feature(niri): Init module
This commit is contained in:
parent
9be8a82a29
commit
1857504bac
13 changed files with 1446 additions and 254 deletions
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./niri.nix
|
||||
./acpid.nix
|
||||
./anyrun.nix
|
||||
./basePackages.nix
|
||||
|
|
@ -48,6 +49,7 @@
|
|||
./virtmanager.nix
|
||||
./xkb.nix
|
||||
./xone.nix
|
||||
./wm.nix
|
||||
./yazi
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
mkDashDefault,
|
||||
pkgs,
|
||||
lib,
|
||||
options,
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ in {
|
|||
abbr --add ls 'lsd'
|
||||
abbr --add :q 'exit'
|
||||
abbr --add gh 'git push origin'
|
||||
abbr --add gu 'git push upstream'
|
||||
abbr --add gl 'git pull origin'
|
||||
abbr --add gm 'git commit -m'
|
||||
abbr --add ga "git add -A"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@
|
|||
'';
|
||||
};
|
||||
monitor = lib.mkOption {
|
||||
default = "${config.mods.hypr.hyprland.defaultMonitor}";
|
||||
default =
|
||||
if config.mods.wm.monitors != []
|
||||
then (builtins.elemAt config.mods.wm.monitors 0).name
|
||||
else "";
|
||||
example = "eDP-1";
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
|
|
@ -27,7 +30,10 @@
|
|||
'';
|
||||
};
|
||||
scale = lib.mkOption {
|
||||
default = "${config.mods.hypr.hyprland.defaultMonitorScale}";
|
||||
default =
|
||||
if config.mods.wm.monitors != []
|
||||
then builtins.toString (builtins.elemAt config.mods.wm.monitors 0).scale
|
||||
else "";
|
||||
example = "1.5";
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
|
|
@ -46,7 +52,14 @@
|
|||
description = "The compositor/greeter command to run";
|
||||
};
|
||||
resolution = lib.mkOption {
|
||||
default = "${config.mods.hypr.hyprland.defaultMonitorMode}";
|
||||
default =
|
||||
if config.mods.wm.monitors != []
|
||||
then let
|
||||
resX = builtins.toString (builtins.elemAt config.mods.wm.monitors 0).resolutionX;
|
||||
resY = builtins.toString (builtins.elemAt config.mods.wm.monitors 0).resolutionY;
|
||||
refresh = builtins.toString (builtins.elemAt config.mods.wm.monitors 0).refreshrate;
|
||||
in "${resX}x${resY}@${refresh}"
|
||||
else "";
|
||||
example = "3440x1440@180";
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
|
|
@ -55,7 +68,8 @@
|
|||
};
|
||||
environments = lib.mkOption {
|
||||
default = [
|
||||
inputs.hyprland.packages.${config.conf.system}.hyprland
|
||||
(lib.mkIf config.mods.hypr.hyprland.enable inputs.hyprland.packages.${config.conf.system}.hyprland)
|
||||
(lib.mkIf config.mods.niri.enable pkgs.niri)
|
||||
];
|
||||
# no idea if these are written correctly
|
||||
example = [
|
||||
|
|
@ -82,7 +96,7 @@
|
|||
};
|
||||
|
||||
config = let
|
||||
username = config.conf.username;
|
||||
inherit (config.conf) username;
|
||||
in
|
||||
lib.mkIf config.mods.greetd.enable (
|
||||
lib.optionalAttrs (options ? environment) {
|
||||
|
|
|
|||
|
|
@ -6,12 +6,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
browserName =
|
||||
if (builtins.isString config.mods.homePackages.browser)
|
||||
then config.mods.homePackages.browser
|
||||
else if config.mods.homePackages.browser ? meta && config.mods.homePackages.browser.meta ? mainProgram
|
||||
then config.mods.homePackages.browser.meta.mainProgram
|
||||
else config.mods.homePackages.browser.pname;
|
||||
defaultWmConf = import ../../../lib/wm.nix {inherit lib;};
|
||||
in {
|
||||
options.mods.hypr.hyprland = {
|
||||
enable = lib.mkOption {
|
||||
|
|
@ -22,64 +17,12 @@ in {
|
|||
Enable Hyprland
|
||||
'';
|
||||
};
|
||||
defaultMonitor = lib.mkOption {
|
||||
default = "";
|
||||
example = "eDP-1";
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
main monitor
|
||||
'';
|
||||
};
|
||||
defaultMonitorMode = lib.mkOption {
|
||||
default = "";
|
||||
example = "3440x1440@180";
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
main monitor mode: width x height @ refreshrate
|
||||
'';
|
||||
};
|
||||
defaultMonitorScale = lib.mkOption {
|
||||
default = "1";
|
||||
example = "1.5";
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
main monitor scaling
|
||||
'';
|
||||
};
|
||||
monitor = lib.mkOption {
|
||||
default = [
|
||||
# main monitor
|
||||
"${config.mods.hypr.hyprland.defaultMonitor},${config.mods.hypr.hyprland.defaultMonitorMode},0x0,${config.mods.hypr.hyprland.defaultMonitorScale}"
|
||||
# all others
|
||||
];
|
||||
example = ["DP-1,3440x1440@180,2560x0,1,vrr,0"];
|
||||
type = with lib.types; listOf str;
|
||||
description = ''
|
||||
The monitor configuration for hyprland.
|
||||
'';
|
||||
};
|
||||
workspace = lib.mkOption {
|
||||
default = [];
|
||||
example = ["2,monitor:DP-1, default:true"];
|
||||
type = with lib.types; listOf str;
|
||||
description = ''
|
||||
The workspace configuration for hyprland.
|
||||
'';
|
||||
};
|
||||
noAtomic = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Use tearing
|
||||
'';
|
||||
};
|
||||
extraAutostart = lib.mkOption {
|
||||
default = [];
|
||||
example = ["your application"];
|
||||
type = lib.types.listOf lib.types.str;
|
||||
description = ''
|
||||
Extra exec_once.
|
||||
Use tearing (Warning, can be buggy)
|
||||
'';
|
||||
};
|
||||
useIronbar = lib.mkOption {
|
||||
|
|
@ -90,14 +33,6 @@ in {
|
|||
Whether to use ironbar in hyprland.
|
||||
'';
|
||||
};
|
||||
ironbarSingleMonitor = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Whether to use ironbar on a single monitor.
|
||||
'';
|
||||
};
|
||||
useDefaultConfig = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
|
|
@ -160,7 +95,151 @@ in {
|
|||
hyprpicker
|
||||
];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
wayland.windowManager.hyprland = let
|
||||
mkWorkspace = workspaces:
|
||||
builtins.map (workspace: let
|
||||
default =
|
||||
if workspace.default
|
||||
then ",default:true"
|
||||
else "";
|
||||
in "${workspace.name},monitor:${workspace.monitor}${default}")
|
||||
workspaces;
|
||||
mkTransform = transform:
|
||||
if transform == "0"
|
||||
then 0
|
||||
else if transform == "90"
|
||||
then 1
|
||||
else if transform == "180"
|
||||
then 2
|
||||
else if transform == "270"
|
||||
then 3
|
||||
else 4;
|
||||
mkVrr = vrr:
|
||||
if vrr
|
||||
then "1"
|
||||
else "0";
|
||||
mkMonitors = monitors:
|
||||
builtins.map (
|
||||
monitor: "${monitor.name},${builtins.toString monitor.resolutionX}x${builtins.toString monitor.resolutionY}@${builtins.toString monitor.refreshrate},${builtins.toString monitor.positionX}x${builtins.toString monitor.positionY},${builtins.toString monitor.scale}, transform,${builtins.toString (mkTransform monitor.transform)}, vrr,${mkVrr monitor.vrr}"
|
||||
)
|
||||
monitors;
|
||||
|
||||
mkMods = bind: let
|
||||
mods = bind.modKeys or [];
|
||||
in
|
||||
builtins.map (mod:
|
||||
if mod == "Mod"
|
||||
then (lib.strings.toUpper config.mods.wm.modKey) + " "
|
||||
else lib.strings.toUpper mod)
|
||||
mods
|
||||
|> lib.strings.concatStringsSep "";
|
||||
mkArgs = args:
|
||||
if args != []
|
||||
then (lib.strings.concatStringsSep " " args)
|
||||
else "";
|
||||
shouldRepeat = bind: bind ? meta && bind.meta ? hyprland && bind.meta.hyprland ? repeat && bind.meta.hyprland.repeat;
|
||||
|
||||
defaultBinds = cfg:
|
||||
if cfg.mods.wm.useDefaultBinds
|
||||
then defaultWmConf.defaultBinds cfg
|
||||
else [];
|
||||
|
||||
mkEBinds = cfg: let
|
||||
binds = cfg.mods.wm.binds ++ defaultBinds cfg;
|
||||
in
|
||||
binds
|
||||
|> builtins.filter (bind: bind ? command && shouldRepeat bind && !hasInvalidCustomCommand bind)
|
||||
|> builtins.map (
|
||||
bind: "${mkMods bind},${bind.key},${mkCommand bind}"
|
||||
);
|
||||
mkBinds = cfg: let
|
||||
binds = cfg.mods.wm.binds ++ defaultBinds cfg;
|
||||
in
|
||||
binds
|
||||
|> builtins.filter (bind: bind ? command && !(shouldRepeat bind) && !hasInvalidCustomCommand bind)
|
||||
|> builtins.map (
|
||||
bind: "${mkMods bind},${bind.key},${mkCommand bind}"
|
||||
);
|
||||
mkCommand = bind: let
|
||||
args = bind.args or [];
|
||||
in
|
||||
if bind.command == "quit"
|
||||
then "exit"
|
||||
else if bind.command == "killActive"
|
||||
then "killactive"
|
||||
else if bind.command == "moveWindowRight"
|
||||
then "movewindow,r"
|
||||
else if bind.command == "moveWindowDown"
|
||||
then "movewindow,d"
|
||||
else if bind.command == "moveWindowLeft"
|
||||
then "movewindow,l"
|
||||
else if bind.command == "moveWindowUp"
|
||||
then "movewindow,u"
|
||||
else if bind.command == "moveFocusUp"
|
||||
then "movefocus,u"
|
||||
else if bind.command == "moveFocusRight"
|
||||
then "movefocus,r"
|
||||
else if bind.command == "moveFocusDown"
|
||||
then "movefocus,d"
|
||||
else if bind.command == "moveFocusLeft"
|
||||
then "movefocus,l"
|
||||
else if bind.command == "toggleFloating"
|
||||
then "togglefloating"
|
||||
else if bind.command == "toggleFullscreen"
|
||||
then "fullscreen"
|
||||
else if bind.command == "focusWorkspace"
|
||||
then "workspace" + "," + mkArgs args
|
||||
else if bind.command == "moveToWorkspace"
|
||||
then "movetoworkspace" + "," + mkArgs args
|
||||
else if bind.command == "spawn"
|
||||
then "exec" + "," + mkArgs args
|
||||
else if bind.command == "spawn-sh"
|
||||
then "exec" + "," + mkArgs args
|
||||
else bind.command.hyprland + "," + mkArgs args;
|
||||
hasInvalidCustomCommand = bind: !(builtins.isString bind.command) && bind.command.hyprland or null == null;
|
||||
|
||||
mkEnv = config: let
|
||||
defaultEnv =
|
||||
if config.mods.wm.useDefaultEnv
|
||||
then defaultWmConf.defaultEnv config
|
||||
else {
|
||||
all = {};
|
||||
hyprland = {};
|
||||
};
|
||||
userEnv =
|
||||
if config.mods.wm.env ? all
|
||||
then config.mods.wm.env.all // config.mods.wm.env.hyprland
|
||||
else config.mods.wm.env;
|
||||
env = userEnv // defaultEnv.all // defaultEnv.hyprland;
|
||||
in
|
||||
lib.attrsets.mapAttrsToList (
|
||||
name: value: "${name},${value}"
|
||||
)
|
||||
env;
|
||||
mkAutoStart = config: let
|
||||
defaultStartup =
|
||||
if config.mods.wm.useDefaultStartup
|
||||
then defaultWmConf.defaultStartup config
|
||||
else {
|
||||
all = [];
|
||||
hyprland = [];
|
||||
};
|
||||
userStartup =
|
||||
if config.mods.wm.startup ? all
|
||||
then config.mods.wm.startup.all ++ config.mods.wm.startup.hyprland
|
||||
else config.mods.wm.startup;
|
||||
autoStart = userStartup ++ defaultStartup.all ++ defaultStartup.hyprland;
|
||||
in
|
||||
autoStart;
|
||||
mkWindowRule = config: let
|
||||
defaultWindowRules =
|
||||
if config.mods.wm.useDefaultWindowRules
|
||||
then defaultWmConf.defaultWindowRules.hyprland
|
||||
else [];
|
||||
in
|
||||
# defaultWindowRules ++ config.mods.wm.windowRules.hyprland;
|
||||
defaultWindowRules;
|
||||
in {
|
||||
enable = true;
|
||||
package = mkDashDefault pkgs.hyprland;
|
||||
plugins =
|
||||
|
|
@ -174,124 +253,13 @@ in {
|
|||
lib.mkMerge
|
||||
[
|
||||
{
|
||||
"$mod" = mkDashDefault "SUPER";
|
||||
"$mod" = mkDashDefault config.mods.wm.modKey;
|
||||
|
||||
bindm = [
|
||||
"$mod, mouse:272, movewindow"
|
||||
"$mod, mouse:273, resizeactive"
|
||||
];
|
||||
|
||||
bind = [
|
||||
# screenshots
|
||||
''$mod SUPER,S,exec,grim -g "$(slurp)" - | wl-copy''
|
||||
''$mod SUPERSHIFT,S,exec,grim -g "$(slurp)" - | satty -f -''
|
||||
|
||||
# regular programs
|
||||
"$mod SUPER,F,exec,${browserName}"
|
||||
(lib.mkIf (
|
||||
browserName == "firefox" || browserName == "zen"
|
||||
) "$mod SUPERSHIFT,F,exec,${browserName} -p special")
|
||||
"$mod SUPER,T,exec,kitty -1"
|
||||
"$mod SUPER,E,exec,nautilus -w"
|
||||
(lib.mkIf config.mods.yazi.enable "$mod SUPER,Y,exec, EDITOR='neovide --no-fork' kitty yazi")
|
||||
"$mod SUPER,N,exec,neovide"
|
||||
(lib.mkIf config.mods.anyrun.enable "$mod SUPER,R,exec,anyrun")
|
||||
(lib.mkIf config.mods.oxi.oxirun.enable "$mod SUPER,R,exec,oxirun")
|
||||
(lib.mkIf config.mods.oxi.oxidash.enable "$mod SUPER,M,exec,oxidash")
|
||||
(lib.mkIf config.mods.oxi.oxicalc.enable "$mod SUPER,G,exec,oxicalc")
|
||||
(lib.mkIf config.mods.oxi.oxishut.enable "$mod SUPER,D,exec,oxishut")
|
||||
(lib.mkIf config.mods.oxi.oxipaste.enable "$mod SUPER,A,exec,oxipaste")
|
||||
(lib.mkIf config.mods.oxi.hyprdock.enable "$mod SUPERSHIFT,P,exec,hyprdock --gui")
|
||||
(lib.mkIf config.mods.hypr.hyprlock.enable "$mod SUPERSHIFT,L,exec, playerctl -a pause & hyprlock & systemctl suspend")
|
||||
(lib.mkIf config.mods.hypr.hyprlock.enable "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate")
|
||||
|
||||
# media keys
|
||||
(lib.mkIf config.mods.scripts.audioControl ",XF86AudioMute,exec, audioControl mute")
|
||||
(lib.mkIf config.mods.scripts.audioControl ",XF86AudioLowerVolume,exec, audioControl sink -5%")
|
||||
(lib.mkIf config.mods.scripts.audioControl ",XF86AudioRaiseVolume,exec, audioControl sink +5%")
|
||||
",XF86AudioPlay,exec, playerctl play-pause"
|
||||
",XF86AudioNext,exec, playerctl next"
|
||||
",XF86AudioPrev,exec, playerctl previous"
|
||||
(lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessDown,exec, changeBrightness 10%-")
|
||||
(lib.mkIf config.mods.scripts.changeBrightness ",XF86MonBrightnessUp,exec, changeBrightness +10%")
|
||||
|
||||
# hyprland keybinds
|
||||
# misc
|
||||
"$mod SUPER,V,togglefloating,"
|
||||
"$mod SUPER,B,fullscreen,"
|
||||
"$mod SUPER,C,togglesplit"
|
||||
"$mod SUPER,Q,killactive,"
|
||||
"$mod SUPERSHIFTALT,M,exit,"
|
||||
"$mod SUPERSHIFT,W,togglespecialworkspace"
|
||||
|
||||
# move
|
||||
"$mod SUPER,left,movewindow,l"
|
||||
"$mod SUPER,right,movewindow,r"
|
||||
"$mod SUPER,up,movewindow,u"
|
||||
"$mod SUPER,down,movewindow,d"
|
||||
|
||||
# workspaces
|
||||
"$mod SUPER,1,workspace,1"
|
||||
"$mod SUPER,2,workspace,2"
|
||||
"$mod SUPER,3,workspace,3"
|
||||
"$mod SUPER,4,workspace,4"
|
||||
"$mod SUPER,5,workspace,5"
|
||||
"$mod SUPER,6,workspace,6"
|
||||
"$mod SUPER,7,workspace,7"
|
||||
"$mod SUPER,8,workspace,8"
|
||||
"$mod SUPER,9,workspace,9"
|
||||
"$mod SUPER,0,workspace,10"
|
||||
|
||||
# move to workspace
|
||||
"$mod SUPERSHIFT,1,movetoworkspace,1"
|
||||
"$mod SUPERSHIFT,2,movetoworkspace,2"
|
||||
"$mod SUPERSHIFT,3,movetoworkspace,3"
|
||||
"$mod SUPERSHIFT,4,movetoworkspace,4"
|
||||
"$mod SUPERSHIFT,5,movetoworkspace,5"
|
||||
"$mod SUPERSHIFT,6,movetoworkspace,6"
|
||||
"$mod SUPERSHIFT,7,movetoworkspace,7"
|
||||
"$mod SUPERSHIFT,8,movetoworkspace,8"
|
||||
"$mod SUPERSHIFT,9,movetoworkspace,9"
|
||||
"$mod SUPERSHIFT,0,movetoworkspace,10"
|
||||
|
||||
# move to workspace silent
|
||||
"$mod SUPERSHIFTALT,1,movetoworkspacesilent,1"
|
||||
"$mod SUPERSHIFTALT,2,movetoworkspacesilent,2"
|
||||
"$mod SUPERSHIFTALT,3,movetoworkspacesilent,3"
|
||||
"$mod SUPERSHIFTALT,4,movetoworkspacesilent,4"
|
||||
"$mod SUPERSHIFTALT,5,movetoworkspacesilent,5"
|
||||
"$mod SUPERSHIFTALT,6,movetoworkspacesilent,6"
|
||||
"$mod SUPERSHIFTALT,7,movetoworkspacesilent,7"
|
||||
"$mod SUPERSHIFTALT,8,movetoworkspacesilent,8"
|
||||
"$mod SUPERSHIFTALT,9,movetoworkspacesilent,9"
|
||||
"$mod SUPERSHIFTALT,0,movetoworkspacesilent,10"
|
||||
|
||||
# preselection
|
||||
"$mod SUPERALT,j,layoutmsg,preselect l"
|
||||
"$mod SUPERALT,k,layoutmsg,preselect d"
|
||||
"$mod SUPERALT,l,layoutmsg,preselect u"
|
||||
"$mod SUPERALT,semicolon,layoutmsg,preselect r"
|
||||
"$mod SUPERALT,h,layoutmsg,preselect n"
|
||||
];
|
||||
|
||||
binde = [
|
||||
# hyprland keybinds
|
||||
# focus
|
||||
"$mod SUPER,J,movefocus,l"
|
||||
"$mod SUPER,semicolon,movefocus,r"
|
||||
"$mod SUPER,L,movefocus,u"
|
||||
"$mod SUPER,K,movefocus,d"
|
||||
|
||||
# resize
|
||||
"$mod SUPER,U,resizeactive,-20 0"
|
||||
"$mod SUPER,P,resizeactive,20 0"
|
||||
"$mod SUPER,O,resizeactive,0 -20"
|
||||
"$mod SUPER,I,resizeactive,0 20"
|
||||
|
||||
(lib.mkIf config.mods.hypr.hyprland.hyprspaceEnable
|
||||
"SUPER, W, overview:toggle")
|
||||
];
|
||||
|
||||
general = {
|
||||
gaps_out = mkDashDefault "3,5,5,5";
|
||||
border_size = mkDashDefault 3;
|
||||
|
|
@ -364,70 +332,19 @@ in {
|
|||
"3, horizontal, workspace"
|
||||
];
|
||||
|
||||
monitor = mkDashDefault config.mods.hypr.hyprland.monitor;
|
||||
workspace = mkDashDefault config.mods.hypr.hyprland.workspace;
|
||||
|
||||
env = [
|
||||
"GTK_CSD,0"
|
||||
''TERM,"kitty /bin/fish"''
|
||||
"XDG_CURRENT_DESKTOP=Hyprland"
|
||||
"XDG_SESSION_TYPE=wayland"
|
||||
"XDG_SESSION_DESKTOP=Hyprland"
|
||||
"HYPRCURSOR_THEME,${config.mods.stylix.cursor.name}"
|
||||
"HYPRCURSOR_SIZE,${toString config.mods.stylix.cursor.size}"
|
||||
"XCURSOR_THEME,${config.mods.stylix.cursor.name}"
|
||||
"XCURSOR_SIZE,${toString config.mods.stylix.cursor.size}"
|
||||
"QT_QPA_PLATFORM,wayland"
|
||||
"QT_QPA_PLATFORMTHEME,qt5ct"
|
||||
"QT_WAYLAND_FORCE_DPI,96"
|
||||
"QT_AUTO_SCREEN_SCALE_FACTOR,0"
|
||||
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
|
||||
"QT_SCALE_FACTOR,1"
|
||||
''EDITOR,"neovide --novsync --nofork"''
|
||||
|
||||
(lib.mkIf config.mods.gpu.nvidia.enable "LIBVA_DRIVER_NAME,nvidia")
|
||||
(lib.mkIf config.mods.gpu.nvidia.enable "XDG_SESSION_TYPE,wayland")
|
||||
(lib.mkIf config.mods.gpu.nvidia.enable "GBM_BACKEND,nvidia-drm")
|
||||
(lib.mkIf config.mods.gpu.nvidia.enable "__GLX_VENDOR_LIBRARY_NAME,nvidia")
|
||||
];
|
||||
|
||||
layerrule = [
|
||||
# layer rules
|
||||
# mainly to disable animations within slurp and grim
|
||||
"noanim, selection"
|
||||
];
|
||||
|
||||
windowrule = [
|
||||
# window rules
|
||||
"float,class:^(.*)(OxiCalc)(.*)$"
|
||||
"float,class:^(.*)(winecfg.exe)(.*)$"
|
||||
"float,class:^(.*)(copyq)(.*)$"
|
||||
"center,class:^(.*)(swappy)(.*)$"
|
||||
"workspace 10 silent,class:^(.*)(steam)(.*)$"
|
||||
|
||||
# Otherwise neovide will ignore tiling
|
||||
"suppressevent fullscreen maximize,class:^(.*)(neovide)(.*)$"
|
||||
];
|
||||
|
||||
exec-once =
|
||||
[
|
||||
# environment
|
||||
"systemctl --user import-environment"
|
||||
"dbus-update-activation-environment --systemd --all"
|
||||
"hyprctl setcursor ${config.mods.stylix.cursor.name} ${toString config.mods.stylix.cursor.size}"
|
||||
# ensures the systemd service knows what "hyprctl" is :)
|
||||
(lib.mkIf config.mods.gaming.gamemode "systemctl try-restart gamemoded.service --user")
|
||||
|
||||
# other programs
|
||||
"${browserName}"
|
||||
(lib.mkIf config.mods.oxi.hyprdock.enable "hyprdock --server")
|
||||
(lib.mkIf config.mods.hypr.hyprpaper.enable "hyprpaper")
|
||||
(lib.mkIf config.mods.hypr.hyprland.useIronbar "ironbar")
|
||||
(lib.mkIf config.mods.oxi.oxipaste.enable "oxipaste_daemon")
|
||||
(lib.mkIf config.mods.oxi.oxinoti.enable "oxinoti")
|
||||
]
|
||||
++ config.mods.hypr.hyprland.extraAutostart;
|
||||
|
||||
workspace = mkDashDefault (mkWorkspace config.mods.wm.workspaces);
|
||||
monitor = mkDashDefault (mkMonitors config.mods.wm.monitors);
|
||||
env = mkDashDefault (mkEnv config);
|
||||
bind = mkDashDefault (mkBinds config);
|
||||
binde = mkDashDefault (mkEBinds config);
|
||||
windowrule = mkDashDefault (mkWindowRule config);
|
||||
exec-once = mkDashDefault (mkAutoStart config);
|
||||
plugin = config.mods.hypr.hyprland.pluginConfig;
|
||||
}
|
||||
config.mods.hypr.hyprland.customConfig
|
||||
|
|
|
|||
|
|
@ -24,14 +24,22 @@
|
|||
|
||||
input-field = [
|
||||
{
|
||||
monitor = "${config.mods.hypr.hyprland.defaultMonitor}";
|
||||
monitor = "${
|
||||
if config.mods.wm.monitors != []
|
||||
then (builtins.elemAt config.mods.wm.monitors 0).name
|
||||
else ""
|
||||
}";
|
||||
placeholder_text = "password or something";
|
||||
}
|
||||
];
|
||||
|
||||
label = [
|
||||
{
|
||||
monitor = "${config.mods.hypr.hyprland.defaultMonitor}";
|
||||
monitor = "${
|
||||
if config.mods.wm.monitors != []
|
||||
then (builtins.elemAt config.mods.wm.monitors 0).name
|
||||
else ""
|
||||
}";
|
||||
text = "$TIME";
|
||||
font_size = 50;
|
||||
position = "0, 200";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
mkDashDefault,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
|
|
@ -7,7 +6,7 @@
|
|||
options,
|
||||
...
|
||||
}: let
|
||||
username = config.conf.username;
|
||||
inherit (config.conf) username;
|
||||
base16 = pkgs.callPackage inputs.base16.lib {};
|
||||
scheme = base16.mkSchemeAttrs config.stylix.base16Scheme;
|
||||
ironbarDefaultConfig = useBatteryModule: {
|
||||
|
|
@ -183,8 +182,15 @@
|
|||
];
|
||||
};
|
||||
monitorConfig = useBatteryModule:
|
||||
if config.mods.hypr.hyprland.ironbarSingleMonitor
|
||||
then {monitors.${config.mods.hypr.hyprland.defaultMonitor} = ironbarDefaultConfig useBatteryModule;}
|
||||
if config.mods.ironbar.ironbarSingleMonitor
|
||||
then {
|
||||
monitors.${
|
||||
if config.mods.wm.monitors != []
|
||||
then (builtins.elemAt config.mods.wm.monitors 0).name
|
||||
else ""
|
||||
} =
|
||||
ironbarDefaultConfig useBatteryModule;
|
||||
}
|
||||
else ironbarDefaultConfig useBatteryModule;
|
||||
in {
|
||||
options.mods = {
|
||||
|
|
@ -195,6 +201,14 @@ in {
|
|||
type = lib.types.bool;
|
||||
description = "Enables ironbar";
|
||||
};
|
||||
ironbarSingleMonitor = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Whether to use ironbar on a single monitor.
|
||||
'';
|
||||
};
|
||||
useDefaultConfig = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
|
|
@ -257,6 +271,7 @@ in {
|
|||
@import url("/home/${username}/.config/gtk-3.0/gtk.css");
|
||||
|
||||
@define-color primary #${scheme.base0D};
|
||||
@define-color warning #${scheme.base0F};
|
||||
@define-color muted-text #${scheme.base05};
|
||||
@define-color background #${scheme.base00};
|
||||
@define-color secondary-background #${scheme.base02};
|
||||
|
|
@ -406,6 +421,10 @@ in {
|
|||
color: @primary;
|
||||
}
|
||||
|
||||
.workspaces .item:not(.visible) {
|
||||
color: @warning;
|
||||
}
|
||||
|
||||
.workspaces .item.focused {
|
||||
background-color: @primary;
|
||||
color: @background;
|
||||
|
|
|
|||
379
modules/programs/niri.nix
Normal file
379
modules/programs/niri.nix
Normal file
|
|
@ -0,0 +1,379 @@
|
|||
{
|
||||
mkDashDefault,
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
defaultWmConf = import ../../lib/wm.nix {inherit lib;};
|
||||
in {
|
||||
options.mods.niri = {
|
||||
enable = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Enable Niri
|
||||
'';
|
||||
};
|
||||
useDefaultConfig = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Use preconfigured Niri config.
|
||||
'';
|
||||
};
|
||||
customConfig = lib.mkOption {
|
||||
default = '''';
|
||||
example = '''';
|
||||
type = lib.types.lines;
|
||||
description = ''
|
||||
Custom Niri configuration.
|
||||
Will be merged with default configuration if enabled.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.mods.niri.enable (
|
||||
lib.optionalAttrs (options ? wayland.windowManager.hyprland) {
|
||||
# TODO deduplicate and abstract away base window management config
|
||||
# install Niri related packages
|
||||
home.packages = with pkgs; [
|
||||
xorg.xprop
|
||||
grim
|
||||
slurp
|
||||
satty
|
||||
xdg-desktop-portal-gtk
|
||||
xdg-desktop-portal-gnome
|
||||
kdePackages.xdg-desktop-portal-kde
|
||||
xdg-desktop-portal-shana
|
||||
copyq
|
||||
wl-clipboard
|
||||
|
||||
niri
|
||||
xwayland-satellite
|
||||
];
|
||||
|
||||
xdg.configFile."niri/config.kdl" = let
|
||||
mkNiriMod = mods:
|
||||
builtins.map (mod:
|
||||
if mod == "Mod"
|
||||
then config.mods.wm.modKey + "+"
|
||||
else "${mod}" + "+")
|
||||
mods
|
||||
|> lib.strings.concatStringsSep "";
|
||||
mkNiriArg = args:
|
||||
if args != []
|
||||
then "\"${(lib.strings.concatStringsSep " " args)}\""
|
||||
else "";
|
||||
mkNiriCommand = bind: let
|
||||
args = bind.args or [];
|
||||
in
|
||||
if bind.command == "quit"
|
||||
then "quit;"
|
||||
else if bind.command == "killActive"
|
||||
then "close-window;"
|
||||
else if bind.command == "moveFocusTop"
|
||||
then "focus-window-up;"
|
||||
else if bind.command == "focusWorkspace"
|
||||
then "focus-workspace" + " " + mkNiriArg args + ";"
|
||||
else if bind.command == "moveWindowRight"
|
||||
then "move-column-right-or-to-monitor-right;"
|
||||
else if bind.command == "moveWindowDown"
|
||||
then "move-window-down;"
|
||||
else if bind.command == "moveWindowLeft"
|
||||
then "move-column-left-or-to-monitor-left;"
|
||||
else if bind.command == "moveWindowUp"
|
||||
then "move-window-up;"
|
||||
else if bind.command == "moveFocusUp"
|
||||
then "focus-window-up;"
|
||||
else if bind.command == "moveFocusRight"
|
||||
then "focus-column-or-monitor-right;"
|
||||
else if bind.command == "moveFocusDown"
|
||||
then "focus-window-down;"
|
||||
else if bind.command == "moveFocusLeft"
|
||||
then "focus-column-or-monitor-left;"
|
||||
else if bind.command == "toggleFloating"
|
||||
then "toggle-window-floating;"
|
||||
else if bind.command == "toggleFullscreen"
|
||||
then "fullscreen-window;"
|
||||
else if bind.command == "moveToWorkspace"
|
||||
then "move-window-to-workspace" + " " + mkNiriArg args + ";"
|
||||
else if bind.command == "spawn"
|
||||
then "spawn" + " " + mkNiriArg args + ";"
|
||||
else if bind.command == "spawn-sh"
|
||||
then "spawn-sh" + " " + mkNiriArg args + ";"
|
||||
else if bind.command.niri != null
|
||||
then bind.command.niri + " " + mkNiriArg args + ";"
|
||||
else "";
|
||||
|
||||
mkNiriBinds = cfg:
|
||||
'' binds {
|
||||
''
|
||||
+ (
|
||||
(
|
||||
builtins.map (
|
||||
bind:
|
||||
/*
|
||||
kdl
|
||||
*/
|
||||
if bind ? key && bind ? command
|
||||
then ''
|
||||
${mkNiriMod (bind.modKeys or [])}${bind.key} ${
|
||||
if
|
||||
bind ? meta
|
||||
&& bind.meta ? niri
|
||||
then
|
||||
(
|
||||
if
|
||||
bind.meta.niri ? desc
|
||||
&& bind.meta.niri.desc != ""
|
||||
then "hotkey-overlay-title=\"" + bind.meta.niri.desc + "\""
|
||||
else ""
|
||||
)
|
||||
+ " "
|
||||
+ (
|
||||
if
|
||||
bind.meta.niri ? repeat
|
||||
&& bind.meta.niri.repeat
|
||||
then "repeat=true"
|
||||
else "repeat=false"
|
||||
)
|
||||
+ " "
|
||||
+ (
|
||||
if
|
||||
bind.meta.niri ? allowWhileLocked
|
||||
&& bind.meta.niri.allowWhileLocked
|
||||
then "allow-when-locked=true"
|
||||
else ""
|
||||
)
|
||||
+ " "
|
||||
+ (
|
||||
if
|
||||
bind.meta.niri ? allowInhibit
|
||||
&& bind.meta.niri.allowInhibit
|
||||
then "allow-inhibiting=true"
|
||||
else "allow-inhibiting=false"
|
||||
)
|
||||
else ""
|
||||
} { ${
|
||||
mkNiriCommand bind
|
||||
} }
|
||||
''
|
||||
else ''''
|
||||
)
|
||||
((
|
||||
cfg.mods.wm.binds
|
||||
++ (
|
||||
if cfg.mods.wm.useDefaultBinds
|
||||
then defaultWmConf.defaultBinds cfg
|
||||
else []
|
||||
)
|
||||
)
|
||||
|> builtins.filter (bind: !(hasInvalidCustomCommand bind)))
|
||||
)
|
||||
|> lib.strings.concatLines
|
||||
)
|
||||
+ ''
|
||||
}
|
||||
'';
|
||||
mkVrr = vrr:
|
||||
if vrr
|
||||
then "true"
|
||||
else "false";
|
||||
mkNiriMonitors = cfg:
|
||||
(builtins.map (
|
||||
monitor:
|
||||
# TODO vrr
|
||||
/*
|
||||
kdl
|
||||
*/
|
||||
''
|
||||
output "${monitor.name}" {
|
||||
variable-refresh-rate on-demand=${mkVrr monitor.vrr}
|
||||
mode "${builtins.toString monitor.resolutionX}x${builtins.toString monitor.resolutionY}@${builtins.toString monitor.refreshrate}"
|
||||
scale ${builtins.toString monitor.scale}
|
||||
transform "${
|
||||
if (monitor.transform == "0")
|
||||
then "normal"
|
||||
else monitor.transform
|
||||
}"
|
||||
position x=${builtins.toString monitor.positionX} y=${builtins.toString monitor.positionY}
|
||||
}
|
||||
''
|
||||
)
|
||||
cfg.mods.wm.monitors)
|
||||
|> lib.strings.concatLines;
|
||||
mkNiriWorkspaces = cfg:
|
||||
(builtins.map (
|
||||
workspace:
|
||||
/*
|
||||
kdl
|
||||
*/
|
||||
''
|
||||
workspace "${workspace.name}" {
|
||||
open-on-output "${workspace.monitor}"
|
||||
}
|
||||
''
|
||||
)
|
||||
cfg.mods.wm.workspaces)
|
||||
|> lib.strings.concatLines;
|
||||
mkNiriWindowRules = cfg: (
|
||||
(
|
||||
builtins.map (
|
||||
rule:
|
||||
/*
|
||||
kdl
|
||||
*/
|
||||
''
|
||||
window-rule {
|
||||
${rule}
|
||||
}
|
||||
''
|
||||
)
|
||||
(
|
||||
cfg.mods.wm.windowRules.niri
|
||||
++ (
|
||||
if cfg.mods.wm.useDefaultWindowRules
|
||||
then defaultWmConf.defaultWindowRules.niri
|
||||
else []
|
||||
)
|
||||
)
|
||||
)
|
||||
|> lib.strings.concatLines
|
||||
);
|
||||
hasInvalidCustomCommand = bind: !(bind ? command) || (!(builtins.isString bind.command) && bind.command.niri or null == null);
|
||||
mkNiriEnv = config: let
|
||||
defaultEnv =
|
||||
if config.mods.wm.useDefaultEnv
|
||||
then defaultWmConf.defaultEnv config
|
||||
else {
|
||||
all = {};
|
||||
niri = {};
|
||||
};
|
||||
userEnv =
|
||||
if config.mods.wm.env ? all
|
||||
then config.mods.wm.env.all // config.mods.wm.env.niri
|
||||
else config.mods.wm.env;
|
||||
env =
|
||||
userEnv
|
||||
// defaultEnv.all
|
||||
// defaultEnv.niri;
|
||||
in
|
||||
''
|
||||
environment {
|
||||
''
|
||||
+ (
|
||||
lib.attrsets.mapAttrsToList (
|
||||
name: value: "${name} \"${value}\""
|
||||
)
|
||||
env
|
||||
|> lib.strings.concatLines
|
||||
)
|
||||
+ ''
|
||||
}
|
||||
'';
|
||||
mkNiriAutoStart = config: let
|
||||
defaultStartup =
|
||||
if config.mods.wm.useDefaultStartup
|
||||
then defaultWmConf.defaultStartup config
|
||||
else {
|
||||
all = {};
|
||||
niri = {};
|
||||
};
|
||||
userStartup =
|
||||
if config.mods.wm.startup ? all
|
||||
then config.mods.wm.startup.all ++ config.mods.wm.startup.niri
|
||||
else config.mods.wm.startup;
|
||||
autoStart = userStartup ++ defaultStartup.all ++ defaultStartup.niri;
|
||||
in
|
||||
(builtins.map (value: "spawn-at-startup \"${value}\"")
|
||||
autoStart)
|
||||
|> lib.strings.concatLines;
|
||||
defaultConfig =
|
||||
/*
|
||||
kdl
|
||||
*/
|
||||
''
|
||||
input {
|
||||
keyboard {
|
||||
xkb {
|
||||
layout "enIntUmlaut"
|
||||
}
|
||||
repeat-delay 200
|
||||
repeat-rate 25
|
||||
numlock
|
||||
}
|
||||
|
||||
touchpad {
|
||||
tap
|
||||
natural-scroll
|
||||
}
|
||||
|
||||
mouse {
|
||||
accel-speed 0.2
|
||||
accel-profile "flat"
|
||||
}
|
||||
|
||||
focus-follows-mouse max-scroll-amount="25%"
|
||||
}
|
||||
|
||||
layout {
|
||||
// Set gaps around windows in logical pixels.
|
||||
gaps 10
|
||||
center-focused-column "never"
|
||||
always-center-single-column
|
||||
|
||||
preset-column-widths {
|
||||
proportion 0.33333
|
||||
proportion 0.5
|
||||
proportion 1.0
|
||||
}
|
||||
|
||||
default-column-width { proportion 0.5; }
|
||||
focus-ring {
|
||||
width 3
|
||||
inactive-color "#505050"
|
||||
active-gradient from="#ff0000" to="#00ff00" angle=45
|
||||
}
|
||||
|
||||
border {
|
||||
off
|
||||
}
|
||||
|
||||
// You can enable drop shadows for windows.
|
||||
shadow {
|
||||
on
|
||||
softness 30
|
||||
spread 5
|
||||
offset x=0 y=5
|
||||
color "#0007"
|
||||
}
|
||||
}
|
||||
|
||||
// Autostart
|
||||
|
||||
hotkey-overlay {
|
||||
skip-at-startup
|
||||
}
|
||||
|
||||
prefer-no-csd
|
||||
''
|
||||
+ mkNiriMonitors config
|
||||
+ mkNiriBinds config
|
||||
+ mkNiriWorkspaces config
|
||||
+ mkNiriWindowRules config
|
||||
+ mkNiriEnv config
|
||||
+ mkNiriAutoStart config;
|
||||
in
|
||||
mkDashDefault {
|
||||
text =
|
||||
if config.mods.niri.useDefaultConfig
|
||||
then defaultConfig + config.mods.niri.customConfig
|
||||
else config.mods.niri.customConfig;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -54,8 +54,8 @@
|
|||
lib.optionalAttrs (options ? home.packages) {
|
||||
programs = {
|
||||
hyprdock = {
|
||||
enable = config.mods.oxi.hyprdock.enable;
|
||||
settings = config.mods.oxi.hyprdock.settings;
|
||||
inherit (config.mods.oxi.hyprdock) enable;
|
||||
inherit (config.mods.oxi.hyprdock) settings;
|
||||
};
|
||||
oxicalc.enable = lib.mkIf config.mods.oxi.oxicalc.enable true;
|
||||
ReSet = lib.mkIf config.mods.oxi.ReSet.enable {
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
};
|
||||
}
|
||||
// lib.optionalAttrs (options ? services.logind) {
|
||||
services.logind.lidSwitchExternalPower = "ignore";
|
||||
services.logind.settings.Login.HandleLidSwitchExternalPower = "ignore";
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
403
modules/programs/wm.nix
Normal file
403
modules/programs/wm.nix
Normal file
|
|
@ -0,0 +1,403 @@
|
|||
{lib, ...}: let
|
||||
wmWorkspace = with lib.types; {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
default = "";
|
||||
example = "1";
|
||||
type = str;
|
||||
description = "Name of the workspace";
|
||||
};
|
||||
default = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
type = bool;
|
||||
description = "Whether the workspace is the default workspace. (Currently doesn't do anything on niri)";
|
||||
};
|
||||
monitor = lib.mkOption {
|
||||
default = "";
|
||||
example = "DP-1";
|
||||
type = str;
|
||||
description = "Name of the monitor to bind the workspace to";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
wmOptions = with lib.types; {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
default = "DP-1";
|
||||
example = "DP-1";
|
||||
type = str;
|
||||
description = "Name of the monitor";
|
||||
};
|
||||
resolutionX = lib.mkOption {
|
||||
default = 1920;
|
||||
example = 2560;
|
||||
type = number;
|
||||
description = "ResolutionX of the monitor";
|
||||
};
|
||||
resolutionY = lib.mkOption {
|
||||
default = 1080;
|
||||
example = 1440;
|
||||
type = number;
|
||||
description = "ResolutionY of the monitor";
|
||||
};
|
||||
refreshrate = lib.mkOption {
|
||||
default = 60;
|
||||
example = 144;
|
||||
type = number;
|
||||
description = "Refreshrate of the monitor";
|
||||
};
|
||||
positionX = lib.mkOption {
|
||||
default = 0;
|
||||
example = 1920;
|
||||
type = number;
|
||||
description = "PositionX of the monitor";
|
||||
};
|
||||
positionY = lib.mkOption {
|
||||
default = 0;
|
||||
example = 1080;
|
||||
type = number;
|
||||
description = "PositionY of the monitor";
|
||||
};
|
||||
scale = lib.mkOption {
|
||||
default = 1;
|
||||
example = 2;
|
||||
type = number;
|
||||
description = "Scale of the monitor";
|
||||
};
|
||||
transform = lib.mkOption {
|
||||
default = "0";
|
||||
example = "90";
|
||||
type = enum ["0" "90" "180" "270" "360"];
|
||||
description = "Transform of the monitor";
|
||||
};
|
||||
vrr = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
type = bool;
|
||||
description = "VRR status of the monitor";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
modKeys = lib.types.enum ["Mod" "Super" "Alt" "Shift" "Ctrl"];
|
||||
|
||||
customCommand = with lib.types; {
|
||||
options = {
|
||||
niri = lib.mkOption {
|
||||
default = null;
|
||||
example = "kitty";
|
||||
type = either null str;
|
||||
description = "Command to use in niri";
|
||||
};
|
||||
hyprland = lib.mkOption {
|
||||
default = null;
|
||||
example = "kitty";
|
||||
type = either null str;
|
||||
description = "Command to use in hyprland";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
envOptions = with lib.types; {
|
||||
options = {
|
||||
all = lib.mkOption {
|
||||
default = {};
|
||||
example = {};
|
||||
type = attrsOf str;
|
||||
description = "General Env";
|
||||
};
|
||||
niri = lib.mkOption {
|
||||
default = {};
|
||||
example = {};
|
||||
type = attrsOf str;
|
||||
description = "Niri Env";
|
||||
};
|
||||
hyprland = lib.mkOption {
|
||||
default = {};
|
||||
example = {};
|
||||
type = attrsOf str;
|
||||
description = "Hyprland Env";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
startupOptions = with lib.types; {
|
||||
options = {
|
||||
all = lib.mkOption {
|
||||
default = [];
|
||||
example = [];
|
||||
type = listOf str;
|
||||
description = "General Startup commands";
|
||||
};
|
||||
niri = lib.mkOption {
|
||||
default = [];
|
||||
example = [];
|
||||
type = listOf str;
|
||||
description = "Niri Startup commands";
|
||||
};
|
||||
hyprland = lib.mkOption {
|
||||
default = [];
|
||||
example = [];
|
||||
type = listOf str;
|
||||
description = "Hyprland Startup commands";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
windowRuleOptions = with lib.types; {
|
||||
options = {
|
||||
niri = lib.mkOption {
|
||||
default = [];
|
||||
example = [];
|
||||
type = listOf lines;
|
||||
description = "Niri window rules";
|
||||
};
|
||||
hyprland = lib.mkOption {
|
||||
default = [];
|
||||
example = [];
|
||||
type = listOf str;
|
||||
description = "Hyprland window rules";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
bindOptions = with lib.types; {
|
||||
options = {
|
||||
modKeys = lib.mkOption {
|
||||
default = [];
|
||||
example = ["Mod"];
|
||||
type = listOf modKeys;
|
||||
description = "List of modifier keys";
|
||||
};
|
||||
key = lib.mkOption {
|
||||
default = "";
|
||||
example = "Q";
|
||||
type = str;
|
||||
description = "Key to bind";
|
||||
};
|
||||
command = lib.mkOption {
|
||||
default = "";
|
||||
example = "killActive";
|
||||
type = either (submodule customCommand) (enum [
|
||||
"spawn"
|
||||
"spawn-sh"
|
||||
"quit"
|
||||
"killActive"
|
||||
"moveFocusUp"
|
||||
"moveFocusRight"
|
||||
"moveFocusDown"
|
||||
"moveFocusLeft"
|
||||
"moveWindowUp"
|
||||
"moveWindowRight"
|
||||
"moveWindowDown"
|
||||
"moveWindowLeft"
|
||||
"focusWorkspace"
|
||||
"moveToWorkspace"
|
||||
"toggleFloating"
|
||||
"toggleFullscreen"
|
||||
]);
|
||||
description = "Command to execute";
|
||||
};
|
||||
args = lib.mkOption {
|
||||
default = [];
|
||||
example = [];
|
||||
type = listOf str;
|
||||
description = "Additional arguments for the command";
|
||||
};
|
||||
meta = lib.mkOption {
|
||||
default = {};
|
||||
example = {};
|
||||
type = submodule {
|
||||
options = {
|
||||
niri = lib.mkOption {
|
||||
default = {};
|
||||
type = submodule {
|
||||
options = {
|
||||
desc = lib.mkOption {
|
||||
default = "";
|
||||
type = str;
|
||||
description = "Description for Hotkey overview";
|
||||
};
|
||||
repeat = lib.mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to repeat the keybind on hold";
|
||||
};
|
||||
allowInhibit = lib.mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to allow inhibiting";
|
||||
};
|
||||
allowWhileLocked = lib.mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether to allow while locked";
|
||||
};
|
||||
cooldown = lib.mkOption {
|
||||
type = number;
|
||||
default = 0;
|
||||
description = "Cooldown on bind";
|
||||
};
|
||||
};
|
||||
};
|
||||
description = "Niri meta for keybinds";
|
||||
};
|
||||
hyprland = lib.mkOption {
|
||||
default = {};
|
||||
type = submodule {
|
||||
options = {
|
||||
repeat = lib.mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to repeat the keybind on hold";
|
||||
};
|
||||
};
|
||||
};
|
||||
description = "Niri meta for keybinds";
|
||||
};
|
||||
};
|
||||
};
|
||||
description = "Custom metadata per bind. Note, only supported environments are taken into account.";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.mods.wm = {
|
||||
modKey = lib.mkOption {
|
||||
default = "Super";
|
||||
example = "Alt";
|
||||
type = modKeys;
|
||||
description = "Mod key";
|
||||
};
|
||||
|
||||
env = lib.mkOption {
|
||||
default = {};
|
||||
example = {
|
||||
all = {
|
||||
EDITOR = "Neovim";
|
||||
};
|
||||
niri = {
|
||||
EDITOR = "Emacs";
|
||||
};
|
||||
};
|
||||
type = with lib.types; either (submodule envOptions) (attrsOf str);
|
||||
description = "Environment configuration";
|
||||
};
|
||||
|
||||
useDefaultEnv = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
type = lib.types.bool;
|
||||
description = "Whether to use default env variables";
|
||||
};
|
||||
|
||||
startup = lib.mkOption {
|
||||
default = [];
|
||||
example = {
|
||||
all = ["oxinoti"];
|
||||
niri = ["someniricommand"];
|
||||
hyprland = ["somehyprlandcommand"];
|
||||
};
|
||||
type = with lib.types; either (submodule startupOptions) (listOf str);
|
||||
description = "Start commands";
|
||||
};
|
||||
|
||||
useDefaultStartup = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
type = lib.types.bool;
|
||||
description = "Whether to use default autostart commands";
|
||||
};
|
||||
|
||||
useDefaultWindowRules = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
type = lib.types.bool;
|
||||
description = "Whether to use default window rules";
|
||||
};
|
||||
|
||||
windowRules = lib.mkOption {
|
||||
default = [];
|
||||
example = {
|
||||
niri = [
|
||||
''
|
||||
match app-id=r#"^org\.keepassxc\.KeePassXC$"#
|
||||
match app-id=r#"^org\.gnome\.World\.Secrets$"#
|
||||
|
||||
block-out-from "screen-capture"
|
||||
''
|
||||
''
|
||||
match app-id=r#"^steam$"#
|
||||
open-on-workspace "0"
|
||||
''
|
||||
];
|
||||
};
|
||||
type = lib.types.submodule windowRuleOptions;
|
||||
description = "Window rules";
|
||||
};
|
||||
|
||||
workspaces = lib.mkOption {
|
||||
default = [];
|
||||
example = [
|
||||
{
|
||||
name = "chat";
|
||||
monitor = "DP-1";
|
||||
}
|
||||
];
|
||||
type =
|
||||
lib.types.listOf (lib.types.submodule wmWorkspace);
|
||||
description = "Workspace configuration";
|
||||
};
|
||||
|
||||
monitors = lib.mkOption {
|
||||
default = [];
|
||||
example = [
|
||||
{
|
||||
name = "DP-1";
|
||||
resolutionX = 1920;
|
||||
resolutionY = 1080;
|
||||
refreshrate = 144;
|
||||
positionX = 0;
|
||||
positionY = 0;
|
||||
scale = 1;
|
||||
transform = "0";
|
||||
vrr = false;
|
||||
}
|
||||
];
|
||||
type =
|
||||
lib.types.listOf (lib.types.submodule wmOptions);
|
||||
description = "Monitor configuration";
|
||||
};
|
||||
|
||||
useDefaultBinds = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
type = lib.types.bool;
|
||||
description = "Whether to use default keybinds";
|
||||
};
|
||||
|
||||
binds = lib.mkOption {
|
||||
default = [];
|
||||
example = [
|
||||
{
|
||||
modKeys = ["Mod"];
|
||||
key = "Q";
|
||||
command = "killActive";
|
||||
args = [];
|
||||
meta = {
|
||||
niri = {
|
||||
desc = "Kill the active window";
|
||||
repeat = false;
|
||||
};
|
||||
hyprland = {};
|
||||
};
|
||||
}
|
||||
];
|
||||
type =
|
||||
lib.types.listOf (lib.types.submodule bindOptions);
|
||||
description = "Bind configuration";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue