Context:
Today, if you go to System Settings -> Windows, and change "Action on title bar with mouse scroll" to "Adjust opacity", you can make any window partially transparent! I want to add a more convenient way to access this feature. More importantly, the scroll action doesn't work on all windows - an easy example is the Calculator app that comes installed by default (GNOME Calculator).
While I think this could be a good pull request, I decided to try and implement it in an Extension first. I started looking into how to do it but reached a dead end. I never worked with Cinnamon before so I might be missing something. Here's what I have so far:
1. This is the code that handles the mouse scroll action. It sets
window->opacity
and then calls meta_compositor_window_opacity_changed
, which in turn calls meta_window_actor_update_opacity
.2. The window menu (which appears when you right-click a window's title bar) is implemented in JavaScript here. Specifically, when the user right-clicks, this line creates a new WindowMenu object, and generating the actual menu items happens in
_buildMenu
. Here's my first problem: I don't see any clean way to add my own extra items to the menu through an extension.3. Assuming there was a way (e.g. hijacking the _buildMenu function), adding the slider itself should be easy -
WindowMenu
extends PopupMenu
which has an implementation of a Slider menu item - although I haven't tested it, and I don't know if it's used anywhere.4. Now comes the actual dead end... Setting
window->opacity
is easy (probably), but how do I call meta_window_actor_update_opacity
? I've been trawling the linuxmint repositories for hours. I don't really understand how the JS <-> C glue works. Is there just no way?An extension called Opacify uses a tweener to change the window's opacity value but doesn't call
meta_window_actor_update_opacity
. Probably as a result, it has a long-standing rendering bug.I hope that wasn't too much but to sum up:
How does the JS <-> C binding happen?
How can I call that specific C function from a JavaScript extension?
How can I - or can I - add a menu entry to WindowMenu? (Note, this will not be necessary for a pull request - only for an extension)