diff options
| author | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-08-26 22:49:00 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-08-29 03:50:30 +0530 |
| commit | c306d53594a6cefc2ecc39dd8d29f9edf1b8ed77 (patch) | |
| tree | 1966c04ec41ea302717f8f7eab5d27c250025155 /modules/desktop/eww/yuck.nix | |
| parent | 84125094b25c2e5c03f2c65b87167f8291aaab5f (diff) | |
| download | home-manager-config-c306d53594a6cefc2ecc39dd8d29f9edf1b8ed77.tar.gz home-manager-config-c306d53594a6cefc2ecc39dd8d29f9edf1b8ed77.zip | |
desktop: showing the icon of the currently focused window in workspaces
- showing the icon of the currently focused window in the workspaces
button for each workspace
Diffstat (limited to 'modules/desktop/eww/yuck.nix')
| -rw-r--r-- | modules/desktop/eww/yuck.nix | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/modules/desktop/eww/yuck.nix b/modules/desktop/eww/yuck.nix index b4757b8..0654d9a 100644 --- a/modules/desktop/eww/yuck.nix +++ b/modules/desktop/eww/yuck.nix @@ -8,15 +8,35 @@ config = lib.mkIf config.desktop.enable { programs.eww.yuckConfig = let - workspaces = pkgs.writeShellApplication { - name = "eww-workspaces"; - runtimeInputs = with pkgs; [ - config.desktop.niri.package - jq - ]; + workspaces = + let + pythonEnv = pkgs.python3.withPackages (ps: [ ps.pygobject3 ]); + in + pkgs.stdenv.mkDerivation { + pname = "eww-workspaces"; + version = "0.1.0"; + src = ./workspaces.py; + dontUnpack = true; + meta.mainProgram = "eww-workspaces"; + + nativeBuildInputs = [ + pkgs.wrapGAppsHook3 + pkgs.gobject-introspection + ]; + buildInputs = [ pkgs.gtk3 ]; - text = builtins.readFile ./workspaces.sh; - }; + installPhase = '' + mkdir -p $out/bin + install -m755 $src $out/bin/eww-workspaces + patchShebangs $out/bin/eww-workspaces + ''; + + # wrapGAppsHook3 wraps every executable in $out/bin automatically, + # setting GI_TYPELIB_PATH etc. from buildInputs' closure. + preFixup = '' + gappsWrapperArgs+=(--prefix PATH : "${pythonEnv}/bin") + ''; + }; activate-windows = let @@ -77,10 +97,13 @@ (box :orientation "v" :space-evenly false :spacing 4 :halign "fill" :class "workspaces" (for ws in workspaces (eventbox :onclick "niri msg action focus-workspace ''${ws.idx}" - :cursor "pointer" - :halign "fill" - (box :halign "fill" :class "workspace-button ''${ws.is_active ? 'active' : '''}" - (label :text "''${ws.idx}")))))) + :cursor "pointer" :halign "fill" + (box :class "workspace-button ''${ws.is_active ? 'active' : '''}" :halign "fill" + (overlay :halign "fill" + (image :class "workspace-icon" + :path "''${ws.icon != ''' ? ws.icon : '${../../../assets/icons/obs.svg}'}" + :image-width 20 :image-height 20) + (label :class "workspace-idx" :text "''${ws.idx}" :halign "end" :valign "end"))))))) (defwidget windows-widget [] (box :orientation "v" :space-evenly false :spacing 4 :halign "center" :class "windows" |
