yubikey-touch-detector can now properly use Notify widget without helpers.

This commit is contained in:
Bartek Stalewski 2022-11-07 00:05:36 +01:00
parent f340ed7c15
commit 00a2734c84
8 changed files with 5 additions and 20 deletions

View file

@ -47,7 +47,7 @@ show_current() {
chosen=$(printf "Output: $def_snk\\nInput: $def_src" | dmenu -c -l 2) chosen=$(printf "Output: $def_snk\\nInput: $def_src" | dmenu -c -l 2)
if [ "$1" = "no_switch" ]; then if [ "$1" = "no_switch" ]; then
case "$chosen" in case "$chosen" in
*) notify-send -u critical "婢 no device to switch" ;; *) notify-send -t 2000 -u critical "婢 no device to switch" ;;
esac esac
else else
case "$chosen" in case "$chosen" in

View file

@ -51,7 +51,7 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
# If there's only one screen # If there's only one screen
[ "$(echo "$screens" | wc -l)" -lt 2 ] && [ "$(echo "$screens" | wc -l)" -lt 2 ] &&
{ onescreen "$screens" "native"; postrun; notify-send -u critical ' no device to switch'; exit ;} { onescreen "$screens" "native"; postrun; notify-send -t 2000 -u critical ' no device to switch'; exit ;}
# Get user choice including both and manual selection: # Get user choice including both and manual selection:
chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i -p "select output") && chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i -p "select output") &&

View file

@ -7,5 +7,5 @@ if [ -n "$1" ]; then
xdotool type "$chosen" xdotool type "$chosen"
else else
printf "$chosen" | xclip -rmlastnl printf "$chosen" | xclip -rmlastnl
notify-send "'$chosen' copied to clipboard" & notify-send -t 2000 "'$chosen' copied to clipboard" &
fi fi

View file

@ -6,7 +6,7 @@ if [ $1 ]; then
dec) pactl set-sink-volume @DEFAULT_SINK@ -5%;; dec) pactl set-sink-volume @DEFAULT_SINK@ -5%;;
esac esac
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}') volume=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk -F' / *' '{print $2}')
notify-send -u low "volume: $volume" notify-send -t 2000 -u low "volume: $volume"
else else
mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%') mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%')
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micmute="\uf131" || micmute="" [ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micmute="\uf131" || micmute=""

View file

@ -1,6 +0,0 @@
#!/bin/sh
case $(cat $XDG_CACHE_HOME/yubikey.status) in
*_1) printf "touch the yubikey" ;;
*) printf "" ;;
esac

View file

@ -1,3 +0,0 @@
#!/bin/sh
yubikey-touch-detector --stdout 2>/dev/null| while read cmd; do echo $cmd > $XDG_CACHE_HOME/yubikey.status; done

View file

@ -127,16 +127,10 @@ screens = [
record_history=False, record_history=False,
), ),
widget.Spacer(), widget.Spacer(),
widget.GenPollCommand( widget.Notify(
background='#e8b923', background='#e8b923',
foreground='#000000', foreground='#000000',
font='RobotoMono Nerd Font Bold', font='RobotoMono Nerd Font Bold',
update_interval=0.5,
cmd="sb-yubikey",
),
widget.Spacer(),
widget.Notify(
default_timeout=2,
), ),
widget.GenPollCommand( widget.GenPollCommand(
background='#005577', background='#005577',