From d5b06a4c6301befd1e5e4e9efa189a71aee51e27 Mon Sep 17 00:00:00 2001 From: darkeddie Date: Sat, 25 Nov 2023 09:26:40 +1100 Subject: Implementation of Rofipower --- config-powermenu.rasi | 123 -------------------------------------- config/hypr/configs/Keybinds.conf | 2 +- config/hypr/scripts/rofipower.sh | 67 +++++++++++++++++++++ config/rofi/config-powermenu.rasi | 123 ++++++++++++++++++++++++++++++++++++++ config/waybar/modules | 6 +- rofipower.sh | 61 ------------------- 6 files changed, 194 insertions(+), 188 deletions(-) delete mode 100644 config-powermenu.rasi create mode 100755 config/hypr/scripts/rofipower.sh create mode 100644 config/rofi/config-powermenu.rasi delete mode 100644 rofipower.sh diff --git a/config-powermenu.rasi b/config-powermenu.rasi deleted file mode 100644 index 9126a32e..00000000 --- a/config-powermenu.rasi +++ /dev/null @@ -1,123 +0,0 @@ -/* --- Configuration for Rofi Power ---- */ - -/* ---- Configuration ---- */ -configuration { - show-icons: false; -} - -/* ---- Load pywal colors (custom wal template) ---- */ -@import "~/.config/rofi/pywal-color/pywal-theme.rasi" - -/* ---- Global Properties ---- */ -* { - font: "JetBrains Mono Nerd Font 14"; -} - -/* ---- Main Window ---- */ -window { - transparency: "real"; - location: center; - anchor: center; - fullscreen: false; - width: 25%; - height: 25%; - x-offset: 0px; - y-offset: 0px; - padding: 0px; - border: 1px solid; - border-radius: 15px; - border-color: @active-background; - cursor: "default"; - background-color: @background-color; -} - -/* ---- Main Box ---- */ -mainbox { - enabled: true; - spacing: 0px; - margin: 0px; - padding: 0px; - border: 0px solid; - border-radius: 0px; - background-image: url("~/.config/rofi/.current_wallpaper", width); - border-color: @active-background; - background-color: @background-color; - children: [ "inputbar", "listview", "message" ]; -} - -/* ---- Inputbar ---- */ -inputbar { - enabled: true; - padding: 2px 4%; - background-color: transparent; - orientation: vertical; - children: ["prompt"]; -} - -prompt { - enabled: true; - padding: 2% 5%; - border-radius: 100% 100% 100% 100%; - border-color: @foreground; - background-color: @background-color; - text-color: @foreground; - cursor: text; -} - -/* ---- Listview ---- */ -listview { - enabled: true; - columns: 5; - lines: 1; - cycle: true; - dynamic: true; - scrollbar: false; - layout: vertical; - reverse: false; - fixed-height: true; - fixed-columns: true; - spacing: 30px; - padding: 4% 30px; - background-color: transparent; - cursor: "default"; - border: 0px; -} - -/* ---- Elements ---- */ -element { - enabled: true; - padding: 20px; - border-radius: 40px; - background-color: transparent; - text-color: @foreground; - cursor: pointer; -} -element-text { - font: "JetBrains Mono Nerd Font 32"; - background-color: transparent; - text-color: inherit; - cursor: inherit; - vertical-align: 0.5; - horizontal-align: 0.5; -} -element selected.normal { - background-color: @selected-normal-background; - text-color: @background; -} - -/* ---- Message ---- */ -message { - enabled: true; - margin: 0px; - padding: 15px; - border-radius: 0px; - background-color: transparent; - text-color: @foreground; - border: 0px; -} -textbox { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; - horizontal-align: 0.5; -} \ No newline at end of file diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf index c072b4d7..8ad56515 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..7bb70e9c --- /dev/null +++ b/config/hypr/scripts/rofipower.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Swayconfig +SWAYCONFIG="$HOME/.config/swaylock/config" + +# CMDs +uptime="`uptime -p | sed -e 's/up //g'`" +host=`hostnamectl hostname` + +# Options +shutdown=' Shutdown' +reboot=' Reboot' +lock=' Lock' +suspend=' Suspend' +logout=' Logout' +hibernate=' Hibernate' + +# Rofi CMD +rofi_cmd() { + rofi -dmenu -p " $USER@$host" -mesg " Uptime: $uptime" -sep '|' -eh 2 -theme ~/.config/rofi/config-powermenu.rasi +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$lock\0meta\x1fl|$suspend\0meta\x1fu|$logout\0meta\x1fe|$reboot\0meta\x1fr|$shutdown\0meta\x1fs|$hibernate\0meta\x1fh" | rofi_cmd +} + +# Execute Command +run_cmd() { + if [[ $1 == '--shutdown' ]]; then + systemctl poweroff + elif [[ $1 == '--reboot' ]]; then + systemctl reboot + elif [[ $1 == '--suspend' ]]; then + systemctl suspend + elif [[ $1 == '--logout' ]]; then + hyprctl dispatch exit 0 + elif [[ $1 == '--hibernate' ]]; then + systemctl hibernate + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $shutdown) + run_cmd --shutdown + ;; + $reboot) + run_cmd --reboot + ;; + $hibernate) + run_cmd --hibernate + ;; + $lock) + sleep 0.5s; swaylock --config ${SWAYCONFIG} & disown + ;; + $suspend) + run_cmd --suspend + ;; + $logout) + run_cmd --logout + ;; + $hibernate) + run_cmd --hibernate + ;; +esac \ No newline at end of file diff --git a/config/rofi/config-powermenu.rasi b/config/rofi/config-powermenu.rasi new file mode 100644 index 00000000..61d7262d --- /dev/null +++ b/config/rofi/config-powermenu.rasi @@ -0,0 +1,123 @@ +/* --- Configuration for Rofi Power ---- */ + +/* ---- Configuration ---- */ +configuration { + show-icons: false; +} + +/* ---- Load pywal colors (custom wal template) ---- */ +@import "~/.config/rofi/pywal-color/pywal-theme.rasi" + +/* ---- Global Properties ---- */ +* { + font: "JetBrains Mono Nerd Font 14"; +} + +/* ---- Main Window ---- */ +window { + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 25%; + height: 25%; + x-offset: 0px; + y-offset: 0px; + padding: 0px; + border: 2px solid; + border-radius: 15px; + border-color: @active-background; + cursor: "default"; + background-color: @background-color; +} + +/* ---- Main Box ---- */ +mainbox { + enabled: true; + spacing: 0px; + margin: 0px; + padding: 0px; + border: 0px solid; + border-radius: 0px; + background-image: url("~/.config/rofi/.current_wallpaper", width); + border-color: @active-background; + background-color: @background-color; + children: [ "inputbar", "listview", "message" ]; +} + +/* ---- Inputbar ---- */ +inputbar { + enabled: true; + padding: 10px 6.5%; + background-color: transparent; + orientation: vertical; + children: ["prompt"]; +} + +prompt { + enabled: true; + padding: 1% 2.5%; + border-radius: 100% 100% 100% 100%; + border-color: @foreground; + background-color: @background-color; + text-color: @foreground; + cursor: text; +} + +/* ---- Listview ---- */ +listview { + enabled: true; + columns: 3; + lines: 2; + cycle: true; + dynamic: true; + scrollbar: false; + layout: vertical; + reverse: false; + fixed-height: true; + fixed-columns: true; + spacing: 20px; + padding: 1% 30px; + background-color: transparent; + cursor: "default"; + border: 0px; +} + +/* ---- Elements ---- */ +element { + enabled: true; + padding: 10px; + border-radius: 30px; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element-text { + font: "JetBrains Mono Nerd Font 18"; + background-color: transparent; + text-color: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.5; +} +element selected.normal { + background-color: @selected-normal-background; + text-color: @background; +} + +/* ---- Message ---- */ +message { + enabled: true; + margin: 0px; + padding: 15px; + border-radius: 0px; + background-color: transparent; + text-color: @foreground; + border: 0px; +} +textbox { + background-color: inherit; + text-color: inherit; + vertical-align: 0.5; + horizontal-align: 0.5; +} \ No newline at end of file diff --git a/config/waybar/modules b/config/waybar/modules index b7b41d74..45668c3a 100644 --- a/config/waybar/modules +++ b/config/waybar/modules @@ -199,7 +199,7 @@ "tooltip": true, "tooltip-format": "{timeTo} {power}w", "on-click-middle": "~/.config/hypr/scripts/ChangeBlur.sh", - "on-click-right": "~/.config/hypr/scripts/Wlogout.sh", + "on-click-right": "~/.config/hypr/scripts/rofipower.sh", }, "bluetooth": { @@ -497,7 +497,7 @@ "custom/power": { "format": "⏻ ", "tooltip": false, - "on-click": "~/.config/hypr/scripts/Wlogout.sh", + "on-click": "~/.config/hypr/scripts/rofipower.sh", "on-click-right": "~/.config/hypr/scripts/ChangeBlur.sh", }, @@ -652,7 +652,7 @@ "custom/power_vertical": { "format": "⏻", "tooltip": false, - "on-click": "~/.config/hypr/scripts/Wlogout.sh", + "on-click": "~/.config/hypr/scripts/rofipower.sh", "on-click-right": "~/.config/hypr/scripts/ChangeBlur.sh", }, diff --git a/rofipower.sh b/rofipower.sh deleted file mode 100644 index 435f1eeb..00000000 --- a/rofipower.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -# Swayconfig -SWAYCONFIG="$HOME/.config/swaylock/config" - -# CMDs -uptime="`uptime -p | sed -e 's/up //g'`" -host=`hostnamectl hostname` - -# Options -shutdown='' -reboot='' -lock='' -suspend='' -logout='' - -# Rofi CMD -rofi_cmd() { - rofi -dmenu -p " $USER@$host" -mesg " Uptime: $uptime" -theme ~/.config/rofi/config-powermenu.rasi -} - -# Pass variables to rofi dmenu -run_rofi() { - echo -e "$lock\0meta\x1fl\n$suspend\0meta\x1fu\n$logout\0meta\x1fe\n$reboot\0meta\x1fr\n$shutdown\0meta\x1fs" | rofi_cmd -} - -# Execute Command -run_cmd() { - if [[ $1 == '--shutdown' ]]; then - systemctl poweroff - elif [[ $1 == '--reboot' ]]; then - systemctl reboot - elif [[ $1 == '--suspend' ]]; then - systemctl suspend - elif [[ $1 == '--logout' ]]; then - hyprctl dispatch exit 0 - fi -} - -# Actions -chosen="$(run_rofi)" -case ${chosen} in - $shutdown) - run_cmd --shutdown - ;; - $reboot) - run_cmd --reboot - ;; - $hibernate) - run_cmd --hibernate - ;; - $lock) - sleep 0.5s; swaylock --config ${SWAYCONFIG} & disown - ;; - $suspend) - run_cmd --suspend - ;; - $logout) - run_cmd --logout - ;; -esac \ No newline at end of file -- cgit v1.2.3