mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-21 17:59:39 +01:00
sway, bspwm: add extraConfigEarly (#2847)
This commit is contained in:
parent
8e4220e6c6
commit
d89bdff445
8 changed files with 99 additions and 67 deletions
|
|
@ -61,21 +61,23 @@ in {
|
|||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."bspwm/bspwmrc".source = pkgs.writeShellScript "bspwmrc" ''
|
||||
${concatStringsSep "\n" (mapAttrsToList formatMonitor cfg.monitors)}
|
||||
xdg.configFile."bspwm/bspwmrc".source = pkgs.writeShellScript "bspwmrc"
|
||||
((optionalString (cfg.extraConfigEarly != "")
|
||||
(cfg.extraConfigEarly + "\n")) + ''
|
||||
${concatStringsSep "\n" (mapAttrsToList formatMonitor cfg.monitors)}
|
||||
|
||||
${concatStringsSep "\n" (mapAttrsToList formatSetting cfg.settings)}
|
||||
${concatStringsSep "\n" (mapAttrsToList formatSetting cfg.settings)}
|
||||
|
||||
bspc rule -r '*'
|
||||
${concatStringsSep "\n" (mapAttrsToList formatRule cfg.rules)}
|
||||
bspc rule -r '*'
|
||||
${concatStringsSep "\n" (mapAttrsToList formatRule cfg.rules)}
|
||||
|
||||
# java gui fixes
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
bspc rule -a sun-awt-X11-XDialogPeer state=floating
|
||||
# java gui fixes
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
bspc rule -a sun-awt-X11-XDialogPeer state=floating
|
||||
|
||||
${cfg.extraConfig}
|
||||
${concatMapStringsSep "\n" formatStartupProgram cfg.startupPrograms}
|
||||
'';
|
||||
${cfg.extraConfig}
|
||||
${concatMapStringsSep "\n" formatStartupProgram cfg.startupPrograms}
|
||||
'');
|
||||
|
||||
# for applications not started by bspwm, e.g. sxhkd
|
||||
xsession.profileExtra = ''
|
||||
|
|
|
|||
|
|
@ -187,6 +187,13 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
extraConfigEarly = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description =
|
||||
"Like extraConfig, except commands are run at the start of the config file.";
|
||||
};
|
||||
|
||||
monitors = mkOption {
|
||||
type = types.attrsOf (types.listOf types.str);
|
||||
default = { };
|
||||
|
|
|
|||
|
|
@ -263,60 +263,61 @@ let
|
|||
seatStr = moduleStr "seat";
|
||||
|
||||
configFile = pkgs.writeText "sway.conf" (concatStringsSep "\n"
|
||||
((if cfg.config != null then
|
||||
with cfg.config;
|
||||
([
|
||||
(fontConfigStr fonts)
|
||||
"floating_modifier ${floating.modifier}"
|
||||
(windowBorderString window floating)
|
||||
"hide_edge_borders ${window.hideEdgeBorders}"
|
||||
"focus_wrapping ${lib.hm.booleans.yesNo focus.forceWrapping}"
|
||||
"focus_follows_mouse ${focus.followMouse}"
|
||||
"focus_on_window_activation ${focus.newWindow}"
|
||||
"mouse_warping ${
|
||||
if builtins.isString (focus.mouseWarping) then
|
||||
focus.mouseWarping
|
||||
else if focus.mouseWarping then
|
||||
"output"
|
||||
else
|
||||
"none"
|
||||
}"
|
||||
"workspace_layout ${workspaceLayout}"
|
||||
"workspace_auto_back_and_forth ${
|
||||
lib.hm.booleans.yesNo workspaceAutoBackAndForth
|
||||
}"
|
||||
"client.focused ${colorSetStr colors.focused}"
|
||||
"client.focused_inactive ${colorSetStr colors.focusedInactive}"
|
||||
"client.unfocused ${colorSetStr colors.unfocused}"
|
||||
"client.urgent ${colorSetStr colors.urgent}"
|
||||
"client.placeholder ${colorSetStr colors.placeholder}"
|
||||
"client.background ${colors.background}"
|
||||
(keybindingsStr {
|
||||
keybindings = keybindingDefaultWorkspace;
|
||||
bindsymArgs =
|
||||
lib.optionalString (cfg.config.bindkeysToCode) "--to-code";
|
||||
})
|
||||
(keybindingsStr {
|
||||
keybindings = keybindingsRest;
|
||||
bindsymArgs =
|
||||
lib.optionalString (cfg.config.bindkeysToCode) "--to-code";
|
||||
})
|
||||
(keycodebindingsStr keycodebindings)
|
||||
] ++ mapAttrsToList inputStr input
|
||||
++ mapAttrsToList outputStr output # outputs
|
||||
++ mapAttrsToList seatStr seat # seats
|
||||
++ mapAttrsToList (modeStr cfg.config.bindkeysToCode) modes # modes
|
||||
++ mapAttrsToList assignStr assigns # assigns
|
||||
++ map barStr bars # bars
|
||||
++ optional (gaps != null) gapsStr # gaps
|
||||
++ map floatingCriteriaStr floating.criteria # floating
|
||||
++ map windowCommandsStr window.commands # window commands
|
||||
++ map startupEntryStr startup # startup
|
||||
++ map workspaceOutputStr workspaceOutputAssign # custom mapping
|
||||
)
|
||||
else
|
||||
[ ]) ++ (optional cfg.systemdIntegration ''
|
||||
exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target"'')
|
||||
((optional (cfg.extraConfigEarly != "") cfg.extraConfigEarly)
|
||||
++ (if cfg.config != null then
|
||||
with cfg.config;
|
||||
([
|
||||
(fontConfigStr fonts)
|
||||
"floating_modifier ${floating.modifier}"
|
||||
(windowBorderString window floating)
|
||||
"hide_edge_borders ${window.hideEdgeBorders}"
|
||||
"focus_wrapping ${lib.hm.booleans.yesNo focus.forceWrapping}"
|
||||
"focus_follows_mouse ${focus.followMouse}"
|
||||
"focus_on_window_activation ${focus.newWindow}"
|
||||
"mouse_warping ${
|
||||
if builtins.isString (focus.mouseWarping) then
|
||||
focus.mouseWarping
|
||||
else if focus.mouseWarping then
|
||||
"output"
|
||||
else
|
||||
"none"
|
||||
}"
|
||||
"workspace_layout ${workspaceLayout}"
|
||||
"workspace_auto_back_and_forth ${
|
||||
lib.hm.booleans.yesNo workspaceAutoBackAndForth
|
||||
}"
|
||||
"client.focused ${colorSetStr colors.focused}"
|
||||
"client.focused_inactive ${colorSetStr colors.focusedInactive}"
|
||||
"client.unfocused ${colorSetStr colors.unfocused}"
|
||||
"client.urgent ${colorSetStr colors.urgent}"
|
||||
"client.placeholder ${colorSetStr colors.placeholder}"
|
||||
"client.background ${colors.background}"
|
||||
(keybindingsStr {
|
||||
keybindings = keybindingDefaultWorkspace;
|
||||
bindsymArgs =
|
||||
lib.optionalString (cfg.config.bindkeysToCode) "--to-code";
|
||||
})
|
||||
(keybindingsStr {
|
||||
keybindings = keybindingsRest;
|
||||
bindsymArgs =
|
||||
lib.optionalString (cfg.config.bindkeysToCode) "--to-code";
|
||||
})
|
||||
(keycodebindingsStr keycodebindings)
|
||||
] ++ mapAttrsToList inputStr input
|
||||
++ mapAttrsToList outputStr output # outputs
|
||||
++ mapAttrsToList seatStr seat # seats
|
||||
++ mapAttrsToList (modeStr cfg.config.bindkeysToCode) modes # modes
|
||||
++ mapAttrsToList assignStr assigns # assigns
|
||||
++ map barStr bars # bars
|
||||
++ optional (gaps != null) gapsStr # gaps
|
||||
++ map floatingCriteriaStr floating.criteria # floating
|
||||
++ map windowCommandsStr window.commands # window commands
|
||||
++ map startupEntryStr startup # startup
|
||||
++ map workspaceOutputStr workspaceOutputAssign # custom mapping
|
||||
)
|
||||
else
|
||||
[ ]) ++ (optional cfg.systemdIntegration ''
|
||||
exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target"'')
|
||||
++ (optional (!cfg.xwayland) "xwayland disable") ++ [ cfg.extraConfig ]));
|
||||
|
||||
defaultSwayPackage = pkgs.sway.override {
|
||||
|
|
@ -425,6 +426,13 @@ in {
|
|||
description =
|
||||
"Extra configuration lines to add to ~/.config/sway/config.";
|
||||
};
|
||||
|
||||
extraConfigEarly = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description =
|
||||
"Like extraConfig, except lines are added to ~/.config/sway/config before all other configuration.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue