From 62a7a2bceca6967b885ee01f2f5e7f5c8aa989f7 Mon Sep 17 00:00:00 2001 From: darkeddie Date: Sat, 25 Nov 2023 16:41:55 +1100 Subject: Update with Ja Suggestions --- config/hypr/scripts/RofiPower.sh | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 config/hypr/scripts/RofiPower.sh (limited to 'config/hypr/scripts/RofiPower.sh') diff --git a/config/hypr/scripts/RofiPower.sh b/config/hypr/scripts/RofiPower.sh new file mode 100755 index 00000000..824cffa3 --- /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" "Suspend" "Logout" "Reboot" "Shutdown" "Hibernate") +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 -- cgit v1.2.3 From 2ad7b840f7f2b06992c875b6e3d5089ec0e86490 Mon Sep 17 00:00:00 2001 From: darkeddie Date: Sat, 25 Nov 2023 20:08:41 +1100 Subject: Update with shortcuts on rofipower --- config/hypr/scripts/RofiPower.sh | 2 +- config/rofi/config-powermenu.rasi | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'config/hypr/scripts/RofiPower.sh') diff --git a/config/hypr/scripts/RofiPower.sh b/config/hypr/scripts/RofiPower.sh index 824cffa3..84d86433 100755 --- a/config/hypr/scripts/RofiPower.sh +++ b/config/hypr/scripts/RofiPower.sh @@ -7,7 +7,7 @@ uptime_info=$(uptime -p | sed -e 's/up //g') host=$(hostnamectl hostname) # Options with Icons and Text -options=("Lock" "Suspend" "Logout" "Reboot" "Shutdown" "Hibernate") +options=("Lock(l)" "Suspend(u)" "Logout(e)" "Reboot(r)" "Shutdown(s)" "Hibernate(h)") icons=("" "" "󰿅" "󱄌" "" "󰒲") # Rofi CMD diff --git a/config/rofi/config-powermenu.rasi b/config/rofi/config-powermenu.rasi index a3babe62..cf0592f8 100644 --- a/config/rofi/config-powermenu.rasi +++ b/config/rofi/config-powermenu.rasi @@ -3,7 +3,6 @@ /* ---- Configuration ---- */ configuration { show-icons: false; - auto-select: true; } /* ---- Load pywal colors (custom wal template) ---- */ @@ -19,8 +18,8 @@ window { location: center; anchor: center; fullscreen: false; - width: 38%; - /*height: 30%;*/ + width: 900px; + height: 400px; x-offset: 0px; y-offset: 0px; padding: 0px; @@ -48,7 +47,7 @@ mainbox { /* ---- Inputbar ---- */ inputbar { enabled: true; - padding: 10px; + padding: 20px; background-color: transparent; orientation: horizontal; children: ["prompt"]; @@ -77,11 +76,12 @@ listview { reverse: false; fixed-height: false; fixed-columns: true; - spacing: 30px; - padding: 2% 30px; + spacing: 40px; + padding: 4% 40px; background-color: transparent; cursor: "default"; border: 0px; + border-color: @active-background; } /* ---- Elements ---- */ -- cgit v1.2.3