Skip to content

Match Obsidian's dotted window class in the focus binding - #9119

Open
ya-luotao wants to merge 1 commit into
omacom:quattrofrom
ya-luotao:fix-obsidian-focus-pattern
Open

Match Obsidian's dotted window class in the focus binding#9119
ya-luotao wants to merge 1 commit into
omacom:quattrofrom
ya-luotao:fix-obsidian-focus-pattern

Conversation

@ya-luotao

Copy link
Copy Markdown

Problem

SUPER + SHIFT + O looks dead once Obsidian is running (#8902). The binding is { launch = "obsidian", focus = "^obsidian$" }, which omarchy-launch-or-focus wraps as \b^obsidian$\b against each window's class and title. That matches a window whose class is exactly obsidian, but current Obsidian builds report the class md.obsidian.Obsidian, so the focus branch never matches, the script relaunches Obsidian every time, and Obsidian's single-instance lock swallows the new process without raising the existing window.

Fix

Change the pattern to ^(md\.obsidian\.)?obsidian$ (Lua literal "^(md\\.obsidian\\.)?obsidian$"). It matches both the bare obsidian class and md.obsidian.Obsidian, case-insensitively, while keeping the anchors.

The anchors are deliberate: #1838 anchored this binding because a window titled "Obsidian is great!" stole the key, and ec59388 re-anchored it after the script went back to \b matching. Dropping them to a bare obsidian would fix #8902 but reintroduce that false match.

Fed through the exact jq expression from bin/omarchy-launch-or-focus:

client ^obsidian$ (old) ^(md\.obsidian\.)?obsidian$ (new)
class obsidian
class md.obsidian.Obsidian ❌ (the bug)
firefox, title "Obsidian - Mozilla Firefox"
class obsidianite
class org.obsidian.foo

Verification

  • jq matrix above against the expression in bin/omarchy-launch-or-focus:13.
  • applications.lua is required from $OMARCHY_PATH/default/hypr/bindings/ via default.hypr.omarchy, not copied into ~/.config, so the change reaches existing installs on update; no migration needed.
  • test/shell.d/launch-1password-test.sh and test/shell.d/hyprland-default-config-test.sh pass.
  • Not exercised against a running Hyprland (developed on macOS). A quick hyprctl clients -j | jq -r '.[].class' | grep -i obsidian on an Omarchy box before/after would confirm the class value.

Fixes #8902

🤖 Generated with Claude Code

https://claude.ai/code/session_01RrGftF1S6Xymu7Z58TRd3M

Obsidian reports the class md.obsidian.Obsidian on current installs, which
the anchored ^obsidian$ pattern cannot match, so SUPER+SHIFT+O always
relaunched instead of focusing and the single-instance lock made the key
look dead. Keep the anchors so a browser tab titled "Obsidian" still
cannot steal the binding, and accept the md.obsidian. prefix.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RrGftF1S6Xymu7Z58TRd3M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default Obsidian binding: focus = "^obsidian$" is anchored, so it can never match and SUPER+SHIFT+O never focuses an open window

1 participant