Cursor theme changes
podiki opened this issue · 9 comments
Thanks for xsettingsd, has been really helpful in making theme changes/reloads in a WM environment (XMonad currently, for me)!
One setting which seems funky is Gtk/CursorThemeName
: upon changing and sending HUP
to xsettingsd, the mouse cursor theme does change, but not everywhere. Perhaps this is more of a GTK or X thing? So most programs will update the cursor theme, but not over root (background).
However, if I open lxappearance, without changing anything just opening the program, the mouse cursor is updated. Perhaps it is a GTK/X thing, as current emacs needs a manual set-mouse-color
to pickup the change, but not in newer pgtk builds. Not sure how this should work for the mouse theme on the desktop in general, or what lxappearance is doing. My quick look at the code just shows it loading current settings, but via g_object
stuff (sorry, not a GTK person to know what's happening).
Is this something that xsettingsd can fix? Or is this something for the WM? Not sure what lxappearance has to do with it, but seems to be a clue that settings need some reload/refresh?
I believe that's an X thing, what lxappearances does is something along the lines of
[icon theme]
Inherits=vimix-cursors-white
in /home/potato/.icons/default/index.theme
Yes, that's one of the places lxappearance writes to (along with gtk2 and gtk3 settings files). In this case though, it doesn't write anything, it is just upon opening it that the cursor theme is (correctly) changed for the desktop. An xsettingsd reload correctly changes the theme for programs, but for some reason this doesn't take everywhere. So something about just reading the GTK settings (when lxappearance starts) does it? Is there something that xsettingsd should/could be doing? Or something from the X side? Sorry if this isn't quite in the area of xsettingsd, but trying to understand where to fix this.
Glad you've found it useful! My guess from glancing at lxappearance would be that https://github.com/lxde/lxappearance/blob/d132fdd829b1ed080f4c82a53b71d7e88dda8cc2/src/cursor-theme.c#L56 is the relevant code. Per the comment there, affected apps are probably ones that inherit the root window's cursor instead of watching XSETTINGS or GtkSettings (which gets automatically updated based on XSETTINGS, IIRC) and updating their own cursors. If that's correct, then what lxappearance is doing (iterating over screens and updating root window cursors) seems to be outside the scope of what xsettingsd does.
can that be done using one of the xsetroot flags
I suspect it can (I'm just using whatever the default cursor is on my system). See https://wiki.archlinux.org/index.php/Cursor_themes#Change_X_shaped_default_cursor.
Unfortunately I tried with xsetroot
before and that doesn't update the cursor theme. I'm not sure if that's what is happening with lxappearance since the change happens immediately on program open (without going to the cursor theme tab or changing any settings), although maybe that is getting called anyway as part of initialization. I guess I'll try some of the low level GTK/GDK stuff to see what triggers the change on root windows...
By the way, for some context for all this theme switching, I'm using xsettingsd along with darkman to switch day/night themes. Overall it works well (you can see the basic scripts as part of my dot files, but this is the the most glaring annoyance remaining...
I'll leave this open for a little while to report if I figure it out, in case it is of use to anyone also relying on xsettingsd for these theme changes, although appears to be outside of the scope of xsettingsd.
EDIT: Yes, the code linked in the earlier comment from lxappearance is called in initialization. However, duplicating that part of the code doesn't seem to update the cursors for me...still that seems promising.
You were right @derat, that code from lxappearance does the trick. I was trying without an actual GTK window (doing this with the C FFI from Common Lisp, because that's a million times easier for me) and it had no effect. Simply creating a GTK window and then using that code of setting the cursor in the root window propagated the change. Except for Steam, but I'm sure that's another beast.
So I guess to complete a mouse cursor theme change will need a little GTK helper program, or open/close lxappearance. I'm not sure why xsetroot
doesn't work, probably needs to go through GDK. (Theming on X is such a mess...)
Thanks for bearing with me, happy to hear any clever hacks around this, but I will close this.
Thanks for documenting your findings! And yeah, my experience has also been that it's pretty hit-and-miss which configuration mechanisms different apps use and how well they respond to changes (with font configuration being the absolute worst :-/).
I've added Gtk/CursorThemeName
to https://github.com/derat/xsettingsd/wiki/Settings, along with a link back to this issue.
Thanks, and if anyone finds anything helpful, do share! I'll probably write something small that just pops up a GTK dialog to inform of a theme change (for my day/night changes) that can then reload the cursor settings. Or perhaps this can be taken care of with other theme switching utilities that exist. If I have anything helpful to report, I'll add it here for reference.