From 0c915f4d1766de29f7f14a22752691597fe41236 Mon Sep 17 00:00:00 2001 From: John Mertz Date: Wed, 11 Aug 2021 18:36:36 -0400 Subject: [PATCH] Add a shortcut to (re)start yubioath-desktop --- README.md | 3 ++- rofi/rofi-power-menu.sh | 6 ++++-- rofi/rofi-yubioath.sh | 12 ++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100755 rofi/rofi-yubioath.sh diff --git a/README.md b/README.md index 60f4ce5..f334947 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ Quick VPN switcher. [**rofi/rofi-power-menu.sh**](https://git.john.me.tz/jpm/scripts/src/branch/master/rofi/rofi-power-menu.sh) -Lock, log out, restart Sway/i3, restart waybar, hibernate, reboot, shutdown. +Lock, toggle displays, reload yubico authenticator, log out, restart Sway/i3, +reload waybar, hibernate, reboot, shutdown. [**rofi/rofi-send-to-kodi.sh**](https://git.john.me.tz/jpm/scripts/src/branch/master/rofi/rofi-send-to-kodi.sh) diff --git a/rofi/rofi-power-menu.sh b/rofi/rofi-power-menu.sh index 03124d4..ba7eed7 100755 --- a/rofi/rofi-power-menu.sh +++ b/rofi/rofi-power-menu.sh @@ -12,17 +12,19 @@ fi if [[ $WM == 'i3' ]]; then res=$(printf "🔒 Lock|↩ Logout|↻ Reload i3|↹ Restart i3|↯ Hibernate|🡙 Reboot|⏻ Shutdown" | rofi -sep "|" -dmenu -i -p 'Power: ' "" -columns 1 -rows 7 -width 32 -l 1 -hide-scrollbar -eh 1 -location 0 -padding 12 -opacity 100 -auto-select -no-fullscreen) else - res=$(echo "🔒 Lock|🖵 Toggle Displays|↩ Logout|↻ Reload Sway|↻ Reload Waybar|↯ Hibernate|🡙 Reboot|⏻ Shutdown" | rofi -sep "|" -dmenu -i -p 'Power: ' "" -no-lazy-grab -auto-select -no-fullscreen) + res=$(echo "🔒 Lock|🖵 Toggle Displays|⚿ Yubico Authenticator|↻ Reload Sway|↻ Reload Waybar|↩ Logout|↯ Hibernate|🡙 Reboot|⏻ Shutdown" | rofi -sep "|" -dmenu -i -p 'Power: ' "" -no-lazy-grab -auto-select -no-fullscreen) fi if [ "$res" == "🔒 Lock" ]; then - ${WM}lock -c 323232 + ${WM}lock -c 1D2021 elif [ "$res" == "↩ Logout" ]; then # Prevent auto-login rm /home/jpm/.config/last_login_gui ${WM} exit elif [ "$res" == "🖵 Toggle Displays" ]; then /home/jpm/scripts/sway/toggle_outputs.sh +elif [ "$res" == "⚿ Yubico Authenticator" ]; then + /home/jpm/scripts/rofi/rofi-yubioath.sh elif [ "$res" == "↻ Reload i3" ]; then i3 reload elif [ "$res" == "↹ Restart i3" ]; then diff --git a/rofi/rofi-yubioath.sh b/rofi/rofi-yubioath.sh new file mode 100755 index 0000000..04467b5 --- /dev/null +++ b/rofi/rofi-yubioath.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +RUNNING=$(pgrep yubioath-deskto) + +if [ "$RUNNING" ]; then + kill $RUNNING + sudo systemctl stop pcscd.socket + sudo systemctl restart pcscd.service + sudo systemctl start pcscd.socket +fi + +QT_QPA_PLATFORMTHEME=qt5ct QT_QPA_PLATFORM=wayland QT_PLUGIN_PATH=/usr/lib/qt/plugins /usr/bin/yubioath-desktop &