From 32942aa0d04435ebfa35784ea8477096d7e8ef8d Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 18 May 2025 21:28:20 +0200 Subject: [PATCH] Fix hyprland rules/window orders & addback layout count --- environments/hyprland/hyprland.conf | 11 ++++++----- modules/wm/ags/layouts/bar.js | 1 + modules/wm/ags/modules/wm.js | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/environments/hyprland/hyprland.conf b/environments/hyprland/hyprland.conf index 485bf86..9021264 100644 --- a/environments/hyprland/hyprland.conf +++ b/environments/hyprland/hyprland.conf @@ -89,10 +89,10 @@ bindm = SUPER, mouse:273, resizewindow bind = Super, c, killactive bind = Super+Shift, c, forcekillactive -bind = Super, k, layoutmsg, cyclenext -bind = Super, j, layoutmsg, cycleprev -bind = Super+Shift, k, layoutmsg, swapnext -bind = Super+Shift, j, layoutmsg, swapprev +bind = Super, k, layoutmsg, cycleprev +bind = Super, j, layoutmsg, cyclenext +bind = Super+Shift, k, layoutmsg, swapprev +bind = Super+Shift, j, layoutmsg, swapnext bind = Super, Return, layoutmsg, swapwithmaster bind = Super, h, layoutmsg, mfact -0.05 @@ -143,7 +143,7 @@ bind = Super+Shift, l, exec, loginctl lock-session windowrule = workspace 3 silent, class:discord windowrule = workspace 3 silent, class:vesktop -windowrule = workspace 2 silent, class:Youtube Music +windowrule = workspace 2 silent, class:com.github.th_ch.youtube_music # smart gaps workspace = w[tv1], gapsout:0, gapsin:0 @@ -155,4 +155,5 @@ windowrule = rounding 0, floating:0, onworkspace:f[1] exec-once = wallpaper exec-once = ags +exec-once = [workspace 4 silent] kitty exec-once = hyprlock --immediate diff --git a/modules/wm/ags/layouts/bar.js b/modules/wm/ags/layouts/bar.js index ebc54d6..4b44d0b 100644 --- a/modules/wm/ags/layouts/bar.js +++ b/modules/wm/ags/layouts/bar.js @@ -25,6 +25,7 @@ export const Bar = (monitor) => monitor, labels: ["一", "二", "三", "四", "五", "六", "七", "八", "九"], }), + wm.Layout({ monitor }), wm.ClientLabel({ monitor }), ], }), diff --git a/modules/wm/ags/modules/wm.js b/modules/wm/ags/modules/wm.js index ac5cbf1..62f16df 100644 --- a/modules/wm/ags/modules/wm.js +++ b/modules/wm/ags/modules/wm.js @@ -43,6 +43,25 @@ export const Tags = ({ monitor, labels, ...props }) => { }); }; +/** @param {{monitor: number } & import("types/widgets/label").LabelProps} props */ +export const Layout = ({ monitor, ...props }) => { + const monName = getMonitorName(monitor); + return Widget.Label({ + className: "module", + ...props, + }).hook( + hyprland, + (self) => { + const mon = hyprland.monitors.find((x) => x.name === monName); + const ws = hyprland.workspaces.find( + (x) => x.id === mon?.activeWorkspace?.id, + ); + self.label = ws?.windows ? `[${ws?.windows}]` : ""; + }, + "changed", + ); +} + /** @param {{monitor: number, fallback?: string} & import("types/widgets/label").LabelProps} props */ export const ClientLabel = ({ monitor, fallback = "", ...props }) => { const monName = getMonitorName(monitor);