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);
|
builtins.replaceStrings upperChars (map (c: "_${c}") lowerChars);
|
||||||
|
|
||||||
formatMonitor = monitor: desktops:
|
formatMonitor = monitor: desktops:
|
||||||
"bspc monitor ${strings.escapeShellArg monitor} -d ${
|
"bspc monitor ${escapeShellArg monitor} -d ${escapeShellArgs desktops}";
|
||||||
strings.escapeShellArgs desktops
|
|
||||||
}";
|
|
||||||
|
|
||||||
formatSetting = n: v:
|
formatValue = v:
|
||||||
let
|
if isList v then
|
||||||
vStr = if isBool v then
|
concatMapStringsSep "," formatValue v
|
||||||
boolToString v
|
else if isBool v then
|
||||||
else if isInt v || isFloat v then
|
if v then "on" else "off"
|
||||||
toString v
|
else if isInt v || isFloat v then
|
||||||
else if isString v then
|
toString v
|
||||||
strings.escapeShellArg v
|
else if isString v then
|
||||||
else
|
v
|
||||||
throw "unsupported setting type for ${n}";
|
else
|
||||||
in "bspc config ${strings.escapeShellArg n} ${vStr}";
|
throw "unsupported type"; # should not happen
|
||||||
|
|
||||||
|
formatSetting = n: v: "bspc config ${escapeShellArgs [ n (formatValue v) ]}";
|
||||||
|
|
||||||
formatRule = target: directives:
|
formatRule = target: directives:
|
||||||
let
|
let
|
||||||
formatDirective = n: v:
|
formatDirective = n: v: "${camelToSnake n}=${formatValue v}";
|
||||||
let
|
|
||||||
vStr = 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}";
|
|
||||||
|
|
||||||
directivesStr = strings.escapeShellArgs (mapAttrsToList formatDirective
|
directivesStr = escapeShellArgs (mapAttrsToList formatDirective
|
||||||
(filterAttrs (n: v: v != null) directives));
|
(filterAttrs (n: v: v != null) directives));
|
||||||
in "bspc rule -a ${strings.escapeShellArg target} ${directivesStr}";
|
in "bspc rule -a ${escapeShellArg target} ${directivesStr}";
|
||||||
|
|
||||||
formatStartupProgram = s: "${s} &";
|
formatStartupProgram = s: "${s} &";
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ in {
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = with types;
|
type = with types;
|
||||||
let primitive = either bool (either int (either float str));
|
let primitive = either bool (either int (either float str));
|
||||||
in attrsOf primitive;
|
in attrsOf (either primitive (listOf primitive));
|
||||||
default = { };
|
default = { };
|
||||||
description = "General settings given to <literal>bspc config</literal>.";
|
description = "General settings given to <literal>bspc config</literal>.";
|
||||||
example = {
|
example = {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
bspc monitor 'focused' -d 'desktop 1' 'd'\''esk top'
|
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 'external_rules_command' '/path/to/external rules command'
|
||||||
bspc config 'gapless_monocle' true
|
bspc config 'gapless_monocle' 'on'
|
||||||
bspc config 'split_ratio' 0.520000
|
bspc config 'ignore_ewmh_fullscreen' 'enter,exit'
|
||||||
|
bspc config 'split_ratio' '0.520000'
|
||||||
|
|
||||||
bspc rule -r '*'
|
bspc rule -r '*'
|
||||||
bspc rule -a '*' 'center=off' 'desktop=d'\''esk top#next' 'split_dir=north' 'sticky=on'
|
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;
|
split_ratio = 0.52;
|
||||||
gapless_monocle = true;
|
gapless_monocle = true;
|
||||||
external_rules_command = "/path/to/external rules command";
|
external_rules_command = "/path/to/external rules command";
|
||||||
|
ignore_ewmh_fullscreen = [ "enter" "exit" ];
|
||||||
};
|
};
|
||||||
rules."*" = {
|
rules."*" = {
|
||||||
sticky = true;
|
sticky = true;
|
||||||
|
|
Loading…
Reference in a new issue