Sway: Difference between revisions
imported>Mschwaig remind people to start sway-session.target as outlined in the sway wiki |
imported>Artturin add instructions and info |
||
Line 1: | Line 1: | ||
Sway | Sway is a tiling Wayland compositor and a drop-in replacement for the i3 window manager for X11. It works with your existing i3 configuration and supports most of i3's features, plus a few extras. | ||
== Installation == | |||
== Systemd integration == | === NixOS === | ||
[https://search.nixos.org/options?query=sway NixOS options for sway] | |||
<syntaxhighlight lang="nix"> | |||
programs.sway = { | |||
enable = true; | |||
wrapperFeatures.gtk = true; # so that gtk works properly | |||
extraPackages = with pkgs; [ | |||
swaylock | |||
swayidle | |||
wl-clipboard | |||
alacritty # Alacritty is the default terminal in the config | |||
dmenu # Dmenu is the default in the config but i recommend wofi since its wayland native | |||
]; | |||
}; | |||
</syntaxhighlight> | |||
=== Home Manager === | |||
[https://rycee.gitlab.io/home-manager/options.html#opt-wayland.windowManager.sway.enable Home Manager options for sway] | |||
<syntaxhighlight lang="nix"> | |||
wayland.windowManager.sway = { | |||
enable = true; | |||
wrapperFeatures.gtk = true ; | |||
}; | |||
home.packages = with pkgs; [ | |||
swaylock | |||
swayidle | |||
wl-clipboard | |||
alacritty # Alacritty is the default terminal in the config | |||
dmenu # Dmenu is the default in the config but i recommend wofi since its wayland native ]; | |||
] | |||
</syntaxhighlight> | |||
== Info == | |||
=== Clipboard === | |||
For clipboard support | |||
<syntaxhighlight lang="nix"> | |||
environment.systemPackages = with pkgs; [ wl-clipboard ]; | |||
</syntaxhighlight> | |||
to use [https://github.com/brunelli/wl-clipboard-x11/ wl-clipboard-x11] which is a wrapper to use wl-clipboard as a drop-in replacement to X11 clipboard tools | |||
<syntaxhighlight lang="nix"> | |||
nixpkgs.overlays = [ | |||
(self: super: { | |||
wl-clipboard-x11 = super.stdenv.mkDerivation rec { | |||
pname = "wl-clipboard-x11"; | |||
version = "5"; | |||
src = super.fetchFromGitHub { | |||
owner = "brunelli"; | |||
repo = "wl-clipboard-x11"; | |||
rev = "v${version}"; | |||
sha256 = "1y7jv7rps0sdzmm859wn2l8q4pg2x35smcrm7mbfxn5vrga0bslb"; | |||
}; | |||
dontBuild = true; | |||
dontConfigure = true; | |||
propagatedBuildInputs = [ super.wl-clipboard ]; | |||
makeFlags = [ "PREFIX=$(out)" ]; | |||
}; | |||
xsel = self.wl-clipboard-x11; | |||
xclip = self.wl-clipboard-x11; | |||
}) | |||
]; | |||
</syntaxhighlight> | |||
{{Note|This will recompile all packages that have xclip or xsel in their dependencies|warn}} | |||
=== Polkit === | |||
<syntaxhighlight lang="nix"> | |||
environment.systemPackages = with pkgs; [ polkit_gnome ]; | |||
</syntaxhighlight> | |||
nix generated sway config | |||
<syntaxhighlight lang="nix"> | |||
${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1 | |||
</syntaxhighlight> | |||
normal sway config | |||
<syntaxhighlight lang="bash"> | |||
# NixOS | |||
exec /run/current-system/sw/libexec/polkit-gnome-authentication-agent-1 | |||
# Home Manager | |||
exec ~/.nix-profile/libexec/polkit-gnome-authentication-agent-1 | |||
</syntaxhighlight> | |||
=== Systemd integration === | |||
In an article on the sway wiki [https://github.com/swaywm/sway/wiki/Systemd-integration], a way to integrate Sway with systemd user services is proposed. Starting sway that way has some benefits: | In an article on the sway wiki [https://github.com/swaywm/sway/wiki/Systemd-integration], a way to integrate Sway with systemd user services is proposed. Starting sway that way has some benefits: |