diff --git a/.config/i3/lock.sh b/.config/i3/lock.sh index de863e3..cea9f8c 100755 --- a/.config/i3/lock.sh +++ b/.config/i3/lock.sh @@ -43,6 +43,9 @@ case "$1" in "reboot to Windows") sudo refind-next-boot 'Microsoft' && systemctl reboot ;; + "reboot to MacOS") + sudo refind-next-boot 'macOS' && systemctl reboot + ;; shutdown) systemctl poweroff ;; @@ -51,10 +54,15 @@ case "$1" in then extra_reboot_options="reboot to Windows\n" fi + if jc efibootmgr | jq -e '.boot_options|any(.display_name == "Mac OS X")' + then + extra_reboot_options="${extra_reboot_options}reboot to MacOS\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}" + echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|reboot to MacOS|shutdown|pick}" exit 2 ;; esac