Author SHA1 Message Date
jozamudi 1e96b238a6 fix(shell): track the real ~/.bashrc and ~/.gitconfig
The repo copy of .bashrc was a stock Debian startup file that nothing on this
machine reads; the live one is the Arch-style file (interactive guard, color
aliases, vim->nvim, fzf init). Replace it with the live content and start
tracking .gitconfig (identity + nvim as editor/difftool).
2026-10-29 08:55:14 -07:00
jozamudi 4bb1c06883 feat(clipboard): add read-only clipboard-check diagnostic script
Lists selection owner/metadata via wl-paste -l to tell Firefox, kitty OSC 52
and wl-copy apart when a copy appears to do nothing. 'clipboard-check.sh test'
runs a 20s observation window. Never writes the clipboard or restarts anything.
Lives in scripts/ with ~/clipboard-check.sh symlinked in, matching the
existing scripts/ convention.
2026-10-29 08:55:14 -07:00
jozamudi bf87375356 chore(portal): mask xdg-desktop-portal-hyprland
Stays masked under sway: the default backend is gtk and ScreenCast/Screenshot
route to wlr, so the hyprland portal was ~35MB of never-used daemon. Committed
as a /dev/null symlink -- that IS the systemd mask mechanism, so a checkout
restores the mask without an extra enable/mask step. Verified afterwards that
the session still exposes every portal interface.
2026-10-29 08:45:28 -07:00
jozamudi 879ade5425 feat(input): clickfinger + tap on the PIXA3854 clickpad
Framework 13 Pro pad (PIXA3854:00 093A:1343). clickfinger so a two-finger press
is the right button anywhere instead of the bottom-right corner zone, and tap
enabled with the matching left/right/middle mapping.
2026-10-29 08:45:12 -07:00
jozamudi 26efcdc6ae fix(sway): pkill-guard hypridle under exec_always
`exec` re-runs on every config reload, so each `swaymsg reload` leaked a second
hypridle: duplicate suspend/lock timers and two processes fighting over the
logind sleep inhibitor. Same pattern already used for waybar and wl-paste.
2026-10-29 08:45:08 -07:00
jozamudi d770486d87 fix(power): stop forcing the TLP power-saver profile at login
`exec tlpctl power-saver` made tlp-pd apply the *_ON_SAV keys even on AC, so
platform_profile stayed low-power while docked and the battery tuning never
took effect on charger. tlp-pd's default 'balanced' profile already flips on
charger events. Profile writes are polkit-gated, so flips must be done from
the session (`tlpctl set balanced`), not via runuser/su.
2026-10-29 08:45:04 -07:00
jozamudi 085c2a7951 chore(clipboard): disable clipman history (AUR package removed)
clipman-git was uninstalled and has no pacman equivalent, so sway was spawning
ENOENT on `clipman` at every reload/launch. Commented out rather than deleted,
with the cliphist (extra/) port noted inline for when the keybinds come back.
2026-10-29 08:44:56 -07:00
jozamudi 8d93ac7e2f feat(idle): suspend after 10 min of lid-open idle
The panel powered off at 330s but nothing ever suspended, so a lid-open idle
laptop kept drawing 6-7W indefinitely; only lid *close* suspended (logind's
default HandleLidSwitch). logind IdleAction stays Ignore on purpose -- it
cannot run swaymsg/hyprlock hooks, hypridle's before_sleep_cmd can.
Plain suspend, not suspend-then-hibernate: swap is zram-only.
2026-10-29 08:44:53 -07:00
jozamudi 77470bd03e fix(portal): screen-capture script, portal backend, swaync autostart
screen-capture.sh was a single non-executable line containing a `slur` typo,
so it never ran and nothing referenced it; rewritten as a working region
capture to ~/Pictures plus clipboard.

xdg-desktop-portal/portals.conf pins the wlr backend for sway, and swaync is
pulled in via graphical-session.target.wants so the portal's
Requisite=graphical-session.target is satisfied (the reason screen sharing
previously never started).
2026-10-27 18:32:33 -07:00
jozamudi b08cd84158 fix(sway): visible focus ring, floating modifier, volume binds
swayfx: with `border pixel` the visible line is child_border, not `border`
(which only paints title bars). Focused child_border was $base00 = black on
black, i.e. invisible; both are now the same gray.

