Jump to content

Sway: Difference between revisions

1,102 bytes added ,  18 October 2022
Add information about setting up Sway with Home Manager
imported>FedX-sudo
m (gnome3 has been renamed to gnome)
imported>LoganWalls
(Add information about setting up Sway with Home Manager)
Line 3: Line 3:


== Installation ==
== Installation ==
You can install Sway by enabling it in NixOS directly, or by using [[Home Manager]]. Note that if you enable Sway using NixOS (via <code>programs.sway.enable = true;</code> in <code>configuration.nix</code>), your Home Manager configurations for Sway will be ignored.


Here is a minimal configuration where everything you would expect (like screen sharing and gtk themes) work:
=== Using NixOS ===
Here is a minimal configuration (without [[Home Manager]]) where everything you would expect (like screen sharing and gtk themes) work:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
{ config, pkgs, lib, ... }:
{ config, pkgs, lib, ... }:
Line 118: Line 120:
* Running sway as a systemd user service is not recommended [https://github.com/swaywm/sway/wiki/Systemd-integration#running-sway-itself-as-a---user-service] [https://github.com/swaywm/sway/issues/5160]
* Running sway as a systemd user service is not recommended [https://github.com/swaywm/sway/wiki/Systemd-integration#running-sway-itself-as-a---user-service] [https://github.com/swaywm/sway/issues/5160]
* This wiki page was gutted and rewritten in June 2022. See [https://discourse.nixos.org/t/some-lose-ends-for-sway-on-nixos-which-we-should-fix/17728] for the related discussion.
* This wiki page was gutted and rewritten in June 2022. See [https://discourse.nixos.org/t/some-lose-ends-for-sway-on-nixos-which-we-should-fix/17728] for the related discussion.
=== Using Home Manager ===
To set up Sway using [[Home Manager]], first you must enable [[Polkit]] in your nix configuration:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
security.polkit.enable = true;
</nowiki>}}
Then you can enable Sway in your home manager configuration. Here is a minimal example:
<syntaxhighlight lang="nix>
  wayland.windowManager.sway = {
    enable = true;
    config = rec {
      modifier = "Mod4";
      # Use kitty as default terminal
      terminal = "kitty";
      startup = [
        # Launch Firefox on start
        {command = "firefox";}
      ];
  };
</syntaxhighlight>
See [https://rycee.gitlab.io/home-manager/options.html#opt-wayland.windowManager.sway.enable Home Manager's Options for Sway] for a complete list of configuration options.


=== Brightness and volume ===
=== Brightness and volume ===
Anonymous user