OSDN Git Service

make instantshutdown scriptable
authorpaperbenni <paperbenni@gmail.com>
Thu, 10 Dec 2020 16:09:51 +0000 (17:09 +0100)
committerpaperbenni <paperbenni@gmail.com>
Thu, 10 Dec 2020 16:09:51 +0000 (17:09 +0100)
autostart.sh
programs/instantshutdown

index 578627e..33e88f2 100755 (executable)
@@ -210,6 +210,9 @@ if ! islive; then
         fi
 
         pkill zenity
+        if imenu -c 'some settings need a reboot to be applied. reboot now?'; then
+            instantshutdown reboot
+        fi
     fi
 
     cd ~/instantos || exit 1
index 8386391..68a6045 100755 (executable)
@@ -11,13 +11,17 @@ if [ "$(pgrep instantshutdown | wc -l)" -gt 2 ]; then
     exit
 fi
 
-answer="$(echo 'cancel
+if [ -z "$1" ]; then
+    answer="$1"
+else
+    answer="$(echo 'cancel
 shutdown
 logout
 reboot
 lock screen
 suspend
 restart wm' | instantmenu -l 10 -w -1 -c -n -F -p 'shutdown menu' -q 'select')"
+fi
 
 # if there are apps open, ask for confirmation
 zconfirm() {
@@ -35,11 +39,10 @@ zconfirm() {
     fi
 }
 
-prepareshutdown(){
+prepareshutdown() {
     # save current brightness
     touch /tmp/shuttingdown
-    if CURBRIGHT="$(/usr/share/instantassist/utils/b.sh g)"
-    then
+    if CURBRIGHT="$(/usr/share/instantassist/utils/b.sh g)"; then
         iconf savebright "$CURBRIGHT"
     fi