From 2e01b26e5a8b4c786845ff6adfc2758ce138e33e Mon Sep 17 00:00:00 2001 From: OCbwoy3 Date: Wed, 12 Mar 2025 18:41:04 +0200 Subject: [PATCH] one round of waybar styling later --- config/hypr/config/autoexec.conf | 9 +- config/hypr/config/display.conf | 12 +- config/hypr/config/keybindings/other.conf | 4 +- config/waybar/config | 21 ++++ config/waybar/modules.json | 107 ++++++++++++++++++ config/waybar/style.css | 127 ++++++++++++++++++++++ hosts/default/packages.nix | 1 + scripts/hot-reload.sh | 14 +++ scripts/waybar-music-status.sh | 16 +++ scripts/xdg.sh | 21 ++++ 10 files changed, 319 insertions(+), 13 deletions(-) create mode 100644 config/waybar/config create mode 100644 config/waybar/modules.json create mode 100644 config/waybar/style.css create mode 100644 scripts/hot-reload.sh create mode 100644 scripts/waybar-music-status.sh create mode 100644 scripts/xdg.sh diff --git a/config/hypr/config/autoexec.conf b/config/hypr/config/autoexec.conf index fe2409a..2aaf5a9 100644 --- a/config/hypr/config/autoexec.conf +++ b/config/hypr/config/autoexec.conf @@ -2,8 +2,7 @@ exec-once = systemctl --user start /nix/store/*-hyprpolkitagent-*/libexec/hyprpolkitagent # Wallpaper -exec-once = swww-daemon & -exec-once = sleep 2 && bash ~/dotfiles/scripts/load-wallpaper.sh +exec-once = hyprpaper # Notification Manager exec-once = dunst & @@ -12,13 +11,13 @@ exec-once = dunst & exec-once = wl-paste --watch cliphist store # XDG Desktop Portal -exec-once = bash ~/dotfiles/scripts/xdg.sh +exec-once = bash ~/config/config/scripts/xdg.sh # Set GTK Settings -exec-once = bash ~/dotfiles/scripts/gtk.sh +exec-once = bash ~/config/config/scripts/gtk.sh # Start Hot Reload -exec-once = bash ~/dotfiles/scripts/hot-reload.sh +exec-once = bash ~/config/config/scripts/hot-reload.sh # Start arRPC exec-once = arrpc diff --git a/config/hypr/config/display.conf b/config/hypr/config/display.conf index 0a777a1..a621fb7 100644 --- a/config/hypr/config/display.conf +++ b/config/hypr/config/display.conf @@ -86,12 +86,12 @@ layerrule = animation slide right, notifications layerrule = dimaround, wofi # Window Rules -windowrule=float, blueman-manager -windowrule=size 900 500, blueman-manager -windowrule=center, blueman-manager -windowrule=float, pavucontrol -windowrule=size 900 500, pavucontrol -windowrule=center, pavucontrol +windowrule=float, .blueman-manager-wrapped +windowrule=size 900 500, .blueman-manager-wrapped +windowrule=center, .blueman-manager-wrapped +windowrule=float, org.pulseaudio.pavucontrol +windowrule=size 900 500, org.pulseaudio.pavucontrol +windowrule=center, org.pulseaudio.pavucontrol windowrule=float, nm-connection-editor windowrule=size 900 500, nm-connection-editor windowrule=center, nm-connection-editor diff --git a/config/hypr/config/keybindings/other.conf b/config/hypr/config/keybindings/other.conf index cb0ffc3..4e23a90 100644 --- a/config/hypr/config/keybindings/other.conf +++ b/config/hypr/config/keybindings/other.conf @@ -3,10 +3,10 @@ bind = $mainMod, Z, togglespecialworkspace, quick bind = $mainMod SHIFT, Z, movetoworkspace, special:quick # Hot reload -bind = $mainMod SHIFT, B, exec, bash ~/dotfiles/scripts/hot-reload.sh +bind = $mainMod SHIFT, B, exec, bash ~/config/scripts/hot-reload.sh # Wallpaper -bind = $mainMod SHIFT, RETURN, exec, bash ~/dotfiles/scripts/select-wallpaper.sh +# bind = $mainMod SHIFT, RETURN, exec, bash ~/config/scripts/select-wallpaper.sh # Screenshot keybinds bind = $mainMod, PRINT, exec, bash ~/dotfiles/scripts/screenshot-selection.sh diff --git a/config/waybar/config b/config/waybar/config new file mode 100644 index 0000000..af41f5e --- /dev/null +++ b/config/waybar/config @@ -0,0 +1,21 @@ +{ + "layer": "top", + "margin-top": 6, + "margin-bottom": -12, + "margin-left": 8, + "margin-right": 8, + "spacing": 10, + "include": [ + "~/config/config/waybar/modules.json" + ], + "modules-left": [ + "hyprland/workspaces", + "hyprland/window" + ], + "modules-right": [ + "custom/regretevator_state", + "custom/music", + "group/traygroup", + "clock" + ] +} diff --git a/config/waybar/modules.json b/config/waybar/modules.json new file mode 100644 index 0000000..b770a54 --- /dev/null +++ b/config/waybar/modules.json @@ -0,0 +1,107 @@ +{ + "group/traygroup": { + "orientation": "inherit", + "modules": ["tray", "network", "bluetooth", "pulseaudio"] + }, + + "custom/middle-split": { + "format": " " + }, + + "custom/music": { + "return-type": "json", + "exec": "bash ~/config/scripts/waybar-music-status.sh", + "restart-interval": 1, + "on-scroll-up": "playerctl -p cider,OCbwoy3_s_iPhone volume 0.05+", + "on-scroll-down": "playerctl -p cider,OCbwoy3_s_iPhone volume 0.05-", + "on-click": "playerctl -p cider,OCbwoy3_s_iPhone play-pause", + "on-click-right": "playerctl -p cider,OCbwoy3_s_iPhone next", + "on-click-middle": "playerctl -p cider,OCbwoy3_s_iPhone previous", + "smooth-scrolling-treshold": 40, + "max-length": 60 + }, + + "custom/regretevator_state": { + "restart-interval": 1, + "return-type": "json", + "exec": "cat /tmp/.regretevator_state" + }, + + "hyprland/window": { + "rewrite": { + "Code - OSS": "Visual Studio Code", + "Cider": "Apple Music", + "SCPSL": "SCP: Secret Laboratory", + "Sober": "Roblox", + "roblox_wrapped - (.*)": "$1", + "Minecraft: Forge Loading...": "Minecraft", + "gemini.google.com_/app": "Gemini", + "PORTAL 2 - (OpenGL|Vulkan)": "Portal 2", + "HALF-LIFE 2 - (OpenGL|Vulkan)": "Half-Life 2", + "(.*) - (.*) - Visual Studio Code": "󰨞 $1  $2", + "(.*) (— Mozilla Firefox( Private Browsing)?|— Brave)": "$1" + }, + "separate-outputs": true + }, + + "hyprland/workspaces": { + "on-click": "activate", + "active-only": false, + "all-outputs": true, + "show-special": false, + "format": "{}", + "format-icons": { + "urgent": "", + "active": "", + "default": "" + }, + "persistent-workspaces": { + "*": 1 + } + }, + + "tray": { + "icon-size": 21, + "spacing": 10 + }, + + "clock": { + "format": "{:%H:%M}", + "tooltip-format": "{:%A %d %B %Y}", + "format-alt": "{:%Y-%m-%d}" + }, + + "pulseaudio": { + "format": "{icon} {volume}%", + "format-muted": " 0%", + "format-source": " {volume}%", + "format-source-muted": "", + "format-icons": { + "default": ["", "", ""] + }, + "tooltip-format": "{desc}\n{icon} {volume}%", + "on-click": "GTK_THEME=catppuccin-mocha-blue-standard+default pavucontrol" + }, + + "network": { + "format": "󰈁", + "format-wifi": "", + "format-ethernet": "", + "format-disconnected": "󰈂", + "tooltip-format": " {ifname} via {gwaddri}", + "tooltip-format-wifi": " {ifname} @ {essid}\nIP: {ipaddr}\nStrength: {signalStrength}%\nFreq: {frequency}MHz\nUp: {bandwidthUpBits} Down: {bandwidthDownBits}", + "tooltip-format-ethernet": " {ifname}\nIP: {ipaddr}\nUp: {bandwidthUpBits} Down: {bandwidthDownBits}", + "tooltip-format-disconnected": "󰈂", + "max-length": 50, + "on-click": "GTK_THEME=catppuccin-mocha-blue-standard+default nm-connection-editor" + }, + + "bluetooth": { + "format": "", + "format-disabled": "󰂲", + "format-off": "", + "interval": 1, + "on-click": "GTK_THEME=catppuccin-mocha-blue-standard+default blueman-manager", + "format-no-controller": "" + } +} diff --git a/config/waybar/style.css b/config/waybar/style.css new file mode 100644 index 0000000..d989eb2 --- /dev/null +++ b/config/waybar/style.css @@ -0,0 +1,127 @@ +/* Global */ + +* { + font-family: 'Symbols Nerd Font', 'Geist Sans'; + border: none; + font-size: 15px; + min-height: 10px; + /* max-height: 10px;*/ +} + +window#waybar { + background: transparent; +} + +window#waybar { + border-radius: 8px; + padding: 3px 5px 3px 5px; +} + +#workspaces, #custom-music, #traygroup, #clock, #window, #custom-regretevator_state { + border-radius: 8px; + padding: 2px 5px 2px 5px; + border: 2px solid #89b4fa; +} + +#traygroup, #custom-music, #window, #workspaces, #custom-regretevator_state { + background-color: #1e1e2e; + padding-left: 5px; + padding-right: 5px; + color: #b4befe; +} + +#custom-regretevator_state { + font-family: 'DotfilesFont', 'Symbols Nerd Font', 'Geist Sans'; +} + +#custom-music, #clock, #window { + padding-left: 10px; + padding-right: 10px; +} + +#clock { + background-color: #1e1e2e; + color: #b4befe; +} + +#workspaces button { + color: #b4befe; +} + +#workspaces button.active { + color: #cba6f7; + font-weight: bolder; +} + +#tray { + padding: 0px 5px 0px 5px; + margin: 0px 0px 0px 0px; + color: #b4befe; + background-color: #1e1e2e; +} + +#tray menu { + padding: 5px 5px 5px 5px; + margin: 5px 5px 5px 5px; + color: #b4befe; + background-color: rgba(30, 30, 46, 0.9); + border: 1px solid #89b4fa; + border-radius: 13px; +} + +#tray menuitem { + padding: 2px 2px 2px 2px; + margin: 2px 0px 2px 0px; + border-radius: 8px; + color: #b4befe; + background-color: rgba(30, 30, 46, 0); + border: 1px solid #89b4fa; +} + +#tray menuitem:hover { + color: #89b4fa; + background-color: rgba(17, 17, 27, 0.8); +} + +#tray separatormenuitem { + background-color: transparent; +} + + + +#network, #bluetooth, #pulseaudio { + padding: 0px 5px 0px 5px; + margin: 0px 0px 0px 0px; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; +} + +.invisible { + padding: 0px 0px 0px 0px; + margin: 0px 0px 0px 0px; + background-color: transparent; + border: 2px transparent; +} + +tooltip { + padding: 5px 5px 5px 5px; + margin: 5px 5px 5px 5px; + border-radius: 4px; + background-color: rgba(30, 30, 46, 0.8); + border: 1px solid #89b4fa; + color: #cdd6f4; + border-radius: 8px; +} + +window#waybar.empty #window { + padding: 0px 0px 0px 0px; + margin: 0px 0px 0px 0px; + border: 2px transparent; + background-color: transparent; +} diff --git a/hosts/default/packages.nix b/hosts/default/packages.nix index e1e0ead..0e12564 100644 --- a/hosts/default/packages.nix +++ b/hosts/default/packages.nix @@ -76,6 +76,7 @@ deno wofi waybar + hyprpaper dunst hyprlock swww diff --git a/scripts/hot-reload.sh b/scripts/hot-reload.sh new file mode 100644 index 0000000..2361dfa --- /dev/null +++ b/scripts/hot-reload.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +pkill -9 waybar + +hyprctl dispatch exec "GTK_THEME=Adwaita waybar -c ~/config/config/waybar/config -s ~/config/config/waybar/style.css" & +hyprctl reload + +ROBLOX_PID="$(pidof sober)" + +echo ${#ROBLOX_PID} + +if [ ${#ROBLOX_PID} -lt 1 ]; then + rm /tmp/.regretevator_state +fi diff --git a/scripts/waybar-music-status.sh b/scripts/waybar-music-status.sh new file mode 100644 index 0000000..325149c --- /dev/null +++ b/scripts/waybar-music-status.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +function _sanitize { + sed -r "s/(^[ ]*)|([ ]*$)//g" | sed -r 's/\&/\&/g' | sed -r 's/\"/\"/g' | sed -r "s/'/\'/g" +} + +# {{artist}} — {{title}} + +SONGNAME="$( playerctl -s -p cider,OCbwoy3_s_iPhone metadata -f "{{artist}} — {{title}}" | _sanitize )" +ALBUMNAME="$( playerctl -s -p cider,OCbwoy3_s_iPhone metadata album | _sanitize )" + +if [ ${#SONGNAME} -gt 0 ] ; then + printf "{\"text\": \" $SONGNAME\", \"tooltip\": \"$ALBUMNAME\", \"class\":\"music\" }" +else + printf "{\"text\": \"\", \"tooltip\": \" \", \"class\":\"invisible\" }" +fi diff --git a/scripts/xdg.sh b/scripts/xdg.sh new file mode 100644 index 0000000..e824937 --- /dev/null +++ b/scripts/xdg.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +sleep 1 + +# kill all possible running xdg-desktop-portals +kill -9 $(pidof xdg-desktop-portal-hyprland) +kill -9 $(pidof xdg-desktop-portal-gnome) +kill -9 $(pidof xdg-desktop-portal-kde) +kill -9 $(pidof xdg-desktop-portal-lxqt) +kill -9 $(pidof xdg-desktop-portal-wlr) +kill -9 $(pidof xdg-desktop-portal-gtk) +kill -9 $(pidof xdg-desktop-portal) +sleep 1 + +# start xdg-desktop-portal-hyprland +/usr/lib/xdg-desktop-portal-hyprland & +sleep 2 + +# start xdg-desktop-portal +/usr/lib/xdg-desktop-portal & +sleep 1