status scripts

This commit is contained in:
tavo 2024-12-28 14:36:59 -06:00
parent 0ebdc2bbd6
commit 52a7798bbe
12 changed files with 96 additions and 51 deletions

View file

@ -22,7 +22,7 @@ dbus-update-activation-environment --systemd --all &
systemctl --user import-environment DISPLAY & systemctl --user import-environment DISPLAY &
xset r rate 300 70 & xset r rate 300 70 &
setxkbmap en & setxkbmap en &
dwmblocks & STATUS_BLOCKS="tray vol mic net bat kbd time date" dwmstatus &
clipmenud & clipmenud &
dunst & dunst &
picom --experimental-backends --animation-for-open-window=zoom & picom --experimental-backends --animation-for-open-window=zoom &

25
scripts/dwm/dwmstatus Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
: "${STATUS_BLOCKS:=tray vol mic net bat kbd mem cpu time date}"
: "${STATUS_PADDING:= }"
while true; do
blocks=""
for i in $STATUS_BLOCKS; do
case $i in
tray) blocks="$blocks$STATUS_PADDING$(systray)" ;;
vol) blocks="$blocks$STATUS_PADDING$(volstat)" ;;
mic) blocks="$blocks$STATUS_PADDING$(micstat)" ;;
net) blocks="$blocks$STATUS_PADDING$(netstat)" ;;
bat) blocks="$blocks$STATUS_PADDING$(batstat)" ;;
kbd) blocks="$blocks$STATUS_PADDING󰌌 $(layoutstat)" ;;
mem) blocks="$blocks$STATUS_PADDING $(memorystat)" ;;
cpu) blocks="$blocks$STATUS_PADDING $(cpustat)" ;;
time) blocks="$blocks$STATUS_PADDING $(date '+%I:%M%p')" ;;
date) blocks="$blocks$STATUS_PADDING $(date '+%a %Y-%m-%d')" ;;
esac
done
xsetroot -name "$blocks"
sleep 1
done

View file

@ -1,8 +1,12 @@
#!/bin/sh #!/bin/sh
# Decreases mic volume by 5% # Decreases mic volume by 5%
amixer set Capture 5%- amixer set Capture 5%- | grep -o -m 1 '[0-9]*%'
MICSTAT="$(micstat)" # MICSTAT="$(micstat)"
notify-send -u low --replace-id=11 "$MICSTAT" 2>/dev/null # notify-send -u low --replace-id=11 "$MICSTAT" 2>/dev/null
kill -45 "$(pidof dwmblocks)" 2>/dev/null
DWMBLOCKS="$(pidof dwmblocks)"
if [ -n "$DWMBLOCKS" ] ; then
kill -45 "$DWMBLOCKS" 2>/dev/null
fi

View file

@ -1,8 +1,12 @@
#!/bin/sh #!/bin/sh
# Increases mic volume by 5% # Increases mic volume by 5%
amixer set Capture 5%+ amixer set Capture 5%+ | grep -o -m 1 '[0-9]*%'
MICSTAT="$(micstat)" # MICSTAT="$(micstat)"
notify-send -u low --replace-id=11 "$MICSTAT" 2>/dev/null # notify-send -u low --replace-id=11 "$MICSTAT" 2>/dev/null
kill -45 "$(pidof dwmblocks)" 2>/dev/null
DWMBLOCKS="$(pidof dwmblocks)"
if [ -n "$DWMBLOCKS" ] ; then
kill -45 "$DWMBLOCKS" 2>/dev/null
fi

View file

@ -3,6 +3,10 @@
amixer -q set Master toggle amixer -q set Master toggle
VOLSTAT="$(volstat)" # VOLSTAT="$(volstat)"
notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null # notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null
kill -44 "$(pidof dwmblocks)" 2>/dev/null
DWMBLOCKS="$(pidof dwmblocks)"
if [ -n "$DWMBLOCKS" ] ; then
kill -44 "$DWMBLOCKS" 2>/dev/null
fi

View file

@ -4,15 +4,12 @@
# Add whatever layouts you want # Add whatever layouts you want
set -- us latam set -- us latam
# Get current layout, and total current=$(setxkbmap -query | awk '/layout/{ print $2 }')
current=$(setxkbmap -query | grep layout | cut -d " " -f 6) total="$#"
total=$(counter=0 ; for layout in "$@" ; do : $((counter+=1)) ; done ; echo "$counter")
index=1 index=1
# For each layout, find whichever is currently for l in "$@" ; do
# selected, and apply the next one if [ "$l" = "$current" ] ; then
for layout in "$@" ; do
if [ "$layout" = "$current" ] ; then
: $((index+=1)) : $((index+=1))
[ "$index" -gt "$total" ] && index=1 [ "$index" -gt "$total" ] && index=1
setxkbmap $(eval "echo \${${index}}") setxkbmap $(eval "echo \${${index}}")
@ -21,5 +18,7 @@ for layout in "$@" ; do
: $((index+=1)) : $((index+=1))
done done
# Restart statusbar module (dwm & dwmblocks) DWMBLOCKS="$(pidof dwmblocks)"
kill -46 "$(pidof dwmblocks)" if [ -n "$DWMBLOCKS" ] ; then
kill -46 "$DWMBLOCKS" 2>/dev/null
fi

