mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 15:39:58 +00:00
sway: per-host overrides via host.conf and session-env
Adds a host_sway_dotfiles mechanism mirroring host_i3_dotfiles: hosts drop a host.conf into ~/.config/sway/ to override sway settings, and optionally a session-env file sourced by start-sway for per-host environment variables. The base sway/config defines $terminal and includes ~/.config/sway/host.conf; an empty placeholder ships with the base profile so the include never warns on hosts without overrides. nymph gets its own host.conf wrapping alacritty in prime-run (NVIDIA PRIME offload), bumping gaps/corner_radius, and pinning workspaces to eDP-1 / DP-1, plus a session-env exporting SWAY_UNSUPPORTED_GPU=1 and WLR_DRM_DEVICES for the hybrid Intel+NVIDIA setup. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -31,3 +31,11 @@ host_i3_dotfiles:
|
|||||||
- src: .config/wireplumber/wireplumber.conf.d/60-camera-priority.conf
|
- src: .config/wireplumber/wireplumber.conf.d/60-camera-priority.conf
|
||||||
dest: .config/wireplumber/wireplumber.conf.d/60-camera-priority.conf
|
dest: .config/wireplumber/wireplumber.conf.d/60-camera-priority.conf
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
|
host_sway_dotfiles:
|
||||||
|
- src: .config/sway/host.conf
|
||||||
|
dest: .config/sway/host.conf
|
||||||
|
mode: "0644"
|
||||||
|
- src: .config/sway/session-env
|
||||||
|
dest: .config/sway/session-env
|
||||||
|
mode: "0644"
|
||||||
|
|||||||
@@ -19,3 +19,18 @@
|
|||||||
- "'i3' in (desktop_sessions_enabled | default([]))"
|
- "'i3' in (desktop_sessions_enabled | default([]))"
|
||||||
- (host_i3_dotfiles | default([])) | length > 0
|
- (host_i3_dotfiles | default([])) | length > 0
|
||||||
|
|
||||||
|
- name: Copy host-specific sway dotfiles
|
||||||
|
tags: [dotfiles, dotfiles:desktop, dotfiles:host, sway]
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ playbook_dir }}/../dotfiles/{{ hostname }}/{{ item.src }}"
|
||||||
|
dest: "{{ user_home }}/{{ item.dest }}"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "{{ item.mode }}"
|
||||||
|
loop: "{{ host_sway_dotfiles | default([]) }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.dest }}"
|
||||||
|
when:
|
||||||
|
- "'sway' in (desktop_sessions_enabled | default([]))"
|
||||||
|
- (host_sway_dotfiles | default([])) | length > 0
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ set $down j
|
|||||||
set $up k
|
set $up k
|
||||||
set $right l
|
set $right l
|
||||||
|
|
||||||
|
# Default terminal (hosts can override via host.conf — e.g. nymph wraps it in prime-run)
|
||||||
|
set $terminal alacritty
|
||||||
|
|
||||||
# Workspaces (waybar formatta i numeri in romani via format-icons)
|
# Workspaces (waybar formatta i numeri in romani via format-icons)
|
||||||
set $ws1 "1"
|
set $ws1 "1"
|
||||||
set $ws2 "2"
|
set $ws2 "2"
|
||||||
@@ -62,6 +65,9 @@ gaps outer 4
|
|||||||
smart_gaps on
|
smart_gaps on
|
||||||
smart_borders on
|
smart_borders on
|
||||||
|
|
||||||
|
# Per-host overrides (terminal wrapper, gaps tweaks, workspace→output bindings, …)
|
||||||
|
include ~/.config/sway/host.conf
|
||||||
|
|
||||||
# Window rules
|
# Window rules
|
||||||
for_window [app_id="(?i)polkit"] floating enable
|
for_window [app_id="(?i)polkit"] floating enable
|
||||||
for_window [class="(?i)polkit"] floating enable
|
for_window [class="(?i)polkit"] floating enable
|
||||||
@@ -108,7 +114,7 @@ exec swayidle -w \
|
|||||||
before-sleep '~/.config/sway/scripts/lockscreen'
|
before-sleep '~/.config/sway/scripts/lockscreen'
|
||||||
|
|
||||||
# Terminal
|
# Terminal
|
||||||
bindsym $mod+Return exec alacritty
|
bindsym $mod+Return exec $terminal
|
||||||
|
|
||||||
# Emacs client
|
# Emacs client
|
||||||
bindsym $mod+Shift+e exec emacsclient -c -n
|
bindsym $mod+Shift+e exec emacsclient -c -n
|
||||||
|
|||||||
3
dotfiles/desktop/.config/sway/host.conf
Normal file
3
dotfiles/desktop/.config/sway/host.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Per-host sway overrides. Empty by default; hosts that need tuning
|
||||||
|
# ship their own version via host_sway_dotfiles, which overwrites this
|
||||||
|
# placeholder during deploy.
|
||||||
@@ -15,6 +15,9 @@ export GDK_BACKEND='wayland,x11'
|
|||||||
|
|
||||||
export SSH_AUTH_SOCK="$HOME/.local/state/ssh-agent/socket"
|
export SSH_AUTH_SOCK="$HOME/.local/state/ssh-agent/socket"
|
||||||
|
|
||||||
|
# Per-host session environment (GPU / Wayland tuning, etc.)
|
||||||
|
[ -r "$HOME/.config/sway/session-env" ] && . "$HOME/.config/sway/session-env"
|
||||||
|
|
||||||
exec dbus-run-session sh -eu -c '
|
exec dbus-run-session sh -eu -c '
|
||||||
umask 077
|
umask 077
|
||||||
printf "%s\n" "$DBUS_SESSION_BUS_ADDRESS" > "$HOME/.dbus-session-bus-address"
|
printf "%s\n" "$DBUS_SESSION_BUS_ADDRESS" > "$HOME/.dbus-session-bus-address"
|
||||||
|
|||||||
16
dotfiles/nymph/.config/sway/host.conf
Normal file
16
dotfiles/nymph/.config/sway/host.conf
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
set $terminal ~/.local/bin/prime-run /usr/bin/alacritty
|
||||||
|
|
||||||
|
gaps inner 10
|
||||||
|
gaps outer 5
|
||||||
|
corner_radius 10
|
||||||
|
|
||||||
|
workspace 1 output eDP-1
|
||||||
|
workspace 2 output DP-1
|
||||||
|
workspace 3 output DP-1
|
||||||
|
workspace 4 output DP-1
|
||||||
|
workspace 5 output DP-1
|
||||||
|
workspace 6 output DP-1
|
||||||
|
workspace 7 output DP-1
|
||||||
|
workspace 8 output DP-1
|
||||||
|
workspace 9 output DP-1
|
||||||
|
workspace 10 output DP-1
|
||||||
6
dotfiles/nymph/.config/sway/session-env
Normal file
6
dotfiles/nymph/.config/sway/session-env
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export LIBVA_DRIVER_NAME=iHD
|
||||||
|
export QT_QPA_PLATFORM=wayland
|
||||||
|
export QT_QPA_PLATFORMTHEME=qt6ct
|
||||||
|
export SWAY_UNSUPPORTED_GPU=1
|
||||||
|
export WLR_DRM_DEVICES=/dev/dri/card0:/dev/dri/card1
|
||||||
|
export WLR_NO_HARDWARE_CURSORS=1
|
||||||
Reference in New Issue
Block a user