mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 05:03:09 +00:00
bspwm: re-add support for lists as config option values (#2125)
Removed by mistake in e70524c
, but ignore_ewmh_fullscreen still needs it.
This commit is contained in:
parent
e70524cd2b
commit
dc1b6b8349
4 changed files with 23 additions and 31 deletions
|
@ -10,39 +10,29 @@ let
|
|||
builtins.replaceStrings upperChars (map (c: "_${c}") lowerChars);
|
||||
|
||||
formatMonitor = monitor: desktops:
|
||||
"bspc monitor ${strings.escapeShellArg monitor} -d ${
|
||||
strings.escapeShellArgs desktops
|
||||
}";
|
||||
"bspc monitor ${escapeShellArg monitor} -d ${escapeShellArgs desktops}";
|
||||
|
||||
formatSetting = n: v:
|
||||
let
|
||||
vStr = if isBool v then
|
||||
boolToString v
|
||||
else if isInt v || isFloat v then
|
||||
toString v
|
||||
else if isString v then
|
||||
strings.escapeShellArg v
|
||||
else
|
||||
throw "unsupported setting type for ${n}";
|
||||
in "bspc config ${strings.escapeShellArg n} ${vStr}";
|
||||
|
||||
formatRule = target: directives:
|
||||
let
|
||||
formatDirective = n: v:
|
||||
let
|
||||
vStr = if isBool v then
|
||||
formatValue = v:
|
||||
if isList v then
|
||||
concatMapStringsSep "," formatValue v
|
||||
else if isBool v then
|
||||
if v then "on" else "off"
|
||||
else if isInt v || isFloat v then
|
||||
toString v
|
||||
else if isString v then
|
||||
v
|
||||
else
|
||||
throw "unsupported rule attribute type for ${n}";
|
||||
in "${camelToSnake n}=${vStr}";
|
||||
throw "unsupported type"; # should not happen
|
||||
|
||||
directivesStr = strings.escapeShellArgs (mapAttrsToList formatDirective
|
||||
formatSetting = n: v: "bspc config ${escapeShellArgs [ n (formatValue v) ]}";
|
||||
|
||||
formatRule = target: directives:
|
||||
let
|
||||
formatDirective = n: v: "${camelToSnake n}=${formatValue v}";
|
||||
|
||||
directivesStr = escapeShellArgs (mapAttrsToList formatDirective
|
||||
(filterAttrs (n: v: v != null) directives));
|
||||
in "bspc rule -a ${strings.escapeShellArg target} ${directivesStr}";
|
||||
in "bspc rule -a ${escapeShellArg target} ${directivesStr}";
|
||||
|
||||
formatStartupProgram = s: "${s} &";
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ in {
|
|||
settings = mkOption {
|
||||
type = with types;
|
||||
let primitive = either bool (either int (either float str));
|
||||
in attrsOf primitive;
|
||||
in attrsOf (either primitive (listOf primitive));
|
||||
default = { };
|
||||
description = "General settings given to <literal>bspc config</literal>.";
|
||||
example = {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
bspc monitor 'focused' -d 'desktop 1' 'd'\''esk top'
|
||||
|
||||
bspc config 'border_width' 2
|
||||
bspc config 'border_width' '2'
|
||||
bspc config 'external_rules_command' '/path/to/external rules command'
|
||||
bspc config 'gapless_monocle' true
|
||||
bspc config 'split_ratio' 0.520000
|
||||
bspc config 'gapless_monocle' 'on'
|
||||
bspc config 'ignore_ewmh_fullscreen' 'enter,exit'
|
||||
bspc config 'split_ratio' '0.520000'
|
||||
|
||||
bspc rule -r '*'
|
||||
bspc rule -a '*' 'center=off' 'desktop=d'\''esk top#next' 'split_dir=north' 'sticky=on'
|
||||
|
|
|
@ -13,6 +13,7 @@ with lib;
|
|||
split_ratio = 0.52;
|
||||
gapless_monocle = true;
|
||||
external_rules_command = "/path/to/external rules command";
|
||||
ignore_ewmh_fullscreen = [ "enter" "exit" ];
|
||||
};
|
||||
rules."*" = {
|
||||
sticky = true;
|
||||
|
|
Loading…
Reference in a new issue