No Blink

How to Stop Blinking or Flashing Cursors

A minority of people cannot work with blinking or flashing cursors. In today's globalized community even a “minority” is still a lot of people. Yet software providers often ignore these peoples' needs.

Apple used to respect such people, and prior to OS X provided a means of turning off cursor blink globally across all applications. This feature was dropped with OS X. Now it is only possible to turn off cursor blink on some applications—and this must be done on a case-by-case basis.

Microsoft built cursor blink into MS-DOS and then into Windows. However, even from Windows 3, it was possible to work around this. I wrote a tiny program that executed in the background and that every 0.5 seconds reset the cursor blink rate to 0. This stopped cursor blink in all Windows applications that used the standard Windows APIs; although ironically this meant that the cursor disappeared in Word and continued to blink in Excel. Since 2000, Microsoft has respected the needs of people who can't work with blinking cursors and allows cursor blink to be turned off globally.

In the Linux world, all decent terminals have long offered the user the choice of blinking or non-blinking cursors. And most Linux Window systems also provide a global solution—at least for applications written for the particular Window system the user is using. Thus, it is possible to globally turn off cursor blink for all GNOME 2 applications (I don't use or know about GNOME 3), and for KDE applications that are based on Qt 3 or Qt 4.

For more information about turning off cursor blink see www.jurta.org/en/prog/noblink. Although the JURTA site is very useful, it doesn't help with applications that use Tcl/Tk's themed widgets (which have cursor blink but which don't respect the insertOffTime option), or with Qt 5.0.0 applications which take their blink rate from the theme and seem to ignore user preferences. In both cases a solution is possible, but involves rebuilding these libraries from source. Note that more modern Qt 5 versions do respect the user's blink rate—but only on Windows.

Building a Non-blinking Tcl/Tk

Alternatively, use the non-themed (non-ttk) input widgets.

Building a Non-blinking Qt 5.0.0

Alternative #1: Use the qt5noblink library.

Alternative #2: Create your own custom QApplication subclass. Here's one approach using Qt for Python that can be done almost identically using C++ if preferred:

from PySide2.QtWidgets import QApplication

if sys.platform.startswith('linux'):
    class Application(QApplication):
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            filename = os.path.expanduser(
                '~/.gconf/desktop/gnome/interface/%gconf.xml')
            with contextlib.suppress(FileNotFoundError):
                with open(filename, 'rt', encoding='utf-8') as file:
                    xml = file.read()
                if re.search(r'<entry[^<>]+name="cursor_blink"[^<>]+'
                             r'value="false"', xml):
                    self.setCursorFlashTime(0)
                    style_hints = self.styleHints()
                    style_hints.setCursorFlashTime(0)
else:
    class Application(QApplication):
        pass # Qt respects blink rate automatically on Windows

Top