diff options
| author | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-26 22:01:03 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-26 22:01:03 +0530 |
| commit | d1ec6eec44e2f7787ec670676933bbcc3d07d361 (patch) | |
| tree | 7434bfc7fdd4f870dc9ea7940b767ac9400c9630 /modules/desktop | |
| parent | 0afd73753d72b7ac2de83f80f457a85a5a33a29c (diff) | |
| download | home-manager-config-d1ec6eec44e2f7787ec670676933bbcc3d07d361.tar.gz home-manager-config-d1ec6eec44e2f7787ec670676933bbcc3d07d361.zip | |
feat: added actions for different modules
Diffstat (limited to 'modules/desktop')
| -rw-r--r-- | modules/desktop/niri/default.nix | 13 | ||||
| -rw-r--r-- | modules/desktop/rofi/default.nix | 50 | ||||
| -rw-r--r-- | modules/desktop/rofi/rofi-action.sh | 1 |
3 files changed, 36 insertions, 28 deletions
diff --git a/modules/desktop/niri/default.nix b/modules/desktop/niri/default.nix index b17ea12..3368766 100644 --- a/modules/desktop/niri/default.nix +++ b/modules/desktop/niri/default.nix @@ -80,8 +80,9 @@ in wayland.windowManager.niri = { enable = true; systemd.enable = true; - # Let Niri register its recommended GNOME portal implementation. - portalPackage = pkgs.xdg-desktop-portal-gnome; + # Don't let Niri register its own portal. We will use xdg.portal for the + # configuration of portal + portalPackage = null; }; # For setting the desktop wallpaper @@ -147,5 +148,13 @@ in "fill" ]; }; + + desktop.rofi.action.actions = [ + { + name = "Poweroff Monitors"; + command = "${lib.getExe cfg.niri.package} msg action power-off-monitors"; + icon = "network-vpn-symbolic"; + } + ]; }; } diff --git a/modules/desktop/rofi/default.nix b/modules/desktop/rofi/default.nix index 0c0e6df..2eab3f2 100644 --- a/modules/desktop/rofi/default.nix +++ b/modules/desktop/rofi/default.nix @@ -8,30 +8,6 @@ let cfg = config.desktop.rofi; base16Colors = import ../../colors/base16 { inherit config lib pkgs; }; - - actionOptionsString = lib.concatMapStringsSep "\\n" ( - action: action.name + lib.optionalString (action.icon != null) "\\0icon\\x1f${action.icon}" - ) cfg.action.actions; - - actionCasesString = lib.concatStringsSep "\n" ( - map (action: " \"${action.name}\") ${action.command} ;;") cfg.action.actions - ); - - actionScript = pkgs.writeShellApplication { - name = "rofi-action"; - runtimeInputs = [ - config.terminal.bash.package - cfg.package - ]; - text = - builtins.replaceStrings - [ - "@@OPTIONS@@" - ''"@@CASES@@") : ;;'' - ] - [ actionOptionsString actionCasesString ] - (builtins.readFile ./rofi-action.sh); - }; in { options.desktop.rofi = { @@ -70,7 +46,6 @@ in package = lib.mkOption { type = lib.types.package; readOnly = true; - default = actionScript; description = "The rofi-action script package."; }; }; @@ -106,5 +81,30 @@ in }; home.packages = lib.mkIf (cfg.action.actions != [ ]) [ cfg.action.package ]; + + desktop.rofi.action.package = pkgs.writeShellApplication { + name = "rofi-action"; + runtimeInputs = [ + config.terminal.bash.package + cfg.package + ]; + text = + let + actions = cfg.action.actions; + optionsString = lib.concatMapStringsSep "\\n" ( + action: action.name + lib.optionalString (action.icon != null) "\\0icon\\x1f${action.icon}" + ) actions; + casesString = lib.concatStringsSep "\n" ( + map (action: " \"${action.name}\") ${action.command} ;;") actions + ); + in + builtins.replaceStrings + [ + "@@OPTIONS@@" + ''"@@CASES@@") : ;;'' + ] + [ optionsString casesString ] + (builtins.readFile ./rofi-action.sh); + }; }; } diff --git a/modules/desktop/rofi/rofi-action.sh b/modules/desktop/rofi/rofi-action.sh index 1e09b75..844e0c9 100644 --- a/modules/desktop/rofi/rofi-action.sh +++ b/modules/desktop/rofi/rofi-action.sh @@ -8,6 +8,5 @@ options="@@OPTIONS@@" chosen=$(echo -e "$options" | rofi -dmenu -i -p "Action:") case "$chosen" in -# replacing "@@CASES@@") : ;; instead of @@CASES@@ for linter/formatter "@@CASES@@") : ;; esac |
