Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot completely remove mouse cursor in nw.js app

I'm using nw.js for html/css/js desktop app and cannot completely remove mouse cursor in full screen mode.

enter image description here

I've removed it by setting css properties cursor: none, margin: 0, padding: 0 on the body/html. And also toolbar: false and fullscreen: true are set in package.json. But the cursor is visible a few pixels on all the edges of screen (picture bellow).

enter image description here

Strange behaviour, does someone know how to completely remove it?

NOTE: This is just an issue in NW.js, as it works perfectly in all browsers and also in the xulrunner, as we migrated in the company from xulrunner to node-webkit (nw.js) all applications got this issue.

like image 797
swolfish Avatar asked Jan 11 '16 08:01

swolfish


People also ask

How do I get rid of cursor pointer?

To enable or disable this feature, follow the steps below. Open the Control Panel. In the Control Panel, double-click the Mouse icon. In the Mouse Properties window, click the Motion tab and check or uncheck the "Show pointer trails" option to enable or disable the feature.

Is it possible to hide cursor?

You will see a “Mouse Properties” window. At the top of this window, click the “Pointer Options” tab. The “Pointer Options” tab displays various mouse settings. Here, in the “Visibility” section, enable the “Hide Pointer While Typing” option.

How do I hide my cursor in Canva?

Answers. Try styling the canvas with cursor: none in CSS, or in JavaScript do canvasElement. style. cursor = "none";.

How do I hide my cursor on my website?

Approach: First, select the element where cursor element need to hide. Add CSS style cursor:none to the a class. Add the class name (class name of CSS style cursor:none) to the particular element where cursor element to be hide.


2 Answers

I suspect another element is applying cursor:auto, essentially overriding your CSS rule.

Consider the following basic example:

html, body {
  background:#000; color:#FFF;
  padding: 0; margin: 0;
  text-align: center;
  cursor:none;
}

div {
  margin:2em;
  padding:1em;
  background:#555;
  cursor:auto;
}
<div>
  <p>This div has cursor:auto</p>
</div>

As you can see, the element gets the normal cursor because it has a cursor:auto rule. Since you did not provide your code, I can't know exactly which element is getting the rule, you can inspect in the devtools to catch it. Otherwise, you can override ALL cursor rules with this CSS line:

* { cursor: none !important; }

And to see that in action:

html, body {
  background:#000; color:#FFF;
  padding: 0; margin: 0;
  text-align: center;
  cursor:none;
}

div {
  margin:2em;
  padding:1em;
  background:#555;
  cursor:auto;
}

* { cursor: none !important; }
<div>
  <p>This div has cursor:auto but gets overriden</p>
</div>

Edit: iframes

The cursor cannot be hidden in documents loaded through an iframe. The iframe would need to get that CSS rule locally.

See iframe demo: https://jsfiddle.net/azizn/rr7bsrc7/1/

like image 188
Aziz Avatar answered Sep 21 '22 17:09

Aziz


I have also the same issue. I think the best solution for us would be to switch to Electron or wait until a stable version 0.13 of nw.js is released.

like image 34
Darko Riđić Avatar answered Sep 20 '22 17:09

Darko Riđić