diff options
author | Robert Helgesson <robert@rycee.net> | 2020-02-02 00:39:17 +0100 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2020-02-02 01:07:28 +0100 |
commit | 45abf3d38a2b51c00c347cab6950f3734e023bba (patch) | |
tree | 414fde5d14d1d075fa65e59175660fd1fb680c43 /modules/services/window-managers | |
parent | 9799d3de2d270a9c40fcf81d600bfd71088e144d (diff) |
Apply `nixfmt` on many files
Diffstat (limited to 'modules/services/window-managers')
-rw-r--r-- | modules/services/window-managers/awesome.nix | 39 | ||||
-rw-r--r-- | modules/services/window-managers/bspwm/default.nix | 81 | ||||
-rw-r--r-- | modules/services/window-managers/bspwm/options.nix | 33 | ||||
-rw-r--r-- | modules/services/window-managers/xmonad.nix | 12 |
4 files changed, 77 insertions, 88 deletions
diff --git a/modules/services/window-managers/awesome.nix b/modules/services/window-managers/awesome.nix index fe914864e2a..d2e2903f83b 100644 --- a/modules/services/window-managers/awesome.nix +++ b/modules/services/window-managers/awesome.nix @@ -9,12 +9,9 @@ let getLuaPath = lib: dir: "${lib}/${dir}/lua/${pkgs.luaPackages.lua.luaversion}"; makeSearchPath = lib.concatMapStrings (path: " --search ${getLuaPath path "share"}" - + " --search ${getLuaPath path "lib"}" - ); + + " --search ${getLuaPath path "lib"}"); -in - -{ +in { options = { xsession.windowManager.awesome = { enable = mkEnableOption "Awesome window manager."; @@ -27,31 +24,29 @@ in }; luaModules = mkOption { - default = []; - type = types.listOf types.package; - description = '' - List of lua packages available for being - used in the Awesome configuration. - ''; - example = literalExample "[ luaPackages.oocairo ]"; + default = [ ]; + type = types.listOf types.package; + description = '' + List of lua packages available for being + used in the Awesome configuration. + ''; + example = literalExample "[ luaPackages.oocairo ]"; }; noArgb = mkOption { - default = false; - type = types.bool; - description = '' - Disable client transparency support, which can be greatly - detrimental to performance in some setups - ''; + default = false; + type = types.bool; + description = '' + Disable client transparency support, which can be greatly + detrimental to performance in some setups + ''; }; }; }; config = mkIf cfg.enable { home.packages = [ awesome ]; - xsession.windowManager.command = - "${awesome}/bin/awesome " - + optionalString cfg.noArgb "--no-argb " - + makeSearchPath cfg.luaModules; + xsession.windowManager.command = "${awesome}/bin/awesome " + + optionalString cfg.noArgb "--no-argb " + makeSearchPath cfg.luaModules; }; } diff --git a/modules/services/window-managers/bspwm/default.nix b/modules/services/window-managers/bspwm/default.nix index e9fa064a8ba..9ea5adbc880 100644 --- a/modules/services/window-managers/bspwm/default.nix +++ b/modules/services/window-managers/bspwm/default.nix @@ -13,59 +13,62 @@ let formatConfig = n: v: let formatList = x: - if isList x - then throw "can not convert 2-dimensional lists to bspwm format" - else formatValue x; + if isList x then + throw "can not convert 2-dimensional lists to bspwm format" + else + formatValue x; formatValue = v: - if isBool v then (if v then "true" else "false") - else if isList v then concatMapStringsSep ", " formatList v - else if isString v then "${lib.strings.escapeShellArg v}" - else toString v; - in - "bspc config ${n} ${formatValue v}"; + if isBool v then + (if v then "true" else "false") + else if isList v then + concatMapStringsSep ", " formatList v + else if isString v then + "${lib.strings.escapeShellArg v}" + else + toString v; + in "bspc config ${n} ${formatValue v}"; formatMonitors = n: v: "bspc monitor ${n} -d ${concatStringsSep " " v}"; formatRules = target: directiveOptions: let formatDirective = n: v: - if isBool v then (if v then "${camelToSnake n}=on" else "${camelToSnake n}=off") - else if (n == "desktop" || n == "node") then "${camelToSnake n}='${v}'" - else "${camelToSnake n}=${lib.strings.escapeShellArg v}"; + if isBool v then + (if v then "${camelToSnake n}=on" else "${camelToSnake n}=off") + else if (n == "desktop" || n == "node") then + "${camelToSnake n}='${v}'" + else + "${camelToSnake n}=${lib.strings.escapeShellArg v}"; - directives = filterAttrs (n: v: v != null && !(lib.strings.hasPrefix "_" n)) directiveOptions; - directivesStr = builtins.concatStringsSep " " (mapAttrsToList formatDirective directives); - in - "bspc rule -a ${target} ${directivesStr}"; + directives = + filterAttrs (n: v: v != null && !(lib.strings.hasPrefix "_" n)) + directiveOptions; + directivesStr = builtins.concatStringsSep " " + (mapAttrsToList formatDirective directives); + in "bspc rule -a ${target} ${directivesStr}"; formatStartupPrograms = map (s: "${s} &"); -in - -{ - options = import ./options.nix { inherit pkgs; inherit lib; }; +in { + options = import ./options.nix { + inherit pkgs; + inherit lib; + }; config = mkIf cfg.enable { home.packages = [ bspwm ]; - xsession.windowManager.command = - let - configFile = pkgs.writeShellScript "bspwmrc" ( - concatStringsSep "\n" ( - (mapAttrsToList formatMonitors cfg.monitors) - ++ (mapAttrsToList formatConfig cfg.settings) - ++ (mapAttrsToList formatRules cfg.rules) - ++ [ '' - # java gui fixes - export _JAVA_AWT_WM_NONREPARENTING=1 - bspc rule -a sun-awt-X11-XDialogPeer state=floating - '' ] - ++ [ cfg.extraConfig ] - ++ (formatStartupPrograms cfg.startupPrograms) - ) - ); - configCmdOpt = optionalString (cfg.settings != null) "-c ${configFile}"; - in - "${cfg.package}/bin/bspwm ${configCmdOpt}"; + xsession.windowManager.command = let + configFile = pkgs.writeShellScript "bspwmrc" (concatStringsSep "\n" + ((mapAttrsToList formatMonitors cfg.monitors) + ++ (mapAttrsToList formatConfig cfg.settings) + ++ (mapAttrsToList formatRules cfg.rules) ++ ['' + # java gui fixes + export _JAVA_AWT_WM_NONREPARENTING=1 + bspc rule -a sun-awt-X11-XDialogPeer state=floating + ''] ++ [ cfg.extraConfig ] + ++ (formatStartupPrograms cfg.startupPrograms))); + configCmdOpt = optionalString (cfg.settings != null) "-c ${configFile}"; + in "${cfg.package}/bin/bspwm ${configCmdOpt}"; }; } diff --git a/modules/services/window-managers/bspwm/options.nix b/modules/services/window-managers/bspwm/options.nix index 9d1955aa57c..58a58a1a782 100644 --- a/modules/services/window-managers/bspwm/options.nix +++ b/modules/services/window-managers/bspwm/options.nix @@ -28,7 +28,8 @@ let }; state = mkOption { - type = types.nullOr (types.enum [ "tiled" "pseudo_tiled" "floating" "fullscreen" ]); + type = types.nullOr + (types.enum [ "tiled" "pseudo_tiled" "floating" "fullscreen" ]); default = null; description = "The state in which a new window should spawn."; example = "floating"; @@ -61,7 +62,7 @@ let hidden = mkOption { type = types.nullOr types.bool; default = null; - description = ''Whether the node should occupy any space.''; + description = "Whether the node should occupy any space."; example = true; }; @@ -141,9 +142,7 @@ let }; }; -in - -{ +in { xsession.windowManager.bspwm = { enable = mkEnableOption "bspwm window manager."; @@ -156,11 +155,10 @@ in }; settings = mkOption { - type = with types; let - primitive = either bool (either int (either float str)); - in - attrsOf (either primitive (listOf primitive)); - default = {}; + type = with types; + let primitive = either bool (either int (either float str)); + in attrsOf (either primitive (listOf primitive)); + default = { }; description = "bspwm configuration"; example = { "border_width" = 2; @@ -180,16 +178,14 @@ in monitors = mkOption { type = types.attrsOf (types.listOf types.str); - default = {}; + default = { }; description = "bspc monitor configurations"; - example = { - "HDMI-0" = [ "web" "terminal" "III" "IV" ]; - }; + example = { "HDMI-0" = [ "web" "terminal" "III" "IV" ]; }; }; rules = mkOption { type = types.attrsOf rule; - default = {}; + default = { }; description = "bspc rules"; example = literalExample '' { @@ -210,12 +206,9 @@ in startupPrograms = mkOption { type = types.listOf types.str; - default = []; + default = [ ]; description = "Programs to be executed during startup."; - example = [ - "numlockx on" - "tilda" - ]; + example = [ "numlockx on" "tilda" ]; }; }; } diff --git a/modules/services/window-managers/xmonad.nix b/modules/services/window-managers/xmonad.nix index 6b3426b963b..7be03874a89 100644 --- a/modules/services/window-managers/xmonad.nix +++ b/modules/services/window-managers/xmonad.nix @@ -9,15 +9,13 @@ let xmonad = pkgs.xmonad-with-packages.override { ghcWithPackages = cfg.haskellPackages.ghcWithPackages; packages = self: - cfg.extraPackages self - ++ optionals cfg.enableContribAndExtras [ - self.xmonad-contrib self.xmonad-extras + cfg.extraPackages self ++ optionals cfg.enableContribAndExtras [ + self.xmonad-contrib + self.xmonad-extras ]; }; -in - -{ +in { options = { xsession.windowManager.xmonad = { enable = mkEnableOption "xmonad window manager"; @@ -35,7 +33,7 @@ in }; extraPackages = mkOption { - default = self: []; + default = self: [ ]; defaultText = "self: []"; example = literalExample '' haskellPackages: [ |