From 0738f48d8f3b2d9e563b1c73ddcfe537ae1df97d Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 10 Jun 2024 15:23:47 -0400 Subject: [PATCH] Add "reboot to MacOS" option in lock.sh when detected --- .config/i3/lock.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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