Re-organize custom.gui namespace

This commit is contained in:
Riley Apeldoorn 2023-06-06 16:07:56 +02:00
parent f25e2d197e
commit df7cd2714f
3 changed files with 23 additions and 14 deletions

View file

@ -1,16 +1,26 @@
{ pkgs, ... }: { pkgs, lib, config, ... }:
{ let cfg = config.custom.gui;
in {
options.custom.gui = {
enable = lib.mkEnableOption "Nix-managed GUI";
};
imports = [ imports = [
./sway.nix ./sway.nix
./term.nix ./term.nix
]; ];
config = lib.mkIf (cfg.enable) {
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
home.packages = with pkgs; [ home.packages = with pkgs; [
# Fonts
fira-code fira-code
# GUI programs
pavucontrol
]; ];
};
} }

View file

@ -1,7 +1,7 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
let mod = "Mod4"; let mod = "Mod4";
cfg = config.custom.gui.sway; cfg = config.custom.gui;
# Generate the workspace keybinds # Generate the workspace keybinds
genWorkspaces = { numbered, named }: with lib; ( genWorkspaces = { numbered, named }: with lib; (
@ -20,8 +20,7 @@ let mod = "Mod4";
in with lib; { in with lib; {
options.custom.gui.sway = with types; { options.custom.gui.wm = with types; {
enable = mkEnableOption "sway window manager";
workspaces.named = mkOption { workspaces.named = mkOption {
type = attrsOf str; type = attrsOf str;
default = {}; default = {};
@ -75,7 +74,7 @@ in with lib; {
}; };
keybindings = mkMerge [ keybindings = mkMerge [
(genWorkspaces { inherit (cfg.workspaces) numbered named; }) (genWorkspaces { inherit (cfg.wm.workspaces) numbered named; })
{ {
"${mod}+h" = "focus left"; "${mod}+h" = "focus left";
"${mod}+j" = "focus down"; "${mod}+j" = "focus down";
@ -109,7 +108,7 @@ in with lib; {
Escape = "mode default"; Escape = "mode default";
}; };
window.titlebar = true; window.titlebar = false;
}; };
}; };

View file

@ -1,5 +1,5 @@
{ ... }: { ... }:
{ {
custom.gui.sway.enable = true; custom.gui.enable = true;
} }