From d8da49460ef02400f2b54a0a00fba47299019c8a Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Sun, 23 Feb 2025 02:29:49 -0500 Subject: [PATCH 01/10] refactor: use `lib.range` for workspace numbers --- home-manager/wayland/hyprland.nix | 35 +++++++++---------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/home-manager/wayland/hyprland.nix b/home-manager/wayland/hyprland.nix index 80c91d9..c98db15 100644 --- a/home-manager/wayland/hyprland.nix +++ b/home-manager/wayland/hyprland.nix @@ -129,33 +129,18 @@ in { "$mod, E, hy3:changegroup, opposite" "$mod, A, hy3:changefocus, raise" - # Workspaces - "$mod, 1, workspace, 1" - "$mod, 2, workspace, 2" - "$mod, 3, workspace, 3" - "$mod, 4, workspace, 4" - "$mod, 5, workspace, 5" - "$mod, 6, workspace, 6" - "$mod, 7, workspace, 7" - "$mod, 8, workspace, 8" - "$mod, 9, workspace, 9" - "$mod, 0, workspace, 10" - - # Workspace Movement - "$mod Shift, 1, hy3:movetoworkspace, 1" - "$mod Shift, 2, hy3:movetoworkspace, 2" - "$mod Shift, 3, hy3:movetoworkspace, 3" - "$mod Shift, 4, hy3:movetoworkspace, 4" - "$mod Shift, 5, hy3:movetoworkspace, 5" - "$mod Shift, 6, hy3:movetoworkspace, 6" - "$mod Shift, 7, hy3:movetoworkspace, 7" - "$mod Shift, 8, hy3:movetoworkspace, 8" - "$mod Shift, 9, hy3:movetoworkspace, 9" - "$mod Shift, 0, hy3:movetoworkspace, 10" - # Screenshot "$mod, P, exec, ${scripts}/screenshot-save" - ]; + ] ++ + # Workspace manipulation + builtins.concatMap (n: + let + wsp = builtins.toString n; + key = if n == 10 then "0" else wsp; + in [ + "$mod, ${key}, workspace, ${wsp}" + "$mod Shift, ${key}, hy3:movetoworkspace, ${wsp}" + ]) (lib.range 1 10); bindn = [ ", mouse:272, hy3:focustab, mouse" From f30e0773ccc92abdd9f81f369a8f6032e5fec857 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Sun, 23 Feb 2025 02:30:56 -0500 Subject: [PATCH 02/10] refactor: use relative script paths in `eww.yuck` This is apparently something EWW supports. --- home-manager/wayland/eww/eww.yuck | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/home-manager/wayland/eww/eww.yuck b/home-manager/wayland/eww/eww.yuck index ab90e4c..2b86a7e 100644 --- a/home-manager/wayland/eww/eww.yuck +++ b/home-manager/wayland/eww/eww.yuck @@ -2,7 +2,7 @@ ;; Window Info (deflisten window :initial "{}" - "~/.config/eww/scripts/active-window") + "scripts/active-window") (defwidget bar_window [class-limit title-limit] (box :class "bar-window" @@ -21,9 +21,9 @@ ;; Workspaces (deflisten workspaces :initial "[]" - "~/.config/eww/scripts/get-workspaces") + "scripts/get-workspaces") (deflisten current_workspace :initial "1" - "~/.config/eww/scripts/get-active-workspace") + "scripts/get-active-workspace") (defwidget bar_workspace_button [workspace] (eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" @@ -37,7 +37,7 @@ (label :text "${workspace.id}"))))) (defwidget bar_workspaces [] - (eventbox :onscroll "~/.config/eww/scripts/change-active-workspace {} ${current_workspace}" + (eventbox :onscroll "scripts/change-active-workspace {} ${current_workspace}" (box :class "bar-workspaces" :orientation "h" :space-evenly true @@ -64,7 +64,7 @@ ;; Playerctl (deflisten mpris :initial "{}" - "~/.config/eww/scripts/mpris-metadata") + "scripts/mpris-metadata") (defwidget bar_music [width artist-limit title-limit] (eventbox :onclick "playerctl play-pause" @@ -130,7 +130,7 @@ (defvar volume_reveal false) (deflisten volume :initial "0" - "~/.config/eww/scripts/volume") + "scripts/volume") (defwidget bar_volume [] (bar_scale :class "bar-volume ${volume.muted ? "muted" : ""}" @@ -147,7 +147,7 @@ (defvar brightness_reveal false) (deflisten brightness :initial "0" - "~/.config/eww/scripts/brightness") + "scripts/brightness") (defwidget bar_brightness [] (bar_scale :class "bar-brightness" @@ -208,11 +208,11 @@ ;; Network (defpoll wifi :interval "5s" :initial "{}" - "~/.config/eww/scripts/network 802-11-wireless") + "scripts/network 802-11-wireless") (defpoll ethernet :interval "5s" :initial "{}" - "~/.config/eww/scripts/network 802-3-ethernet") + "scripts/network 802-3-ethernet") (defpoll bluetooth :interval "5s" :initial "{}" - "~/.config/eww/scripts/network bluetooth") + "scripts/network bluetooth") (defvar internet_reveal false) From 99d593dfe5a11b52341ae8bbe9d24aca7f156fc3 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Sun, 23 Feb 2025 02:34:40 -0500 Subject: [PATCH 03/10] feat: update to emacs 30 --- config/config.nix | 2 +- config/packages.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.nix b/config/config.nix index 3a00b5c..47e73c7 100644 --- a/config/config.nix +++ b/config/config.nix @@ -78,7 +78,7 @@ in noto-fonts noto-fonts-cjk-sans noto-fonts-color-emoji - source-sans-pro + overpass # Display quicksand diff --git a/config/packages.nix b/config/packages.nix index 3f752ad..20db65d 100644 --- a/config/packages.nix +++ b/config/packages.nix @@ -65,7 +65,7 @@ in { services.emacs.enable = true; services.emacs.package = with pkgs; - (emacsPackagesFor (pkgs.emacs29.override { withPgtk = true; })) + (emacsPackagesFor (pkgs.emacs30.override { withPgtk = true; })) .emacsWithPackages (epkgs: [ epkgs.vterm ]); programs.direnv.enable = true; From 7a4b7cd6cc27851817a1ed0814d4bf73e0fa92ff Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Tue, 25 Feb 2025 00:48:57 -0500 Subject: [PATCH 04/10] feat: EWW power menu --- home-manager/wayland/eww/eww.scss | 47 ++++++++----- home-manager/wayland/eww/eww.yuck | 110 +++++++++++++++++++++--------- home-manager/wayland/hyprland.nix | 1 - home-manager/wayland/scripts/exit | 4 -- home-manager/wayland/wltools.nix | 13 ---- 5 files changed, 110 insertions(+), 65 deletions(-) delete mode 100755 home-manager/wayland/scripts/exit diff --git a/home-manager/wayland/eww/eww.scss b/home-manager/wayland/eww/eww.scss index 22339bc..da3434a 100644 --- a/home-manager/wayland/eww/eww.scss +++ b/home-manager/wayland/eww/eww.scss @@ -9,6 +9,7 @@ $accent: #f6a8cf; * { all: unset; + font-family: "Quicksand Medium"; } @mixin segment { @@ -19,18 +20,17 @@ $accent: #f6a8cf; .bar { background-color: $background; - font-family: "Quicksand Medium"; color: $foreground; font-size: 13px; - padding: 3px 10px; + padding: 3px 0px; } tooltip { - background-color: rgba(0,0,0,0.8); - font-family: "JetBrains Mono"; - font-size: 12px; + background-color: rgba(22, 16, 30, 0.9); + border-radius: 5px; + font-size: 13px; } .detail { @@ -45,7 +45,7 @@ tooltip { } .bar-window { - margin-left: 4px; + margin-left: 14px; .detail { margin-top: 1px; @@ -71,12 +71,9 @@ tooltip { .bar-music { @include segment; - padding-left: 3px; - padding-right: 10px; + padding: 0px 2px; .progress { - margin-right: 5px; - .back { color: $background-scale; } @@ -86,6 +83,12 @@ tooltip { } } + .symbol.stopped { + font-size: 15px; + color: $foreground-alt; + margin-left: -2px; + } + .symbol.paused { font-size: 12px; margin-left: 2px; @@ -96,6 +99,11 @@ tooltip { margin-top: 1px; } + .bar-music-meta { + margin-left: 6px; + margin-right: 10px; + } + .bar-artist { margin-top: 1px; margin-bottom: -2px; @@ -247,12 +255,19 @@ scale trough { } } -.bar-idleinhibit { - margin-left: 3px; - margin-right: 4px; - color: $disabled; +.bar-power { + font-size: 18px; + margin-left: 4px; + margin-right: 10px; + color: #f7768e; +} - &.active { - color: #f7768e; +.power { + font-size: 36px; + + button > box { + background-color: $background; + border-radius: 8px; + margin: 5px; } } diff --git a/home-manager/wayland/eww/eww.yuck b/home-manager/wayland/eww/eww.yuck index 2b86a7e..57b3614 100644 --- a/home-manager/wayland/eww/eww.yuck +++ b/home-manager/wayland/eww/eww.yuck @@ -28,13 +28,13 @@ (defwidget bar_workspace_button [workspace] (eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" (overlay - (box :class "segment workspace-button ${workspace.id == current_workspace ? "current" : "" + (box :class "workspace-button ${workspace.id == current_workspace ? "current" : "" } ${workspace.windows > 0 ? "occupied" : "empty" } ${workspace.previous > 0 ? "previous-occupied" : "previous-empty" } ${workspace.next > 0 ? "next-occupied" : "next-empty"}" - (label :text "${workspace.id}")) + (label :text {workspace.id})) (box :visible {workspace.id == current_workspace} - (label :text "${workspace.id}"))))) + (label :text {workspace.id}))))) (defwidget bar_workspaces [] (eventbox :onscroll "scripts/change-active-workspace {} ${current_workspace}" @@ -66,20 +66,17 @@ (deflisten mpris :initial "{}" "scripts/mpris-metadata") -(defwidget bar_music [width artist-limit title-limit] +(defwidget bar_music [artist-limit title-limit] (eventbox :onclick "playerctl play-pause" - (box :class "bar-music segment" + (box :class "bar-music" :orientation "h" - :width width :space-evenly false (box :class "progress" (overlay (circular-progress :class "back" :value 100 :width 25 - :thickness 2 - :start-at 75 - :clockwise true) + :thickness 2) (circular-progress :class "front" :value {(mpris.position ?: 0) == 0 || (mpris.duration ?: 0) == 0 ? 0 : @@ -89,19 +86,24 @@ :thickness 2 :start-at 75 :clockwise true) - (label :class "symbol ${mpris.status == "Playing" ? "playing" : "paused"}" - :text {mpris.status == "Playing" ? "󰏤" : ""}))) - (box :orientation "v" - :space-evenly false - :visible {(mpris.title ?: "") != "" && (mpris.status ?: "Stopped") != "Stopped"} - (label :class "bar-artist detail" - :halign "start" - :limit-width artist-limit - :text {mpris.artist ?: ""}) - (label :halign "bar-title" - :limit-width title-limit - :text {mpris.title ?: ""}))))) - + (label :class "symbol ${(mpris.title ?: "") == "" || (mpris.status ?: "Stopped") == "Stopped" ? "stopped" : + mpris.status == "Playing" ? "playing" : "paused"}" + :text {(mpris.title ?: "") == "" || (mpris.status ?: "Stopped") == "Stopped" ? "" : + mpris.status == "Playing" ? "󰏤" : ""}))) + (revealer :transition "slideright" + :duration "800ms" + :reveal {(mpris.title ?: "") != "" && (mpris.status ?: "Stopped") != "Stopped"} + (box :orientation "v" + :class "bar-music-meta" + :space-evenly false + (label :class "bar-artist detail" + :halign "start" + :limit-width artist-limit + :text {mpris.artist ?: ""}) + (label :class "bar-title" + :halign "start" + :limit-width title-limit + :text {mpris.title ?: ""})))))) ;; Scales (Volume + Brightness) @@ -222,21 +224,67 @@ :tooltip {ethernet != "{}" ? "${ethernet.name} (${ethernet.device})" : wifi != "{}" ? "${wifi.name} (${wifi.device})" : ""} (label :class "symbol" - :text {wifi != "{}" ? "󰤨" : ethernet != "{}" ? "󰈁" : "󰤮"}))) + :text {wifi != "{}" ? "󰤨" : ethernet != "{}" ? "󰈀" : "󰤮"}))) (defwidget bar_bluetooth [] (box :class "bar-bluetooth ${bluetooth == "{}" ? "disabled" : ""}" (label :text {bluetooth != "{}" ? "󰂯" : "󰂲"}))) -;; Idle Inhibitor +;; Power Menu (defpoll idleinhibit :interval "10s" :initial "0" "pgrep -c -f wayland\"\"-idle-inhibitor || true") -(defwidget bar_idleinhibit [] - (eventbox :onclick "scripts/toggle-idle-inhibit && ${EWW_CMD} poll idleinhibit" - (box :class "bar-idleinhibit ${idleinhibit > 0 ? "active" : ""}" - (label :text {idleinhibit > 0 ? "󰈈" : "󰛑"})))) +(defwidget bar_power [] + (eventbox :onclick "${EWW_CMD} active-windows | grep -q power \ +&& ${EWW_CMD} close power || ${EWW_CMD} open power" + (box :class "bar-power" + (label :text "⏻")))) + +(defwindow power + :monitor 0 + :geometry (geometry + :width "375px" + :height "150px" + :anchor "top right") + :namespace "eww-bar" + :stacking "fg" + :exclusive false + :focusable false + (eventbox :onhoverlost "${EWW_CMD} close power" + (box :class "power" + :orientation "v" + (box :orientation "h" + (button :onclick "systemctl suspend" + :tooltip "Sleep" + (box :style "color: #9aa5ce;" + (label :text "󰤄"))) + (button :onclick "hyprlock --immediate &" + :tooltip "Lock" + (box :style "color: #cfc9c2;" + (label :text ""))) + (button :onclick "hyprctl dispatch exit" + :tooltip "Log Out" + (box :style "color: #7dcfff; padding-left: 0.3ex;" + (label :text ""))) + (button :onclick "reboot" + :tooltip "Reboot" + (box :style "color: #e0af68;" + (label :text ""))) + (button :onclick "poweroff" + :tooltip "Shutdown" + (box :style "color: #f7768e; font-size: 1.35em; padding-bottom: 0.15ex;" + (label :text "⏼")))) + (box + :orientation "h" + (box) (box) (box) (box) + (button :onclick "scripts/toggle-idle-inhibit && ${EWW_CMD} poll idleinhibit" + :tooltip "Idle Inhibitor: ${idleinhibit > 0 ? "On" : "Off"}" + (box :style "padding-right: 0.5ex; ${idleinhibit > 0 ? + "color: #ff9e64" : + "color: #565f89; padding-top: 0.3ex;"}" + (label :text {idleinhibit > 0 ? "󰈈" : "󰛑"}))))))) + ;; Separator @@ -290,7 +338,7 @@ (bar_ram) (bar_battery) (bar_sep) - (bar_idleinhibit))) + (bar_power))) (defwidget fire_bar_layout [] (centerbox :class "bar" @@ -366,7 +414,7 @@ (defwindow fire_bar :monitor 0 :geometry (geometry :width "100%" - :height "3%" + :height "35px" :anchor "top center") :namespace "eww-bar" :stacking "fg" @@ -377,7 +425,7 @@ (defwindow earth_bar :monitor 0 :geometry (geometry :width "100%" - :height "3%" + :height "35px" :anchor "top center") :namespace "eww-bar" :stacking "fg" diff --git a/home-manager/wayland/hyprland.nix b/home-manager/wayland/hyprland.nix index c98db15..85db0af 100644 --- a/home-manager/wayland/hyprland.nix +++ b/home-manager/wayland/hyprland.nix @@ -93,7 +93,6 @@ in { bind = [ "$mod, Return, exec, $terminal" "$mod, D, exec, $menu" - "$mod Shift, E, exec, ${scripts}/exit" "$mod, M, exec, hyprlock --immediate" # Emacs Everywhere diff --git a/home-manager/wayland/scripts/exit b/home-manager/wayland/scripts/exit deleted file mode 100755 index 10477b9..0000000 --- a/home-manager/wayland/scripts/exit +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -pkill -0 swaynag || \ - swaynag -t exit -m "Do you really want to exit?" \ - -B "Reboot" "reboot" -B "Shutdown" "poweroff" -b "Exit" "hyprctl dispatch exit" diff --git a/home-manager/wayland/wltools.nix b/home-manager/wayland/wltools.nix index d5c9540..dcfbfd0 100644 --- a/home-manager/wayland/wltools.nix +++ b/home-manager/wayland/wltools.nix @@ -9,19 +9,6 @@ imv ]; - xdg.configFile."swaynag/config".text = '' - font=JetBrainsMono 10 - layer=top - - [exit] - background=111320D0 - text=a9b1d6 - border-bottom=7BC5E4 - border-bottom-size=1 - button-background=282E49F0 - button-border-size=2 - ''; - # Hyprlock programs.hyprlock.enable = true; From e3228bb1ef89b6de7f4a84c89c147ce4aa78c5a7 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Tue, 25 Feb 2025 00:55:44 -0500 Subject: [PATCH 05/10] fix: resolve conflicting click actions in status bar volume --- home-manager/wayland/eww/eww.yuck | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/home-manager/wayland/eww/eww.yuck b/home-manager/wayland/eww/eww.yuck index 57b3614..061c84e 100644 --- a/home-manager/wayland/eww/eww.yuck +++ b/home-manager/wayland/eww/eww.yuck @@ -110,11 +110,11 @@ (defwidget bar_scale [?class reveal-name reveal value symbol onchange ?onclick] (eventbox :onhover "${EWW_CMD} update ${reveal-name}=true" :onhoverlost "${EWW_CMD} update ${reveal-name}=false" - :onclick onclick (box :class "bar-scale ${class}" :space-evenly false - (label :class "symbol" - :text symbol) + (eventbox :onclick onclick + (label :class "symbol" + :text symbol)) (revealer :transition "slideright" :reveal reveal :duration "400ms" @@ -124,10 +124,11 @@ :min 0 :max 101 :onchange onchange)) - (label :class "percent" - :width 29 - :xalign 0 - :text "${value}%")))) + (eventbox :onclick onclick + (label :class "percent" + :width 29 + :xalign 0 + :text "${value}%"))))) (defvar volume_reveal false) From 2981dca2883cd25622f296a6edbc805e1ccf5a91 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Thu, 27 Feb 2025 15:44:11 -0500 Subject: [PATCH 06/10] refactor: remove unnecessary `label` widgets in EWW bar --- home-manager/wayland/eww/eww.scss | 7 +------ home-manager/wayland/eww/eww.yuck | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/home-manager/wayland/eww/eww.scss b/home-manager/wayland/eww/eww.scss index da3434a..0e63d34 100644 --- a/home-manager/wayland/eww/eww.scss +++ b/home-manager/wayland/eww/eww.scss @@ -200,17 +200,12 @@ scale trough { .bar-internet { margin-left: 5px; margin-right: 9px; - font-family: "JetBrains Mono"; + font-size: 15px; color: #bb9af7; - font-size: 12px; &.disabled { color: $disabled; } - - .symbol { - font-size: 15px; - } } .bar-bluetooth { diff --git a/home-manager/wayland/eww/eww.yuck b/home-manager/wayland/eww/eww.yuck index 061c84e..7ad1c48 100644 --- a/home-manager/wayland/eww/eww.yuck +++ b/home-manager/wayland/eww/eww.yuck @@ -32,9 +32,9 @@ } ${workspace.windows > 0 ? "occupied" : "empty" } ${workspace.previous > 0 ? "previous-occupied" : "previous-empty" } ${workspace.next > 0 ? "next-occupied" : "next-empty"}" - (label :text {workspace.id})) + {workspace.id}) (box :visible {workspace.id == current_workspace} - (label :text {workspace.id}))))) + {workspace.id})))) (defwidget bar_workspaces [] (eventbox :onscroll "scripts/change-active-workspace {} ${current_workspace}" @@ -104,9 +104,10 @@ :halign "start" :limit-width title-limit :text {mpris.title ?: ""})))))) -;; Scales (Volume + Brightness) +;; Scales (Volume + Brightness) + (defwidget bar_scale [?class reveal-name reveal value symbol onchange ?onclick] (eventbox :onhover "${EWW_CMD} update ${reveal-name}=true" :onhoverlost "${EWW_CMD} update ${reveal-name}=false" @@ -224,12 +225,11 @@ :space-evenly false :tooltip {ethernet != "{}" ? "${ethernet.name} (${ethernet.device})" : wifi != "{}" ? "${wifi.name} (${wifi.device})" : ""} - (label :class "symbol" - :text {wifi != "{}" ? "󰤨" : ethernet != "{}" ? "󰈀" : "󰤮"}))) + {wifi != "{}" ? "󰤨" : ethernet != "{}" ? "󰈀" : "󰤮"})) (defwidget bar_bluetooth [] (box :class "bar-bluetooth ${bluetooth == "{}" ? "disabled" : ""}" - (label :text {bluetooth != "{}" ? "󰂯" : "󰂲"}))) + {bluetooth != "{}" ? "󰂯" : "󰂲"})) ;; Power Menu @@ -240,7 +240,7 @@ (eventbox :onclick "${EWW_CMD} active-windows | grep -q power \ && ${EWW_CMD} close power || ${EWW_CMD} open power" (box :class "bar-power" - (label :text "⏻")))) + "⏻"))) (defwindow power :monitor 0 @@ -259,23 +259,23 @@ (button :onclick "systemctl suspend" :tooltip "Sleep" (box :style "color: #9aa5ce;" - (label :text "󰤄"))) + "󰤄")) (button :onclick "hyprlock --immediate &" :tooltip "Lock" (box :style "color: #cfc9c2;" - (label :text ""))) + "")) (button :onclick "hyprctl dispatch exit" :tooltip "Log Out" (box :style "color: #7dcfff; padding-left: 0.3ex;" - (label :text ""))) + "")) (button :onclick "reboot" :tooltip "Reboot" (box :style "color: #e0af68;" - (label :text ""))) + "")) (button :onclick "poweroff" :tooltip "Shutdown" (box :style "color: #f7768e; font-size: 1.35em; padding-bottom: 0.15ex;" - (label :text "⏼")))) + "⏼"))) (box :orientation "h" (box) (box) (box) (box) @@ -284,7 +284,7 @@ (box :style "padding-right: 0.5ex; ${idleinhibit > 0 ? "color: #ff9e64" : "color: #565f89; padding-top: 0.3ex;"}" - (label :text {idleinhibit > 0 ? "󰈈" : "󰛑"}))))))) + {idleinhibit > 0 ? "󰈈" : "󰛑"})))))) ;; Separator @@ -293,7 +293,7 @@ (box :class "bar-sep" :hexpand false :vexpand false - (label :text "|"))) + "|")) ;; Bar Layout From c029404eaa4485053d0de7e181dadf00c4276565 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Thu, 27 Feb 2025 15:50:13 -0500 Subject: [PATCH 07/10] fix: close EWW power menu on button press --- home-manager/wayland/eww/eww.yuck | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/home-manager/wayland/eww/eww.yuck b/home-manager/wayland/eww/eww.yuck index 7ad1c48..0e1d013 100644 --- a/home-manager/wayland/eww/eww.yuck +++ b/home-manager/wayland/eww/eww.yuck @@ -256,23 +256,23 @@ (box :class "power" :orientation "v" (box :orientation "h" - (button :onclick "systemctl suspend" + (button :onclick "${EWW_CMD} close power; systemctl suspend" :tooltip "Sleep" (box :style "color: #9aa5ce;" "󰤄")) - (button :onclick "hyprlock --immediate &" + (button :onclick "${EWW_CMD} close power; hyprlock --immediate &" :tooltip "Lock" (box :style "color: #cfc9c2;" "")) - (button :onclick "hyprctl dispatch exit" + (button :onclick "${EWW_CMD} close power; hyprctl dispatch exit" :tooltip "Log Out" (box :style "color: #7dcfff; padding-left: 0.3ex;" "")) - (button :onclick "reboot" + (button :onclick "${EWW_CMD} close power; reboot" :tooltip "Reboot" (box :style "color: #e0af68;" "")) - (button :onclick "poweroff" + (button :onclick "${EWW_CMD} close power; poweroff" :tooltip "Shutdown" (box :style "color: #f7768e; font-size: 1.35em; padding-bottom: 0.15ex;" "⏼"))) From 7933cd829b573a55896f5ccd13465e16f468b40e Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Thu, 27 Feb 2025 15:54:20 -0500 Subject: [PATCH 08/10] refactor: remove unnecessary classes in EWW config --- home-manager/wayland/eww/eww.yuck | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home-manager/wayland/eww/eww.yuck b/home-manager/wayland/eww/eww.yuck index 0e1d013..f761c00 100644 --- a/home-manager/wayland/eww/eww.yuck +++ b/home-manager/wayland/eww/eww.yuck @@ -29,9 +29,9 @@ (eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" (overlay (box :class "workspace-button ${workspace.id == current_workspace ? "current" : "" -} ${workspace.windows > 0 ? "occupied" : "empty" -} ${workspace.previous > 0 ? "previous-occupied" : "previous-empty" -} ${workspace.next > 0 ? "next-occupied" : "next-empty"}" +} ${workspace.windows > 0 ? "occupied" : "" +} ${workspace.previous > 0 ? "previous-occupied" : "" +} ${workspace.next > 0 ? "next-occupied" : ""}" {workspace.id}) (box :visible {workspace.id == current_workspace} {workspace.id})))) From 0275dcacddcd590f16ba48eaa21b363af9915441 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Mon, 3 Mar 2025 16:41:05 -0500 Subject: [PATCH 09/10] fix(eww): add support for multiple screens to status bar --- home-manager/wayland/eww/eww.yuck | 41 ++++++++++++++----------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/home-manager/wayland/eww/eww.yuck b/home-manager/wayland/eww/eww.yuck index f761c00..b0aee77 100644 --- a/home-manager/wayland/eww/eww.yuck +++ b/home-manager/wayland/eww/eww.yuck @@ -236,14 +236,13 @@ (defpoll idleinhibit :interval "10s" :initial "0" "pgrep -c -f wayland\"\"-idle-inhibitor || true") -(defwidget bar_power [] - (eventbox :onclick "${EWW_CMD} active-windows | grep -q power \ -&& ${EWW_CMD} close power || ${EWW_CMD} open power" +(defwidget bar_power [screen] + (eventbox :onclick "${EWW_CMD} active-windows | grep -q power_${screen} \ +&& ${EWW_CMD} close power_${screen} || ${EWW_CMD} open power --id power_${screen} --screen ${screen}" (box :class "bar-power" "⏻"))) -(defwindow power - :monitor 0 +(defwindow power [screen] :geometry (geometry :width "375px" :height "150px" @@ -252,27 +251,27 @@ :stacking "fg" :exclusive false :focusable false - (eventbox :onhoverlost "${EWW_CMD} close power" + (eventbox :onhoverlost "${EWW_CMD} close power_${screen}" (box :class "power" :orientation "v" (box :orientation "h" - (button :onclick "${EWW_CMD} close power; systemctl suspend" + (button :onclick "${EWW_CMD} close power_${screen}; systemctl suspend" :tooltip "Sleep" (box :style "color: #9aa5ce;" "󰤄")) - (button :onclick "${EWW_CMD} close power; hyprlock --immediate &" + (button :onclick "${EWW_CMD} close power_${screen}; hyprlock --immediate &" :tooltip "Lock" (box :style "color: #cfc9c2;" "")) - (button :onclick "${EWW_CMD} close power; hyprctl dispatch exit" + (button :onclick "${EWW_CMD} close power_${screen}; hyprctl dispatch exit" :tooltip "Log Out" (box :style "color: #7dcfff; padding-left: 0.3ex;" "")) - (button :onclick "${EWW_CMD} close power; reboot" + (button :onclick "${EWW_CMD} close power_${screen}; reboot" :tooltip "Reboot" (box :style "color: #e0af68;" "")) - (button :onclick "${EWW_CMD} close power; poweroff" + (button :onclick "${EWW_CMD} close power_${screen}; poweroff" :tooltip "Shutdown" (box :style "color: #f7768e; font-size: 1.35em; padding-bottom: 0.15ex;" "⏼"))) @@ -324,7 +323,7 @@ :artist-limit 30 :title-limit 25))) -(defwidget fire_bar_right_edge [] +(defwidget fire_bar_right_edge [screen] (box :orientation "h" :space-evenly false :halign "end" @@ -339,9 +338,9 @@ (bar_ram) (bar_battery) (bar_sep) - (bar_power))) + (bar_power :screen screen))) -(defwidget fire_bar_layout [] +(defwidget fire_bar_layout [screen] (centerbox :class "bar" :orientation "h" (box :orientation "h" @@ -353,7 +352,7 @@ (box :orientation "h" :space-evenly false (fire_bar_right_wing) - (fire_bar_right_edge)))) + (fire_bar_right_edge :screen screen)))) (defwidget earth_bar_left_edge [] @@ -397,7 +396,7 @@ (bar_sep) (bar_idleinhibit))) -(defwidget earth_bar_layout [] +(defwidget earth_bar_layout [screen] (centerbox :class "bar" :orientation "h" (box :orientation "h" @@ -412,8 +411,7 @@ (earth_bar_right_edge)))) -(defwindow fire_bar - :monitor 0 +(defwindow fire_bar [screen] :geometry (geometry :width "100%" :height "35px" :anchor "top center") @@ -421,10 +419,9 @@ :stacking "fg" :exclusive true :focusable false - (fire_bar_layout)) + (fire_bar_layout :screen screen)) -(defwindow earth_bar - :monitor 0 +(defwindow earth_bar [screen] :geometry (geometry :width "100%" :height "35px" :anchor "top center") @@ -432,4 +429,4 @@ :stacking "fg" :exclusive true :focusable false - (earth_bar_layout)) + (earth_bar_layout :screen screen)) From 264fc1406d9b277a9fe7495a7f1fe86850bca796 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Fri, 7 Mar 2025 21:07:59 -0500 Subject: [PATCH 10/10] tweak: switch from `jaq` to `jq` `jaq` is not really better than `jq`, and it's more useful to have the more popular version in my environment. --- config/packages.nix | 2 +- home-manager/wayland/eww/scripts/active-window | 4 ++-- home-manager/wayland/eww/scripts/get-active-workspace | 2 +- home-manager/wayland/eww/scripts/get-workspaces | 6 +++--- home-manager/wayland/scripts/multimedia | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/packages.nix b/config/packages.nix index 20db65d..be9a838 100644 --- a/config/packages.nix +++ b/config/packages.nix @@ -25,7 +25,7 @@ in { in [ # Shell socat - jaq + jq tldr ripgrep unzip diff --git a/home-manager/wayland/eww/scripts/active-window b/home-manager/wayland/eww/scripts/active-window index 2124d68..8678080 100755 --- a/home-manager/wayland/eww/scripts/active-window +++ b/home-manager/wayland/eww/scripts/active-window @@ -1,6 +1,6 @@ #!/usr/bin/env bash -hyprctl activewindow -j | jaq -c . +hyprctl activewindow -j | jq -c . socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 grep -ose '^activewindow>>' | while read -r line; do - hyprctl activewindow -j | jaq -c . + hyprctl activewindow -j | jq -c . done diff --git a/home-manager/wayland/eww/scripts/get-active-workspace b/home-manager/wayland/eww/scripts/get-active-workspace index b5d8dd3..65245a4 100755 --- a/home-manager/wayland/eww/scripts/get-active-workspace +++ b/home-manager/wayland/eww/scripts/get-active-workspace @@ -1,4 +1,4 @@ #!/usr/bin/env bash -hyprctl monitors -j | jaq '.[] | select(.focused) | .activeWorkspace.id' +hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id' socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}' diff --git a/home-manager/wayland/eww/scripts/get-workspaces b/home-manager/wayland/eww/scripts/get-workspaces index 5957cb2..3d43617 100755 --- a/home-manager/wayland/eww/scripts/get-workspaces +++ b/home-manager/wayland/eww/scripts/get-workspaces @@ -1,9 +1,9 @@ #!/usr/bin/env bash workspaces() { - hyprctl workspaces -j | jaq -c 'map({key: .id | tostring, value: .windows}) | from_entries - | . as $windows | [range(1;11) | {id: tostring, windows: $windows[tostring] // 0, - previous: $windows[.-1|tostring] // 0, next: $windows[.+1|tostring] // 0}]' + hyprctl workspaces -j | jq -c 'map({key: .id | tostring, value: .windows}) | from_entries + | . as $windows | [range(1;11) | {id: tostring, windows: ($windows[tostring] // 0), + previous: ($windows[.-1|tostring] // 0), next: ($windows[.+1|tostring] // 0)}]' } workspaces diff --git a/home-manager/wayland/scripts/multimedia b/home-manager/wayland/scripts/multimedia index d55c3e4..e5ac5fa 100755 --- a/home-manager/wayland/scripts/multimedia +++ b/home-manager/wayland/scripts/multimedia @@ -1,4 +1,4 @@ #!/usr/bin/env bash notify-send "$1" "$2" -c multimedia -a "$3" \ - $(makoctl list | jaq -r 'first(.data[][]|select(.category.data=="multimedia")|.id.data|["-r",.])[]') \ + $(makoctl list | jq -r 'first(.data[][]|select(.category.data=="multimedia")|.id.data|["-r",.])[]') \ -h "INT:value:$4"