mirror of
https://github.com/nix-community/home-manager
synced 2024-11-15 23:59:45 +01:00
bspwm: add alwaysResetDesktops (#2785)
If set to true, desktops configured in `monitors` will be reset every time the config is run. If set to false, desktops will only be configured the first time the config is run. This is useful if you want to dynamically add desktops and you don't want them to be destroyed if you re-run `bspwmrc`.
This commit is contained in:
parent
32e433d07d
commit
e2a85ac43f
4 changed files with 30 additions and 2 deletions
|
@ -10,7 +10,19 @@ let
|
|||
builtins.replaceStrings upperChars (map (c: "_${c}") lowerChars);
|
||||
|
||||
formatMonitor = monitor: desktops:
|
||||
let
|
||||
resetDesktops =
|
||||
"bspc monitor ${escapeShellArg monitor} -d ${escapeShellArgs desktops}";
|
||||
defaultDesktopName =
|
||||
"Desktop"; # https://github.com/baskerville/bspwm/blob/master/src/desktop.h
|
||||
in if cfg.alwaysResetDesktops then
|
||||
resetDesktops
|
||||
else ''
|
||||
if [[ $(bspc query --desktops --names --monitor ${
|
||||
escapeShellArg monitor
|
||||
}) == ${defaultDesktopName} ]]; then
|
||||
${resetDesktops}
|
||||
fi'';
|
||||
|
||||
formatValue = v:
|
||||
if isList v then
|
||||
|
|
|
@ -185,6 +185,19 @@ in {
|
|||
example = { "HDMI-0" = [ "web" "terminal" "III" "IV" ]; };
|
||||
};
|
||||
|
||||
alwaysResetDesktops = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
If set to <literal>true</literal>, desktops configured in <option>monitors</option> will be reset
|
||||
every time the config is run.
|
||||
|
||||
If set to <literal>false</literal>, desktops will only be configured the first time the config is run.
|
||||
This is useful if you want to dynamically add desktops and you don't want them to be destroyed if you
|
||||
re-run <literal>bspwmrc</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
rules = mkOption {
|
||||
type = types.attrsOf rule;
|
||||
default = { };
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
bspc monitor 'focused' -d 'desktop 1' 'd'\''esk top'
|
||||
if [[ $(bspc query --desktops --names --monitor 'focused') == Desktop ]]; then
|
||||
bspc monitor 'focused' -d 'desktop 1' 'd'\''esk top'
|
||||
fi
|
||||
|
||||
bspc config 'border_width' '2'
|
||||
bspc config 'external_rules_command' '/path/to/external rules command'
|
||||
|
|
|
@ -8,6 +8,7 @@ with lib;
|
|||
enable = true;
|
||||
monitors.focused =
|
||||
[ "desktop 1" "d'esk top" ]; # pathological desktop names
|
||||
alwaysResetDesktops = false;
|
||||
settings = {
|
||||
border_width = 2;
|
||||
split_ratio = 0.52;
|
||||
|
|
Loading…
Reference in a new issue