Detect Windows boot option for lock.sh pick menu

This commit is contained in:
Adam Goldsmith 2024-05-10 13:06:50 -04:00
parent 44846433f1
commit 6dcca8d94f

View File

@ -47,7 +47,11 @@ case "$1" in
systemctl poweroff
;;
pick)
$0 "$(echo -e 'lock\nlogout\nsuspend\nhibernate\nreboot\nreboot to Windows\nshutdown' | rofi -dmenu -i)"
if jc efibootmgr | jq -e '.boot_options|any(.display_name == "Windows Boot Manager")'
then
extra_reboot_options="reboot to Windows\n"
fi
$0 "$(echo -e 'lock\nlogout\nsuspend\nhibernate\nreboot\n'"${extra_reboot_options}shutdown" | rofi -dmenu -i)"
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|reboot to Windows|shutdown|pick}"