notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Support for a non-blinking cursor

Open cbm755 opened this issue 8 years ago • 10 comments

Jupyter has a blinking cursor. Ideally, this should be based on my OS preferences.

At least on my Fedora system, Firefox seems learn this from Gnome.

Does the browser expose this? Can Jupyter get this property and use it?

(Apologies if this is a dupe, didn't see it...)

cbm755 avatar Jun 27 '16 17:06 cbm755

I doubt this is something browsers expose. Our text editor component is CodeMirror. If that exposes a way to control cursor-blinkitude, we could add a separate setting for it.

takluyver avatar Jun 27 '16 18:06 takluyver

yes, codemirror as a cursorblinkyness-like option.

You can set hat with though your custom.js likely.

Carreau avatar Jun 27 '16 18:06 Carreau

I certainly can't work with a blinking cursor so hope no blinking becomes a configuration option.

mark-summerfield avatar Jul 12 '17 17:07 mark-summerfield

I really like jupyter notebook, big thanks to the developers. However, I too am afflicted by the cursor blink phenotype. Fortunately someone has explained a solution on their blog: http://pirsquared.org/blog/notebook-blink.html

At least the last part apparently worked for me - i.e. pasting and running the following javascript code in one of the current notebook's cells:

%%javascript
var rate = 0;
// apply setting to  all current CodeMirror instances
IPython.notebook.get_cells().map(
    function(c) {  return c.code_mirror.options.cursorBlinkRate=rate;  }
);

// make sure new CodeMirror instance also use this setting
CodeMirror.defaults.cursorBlinkRate=rate;

tomwhi avatar Sep 18 '17 09:09 tomwhi

You can add "CodeCell": { "cm_config": {"cursorBlinkRate": 0}} inside .jupyter/nbconfig/notebook.json and restart jupyter notebook for cursor to stop blinking:

A piece of my config:

{
  ...
  "CodeCell": {
    "cm_config": {
      "autoCloseBrackets": false,
      "cursorBlinkRate": 0
    }
  },
  ...
}

SergeyDidenko avatar Jul 17 '18 12:07 SergeyDidenko

@SergeyDidenko Seem to be a great solution but I cannot find .jupyter/nbconfig/notebook.json for Anaconda distribution.

al-yakubovich avatar Oct 15 '19 22:10 al-yakubovich

Just another use case for this - I work remote using anydesk and the inherent latency in a remote session makes the blinking cursor quite wonky and hard to follow

hughesadam87 avatar Jan 31 '20 20:01 hughesadam87

Cursor blinking is a very annoying feature. I am trying to follow the tips you give. I have modified these two files with no results:

.jupyter/nbconfig/notebook.json:

`{ "Notebook": { "Header": false, "Toolbar": false }, "Cell": { "cm_config": { "lineNumbers": true, "styleActiveLine": true, "cursorBlinkRate": 0 } } }

` and file .jupyter/lab/user-settings/@jupyterlab/codemirror-extension/commands.jupyterlab-settings:

`{ // CodeMirror // @jupyterlab/codemirror-extension:commands // Text editor settings for all CodeMirror editors. // ************************************************

// Theme
// CSS file defining the corresponding
// .cm-s-[name] styles is loaded
"theme": "jupyter",
"styleActiveLine": true,
"cursorBlinkRate": 0

}`

When running jupyter-lab the cursor is still blinking. I have also modified the settings of CodeMirror from inside jupyter, and it looks like the commands.jupyterlab-settings:

`{ // CodeMirror // @jupyterlab/codemirror-extension:commands // Text editor settings for all CodeMirror editors. // ************************************************

// Theme
// CSS file defining the corresponding
// .cm-s-[name] styles is loaded
"theme": "jupyter",
"styleActiveLine": true,
"cursorBlinkRate": 0

}`

I have tried to modify the IPython custom.js file but the file and the folder static/ don't exist. Any help?. Thank you.

I am using: Ubuntu 20.04 Jupyter-lab 3.0.16

jilguero888 avatar Jun 03 '21 17:06 jilguero888

This is also a huge problem for me in JupyterLab on macOS. The blinking cursor is incredibly distracting, especially when using the dark theme. I tried changing browsers but the cursor blinks in all of Safari, Opera and Firefox. I would truly appreciate an option to just have a non-blinking cursor. The solution by @SergeyDidenko did not work for me. I tried adding his code to both notebook.json and jupyter_notebook_config.json, without success.

gloryVine avatar Jun 17 '21 20:06 gloryVine

Userstyle to remove blink in JupyterLab:

@-moz-document url-prefix("http://localhost:8888/lab") {
    @keyframes cm-blink {50% {opacity: 1 !important;}}
    @keyframes cm-blink2 {50% {opacity: 1 !important;}}
}

trondsg avatar Dec 02 '23 21:12 trondsg

in the new version of jupter lab, you can click Settings -> Settings Editor -> CodeMirror -> Cursor blinking rate, set Cursor blinking rate as 0

AlexFeng863 avatar Jun 22 '24 10:06 AlexFeng863

in the new version of jupter lab, you can click Settings -> Settings Editor -> CodeMirror -> Cursor blinking rate, set Cursor blinking rate as 0

Great, closing then.

Carreau avatar Jun 27 '24 08:06 Carreau