Add initial rofi lib
This commit is contained in:
@ -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,
|
||||
|
@ -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 =
|
||||
|
@ -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
21
lib/rofi.nix
Normal 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}
|
||||
'';
|
||||
}
|
Reference in New Issue
Block a user