power menu, redshift, polybar

This commit is contained in:
azpsen
2024-01-28 16:37:10 -06:00
parent 89516a6ce1
commit 319b44ecbd
307 changed files with 7642 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
# Script: pulseaudio-tail
A script to control PulseAudio.
The script uses polybar's tail function to display the adjustments in real time. Please note that there is already a polybar module [`pulseaudio`](https://github.com/jaagr/polybar/wiki/Module:-pulseaudio) for this task.
## Dependencies
* `pamixer`
Maybe `pavucontrol` is a good idea. In the example it is opened with a right mouse click.
## Module
```ini
[module/pulseaudio-tail]
type = custom/script
exec = ~/polybar-scripts/pulseaudio-tail.sh
tail = true
click-right = exec pavucontrol &
click-left = ~/polybar-scripts/pulseaudio-tail.sh --mute &
scroll-up = ~/polybar-scripts/pulseaudio-tail.sh --up &
scroll-down = ~/polybar-scripts/pulseaudio-tail.sh --down &
```

View File

@@ -0,0 +1,66 @@
#!/bin/sh
update_sink() {
sink=$(pacmd list-sinks | sed -n '/\* index:/ s/.*: //p')
}
volume_up() {
update_sink
pactl set-sink-volume "$sink" +1%
}
volume_down() {
update_sink
pactl set-sink-volume "$sink" -1%
}
volume_mute() {
update_sink
pactl set-sink-mute "$sink" toggle
}
volume_print() {
update_sink
active_port=$(pacmd list-sinks | sed -n "/index: $sink/,/index:/p" | grep active)
if echo "$active_port" | grep -q speaker; then
icon="#1"
elif echo "$active_port" | grep -q headphones; then
icon="#2"
else
icon="#3"
fi
muted=$(pamixer --sink "$sink" --get-mute)
if [ "$muted" = true ]; then
echo "$icon --"
else
echo "$icon $(pamixer --sink "$sink" --get-volume)"
fi
}
listen() {
volume_print
pactl subscribe | while read -r event; do
if echo "$event" | grep -qv "Client"; then
volume_print
fi
done
}
case "$1" in
--up)
volume_up
;;
--down)
volume_down
;;
--mute)
volume_mute
;;
*)
listen
;;
esac