mirror of
https://github.com/nix-community/home-manager
synced 2024-12-23 10:19:48 +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,7 +61,9 @@ in {
|
|||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."bspwm/bspwmrc".source = pkgs.writeShellScript "bspwmrc" ''
|
||||
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)}
|
||||
|
@ -75,7 +77,7 @@ in {
|
|||
|
||||
${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,7 +263,8 @@ let
|
|||
seatStr = moduleStr "seat";
|
||||
|
||||
configFile = pkgs.writeText "sway.conf" (concatStringsSep "\n"
|
||||
((if cfg.config != null then
|
||||
((optional (cfg.extraConfigEarly != "") cfg.extraConfigEarly)
|
||||
++ (if cfg.config != null then
|
||||
with cfg.config;
|
||||
([
|
||||
(fontConfigStr fonts)
|
||||
|
@ -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 [
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
extra config early
|
||||
|
||||
if [[ $(bspc query --desktops --names --monitor 'focused') == Desktop ]]; then
|
||||
bspc monitor 'focused' -d 'desktop 1' 'd'\''esk top'
|
||||
fi
|
||||
|
|
|
@ -24,6 +24,9 @@ with lib;
|
|||
border = null;
|
||||
unknownRule = 42;
|
||||
};
|
||||
extraConfigEarly = ''
|
||||
extra config early
|
||||
'';
|
||||
extraConfig = ''
|
||||
extra config
|
||||
'';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
sway-bar-focused-colors = ./sway-bar-focused-colors.nix;
|
||||
sway-bindkeys-to-code = ./sway-bindkeys-to-code.nix;
|
||||
sway-bindkeys-to-code-and-extra-config =
|
||||
./sway-bindkeys-to-code-and-extra-config.nix;
|
||||
sway-default = ./sway-default.nix;
|
||||
sway-followmouse = ./sway-followmouse.nix;
|
||||
sway-followmouse-legacy = ./sway-followmouse-legacy.nix;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import $HOME/.cache/wal/colors-sway
|
||||
|
||||
font pango:monospace 8.000000
|
||||
floating_modifier Mod1
|
||||
default_border pixel 2
|
||||
|
@ -104,3 +106,4 @@ bar {
|
|||
}
|
||||
|
||||
exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target"
|
||||
exec_always pkill flashfocus; flasfocus &
|
|
@ -9,11 +9,17 @@
|
|||
# overriding findutils causes issues
|
||||
config.menu = "${pkgs.dmenu}/bin/dmenu_run";
|
||||
config.bindkeysToCode = true;
|
||||
extraConfigEarly = ''
|
||||
import $HOME/.cache/wal/colors-sway
|
||||
'';
|
||||
extraConfig = ''
|
||||
exec_always pkill flashfocus; flasfocus &
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/sway/config
|
||||
assertFileContent $(normalizeStorePaths home-files/.config/sway/config) \
|
||||
${./sway-bindkeys-to-code.conf}
|
||||
${./sway-bindkeys-to-code-and-extra-config.conf}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue