1

Add initial rofi lib

This commit is contained in:
2023-05-25 11:53:23 +02:00
parent 6d22fcfb8e
commit 3d72b59df5
4 changed files with 28 additions and 0 deletions

View File

@ -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,

View File

@ -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 =

View File

@ -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;};
}

21
lib/rofi.nix Normal file
View File

@ -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}
'';
}