support background for WM

This commit is contained in:
Quentin Boyer 2022-04-11 22:02:32 +02:00
parent 5bda6519cd
commit 807877198b
4 changed files with 34 additions and 14 deletions

View file

@ -64,6 +64,8 @@
};
};
wallpaper = "${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/backgrounds/nixos/nix-wallpaper-simple-dark-gray.png";
printScreen = {
enable = true;
keybind = "Print";

View file

@ -13,7 +13,14 @@ let
always = true;
}] else [ ];
startup = startupNotifications ++ cfg.startup;
wallpaperSet =
if cfg.wallpaper != null then [{
command = "${pkgs.feh}/bin/feh --bg-scale ${cfg.wallpaper}";
always = true;
notification = false;
}] else [ ];
startup = startupNotifications ++ wallpaperSet ++ cfg.startup;
in
{
config = mkIf (cfg.enable && cfg.kind == "i3") {
@ -86,16 +93,17 @@ in
windowManager.i3 = {
enable = true;
config = {
keybindings = common.keybindings;
workspaceOutputAssign = common.workspaceOutputAssign;
assigns = common.assigns;
fonts = common.mkFont cfg.font;
modifier = cfg.modifier;
bars = [{
fonts = common.mkFont cfg.bar.font;
statusCommand = "${config.programs.i3status-rust.package}/bin/i3status-rs ${config.home.homeDirectory}/.config/i3status-rust/config-bottom.toml";
}];
};
inherit startup;
keybindings = common.keybindings;
workspaceOutputAssign = common.workspaceOutputAssign;
assigns = common.assigns;
fonts = common.mkFont cfg.font;
modifier = cfg.modifier;
bars = [{
fonts = common.mkFont cfg.bar.font;
statusCommand = "${config.programs.i3status-rust.package}/bin/i3status-rs ${config.home.homeDirectory}/.config/i3status-rust/config-bottom.toml";
}];
};
};
scriptPath = ".hm-xsession";
};

View file

@ -135,6 +135,11 @@ with lib;
});
};
wallpaper = mkOption {
type = types.nullOr types.path;
description = "wallpaper";
};
workspaces = {
definitions = mkOption {
type = types.attrsOf (types.submodule {

View file

@ -19,7 +19,7 @@ in
home.packages = with pkgs; [
sway
];
] ++ (if cfg.wallpaper != null then [ pkgs.swaybg ] else [ ]);
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
@ -104,8 +104,13 @@ in
wm.menu.command = mkDefault "${pkgs.wofi}/bin/wofi --show drun,run --allow-images";
wm.exit.command = mkDefault "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
wayland.windowManager.sway = {
enable = true;
extraConfig = mkIf (cfg.wallpaper != null) ''
output "*" bg ${cfg.wallpaper} fill
'';
config = {
inherit startup;
modifier = cfg.modifier;
@ -138,8 +143,8 @@ in
titlebar = true;
};
keybindings = common.keybindings;
workspaceOutputAssign = common.workspaceOutputAssign;
assigns = common.assigns;
workspaceOutputAssign = common.workspaceOutputAssign;
assigns = common.assigns;
};
};