{pkgs, ...}: let powermenu-script = pkgs.writeScriptBin "rofi-powermenu" '' #!/usr/bin/env bash dir="$HOME/.config/rofi/powermenu/type-3" theme='style-2' uptime="$(uptime -p | sed -e 's/up //g')" host=$(hostnamectl hostname) shutdown='⛈' reboot='⏻lock' suspend' lock='='sleep' logout='log out' yes='yes' no='no' rofi_cmd() { rofi -dmenu \ -p "Uptime: $uptime" \ -mesg "Uptime: $uptime" \ -theme $dir/$theme.rasi } confirm_cmd() { rofi -dmenu \ -p 'Confirmation' \ -mesg 'Are you Sure?' \ -theme $dir/shared/confirm.rasi } confirm_exit() { echo -e "$yes\n$no" | confirm_cmd } run_rofi() { echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd } run_cmd() { selected="$(confirm_exit)" if [[ "$selected" == "$yes" ]]; then if [[ $1 == '--shutdown' ]]; then systemctl poweroff elif [[ $1 == '--reboot' ]]; then systemctl reboot elif [[ $1 == '--suspend' ]]; then mpc -q pause amixer set Master mute systemctl suspend elif [[ $1 == '--logout' ]]; then if [[ "$DESKTOP_SESSION" == 'niri' ]]; then niri msg quit fi fi else exit 0 fi } chosen="$(run_rofi)" case $chosen in $shutdown) run_cmd --shutdown ;; $reboot) run_cmd --reboot ;; $lock) qs -c noctalia ipc call lockScreen lock ;; $suspend) run_cmd --suspend ;; $logout) run_cmd --logout ;; esac ''; in { users.users.someone.packages = [pkgs.rofi powermenu-script pkgs.nerd-fonts.sauce-code-pro]; }