by GINJILISM
Fixes for Obsidian Mobile on foldable phones like iPhone Duo: tap protection for the sidebar swipe, a layout guard for phone/tablet mode mix-ups, a hideable tab bar with floating buttons, and per-device settings.
Duo Optimize
Fixes for using Obsidian Mobile on a foldable phone (developed and tested on an iPhone Duo; the same issues exist on Android foldables such as Galaxy Fold and Pixel Fold).
Features
- Tap protection (touch slop): On mobile, the sidebar drawer follows your finger even for short taps and small movements, which makes the screen twitch and gets in the way of plugin UI on the left side. This plugin holds back move events until the horizontal travel passes a threshold (default 36 px), so deliberate swipes still open the sidebars while taps stay calm. There is no stock setting to disable the sidebar swipe; this is the middle ground.
- Layout guard: Obsidian picks the phone or tablet layout from the shortest screen dimension, and on foldables the choice can land wrong after opening or closing the device, leaving a mixed layout. The guard checks the body classes against the screen size after a resize and repairs them when they disagree (rate-limited so it never fights the app). A manual command, "Check and repair layout", is also available. An experimental option can lock the expectation to the phone layout.
- Hideable tab bar + floating buttons: The top tab bar can be hidden in the unfolded (tablet) layout for a cleaner reading view. A small button in the top-right toggles it: just below the tab bar while it is shown, and in the corner (inward of the sidebar button) while it is hidden, so it never overlaps the built-in buttons. Because hiding the tab bar also hides the built-in sidebar buttons, replacement sidebar buttons appear in the top-left and top-right corners while it is hidden. All floating buttons fade out while scrolling down and reappear on scroll up or back at the very top.
- Tab title bar auto-off: Optionally turns off the core "Show tab title bar" appearance setting at startup. If you turn it back on in the core settings, it stays on for that session; turning the plugin option off does not restore it.
- Per-device settings: All settings are stored in per-device local storage and are never synced, so each device keeps its own values and your PC is never affected.
Installation
Install from the Obsidian Community Plugins directory (Settings -> Community plugins -> Browse), or manually: copy main.js and manifest.json into <your vault>/.obsidian/plugins/duo-optimize/ and enable the plugin.
Known limits
- The layout guard works at the CSS class level. The workspace scaffolding that Obsidian builds at startup cannot be rebuilt by a plugin, so a mixed layout can occasionally need an app restart anyway.
- The replacement sidebar buttons use the workspace API with a fallback to the core toggle commands.
- Tap protection is designed for one-finger touch gestures. Multi-touch and pen input are left untouched.
Development
Plain JavaScript, no build step. The decision logic (gesture gate, layout checks, settings resolution, button visibility) is kept DOM-free and covered by small tests:
node tests/run.js
node tests/layout-tests.js
node tests/settings-tests.js
License
MIT
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.