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 &
xset r rate 300 70 &
setxkbmap en &
dwmblocks &
STATUS_BLOCKS="tray vol mic net bat kbd time date" dwmstatus &
clipmenud &
dunst &
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
# Decreases mic volume by 5%
amixer set Capture 5%-
amixer set Capture 5%- | grep -o -m 1 '[0-9]*%'
MICSTAT="$(micstat)"
notify-send -u low --replace-id=11 "$MICSTAT" 2>/dev/null
kill -45 "$(pidof dwmblocks)" 2>/dev/null
# MICSTAT="$(micstat)"
# notify-send -u low --replace-id=11 "$MICSTAT" 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
# Increases mic volume by 5%
amixer set Capture 5%+
amixer set Capture 5%+ | grep -o -m 1 '[0-9]*%'
MICSTAT="$(micstat)"
notify-send -u low --replace-id=11 "$MICSTAT" 2>/dev/null
kill -45 "$(pidof dwmblocks)" 2>/dev/null
# MICSTAT="$(micstat)"
# notify-send -u low --replace-id=11 "$MICSTAT" 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
VOLSTAT="$(volstat)"
notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null
kill -44 "$(pidof dwmblocks)" 2>/dev/null
# VOLSTAT="$(volstat)"
# notify-send -u low --replace-id=10 "$VOLSTAT" 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
set -- us latam
# Get current layout, and total
current=$(setxkbmap -query | grep layout | cut -d " " -f 6)
total=$(counter=0 ; for layout in "$@" ; do : $((counter+=1)) ; done ; echo "$counter")
current=$(setxkbmap -query | awk '/layout/{ print $2 }')
total="$#"
index=1
# For each layout, find whichever is currently
# selected, and apply the next one
for layout in "$@" ; do
if [ "$layout" = "$current" ] ; then
for l in "$@" ; do
if [ "$l" = "$current" ] ; then
: $((index+=1))
[ "$index" -gt "$total" ] && index=1
setxkbmap $(eval "echo \${${index}}")
@ -21,5 +18,7 @@ for layout in "$@" ; do
: $((index+=1))
done
# Restart statusbar module (dwm & dwmblocks)
kill -46 "$(pidof dwmblocks)"
DWMBLOCKS="$(pidof dwmblocks)"
if [ -n "$DWMBLOCKS" ] ; then
kill -46 "$DWMBLOCKS" 2>/dev/null
fi

View file

@ -1,10 +1,7 @@
#!/bin/sh
# Get current keyboard layout
layout="$( \
setxkbmap -query | grep layout | awk '{print $2}' |
sed 's/latam/la/' \
)"
layout="$(setxkbmap -query | awk '/layout/{ print $2 }' | sed 's/latam/la/')"
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
# (in current default Capture)
# Get volume levels
vol=$(amixer | grep "Capture" | grep -m 1 -o '[0-9]*[0-9]%')
vol="${vol%\%*}" # Remove percentage sign
info=$(amixer get Capture | grep -m 1 '[0-9]*%')
# If device is off (muted), notify mute, print volume otherwise
if amixer scontents | grep "Capture" | grep -q "\[off\]"; then echo "󰍭 ──────────" && exit ; fi
if [ -z "${info##*\[off\]}" ] ; then
echo "󰍭 ──────────"
exit 0
fi
vol="${info#*\[}"
vol="${vol%%%\]*}"
# Define bar progress with volume
case 1 in
$((vol >= 100)) ) bar="━━━━━━━━━━" ;;
$((vol >= 90)) ) bar="━━━━━━━━━─" ;;
@ -24,5 +26,4 @@ case 1 in
$((vol >= 0)) ) bar="──────────" ;;
esac
# Print and notify
echo "󰍬 $bar"

View file

@ -1,8 +1,9 @@
#!/bin/sh
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/*/*p && systray="$systray 󰕾"
grep -rq 'RUNNING' /proc/asound/*/*c && 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
# (in current default output)
# Get volume level
vol=$(amixer | grep "Playback" | grep -m 1 -o '[0-9]*[0-9]%')
vol="${vol%\%*}" # Remove percentage sign
info=$(amixer get Master | grep -m 1 '[0-9]*%')
# If device is off (muted), notify mute, print volume otherwise
if amixer scontents | grep "Playback" | grep -q "\[off\]"; then echo "󰖁 ──────────" && exit ; fi
if [ -z "${info##*\[off\]}" ] ; then
echo "󰖁 ──────────"
exit 0
fi
vol="${info#*\[}"
vol="${vol%%%\]*}"
# Define bar progress with volume
case 1 in
$((vol >= 100)) ) bar="━━━━━━━━━━" ;;
$((vol >= 90)) ) bar="━━━━━━━━━─" ;;

View file

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