From 06520092e81b2c8286dae8c3ee6494385620d75c Mon Sep 17 00:00:00 2001 From: KoenDR06 Date: Mon, 23 Mar 2026 18:37:21 +0100 Subject: [PATCH] add hyprland windowrule and tagging functionality for opacity --- lib/catppuccin.nix | 23 ++++++++++++++++++++--- modules/wm/hyprland/default.nix | 2 ++ modules/wm/hyprland/keybindings.nix | 7 +++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/catppuccin.nix b/lib/catppuccin.nix index 4bc397a..c70b676 100644 --- a/lib/catppuccin.nix +++ b/lib/catppuccin.nix @@ -1,11 +1,28 @@ {inputs, ...}: let - inherit (inputs.nixpkgs.lib) toHexString concatStrings strings; + inherit (inputs.nixpkgs.lib) toHexString concatStrings strings toLower; inherit (strings) fixedWidthString; padHex = n: fixedWidthString 2 "0" (toHexString n); -in { + padHexLower = n: fixedWidthString 2 "0" (toLower (toHexString n)); + toHex = color: concatStrings ["#" (padHex color.red) (padHex color.green) (padHex color.blue)]; toHexNoHash = color: concatStrings [(padHex color.red) (padHex color.green) (padHex color.blue)]; - toRGB = color: concatStrings ["rgb(" (toString color.red) "," (toString color.green) "," (toString color.blue) ")"]; + toRGB = color: concatStrings ["rgb(" (toHexNoHash color) ")"]; + toRGBHex = color: concatStrings ["rgb(" (padHexLower color.red) (padHexLower color.green) (padHexLower color.blue) ")"]; toRGBA = color: a: concatStrings ["rgba(" (toString color.red) "," (toString color.green) "," (toString color.blue) "," (toString a) ")"]; +in { + # 0xrrggbb + toHex = toHex; + + # rrggbb + toHexNoHash = toHexNoHash; + + # rgb(red,green,blue) + toRGB = toRGB; + + # rgb(rrggbb) + toRGBHex = toRGBHex; + + # rgb(red,green,blue,opac[0-1]) + toRGBA = toRGBA; } diff --git a/modules/wm/hyprland/default.nix b/modules/wm/hyprland/default.nix index 2703603..28c00c3 100644 --- a/modules/wm/hyprland/default.nix +++ b/modules/wm/hyprland/default.nix @@ -78,6 +78,8 @@ in { "nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0" "opacity 1.0 override, initialTitle:^Picture-in-Picture$" + "opacity 1.0 override, tag:full-opacity" + "bordercolor ${catppuccin.toRGBHex colors.yellow}, tag:full-opacity" "float, initialClass:CImg" "float, initialTitle:GLFW" diff --git a/modules/wm/hyprland/keybindings.nix b/modules/wm/hyprland/keybindings.nix index 70b6e2a..5c13d92 100644 --- a/modules/wm/hyprland/keybindings.nix +++ b/modules/wm/hyprland/keybindings.nix @@ -102,6 +102,13 @@ in { dispatcher = "exec"; params = "hyprlock"; } + { + flags = []; + mods = ["SUPER"]; + key = "O"; + dispatcher = "tagwindow"; + params = "full-opacity"; + } { flags = ["e"]; mods = ["SUPER"];