From c9ebaa4f19377a8401d7b2269daee8ef33c388f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Tue, 28 Oct 2025 18:35:26 +0700 Subject: [PATCH] Fix astal system tray --- home/ags/files/Bar.tsx | 7 +++- home/ags/files/utils.ts | 78 ++++++++++++++++++++++++++++------------ home/foot/default.nix | 1 + home/helium/default.nix | 4 +-- hosts/Aloria/default.nix | 19 ++++++++-- 5 files changed, 80 insertions(+), 29 deletions(-) diff --git a/home/ags/files/Bar.tsx b/home/ags/files/Bar.tsx index 19de811..708dc09 100644 --- a/home/ags/files/Bar.tsx +++ b/home/ags/files/Bar.tsx @@ -19,6 +19,7 @@ const wirePlumber = Wp.get_default(); function SysTray(): JSX.Element { const tray = Tray.get_default(); let items = createBinding(tray, "items"); + const init = (btn: Gtk.MenuButton, item: Tray.TrayItem) => { btn.menuModel = item.menuModel; btn.insert_action_group("dbusmenu", item.actionGroup); @@ -26,6 +27,7 @@ function SysTray(): JSX.Element { btn.insert_action_group("dbusmenu", item.actionGroup); }); }; + return ( @@ -38,7 +40,10 @@ function SysTray(): JSX.Element { tooltipMarkup={createBinding(item, "tooltipMarkup")} menuModel={createBinding(item, "menuModel")} > - + ); }} diff --git a/home/ags/files/utils.ts b/home/ags/files/utils.ts index 6179225..a49a3c3 100644 --- a/home/ags/files/utils.ts +++ b/home/ags/files/utils.ts @@ -1,40 +1,72 @@ -import Apps from "gi://AstalApps" +import Apps from "gi://AstalApps"; import AstalHyprland from "gi://AstalHyprland"; const app_icons = new Apps.Apps().list.reduce( (acc, app) => { - if (app.icon_name) { - acc.classOrNames[app.wm_class ?? app.name] = app.icon_name; + // keys from AstalApps entries are typically wm_class (snake_case) or name + const key = app.wm_class ?? app.name; + if (key) { + acc.classOrNames[key] = app.icon_name; + } + if (app.executable) { acc.executables[app.executable] = app.icon_name; } return acc; }, - { classOrNames: {}, executables: {} }, + { classOrNames: {} as Record, executables: {} as Record }, ); -export function getIconName(client: AstalHyprland.Client) { - if (!client) { - return ""; - } +export function getIconName(client: AstalHyprland.Client | null | undefined) { + if (!client) return ""; - let icon = app_icons.classOrNames[client.class]; - if (!icon) { - const icon_key = Object.keys(app_icons.classOrNames).find( - (key) => - key.includes(client.title) || - key.includes(client.initialTitle) || - key.includes(client.initialClass) || - key.includes(client.class), - ); - if (icon_key) { - icon = app_icons.classOrNames[icon_key]; - app_icons.classOrNames[client.class] = icon; + // try a bunch of fields (snake_case and camelCase variants) + const possibleKeys = [ + // common client properties (snake_case) + (client as any).wm_class, + (client as any).initial_class, + (client as any).executable, + // camelCase variants (some bindings expose these) + (client as any).class, + (client as any).initialClass, + (client as any).initialTitle, + (client as any).title, + (client as any).name, + ].filter(Boolean) as string[]; + + // 1) direct exact match + for (const k of possibleKeys) { + const icon = app_icons.classOrNames[k] ?? app_icons.executables[k]; + if (icon) { + // cache the mapping for this client's canonical class (prefer wm_class or class) + const cacheKey = (client as any).wm_class ?? (client as any).class ?? (client as any).name ?? k; + app_icons.classOrNames[cacheKey] = icon; + return icon; } } - if (!icon) { - app_icons.classOrNames[client.class] = ""; + // 2) fuzzy match: see if any stored key includes any of the client strings (title, name, etc.) + const searchStrings = [ + (client as any).title, + (client as any).initialTitle, + (client as any).initial_class, + (client as any).initialClass, + (client as any).wm_class, + (client as any).class, + (client as any).name, + ].filter(Boolean) as string[]; + + for (const s of searchStrings) { + const matchKey = Object.keys(app_icons.classOrNames).find((key) => key.includes(s)); + if (matchKey) { + const icon = app_icons.classOrNames[matchKey]; + const cacheKey = (client as any).wm_class ?? (client as any).class ?? (client as any).name ?? s; + app_icons.classOrNames[cacheKey] = icon; + return icon; + } } - return icon; + // nothing found — cache empty string so we don't repeat work + const cacheKey = (client as any).wm_class ?? (client as any).class ?? (client as any).name ?? ""; + if (cacheKey) app_icons.classOrNames[cacheKey] = ""; + return ""; } diff --git a/home/foot/default.nix b/home/foot/default.nix index 13fdac2..bc29bd2 100644 --- a/home/foot/default.nix +++ b/home/foot/default.nix @@ -12,6 +12,7 @@ tweak = { sixel = "yes"; }; + scrollback.lines = 100000; colors = { background = "000010"; foreground = "F8F8F2"; diff --git a/home/helium/default.nix b/home/helium/default.nix index 3d9c190..dd990cd 100644 --- a/home/helium/default.nix +++ b/home/helium/default.nix @@ -5,8 +5,8 @@ pname = "Helium"; version = "0.4.7.1"; src = pkgs.fetchurl { - url = "https://github.com/imputnet/helium-linux/releases/download/0.4.7.1/helium-0.4.7.1-x86_64.AppImage"; - sha256 = "b7a64d9cd96c841119f4729545d7b88ed804fdcac99d3878099f338766dfdd2d"; + url = "https://release-assets.githubusercontent.com/github-production-release-asset/1043354934/31a5650e-2719-4734-8aa7-8b45ff506fe7"; + sha256 = "275853aae038ee08a6d07ed314c33e25a6d8e5845c2f9b27253a4cfde94dd732"; }; }) ]; diff --git a/hosts/Aloria/default.nix b/hosts/Aloria/default.nix index 3dc16d3..1b4dca7 100644 --- a/hosts/Aloria/default.nix +++ b/hosts/Aloria/default.nix @@ -33,7 +33,7 @@ in { networking.wireless.iwd.enable = true; networking.wireless.iwd.settings = { IPv6 = { - Enabled = true; + Enabled = false; }; Settings = { AutoConnect = true; @@ -77,7 +77,7 @@ in { networking.wg-quick.interfaces = { Tunnel = { - address = [ "10.0.0.5/24" "2a02:a03f:83ad:2101::5/128" ]; + address = [ "10.0.0.5/24" ]; privateKeyFile = "/home/user/.secrets/Wireguard/Aloria.key"; listenPort = 51820; autostart = false; @@ -91,7 +91,7 @@ in { }]; }; OPNsense = { - address = [ "10.0.0.5/24" "2a02:a03f:83ad:2101::5/128" ]; + address = [ "10.0.0.5/24" ]; privateKeyFile = "/home/user/.secrets/Wireguard/Aloria.key"; listenPort = 51820; autostart = true; @@ -104,6 +104,19 @@ in { persistentKeepalive = 25; }]; }; + GCP = { + address = [ "10.5.0.5/24" ]; + privateKeyFile = "/home/user/.secrets/Wireguard/GCP.key"; + listenPort = 51820; + autostart = false; + postUp = "resolvectl dns GCP 1.1.1.1;resolvectl dns wlan0 1.1.1.1;"; + peers = [{ + publicKey = "NEBNE4Czf2MkZF2X5aVhmofENH1uXjDpvXjIMJvfMFA="; + allowedIPs = [ "0.0.0.0/0" ]; + endpoint = "35.201.231.151:443"; + persistentKeepalive = 25; + }]; + }; }; systemd.services."wg-quick-OPNsense" = { serviceConfig = { Restart = "on-failure"; RestartSec = "2s"; };