removed old reduntant script and improved formatting and readability of new one

This commit is contained in:
Schrottkatze 2022-09-11 20:21:54 +02:00
parent dc7456b68d
commit 7c00a36f2f
2 changed files with 31 additions and 47 deletions

View file

@ -1,21 +0,0 @@
items="lock screen;log out;toggle picom;shut down;reboot;update all"
selection=$(echo $items | rofi -sep ";" -dmenu)
case $selection in
"lock screen")
i3lock-fancy
;;
"log out")
pkill i3
;;
"toggle picom")
pkill picom || picom --experimental-backend -b
;;
"shut down")
shutdown now
;;
"reboot")
systemctl reboot
;;
esac

View file

@ -1,30 +1,35 @@
{ pkgs, ... }: { pkgs, ... }:
pkgs.writeShellScriptBin "desktopctl" '' pkgs.writeShellScriptBin "desktopctl" ''
case $@ in case $@ in
"Lock Screen") "Lock Screen")
nohup sh -c "i3lock-fancy" > /dev/null & nohup sh -c "i3lock-fancy" > /dev/null &
exit 0 exit 0
;; ;;
"Log Out") "Log Out")
pkill i3 pkill i3
exit 0 exit 0
;; ;;
"Shut Down") "Shut Down")
shutdown now shutdown now
exit 0 exit 0
;; ;;
"Reboot") "Reboot")
systemctl reboot systemctl reboot
exit 0 exit 0
;; ;;
esac esac
echo -en "\0theme\x1flistview,inputbar,message{columns:4;lines:1;}\n" # resizes grid
echo -en "\0theme\x1fwindow{width:800px;location:north;y-offset:24px;border-radius:0 0 12px 12px;}\n" echo -en "\0theme\x1flistview,inputbar,message{columns:4;lines:1;}\n"
echo -en "\0theme\x1fmainbox{children:[listview,inputbar];}\n" # resizes window, moves it to top of screen, adjusts rounded corners
echo -en "\0theme\x1finputbar{margin:0;}\n" echo -en "\0theme\x1fwindow{width:800px;location:north;y-offset:24px;border-radius:0 0 12px 12px;}\n"
echo -en "Lock Screen\0icon\x1f${../../other/assets/desktopctl/lock-screen.svg}\n" # swaps grid and input bar
echo -en "Log Out\0icon\x1f${../../other/assets/desktopctl/logout.svg}\n" echo -en "\0theme\x1fmainbox{children:[listview,inputbar];}\n"
echo -en "Shut Down\0icon\x1f${../../other/assets/desktopctl/shutdown.svg}\n" # fixes brown line below input bar
echo -en "Reboot\0icon\x1f${../../other/assets/desktopctl/reboot.svg}\n" echo -en "\0theme\x1finputbar{margin:0;}\n"
echo -en "Lock Screen\0icon\x1f${../../other/assets/desktopctl/lock-screen.svg}\n"
echo -en "Log Out\0icon\x1f${../../other/assets/desktopctl/logout.svg}\n"
echo -en "Shut Down\0icon\x1f${../../other/assets/desktopctl/shutdown.svg}\n"
echo -en "Reboot\0icon\x1f${../../other/assets/desktopctl/reboot.svg}\n"
'' ''