theme selector and powermenu
This commit is contained in:
parent
83e8e09329
commit
867117f297
2 changed files with 17 additions and 4 deletions
|
@ -1,10 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Define options
|
# Define options
|
||||||
options="Shutdown\nRestart\nSuspend\nLock"
|
options="Shutdown\nRestart\nSuspend\nLogout\nLock"
|
||||||
|
|
||||||
# Prompt user to select an option using Rofi
|
# Prompt user to select an option using Rofi
|
||||||
selected_option=$(echo -e "$options" | rofi -dmenu -p "Power Menu")
|
selected_option=$(echo -e "$options" | rofi -dmenu -p "Power Menu" -lines 6 -theme-str 'configuration {show-icons: false;} entry {placeholder: "Choose..."}')
|
||||||
|
|
||||||
|
if [ -z "$selected_option" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Function to display confirmation dialog
|
# Function to display confirmation dialog
|
||||||
confirm_action() {
|
confirm_action() {
|
||||||
|
@ -32,6 +36,14 @@ case $selected_option in
|
||||||
"Suspend")
|
"Suspend")
|
||||||
systemctl suspend
|
systemctl suspend
|
||||||
;;
|
;;
|
||||||
|
"Logout")
|
||||||
|
confirmation=$(confirm_action "Logout?")
|
||||||
|
if [ "$confirmation" == "Yes" ]; then
|
||||||
|
i3-msg exit
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
"Lock")
|
"Lock")
|
||||||
i3-msg exit
|
i3-msg exit
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -10,8 +10,9 @@ theme_options=(
|
||||||
|
|
||||||
# rofi script to get what theme to use
|
# rofi script to get what theme to use
|
||||||
chosen=$(printf '%s\n' "${theme_options[@]}" | rofi -dmenu -p "Theme" -theme-str "configuration {show-icons:false;}")
|
chosen=$(printf '%s\n' "${theme_options[@]}" | rofi -dmenu -p "Theme" -theme-str "configuration {show-icons:false;}")
|
||||||
if [[ $chosen == "-" ]]; then
|
|
||||||
exit 1
|
if [[ $chosen == "" ]]; then
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
theme=$(echo "${chosen}" | rev | cut -d- -f2- | rev)
|
theme=$(echo "${chosen}" | rev | cut -d- -f2- | rev)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue