Rofi Menu Back and Quit Options & Startup Script in Control Center

- Add startup processes script to control center
- Add a "back" and "quit" rofi menu option where back exits
  current menu, leaving the option to return to previous
  menu that called it. Quit kills all rofi processes.
This commit is contained in:
Sravan Balaji
2021-08-19 17:34:23 -04:00
parent ac230e958e
commit 3846f5f516
11 changed files with 107 additions and 22 deletions

View File

@@ -15,15 +15,19 @@ rofi_menu() {
" Notifications - deadd"
" Media - playerctl"
"墳Volume - pactl"
" Startup Processes - startup"
" Hardware - system76-power"
" Power Menu - session"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -49,6 +53,9 @@ main() {
--pactl)
/home/sravan/.scripts/pactl.sh --rofi
;;
--startup)
/home/sravan/.scripts/startup.sh --rofi
;;
--system76-power)
/home/sravan/.scripts/system76-power.sh --rofi
;;

View File

@@ -27,13 +27,16 @@ rofi_menu() {
" Toggle Notification Center - toggle-center"
" Pause Popup Notifications - pause"
" Unpause Popup Notifications - unpause"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}

View File

@@ -29,13 +29,16 @@ rofi_menu() {
" Close Notification - close"
" View History - history"
" Toggle Do Not Disturb - dnd"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}

View File

@@ -15,13 +15,16 @@ rofi_menu() {
" Lower Volume - lower"
" Mute - mute"
" Mixer - mixer"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}

View File

@@ -20,13 +20,16 @@ rofi_menu() {
"⏼ Toggle - toggle"
" Turn On - on"
" Turn Off - off"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}

View File

@@ -15,13 +15,16 @@ rofi_menu() {
"怜 Next - next"
"玲 Previous - prev"
" Change Source - change"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}

View File

@@ -18,13 +18,16 @@ rofi_menu() {
" Reboot - reboot"
" Shutdown - shutdown"
"鈴 Hibernate - hibernate"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && killall rofi
fi
}

View File

@@ -65,13 +65,16 @@ rofi_menu() {
"羽 Launch Delayed Processes - delay"
" Kill Startup Processes - kill-startup"
" Kill Delayed Processes - kill-delay"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}

View File

@@ -13,13 +13,16 @@ rofi_menu() {
declare -a options=(
" Switchable Graphics - rofi-graphics"
" Performance Profile - rofi-profile"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -31,13 +34,16 @@ rofi_graphics_menu() {
"Switch to Hybrid Mode - graphics-hybrid"
"Switch to Integrated Mode - graphics-integrated"
"Switch to Nvidia Mode - graphics-nvidia"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi-graphics"
fi
}
@@ -48,13 +54,16 @@ rofi_profile_menu() {
"Switch to Battery Mode - profile-battery"
"Switch to Balanced Mode - profile-balanced"
"Switch to Performance Mode - profile-performance"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi-profile"
fi
}

11
.scripts/trackpad.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
trackpad_id=13
if xinput list-props $trackpad_id | grep "Device Enabled (.*):.*1" >/dev/null
then
xinput disable $trackpad_id
notify-send -u low -i mouse "Trackpad disabled"
else
xinput enable $trackpad_id
notify-send -u low -i mouse "Trackpad enabled"
fi

View File

@@ -661,13 +661,16 @@ Pull and update submodules
" Close Notification - close"
" View History - history"
" Toggle Do Not Disturb - dnd"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -1156,13 +1159,16 @@ Each label is represented as a clickable button in the notification center. The
" Toggle Notification Center - toggle-center"
" Pause Popup Notifications - pause"
" Unpause Popup Notifications - unpause"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -2654,13 +2660,16 @@ See [[https://github.com/phillipberndt/autorandr#hook-scripts][autorandr hook sc
"⏼ Toggle - toggle"
" Turn On - on"
" Turn Off - off"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -7200,13 +7209,16 @@ Configuration for Alacritty, the GPU enhanced terminal emulator.
"怜 Next - next"
"玲 Previous - prev"
" Change Source - change"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -7261,13 +7273,16 @@ Configuration for Alacritty, the GPU enhanced terminal emulator.
" Lower Volume - lower"
" Mute - mute"
" Mixer - mixer"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -7335,13 +7350,16 @@ Configuration for Alacritty, the GPU enhanced terminal emulator.
declare -a options=(
" Switchable Graphics - rofi-graphics"
" Performance Profile - rofi-profile"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -7353,13 +7371,16 @@ Configuration for Alacritty, the GPU enhanced terminal emulator.
"Switch to Hybrid Mode - graphics-hybrid"
"Switch to Integrated Mode - graphics-integrated"
"Switch to Nvidia Mode - graphics-nvidia"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi-graphics"
fi
}
@@ -7370,13 +7391,16 @@ Configuration for Alacritty, the GPU enhanced terminal emulator.
"Switch to Battery Mode - profile-battery"
"Switch to Balanced Mode - profile-balanced"
"Switch to Performance Mode - profile-performance"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi-profile"
fi
}
@@ -7468,13 +7492,16 @@ Configuration for Alacritty, the GPU enhanced terminal emulator.
" Reboot - reboot"
" Shutdown - shutdown"
"鈴 Hibernate - hibernate"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && killall rofi
fi
}
@@ -7595,13 +7622,16 @@ Configuration for Alacritty, the GPU enhanced terminal emulator.
"羽 Launch Delayed Processes - delay"
" Kill Startup Processes - kill-startup"
" Kill Delayed Processes - kill-delay"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -7708,15 +7738,19 @@ These are scripts that should be run from Lutris when launching or exiting a gam
" Notifications - deadd"
" Media - playerctl"
"墳Volume - pactl"
" Startup Processes - startup"
" Hardware - system76-power"
" Power Menu - session"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" != "quit" ]]; then
if [[ "$option" == "quit" ]]; then
kilall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && main "--rofi"
fi
}
@@ -7742,6 +7776,9 @@ These are scripts that should be run from Lutris when launching or exiting a gam
--pactl)
/home/sravan/.scripts/pactl.sh --rofi
;;
--startup)
/home/sravan/.scripts/startup.sh --rofi
;;
--system76-power)
/home/sravan/.scripts/system76-power.sh --rofi
;;