Set up Sway

This commit is contained in:
Daniel Lundin 2024-10-23 10:33:46 +02:00
parent 890ac1e91c
commit 906a806b5d
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
4 changed files with 113 additions and 4 deletions

View file

@ -79,6 +79,13 @@ in
localNetworkGameTransfers.openFirewall = true;
};
security.polkit.enable = true;
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
services.gnome.gnome-keyring.enable = true;
services.printing.enable = true;

View file

@ -29,11 +29,11 @@
"zig": "zig"
},
"locked": {
"lastModified": 1729600492,
"narHash": "sha256-lQ1oSHfNRvveB9YEMetEFl6a8Tpb6cQkMtSQKAYBLMQ=",
"lastModified": 1729703875,
"narHash": "sha256-haI5d6Xs4FzBN2x+BkmvnRUT0BAaaVnRcnW/DaEWXsw=",
"ref": "refs/heads/main",
"rev": "5e001fcb64deeee69b92a03a51d05a21b09153bd",
"revCount": 7763,
"rev": "61aff898bd585d77c89f6b4a453992a6daec6f56",
"revCount": 7775,
"type": "git",
"url": "ssh://git@github.com/ghostty-org/ghostty"
},

View file

@ -12,6 +12,7 @@
./nvim.nix
./scripts.nix
./ssh.nix
./sway.nix
./tmux.nix
./utils.nix
./vcs.nix

101
home/common/sway.nix Normal file
View file

@ -0,0 +1,101 @@
{
config,
lib,
pkgs,
...
}:
{
config = lib.mkIf config.patagia.desktop.enable {
home.sessionVariables.NIXOS_OZONE_WL = "1"; # For electron apps
programs.wofi = {
enable = true;
settings = {
location = "top-center";
allow_markup = true;
width = 800;
};
style = ''
* {
font-family: monospace;
}
window {
background-color: #7c818c;
}
'';
};
home.packages = with pkgs; [
fuzzel
light
];
wayland.windowManager.sway =
let
gtk-launch = "${pkgs.gtk4.dev}/bin/gtk4-launch";
light = "${pkgs.light}/bin/light";
playerctl = "${pkgs.playerctl}/bin/playerctl --all-players";
wofi = "${pkgs.wofi}/bin/wofi";
wpctl = "${pkgs.wireplumber}/bin/wpctl";
in
{
enable = true;
systemd.enable = true;
wrapperFeatures.gtk = true;
# SwayFX for fancy fancification
package = pkgs.swayfx;
checkConfig = false; # workaround for https://discourse.nixos.org/t/sway-fails-with-cannot-create-gles2-renderer-after-update/45703
extraConfig = ''
corner_radius 6
shadows enable
'';
# default_dim_inactive 0.9
config = {
modifier = "Mod4";
terminal = "ghostty";
menu = "${wofi} --show drun";
fonts.names = [ "Berkeley Mono Variable" ];
gaps = {
smartGaps = true;
smartBorders = "on";
inner = 0;
outer = 0;
};
window = {
border = 3;
titlebar = false;
};
keybindings =
let
inherit (config.wayland.windowManager.sway.config) modifier menu;
in
lib.mkAfter {
"${modifier}+return" = "exec ${menu}";
"${modifier}+f" = "floating toggle";
"${modifier}+t" = "exec ghostty";
"${modifier}+s" = "sticky toggle";
"${modifier}+q" = "exit";
"${modifier}+r" = "reload";
"XF86MonBrightnessDown" = "exec '${light} -U 15'";
"XF86MonBrightnessUp" = "exec '${light} -A 15'";
"XF86AudioRaiseVolume" = "exec '${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%+ -l 1.0'";
"XF86AudioLowerVolume" = "exec '${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%- -l 1.0'";
"XF86AudioMute" = "exec '${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle'";
"XF86AudioPlay" = "exec '${playerctl} play-pause'";
"XF86AudioNext" = "exec '${playerctl} next'";
"XF86AudioPrev" = "exec '${playerctl} previous'";
"Print" = "exec 'screenshot.sh clipboard'";
};
};
};
};
}