keybinds: restore `floating_modifier $mod normal` (was `none`) and drop the
`pkill -RTMIN+10 i3blocks` tail from the volume binds -- i3blocks is not in
use, waybar is.

windows: drop a stray trailing semicolon; waybar: remove the unused
sway/submap module.
2026-10-27 18:32:33 -07:00
13 changed files with 245 additions and 146 deletions

No files matched your search

+5 -122
View File
@@ -1,130 +1,13 @@
# ~/.bashrc: executed by bash(1) for non-login shells. #
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # ~/.bashrc
# for examples #
# If not running interactively, don't do anything # If not running interactively, don't do anything
case $- in [[ $- != *i* ]] && return
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
source ~/.local/scripts/git-prompt.sh
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 " (%s)") \n\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto' alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto' alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
PATH=$PATH:~/.local/bin/
export WLR_DRM_NO_MODIFIERS=1
alias vim='nvim' alias vim='nvim'
alias ssh='ssh -XC' PS1='[\u@\h \W]\$ '
alias xfreerdp='xfreerdp +clipboard /dynamic-resolution '
# Set up fzf key bindings and fuzzy completion
eval "$(fzf --bash)" eval "$(fzf --bash)"
+15
View File
@@ -46,3 +46,18 @@ listener {
on-timeout = swaymsg "output * power off" on-timeout = swaymsg "output * power off"
on-resume = swaymsg "output * power on" && brightnessctl -r on-resume = swaymsg "output * power on" && brightnessctl -r
} }
# 10min -> s2idle. This listener used to be missing entirely: the panel powered
# off at 330s but the machine never suspended, so a lid-open idle laptop kept
# draining ~6-7W (10h battery) forever. Closing the lid did suspend, because
# logind's default HandleLidSwitch=suspend -- but only the lid path.
# logind's own IdleAction stays Ignore on purpose (it cannot run swaymsg/hyprlock
# pre-sleep hooks; hypridle's before_sleep_cmd can).
# 600s = long enough that a compile/syncthing burst usually finishes; a suspend
# mid-task is recoverable, and before_sleep_cmd locks on resume.
# Verified: polkit org.freedesktop.login1.suspend allow_active=yes, so this
# needs no auth prompt from an active local session. Plain suspend (not
# suspend-then-hibernate) because swap is zram-only -> hibernate impossible.
listener {
timeout = 600 # 10min -> suspend
on-timeout = systemctl suspend
}
+42 -9
View File
@@ -49,6 +49,16 @@ exec_always --no-startup-id /home/work/.config/sway/scripts/shikane-recover-on-r
# middle_emulation enabled # middle_emulation enabled
#} #}
# Touchpad (PIXA3854:00 093A:1343, clickpad): clickfinger so a two-finger press
# is a right click instead of using the bottom-right button area.
# Tap-to-click mirrors the same 1/2/3-finger lrm mapping.
input type:touchpad {
click_method clickfinger
clickfinger_button_map lrm
tap enabled
tap_button_map lrm
}
### Idle configuration ### Idle configuration
#exec swayidle -w \ #exec swayidle -w \
# timeout 300 'swaylock -f -c 000000' \ # timeout 300 'swaylock -f -c 000000' \
@@ -71,7 +81,10 @@ exec systemctl --user start xdg-desktop-portal-wlr.service
exec_always --no-startup-id "pkill -x waybar; waybar -c ~/.config/sway/waybar/config.jsonc -s ~/.config/sway/waybar/style.css" exec_always --no-startup-id "pkill -x waybar; waybar -c ~/.config/sway/waybar/config.jsonc -s ~/.config/sway/waybar/style.css"
exec nm-applet exec nm-applet
exec blueman-applet exec blueman-applet
exec hypridle # Guarded with pkill because `exec`/`exec_always` re-runs on every sway config
# reload: a second hypridle instance would double-fire every listener (two
# suspend timers, two lock screens) and fight over the sleep inhibitor.
exec_always --no-startup-id "pkill -x hypridle; sleep 0.3; hypridle >/dev/null 2>&1 &"
# hyprlock can outlive a sway session; a stale instance then makes hypridle's # hyprlock can outlive a sway session; a stale instance then makes hypridle's
# "pidof hyprlock || hyprlock" guard a permanent no-op. Clear leftovers at login. # "pidof hyprlock || hyprlock" guard a permanent no-op. Clear leftovers at login.
exec --no-startup-id pkill -x hyprlock exec --no-startup-id pkill -x hyprlock
@@ -87,7 +100,16 @@ exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec flatpak run com.github.wwmm.easyeffects -w exec flatpak run com.github.wwmm.easyeffects -w
exec xrdb -merge ~/.Xresources exec xrdb -merge ~/.Xresources
exec tlpctl power-saver # Removed 2026-10-27 (power audit): forcing the power-saver profile made TLP apply
# *_ON_SAV keys even on AC, so the platform profile stayed low-power when docked and
# the *_ON_BAT tuning in /etc/tlp.d/90-framework.conf never ran. tlp-pd's default
# 'balanced' profile already switches on charger events -- no script needed.
# # Removed 2026-10-28 (power audit): forcing power-saver made TLP apply *_ON_SAV
# keys even on AC, so the docked platform profile stayed low-power and the
# *_ON_BAT tuning never ran. tlp-pd's 'balanced' profile switches on charger
# events by itself. NOTE: profile writes are polkit-gated -- flip manually with
# tlpctl set balanced (from the desktop session, not via runuser/su).
# exec tlpctl power-saver
#exec gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" #exec gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
@@ -109,16 +131,27 @@ exec tlpctl power-saver
# sway runs exec lines through `sh -c`, so the wrapper's own command line # sway runs exec lines through `sh -c`, so the wrapper's own command line
# contains the pattern and pkill would kill the shell that is about to start # contains the pattern and pkill would kill the shell that is about to start
# the replacements (learned the hard way). # the replacements (learned the hard way).
exec_always --no-startup-id "pkill -x wl-paste; sleep 0.3; \ # [aur-cleanup 2026-10-28] clipman-git uninstalled -- AUR-only, no pacman equivalent.
wl-paste -t text --watch clipman store & \ # Disabled so sway doesn't spawn ENOENT on the missing `clipman` binary.
wl-paste -p -t text --watch clipman store & \ # Restore by reinstalling clipman-git, or port to extra/cliphist:
wait" # exec_always --no-startup-id "pkill -x wl-paste; sleep 0.3; \
# wl-paste -t text --watch cliphist store & \
# wl-paste -p -t text --watch cliphist store & \
# wait"
# bindsym $mod+y exec sh -c 'cliphist list | wofi --dmenu | cliphist decode | wl-copy'
# bindsym $mod+Shift+y exec cliphist wipe
# (verify flag order with `cliphist -h`; -p selects the primary buffer)
#
# exec_always --no-startup-id "pkill -x wl-paste; sleep 0.3; \
# wl-paste -t text --watch clipman store & \
# wl-paste -p -t text --watch clipman store & \
# wait"
# The keybind to select a clipping # The keybind to select a clipping
bindsym $mod+y exec clipman --primary pick --tool wofi # bindsym $mod+y exec clipman --primary pick --tool wofi
# Clear all clippings # Clear all clippings
bindsym $mod+Shift+y exec clipman clear -a # bindsym $mod+Shift+y exec clipman clear -a
# Remove a selected clipping # Remove a selected clipping
bindsym $mod+Mod1+y exec clipman clear --tool wofi # bindsym $mod+Mod1+y exec clipman clear --tool wofi
# Empty the current clipping # Empty the current clipping
bindsym $mod+Ctrl+y exec : | wl-copy -p bindsym $mod+Ctrl+y exec : | wl-copy -p
+5 -8
View File
@@ -14,8 +14,8 @@ bindsym $mod+d exec $menu
# Change normal to inverse to use left mouse button for resizing and right # Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging. # mouse button for dragging.
# DISABLED 2026-09-28: experiment for windows popping out (accidental mod+click) # DISABLED 2026-09-28: experiment for windows popping out (accidental mod+click)
#floating_modifier $mod normal floating_modifier $mod normal
floating_modifier none #floating_modifier none
# Reload the configuration file # Reload the configuration file
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
@@ -128,14 +128,11 @@ bindsym $mod+bracketright exec playerctl next
bindsym $mod+backslash exec playerctl play-pause bindsym $mod+backslash exec playerctl play-pause
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% \ bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
&& pkill -RTMIN+10 i3blocks;
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% \ bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
&& pkill -RTMIN+10 i3blocks;
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle \ bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
&& pkill -RTMIN+10 i3blocks;
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
+19 -3
View File
@@ -41,6 +41,22 @@ set $base0F #666666
# base00-02=bg #3E3B33, base03=olive #8C9A6B, base04=peach #F3B49F, base05=rust #D9714C, base06-07=cream #FFE8DB # base00-02=bg #3E3B33, base03=olive #8C9A6B, base04=peach #F3B49F, base05=rust #D9714C, base06-07=cream #FFE8DB
# ╔══════════════════════════════════════════════════════════════════╗
# ║ FOCUS RING (subtle gray ramp) ║
# ║ ║
# ║ With `border pixel` the line you actually see around a window is ║
# ║ child_border (5th color). `border` (1st) only paints title bars, ║
# ║ which pixel borders don't have -- so both are set to the same ║
# ║ gray here. Previously child_border for focused windows was ║
# ║ $base00 (#000000) = invisible on a black background, which is ║
# ║ why the focused window was hard to spot. ║
# ║ ║
# ║ Tune: lighter = easier to spot, darker = less obvious. ║
# ╚══════════════════════════════════════════════════════════════════╝
set $border_focus #252525
set $border_inactive #171717
set $border_unfocused #0D0D0D
#set $base00 #000000 #set $base00 #000000
#set $base01 #121212 #set $base01 #121212
#set $base02 #222222 #set $base02 #222222
@@ -59,9 +75,9 @@ set $base0F #666666
#set $base0F #444444 #set $base0F #444444
# Property Name Border BG Text Indicator Child Border # Property Name Border BG Text Indicator Child Border
client.focused #FFFFFF $base00 #FFFFFF #FFFFFF $base00 client.focused $border_focus $base00 $base07 $border_focus $border_focus
client.focused_inactive $base02 $base00 $base05 $base03 $base02 client.focused_inactive $border_inactive $base00 $base05 $border_inactive $border_inactive
client.unfocused $base01 $base00 $base05 $base03 $base01 client.unfocused $border_unfocused $base00 $base05 $border_unfocused $border_unfocused
client.urgent #FFA14C #FFA14C $base00 #FFA14C #FFA14C client.urgent #FFA14C #FFA14C $base00 #FFA14C #FFA14C
client.placeholder $base00 $base00 $base05 $base00 $base00 client.placeholder $base00 $base00 $base05 $base00 $base00
client.background $base00 client.background $base00
+1 -1
View File
@@ -1,5 +1,5 @@
# Generated windows. # Generated windows.
for_window [title="(?:Open|Save) (?:File|Folder|As)"] floating enable; for_window [title="(?:Open|Save) (?:File|Folder|As)"] floating enable
for_window [title="(?:Open|Save) (?:File|Folder|As)"] resize set 800 600 for_window [title="(?:Open|Save) (?:File|Folder|As)"] resize set 800 600
for_window [window_role="pop-up"] floating enable for_window [window_role="pop-up"] floating enable
for_window [window_role="bubble"] floating enable for_window [window_role="bubble"] floating enable
+32 -2
View File
@@ -1,3 +1,33 @@
#!/bin/bash #!/bin/sh
# Region screenshot -> ~/Pictures + clipboard.
#
# This file used to contain a single broken line (`slur`, and it was not
# executable): the typo meant `slurp` never ran, and nothing referenced it
# anyway -- the $mod+shift+p keybind in config.d/keybinds has its own inline
# pipeline. Fixed and kept as the shared implementation so the behaviour is
# identical wherever it gets wired up.
#
# Usage: screen-capture.sh [region|output|full] (default: region)
# (no "window" mode: slurp offers region, `-o` output and `-p` point selection
# only -- it cannot pick a window)
slur set -u
outdir="${XDG_PICTURES_DIR:-$HOME/Pictures}"
mkdir -p "$outdir"
file="$outdir/$(date +%F-%H%M%S).png"
case "${1:-region}" in
region) geom=$(slurp) || exit 1 # Esc cancels
[ -n "$geom" ] || exit 1
grim -g "$geom" "$file" ;;
output) geom=$(slurp -o -f '%g') || exit 1 # pick a monitor
[ -n "$geom" ] || exit 1
grim -g "$geom" "$file" ;;
full) grim "$file" ;;
*) echo "usage: $(basename "$0") [region|output|full]" >&2; exit 2 ;;
esac
[ -s "$file" ] || { echo "capture failed" >&2; exit 1; }
wl-copy < "$file"
notify-send -i "$file" "Screenshot saved" "$file"
-1
View File
@@ -3,7 +3,6 @@
"spacing": 2, // Gaps between modules (4px) "spacing": 2, // Gaps between modules (4px)
"modules-left": [ "modules-left": [
"sway/workspaces", "sway/workspaces",
"sway/submap",
"sway/scratchpad", "sway/scratchpad",
"sway/window" "sway/window"
], ],
@@ -0,0 +1 @@
/usr/lib/systemd/user/swaync.service
@@ -0,0 +1 @@
/dev/null
+22
View File
@@ -0,0 +1,22 @@
# Portal implementation pinning for the SWAY session.
#
# Without this file xdg-desktop-portal fell back to the deprecated `UseIn` key
# and picked hyprland.portal at random ("Choosing hyprland.portal ... via the
# deprecated UseIn key"), while the sway config also started the wlr portal --
# two implementations registered at once.
#
# Base is Arch's own /usr/share/xdg-desktop-portal/sway-portals.conf.
# GlobalShortcuts is added because neither wlr nor gtk implements it, and
# easyeffects requests it (journal: "Unknown method CreateSession or interface
# org.freedesktop.impl.portal.GlobalShortcuts").
[preferred]
default=gtk
org.freedesktop.impl.portal.ScreenCast=wlr
org.freedesktop.impl.portal.Screenshot=wlr
# gtk's Inhibit uses org.gnome.SessionManager / org.freedesktop.ScreenSaver,
# neither of which sway implements; "none" lets apps use Wayland's
# idle-inhibit protocol, which sway does implement.
org.freedesktop.impl.portal.Inhibit=none
org.freedesktop.impl.portal.GlobalShortcuts=hyprland
org.freedesktop.impl.portal.InputCapture=hyprland
+7
View File
@@ -0,0 +1,7 @@
[user]
email = [email protected]
name = Josue Zamudio
[diff]
tool = nvimdiff
[core]
editor = nvim
+95
View File
@@ -0,0 +1,95 @@
#!/usr/bin/env bash
# clipboard-check.sh -- diagnose "copy did nothing" on sway/Wayland.
# READ-ONLY: lists selection metadata and reads text; never writes the clipboard,
# never runs wl-copy, never restarts anything.
# ./clipboard-check.sh -> status (what is configured right now)
# ./clipboard-check.sh test -> 20s window: copy in Firefox, then tell me who failed
set -uo pipefail
own_sig() { # identify the owner from its advertised type list
local t
t=$(wl-paste -l 2>&1); [[ -z "$t" ]] && { echo "(clipboard empty / no owner)"; return; }
case "$t" in
*x-moz-url-priv*|*text/html*) echo "Firefox (has moz/html types)" ;;
*glfw+clipboard*) echo "kitty/GLFW terminal (OSC 52 or copy_on_select)" ;;
*image/png*) echo "image (screenshot? wl-copy -b)" ;;
*) echo "some other client: $(echo "$t" | tr '\n' ' ')" ;;
esac
}
if [[ "${1:-status}" == test ]]; then
echo "BEFORE owner: $(own_sig)"
echo
echo " >> Copy some text in Firefox NOW (Ctrl+C), then press Enter."
read -r _
echo "AFTER owner: $(own_sig)"
echo
if wl-paste -l >/dev/null 2>&1; then
n=$(wl-paste 2>/dev/null | wc -c)
echo " text available: $n byte(s)"
[[ $n -gt 0 ]] && echo " preview: $(wl-paste 2>/dev/null | head -c 70 | tr '\n' ' ')"
echo
echo " VERDICT: the compositor HAS the copy -> the loss is on the paste side"
echo " (stale PRIMARY for middle-click, or a clipboard-history keybind"
echo " that no longer exists since clipman was removed)."
else
echo " VERDICT: the compositor has NOTHING -> Firefox never took ownership."
echo " Usual causes, in order of likelihood:"
echo " 1) Firefox lacked keyboard focus at Ctrl+C -- Wayland only"
echo " accepts set_selection from the focused surface (a PiP window,"
echo " a toast, or a workspace switch stealing focus is enough)."
echo " 2) The page's own JS intercepted the copy event (sites that"
echo " block copying). dom.event.clipboardevents.enabled=true by"
echo " default, so page scripts may do this."
echo " 3) The offer got cancelled mid-transfer ('selection cancelled'"
echo " in sway's log) -- see: journalctl -b | grep 'selection cancelled'"
fi
exit 0
fi
echo "== components =="
printf ' %-22s %s\n' "sway" "$(swaymsg --version 2>&1 | head -1)"
printf ' %-22s %s\n' "wl-clipboard" "$(wl-copy --version 2>&1 | head -1)"
printf ' %-22s %s\n' "firefox" "$(firefox --version 2>&1 | head -1) [$(pacman -Q firefox 2>/dev/null || echo '?')]"
printf ' %-22s %s\n' "cliphist" "$(command -v cliphist || echo 'NOT INSTALLED (history keybinds are dead)')"
echo
echo "== clipboard managers / watchers (a watcher that dies mid-copy LOSES the copy) =="
m=$(pgrep -af 'wl-paste|cliphist|clipman|copyq|klipper|parcellite|flameshot' 2>/dev/null || true)
[[ -n "$m" ]] && echo "$m" | sed 's/^/ RUNNING /' || echo " none running <- no history is being saved, but also nothing can steal a copy"
echo
echo "== XWayland mixing (X11<->Wayland clipboard skew is a classic cause) =="
if pgrep -x Xwayland >/dev/null 2>&1; then
echo " Xwayland IS running -> any X11 app can own the selection out-of-band:"
pgrep -a Xwayland | sed 's/^/ /'
else
echo " no Xwayland -> pure Wayland, that whole failure class is ruled out"
fi
echo
echo "== window shells (a copy from an X11-surfaced Firefox behaves differently) =="
swaymsg -t get_tree 2>/dev/null | python3 -c "
import json,sys
def walk(n):
yield n
for k in ('nodes','floating_nodes'):
for c in n.get(k) or []: yield from walk(c)
for n in walk(json.load(sys.stdin)):
if n.get('pid') and n.get('type') in ('con','floating_con'):
shell = 'x11' if n.get('window') is not None else 'wayland'
wp = n.get('window_properties') or {}
ident = str(n.get('app_id') or wp.get('class'))[:24]
print(' %-8s %-26s %s' % (shell, ident, (n.get('name') or '')[:38]))
" 2>&1 | sort -u | head -12
echo
echo "== current selections (read-only) =="
printf ' CLIPBOARD owner : %s\n' "$(own_sig)"
printf ' PRIMARY types : %s\n' "$(wl-paste -p -l 2>&1 | tr '\n' ' ' | cut -c1-100)"
echo
echo "== Firefox clipboard prefs (blank = default) =="
P=$(ls ~/.mozilla/firefox/*/prefs.js 2>/dev/null | head -1)
grep -hE 'dom\.event\.clipboardevents|middlepaste|widget\.wayland' "$P" 2>/dev/null | sed 's/^/ /' || true
grep -hE 'user_pref' "$(dirname "$P")/user.js" 2>/dev/null | grep -iE 'clipboard|wayland' | sed 's/^/ user.js: /' || true
echo
echo "== past cancellations sway logged (each one = a copy that vanished) =="
journalctl -b 0 --no-pager 2>/dev/null | grep -ic 'selection cancelled' | sed 's/^/ '\''selection cancelled'\'' events this boot: /'
echo
echo "Run '$0 test' to A/B an actual Firefox copy."