trilium icon indicating copy to clipboard operation
trilium copied to clipboard

(Feature request) Bring back Zen Mode

Open en3r0 opened this issue 3 years ago • 6 comments

Describe feature

I personally found Zen Mode to be a great way to focus in on the notes.

Is there any way to bring it back?

Additional Information

No response

en3r0 avatar Jan 17 '22 17:01 en3r0

Hi, if you hide the left panel, there isn't that much visible on the screen:

image

zadam avatar Jan 17 '22 19:01 zadam

I agree, it is not much, but it is not quite "zen like".

Ideally I would like to get as close to a blank screen as possible. All icons and tabs hidden, just a blank screen and a blinking cursor.

I don't think something like that is possible through CSS modification only?

en3r0 avatar Jan 17 '22 20:01 en3r0

I don't think something like that is possible through CSS modification only?

Almost. You can hide the elements on the page with CSS selectors, but you also need a way to trigger between zen and non-zen mode.

You could add a button/shortcut like this:

api.addButtonToToolbar({
    title: 'Zen mode',
    icon: 'book',
    action: function() {
         $("body").toggleClass("zen-mode");
    },
    shortcut: 'alt+t'
});

The hiding CSS selectors will be then prepended with .zen-mode.

zadam avatar Jan 17 '22 21:01 zadam

Zadam's way above works excellent! I've added Zen Mode to my Midnight Trilium Theme:

Heres the relevant CSS I used.

For a basic Zen Mode that still keeps some note UI like tabs, attributes, and splitter:

/* Zen Mode */
body.zen-mode #launcher-pane, body.zen-mode #left-pane, body.zen-mode .title-bar-buttons {
    display:none !important;
}

For an extreme Zen Mode that hides everything but the note:

/* Zen Mode Extreme */
/* display:none friendly */
body.zen-mode #launcher-pane, body.zen-mode #left-pane {
    display:none !important;
    height:0 !important;
    width:0 !important:
} 
/* display:none not friendly - some of these have an interactivity lag when coming back from display:none so another method must be used */
body.zen-mode .title-bar-buttons, body.zen-mode .tab-row-widget, body.zen-mode .title-row, body.zen-mode .ribbon-container, body.zen-mode .gutter, body.zen-mode #rest-pane > div:nth-child(1) {
    visibility: hidden !important;
    height:0 !important;
    width:0 !important:
} 

To me Trilium's awesome style and script flexibility means this can be recreated and perhaps this issue closed?

cwilliams5 avatar Feb 14 '22 08:02 cwilliams5

This works great!

Only thing I would add if making this a feature again is having ESC also exit Zen Mode. Not sure if that is possible with this implementation or not.

en3r0 avatar Mar 07 '22 13:03 en3r0

For those wanting to use the feature discussed here, you just need to create two notes as follows:

  1. A CSS note (Basic Properties: Note type: CSS) with an Owned Attribute #appCss. In this note put either of the CSS snippets above.
  2. A JS frontend note (Basic Properties: Note type: JS frontend) with an Owned Attribute #run=frontEndStartup . In this note put the api.addButtonToToolbar... code snippet above.

Reload and there will be a book icon button bottom left. Note that there's no obvious way to exit the extreme Zen mode, but Ctrl-R (browser re-load) works.

tbnorth avatar Mar 12 '24 14:03 tbnorth

Trilium has entered maintenance mode. Future enhancements will be addressed in TrilumNext: https://github.com/TriliumNext/Notes/issues/141

meichthys avatar May 09 '24 03:05 meichthys