add scripts

This commit is contained in:
cho
2023-05-03 21:19:35 +07:00
parent 52a68ee195
commit 27722d1154
24 changed files with 717 additions and 0 deletions

28
home/default/.local/bin/sysact Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
# A dmenu wrapper script for system functions.
export WM=$XDG_CURRENT_DESKTOP
case "$(readlink -f /sbin/init)" in
*systemd*) ctl='systemctl' ;;
*) ctl='loginctl' ;;
esac
case "$(printf "🔒 lock\n🚪 leave $WM\n♻ renew\n🐻 hibernate\n🔃 reboot\n🖥 shutdown\n💤 sleep\n📺 display off\n set background\n start idle\n kill swayidle\n fcitx5\n kill fcitx5" | dmenu -i -l 12 -p 'Action: ')" in
'🔒 lock')
setsid -f swaylock
setsid -f sleep 2 && swayidle -w timeout 1 'wlopm --off "*"' resume 'wlopm --on "*" && kill $#'
;;
"🚪 leave $WM") swaymsg exit ;;
"♻️ renew") swaymsg reload ;;
'🐻 hibernate') $ctl hibernate -i ;;
'💤 sleep') $ctl suspend -i ;;
'🔃 reboot') $ctl reboot -i ;;
'🖥️ shutdown') $ctl poweroff -i ;;
'📺 display off') swayidle -w timeout 1 'wlopm --off "*"' resume 'wlopm --on "*" && kill $#' ;;
' set background') change-background ;;
' start idle') idle ;;
' kill swayidle') killall swayidle ;;
' fcitx5') fcitx5 ;;
' kill fcitx5') killall fcitx5 ;;
*) exit 1 ;;
esac