1
0
Fork 0

use wob to display volume and brightness change

This commit is contained in:
Massaki Archambault 2019-09-28 19:38:20 -04:00
parent d902ee6e76
commit a4ccd9e79c
6 changed files with 19 additions and 14 deletions

View File

@ -0,0 +1 @@
/home/marchambault/.config/systemd/user/tmux.service

View File

@ -0,0 +1,10 @@
[Unit]
Description=A lightweight overlay volume/backlight/progress/anything bar for Wayland.
PartOf=graphical-session.target
[Service]
Type=simple
ExecStart=/bin/bash -c "exec $HOME/bin/wob"
[Install]
WantedBy=sway-session.target

View File

@ -14,12 +14,7 @@ function get_brightness {
function send_notification {
icon="notification-display-brightness"
brightness=$(get_brightness)
# Make the bar with the special character ─ (it's not dash -)
# https://en.wikipedia.org/wiki/Box-drawing_character
bar=$(seq -s "━" 0 $((brightness / 2)) | sed 's/[0-9]//g')
# Send the notification
dunstify -i "$icon" -r 5555 -u normal " $bar"
echo $(get_brightness) >"$XDG_RUNTIME_DIR/wobpipe"
}
case $1 in

View File

@ -21,14 +21,9 @@ function send_notification {
iconSound="notification-audio-volume-high"
iconMuted="notification-audio-volume-muted"
if is_mute ; then
dunstify -i $iconMuted -r 2593 -u normal ""
echo 0 >"$XDG_RUNTIME_DIR/wobpipe"
else
volume=$(get_volume)
# Make the bar with the special character ─ (it's not dash -)
# https://en.wikipedia.org/wiki/Box-drawing_character
bar=$(seq --separator="━" 0 "$((volume / 2))" | sed 's/[0-9]//g')
# Send the notification
dunstify -i $iconSound -r 2593 -u normal " $bar"
echo "$(get_volume)" >"$XDG_RUNTIME_DIR/wobpipe"
fi
}

4
files/bin/wob Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
mkfifo "$XDG_RUNTIME_DIR/wobpipe"
tail -f "$XDG_RUNTIME_DIR/wobpipe" | /bin/wob

View File

@ -2,9 +2,9 @@
# run units
systemctl --user daemon-reload
systemctl --user enable --now tmux.service
systemctl --user enable --now redshift.service
systemctl --user enable --now swayidle.service
systemctl --user enable --now wob.service
# install tmux plugins
tmux run-shell ~/.tmux/plugins/tpm/bin/install_plugins