- Enable CSS Snippets:
Options > Appearance > CSS Snippets
- Create a new css file in the snippets folder with the following content:
.body-fullscreen {
padding-top: 0 !important;
}
.titlebar-fullscreen {
display: none !important;
}
- Disable Safe Mode:
Options > Community plugins > Safe mode
- Install obsidian-javascript-init plugin (obsidian link:
obsidian://show-plugin?id=obsidian-javascript-init
) - Enable
JavaScript Init
plugin - In
Plugin options > JavaScript Init Setting
paste the following code:
body = document.querySelector("body");
titlebar = document.querySelector(".titlebar");
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
let resizeObserver = new ResizeObserver((entries) => {
handleResized()
});
resizeObserver.observe(body);
function handleResized() {
sleep(50).then(() => {
if (screenX == 0) {
body.classList.add("body-fullscreen");
titlebar.classList.add("titlebar-fullscreen");
}
else {
body.classList.remove("body-fullscreen");
titlebar.classList.remove("titlebar-fullscreen");
}
})
}