nixos/home/desktop/sway/default.nix
Evie Litherland-Smith 94c6d717b0 Use libsecret for mbsync and git-credential-helper
Add gnome-keyring as libsecret backend, swap git-credential-helper and
mbsync to using libsecret/secret-tool. Add helper script to check for
and request mbsync passwords if missing. Add GNOME Seahorse for
viewing passwords graphically.

Remove email/work.nix and merge back into default.nix

Don't auto start protonmail-bridge, use the GUI instead so it doesn't
need to unlock all my keychains immediately

Move 3D modelling software to Vanguard only, instead of all personal
devices.

Move waybar back to top of screen and adjust all corner radii to 5px
from 10px

Re-enable swayfx blur_ignore_transparent now that it's added to
nixpkgs, re-enable shadows
2024-07-08 08:58:32 +01:00

186 lines
6.7 KiB
Nix

{
config,
lib,
pkgs,
fonts,
accentColourName,
...
}: let
set-background = pkgs.writeShellScriptBin "set-background" ''
${pkgs.swaybg}/bin/swaybg -m fill -i ${./wallpapers/landscapes/tropic_island_day.jpg}
'';
in {
home.packages = [set-background];
programs.waybar.systemd.target = "sway-session.target";
services.kanshi.systemdTarget = "sway-session.target";
wayland.windowManager.sway = {
enable = true;
package =
pkgs.swayfx.overrideAttrs
(old: {passthru.providedSessions = ["sway"];});
swaynag.enable = true;
systemd.enable = true;
xwayland = true;
checkConfig = false;
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.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 = let
sc = config.scheme.withHashtag;
text = toString sc.base05;
indicator = toString sc.${accentColourName};
background = toString sc.base00;
in {
inherit background;
focused = let
border = toString sc.${accentColourName};
in {
inherit background text indicator border;
childBorder = border;
};
focusedInactive = let
border = toString sc.base04;
in {
inherit background text indicator border;
childBorder = border;
};
unfocused = let
border = toString sc.base03;
in {
inherit background text indicator border;
childBorder = border;
};
urgent = let
border = toString sc.red;
in {
inherit background text indicator border;
childBorder = border;
};
};
startup = [
{command = "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";}
{command = "${set-background}/bin/set-background";}
];
window = {
border = 1;
titlebar = false;
commands = [
{
criteria.window_role = "(?:pop-up|bubble|dialog)";
command = "floating enable";
}
{
criteria.app_id = "(?:org\.kde\.polkit-kde-authentication-agent-1|Pinentry|pavucontrol|\.blueman-manager-wrapped|nm-connection-editor)";
command = "floating enable";
}
{
criteria.class = "(?:[Mm]atplotlib|.*\.py|Idl)";
command = "floating enable";
}
{
# Catch-all for file dialog windows
criteria.title = "(?:Open|Save) (?:File|Folder|As)";
command = "floating enable, resize set width 1030 height 710";
}
{
# Inhibit idle when watching vidoes
criteria.app_id = "(?:firefox|mpv)";
command = "inhibit_idle fullscreen";
}
{
# Window rules for game sessions.
# Note: controllers don't reset idle timer
criteria.class = "(?:steam_app|Minecraft).*";
command = "floating enable, fullscreen enable, inhibit_idle focus";
}
];
};
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
"Mod4+Mod1+l" = "exec swaylockfx";
"${modifier}+z" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw";
"${modifier}+Shift+z" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -d -sw";
"${modifier}+Shift+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 5
blur enable
blur_xray disable
blur_passes 3
blur_radius 5
shadows enable
shadow_blur_radius 5
layer_effects "system-menu" blur enable; blur_ignore_transparent enable; shadows enable
layer_effects "gtk-layer-shell" blur enable; blur_ignore_transparent enable; shadows enable
layer_effects "notifications" blur enable; blur_ignore_transparent enable; shadows enable
layer_effects "launcher" blur enable; blur_ignore_transparent enable; shadows enable
layer_effects "logout_dialog" blur enable; blur_ignore_transparent enable; shadows enable
layer_effects "waybar" blur enable; blur_ignore_transparent enable; shadows enable
layer_effects "avizo" blur enable; blur_ignore_transparent enable; shadows enable
layer_effects "swaync-notification-window" blur enable; blur_ignore_transparent enable; shadows enable
layer_effects "swaync-control-center" blur enable; blur_ignore_transparent enable; shadows enable
titlebar_separator enable
'';
};
}