Sway no Arch Linux: configuração Inicial sem enrolação
Dica publicada em Linux / Configuração
Sway no Arch Linux: configuração Inicial sem enrolação
Pré-requisitos e Instalação
Instalação do compositor, terminal (foot), menu (wmenu), barra (waybar) e utilitários essenciais.sudo pacman -S --needed sway swaybg swayidle swaylock foot wmenu polkit xorg-xwayland waybar networkmanager network-manager-applet ttf-font-awesome pavucontrol grim slurp wl-clipboard swappy mako polkit-gnome wlsunset cliphist
systemctl enable --now NetworkManager
Configuração do Terminal (foot)
Configuração de transparência.mkdir -p ~/.config/foot
cat << 'EOF' > ~/.config/foot/foot.ini
[colors-dark]
background=1e1e1e
alpha=0.85
EOF
Configuração da Waybar
Módulos de volume interativo, rede, CPU, RAM, disco e relógio no topo.mkdir -p ~/.config/waybar
cat << 'EOF' > ~/.config/waybar/config
{
"layer": "bottom",
"position": "top",
"height": 30,
"modules-left": ["sway/workspaces", "sway/mode"],
"modules-center": ["sway/window"],
"modules-right": ["pulseaudio", "network", "cpu", "memory", "disk", "tray", "clock"],
"pulseaudio": {
"format": "VOL: {volume}%",
"format-muted": "MUDO",
"on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
"on-click-right": "pavucontrol",
"scroll-step": 5
},
"network": {
"format-wifi": "WIFI: {essid} ({signalStrength}%)",
"format-ethernet": "ETH: {ipaddr}",
"format-disconnected": "Desconectado",
"tooltip-format": "{ifname} via {gwaddr}",
"on-click": "foot -e nmtui"
},
"cpu": { "format": "CPU: {usage}%" },
"memory": { "format": "RAM: {}%" },
"disk": { "format": "HD: {percentage_used}%", "path": "/" },
"tray": { "spacing": 10 },
"clock": {
"format": "{:%d/%m/%Y %H:%M}",
"tooltip-format": "<big>{:%B de %Y}</big>\n<tt><small>{calendar}</small></tt>"
}
}
EOF
cat << 'EOF' > ~/.config/waybar/style.css * { font-family: monospace, "Font Awesome 6 Free"; font-size: 13px; } window#waybar { background-color: #323232; color: #ffffff; } #workspaces button { padding: 0 8px; background-color: transparent; color: #ffffff; border: none; } #workspaces button.focused { background-color: #5c5c5c; } #pulseaudio, #network, #cpu, #memory, #disk, #clock, #tray { padding: 0 10px; } EOF
cat << 'EOF' > ~/.config/waybar/style.css * { font-family: monospace, "Font Awesome 6 Free"; font-size: 13px; } window#waybar { background-color: #323232; color: #ffffff; } #workspaces button { padding: 0 8px; background-color: transparent; color: #ffffff; border: none; } #workspaces button.focused { background-color: #5c5c5c; } #pulseaudio, #network, #cpu, #memory, #disk, #clock, #tray { padding: 0 10px; } EOF
Configuração do Sway
Configuração centralizada com suporte a 100Hz (FreeSync), tema personalizado, utilitários em segundo plano e atalhos customizados. O arquivo abaixo sobrescreve a configuração padrão.mkdir -p ~/.config/sway
cat << 'EOF' > ~/.config/sway/config
set $mod Mod4
set $left h
set $down j
set $up k
set $right l
set $term foot
set $menu wmenu-run
# Integração do portal e Layout include /etc/sway/config.d/* exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway input * xkb_layout "br"
# Monitor e Papel de Parede (Exemplo para RX 5700 XT) output DP-3 mode 2560x1440@100Hz adaptive_sync on output * bg ~/Imagens/wallpaper.jpg fill
# Visual: Gaps e Bordas vermelhas smart_gaps off gaps inner 3 gaps outer 1 default_border pixel 4 default_floating_border pixel 4 for_window [app_id=".*"] border pixel 4 for_window [class=".*"] border pixel 4 client.focused #8B0000 #8B0000 #FFFFFF #8B0000 #8B0000
# Daemons bar { swaybar_command waybar } exec_always pkill nm-applet; nm-applet --indicator & exec mako exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec wlsunset -l -8.12 -L -35.09 exec wl-paste --type text --watch cliphist store exec wl-paste --type image --watch cliphist store
# Atalhos: Sistema bindsym $mod+Return exec $term bindsym $mod+d exec $menu bindsym $mod+Shift+q kill bindsym $mod+Shift+c reload bindsym $mod+Shift+e exec swaynag -t warning -m 'Sair do Sway?' -B 'Sim' 'swaymsg exit'
# Atalhos: Aplicativos e Utilitários bindsym $mod+b exec google-chrome-stable bindsym Print exec grim -g "$(slurp)" - | swappy -f - bindsym Shift+Print exec grim - | swappy -f - bindsym $mod+c exec cliphist list | wmenu | cliphist decode | wl-copy
# Atalhos: Navegação bindsym $mod+$left focus left bindsym $mod+$down focus down bindsym $mod+$up focus up bindsym $mod+$right focus right bindsym $mod+Shift+$left move left bindsym $mod+Shift+$down move down bindsym $mod+Shift+$up move up bindsym $mod+Shift+$right move right
# Atalhos: Workspaces bindsym $mod+1 workspace number 1 bindsym $mod+2 workspace number 2 bindsym $mod+3 workspace number 3 bindsym $mod+Shift+1 move container to workspace number 1 bindsym $mod+Shift+2 move container to workspace number 2 bindsym $mod+Shift+3 move container to workspace number 3
# Atalhos: Layout bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split bindsym $mod+f fullscreen bindsym $mod+Shift+space floating toggle bindsym $mod+space focus mode_toggle EOF
# Integração do portal e Layout include /etc/sway/config.d/* exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway input * xkb_layout "br"
# Monitor e Papel de Parede (Exemplo para RX 5700 XT) output DP-3 mode 2560x1440@100Hz adaptive_sync on output * bg ~/Imagens/wallpaper.jpg fill
# Visual: Gaps e Bordas vermelhas smart_gaps off gaps inner 3 gaps outer 1 default_border pixel 4 default_floating_border pixel 4 for_window [app_id=".*"] border pixel 4 for_window [class=".*"] border pixel 4 client.focused #8B0000 #8B0000 #FFFFFF #8B0000 #8B0000
# Daemons bar { swaybar_command waybar } exec_always pkill nm-applet; nm-applet --indicator & exec mako exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec wlsunset -l -8.12 -L -35.09 exec wl-paste --type text --watch cliphist store exec wl-paste --type image --watch cliphist store
# Atalhos: Sistema bindsym $mod+Return exec $term bindsym $mod+d exec $menu bindsym $mod+Shift+q kill bindsym $mod+Shift+c reload bindsym $mod+Shift+e exec swaynag -t warning -m 'Sair do Sway?' -B 'Sim' 'swaymsg exit'
# Atalhos: Aplicativos e Utilitários bindsym $mod+b exec google-chrome-stable bindsym Print exec grim -g "$(slurp)" - | swappy -f - bindsym Shift+Print exec grim - | swappy -f - bindsym $mod+c exec cliphist list | wmenu | cliphist decode | wl-copy
# Atalhos: Navegação bindsym $mod+$left focus left bindsym $mod+$down focus down bindsym $mod+$up focus up bindsym $mod+$right focus right bindsym $mod+Shift+$left move left bindsym $mod+Shift+$down move down bindsym $mod+Shift+$up move up bindsym $mod+Shift+$right move right
# Atalhos: Workspaces bindsym $mod+1 workspace number 1 bindsym $mod+2 workspace number 2 bindsym $mod+3 workspace number 3 bindsym $mod+Shift+1 move container to workspace number 1 bindsym $mod+Shift+2 move container to workspace number 2 bindsym $mod+Shift+3 move container to workspace number 3
# Atalhos: Layout bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split bindsym $mod+f fullscreen bindsym $mod+Shift+space floating toggle bindsym $mod+space focus mode_toggle EOF
Autostart via TTY
Início automático do compositor ao realizar login no console.cat << 'EOF' >> ~/.bash_profile
if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then exec sway fi EOF
if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then exec sway fi EOF
Funcionalidades:
Detecta automaticamente o monitor.
Baixa o wallpaper padrão do Sway.
Realiza a configuração inicial do Sway.
Ativa o Num Lock na inicialização.
Define o layout de teclado brasileiro (ABNT2).
Detecta navegadores web (Brave, Firefox e Google Chrome).
Para Brave e Google Chrome, utiliza os parâmetros: --password-store=basic --disable-gpu.
Detecta o lançador de programas (wofi ou wmenu).
Realiza backup dos arquivos originais, caso existam.
Configura o terminal Foot.
Configura a barra de status Waybar.
Configura o sistema de notificações Mako integrado ao notify-send no Wayland.
https://gitlab.com/slackvoid/sway-config