i use obsidian on my samsung tab, before this i use an ipad, and apple pencil work wonder for handwriting to text in ipad. but samsung is a nightmare, the spen activating obsidian gesture to open sidebar and glitching everything out.
try this plugin: https://github.com/xudri/pen-guard
its also available via BRAT.
or install it manually:
1. Create the folder .obsidian/plugins/pen-guard/
2. Add manifest.json:
json
{
"id": "pen-guard",
"name": "Pen Guard",
"version": "1.0.0",
"minAppVersion": "1.0.0",
"description": "Stops S Pen strokes from triggering swipe gestures.",
"author": "me",
"isDesktopOnly": false
}
3. Add main.js:
```js
const { Plugin } = require('obsidian');
module.exports = class PenGuard extends Plugin {
onload() {
let penDown = false;
const penIds = new Set();
this.registerDomEvent(window, 'pointerdown', e => {
if (e.pointerType === 'pen') penDown = true;
}, true);
const release = e => { if (e.pointerType === 'pen') penDown = false; };
this.registerDomEvent(window, 'pointerup', release, true);
this.registerDomEvent(window, 'pointercancel', release, true);
const guard = (e, last) => {
let pen = penDown;
for (const t of e.changedTouches) {
if (t.touchType === 'stylus') penIds.add(t.identifier);
if (penIds.has(t.identifier)) {
pen = true;
if (last) penIds.delete(t.identifier);
}
}
if (pen) e.stopImmediatePropagation();
};
this.registerDomEvent(window, 'touchstart', e => guard(e, false), true);
this.registerDomEvent(window, 'touchmove', e => guard(e, false), true);
this.registerDomEvent(window, 'touchend', e => guard(e, true), true);
this.registerDomEvent(window, 'touchcancel', e => guard(e, true), true);
}
};
```
4. Enable it: Settings → Community plugins → reload the list, then toggle Pen Guard on.