diff options
| author | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-08-30 01:01:48 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-08-31 05:20:12 +0530 |
| commit | 42a02dea80094145bea4f07c72e84a5868d63e69 (patch) | |
| tree | 4c307e7a03b55f3ed2441cb4e759d6373b907a66 /modules/desktop/eww/yuck.nix | |
| parent | 66e401fb6324c073a0770e0a4afe6d5cca830046 (diff) | |
| download | home-manager-config-42a02dea80094145bea4f07c72e84a5868d63e69.tar.gz home-manager-config-42a02dea80094145bea4f07c72e84a5868d63e69.zip | |
feat: replaced python scripts with lua
- using lua scripts where we previously used python for lower resource
consumption
Diffstat (limited to 'modules/desktop/eww/yuck.nix')
| -rw-r--r-- | modules/desktop/eww/yuck.nix | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/modules/desktop/eww/yuck.nix b/modules/desktop/eww/yuck.nix index 353c094..4f6c158 100644 --- a/modules/desktop/eww/yuck.nix +++ b/modules/desktop/eww/yuck.nix @@ -8,21 +8,19 @@ config = lib.mkIf config.desktop.enable { programs.eww.yuckConfig = let - mkPythonScript = + mkLuaScript = { name, path, description ? "", - python ? pkgs.python3, - pythonPackages ? (ps: [ ]), + lua ? pkgs.luajit, + luaPackages ? (_: [ ]), deps ? [ ], gobjectIntrospection ? false, }: let - pythonEnv = python.withPackages pythonPackages; - pathPrefix = lib.concatStringsSep ":" ( - [ "${pythonEnv}/bin" ] ++ map (p: "${lib.getBin p}/bin") deps - ); + luaEnv = lua.withPackages luaPackages; + pathPrefix = lib.concatStringsSep ":" ([ "${luaEnv}/bin" ] ++ map (p: "${lib.getBin p}/bin") deps); in pkgs.stdenv.mkDerivation { pname = name; @@ -61,10 +59,16 @@ ''; }; - system-stats = mkPythonScript { + system-stats = mkLuaScript { name = "eww-system-stats"; - path = ./system-stats.py; + path = ./system-stats.lua; description = "Emit {cpu, ram, net} as JSON."; + luaPackages = ( + ps: [ + ps.lua-cjson + ps.luaposix + ] + ); deps = [ pkgs.iw pkgs.iproute2 @@ -74,29 +78,24 @@ ]; }; - workspaces = mkPythonScript { - name = "eww-workspaces"; - path = ./workspaces.py; - description = "Emit workspace list with each focused-app icon, driven by niri's event-stream."; - pythonPackages = (ps: [ ps.pygobject3 ]); - deps = [ config.desktop.niri.package ]; - gobjectIntrospection = true; - }; - - activate-windows = mkPythonScript { - name = "eww-activate-windows"; - path = ./activate-windows.py; - description = "Emit icons for windows on the active niri workspace via event-stream."; - pythonPackages = (ps: [ ps.pygobject3 ]); + niri-status = mkLuaScript { + name = "niri-status"; + path = ./niri-status.lua; + description = "Emit workspace and active window information list."; + luaPackages = ( + ps: [ + ps.lgi + ps.lua-cjson + ] + ); deps = [ config.desktop.niri.package ]; gobjectIntrospection = true; }; in builtins.replaceStrings [ - "@@workspaces-script@@" - "@@windows-script@@" - "@@systemstats-script@@" + "@@niri-status-script@@" + "@@system-stats-script@@" "@@icon-offline@@" "@@icon-wifi@@" "@@icon-ethernet@@" @@ -107,8 +106,7 @@ "@@icon-calendar@@" ] [ - (lib.getExe workspaces) - (lib.getExe activate-windows) + (lib.getExe niri-status) (lib.getExe system-stats) (toString ../../../assets/icons/bar/offline.svg) (toString ../../../assets/icons/bar/wifi.svg) |
