nixos/home/sway/default.nix

175 lines
5.8 KiB
Nix

{
config,
lib,
pkgs,
fonts,
scheme,
accentColour ? "base07",
...
}: {
imports = [../desktop.nix];
wayland.windowManager.sway = {
enable = true;
package = null;
swaynag.enable = true;
systemd.enable = true;
xwayland = true;
config = {
input = {
"*" = {
xkb_layout = "gb";
xkb_options = "ctrl:nocaps";
};
"type:touchpad" = {
tap = "enabled";
natural_scroll = "enabled";
};
};
seat = {
"seat0" = {
xcursor_theme = with config.gtk.cursorTheme; "${name} ${toString size}";
};
};
modifier = "Mod4";
terminal = "${config.programs.alacritty.package}/bin/alacritty";
menu = "${config.programs.rofi.finalPackage}/bin/rofi -show drun";
workspaceAutoBackAndForth = true;
bars = [];
gaps = {
inner = 10;
outer = 5;
};
fonts = {
names = [fonts.monospace.name];
style = "regular";
size = fonts.sizes.desktop * 1.0;
};
colors = with scheme.withHashtag; let
text = toString base05;
indicator = toString cyan;
in rec {
background = toString base00;
focused = rec {
inherit background text indicator;
border = toString scheme.withHashtag.${accentColour};
childBorder = border;
};
unfocused = rec {
inherit background text indicator;
border = toString base03;
childBorder = border;
};
focusedInactive = rec {
inherit background text indicator;
border = toString base03;
childBorder = border;
};
};
startup = [
{command = "${pkgs.swaynotificationcenter}/bin/swaync";}
{command = "${pkgs.swaybg}/bin/swaybg -i ${../../wallpapers/waves/cat-waves.png}";}
{command = "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";}
{command = "${pkgs.protonmail-bridge}/bin/protonmail-bridge -n";}
];
assigns = {
"3" = [
{class = "^(libreoffice|soffice)(.*)$";}
];
"4" = [
{class = "^WebCord$";}
{class = "^Signal$";}
];
"5" = [
{class = "^steam$";}
{class = "^org.prismlauncher.PrismLauncher$";}
];
};
window = {
commands = [
{
command = "floating enable";
criteria = {app_id = "org.kde.polkit-kde-authentication-agent-1";};
}
{
command = "floating enable";
criteria = {app_id = "Pinentry";};
}
{
command = "floating enable";
criteria = {app_id = "pavucontrol";};
}
{
command = "floating enable";
criteria = {app_id = ".blueman-manager-wrapped";};
}
{
command = "floating enable";
criteria = {app_id = "nm-connection-editor";};
}
{
command = "floating enable";
criteria = {app_id = "org.prismlauncher.PrismLauncher";};
}
];
};
keybindings = with config; let
modifier = wayland.windowManager.sway.config.modifier;
withTerm = {
term ? "alacritty",
package ? config.programs.${term}.package,
progname,
args ? "",
}: "${package}/bin/${term} -T ${progname} -e ${progname} ${args}";
in
lib.mkOptionDefault {
# Movement
"${modifier}+bracketleft" = "move workspace to output left";
"${modifier}+bracketright" = "move workspace to output right";
# Function keys
## Sound
"XF86AudioMute" = "exec ${services.avizo.package}/bin/volumectl %";
"XF86AudioMicMute" = "exec ${services.avizo.package}/bin/volumectl -m %";
"XF86AudioRaiseVolume" = "exec ${services.avizo.package}/bin/volumectl -u + 5";
"XF86AudioLowerVolume" = "exec ${services.avizo.package}/bin/volumectl -u - 5";
## Playback
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
## Brightness
"XF86MonBrightnessUp" = "exec ${services.avizo.package}/bin/lightctl + 5";
"XF86MonBrightnessDown" = "exec ${services.avizo.package}/bin/lightctl - 5";
# System utilities
"${modifier}+F1" = "exec ${programs.swaylock.package}/bin/swaylock --screenshots --clock --indicator --grace-no-mouse";
"${modifier}+z" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw";
"${modifier}+Shift+z" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -d -sw";
"${modifier}+Shift+Return" = "exec ${programs.emacs.finalPackage}/bin/emacsclient -c";
# "${modifier}+s" = "exec ${withTerm {
# progname = "btm";
# args = "--autohide_time --battery --celsius --enable_cache_memory --enable_gpu_memory --group --hide_avg_cpu --hide_table_gap --retention=3m --show_table_scroll_position";
# }}";
# "${modifier}+c" = "exec ${withTerm {progname = "cava";}}"
};
};
extraConfig = ''
corner_radius 10
blur enable
blur_xray disable
blur_passes 3
blur_radius 5
corner_radius 10
shadows enable
shadow_blur_radius 4
layer_effects "waybar" blur enable; blur_ignore_transparent enable
layer_effects "swaync-control-center" blur enable; blur_ignore_transparent enable
layer_effects "rofi" blur enable; blur_ignore_transparent enable
titlebar_separator enable
scratchpad_minimize enable
'';
};
}