home-manager/sway/default.nix

170 lines
4.1 KiB
Nix

{ config, lib, pkgs, ... }:
let
font.name = "DejaVu Sans Mono";
font.size = 12.0;
lock_command = "${pkgs.swaylock-effects}/bin/swaylock --daemonize --screenshots --effect-blur 8x2 --ignore-empty-password --show-failed-attempts";
swaymsg = "${pkgs.sway}/bin/swaymsg";
in
{
imports = [
./i3status-rust.nix
./dunst.nix
];
home.packages = with pkgs; [
xdg-utils
shotman
wl-clipboard
];
programs.fuzzel = {
enable = true;
settings = {
main = {
terminal = "${pkgs.kitty}/bin/kitty";
layer = "overlay";
font = "DejaVu Sans Mono:size=12";
};
colors = {
background = "002b36ff";
border = "ffffffaa";
};
};
};
programs.swaylock = {
enable = true;
package = pkgs.swaylock-effects;
};
home.pointerCursor = {
name = "Adwaita";
package = pkgs.adwaita-icon-theme;
size = 24;
x11 = {
enable = true;
defaultCursor = "Adwaita";
};
};
services.swayidle = {
enable = true;
events = [
{ event = "before-sleep"; command = lock_command; }
];
timeouts = [
{ timeout = 900; command = "${swaymsg} output '*' power off"; resumeCommand = "${swaymsg} output '*' power on"; }
{ timeout = 1000; command = lock_command; }
];
};
services.swayosd.enable = true;
services.poweralertd.enable = true;
wayland.windowManager.sway = {
enable = true;
config = {
window = {
border = 0;
titlebar = false;
};
modifier = "Mod4";
terminal = "${pkgs.kitty}/bin/kitty";
input = {
"type:keyboard" = {
xkb_layout = "de";
xkb_variant = "nodeadkeys";
xkb_options = "caps:escape";
};
"type:touchpad" = {
natural_scroll = "enabled";
tap = "enabled";
accel_profile = "flat";
dwt = "enabled";
};
};
seat = {
"*" = {
hide_cursor = "5000";
};
};
defaultWorkspace = "1";
focus.newWindow = "urgent";
fonts = {
names = [ font.name ];
size = font.size;
};
bars = [{
mode = "hide";
position = "top";
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
fonts = {
names = [ font.name ];
size = font.size;
};
}];
menu = "${pkgs.fuzzel}/bin/fuzzel";
keybindings =
let
modifier = config.wayland.windowManager.sway.config.modifier;
in
lib.mkOptionDefault {
"${modifier}+Shift+s" = "exec shotman --capture region --copy";
"${modifier}+l" = "exec ${lock_command}";
"${modifier}+Shift+m" = "output '*' power off, output '*' power on, exec ${pkgs.kanshi}/bin/kanshictl reload";
"--release Caps_Lock" = "exec swayosd-client --caps-lock";
"--release Num_Lock" = "exec swayosd-client --num-lock";
"XF86AudioRaiseVolume" = "exec swayosd-client --output-volume raise";
"XF86AudioLowerVolume" = "exec swayosd-client --output-volume lower";
"XF86AudioMute" = "exec swayosd-client --output-volume mute-toggle";
"XF86AudioMicMute" = "exec swayosd-client --input-volume mute-toggle";
"XF86MonBrightnessUp" = "exec swayosd-client --brightness raise";
"XF86MonBrightnessDown" = "exec swayosd-client --brightness lower";
};
window.commands = [
{
criteria = { app_id = "[Kk]itty"; };
command = "move window to workspace 1";
}
{
criteria = { class = "[Ee]lement"; };
command = "move window to workspace 2";
}
{
criteria = { app_id = "[Tt]hunderbird"; };
command = "move window to workspace 4";
}
{
criteria = { app_id = "[Ff]irefox"; };
command = "move window to workspace 8";
}
];
startup = [
{ command = "keepassxc"; }
{ command = "kitty"; }
{ command = "element-desktop"; }
{ command = "thunderbird"; }
{ command = "firefox"; }
];
};
};
}