diff --git a/common/desktop.nix b/common/desktop.nix index 52cc9d4..31745aa 100644 --- a/common/desktop.nix +++ b/common/desktop.nix @@ -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; diff --git a/flake.lock b/flake.lock index ef8d639..8152509 100644 --- a/flake.lock +++ b/flake.lock @@ -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" }, diff --git a/home/common/default.nix b/home/common/default.nix index 0697d99..6048b07 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -12,6 +12,7 @@ ./nvim.nix ./scripts.nix ./ssh.nix + ./sway.nix ./tmux.nix ./utils.nix ./vcs.nix diff --git a/home/common/sway.nix b/home/common/sway.nix new file mode 100644 index 0000000..db931bf --- /dev/null +++ b/home/common/sway.nix @@ -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; + [ + ]; + + 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'"; + }; + }; + }; + }; +}