View file

@ -1,10 +1,7 @@
#!/bin/sh #!/bin/sh
# Get current keyboard layout # Get current keyboard layout
layout="$( \ layout="$(setxkbmap -query | awk '/layout/{ print $2 }' | sed 's/latam/la/')"
setxkbmap -query | grep layout | awk '{print $2}' |
sed 's/latam/la/' \
)"
echo "$layout" echo "$layout"
notify-send -u low --replace-id=12 "󰌌 Layout" "$layout" # notify-send -u low --replace-id=12 "󰌌 Layout" "$layout"

View file

@ -2,14 +2,16 @@
# Fetch current mic levels # Fetch current mic levels
# (in current default Capture) # (in current default Capture)
# Get volume levels info=$(amixer get Capture | grep -m 1 '[0-9]*%')
vol=$(amixer | grep "Capture" | grep -m 1 -o '[0-9]*[0-9]%')
vol="${vol%\%*}" # Remove percentage sign
# If device is off (muted), notify mute, print volume otherwise if [ -z "${info##*\[off\]}" ] ; then
if amixer scontents | grep "Capture" | grep -q "\[off\]"; then echo "󰍭 ──────────" && exit ; fi echo "󰍭 ──────────"
exit 0
fi
vol="${info#*\[}"
vol="${vol%%%\]*}"
# Define bar progress with volume
case 1 in case 1 in
$((vol >= 100)) ) bar="━━━━━━━━━━" ;; $((vol >= 100)) ) bar="━━━━━━━━━━" ;;
$((vol >= 90)) ) bar="━━━━━━━━━─" ;; $((vol >= 90)) ) bar="━━━━━━━━━─" ;;
@ -24,5 +26,4 @@ case 1 in
$((vol >= 0)) ) bar="──────────" ;; $((vol >= 0)) ) bar="──────────" ;;
esac esac
# Print and notify
echo "󰍬 $bar" echo "󰍬 $bar"

View file

@ -1,8 +1,9 @@
#!/bin/sh #!/bin/sh
systray="" systray=""
ps aux | grep -v grep | grep -q "$HOME/.config/scripts/record" && systray="$systray 󰻃" grep -rq 'RUNNING' /proc/asound/*/*c && systray="$systray "
grep -rq 'RUNNING' /proc/asound/*/*c && systray="$systray " grep -rq 'RUNNING' /proc/asound/*/*p && systray="$systray 󰕾"
grep -rq 'RUNNING' /proc/asound/*/*p && systray="$systray 󰕾"
[ -n "$systray" ] && echo "[$systray ]" if [ -n "$systray" ] ; then
echo "[$systray ]"
fi

View file

@ -2,14 +2,16 @@
# Fetch current audio level # Fetch current audio level
# (in current default output) # (in current default output)
# Get volume level info=$(amixer get Master | grep -m 1 '[0-9]*%')
vol=$(amixer | grep "Playback" | grep -m 1 -o '[0-9]*[0-9]%')
vol="${vol%\%*}" # Remove percentage sign
# If device is off (muted), notify mute, print volume otherwise if [ -z "${info##*\[off\]}" ] ; then
if amixer scontents | grep "Playback" | grep -q "\[off\]"; then echo "󰖁 ──────────" && exit ; fi echo "󰖁 ──────────"
exit 0
fi
vol="${info#*\[}"
vol="${vol%%%\]*}"
# Define bar progress with volume
case 1 in case 1 in
$((vol >= 100)) ) bar="━━━━━━━━━━" ;; $((vol >= 100)) ) bar="━━━━━━━━━━" ;;
$((vol >= 90)) ) bar="━━━━━━━━━─" ;; $((vol >= 90)) ) bar="━━━━━━━━━─" ;;

View file

@ -1,8 +1,12 @@
#!/bin/sh #!/bin/sh
# Decreases volume by 5% # Decreases volume by 5%
amixer set Master 5%- unmute amixer set Master 5%- unmute | grep -o -m 1 '[0-9]*%'
VOLSTAT="$(volstat)" #VOLSTAT="$(volstat)"
notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null #notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null
kill -44 "$(pidof dwmblocks)" 2>/dev/null
DWMBLOCKS="$(pidof dwmblocks)"
if [ -n "$DWMBLOCKS" ] ; then
kill -44 "$DWMBLOCKS" 2>/dev/null
fi

View file

@ -1,8 +1,12 @@
#!/bin/sh #!/bin/sh
# Increases volume by 5% # Increases volume by 5%
amixer set Master 5%+ unmute amixer set Master 5%+ unmute | grep -o -m 1 '[0-9]*%'
VOLSTAT="$(volstat)" #VOLSTAT="$(volstat)"
notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null #notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null
kill -44 "$(pidof dwmblocks)" 2>/dev/null
DWMBLOCKS="$(pidof dwmblocks)"
if [ -n "$DWMBLOCKS" ] ; then
kill -44 "$DWMBLOCKS" 2>/dev/null
fi