From 187c673adf3c6a9a7afd8934ee41df7941f28cbf Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 18 Mar 2015 03:07:20 +0100 Subject: modules: Move my modules into category dirs. Signed-off-by: aszlig --- modules/user/aszlig/services/i3/workspace.nix | 107 ++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 modules/user/aszlig/services/i3/workspace.nix (limited to 'modules/user/aszlig/services/i3/workspace.nix') diff --git a/modules/user/aszlig/services/i3/workspace.nix b/modules/user/aszlig/services/i3/workspace.nix new file mode 100644 index 00000000..403ba57d --- /dev/null +++ b/modules/user/aszlig/services/i3/workspace.nix @@ -0,0 +1,107 @@ +{ name, lib, config, ... }: + +with lib; + +let + finalLabel = + if config.label == null then name + else config.labelPrefix + config.label; + + mkDoc = anchor: "http://i3wm.org/docs/userguide.html#${anchor}"; +in +{ + options = { + labelPrefix = mkOption { + type = types.str; + default = ""; + example = "666: "; + description = '' + The value that will be put in front of the . + So if you have a label called bar and a + called foo the + label for the workspace will be foobar. + ''; + }; + + label = mkOption { + type = types.nullOr types.str; + default = name; + description = '' + The label of this workspace, which is its name by default. If the value + is null, the resulting label of the workspace + is just its name and no is applied. + ''; + }; + + assign = mkOption { + type = types.listOf types.attrs; + default = []; + example = [ + { class = "^Chromium(?:-browser)?\$"; } + { instance = "^gajim\$"; } + ]; + description = let + anchor = "_automatically_putting_clients_on_specific_workspaces"; + in '' + Assign windows to this specific workspace using the attribute names + described by . + ''; + }; + + head = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + The XRandR head this workspace will be assigned to. + ''; + }; + + keys = let + commonDesc = '' + The $mod placeholder represents the default + modifier key. Details about the syntax of key combinations can be found + at . + ''; + in { + switchTo = mkOption { + type = types.nullOr types.str; + default = null; + example = "$mod+1"; + description = '' + Key combination to switch to this workspace. + '' + commonDesc; + }; + + moveTo = mkOption { + type = types.nullOr types.str; + default = null; + example = "$mod+Shift+exclam"; + description = '' + Key combination to move a container to this workspace. + '' + commonDesc; + }; + }; + + config = mkOption { + type = types.lines; + default = ""; + description = '' + Raw configuration options for this workspace. + ''; + }; + }; + + config.config = let + mkAssign = mapAttrsToList (criteria: value: "${criteria}=\"${value}\""); + mkSym = sym: rest: optionalString (sym != null) "bindsym ${sym} ${rest}"; + in '' + ${optionalString (config.head != null) '' + workspace "${finalLabel}" output ${config.head} + ''} + ${mkSym config.keys.switchTo "workspace \"${finalLabel}\""} + ${mkSym config.keys.moveTo "move workspace \"${finalLabel}\""} + ${concatMapStrings (assign: '' + assign [${concatStringsSep " " (mkAssign assign)}] ${finalLabel} + '') config.assign} + ''; +} -- cgit 1.4.1