refactor(waybar): store rendered window icons
This commit is contained in:
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
## Desktop
|
## Desktop
|
||||||
|
|
||||||
- TODO: Verify this path after the NixOS configuration is migrated.
|
- When adding a graphical application, register its workspace icon in `registry.window-icon`.
|
||||||
When adding a graphical application, add a `window-rewrite` icon mapping in `modules/desktop/session/waybar.nix`.
|
|
||||||
The workspace indicator uses this mapping to show an application icon instead of the generic default glyph.
|
The workspace indicator uses this mapping to show an application icon instead of the generic default glyph.
|
||||||
Match the mapping on the window class.
|
Match the mapping on the window class.
|
||||||
|
Store the icon as the rendered string.
|
||||||
Run `hyprctl clients -j | jq -r '.[].class' | sort -u` to list classes in the running session.
|
Run `hyprctl clients -j | jq -r '.[].class' | sort -u` to list classes in the running session.
|
||||||
- TODO: Verify this path after the NixOS configuration is migrated.
|
- TODO: Verify this path after the NixOS configuration is migrated.
|
||||||
Set Hyprland session environment variables in `modules/desktop/session/hyprland/default.nix` with `env = KEY,VALUE`.
|
Set Hyprland session environment variables in `modules/desktop/session/hyprland/default.nix` with `env = KEY,VALUE`.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ in
|
|||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
registry.window-icon.${config.networking.hostName}.firefox = {
|
registry.window-icon.${config.networking.hostName}.firefox = {
|
||||||
class = ".*[Ff]irefox.*";
|
class = ".*[Ff]irefox.*";
|
||||||
icon = "f269";
|
icon = builtins.fromJSON ''"\uf269"'';
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.${config.user.name} = hm: {
|
home-manager.users.${config.user.name} = hm: {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ in
|
|||||||
|
|
||||||
registry.window-icon.${config.networking.hostName}.ghostty = {
|
registry.window-icon.${config.networking.hostName}.ghostty = {
|
||||||
class = "com.mitchellh.ghostty";
|
class = "com.mitchellh.ghostty";
|
||||||
icon = "f120";
|
icon = builtins.fromJSON ''"\uf120"'';
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.${user}.home.packages = [ pkgs.ghostty ];
|
home-manager.users.${user}.home.packages = [ pkgs.ghostty ];
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ in
|
|||||||
|
|
||||||
registry.window-icon.${config.networking.hostName}.obsidian = {
|
registry.window-icon.${config.networking.hostName}.obsidian = {
|
||||||
class = "obsidian";
|
class = "obsidian";
|
||||||
icon = "f02d";
|
icon = builtins.fromJSON ''"\uf02d"'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ in
|
|||||||
|
|
||||||
registry.window-icon.${config.networking.hostName}.signal = {
|
registry.window-icon.${config.networking.hostName}.signal = {
|
||||||
class = "[Ss]ignal";
|
class = "[Ss]ignal";
|
||||||
icon = "f4ad";
|
icon = builtins.fromJSON ''"\uf4ad"'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
registry.window-icon.${config.networking.hostName}.steam = {
|
registry.window-icon.${config.networking.hostName}.steam = {
|
||||||
class = "[Ss]team";
|
class = "[Ss]team";
|
||||||
icon = "f1b6";
|
icon = builtins.fromJSON ''"\uf1b6"'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ in
|
|||||||
|
|
||||||
registry.window-icon.${config.networking.hostName}.vesktop = {
|
registry.window-icon.${config.networking.hostName}.vesktop = {
|
||||||
class = "[Vv]esktop";
|
class = "[Vv]esktop";
|
||||||
icon = "f1ff";
|
icon = builtins.fromJSON ''"\uf1ff"'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,6 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# The Hyprland compositor.
|
# The Hyprland compositor.
|
||||||
let
|
|
||||||
glyph = code: builtins.fromJSON ''"\u${code}"'';
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor";
|
options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor";
|
||||||
|
|
||||||
@@ -238,9 +235,9 @@ in
|
|||||||
on-click = "activate";
|
on-click = "activate";
|
||||||
format = "{id} {windows}";
|
format = "{id} {windows}";
|
||||||
format-window-separator = " ";
|
format-window-separator = " ";
|
||||||
window-rewrite-default = glyph "f2d0";
|
window-rewrite-default = builtins.fromJSON ''"\uf2d0"'';
|
||||||
window-rewrite = lib.mapAttrs' (
|
window-rewrite = lib.mapAttrs' (
|
||||||
_name: windowIcon: lib.nameValuePair "class<${windowIcon.class}>" (glyph windowIcon.icon)
|
_name: windowIcon: lib.nameValuePair "class<${windowIcon.class}>" windowIcon.icon
|
||||||
) (lib.attrByPath [ config.networking.hostName ] { } config.registry.window-icon);
|
) (lib.attrByPath [ config.networking.hostName ] { } config.registry.window-icon);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
icon = lib.mkOption {
|
icon = lib.mkOption {
|
||||||
description = "Sets the Nerd Font codepoint shown for matching windows.";
|
description = "Sets the icon shown for matching windows.";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
example = "f269";
|
example = "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user