From 42a02dea80094145bea4f07c72e84a5868d63e69 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sun, 30 Aug 2026 01:01:48 +0530 Subject: feat: replaced python scripts with lua - using lua scripts where we previously used python for lower resource consumption --- modules/desktop/eww/yuck.nix | 54 +++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'modules/desktop/eww/yuck.nix') 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) -- cgit v1.2.3