#!/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