ch11ng / exwm

Emacs X Window Manager
2.85k stars 134 forks source link

All black mouse cursor #513

Closed Ambrevar closed 4 years ago

Ambrevar commented 5 years ago

I don't remember if this always was an issue, but now I'm a little annoyed by the mouse cursor: it's all black (contour as well), so it's very hard to see on my black-backgrounded Emacs buffers.

Note as soon as the mouse hovers over X windows (i.e. not Emacs buffers) then the cursor becomes "normal", that is, black with a white contour.

If I start Emacs without EXWM, the mouse cursor is also normal.

I don't have any specific configuration regarding the mouse cursor.

medranocalvo commented 5 years ago

That's strange. Might it have to do with your theme? Please, use M-x list-faces-display and have a look at the mouse face, particularly the background. Note that under my experience the mouse face uses to linger when you switch themes.

Other than that, I don't think EXWM meddles with the mouse cursor in any way.

Ambrevar commented 5 years ago

I haven't configured the face of my mouse cursor. Here it is:

Face: mouse (sample) (customize this face)

Documentation: Basic face for the mouse color under X.

Defined in ‘faces.el’.

       Family: unspecified
      Foundry: unspecified
        Width: unspecified
       Height: unspecified
       Weight: unspecified
        Slant: unspecified
   Foreground: unspecified

DistantForeground: unspecified Background: unspecified Underline: unspecified Overline: unspecified Strike-through: unspecified Box: unspecified Inverse: unspecified Stipple: unspecified Font: unspecified Fontset: unspecified Inherit: unspecified

medranocalvo commented 5 years ago

Hm. I'm at a loss. I suggest you to try the following:

a) Change the Foreground and Background color of the mouse face. Does the color change?

b) Have a look at the instructions in https://wiki.archlinux.org/index.php/Cursor_themes, (in particular https://wiki.archlinux.org/index.php/Cursor_themes#Change_X_shaped_default_cursor).

c) Try other simple tiling window manager (e.g., awesome mentioned in the above link). How is the cursor there?

Ambrevar commented 5 years ago

I tried a few things:

For now I'll settle with

(set-face-background 'mouse "#777777")

in my Emacs configuration. That'll do, although I wish I could have changed the mouse contour color :/

ch11ng commented 5 years ago

@Ambrevar Is EXWM running on a GTK3 build of Emacs? You can check this with M-x emacs-version.

Ambrevar commented 5 years ago

I tried with both Athena and GTK3: same thing.

ch11ng commented 5 years ago

Cursor is an attribute of X windows and fallback to use parent's when absent. If xsetroot does not affect the cursor in Emacs frames then Emacs must have specified its own one. Perhaps you should try modifying the cursor theme before running any GUI apps (including Emacs).

Ambrevar commented 5 years ago

That's what I had tried when I mentioned that xsetroot changes nothing. In fact, I have a dzen bar and when I move the mouse cursor there, it display properly (black with white contour).

On Emacs, it's all black.

ch11ng commented 5 years ago

Unfortunately there seems to be no way to check which cursor an X window is using. The only relevant code in EXWM that is involved in modifying cursor is moving/resizing an X window (just a temporary cursor set with the GrabPointer request). The cursors are initialized when EXWM starts up so you can check if they are normal (by holding super and down-mouse-1 over a floating X window for example). If not then maybe something starts after EXWM modifies the cursor theme.

mnick commented 5 years ago

I seem to have the same issue. However, I only get a black cursor on higher exwm workspaces:

It looks like X11 settings are not initialized correctly when new workspaces are started. Hope this helps debugging the issue.

ch11ng commented 5 years ago

@mnick Do you have any special setting related to X cursor? Workspace frames are created with (make-frame) and there's no option to control which X cursor to use for the new frame. For me I just make the cursor theme preconfigured and have xsetroot -cursor_name left_ptr run before starting Emacs.

medranocalvo commented 5 years ago

@mnick: Please,

  1. post the result of evaluating each of the following within the first workspace and then within some higher workspace:
(frame-parameter nil 'background-color)
(frame-parameter nil 'mouse-color)
(describe-face 'mouse)
  1. post the value of the following variables:

    • initial-frame-alist
    • default-frame-alist
    • window-system-default-frame-alist
  2. post the output of xrdb -query.

Let me know if something's not clear or you find difficulties.

Ambrevar commented 5 years ago

Unlike @mnick I only ever use one workspace, and the cursor is all black by default in workspace 0.

medranocalvo commented 5 years ago

@Ambrevar, thanks for the info. Please, post the results I asked @mnick, in case it sheds some light.

One can get an all-black mouse pointer evaluating this snippet:

;; The `mouse-color` frame parameter determines the pointer foreground, the
;; `background-color` determines the pointer background.  When those are the same,
;; the background color of the pointer is taken from `foreground-color`.
(let ((frame (make-frame '((background-color . "black")
                           (foreground-color . "black")
                           (mouse-color . "black")))))
  ;; Restore back/foreground.
  (set-frame-parameter frame 'background-color "white")
  (set-frame-parameter frame 'foreground-color "black"))

Does that ring a bell?

@Ambrevar, @mnick: Could you also have a look at your .emacs.d/custom.el file? Do you use desktop.el? If so, please also have a look there for anything relevant.

Ambrevar commented 5 years ago

I don't use custom.el. I use desktop.el, but there is nothing regarding mouse-color or frame faces.

medranocalvo commented 4 years ago

@Ambrevar, @mnick: is this still happening?

Ambrevar commented 4 years ago

I didn't notice when it changed, but now that you mention it, you are right, the cursor is no longer all black for me!

Any idea what fixed it?

medranocalvo commented 4 years ago

No clue :-). I'd say something in your environment (?).

I'm closing the ticket, please reopen if it happens again.