mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 04:19:19 -08:00
feat: i3!
This commit is contained in:
parent
add8b013a4
commit
d463824ef1
35 changed files with 2150 additions and 156 deletions
245
modules/home/i3.nix
Normal file
245
modules/home/i3.nix
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.xsession.windowManager.i3;
|
||||
|
||||
commonOptions = import ./i3/options.nix {
|
||||
inherit config lib cfg pkgs;
|
||||
moduleName = "i3";
|
||||
};
|
||||
|
||||
configModule = types.submodule {
|
||||
options = {
|
||||
inherit (commonOptions)
|
||||
fonts window floating focus assigns modifier workspaceLayout
|
||||
workspaceAutoBackAndForth keycodebindings colors bars startup gaps menu
|
||||
terminal defaultWorkspace workspaceOutputAssign;
|
||||
|
||||
keybindings = mkOption {
|
||||
type = types.attrsOf (types.nullOr types.str);
|
||||
defaultText = "Default i3 keybindings.";
|
||||
description = ''
|
||||
An attribute set that assigns a key press to an action using a key symbol.
|
||||
See <https://i3wm.org/docs/userguide.html#keybindings>.
|
||||
|
||||
Consider to use `lib.mkOptionDefault` function to extend or override
|
||||
default keybindings instead of specifying all of them from scratch.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
let
|
||||
modifier = config.xsession.windowManager.i3.config.modifier;
|
||||
in lib.mkOptionDefault {
|
||||
"''${modifier}+Return" = "exec i3-sensible-terminal";
|
||||
"''${modifier}+Shift+q" = "kill";
|
||||
"''${modifier}+d" = "exec ''${pkgs.dmenu}/bin/dmenu_run";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
modes = mkOption {
|
||||
type = types.attrsOf (types.attrsOf types.str);
|
||||
default = {
|
||||
resize = {
|
||||
"Left" = "resize shrink width 10 px or 10 ppt";
|
||||
"Down" = "resize grow height 10 px or 10 ppt";
|
||||
"Up" = "resize shrink height 10 px or 10 ppt";
|
||||
"Right" = "resize grow width 10 px or 10 ppt";
|
||||
"Escape" = "mode default";
|
||||
"Return" = "mode default";
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
An attribute set that defines binding modes and keybindings
|
||||
inside them
|
||||
|
||||
Only basic keybinding is supported (bindsym keycomb action),
|
||||
for more advanced setup use 'i3.extraConfig'.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
commonFunctions = import ./i3/functions.nix {
|
||||
inherit config cfg lib;
|
||||
moduleName = "i3";
|
||||
};
|
||||
|
||||
inherit (commonFunctions)
|
||||
keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr
|
||||
floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString
|
||||
fontConfigStr keybindingDefaultWorkspace keybindingsRest workspaceOutputStr;
|
||||
|
||||
startupEntryStr = { command, always, notification, workspace, ... }:
|
||||
concatStringsSep " " [
|
||||
(if always then "exec_always" else "exec")
|
||||
(if (notification && workspace == null) then "" else "--no-startup-id")
|
||||
(if (workspace == null) then
|
||||
command
|
||||
else
|
||||
"i3-msg 'workspace ${workspace}; exec ${command}'")
|
||||
];
|
||||
|
||||
configFile = pkgs.writeText "i3.conf" (concatStringsSep "\n"
|
||||
((if cfg.config != null then
|
||||
with cfg.config;
|
||||
([ cfg.extraConfigEarly] ++ [
|
||||
(fontConfigStr fonts)
|
||||
"floating_modifier ${floating.modifier}"
|
||||
(windowBorderString window floating)
|
||||
"hide_edge_borders ${window.hideEdgeBorders}"
|
||||
"focus_wrapping ${focus.wrapping}"
|
||||
"focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}"
|
||||
"focus_on_window_activation ${focus.newWindow}"
|
||||
"mouse_warping ${if focus.mouseWarping then "output" else "none"}"
|
||||
"workspace_layout ${workspaceLayout}"
|
||||
"workspace_auto_back_and_forth ${
|
||||
lib.hm.booleans.yesNo workspaceAutoBackAndForth
|
||||
}"
|
||||
"client.focused ${colorSetStr colors.focused}"
|
||||
"client.focused_inactive ${colorSetStr colors.focusedInactive}"
|
||||
"client.unfocused ${colorSetStr colors.unfocused}"
|
||||
"client.urgent ${colorSetStr colors.urgent}"
|
||||
"client.placeholder ${colorSetStr colors.placeholder}"
|
||||
"client.background ${colors.background}"
|
||||
(keybindingsStr { keybindings = keybindingDefaultWorkspace; })
|
||||
(keybindingsStr { keybindings = keybindingsRest; })
|
||||
(keycodebindingsStr keycodebindings)
|
||||
] ++ mapAttrsToList (modeStr false) modes
|
||||
++ mapAttrsToList assignStr assigns ++ map barStr bars
|
||||
++ optional (gaps != null) gapsStr
|
||||
++ map floatingCriteriaStr floating.criteria
|
||||
++ map windowCommandsStr window.commands ++ map startupEntryStr startup
|
||||
++ map workspaceOutputStr workspaceOutputAssign)
|
||||
else
|
||||
[ ]) ++ [ cfg.extraConfig ]));
|
||||
|
||||
# Validates the i3 configuration
|
||||
checkI3Config =
|
||||
pkgs.runCommandLocal "i3-config" { buildInputs = [ cfg.package ]; } ''
|
||||
# We have to make sure the wrapper does not start a dbus session
|
||||
export DBUS_SESSION_BUS_ADDRESS=1
|
||||
|
||||
# A zero exit code means i3 successfully validated the configuration
|
||||
i3 -c ${configFile} -C -d all || {
|
||||
echo "i3 configuration validation failed"
|
||||
echo "For a verbose log of the failure, run 'i3 -c ${configFile} -C -d all'"
|
||||
exit 1
|
||||
};
|
||||
cp ${configFile} $out
|
||||
'';
|
||||
|
||||
in {
|
||||
meta.maintainers = with maintainers; [ sumnerevans ];
|
||||
|
||||
options = {
|
||||
xsession.windowManager.i3 = {
|
||||
enable = mkEnableOption "i3 window manager";
|
||||
|
||||
package = mkPackageOption pkgs "i3" { };
|
||||
|
||||
config = mkOption {
|
||||
type = types.nullOr configModule;
|
||||
default = { };
|
||||
description = "i3 configuration options.";
|
||||
};
|
||||
|
||||
extraConfigEarly = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description =
|
||||
"Extra configuration lines to add to ~/.config/i3/config.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [ (mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
assertions = [
|
||||
(hm.assertions.assertPlatform "xsession.windowManager.i3" pkgs
|
||||
platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xsession.windowManager.command = "${cfg.package}/bin/i3";
|
||||
|
||||
xdg.configFile."i3/config" = {
|
||||
source = checkI3Config;
|
||||
onChange = ''
|
||||
# There may be several sockets after log out/log in, but the old ones
|
||||
# will fail with "Connection refused".
|
||||
for i3Socket in ''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*; do
|
||||
if [[ -S $i3Socket ]]; then
|
||||
${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null |& grep -v "Connection refused" || true
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
}
|
||||
(mkIf (cfg.config != null) {
|
||||
warnings = (optional (isList cfg.config.fonts)
|
||||
"Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.")
|
||||
++ flatten (map (b:
|
||||
optional (isList b.fonts)
|
||||
"Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.")
|
||||
cfg.config.bars) ++ [
|
||||
(mkIf (any (s: s.workspace != null) cfg.config.startup)
|
||||
("'xsession.windowManager.i3.config.startup.*.workspace' is deprecated, "
|
||||
+ "use 'xsession.windowManager.i3.config.assigns' instead."
|
||||
+ "See https://github.com/nix-community/home-manager/issues/265."))
|
||||
(mkIf cfg.config.focus.forceWrapping
|
||||
("'xsession.windowManager.i3.config.focus.forceWrapping' is deprecated, "
|
||||
+ "use 'xsession.windowManager.i3.config.focus.wrapping' instead."))
|
||||
];
|
||||
})
|
||||
]))
|
||||
{xsession.windowManager.i3.config.keybindings = mapAttrs (n: mkOptionDefault) {
|
||||
"${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}";
|
||||
"${cfg.config.modifier}+Shift+q" = "kill";
|
||||
"${cfg.config.modifier}+d" = "exec ${cfg.config.menu}";
|
||||
|
||||
"${cfg.config.modifier}+Left" = "focus left";
|
||||
"${cfg.config.modifier}+Down" = "focus down";
|
||||
"${cfg.config.modifier}+Up" = "focus up";
|
||||
"${cfg.config.modifier}+Right" = "focus right";
|
||||
|
||||
"${cfg.config.modifier}+Shift+Left" = "move left";
|
||||
"${cfg.config.modifier}+Shift+Down" = "move down";
|
||||
"${cfg.config.modifier}+Shift+Up" = "move up";
|
||||
"${cfg.config.modifier}+Shift+Right" = "move right";
|
||||
|
||||
"${cfg.config.modifier}+h" = "split h";
|
||||
"${cfg.config.modifier}+v" = "split v";
|
||||
"${cfg.config.modifier}+f" = "fullscreen toggle";
|
||||
|
||||
"${cfg.config.modifier}+s" = "layout stacking";
|
||||
"${cfg.config.modifier}+w" = "layout tabbed";
|
||||
"${cfg.config.modifier}+e" = "layout toggle split";
|
||||
|
||||
"${cfg.config.modifier}+Shift+space" = "floating toggle";
|
||||
"${cfg.config.modifier}+space" = "focus mode_toggle";
|
||||
|
||||
"${cfg.config.modifier}+a" = "focus parent";
|
||||
|
||||
"${cfg.config.modifier}+Shift+minus" = "move scratchpad";
|
||||
"${cfg.config.modifier}+minus" = "scratchpad show";
|
||||
|
||||
"${cfg.config.modifier}+Shift+c" = "reload";
|
||||
"${cfg.config.modifier}+Shift+r" = "restart";
|
||||
"${cfg.config.modifier}+Shift+e" =
|
||||
"exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
|
||||
|
||||
"${cfg.config.modifier}+r" = "mode resize";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
166
modules/home/i3/functions.nix
Normal file
166
modules/home/i3/functions.nix
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
|
||||
{ cfg, config, lib, moduleName }:
|
||||
|
||||
with lib;
|
||||
|
||||
rec {
|
||||
criteriaStr = criteria:
|
||||
let
|
||||
toCriteria = k: v:
|
||||
if builtins.isBool v then
|
||||
(if v then "${k}" else "")
|
||||
else
|
||||
''${k}="${v}"'';
|
||||
in "[${concatStringsSep " " (mapAttrsToList toCriteria criteria)}]";
|
||||
|
||||
keybindingDefaultWorkspace = filterAttrs (n: v:
|
||||
cfg.config.defaultWorkspace != null && v == cfg.config.defaultWorkspace)
|
||||
cfg.config.keybindings;
|
||||
|
||||
keybindingsRest = filterAttrs (n: v:
|
||||
cfg.config.defaultWorkspace == null || v != cfg.config.defaultWorkspace)
|
||||
cfg.config.keybindings;
|
||||
|
||||
keybindingsStr = { keybindings, bindsymArgs ? "", indent ? "" }:
|
||||
concatStringsSep "\n" (mapAttrsToList (keycomb: action:
|
||||
optionalString (action != null) "${indent}bindsym ${
|
||||
lib.optionalString (bindsymArgs != "") "${bindsymArgs} "
|
||||
}${keycomb} ${action}") keybindings);
|
||||
|
||||
keycodebindingsStr = keycodebindings:
|
||||
concatStringsSep "\n" (mapAttrsToList (keycomb: action:
|
||||
optionalString (action != null) "bindcode ${keycomb} ${action}")
|
||||
keycodebindings);
|
||||
|
||||
colorSetStr = c:
|
||||
concatStringsSep " " [
|
||||
c.border
|
||||
c.background
|
||||
c.text
|
||||
c.indicator
|
||||
c.childBorder
|
||||
];
|
||||
barColorSetStr = c: concatStringsSep " " [ c.border c.background c.text ];
|
||||
|
||||
modeStr = bindkeysToCode: name: keybindings: ''
|
||||
mode "${name}" {
|
||||
${keybindingsStr {
|
||||
inherit keybindings;
|
||||
bindsymArgs = lib.optionalString bindkeysToCode "--to-code";
|
||||
indent = " ";
|
||||
}}
|
||||
}
|
||||
'';
|
||||
|
||||
assignStr = workspace: criteria:
|
||||
concatStringsSep "\n"
|
||||
(map (c: "assign ${criteriaStr c} ${workspace}") criteria);
|
||||
|
||||
fontConfigStr = let
|
||||
toFontStr = { names, style ? "", size ? "" }:
|
||||
optionalString (names != [ ]) concatStringsSep " "
|
||||
(remove "" [ "font" "pango:${concatStringsSep ", " names}" style size ]);
|
||||
in fontCfg:
|
||||
if isList fontCfg then
|
||||
toFontStr { names = fontCfg; }
|
||||
else
|
||||
toFontStr {
|
||||
inherit (fontCfg) names style;
|
||||
size = toString fontCfg.size;
|
||||
};
|
||||
|
||||
barStr = { id, fonts, mode, hiddenState, position, workspaceButtons
|
||||
, workspaceNumbers, command, statusCommand, colors, trayOutput, trayPadding
|
||||
, extraConfig, ... }:
|
||||
let colorsNotNull = lib.filterAttrs (n: v: v != null) colors != { };
|
||||
in concatMapStrings (x: x + "\n") (indent (lists.subtractLists [ "" null ]
|
||||
(flatten [
|
||||
"bar {"
|
||||
(optionalString (id != null) "id ${id}")
|
||||
(fontConfigStr fonts)
|
||||
(optionalString (mode != null) "mode ${mode}")
|
||||
(optionalString (hiddenState != null) "hidden_state ${hiddenState}")
|
||||
(optionalString (position != null) "position ${position}")
|
||||
(optionalString (statusCommand != null)
|
||||
"status_command ${statusCommand}")
|
||||
"${moduleName}bar_command ${command}"
|
||||
(optionalString (workspaceButtons != null)
|
||||
"workspace_buttons ${lib.hm.booleans.yesNo workspaceButtons}")
|
||||
(optionalString (workspaceNumbers != null) "strip_workspace_numbers ${
|
||||
lib.hm.booleans.yesNo (!workspaceNumbers)
|
||||
}")
|
||||
(optionalString (trayOutput != null) "tray_output ${trayOutput}")
|
||||
(optionalString (trayPadding != null)
|
||||
"tray_padding ${toString trayPadding}")
|
||||
(optionals colorsNotNull (indent (lists.subtractLists [ "" null ] [
|
||||
"colors {"
|
||||
(optionalString (colors.background != null)
|
||||
"background ${colors.background}")
|
||||
(optionalString (colors.statusline != null)
|
||||
"statusline ${colors.statusline}")
|
||||
(optionalString (colors.separator != null)
|
||||
"separator ${colors.separator}")
|
||||
(optionalString (colors.focusedBackground != null)
|
||||
"focused_background ${colors.focusedBackground}")
|
||||
(optionalString (colors.focusedStatusline != null)
|
||||
"focused_statusline ${colors.focusedStatusline}")
|
||||
(optionalString (colors.focusedSeparator != null)
|
||||
"focused_separator ${colors.focusedSeparator}")
|
||||
(optionalString (colors.focusedWorkspace != null)
|
||||
"focused_workspace ${barColorSetStr colors.focusedWorkspace}")
|
||||
(optionalString (colors.activeWorkspace != null)
|
||||
"active_workspace ${barColorSetStr colors.activeWorkspace}")
|
||||
(optionalString (colors.inactiveWorkspace != null)
|
||||
"inactive_workspace ${barColorSetStr colors.inactiveWorkspace}")
|
||||
(optionalString (colors.urgentWorkspace != null)
|
||||
"urgent_workspace ${barColorSetStr colors.urgentWorkspace}")
|
||||
(optionalString (colors.bindingMode != null)
|
||||
"binding_mode ${barColorSetStr colors.bindingMode}")
|
||||
"}"
|
||||
]) { }))
|
||||
extraConfig
|
||||
"}"
|
||||
])) { });
|
||||
|
||||
gapsStr = with cfg.config.gaps;
|
||||
concatStringsSep "\n" (lists.subtractLists [ "" null ] [
|
||||
(optionalString (inner != null) "gaps inner ${toString inner}")
|
||||
(optionalString (outer != null) "gaps outer ${toString outer}")
|
||||
(optionalString (horizontal != null)
|
||||
"gaps horizontal ${toString horizontal}")
|
||||
(optionalString (vertical != null) "gaps vertical ${toString vertical}")
|
||||
(optionalString (top != null) "gaps top ${toString top}")
|
||||
(optionalString (bottom != null) "gaps bottom ${toString bottom}")
|
||||
(optionalString (left != null) "gaps left ${toString left}")
|
||||
(optionalString (right != null) "gaps right ${toString right}")
|
||||
(optionalString smartGaps "smart_gaps on")
|
||||
(optionalString (smartBorders != "off") "smart_borders ${smartBorders}")
|
||||
]);
|
||||
|
||||
windowBorderString = window: floating:
|
||||
let
|
||||
titlebarString = { titlebar, border, ... }:
|
||||
"${if titlebar then "normal" else "pixel"} ${toString border}";
|
||||
in concatStringsSep "\n" [
|
||||
"default_border ${titlebarString window}"
|
||||
"default_floating_border ${titlebarString floating}"
|
||||
];
|
||||
|
||||
floatingCriteriaStr = criteria:
|
||||
"for_window ${criteriaStr criteria} floating enable";
|
||||
windowCommandsStr = { command, criteria, ... }:
|
||||
"for_window ${criteriaStr criteria} ${command}";
|
||||
workspaceOutputStr = item:
|
||||
let outputs = concatMapStringsSep " " strings.escapeNixString item.output;
|
||||
in ''workspace "${item.workspace}" output ${outputs}'';
|
||||
|
||||
indent = list:
|
||||
{ includesWrapper ? true, level ? 1 }:
|
||||
let prefix = concatStringsSep "" (lib.genList (x: " ") (level * 2));
|
||||
|
||||
in (lib.imap1 (i: v:
|
||||
"${if includesWrapper && (i == 1 || i == (lib.length list)) then
|
||||
v
|
||||
else
|
||||
"${prefix}${v}"}") list);
|
||||
}
|
||||
938
modules/home/i3/options.nix
Normal file
938
modules/home/i3/options.nix
Normal file
|
|
@ -0,0 +1,938 @@
|
|||
{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
isI3 = moduleName == "i3";
|
||||
isSway = !isI3;
|
||||
|
||||
inherit (config.home) stateVersion;
|
||||
|
||||
fontOptions = types.submodule {
|
||||
options = {
|
||||
names = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "monospace" ];
|
||||
defaultText = literalExpression ''[ "monospace" ]'';
|
||||
description = ''
|
||||
List of font names list used for window titles. Only FreeType fonts are supported.
|
||||
The order here is important (e.g. icons font should go before the one used for text).
|
||||
'';
|
||||
example = literalExpression ''[ "FontAwesome" "Terminus" ]'';
|
||||
};
|
||||
|
||||
style = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
The font style to use for window titles.
|
||||
'';
|
||||
example = "Bold Semi-Condensed";
|
||||
};
|
||||
|
||||
size = mkOption {
|
||||
type = types.either types.float types.str;
|
||||
default = 8.0;
|
||||
description = ''
|
||||
The font size to use for window titles.
|
||||
'';
|
||||
example = 11.5;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
startupModule = types.submodule {
|
||||
options = {
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
description = "Command that will be executed on startup.";
|
||||
};
|
||||
|
||||
always = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to run command on each ${moduleName} restart.";
|
||||
};
|
||||
} // optionalAttrs isI3 {
|
||||
notification = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable startup-notification support for the command.
|
||||
See {option}`--no-startup-id` option description in the i3 user guide.
|
||||
'';
|
||||
};
|
||||
|
||||
workspace = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Launch application on a particular workspace. DEPRECATED:
|
||||
Use [](#opt-xsession.windowManager.i3.config.assigns)
|
||||
instead. See <https://github.com/nix-community/home-manager/issues/265>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
barModule = types.submodule {
|
||||
options = let
|
||||
versionAtLeast2009 = versionAtLeast stateVersion "20.09";
|
||||
mkNullableOption = { type, default, ... }@args:
|
||||
mkOption (args // {
|
||||
type = types.nullOr type;
|
||||
default = if versionAtLeast2009 then null else default;
|
||||
defaultText = literalExpression ''
|
||||
null for state version ≥ 20.09, as example otherwise
|
||||
'';
|
||||
example = default;
|
||||
});
|
||||
in {
|
||||
fonts = mkOption {
|
||||
type = with types; either (listOf str) fontOptions;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
|
||||
style = "Bold Semi-Condensed";
|
||||
size = 11.0;
|
||||
}
|
||||
'';
|
||||
description = "Font configuration for this bar.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = "Extra configuration lines for this bar.";
|
||||
};
|
||||
|
||||
id = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Specifies the bar ID for the configured bar instance.
|
||||
If this option is missing, the ID is set to bar-x, where x corresponds
|
||||
to the position of the embedding bar block in the config file.
|
||||
'';
|
||||
};
|
||||
|
||||
mode = mkNullableOption {
|
||||
type = types.enum [ "dock" "hide" "invisible" ];
|
||||
default = "dock";
|
||||
description = "Bar visibility mode.";
|
||||
};
|
||||
|
||||
hiddenState = mkNullableOption {
|
||||
type = types.enum [ "hide" "show" ];
|
||||
default = "hide";
|
||||
description = "The default bar mode when 'bar.mode' == 'hide'.";
|
||||
};
|
||||
|
||||
position = mkNullableOption {
|
||||
type = types.enum [ "top" "bottom" ];
|
||||
default = "bottom";
|
||||
description = "The edge of the screen ${moduleName}bar should show up.";
|
||||
};
|
||||
|
||||
workspaceButtons = mkNullableOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether workspace buttons should be shown or not.";
|
||||
};
|
||||
|
||||
workspaceNumbers = mkNullableOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description =
|
||||
"Whether workspace numbers should be displayed within the workspace buttons.";
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
default = let
|
||||
# If the user uses the "system" Sway (i.e. cfg.package == null) then the bar has
|
||||
# to come from a different package
|
||||
pkg = if isSway && isNull cfg.package then pkgs.sway else cfg.package;
|
||||
in "${pkg}/bin/${moduleName}bar";
|
||||
defaultText = "i3bar";
|
||||
description = "Command that will be used to start a bar.";
|
||||
example = if isI3 then
|
||||
"\${pkgs.i3}/bin/i3bar -t"
|
||||
else
|
||||
"\${pkgs.waybar}/bin/waybar";
|
||||
};
|
||||
|
||||
statusCommand = mkNullableOption {
|
||||
type = types.str;
|
||||
default = "${pkgs.i3status}/bin/i3status";
|
||||
description = "Command that will be used to get status lines.";
|
||||
};
|
||||
|
||||
colors = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
background = mkNullableOption {
|
||||
type = types.str;
|
||||
default = "#000000";
|
||||
description = "Background color of the bar.";
|
||||
};
|
||||
|
||||
statusline = mkNullableOption {
|
||||
type = types.str;
|
||||
default = "#ffffff";
|
||||
description = "Text color to be used for the statusline.";
|
||||
};
|
||||
|
||||
separator = mkNullableOption {
|
||||
type = types.str;
|
||||
default = "#666666";
|
||||
description = "Text color to be used for the separator.";
|
||||
};
|
||||
|
||||
focusedBackground = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description =
|
||||
"Background color of the bar on the currently focused monitor output.";
|
||||
example = "#000000";
|
||||
};
|
||||
|
||||
focusedStatusline = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description =
|
||||
"Text color to be used for the statusline on the currently focused monitor output.";
|
||||
example = "#ffffff";
|
||||
};
|
||||
|
||||
focusedSeparator = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description =
|
||||
"Text color to be used for the separator on the currently focused monitor output.";
|
||||
example = "#666666";
|
||||
};
|
||||
|
||||
focusedWorkspace = mkNullableOption {
|
||||
type = barColorSetModule;
|
||||
default = {
|
||||
border = "#4c7899";
|
||||
background = "#285577";
|
||||
text = "#ffffff";
|
||||
};
|
||||
description = ''
|
||||
Border, background and text color for a workspace button when the workspace has focus.
|
||||
'';
|
||||
};
|
||||
|
||||
activeWorkspace = mkNullableOption {
|
||||
type = barColorSetModule;
|
||||
default = {
|
||||
border = "#333333";
|
||||
background = "#5f676a";
|
||||
text = "#ffffff";
|
||||
};
|
||||
description = ''
|
||||
Border, background and text color for a workspace button when the workspace is active.
|
||||
'';
|
||||
};
|
||||
|
||||
inactiveWorkspace = mkNullableOption {
|
||||
type = barColorSetModule;
|
||||
default = {
|
||||
border = "#333333";
|
||||
background = "#222222";
|
||||
text = "#888888";
|
||||
};
|
||||
description = ''
|
||||
Border, background and text color for a workspace button when the workspace does not
|
||||
have focus and is not active.
|
||||
'';
|
||||
};
|
||||
|
||||
urgentWorkspace = mkNullableOption {
|
||||
type = barColorSetModule;
|
||||
default = {
|
||||
border = "#2f343a";
|
||||
background = "#900000";
|
||||
text = "#ffffff";
|
||||
};
|
||||
description = ''
|
||||
Border, background and text color for a workspace button when the workspace contains
|
||||
a window with the urgency hint set.
|
||||
'';
|
||||
};
|
||||
|
||||
bindingMode = mkNullableOption {
|
||||
type = barColorSetModule;
|
||||
default = {
|
||||
border = "#2f343a";
|
||||
background = "#900000";
|
||||
text = "#ffffff";
|
||||
};
|
||||
description =
|
||||
"Border, background and text color for the binding mode indicator";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = ''
|
||||
Bar color settings. All color classes can be specified using submodules
|
||||
with 'border', 'background', 'text', fields and RGB color hex-codes as values.
|
||||
See default values for the reference.
|
||||
Note that 'background', 'status', and 'separator' parameters take a single RGB value.
|
||||
|
||||
See <https://i3wm.org/docs/userguide.html#_colors>.
|
||||
'';
|
||||
};
|
||||
|
||||
trayOutput = mkNullableOption {
|
||||
type = types.str;
|
||||
# Sway/Wayland doesn't have the concept of a primary output. The default for sway is to show it on all outputs
|
||||
default = if isI3 then "primary" else "*";
|
||||
description = "Where to output tray.";
|
||||
};
|
||||
|
||||
trayPadding = mkNullableOption {
|
||||
type = types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
Sets the pixel padding of the system tray.
|
||||
This padding will surround the tray on all sides and between each item.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
barColorSetModule = types.submodule {
|
||||
options = {
|
||||
border = mkOption {
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
background = mkOption {
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
text = mkOption {
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
colorSetModule = types.submodule {
|
||||
options = {
|
||||
border = mkOption {
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
childBorder = mkOption {
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
background = mkOption {
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
text = mkOption {
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
indicator = mkOption {
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
windowCommandModule = types.submodule {
|
||||
options = {
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
description = "${capitalModuleName}wm command to execute.";
|
||||
example = "border pixel 1";
|
||||
};
|
||||
|
||||
criteria = mkOption {
|
||||
type = criteriaModule;
|
||||
description = ''
|
||||
Criteria of the windows on which command should be executed.
|
||||
|
||||
A value of `true` is equivalent to using an empty
|
||||
criteria (which is different from an empty string criteria).
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
title = "x200: ~/work";
|
||||
floating = true;
|
||||
};
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
criteriaModule = types.attrsOf (types.either types.str types.bool);
|
||||
in {
|
||||
fonts = mkOption {
|
||||
type = with types; either (listOf str) fontOptions;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
|
||||
style = "Bold Semi-Condensed";
|
||||
size = 11.0;
|
||||
}
|
||||
'';
|
||||
description = "Font configuration for window titles, nagbar...";
|
||||
};
|
||||
|
||||
window = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
titlebar = mkOption {
|
||||
type = types.bool;
|
||||
default = if versionOlder stateVersion "23.05" then
|
||||
(isI3 && (cfg.config.gaps == null))
|
||||
else
|
||||
true;
|
||||
defaultText = if isI3 then ''
|
||||
true for state version ≥ 23.05
|
||||
config.gaps == null for state version < 23.05
|
||||
'' else ''
|
||||
true for state version ≥ 23.05
|
||||
false for state version < 23.05
|
||||
'';
|
||||
description = "Whether to show window titlebars.";
|
||||
};
|
||||
|
||||
border = mkOption {
|
||||
type = types.int;
|
||||
default = 2;
|
||||
description = "Window border width.";
|
||||
};
|
||||
|
||||
hideEdgeBorders = mkOption {
|
||||
type = let
|
||||
i3Options = [ "none" "vertical" "horizontal" "both" "smart" ];
|
||||
swayOptions = i3Options ++ [ "smart_no_gaps" ];
|
||||
in if isI3 then
|
||||
types.enum i3Options
|
||||
else
|
||||
types.enum (swayOptions ++ (map (e: "--i3 ${e}") swayOptions));
|
||||
default = "none";
|
||||
description = "Hide window borders adjacent to the screen edges.";
|
||||
};
|
||||
|
||||
commands = mkOption {
|
||||
type = types.listOf windowCommandModule;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of commands that should be executed on specific windows.
|
||||
See {option}`for_window` ${moduleName}wm option documentation.
|
||||
'';
|
||||
example = [{
|
||||
command = "border pixel 1";
|
||||
criteria = { class = "XTerm"; };
|
||||
}];
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = "Window titlebar and border settings.";
|
||||
};
|
||||
|
||||
floating = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
titlebar = mkOption {
|
||||
type = types.bool;
|
||||
default = if versionOlder stateVersion "23.05" then
|
||||
(isI3 && (cfg.config.gaps == null))
|
||||
else
|
||||
true;
|
||||
defaultText = if isI3 then ''
|
||||
true for state version ≥ 23.05
|
||||
config.gaps == null for state version < 23.05
|
||||
'' else ''
|
||||
true for state version ≥ 23.05
|
||||
false for state version < 23.05
|
||||
'';
|
||||
description = "Whether to show floating window titlebars.";
|
||||
};
|
||||
|
||||
border = mkOption {
|
||||
type = types.int;
|
||||
default = 2;
|
||||
description = "Floating windows border width.";
|
||||
};
|
||||
|
||||
modifier = mkOption {
|
||||
type = types.str;
|
||||
default = cfg.config.modifier;
|
||||
defaultText = "${moduleName}.config.modifier";
|
||||
description =
|
||||
"Modifier key or keys that can be used to drag floating windows.";
|
||||
example = "Mod4";
|
||||
};
|
||||
|
||||
criteria = mkOption {
|
||||
type = types.listOf criteriaModule;
|
||||
default = [ ];
|
||||
description =
|
||||
"List of criteria for windows that should be opened in a floating mode.";
|
||||
example = [
|
||||
{ "title" = "Steam - Update News"; }
|
||||
{ "class" = "Pavucontrol"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = "Floating window settings.";
|
||||
};
|
||||
|
||||
focus = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
newWindow = mkOption {
|
||||
type = types.enum [ "smart" "urgent" "focus" "none" ];
|
||||
default = "smart";
|
||||
description = ''
|
||||
This option modifies focus behavior on new window activation.
|
||||
|
||||
See <https://i3wm.org/docs/userguide.html#focus_on_window_activation>
|
||||
'';
|
||||
example = "none";
|
||||
};
|
||||
|
||||
followMouse = mkOption {
|
||||
type = if isSway then
|
||||
types.either (types.enum [ "yes" "no" "always" ]) types.bool
|
||||
else
|
||||
types.bool;
|
||||
default = if isSway then "yes" else true;
|
||||
description = "Whether focus should follow the mouse.";
|
||||
apply = val:
|
||||
if (isSway && isBool val) then (lib.hm.booleans.yesNo val) else val;
|
||||
};
|
||||
|
||||
wrapping = mkOption {
|
||||
type = types.enum [ "yes" "no" "force" "workspace" ];
|
||||
default = {
|
||||
i3 = if cfg.config.focus.forceWrapping then "force" else "yes";
|
||||
# the sway module's logic was inverted and incorrect,
|
||||
# so preserve it for backwards compatibility purposes
|
||||
sway = if cfg.config.focus.forceWrapping then "yes" else "no";
|
||||
}.${moduleName};
|
||||
description = ''
|
||||
Whether the window focus commands automatically wrap around the edge of containers.
|
||||
|
||||
See <https://i3wm.org/docs/userguide.html#_focus_wrapping>
|
||||
'';
|
||||
};
|
||||
|
||||
forceWrapping = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to force focus wrapping in tabbed or stacked containers.
|
||||
|
||||
This option is deprecated, use {option}`focus.wrapping` instead.
|
||||
'';
|
||||
};
|
||||
|
||||
mouseWarping = mkOption {
|
||||
type = if isSway then
|
||||
types.oneOf [ types.bool (types.enum [ "container" "output" ]) ]
|
||||
else
|
||||
types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether mouse cursor should be warped to the center of the window when switching focus
|
||||
to a window on a different output.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = "Focus related settings.";
|
||||
};
|
||||
|
||||
assigns = mkOption {
|
||||
type = types.attrsOf (types.listOf criteriaModule);
|
||||
default = { };
|
||||
description = ''
|
||||
An attribute set that assigns applications to workspaces based
|
||||
on criteria.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
"1: web" = [{ class = "^Firefox$"; }];
|
||||
"0: extra" = [{ class = "^Firefox$"; window_role = "About"; }];
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
modifier = mkOption {
|
||||
type = types.enum [ "Shift" "Control" "Mod1" "Mod2" "Mod3" "Mod4" "Mod5" ];
|
||||
default = "Mod1";
|
||||
description = "Modifier key that is used for all default keybindings.";
|
||||
example = "Mod4";
|
||||
};
|
||||
|
||||
workspaceLayout = mkOption {
|
||||
type = types.enum [ "default" "stacking" "tabbed" ];
|
||||
default = "default";
|
||||
example = "tabbed";
|
||||
description = ''
|
||||
The mode in which new containers on workspace level will
|
||||
start.
|
||||
'';
|
||||
};
|
||||
|
||||
workspaceAutoBackAndForth = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Assume you are on workspace "1: www" and switch to "2: IM" using
|
||||
mod+2 because somebody sent you a message. You don’t need to remember
|
||||
where you came from now, you can just press $mod+2 again to switch
|
||||
back to "1: www".
|
||||
'';
|
||||
};
|
||||
|
||||
keycodebindings = mkOption {
|
||||
type = types.attrsOf (types.nullOr types.str);
|
||||
default = { };
|
||||
description = ''
|
||||
An attribute set that assigns keypress to an action using key code.
|
||||
See <https://i3wm.org/docs/userguide.html#keybindings>.
|
||||
'';
|
||||
example = { "214" = "exec /bin/script.sh"; };
|
||||
};
|
||||
|
||||
colors = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
background = mkOption {
|
||||
type = types.str;
|
||||
default = "#ffffff";
|
||||
description = ''
|
||||
Background color of the window. Only applications which do not cover
|
||||
the whole area expose the color.
|
||||
'';
|
||||
};
|
||||
|
||||
focused = mkOption {
|
||||
type = colorSetModule;
|
||||
default = {
|
||||
border = "#4c7899";
|
||||
background = "#285577";
|
||||
text = "#ffffff";
|
||||
indicator = "#2e9ef4";
|
||||
childBorder = "#285577";
|
||||
};
|
||||
description = "A window which currently has the focus.";
|
||||
};
|
||||
|
||||
focusedInactive = mkOption {
|
||||
type = colorSetModule;
|
||||
default = {
|
||||
border = "#333333";
|
||||
background = "#5f676a";
|
||||
text = "#ffffff";
|
||||
indicator = "#484e50";
|
||||
childBorder = "#5f676a";
|
||||
};
|
||||
description = ''
|
||||
A window which is the focused one of its container,
|
||||
but it does not have the focus at the moment.
|
||||
'';
|
||||
};
|
||||
|
||||
unfocused = mkOption {
|
||||
type = colorSetModule;
|
||||
default = {
|
||||
border = "#333333";
|
||||
background = "#222222";
|
||||
text = "#888888";
|
||||
indicator = "#292d2e";
|
||||
childBorder = "#222222";
|
||||
};
|
||||
description = "A window which is not focused.";
|
||||
};
|
||||
|
||||
urgent = mkOption {
|
||||
type = colorSetModule;
|
||||
default = {
|
||||
border = "#2f343a";
|
||||
background = "#900000";
|
||||
text = "#ffffff";
|
||||
indicator = "#900000";
|
||||
childBorder = "#900000";
|
||||
};
|
||||
description = "A window which has its urgency hint activated.";
|
||||
};
|
||||
|
||||
placeholder = mkOption {
|
||||
type = colorSetModule;
|
||||
default = {
|
||||
border = "#000000";
|
||||
background = "#0c0c0c";
|
||||
text = "#ffffff";
|
||||
indicator = "#000000";
|
||||
childBorder = "#0c0c0c";
|
||||
};
|
||||
description = ''
|
||||
Background and text color are used to draw placeholder window
|
||||
contents (when restoring layouts). Border and indicator are ignored.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = ''
|
||||
Color settings. All color classes can be specified using submodules
|
||||
with 'border', 'background', 'text', 'indicator' and 'childBorder' fields
|
||||
and RGB color hex-codes as values. See default values for the reference.
|
||||
Note that '${moduleName}.config.colors.background' parameter takes a single RGB value.
|
||||
|
||||
See <https://i3wm.org/docs/userguide.html#_changing_colors>.
|
||||
'';
|
||||
};
|
||||
|
||||
bars = mkOption {
|
||||
type = types.listOf barModule;
|
||||
default = if versionAtLeast stateVersion "20.09" then [{
|
||||
mode = "dock";
|
||||
hiddenState = "hide";
|
||||
position = "bottom";
|
||||
workspaceButtons = true;
|
||||
workspaceNumbers = true;
|
||||
statusCommand = "${pkgs.i3status}/bin/i3status";
|
||||
fonts = {
|
||||
names = [ "monospace" ];
|
||||
size = 8.0;
|
||||
};
|
||||
trayOutput = "primary";
|
||||
colors = {
|
||||
background = "#000000";
|
||||
statusline = "#ffffff";
|
||||
separator = "#666666";
|
||||
focusedWorkspace = {
|
||||
border = "#4c7899";
|
||||
background = "#285577";
|
||||
text = "#ffffff";
|
||||
};
|
||||
activeWorkspace = {
|
||||
border = "#333333";
|
||||
background = "#5f676a";
|
||||
text = "#ffffff";
|
||||
};
|
||||
inactiveWorkspace = {
|
||||
border = "#333333";
|
||||
background = "#222222";
|
||||
text = "#888888";
|
||||
};
|
||||
urgentWorkspace = {
|
||||
border = "#2f343a";
|
||||
background = "#900000";
|
||||
text = "#ffffff";
|
||||
};
|
||||
bindingMode = {
|
||||
border = "#2f343a";
|
||||
background = "#900000";
|
||||
text = "#ffffff";
|
||||
};
|
||||
};
|
||||
}] else
|
||||
[ { } ];
|
||||
defaultText = literalExpression "see code";
|
||||
description = ''
|
||||
${capitalModuleName} bars settings blocks. Set to empty list to remove bars completely.
|
||||
'';
|
||||
};
|
||||
|
||||
startup = mkOption {
|
||||
type = types.listOf startupModule;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Commands that should be executed at startup.
|
||||
|
||||
See <https://i3wm.org/docs/userguide.html#_automatically_starting_applications_on_i3_startup>.
|
||||
'';
|
||||
example = if isI3 then
|
||||
literalExpression ''
|
||||
[
|
||||
{ command = "systemctl --user restart polybar"; always = true; notification = false; }
|
||||
{ command = "dropbox start"; notification = false; }
|
||||
{ command = "firefox"; }
|
||||
];
|
||||
''
|
||||
else
|
||||
literalExpression ''
|
||||
[
|
||||
{ command = "systemctl --user restart waybar"; always = true; }
|
||||
{ command = "dropbox start"; }
|
||||
{ command = "firefox"; }
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
gaps = mkOption {
|
||||
type = types.nullOr (types.submodule {
|
||||
options = {
|
||||
inner = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Inner gaps value.";
|
||||
example = 12;
|
||||
};
|
||||
|
||||
outer = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Outer gaps value.";
|
||||
example = 5;
|
||||
};
|
||||
|
||||
horizontal = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Horizontal gaps value.";
|
||||
example = 5;
|
||||
};
|
||||
|
||||
vertical = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Vertical gaps value.";
|
||||
example = 5;
|
||||
};
|
||||
|
||||
top = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Top gaps value.";
|
||||
example = 5;
|
||||
};
|
||||
|
||||
left = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Left gaps value.";
|
||||
example = 5;
|
||||
};
|
||||
|
||||
bottom = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Bottom gaps value.";
|
||||
example = 5;
|
||||
};
|
||||
|
||||
right = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = "Right gaps value.";
|
||||
example = 5;
|
||||
};
|
||||
|
||||
smartGaps = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
This option controls whether to disable all gaps (outer and inner)
|
||||
on workspace with a single container.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
smartBorders = mkOption {
|
||||
type = types.enum [ "on" "off" "no_gaps" ];
|
||||
default = "off";
|
||||
description = ''
|
||||
This option controls whether to disable container borders on
|
||||
workspace with a single container.
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
default = null;
|
||||
description = ''
|
||||
Gaps related settings.
|
||||
'';
|
||||
};
|
||||
|
||||
terminal = mkOption {
|
||||
type = types.str;
|
||||
default = if isI3 then "i3-sensible-terminal" else "${pkgs.foot}/bin/foot";
|
||||
description = "Default terminal to run.";
|
||||
example = "alacritty";
|
||||
};
|
||||
|
||||
menu = mkOption {
|
||||
type = types.str;
|
||||
default = if isSway then
|
||||
"${pkgs.dmenu}/bin/dmenu_path | ${pkgs.dmenu}/bin/dmenu | ${pkgs.findutils}/bin/xargs swaymsg exec --"
|
||||
else
|
||||
"${pkgs.dmenu}/bin/dmenu_run";
|
||||
description = "Default launcher to use.";
|
||||
example = "bemenu-run";
|
||||
};
|
||||
|
||||
defaultWorkspace = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
The default workspace to show when ${
|
||||
if isSway then "sway" else "i3"
|
||||
} is launched.
|
||||
This must to correspond to the value of the keybinding of the default workspace.
|
||||
'';
|
||||
example = "workspace number 9";
|
||||
};
|
||||
|
||||
workspaceOutputAssign = mkOption {
|
||||
type = with types;
|
||||
let
|
||||
workspaceOutputOpts = submodule {
|
||||
options = {
|
||||
workspace = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
example = "Web";
|
||||
description = ''
|
||||
Name of the workspace to assign.
|
||||
'';
|
||||
};
|
||||
|
||||
output = mkOption {
|
||||
type = with types; either str (listOf str);
|
||||
default = "";
|
||||
apply = lists.toList;
|
||||
example = "eDP";
|
||||
description = ''
|
||||
Name(s) of the output(s) from {command}`
|
||||
${if isSway then "swaymsg" else "i3-msg"} -t get_outputs
|
||||
`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in listOf workspaceOutputOpts;
|
||||
default = [ ];
|
||||
description = "Assign workspaces to outputs.";
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue