diff --git a/config/ags/lib/utils.ts b/config/ags/lib/utils.ts index f013cb0..dd9e945 100644 --- a/config/ags/lib/utils.ts +++ b/config/ags/lib/utils.ts @@ -127,20 +127,22 @@ export function findApp(klass: string) { if (ret.length === 0) ret = filter(["name", "executable", "description"]) - if (ret.length > 1) print(`multiple apps found for ${klass}`) - ret.forEach((app) => { - const props = [ - "name", - "icon_name", - "desktop", - "wm_class", - "description", - "frequency", - "executable", - ] - print(` - name: ${app.name}`) - for (const prop of props) print(` * ${prop}: ${app[prop]}`) - }) + if (ret.length > 1) { + print(`multiple apps found for ${klass}`) + ret.forEach((app) => { + const props = [ + "name", + "icon_name", + "desktop", + "wm_class", + "description", + "frequency", + "executable", + ] + print(` - name: ${app.name}`) + for (const prop of props) print(` * ${prop}: ${app[prop]}`) + }) + } if (ret.length === 0) print(`no app found for ${klass}`) return ret[0] diff --git a/config/ags/widget/bar/buttons/Taskbar.ts b/config/ags/widget/bar/buttons/Taskbar.ts index 224952e..7902750 100644 --- a/config/ags/widget/bar/buttons/Taskbar.ts +++ b/config/ags/widget/bar/buttons/Taskbar.ts @@ -24,7 +24,23 @@ const AppItem = (address: string) => { const title = Utils.watch(client.title, hyprland, () => hyprland.getClient(address)?.title || "") - const icon_name = app?.icon_name ?? client.class + const ico = Utils.merge([title, monochrome.bind()], (title, monochrome) => { + let icon_name = app?.icon_name ?? client.class + let icon_fallback = icons.fallback.executable + + if (app?.name === "WezTerm") { + const cmd = title.split(" ")[1] + if (cmd) { + icon_fallback = icon_name + icon_name = cmd + } + } + + return icon( + icon_name + (monochrome ? "-symbolic" : ""), + icon_fallback + (monochrome ? "-symbolic" : "") + ) + }) const btn = PanelButton({ class_name: "panel-button", @@ -34,14 +50,7 @@ const AppItem = (address: string) => { child: Widget.Box([ Widget.Icon({ size: iconSize.bind(), - icon: monochrome - .bind() - .as((m) => - icon( - icon_name + (m ? "-symbolic" : ""), - icons.fallback.executable + (m ? "-symbolic" : "") - ) - ), + icon: ico, }), Widget.Label({ label: title,