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 = [
./sway.nix
./term.nix
];
fonts.fontconfig.enable = true;
config = lib.mkIf (cfg.enable) {
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
fira-code
];
home.packages = with pkgs; [
# Fonts
fira-code
# GUI programs
pavucontrol
];
};
}

View file

@ -1,7 +1,7 @@
{ pkgs, lib, config, ... }:
let mod = "Mod4";
cfg = config.custom.gui.sway;
cfg = config.custom.gui;
# Generate the workspace keybinds
genWorkspaces = { numbered, named }: with lib; (
@ -15,13 +15,12 @@ let mod = "Mod4";
);
sc = with pkgs; (writeScriptBin "sc" ''
${slurp}/bin/slurp | ${grim}/bin/grim -g - - | ${wl-clipboard}/bin/wl-copy -t image/png
'');
${slurp}/bin/slurp | ${grim}/bin/grim -g - - | ${wl-clipboard}/bin/wl-copy -t image/png
'');
in with lib; {
options.custom.gui.sway = with types; {
enable = mkEnableOption "sway window manager";
options.custom.gui.wm = with types; {
workspaces.named = mkOption {
type = attrsOf str;
default = {};
@ -75,7 +74,7 @@ in with lib; {
};
keybindings = mkMerge [
(genWorkspaces { inherit (cfg.workspaces) numbered named; })
(genWorkspaces { inherit (cfg.wm.workspaces) numbered named; })
{
"${mod}+h" = "focus left";
"${mod}+j" = "focus down";
@ -109,7 +108,7 @@ in with lib; {
Escape = "mode default";
};
window.titlebar = true;
window.titlebar = false;
};
};

View file

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