nix-config/users/mara/config/sway.nix
2025-12-23 15:43:07 +01:00

242 lines
8.8 KiB
Nix

{
config,
lib,
pkgs,
...
}:
{
options.custom.screenShotDir = lib.mkOption {
default = config.home.homeDirectory + "/Pictures/Screenshots";
type = with lib.types; uniq str;
description = "Folder for all screenshots";
};
config = {
services.swww-randomize = {
enable = true;
backgroundDir = config.home.homeDirectory + "/Pictures/Archive/Wallpaper/Landscape";
};
wayland.windowManager.sway = {
enable = true;
package = pkgs.swayfx;
wrapperFeatures.gtk = true;
checkConfig = false;
extraConfigEarly = ''
blur enable
blur_passes 2
blur_radius 4
shadows enable
shadow_blur_radius 16
layer_effects "waybar" {
blur enable
blur_ignore_transparent enabled
}
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next
'';
config = rec {
bars = [
{
command = "''";
mode = "hide";
}
];
modifier = "Mod1";
terminal = lib.getExe pkgs.kitty;
menu = lib.getExe pkgs.fuzzel;
input = {
"type:touchpad" = {
tap = "on";
};
"*" = {
accel_profile = "flat";
pointer_accel = "-0.1";
xkb_layout = "de,gb";
xkb_variant = ",colemak_dh";
xkb_numlock = "enabled";
};
};
output."BOE 0x0BCA Unknown".scale = "1.5";
seat = {
"*".hide_cursor = "when-typing enable";
seat0.fallback = "true";
seat1."\r" = lib.concatMapStringsSep "\n " (s: " attach ${s}") [
"9390:4610:Rapoo_Rapoo_Gaming_Device"
"9390:4610:Rapoo_Rapoo_Gaming_Device_Keyboard"
];
};
keybindings = {
# Computer Control
"${modifier}+Escape" = "exit";
"${modifier}+Shift+Escape" =
"exec ${lib.getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${menu} -d | ${lib.getExe' pkgs.findutils "xargs"} ${lib.getExe' pkgs.systemd "systemctl"}";
# Focus
"${modifier}+Down" = "focus down";
"${modifier}+Left" = "focus left";
"${modifier}+Right" = "focus right";
"${modifier}+Up" = "focus up";
# Movement
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Right" = "move right";
"${modifier}+Shift+Up" = "move up";
# Toggle
"${modifier}+Shift+f" = "fullscreen toggle";
"${modifier}+Shift+space" = "floating toggle";
# Workspaces
"${modifier}+Ctrl+Left" = "workspace prev";
"${modifier}+Ctrl+Right" = "workspace next";
"${modifier}+Ctrl+Shift+Left" = "move window to workspace prev";
"${modifier}+Ctrl+Shift+Right" = "move window to workspace next";
"${modifier}+1" = "workspace number 1";
"${modifier}+Shift+1" = "move window to workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+Shift+2" = "move window to workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+Shift+3" = "move window to workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+Shift+4" = "move window to workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+Shift+5" = "move window to workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+Shift+6" = "move window to workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+Shift+7" = "move window to workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+Shift+8" = "move window to workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+Shift+9" = "move window to workspace number 9";
"${modifier}+0" = "workspace number 0";
"${modifier}+Shift+0" = "move window to workspace number 0";
# Sway Control
"${modifier}+Shift+q" = "kill";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart";
# Shadow Dimension
"${modifier}+Shift+Tab" = "move scratchpad";
"${modifier}+Tab" = "scratchpad show";
# Programs
"${modifier}+a" = "exec ${lib.getExe pkgs.nemo}";
"${modifier}+Return" = "exec ${terminal}";
# dmenu
"${modifier}+d" = "exec ${menu}";
"${modifier}+s" =
"exec ${lib.getExe pkgs.bash} -c \"${terminal} ssh $(grep -P '^Host (?!\\*)' ${config.home.homeDirectory}/.ssh/config | ${lib.getExe' pkgs.coreutils "cut"} -d ' ' -f2 | ${menu} -d)\"";
"${modifier}+e" =
"exec ${lib.getExe pkgs.bash} -c \"${lib.getExe pkgs.uni} emoji all -f '%(emoji h) %(cldr_full h Q:[:])' | ${lib.getExe pkgs.gnused} '/^$/d' | ${menu} -d | ${lib.getExe' pkgs.coreutils "cut"} -d ' ' -f1 | ${lib.getExe' pkgs.coreutils "tr"} -d '\\n' | ${lib.getExe' pkgs.wl-clipboard-rs "wl-copy"}\"";
# Wallpaper
"${modifier}+b" = "exec ${lib.getExe' pkgs.systemd "systemctl"} --user start swww-randomize";
# Notifications
"${modifier}+n" = "exec ${lib.getExe' pkgs.dunst "dunstctl"} history-pop";
# Screenshot
"${modifier}+Shift+s" =
"exec ${lib.getExe pkgs.bash} -c \"${lib.getExe' pkgs.coreutils "mkdir"} -p ${config.custom.screenShotDir}; ${lib.getExe pkgs.wayfreeze} --hide-cursor --after-freeze-cmd '${lib.getExe pkgs.sway-contrib.grimshot} savecopy area ${config.custom.screenShotDir}/$(${lib.getExe' pkgs.coreutils "date"} -Iseconds).png; ${lib.getExe pkgs.killall} wayfreeze'\"";
# Screenlock
"${modifier}+l" = "exec --no-startup-id ${lib.getExe pkgs.swaylock}";
# Audio
"--locked XF86AudioLowerVolume" =
"exec ${lib.getExe pkgs.pulsemixer} --change-volume -5 --max-volume 100";
"--locked XF86AudioRaiseVolume" =
"exec ${lib.getExe pkgs.pulsemixer} --change-volume +5 --max-volume 100";
"--locked XF86AudioNext" = "exec ${lib.getExe pkgs.playerctl} next";
"--locked XF86AudioPrev" = "exec ${lib.getExe pkgs.playerctl} previous";
"--locked XF86AudioPause" = "exec ${lib.getExe pkgs.playerctl} play-pause";
"--locked XF86AudioPlay" = "exec ${lib.getExe pkgs.playerctl} play-pause";
"--locked XF86AudioMute" = "exec ${lib.getExe pkgs.pulsemixer} --toggle-mute";
"--locked XF86AudioMicMute" =
"exec ${lib.getExe pkgs.pulsemixer} --toggle-mute --id $(${lib.getExe pkgs.pulsemixer} --list-sources | grep -Po 'source-\\d{2}(?=.*Default$)')";
# Brightness
"--locked XF86MonBrightnessDown" = "exec ${lib.getExe pkgs.brightnessctl} set 5%-";
"--locked XF86MonBrightnessUp" = "exec ${lib.getExe pkgs.brightnessctl} set 5%+";
};
colors = {
background = "#856cf9";
focused = {
background = "#182030";
border = "#5c4a94";
childBorder = "#856cd9";
indicator = "#856cd9";
text = "#856cd9";
};
focusedInactive = {
background = "#5c4a94";
border = "#5c4a94";
childBorder = "#5c4a94";
indicator = "#5c4a94";
text = "#5c4a94";
};
unfocused = {
background = "#5c4a94";
border = "#5c4a94";
childBorder = "#5c4a94";
indicator = "#5c4a94";
text = "#5c4a94";
};
urgent = {
background = "#2f343a";
border = "#900000";
childBorder = "#ffffff";
indicator = "#900000";
text = "#900000";
};
placeholder = {
background = "#000000";
border = "#0c0c0c";
childBorder = "#ffffff";
indicator = "#000000";
text = "#0c0c0c";
};
};
gaps = {
inner = 5;
outer = 0;
};
floating = {
border = 2;
titlebar = false;
};
window = {
border = 2;
titlebar = false;
commands = [
{
criteria.app_id = ".*";
command = "inhibit_idle fullscreen";
}
{
criteria.app_id = "org\.keepassxc\.KeePassXC";
command = "floating enable";
}
{
criteria.app_id = "xfce-polkit";
command = "floating enable";
}
];
};
};
};
};
}