restructure and further configure sway

This commit is contained in:
Astreaprtcl 2025-12-21 00:44:47 +01:00
parent f9138672e8
commit 8f5c2ff8f6
25 changed files with 476 additions and 256 deletions

View file

@ -1,55 +1,86 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) concatMapStringsSep getExe getExe';
inherit (lib)
concatMapStringsSep
getExe
getExe'
mkOption
types
;
in
{
wayland.windowManager.sway = {
enable = true;
package = pkgs.swayfx;
wrapperFeatures.gtk = true;
checkConfig = false;
extraConfigEarly = ''
blur enable
blur_passes 2
blur_radius 4
options.custom.screenShotDir = mkOption {
default = config.home.homeDirectory + "/Pictures/Screenshots";
type = with types; uniq str;
description = "Folder for all screenshots";
};
shadows enable
shadow_blur_radius 16
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
layer_effects "waybar" blur enable
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
'';
config = rec {
modifier = "Mod1";
shadows enable
shadow_blur_radius 16
input."*" = {
xkb_layout = "de,gb";
xkb_variant = ",colemak_dh";
xkb_numlock = "enabled";
};
layer_effects "waybar" blur enable
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
output."BOE 0x0BCA Unknown".scale = "1.5";
bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next
'';
config = rec {
modifier = "Mod1";
terminal = getExe pkgs.kitty;
menu = getExe pkgs.fuzzel;
seat = {
"*".hide_cursor = "when-typing enable";
seat0.fallback = "true";
seat1."\r" = concatMapStringsSep "\n " (s: " attach ${s}") [
"9390:4610:Rapoo_Rapoo_Gaming_Device"
"9390:4610:Rapoo_Rapoo_Gaming_Device_Keyboard"
];
};
keybindings =
let
mod = config.wayland.windowManager.sway.config.modifier;
in
{
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" = 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 ${getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${getExe pkgs.fuzzel} -d'";
"${modifier}+Shift+Escape" =
"exec ${getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${menu} -d | ${getExe' pkgs.findutils "xargs"} ${getExe' pkgs.systemd "systemctl"}";
# Focus
"${modifier}+Down" = "focus down";
@ -90,7 +121,6 @@ in
"${modifier}+0" = "workspace number 0";
"${modifier}+Shift+0" = "move window to workspace number 0";
# Sway Control
"${modifier}+Shift+q" = "kill";
"${modifier}+Shift+c" = "reload";
@ -102,77 +132,111 @@ in
# Programs
"${modifier}+a" = "exec ${getExe pkgs.nemo}";
"${modifier}+Return" = "exec ${getExe pkgs.kitty}";
"${modifier}+Return" = "exec ${terminal}";
# dmenu
"${modifier}+d" = "exec ${getExe pkgs.fuzzel}";
"${modifier}+d" = "exec ${menu}";
"${modifier}+s" =
"exec ${getExe pkgs.bash} -c \"${terminal} ssh $(grep -P '^Host (?!\\*)' ${config.home.homeDirectory}/.ssh/config | ${getExe' pkgs.coreutils "cut"} -d ' ' -f2 | ${menu} -d)\"";
"${modifier}+e" =
"exec ${getExe pkgs.bash} -c \"${getExe pkgs.uni} emoji all -f '%(emoji h) %(cldr_full h Q:[:])' | ${getExe pkgs.gnused} '/^$/d' | ${menu} -d | ${getExe' pkgs.coreutils "cut"} -d ' ' -f1 | ${getExe' pkgs.coreutils "tr"} -d '\\n' | ${getExe' pkgs.wl-clipboard-rs "wl-copy"}\"";
# Wallpaper
"${modifier}+b" = "exec ${getExe' pkgs.systemd "systemctl"} --user start swww-randomize";
# Notifications
"${modifier}+n" = "exec ${getExe' pkgs.dunst "dunstctl"} history-pop";
# Screenshot
"${modifier}+Shift+s" =
"exec ${getExe pkgs.bash} -c \"${getExe' pkgs.coreutils "mkdir"} -p ${config.custom.screenShotDir}; ${getExe pkgs.wayfreeze} --hide-cursor --after-freeze-cmd '${getExe pkgs.sway-contrib.grimshot} savecopy area ${config.custom.screenShotDir}/$(${getExe' pkgs.coreutils "date"} -Iseconds).png; ${getExe pkgs.killall} wayfreeze'\"";
# Screenlock
"${modifier}+l" = "exec --no-startup-id ${getExe pkgs.swaylock}";
# Audio
"--locked XF86AudioLowerVolume" =
"exec ${getExe pkgs.pulsemixer} --change-volume -5 --max-volume 100";
"--locked XF86AudioRaiseVolume" =
"exec ${getExe pkgs.pulsemixer} --change-volume +5 --max-volume 100";
"--locked XF86AudioNext" = "exec ${getExe pkgs.playerctl} next";
"--locked XF86AudioPrev" = "exec ${getExe pkgs.playerctl} previous";
"--locked XF86AudioPause" = "exec ${getExe pkgs.playerctl} play-pause";
"--locked XF86AudioPlay" = "exec ${getExe pkgs.playerctl} play-pause";
"--locked XF86AudioMute" = "exec ${getExe pkgs.pulsemixer} --toggle-mute";
"--locked XF86AudioMicMute" =
"exec ${getExe pkgs.pulsemixer} --toggle-mute --id $(${getExe pkgs.pulsemixer} --list-sources | grep -Po 'source-\\d{2}(?=.*Default$)')";
# Brightness
"--locked XF86MonBrightnessDown" = "exec ${getExe pkgs.brightnessctl} set 5%-";
"--locked XF86MonBrightnessUp" = "exec ${getExe pkgs.brightnessctl} set 5%+";
};
colors = {
background = "#856cf9";
focused = {
background = "#182030";
border = "#5c4a94";
childBorder = "#856cd9";
indicator = "#856cd9";
text = "#856cd9";
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";
};
};
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";
}
];
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";
}
];
};
};
};
};