diff --git a/home/modules/hyprland/default.nix b/home/modules/hyprland/default.nix index 2c4cb040..140e093c 100644 --- a/home/modules/hyprland/default.nix +++ b/home/modules/hyprland/default.nix @@ -1,4 +1,5 @@ # TODO: The keys to reset the workspaces need to depend on actual workspace config +# TODO: Many of the text file generations can be made simpler with pipe and concatLines functions... { config, nixosConfig, diff --git a/home/modules/rofi/default.nix b/home/modules/rofi/default.nix index 1256952d..11c0bcdf 100644 --- a/home/modules/rofi/default.nix +++ b/home/modules/rofi/default.nix @@ -19,6 +19,11 @@ in { rofi-wayland ]; + home.file.".config/rofi/menu-power.fish".text = mylib.rofi.mkSimpleMenu { + "Poweroff" = "poweroff"; + "Reload Hyprland" = "hyprctl reload"; + }; + home.activation = { # NOTE: Keep the rofi config symlinked, to allow easy changes with hotreload linkRofiConfig = diff --git a/lib/default.nix b/lib/default.nix index 665dabea..911ad62f 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -8,4 +8,5 @@ modules = import ./modules.nix {inherit inputs pkgs lib;}; networking = import ./networking.nix {inherit inputs pkgs lib;}; virtualisation = import ./virtualisation.nix {inherit inputs pkgs lib;}; + rofi = import ./rofi.nix {inherit inputs pkgs lib;}; } diff --git a/lib/rofi.nix b/lib/rofi.nix new file mode 100644 index 00000000..dc99359a --- /dev/null +++ b/lib/rofi.nix @@ -0,0 +1,21 @@ +{ + inputs, + pkgs, + lib, + ... +}: rec { + # Receives attrs like: + # { + # "Poweroff" = "poweroff"; + # "Reload Hyprland" = "hyprctl reload"; + # } + mkSimpleMenu = let + # Makes a string like ''"Poweroff" "Reload Hyprland"'' + unpack-options = attrs: "\"${lib.concatStringsSep "\" \"" builtins.attrNames attrs}\""; + in + prompt: attrs: '' + #! ${pkgs.fish}/bin/fish + + set OPTIONS ${unpack-options attrs} + ''; +}