aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr
diff options
context:
space:
mode:
authorJa.KooLit <jimmielovejay@gmail.com>2023-11-25 18:22:35 +0900
committerGitHub <noreply@github.com>2023-11-25 18:22:35 +0900
commitfbf04572b4ed8867da3c96551b25261401364be0 (patch)
tree3511ed6e62c843f08da4d23d2cb89e010ed7a40e /config/hypr
parent46d00a7892f88485e39993985efbafb6ddf96cc3 (diff)
parent2ad7b840f7f2b06992c875b6e3d5089ec0e86490 (diff)
Merge pull request #32 from darkeddie/main
Rofi Power Menu
Diffstat (limited to 'config/hypr')
-rw-r--r--config/hypr/configs/Keybinds.conf2
-rwxr-xr-xconfig/hypr/scripts/RofiPower.sh67
2 files changed, 68 insertions, 1 deletions
diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf
index c072b4d7..26a32f55 100644
--- a/config/hypr/configs/Keybinds.conf
+++ b/config/hypr/configs/Keybinds.conf
@@ -30,7 +30,7 @@ bind = $mainMod, Q, killactive,
bind = $mainMod, Return, exec, $term
bind = $mainMod, T, exec, $files
bind = CTRL ALT, L, exec, $scriptsDir/LockScreen.sh
-bind = CTRL ALT, P, exec, $scriptsDir/Wlogout.sh
+bind = CTRL ALT, P, exec, $scriptsDir/RofiPower.sh
bind = $mainMod CTRL, S, exec, $scriptsDir/RofiBeats.sh
bind = $mainMod ALT, E, exec, $scriptsDir/RofiEmoji.sh
bind = $mainMod, H, exec, $scriptsDir/KeyHints.sh
diff --git a/config/hypr/scripts/RofiPower.sh b/config/hypr/scripts/RofiPower.sh
new file mode 100755
index 00000000..84d86433
--- /dev/null
+++ b/config/hypr/scripts/RofiPower.sh
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+
+SwayLock=$HOME/.config/hypr/scripts/LockScreen.sh
+
+# CMDs
+uptime_info=$(uptime -p | sed -e 's/up //g')
+host=$(hostnamectl hostname)
+
+# Options with Icons and Text
+options=("Lock(l)" "Suspend(u)" "Logout(e)" "Reboot(r)" "Shutdown(s)" "Hibernate(h)")
+icons=("" "" "󰿅" "󱄌" "" "󰒲")
+
+# Rofi CMD
+rofi_cmd() {
+ options_with_icons=()
+ for ((i = 0; i < ${#options[@]}; i++)); do
+ options_with_icons+=("${icons[$i]} ${options[$i]}")
+ done
+
+ chosen_option=$(printf "%s\n" "${options_with_icons[@]}" | \
+ rofi -dmenu -i -p " $USER@$host" -mesg " Uptime: $uptime_info" \
+ -kb-select-1 "l" \
+ -kb-select-2 "u" \
+ -kb-select-3 "e" \
+ -kb-select-4 "r" \
+ -kb-select-5 "s" \
+ -kb-select-6 "h" \
+ -theme ~/.config/rofi/config-powermenu.rasi | awk '{print $1}')
+ echo "$chosen_option"
+}
+
+# Pass variables to rofi dmenu
+run_rofi() {
+ chosen_option=$(rofi_cmd)
+ echo "$chosen_option"
+}
+
+# Execute Command
+run_cmd() {
+ case $1 in
+ "")
+ $SwayLock &
+ ;;
+ "")
+ systemctl suspend
+ ;;
+ "󰿅")
+ hyprctl dispatch exit 0
+ ;;
+ "󱄌")
+ systemctl reboot
+ ;;
+ "")
+ systemctl poweroff
+ ;;
+ "󰒲")
+ systemctl hibernate
+ ;;
+ *)
+ echo "choose: $1"
+ ;;
+ esac
+}
+
+# Actions
+chosen_option=$(run_rofi)
+run_cmd "${chosen_option% *}" \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage