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 { function send_notification {
icon="notification-display-brightness" icon="notification-display-brightness"
brightness=$(get_brightness) echo $(get_brightness) >"$XDG_RUNTIME_DIR/wobpipe"
# 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"
} }
case $1 in case $1 in

View File

@ -21,14 +21,9 @@ function send_notification {
iconSound="notification-audio-volume-high" iconSound="notification-audio-volume-high"
iconMuted="notification-audio-volume-muted" iconMuted="notification-audio-volume-muted"
if is_mute ; then if is_mute ; then
dunstify -i $iconMuted -r 2593 -u normal "" echo 0 >"$XDG_RUNTIME_DIR/wobpipe"
else else
volume=$(get_volume) echo "$(get_volume)" >"$XDG_RUNTIME_DIR/wobpipe"
# 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"
fi 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 # run units
systemctl --user daemon-reload systemctl --user daemon-reload
systemctl --user enable --now tmux.service
systemctl --user enable --now redshift.service systemctl --user enable --now redshift.service
systemctl --user enable --now swayidle.service systemctl --user enable --now swayidle.service
systemctl --user enable --now wob.service
# install tmux plugins # install tmux plugins
tmux run-shell ~/.tmux/plugins/tpm/bin/install_plugins tmux run-shell ~/.tmux/plugins/tpm/bin/install_plugins