sway: screenshots, polkit floating, flatpak dark theme

Screenshots
- Swap xfce4-screenshooter for flameshot + grim/slurp/jq; xfce4 used
  the X11 selection so clipboard didn't round-trip to Wayland clients.
  Print invokes flameshot's editor; Shift/Alt+Print are quick
  grim-based captures via a small wrapper script. Flameshot is now
  autostarted so the first capture isn't slow.

Polkit
- Add for_window rules so the xfce-polkit dialog (and any other polkit
  agent) always opens floating.

Flatpak dark theme
- Write /etc/flatpak/overrides/global with GTK_THEME=Yaru-Blue-dark for
  legacy GTK apps, plus a sway-portals.conf so the Settings portal is
  served by xdg-desktop-portal-gtk (wlr doesn't implement it). That
  lets libadwaita apps see color-scheme=prefer-dark.

cleanup-sway: track the new package set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Fabio Scotto di Santolo
2026-05-16 23:26:45 +02:00
parent 41c474820f
commit d535c9ffd2
7 changed files with 97 additions and 5 deletions

View File

@@ -62,6 +62,11 @@ gaps outer 4
smart_gaps on
smart_borders on
# Window rules
for_window [app_id="(?i)polkit"] floating enable
for_window [class="(?i)polkit"] floating enable
for_window [title="^Authentication Required"] floating enable
# Autostart — XDG and session services
exec dex --autostart --environment sway
exec gnome-keyring-daemon --start --components=secrets
@@ -85,6 +90,7 @@ exec /usr/libexec/xfce-polkit
exec nm-applet
exec blueman-applet
exec udiskie
exec flameshot
# Clipboard manager (Wayland-native)
exec wl-paste --type text --watch cliphist store
@@ -125,10 +131,13 @@ bindsym $mod+Shift+x exec ~/.config/sway/scripts/lockscreen
# Kill focused window
bindsym $mod+Shift+q kill
# Screenshot (xfce4-screenshooter via xdg-desktop-portal-wlr)
bindsym Print exec xfce4-screenshooter
bindsym Shift+Print exec xfce4-screenshooter -r
bindsym Alt+Print exec xfce4-screenshooter -w
# Screenshot
# Print → flameshot GUI (annotations, save + clipboard via portal)
# Shift+Print → grim+slurp region → clipboard
# Alt+Print → grim focused output → clipboard
bindsym Print exec flameshot gui --path "$HOME/Pictures/Screenshots" --clipboard
bindsym Shift+Print exec ~/.config/sway/scripts/screenshot region
bindsym Alt+Print exec ~/.config/sway/scripts/screenshot output
# Focus
bindsym $mod+$left focus left

View File

@@ -0,0 +1,40 @@
#!/bin/sh
# Quick screenshot helpers for sway. Captures via grim, saves to disk and
# also copies to the Wayland clipboard. Use the flameshot binding for
# annotations / fancy capture.
#
# Usage: screenshot {full|region|output|window}
set -eu
mode="${1:-full}"
dir="$HOME/Pictures/Screenshots"
mkdir -p "$dir"
file="$dir/$(date +%Y%m%d_%H%M%S).png"
case "$mode" in
full)
grim "$file"
;;
region)
grim -g "$(slurp)" "$file"
;;
output)
out=$(swaymsg -t get_outputs --raw \
| jq -r '.[] | select(.focused) | .name')
grim -o "$out" "$file"
;;
window)
geom=$(swaymsg -t get_tree \
| jq -r '.. | select(.focused? == true)
| "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"')
grim -g "$geom" "$file"
;;
*)
printf 'Usage: %s {full|region|output|window}\n' "$0" >&2
exit 1
;;
esac
wl-copy < "$file"
notify-send "Screenshot saved" "$file" -i image-x-generic >/dev/null 2>&1 || true