Skip to content

Commit 313ef66

Browse files
committed
Fix 1.7.5 not opening search w/hotkey + focus lock
Older versions of Obsidian focused the search box directly from the search command, which allowed hotkey-based search to work with Pane Relief's Focus Lock active. Newer versions now do the focusing in a way that is subject to Focus Lock, so this release adds a workaround to emulate the old behavior. Note: with the exception of taking focus away from popout windows, Obsidian has fixed most of the problems in its UI that Focus Lock was intended to prevent, so you may want to try turning off Focus Lock to see if you still need it. (The one other major use case for it is keeping the "Automatically reveal active file" plugin from constantly focusing the file explorer pane.)
1 parent 4ce29ad commit 313ef66

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "pane-relief",
33
"name": "Pane Relief",
4-
"version": "0.5.5",
4+
"version": "0.5.6",
55
"minAppVersion": "1.5.8",
66
"description": "Per-tab history, hotkeys for pane/tab movement, navigation, sliding workspace, and more",
77
"author": "PJ Eby",

src/focus-lock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export class FocusLock extends Service {
4141
// Handle the case where there was no prior active leaf
4242
if (!this.activeLeaf || !isLeafAttached(this.activeLeaf))
4343
return old.call(this, this.getLeaf(), ...etc);
44+
// Obsidian 1.7.x handles search focusing differently; this restores the old behavior
45+
if (leaf.view?.getViewType() === "search" && etc[0] === true || etc[0]?.focus) leaf.setEphemeralState({focus: true});
4446
}},
4547
revealLeaf(old) {
4648
return function(leaf: WorkspaceLeaf) {

versions.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2+
"0.5.6": "1.5.8",
23
"0.5.5": "1.5.8",
3-
"0.5.4": "1.5.8",
4-
"0.5.3": "1.5.8",
54
"0.5.2": "1.3.5",
65
"0.5.1": "1.2.8",
76
"0.4.2": "0.15.9",

0 commit comments

Comments
 (0)