Distraction-free mode
-
I’ve seen two discussions about a distraction-free mode: https://sourceforge.net/p/notepad-plus/discussion/331754/thread/c0b3127a/ and https://notepad-plus-plus.org/community/topic/13703/is-there-a-distraction-free-writing-mode-like-vimroom-a-plugin-of-vim
In the latter, @dail posted a nice screenshot of what could be such a mode: the text is centered on screen with wide margins. Would it be possible to have the source code of this plugin? Thank you! -
Hi @gracile-fr
I don’t have the source code any more. I just did some quick tests on an existing plugin I was working with. To get the basic functionality is easy, just set the margins wide so that it centers the text. You can do some testing with the PythonScript plugin. (Normally I would be a bit biased to use LuaScript but there is an issue using it to set the margins). So using Python:
w = 1980 editor.setMarginLeft(w/3) editor.setMarginRight(w/3) notepad.runMenuCommand("View", "Post-It")
That’s the general idea. Obviously the screen width is hard coded, don’t know off the top of my head how to get the width of the editor.
-
you could use @dail s script and ctypes to get the size of the fullscreen notepad++ window like this
import ctypes from ctypes.wintypes import RECT FindWindow = ctypes.windll.user32.FindWindowW GetWindowRect = ctypes.windll.user32.GetWindowRect Rect = RECT() nppHandle = FindWindow(u'Notepad++', None) notepad.runMenuCommand("View", "Post-It") if GetWindowRect(nppHandle, ctypes.byref(Rect)) != 0: w = Rect.right editor.setMarginLeft(w/3) editor.setMarginRight(w/3)
Cheers
Claudia -
FYI:
This feature will be in the next release (v7.9.6). -