4 Commits
Author SHA1 Message Date
jozamudi 35e64fc0cc fix(swaylock): rewrite for vanilla swaylock 1.8.6
The previous file used swaylock-EFFECTS options, which the packaged swaylock
ignores. Documents that swaylock reads $XDG_CONFIG_HOME/swaylock/config on
every invocation, including hypridle's before_sleep_cmd and the $mod+m
keybind.
2026-10-27 18:32:33 -07:00
jozamudi d1bd6aae48 fix(shikane): detect silent deadlocks; re-apply profile on sway reload
watchdog: covers both observed deadlock flavours -- the loud one that repeats
"Received invalid input AtomicChangeDone at state Discarded", and the silent
one that logs nothing and just never leaves VariantInProgress.

shikane-recover-on-reload.sh (new, previously referenced by sway/config but
never committed): shikanectl reload -> sleep 2 -> watchdog check, falling
back to a service restart when reload cannot recover.

clamshell-mode.sh: documents why the laptop panel is no longer enabled
unconditionally on lid-open, which raced shikane's "External Display" profile
(eDP-1 disabled by design) and produced "Atomic commit failed: Device or
resource busy" churn.
2026-10-27 18:32:33 -07:00
jozamudi 0ceec0b4ab fix(sway): only force a post-resume modeset when the stall is actually present
recover-output-after-resume.sh existed to work around the old ThinkPad's
/etc/modprobe.d/i915.conf, which forced PSR2 and the deepest display
C-states; the flip pending across suspend never completed, so every later
commit returned EBUSY and only a full modeset cleared it.

That file is gone and this laptop's iGPU is driven by `xe` (Panther Lake has
no i915 support at all), so the original cause cannot recur. The modeset is
now conditional on the user journal actually reporting "Atomic commit
failed"/"Page-flip failed" within the last 3 minutes.

Unconditional disable/enable + `shikanectl reload` on every resume was itself
a hazard: it is the exact sequence that re-triggers the shikane
VariantInProgress deadlock the watchdog exists to recover from.

hypridle.conf's comment no longer references the deleted i915.conf.
2026-10-27 18:32:33 -07:00
jozamudi 078f9acf71 fix(display): target the Framework 13 Pro panel
Migration from the ThinkPad X1 Carbon (2880x1800) to the Framework Laptop
13 Pro, whose panel is CSOT MND508ZB1-1 = 2880x1920 3:2 @120Hz and exposes
only 2880x1920@120000Hz / @60000Hz.

shikane was requesting [email protected], a mode this panel cannot provide,
so the variant could never be satisfied: it sat in NoVariantApplied for the
whole session, with 61 historical "Discarded" events. Both profiles now use
2880x1920@120Hz (including the disabled eDP-1 block, whose mode string still
has to resolve). Verified: profile now reaches VariantApplied.

Scale is 1.75 -> 1645x1097 logical, ~147 effective DPI, chosen to reproduce
the ~145 DPI of the old panel at 1.67. 1.75 is exactly representable as
float32, which sway stores scale in; 1.6 and 1.67 are not. 2.0 would be the
only integer (1:1, unresampled) scale but yields just 1440x960 logical.

The .config/sway/config hunk also adds the matching `output $laptop` baseline
so sway does not start at scale 2.0 and re-flow when shikane applies 1.75,
and carries previously-uncommitted session wiring for the scripts below.

shikane's config.toml was previously unversioned; it now lives in this repo
and ~/.config/shikane is a symlink, matching the existing convention.
2026-10-27 18:32:21 -07:00
8 changed files with 280 additions and 49 deletions

No files matched your search

