aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel <48409433+darkeddie@users.noreply.github.com>2023-11-24 22:44:52 +1100
committerGitHub <noreply@github.com>2023-11-24 22:44:52 +1100
commit61bbe3b7d94387ede06353e626465f2987932afe (patch)
treefffa5542ce92085341b65efff5fbf09f6c1d71c2
parent46d00a7892f88485e39993985efbafb6ddf96cc3 (diff)
Rofi style power menu
-rw-r--r--config-powermenu.rasi123
-rw-r--r--rofipower.sh61
2 files changed, 184 insertions, 0 deletions
diff --git a/config-powermenu.rasi b/config-powermenu.rasi
new file mode 100644
index 00000000..9126a32e
--- /dev/null
+++ b/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: 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/rofipower.sh b/rofipower.sh
new file mode 100644
index 00000000..435f1eeb
--- /dev/null
+++ b/rofipower.sh
@@ -0,0 +1,61 @@
+#!/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
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage