Sway: Difference between revisions

Lulu (talk | contribs)
Remove duplicated entry "Touchscreen input bound to the wrong monitor in multi-monitor setups"
Onny (talk | contribs)
Restructure, add config section
Line 2: Line 2:
[https://github.com/swaywm/sway/wiki/i3-Migration-Guide i3 migration guide]
[https://github.com/swaywm/sway/wiki/i3-Migration-Guide i3 migration guide]


== Installation ==
== Setup ==
You can install Sway by enabling it in NixOS directly, or by using [[Home Manager]], or both.
You can install Sway by enabling it in NixOS directly, or by using [[Home Manager]], or both.


Line 58: Line 58:


You might need to active dbus manually from .zshrc to use i.e: dunst, see [https://discourse.nixos.org/t/dunst-crashes-if-run-as-service/27671/2 Dunst crashes if run as service]
You might need to active dbus manually from .zshrc to use i.e: dunst, see [https://discourse.nixos.org/t/dunst-crashes-if-run-as-service/27671/2 Dunst crashes if run as service]
=== Brightness and volume ===
If you are on a laptop, you can set up brightness and volume function keys as follows:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
users.users.yourusername.extraGroups = [ "video" ];
programs.light.enable = true;
</nowiki>}}
{{file|sway config|bash|
# Brightness
bindsym XF86MonBrightnessDown exec light -U 10
bindsym XF86MonBrightnessUp exec light -A 10
# Volume
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +1%'
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -1%'
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
}}


=== Systemd services ===
=== Systemd services ===
Line 114: Line 94:
};                                                                       
};                                                                       
</nowiki>}}
</nowiki>}}
== Configuration ==
Sway can be configured for specific users using Home-Manager or manually through configuration files. Default is <code>/etc/sway/config</code> and custom user configuration in <code>~/.config/sway/config</code>.
=== Keyboard layout ===
Changing layout for all keyboards to German (de)<syntaxhighlight lang="console">
input * xkb_layout "de"
</syntaxhighlight>
=== High-DPI scaling ===
Changing scale for all screens to factor 1.5<syntaxhighlight lang="console">
output * scale 1.5
</syntaxhighlight>
=== Brightness and volume ===
If you are on a laptop, you can set up brightness and volume function keys as follows:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
users.users.yourusername.extraGroups = [ "video" ];
programs.light.enable = true;
</nowiki>}}
{{file|sway config|bash|
# Brightness
bindsym XF86MonBrightnessDown exec light -U 10
bindsym XF86MonBrightnessUp exec light -A 10
# Volume
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +1%'
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -1%'
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
}}


== Troubleshooting ==
== Troubleshooting ==