From e4267adcfbfd94df92e0c4f92f0f1c9c54c342e8 Mon Sep 17 00:00:00 2001 From: Andre Ramnitz Date: Fri, 15 Dec 2023 20:55:52 +0100 Subject: [PATCH] waybar/hypr: add powermenu & wallpaper buttons --- hypr/.config/hypr/scripts/powermenu.sh | 17 ++++++ waybar/.config/waybar/config | 71 ++++++++++++++++---------- waybar/.config/waybar/style.css | 41 ++------------- 3 files changed, 64 insertions(+), 65 deletions(-) create mode 100755 hypr/.config/hypr/scripts/powermenu.sh diff --git a/hypr/.config/hypr/scripts/powermenu.sh b/hypr/.config/hypr/scripts/powermenu.sh new file mode 100755 index 00000000..fe73800a --- /dev/null +++ b/hypr/.config/hypr/scripts/powermenu.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# shamelessly stolen from https://github.com/luispabon/sway-dotfiles + +entries="⇠ Logout\n⏾ Suspend\n⭮ Reboot\n⏻ Shutdown" + +selected=$(echo -e $entries|wofi --width 250 --height 210 --dmenu --cache-file /dev/null | awk '{print tolower($2)}') + +case $selected in + logout) + hyprctl dispatch exit;; + suspend) + exec loginctl suspend;; + reboot) + exec loginctl reboot;; + shutdown) + exec loginctl poweroff -i;; +esac diff --git a/waybar/.config/waybar/config b/waybar/.config/waybar/config index 012b86dd..f99955bd 100644 --- a/waybar/.config/waybar/config +++ b/waybar/.config/waybar/config @@ -3,12 +3,12 @@ "position": "bottom", // Waybar position (top|bottom|left|right) "height": 26, // Waybar height (to be removed for auto height) // "width": 1280, // Waybar width - "spacing": 5, // Gaps between modules (4px) + "spacing": 6, // Gaps between modules (4px) // Choose the order of the modules "modules-left": ["hyprland/workspaces", "mpd"], "modules-center": ["hyprland/window"], "margin": "0", - "modules-right": ["keyboard-state", "cpu", "memory", "temperature#temp2", "temperature", "pulseaudio", "idle_inhibitor", "clock", "tray"], + "modules-right": ["keyboard-state", "cpu", "memory", "temperature#temp2", "temperature", "pulseaudio", "clock", "tray", "idle_inhibitor", "custom/wallpaper", "custom/powermenu"], // Modules configuration @@ -102,38 +102,22 @@ }, - "idle_inhibitor": { - "format": "{icon}", - "format-icons": { - "activated": "", - "deactivated": "" - } - }, - - "tray": { // "icon-size": 21, "spacing": 10 }, - "clock": { - // "timezone": "America/New_York", - "tooltip-format": "{:%Y %B}\n{calendar}", - "format-alt": "{:%Y-%m-%d}" - }, - - "cpu": { - "format": "{usage:2}% ", - "tooltip": true, + "format": " {usage:2}%", "on-click": "/usr/bin/foot -a popup htop", "interval": 2, }, "memory": { - "format": "{percentage:2}% ", + "format": " {percentage:2}%", + "on-click": "/usr/bin/foot -a popup htop", "interval": 2, }, @@ -143,7 +127,7 @@ "hwmon-path": "/sys/class/hwmon/hwmon4/temp7_input", "critical-threshold": 60, // "format-critical": "{temperatureC}°C {icon}", - "format": "WaterGPU: {temperatureC}°C {icon}", + "format": "{icon} {temperatureC}°C WaterGPU", "format-icons": ["", "", ""] }, @@ -152,7 +136,7 @@ "hwmon-path": "/sys/class/hwmon/hwmon4/temp6_input", "critical-threshold": 60, // "format-critical": "{temperatureC}°C {icon}", - "format": "WaterCPU: {temperatureC}°C {icon}", + "format": "{icon} {temperatureC}°C WaterCPU", "format-icons": ["", "", ""] }, @@ -170,11 +154,11 @@ "pulseaudio": { // "scroll-step": 1, // %, can be a float - "format": "{volume}% {icon} {format_source}", - "format-bluetooth": "{volume}% {icon} {format_source}", + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{icon} {volume}% {format_source}", "format-bluetooth-muted": " {icon} {format_source}", - "format-muted": " {format_source}", - "format-source": "{volume}% ", + "format-muted": " {format_source}", + "format-source": " {volume}%", "format-source-muted": "", "format-icons": { "headphone": "", @@ -188,5 +172,36 @@ "on-click": "pavucontrol" }, -} + "clock": { + // "timezone": "America/New_York", + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%Y-%m-%d}" + }, + + + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + + + "custom/wallpaper": { + "format": "  ", + "on-click": "$HOME/.local/bin/rndwallpaper swww", + "tooltip": false, + "interval": "once", + }, + + + "custom/powermenu": { + "format": " ⏻ ", + "on-click-middle": "$HOME/.config/hypr/scripts/powermenu.sh", + "tooltip": false, + "interval": "once", + }, +} +# kak: filetype=json:ts=2:iw=2 diff --git a/waybar/.config/waybar/style.css b/waybar/.config/waybar/style.css index c1d9ad06..0937ec63 100644 --- a/waybar/.config/waybar/style.css +++ b/waybar/.config/waybar/style.css @@ -6,35 +6,22 @@ window#waybar { - background-color: rgba(43, 48, 59, 1); + background-color: rgba(43, 48, 59, 1.0); border-bottom: 2px solid rgba(100, 114, 125, 1); color: #ffffff; transition-property: background-color; transition-duration: .5s; } - window#waybar.hidden { opacity: 0.2; } - -/* window#waybar.empty { background-color: transparent; + background-image: linear-gradient(0deg, rgba(0,0,0,1.0), rgba(0,0,0,0)) } -window#waybar.solo { - background-color: #FFFFFF; +window#waybar.foot { + background-color: rgba(24,24,24,1.0); } -*/ - -window#waybar.termite { - background-color: #3F3F3F; -} - -window#waybar.chromium { - background-color: #000000; - border: none; -} - #workspaces button { @@ -46,43 +33,23 @@ window#waybar.chromium { border: none; border-radius: 0; } - #workspaces button:hover { background: inherit; border-bottom: 2px solid tomato; box-shadow: inset 0 -28px #c9545d; } - #workspaces button.active { font-weight: bold; border-bottom: 2px solid lightblue; } - #workspaces button.focused { border-bottom: 2px solid #c9545d; } - #workspaces button.urgent { border-bottom: 2px solid #eb4d4b; } - -button { - /* Use box-shadow instead of border so the text isn't offset */ - box-shadow: inset 0 -3px transparent; - /* Avoid rounded borders under each button name */ - border: none; - border-radius: 0; -} - -/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ -button:hover { - background: inherit; - box-shadow: inset 0 -3px #ffffff; -} - - #cpu, #memory, #temperature { -- 2.51.2