feat: rofi power menu
This commit is contained in:
parent
577f8c0f9b
commit
98cf38ea31
4 changed files with 53 additions and 44 deletions
10
README.md
10
README.md
|
@ -36,13 +36,13 @@ The following packages are required for the proper functioning of Hyprland on Vo
|
||||||
<details>
|
<details>
|
||||||
<summary><strong>System Components</strong></summary>
|
<summary><strong>System Components</strong></summary>
|
||||||
|
|
||||||
- dbus
|
- dbus : service
|
||||||
- seatd
|
- seatd : service
|
||||||
- polkit
|
- elogind : service
|
||||||
|
- polkit : service
|
||||||
- polkit-kde-agent
|
- polkit-kde-agent
|
||||||
- elogind
|
- [ly](https://github.com/fairyglade/ly) : service
|
||||||
- mesa-dri
|
- mesa-dri
|
||||||
- [ly](https://github.com/fairyglade/ly) : display manager
|
|
||||||
- pipewire
|
- pipewire
|
||||||
- pipewire-pulse
|
- pipewire-pulse
|
||||||
- pipewire-devel
|
- pipewire-devel
|
||||||
|
|
|
@ -4,7 +4,7 @@ source $HOME/.config/hypr/scripts/env.sh
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
d) exec $rofi_dir/launchers/type-$launcher_type/launcher.sh ;;
|
d) exec $rofi_dir/launchers/type-$launcher_type/launcher.sh ;;
|
||||||
p) exec $rofi_dir/powermenu/type-$powermenu_type/powermenu.sh ;;
|
p) exec $rofi_dir/applets/bin/powermenu.sh ;;
|
||||||
s) exec $rofi_dir/applets/bin/screenshot.sh ;;
|
s) exec $rofi_dir/applets/bin/screenshot.sh ;;
|
||||||
h)
|
h)
|
||||||
echo -e "rofilaunch.sh [action]\nwhere action,"
|
echo -e "rofilaunch.sh [action]\nwhere action,"
|
||||||
|
|
|
@ -10,19 +10,29 @@ source "$HOME"/.config/rofi/applets/shared/theme.bash
|
||||||
theme="$type/$style"
|
theme="$type/$style"
|
||||||
|
|
||||||
# Theme Elements
|
# Theme Elements
|
||||||
prompt="`hostname`"
|
prompt="$(hostname)"
|
||||||
mesg="Uptime : `uptime -p | sed -e 's/up //g'`"
|
mesg="Uptime : $(uptime -p | sed -e 's/up //g')"
|
||||||
|
|
||||||
if [[ ( "$theme" == *'type-1'* ) || ( "$theme" == *'type-3'* ) || ( "$theme" == *'type-5'* ) ]]; then
|
if [[ "$theme" == *'type-1'* ]]; then
|
||||||
list_col='1'
|
list_col='1'
|
||||||
list_row='6'
|
list_row='5'
|
||||||
elif [[ ( "$theme" == *'type-2'* ) || ( "$theme" == *'type-4'* ) ]]; then
|
win_width='400px'
|
||||||
list_col='6'
|
elif [[ "$theme" == *'type-3'* ]]; then
|
||||||
|
list_col='1'
|
||||||
|
list_row='5'
|
||||||
|
win_width='120px'
|
||||||
|
elif [[ "$theme" == *'type-5'* ]]; then
|
||||||
|
list_col='1'
|
||||||
|
list_row='5'
|
||||||
|
win_width='520px'
|
||||||
|
elif [[ ("$theme" == *'type-2'*) || ("$theme" == *'type-4'*) ]]; then
|
||||||
|
list_col='5'
|
||||||
list_row='1'
|
list_row='1'
|
||||||
|
win_width='670px'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
layout=`cat ${theme} | grep 'USE_ICON' | cut -d'=' -f2`
|
layout=$(cat ${theme} | grep 'USE_ICON' | cut -d'=' -f2)
|
||||||
if [[ "$layout" == 'NO' ]]; then
|
if [[ "$layout" == 'NO' ]]; then
|
||||||
option_1=" Lock"
|
option_1=" Lock"
|
||||||
option_2=" Logout"
|
option_2=" Logout"
|
||||||
|
@ -45,7 +55,8 @@ fi
|
||||||
|
|
||||||
# Rofi CMD
|
# Rofi CMD
|
||||||
rofi_cmd() {
|
rofi_cmd() {
|
||||||
rofi -theme-str "listview {columns: $list_col; lines: $list_row;}" \
|
rofi -theme-str "window {width: $win_width;}" \
|
||||||
|
-theme-str "listview {columns: $list_col; lines: $list_row;}" \
|
||||||
-theme-str 'textbox-prompt-colon {str: "";}' \
|
-theme-str 'textbox-prompt-colon {str: "";}' \
|
||||||
-dmenu \
|
-dmenu \
|
||||||
-p "$prompt" \
|
-p "$prompt" \
|
||||||
|
@ -56,7 +67,7 @@ rofi_cmd() {
|
||||||
|
|
||||||
# Pass variables to rofi dmenu
|
# Pass variables to rofi dmenu
|
||||||
run_rofi() {
|
run_rofi() {
|
||||||
echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6" | rofi_cmd
|
echo -e "$option_1\n$option_2\n$option_3\n$option_5\n$option_6" | rofi_cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
# Confirmation CMD
|
# Confirmation CMD
|
||||||
|
@ -78,52 +89,51 @@ confirm_exit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Confirm and execute
|
# Confirm and execute
|
||||||
confirm_run () {
|
confirm_run() {
|
||||||
selected="$(confirm_exit)"
|
selected="$(confirm_exit)"
|
||||||
if [[ "$selected" == "$yes" ]]; then
|
if [[ "$selected" == "$yes" ]]; then
|
||||||
${1} && ${2} && ${3}
|
${1} && ${2} && ${3}
|
||||||
else
|
else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute Command
|
# Execute Command
|
||||||
run_cmd() {
|
run_cmd() {
|
||||||
if [[ "$1" == '--opt1' ]]; then
|
if [[ "$1" == '--opt1' ]]; then
|
||||||
betterlockscreen -l
|
swaylock
|
||||||
elif [[ "$1" == '--opt2' ]]; then
|
elif [[ "$1" == '--opt2' ]]; then
|
||||||
confirm_run 'kill -9 -1'
|
confirm_run 'kill -9 -1'
|
||||||
elif [[ "$1" == '--opt3' ]]; then
|
elif [[ "$1" == '--opt3' ]]; then
|
||||||
confirm_run 'mpc -q pause' 'amixer set Master mute' 'systemctl suspend'
|
confirm_run 'mpc -q pause' 'amixer set Master mute' 'systemctl suspend'
|
||||||
elif [[ "$1" == '--opt4' ]]; then
|
elif [[ "$1" == '--opt4' ]]; then
|
||||||
confirm_run 'systemctl hibernate'
|
confirm_run 'loginctl hibernate'
|
||||||
elif [[ "$1" == '--opt5' ]]; then
|
elif [[ "$1" == '--opt5' ]]; then
|
||||||
confirm_run 'systemctl reboot'
|
confirm_run 'loginctl reboot'
|
||||||
elif [[ "$1" == '--opt6' ]]; then
|
elif [[ "$1" == '--opt6' ]]; then
|
||||||
confirm_run 'systemctl poweroff'
|
confirm_run 'loginctl poweroff'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Actions
|
# Actions
|
||||||
chosen="$(run_rofi)"
|
chosen="$(run_rofi)"
|
||||||
case ${chosen} in
|
case ${chosen} in
|
||||||
$option_1)
|
$option_1)
|
||||||
run_cmd --opt1
|
run_cmd --opt1
|
||||||
;;
|
;;
|
||||||
$option_2)
|
$option_2)
|
||||||
run_cmd --opt2
|
run_cmd --opt2
|
||||||
;;
|
;;
|
||||||
$option_3)
|
$option_3)
|
||||||
run_cmd --opt3
|
run_cmd --opt3
|
||||||
;;
|
;;
|
||||||
$option_4)
|
$option_4)
|
||||||
run_cmd --opt4
|
run_cmd --opt4
|
||||||
;;
|
;;
|
||||||
$option_5)
|
$option_5)
|
||||||
run_cmd --opt5
|
run_cmd --opt5
|
||||||
;;
|
;;
|
||||||
$option_6)
|
$option_6)
|
||||||
run_cmd --opt6
|
run_cmd --opt6
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ window {
|
||||||
location: center;
|
location: center;
|
||||||
anchor: center;
|
anchor: center;
|
||||||
fullscreen: false;
|
fullscreen: false;
|
||||||
width: 800px;
|
|
||||||
x-offset: 0px;
|
x-offset: 0px;
|
||||||
y-offset: 0px;
|
y-offset: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|
Loading…
Add table
Reference in a new issue