This repository has been archived on 2024-07-03. You can view files and clone it, but cannot push or open issues or pull requests.
home-manager/programs/desktop/sway/default.nix
Evie Litherland-Smith 98b04a645a Switch swaync for mako
Move waybar to bottom of screen, move workspaces module to the left
and mpris to the centre
2024-05-28 07:47:00 +01:00

163 lines
5.3 KiB
Nix

{
config,
lib,
pkgs,
fonts,
accentColour ? "base07",
...
}: {
wayland.windowManager.sway = {
enable = true;
package =
pkgs.swayfx.overrideAttrs
(old: {passthru.providedSessions = ["sway"];});
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.foot.package}/bin/foot";
menu = "${config.programs.fuzzel.package}/bin/fuzzel";
workspaceAutoBackAndForth = true;
bars = [];
gaps = {
inner = 5;
outer = 0;
};
fonts = {
names = [fonts.monospace.name];
style = "regular";
size = fonts.sizes.desktop * 1.0;
};
colors = with config.scheme.withHashtag; let
text = toString base05;
indicator = toString cyan;
in rec {
background = toString base00;
focused = rec {
inherit background text indicator;
border = toString config.scheme.withHashtag.${accentColour};
childBorder = border;
};
focusedInactive = rec {
inherit background text indicator;
border = toString base04;
childBorder = border;
};
unfocused = rec {
inherit background text indicator;
border = toString base03;
childBorder = border;
};
urgent = rec {
inherit background text indicator;
border = toString red;
childBorder = border;
};
};
startup = [
{command = "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";}
{command = "${pkgs.protonmail-bridge}/bin/protonmail-bridge -n";}
{command = "set-background";}
];
window = {
border = 1;
titlebar = false;
commands =
(map (criteria: {
inherit criteria;
command = "floating enable";
}) [
{app_id = "org.kde.polkit-kde-authentication-agent-1";}
{app_id = "Pinentry";}
{app_id = "pavucontrol";}
{app_id = "\.blueman-manager-wrapped";}
{app_id = "nm-connection-editor";}
{app_id = "thunar";}
{class = "[Mm]atplotlib";}
{class = ".*\.py";}
{class = "Idl";}
])
++ (map (criteria: {
inherit criteria;
command = "layout tabbed";
}) [
{class = "Nxplayer\.bin";}
{app_id = "Nxplayer\.bin";}
])
++ [];
};
floating.border = 1;
keybindings = with config; let
modifier = wayland.windowManager.sway.config.modifier;
in
lib.mkOptionDefault {
# Movement
"${modifier}+comma" = "workspace prev";
"${modifier}+period" = "workspace next";
"${modifier}+shift+comma" = "move workspace prev";
"${modifier}+shift+period" = "move workspace next";
"${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 swaylockfx";
"${modifier}+p" = "exec ${programs.wlogout.package}/bin/wlogout";
"${modifier}+Shift+Return" = "exec ${programs.emacs.finalPackage}/bin/emacsclient -c";
};
};
extraConfig = ''
bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next
corner_radius 10
blur enable
blur_xray disable
blur_passes 3
blur_radius 5
corner_radius 10
shadows disable
shadow_blur_radius 0
layer_effects "system-menu" blur enable; shadows disable
layer_effects "gtk-layer-shell" blur enable; shadows disable
layer_effects "notifications" blur enable; shadows disable
layer_effects "launcher" blur enable; shadows disable
layer_effects "waybar" blur enable; shadows disable
layer_effects "avizo" blur enable; shadows disable
titlebar_separator enable
scratchpad_minimize enable
'';
};
}