Presentation mode?
-
Is there a way to get Notepad++ to enter presentation mode? I would like to stop the screensaver kicking in all the time (IT set it to 5 minutes and I cannot change it). Thanks.
-
Ah, those I.T. clowns…always doing dumb things.
Sounds like what you need is a mouse-jiggler.
-
So, as I often do, I grabbed the jiggler script I use, and I cleaned it up for forum posting. The script runs via the PythonScript plugin and executes behind the scenes whenever your Notepad++ is running, preventing your computer from entering screensaver/sleep mode.
Curiously, I notice if I have Visual Studio IDE running in addition to Notepad++, my computer WILL sleep after the I.T. prescribed timeout – I have no idea why this is.
Here’s
MouseJiggleDaemon.py
:# -*- coding: utf-8 -*- import ctypes from ctypes import Structure, c_uint, sizeof, byref, POINTER, c_int from ctypes.wintypes import DWORD, LONG import threading import time ULONG_PTR = ctypes.POINTER(DWORD) INPUT_MOUSE = 0 MOUSEEVENTF_ABSOLUTE = 0x8000 MOUSEEVENTF_MOVE = 0x0001 class MOUSEINPUT(ctypes.Structure): _fields_ = ( ('dx', LONG), ('dy', LONG), ('mouseData', DWORD), ('dwFlags', DWORD), ('time', DWORD), ('dwExtraInfo', ULONG_PTR) ) class _INPUTunion(ctypes.Union): _fields_ = ( ('mi', MOUSEINPUT), ) def MouseInput(flags, x, y, data): return MOUSEINPUT(x, y, data, flags, 0, None) def Input(structure): return INPUT(INPUT_MOUSE, _INPUTunion(mi=structure)) def Mouse(flags, x=0, y=0, data=0): return Input(MouseInput(flags, x, y, data)) class INPUT(ctypes.Structure): _fields_ = ( ('type', DWORD), ('union', _INPUTunion) ) def sendInput(*inputs): nInputs = len(inputs) LPINPUT = INPUT * nInputs pInputs = LPINPUT(*inputs) cbSize = ctypes.c_int(ctypes.sizeof(INPUT)) return ctypes.windll.user32.SendInput(nInputs, pInputs, cbSize) def sendMouseMoveDeltaXY(x, y): flags = MOUSEEVENTF_MOVE event = Mouse(flags, x, y, 0) return sendInput(event) class MJD(object): def __init__(self): self.jiggle_thread = threading.Thread(target=self.jiggle_thread_function, args=(1,)) self.jiggle_thread.daemon = True # thread won't stop until parent ends self.jiggle_thread.start() def jiggle_thread_function(self, name): multiplier = 1 while True: sendMouseMoveDeltaXY(multiplier, multiplier) multiplier *= -1 time.sleep(5.0) # use this so we don't continuously use CPU time if __name__ == "__main__": try: mjd except NameError: mjd = MJD()
You can set it up for automatic use by adding these two lines to your user
startup.py
file:import MouseJiggleDaemon mjd = MouseJiggleDaemon.MJD()
and by configuring your PythonScript to run “at startup” by choosing this setting:
-
@alan-kilborn it is working thank you.
Maybe this could make it to mainline np++ one day :)
-
@roweryan said in Presentation mode?:
Maybe this could make it to mainline np++ one day
It seems perfect as an add-on script.
Glad that it works for you.Now you have a reason to never exit N++.
If you need such a reason.
:-)