+34 -20
View File
@@ -1,34 +1,48 @@
# Idle / lock for SWAY (wlroots), not Hyprland.
#
# Two things in the original Hyprland template silently did nothing under sway:
# * `loginctl lock-session` -> sway implements no freedesktop login1 Session
# Lock protocol, so it is a no-op. Lock directly.
# * `hyprctl dispatch dpms` -> "HYPRLAND_INSTANCE_SIGNATURE not set!".
# Use `swaymsg "output * power on|off"`.
# Also: a hyprlock instance can outlive a sway session and then make the
# `pidof hyprlock || hyprlock` guard a permanent no-op; the sway config kills
# leftovers at login (`exec --no-startup-id pkill -x hyprlock`).
general { general {
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances. lock_cmd = pidof hyprlock || hyprlock
before_sleep_cmd = loginctl lock-session # lock before suspend. # pre-suspend uses swaylock: fast, sway-native, exits cleanly (no leak)
after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display. before_sleep_cmd = swaylock -f -c 000000
# DPMS "power on" alone does not clear a post-resume eDP page-flip stall
# ("Atomic commit failed: Device or resource busy" for tens of minutes).
# The script does a full disable/enable (forced modeset) but ONLY when the
# journal actually shows the stall -- it used to fire unconditionally, which
# risked the shikane VariantInProgress deadlock on healthy resumes. The
# original i915 PSR2/DC4 cause is gone; this laptop uses the `xe` driver.
# Lid-aware so it does not race shikane's "External Display" profile.
after_sleep_cmd = /home/work/.config/sway/scripts/recover-output-after-resume.sh
} }
listener { listener {
timeout = 150 # 2.5min. timeout = 150 # 2.5min
on-timeout = brightnessctl -s set 10 # set monitor backlight to minimum, avoid 0 on OLED monitor. on-timeout = brightnessctl -s set 10
on-resume = brightnessctl -r # monitor backlight restore. on-resume = brightnessctl -r
} }
# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight. # keyboard backlight
listener { listener {
timeout = 150 # 2.5min. timeout = 150
on-timeout = brightnessctl -sd rgb:kbd_backlight set 0 # turn off keyboard backlight. on-timeout = brightnessctl -sd rgb:kbd_backlight set 0
on-resume = brightnessctl -rd rgb:kbd_backlight # turn on keyboard backlight. on-resume = brightnessctl -rd rgb:kbd_backlight
} }
listener { listener {
timeout = 300 # 5min timeout = 300 # 5min -> lock
on-timeout = loginctl lock-session # lock screen when timeout has passed on-timeout = pidof hyprlock || hyprlock
} }
listener { listener {
timeout = 330 # 5.5min timeout = 330 # 5.5min -> output power off
on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed on-timeout = swaymsg "output * power off"
on-resume = hyprctl dispatch dpms on && brightnessctl -r # screen on when activity is detected after timeout has fired. on-resume = swaymsg "output * power on" && brightnessctl -r
}
listener {
timeout = 1800 # 30min
on-timeout = systemctl suspend # suspend pc
} }
+47
View File
@@ -0,0 +1,47 @@
[[profile]]
name = "laptop"
exec = ["notify-send shikane \"Profile $SHIKANE_PROFILE_NAME has been applied\""]
[[profile.output]]
enable = true
search = "eDP-1"
# Panel on the Framework Laptop 13 Pro is CSOT MND508ZB1-1 = 2880x1920 (3:2)
# @120Hz. /sys/class/drm/card0-eDP-1/modes exposes ONLY 2880x1920@120000Hz
# and @60000Hz. The previous value here, [email protected], was the OLD
# ThinkPad's panel mode and does not exist on this panel, so shikane could
# never satisfy the variant -- the most likely root cause of the
# VariantInProgress deadlocks.
mode = "2880x1920@120Hz"
position = "0,0"
# Scale 1.75 chosen deliberately (2026-10-27).
# Panel: CSOT MND508ZB1-1, 2880x1920 on 13.5in = 256 PPI. What matters is
# effective DPI = PPI/scale; 1.75 -> 147 DPI, which matches the 145 DPI this
# laptop's owner previously used on the old ThinkPad (2880x1800 on 14in at
# 1.67). The exact equivalent would be 1.765; 1.75 is the nearest value that
# is exactly representable as float32 (sway stores scale as float).
# 2.0 is the only integer scale (1:1 pixel mapping, no resampling, sharpest)
# but gives just 1440x960 logical. 1.5 = max workspace at 171 DPI (small).
# History: 1.67/1.5/1.6 all tried; 1.6 was not float-exact (1.600000024).
scale = 1.75
transform = "normal"
adaptive_sync = false
[[profile]]
name = "External Display"
exec = ["notify-send shikane \"Profile $SHIKANE_PROFILE_NAME has been applied\""]
[[profile.output]]
enable = false
search = "eDP-1"
# Even a disabled block carries a mode string that shikane must resolve
# against the panel's mode list, so keep it valid.
mode = "2880x1920@120Hz"
position = "0,0"
scale = 1.75
transform = "normal"
adaptive_sync = false
[[profile.output]]
enable = true
search = "n/DP-(.*)"
scale = 1.3
transform = "normal"
adaptive_sync = false
+44 -12
View File
@@ -28,15 +28,20 @@ include ~/.config/sway/config.d/*
# You can get the names of your outputs by running: swaymsg -t get_outputs # You can get the names of your outputs by running: swaymsg -t get_outputs
# https://gitlab.com/w0lff/shikane for multitple display handling # https://gitlab.com/w0lff/shikane for multitple display handling
#output * bg /home/jozamudi/Documents/Wallpapers/windows-11-stock-official-colorful-3840x2160-5658.jpg fill #output * bg /home/jozamudi/Documents/Wallpapers/windows-11-stock-official-colorful-3840x2160-5658.jpg fill
#output eDP-1 scale 1.7
#output 'BNQ BenQ PD3200U S2N01233019' scale 1.5 #output 'BNQ BenQ PD3200U S2N01233019' scale 1.5
# Baseline for the built-in panel so sway starts at the same geometry shikane
# will apply. Panel is CSOT MND508ZB1-1: 2880x1920 (3:2) with only 120Hz/60Hz
# modes available. Without this, sway defaults to scale 2.0 and the desktop
# visibly re-flows when shikane applies 1.5 a moment after login.
output $laptop mode 2880x1920@120Hz scale 1.75
#exec_always shikanectl reload #exec_always shikanectl reload
bindswitch --reload --locked lid:on output $laptop disable bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable bindswitch --reload --locked lid:off output $laptop enable
exec_always --no-startup-id '/home/work/.config/sway/scripts/clamshell-mode.sh' exec_always --no-startup-id '/home/work/.config/sway/scripts/clamshell-mode.sh'
# Re-apply shikane display profile (scaling) after every sway reload # Re-apply shikane display profile after every sway reload;
exec_always --no-startup-id shikanectl reload # falls back to a service restart if the daemon deadlocked
exec_always --no-startup-id /home/work/.config/sway/scripts/shikane-recover-on-reload.sh
#input "1267:12792:ELAN067B:00_04F3:31F8_Touchpad" { #input "1267:12792:ELAN067B:00_04F3:31F8_Touchpad" {
# dwt enabled # dwt enabled
@@ -54,18 +59,33 @@ exec_always --no-startup-id shikanectl reload
seat seat0 xcursor_theme Adwaita 35 seat seat0 xcursor_theme Adwaita 35
# Portal implementations are pinned in ~/.config/xdg-desktop-portal/portals.conf
# (default=gtk, ScreenCast/Screenshot=wlr, Inhibit=none, GlobalShortcuts=hyprland).
exec systemctl --user start xdg-desktop-portal-wlr.service exec systemctl --user start xdg-desktop-portal-wlr.service
#exec pipewire #exec pipewire
exec swaync # swaync is started by its systemd user unit / D-Bus activation; starting it
exec_always --no-startup-id pkill -x waybar; waybar -c ~/.config/sway/waybar/config.jsonc -s ~/.config/sway/waybar/style.css # here too caused "already running" crash-loops (start-limit-hit).
#exec swaync
# NOTE: the command must be quoted -- sway splits unquoted ';' into separate
# sway commands and fails with "Unknown/invalid command 'waybar'"
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 exec hypridle
# 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.
exec --no-startup-id pkill -x hyprlock
exec systemctl --user start hyperolkitagent # Polkit authentication agent.
# The original line was a typo ("hyperolkitagent"), so no agent ever started.
# hyprpolkitagent is installed but aborts on this machine: hyprtoolkit vendors
# aquamarine, which refuses to create a GBM allocator because the Intel Iris Xe
# iGPU has no PRIME export (drmGetCap DRM_CAP_PRIME -> unsupported) and then
# asserts "Couldn't open a gbm fd" instead of falling back -- 5/5 core dumps.
# Keep hyprpolkitagent.service disabled; polkit-gnome is used instead.
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 wl-paste -t text --watch clipman store --no-persist
exec tlpctl power-saver exec tlpctl power-saver
@@ -74,13 +94,25 @@ exec tlpctl power-saver
#exec mpd #exec mpd
#exec syncthing #exec syncthing
# Auto start .desktop files using dex # Auto start .desktop files using dex -- dex is not installed (and there is no
exec dex -a # ~/.config/autostart), so this was a no-op.
#exec dex -a
#exec wl-paste -t text --watch clipman store --no-persist #exec wl-paste -t text --watch clipman store --no-persist
# There are two wl-paste processes running, one for the primary and one for the normal clipboard # There are two wl-paste watchers on purpose: one for the regular clipboard,
exec wl-paste -t text --watch clipman store # one for the primary selection (clipman keeps a single shared history, the
exec wl-paste -p -t text --watch clipman store # --primary flag on `pick` only decides where the picked item is served).
# Guarded with pkill because `exec` re-runs on every `swaymsg reload`: a stale
# `store --no-persist` instance from an older config survived three reloads and
# ran alongside the current pair.
# NOTE: `pkill -x` matches the process *name* only. Do NOT use `pkill -f` here --
# 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
# the replacements (learned the hard way).
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
+9 -1
View File
@@ -1,4 +1,12 @@
#!/bin/sh #!/bin/sh
# Lid-driven laptop panel handling.
#
# shikane is authoritative for output layout/scaling
# (~/.config/shikane/config.toml + shikane-watchdog.timer). This script used to
# run `swaymsg output eDP-1 enable` whenever the lid was open, which on every
# `swaymsg reload` raced the shikane "External Display" profile (eDP-1 off) and
# contributed to "Atomic commit failed: Device or resource busy" churn.
# It now only ever disables.
LAPTOP_OUTPUT="eDP-1" LAPTOP_OUTPUT="eDP-1"
LID_STATE_FILE="/proc/acpi/button/lid/LID/state" LID_STATE_FILE="/proc/acpi/button/lid/LID/state"
@@ -6,7 +14,7 @@ LID_STATE_FILE="/proc/acpi/button/lid/LID/state"
read -r LS < "$LID_STATE_FILE" read -r LS < "$LID_STATE_FILE"
case "$LS" in case "$LS" in
*open) swaymsg output "$LAPTOP_OUTPUT" enable ;;
*closed) swaymsg output "$LAPTOP_OUTPUT" disable ;; *closed) swaymsg output "$LAPTOP_OUTPUT" disable ;;
*open) : ;; # leave to shikane
*) echo "Could not get lid state" >&2 ; exit 1 ;; *) echo "Could not get lid state" >&2 ; exit 1 ;;
esac esac
+60
View File
@@ -0,0 +1,60 @@
#!/bin/sh
# recover-output-after-resume -- clear a post-resume eDP page-flip stall.
#
# Symptom (see journalctl --user --since -5m | grep 'Atomic commit failed'):
# [wlr] backend/drm/atomic.c:82 connector eDP-1: Atomic commit failed:
# Device or resource busy
# [sway] desktop/output.c:307 Page-flip failed on output eDP-1
# ...repeatedly for tens of minutes after a resume.
#
# HISTORY: this was originally a workaround for the old ThinkPad's
# /etc/modprobe.d/i915.conf, which forced PSR2 and the deepest display C-states
# (options i915 enable_guc=3 enable_psr=2 enable_dc=4 enable_rc6=1 -- both of
# which taint the kernel). With PSR2 forced on, the flip pending across suspend
# never completed, so every later commit returned EBUSY, and DPMS "power on"
# alone did not clear it -- only a full modeset did.
#
# STATUS: that file is gone. This machine is a Framework Laptop 13 Pro whose
# iGPU is driven by `xe` (Panther Lake has no i915 support at all), so the
# original cause cannot recur. The modeset below is therefore CONDITIONAL and
# only fires when the stall is actually present in the journal.
#
# Why conditional: an unconditional disable/enable plus `shikanectl reload`
# after every resume is exactly the sequence that re-triggers the shikane
# 1.1.1 VariantInProgress deadlock (see shikane-watchdog.sh). No point paying
# that risk on resumes that are already healthy.
#
# Lid-aware on purpose: a blind `output eDP-1 enable` raced shikane's
# "External Display" profile (which keeps eDP-1 off) and caused
# "Atomic commit failed: Device or resource busy" churn in clamshell mode.
# See the note in clamshell-mode.sh.
set -u
LID_STATE="${LID_STATE:-/proc/acpi/button/lid/LID/state}"
OUTPUT="${OUTPUT:-eDP-1}"
# Always undo the idle DPMS-off first (this is what after_sleep_cmd used to do).
swaymsg "output * power on" 2>/dev/null
# Only escalate to a modeset if the page-flip stall is actually being reported.
# sway runs inside the user session, so its stderr is in the user journal.
if command -v journalctl >/dev/null 2>&1; then
if ! journalctl --user --since '-3 min' --no-pager 2>/dev/null \
| grep -qE 'Atomic commit failed|Page-flip failed on output'; then
exit 0 # healthy resume -> do not disturb shikane
fi
fi
# The modeset below is lid-gated only.
[ -r "$LID_STATE" ] || exit 0
grep -q 'open' "$LID_STATE" || exit 0 # lid closed -> leave layout to shikane
# Give the driver a moment to finish re-training the link before we modeset.
sleep 1
swaymsg "output $OUTPUT disable" 2>/dev/null
sleep 1
swaymsg "output $OUTPUT enable" 2>/dev/null
# Re-assert the shikane profile (mode/scale/position) on top of the modeset.
command -v shikanectl >/dev/null 2>&1 && shikanectl reload 2>/dev/null
exit 0
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
# shikane-recover-on-reload: run after every sway startup/reload
# (wired up via exec_always in the sway config).
#
# Re-applies the shikane profile, then verifies the daemon came out
# the other side: if the re-apply hit the commit-failure race, the
# watchdog check (2s later) restarts the service to recover.
set -u
shikanectl reload 2>/dev/null
sleep 2
exec /home/work/.config/sway/scripts/shikane-watchdog.sh
+20 -7
View File
@@ -3,8 +3,11 @@
# #
# Bug (shikane 1.1.1): if a variant application is discarded mid-way # Bug (shikane 1.1.1): if a variant application is discarded mid-way
# (e.g. by a failing DP atomic commit), the daemon gets stuck in # (e.g. by a failing DP atomic commit), the daemon gets stuck in
# VariantInProgress/Discarded and keeps logging # VariantInProgress/Discarded. Two flavors observed:
# loud: keeps logging
# [WARN shikane::variant] Received invalid input AtomicChangeDone at state Discarded # [WARN shikane::variant] Received invalid input AtomicChangeDone at state Discarded
# silent: no WARN at all; the variant state ends at "Discarded" and the
# daemon state machine simply never leaves VariantInProgress
# `shikanectl reload` does not recover it; a service restart does # `shikanectl reload` does not recover it; a service restart does
# (re-applies the active profile in ~1s). # (re-applies the active profile in ~1s).
# #
@@ -25,21 +28,31 @@ if [ -n "$latest3" ]; then
*VariantApplied*) *VariantApplied*)
: ;; # healthy : ;; # healthy
*) *)
# InProgress/Discarded within the last 3 min: only a deadlock # Daemon still InProgress. Deadlock signatures (a legitimate
# if the WARN signature is present (a legitimate slow transition # slow transition has neither):
# has no WARN) # loud: the WARN from the discarded-variant race
# silent: variant discarded but daemon never processed it
printf '%s\n' "$logs3" | grep -q 'invalid input' && stuck=1 printf '%s\n' "$logs3" | grep -q 'invalid input' && stuck=1
if [ "$stuck" -eq 0 ]; then
lastvariant=$(printf '%s\n' "$logs3" \
| grep 'shikane::variant' | grep 'New variant state' | tail -1)
case "$lastvariant" in
*Discarded*) stuck=1 ;;
esac
fi
;; ;;
esac esac
else else
# No state change in the last 3 min — check the last known state # No state change in the last 3 min — check the last known state
last10=$(journalctl --user -u "$unit" -q --since "-10min" 2>/dev/null \ # (unbounded: a stuck daemon may have gone silent long ago,
# e.g. across a laptop suspend)
lastline=$(journalctl --user -u "$unit" -q -n 500 2>/dev/null \
| grep 'daemon::state_machine' | tail -1) | grep 'daemon::state_machine' | tail -1)
case "$last10" in case "$lastline" in
'' | *VariantApplied*) '' | *VariantApplied*)
: ;; # stable and applied, or nothing to check : ;; # stable and applied, or nothing to check
*) *)
stuck=1 ;; # stuck in-progress/discarded for >3 min stuck=1 ;; # stuck in-progress/discarded, any age
esac esac
fi fi
+53 -9
View File
@@ -1,15 +1,59 @@
# swaylock configuration -- VANILLA swaylock (packaged v1.8.6).
#
# swaylock reads $XDG_CONFIG_HOME/swaylock/config automatically, so this file
# applies to every invocation, including hypridle's before_sleep_cmd and the
# $mod+m keybind.
#
# IMPORTANT: the previous version of this file used swaylock-EFFECTS options
# (clock, timestr, datestr, fade-in, effect-blur, effect-scale and a bare
# `indicator`). The packaged swaylock is vanilla, and each of those lines logs
# swaylock: unrecognized option '--effect-blur=20x2'
# + a full usage dump, then ignores it (verified against v1.8.6). So the file
# was never fatal -- but none of its styling ever applied either, which is why
# the lock screen always looked like a bare `swaylock -c 000000`. Keep only
# names that appear in `swaylock --help` (check: every key here matches one).
#
# Want the blurred background + clock lock screen? Use hyprlock (installed and
# configured at ~/.config/hypr/hyprlock.conf) -- that is what hypridle's
# lock_cmd / 300s listener already call. Or install swaylock-effects from the
# AUR and re-add the effect-* keys.
ignore-empty-password ignore-empty-password
show-failed-attempts
indicator-caps-lock
clock font=JetBrainsMono Nerd Font Mono
timestr=%R font-size=24
datestr=%a, %e of %B
indicator-radius=110
indicator-thickness=12
fade-in=0.2 color=000000
#screenshots inside-color=00000000
effect-blur=20x2 inside-clear-color=00000000
#effect-greyscale inside-ver-color=00000000
effect-scale=0.3 inside-wrong-color=00000000
indicator line-color=333333
line-clear-color=CCCCCC
line-ver-color=999999
line-wrong-color=FFA14C
ring-color=333333
ring-clear-color=CCCCCC
ring-ver-color=999999
ring-wrong-color=FFA14C
key-hl-color=CCCCCC
bs-hl-color=FFA14C
separator-color=222222
text-color=FFFFFF
text-clear-color=CCCCCC
text-ver-color=FFFFFF
text-wrong-color=FFA14C
layout-bg-color=00000000
layout-border-color=00000000
layout-text-color=CCCCCC