New Hotkey: Toggle Visible/Hidden Properties

Use case or problem

I’m frequently going into settings to toggle the visibility of properties in a note. On most days, I prefer to have them hidden in the note, but shown in a side pane. This keeps a cleaner writing experience. But when I’m organizing things, I prefer to have them visible.

There is no hotkey to toggle the visibility of properties in a note.

Proposed solution

Add a single new hotkey.

4 Likes

There is the “Toggle fold properties in current file” command you could use.

Also this related request:

Thank you. That is indeed a functional workaround.

That said, I’m still advocating for a hotkey to match the “Properties in document” setting.

3 Likes

I fully support this.

5 Likes

I support

It’s such an obvious thing. Is it really so difficult to implement

I found such a solution for myself. Create a css file with the following content:

.metadata-container,
.cm-line:has(.cm-hmd-frontmatter) {
display: none !important; 
} 

It completely disables the visibility of properties.

Name it and send it to the snippets folder. Next, install the plugin: GitHub - deathau/snippet-commands-obsidian: Registers custom css snippets as commands (which you can bind hotkeys to) . Add a keyboard shortcut to your css file and enjoy life. I apologize in advance for my English.

Do not forget to go to the obsidian settings, appearance, css fragments and activate the created css file.

Another approach is using a Templater template. Not the original request, but this flips between the Visible and Source setting for Properties in document:

<%*
const currentMode = app.vault.getConfig('propertiesInDocument');
const newMode = currentMode === 'visible' ? 'source' : 'visible';

app.vault.setConfig('propertiesInDocument', newMode);

if (newMode === 'source') {
    const activeView = app.workspace.getActiveViewOfType(tp.obsidian.MarkdownView);
    if (activeView) {
        activeView.editor.setCursor({ line: 0, ch: 0 });
    }
}
-%>

Set it as a “template hotkey” for easy switching back and forth. The only thing I noticed is that as it’s a global setting all notes are affected. So, if you have two notes open it will change both. That hasn’t bothered me.