Feature request: transparent HUD and Brisk Menu for Mutiny

Mate-HUD covers big part of the window it’s called on. Unlike MATE, in Unity the HUD is transparent, though blurred, so you can see if something’s happening underneath the HUD. So I thought of adding some transparency myself, and I did it using Compiz, through CCSM, in Opacity, Brightness and Saturation setting I put and opacity of 85% to window type=Unknown, and it worked. And indeed, it does make me feel as having better control over the window I’m working on. The only downside of what I did is that this way both background and text get the same opacity level, which can reduce visibility.

So I’d like to propose the HUD’s background to be somewhat transparent (with a slight blur, maybe, for visibility sake), so we can notice if something happens on the window while we browse the HUD. Ideally it would be WM independent (though I guess hardware compositing would be needed?), so people could use it with both Marco and Compiz.

Same could be done with Brisk Menu, though in this case it would be purely cosmetic, I guess, to make it feel that bit more like Unity. But in the HUD case, transparency adds to usability, in my experience.

2 Likes

You should submit a feature request on GitHub under their respective projects.

2 Likes

I’ll look into that. Although, I hoped relevant people are taking suggestions also from these forums…

Meanwhile, I wanted to notify that another downside of the way I did it is that mpv and Steam windows also become transparent, so far, maybe there’s more of them. Obviously, Compiz sees them as type=Unknown windows, too. This is just a minor annoyance, really, as reopcifying them is as easy as a key stroke + a mouse scroll, but still… It means a neater official solution would be much appreciated. :slight_smile:

I have tried out rofi launcher and after I changed its theme I noticed that the HUD’s theme was also changed. Maybe you should try that.

No, I’m actually fine with the HUD picking up the main GTK theme. I just want a bit of transparency there. :slight_smile:

However, I am also looking for Synapse alternatives lately, so I’ll probably take a look at rofi anyway. Thanks! :slight_smile:

You can use rofi’s settings to set your preferred transparency and/or color theme. Take a look here:
https://blog.sarine.nl/2017/04/10/rofi-140-sneak-preview7.html

The HUD actually uses rofi. As in literally, when you activate the HUD, it gathers the list of menu entries and feeds them directly to rofi. Any config in rofi will affect the HUD. This also means that it’s easy to add new config settings to the HUD code so that it feeds them to rofi :slight_smile:

1 Like

Indeed, rofi is already installed on my system. :open_mouth:
This is great news, meaning it shouldn’t be too hard to add a bit of alpha in the HUD. But I have a few questions…

How comes mate-hud inherits main gtk theme, but rofi doesn’t?
How can I modify the themes? Where are their settings stored?
Changing rofi theme with rofi-theme-selector doesn’t seem to change anything in the HUD on my machine… Is there a way to modify the looks of the HUD? I’m, obviously, mostly interested in adding alpha here, of course.

Quite cleverly, actually. It creates a fake GTK window (which it destroys without displaying) and reads the theme colors from its style context (which are set by the GTK theme), then passes those on to rofi as command line arguments.

So in a way, whatever mate-hud does in fact overrides any other settings on your system (as rofi command line arguments override other settings)

I see… But is there a way to add alpha to this? I guess I should edit something in /usr/lib/mate-hud/mate-hud, I just don’t really see what exactly…

1 Like

Yeah, try that file around line 210-ish. I’m not at my computer, but you could try it and report back here! That’d be awesome!! Where it says -color-window and -color-normal, change bg_color to ‘#0000007f’ for a 50% opaque black and see if that works. You might need to add new lines for -fake-transparency and -fake-background ‘background’. Not sure if this will work, but might be worth the try. Another option would be to use the -theme-str option, but not sure how to use that.

The options I’m gathering from here: https://github.com/DaveDavenport/rofi/blob/next/doc/rofi.1.markdown

2 Likes

Well, this actually works, but I had to destroy the feature of picking up the GTK theme... I backet it up, though, of course. :slight_smile: I'm not sure if we can have both GTK theme integration AND transparency, which would be the coolest. But a nice neutral transparent HUD theme would also do quite well in my opinion.

What I did so far is changing bg_color to '#7f000000' (bg_color = '#7f000000') and fg_color to '#FFFFFFFF' (fg_color = '#FFFFFFFF') to make it readable all together. I've also changed selected_bg_color to '#7fffffff' (selected_bg_color = '#7fffffff'), to keep it transparent (and white in this case) on selection. Everything else is left as it was. You can see the result in the screenshot, showing the HUD in Caja.

Another thing, that you probably already noticed, is that it is ARGB, not RGBA. Meaning the first field is the alpha channel, not the last one.

The way I have it now almost works as it is for me. :smiley: But a few more touches will probably also be welcome.

1 Like

Woah, this is brilliant!

Ok, the next step would be to prepend the alpha value to the color code, so whatever Gtk returns as bg_color, insert the opacity_value right after the # symbol. That opacity_value could very well be a gsettings config variable so that the user can modify the transparency percentage :smile:

Thanks for persisting on working on this, I like this feature and I think a pull request is in order to make this official.

I think an on/off switch on gsettings should be sufficient, and conditionally add the necessary flags to rofi, defaulting to 7f alpha. But an arbitrary value could be very nice too.

Again, thanks for working on this! :slight_smile:

1 Like

@Franko_Burolo - so, I played with this a bit and I think what we need to do here is add an alpha channel to the rgba_to_hex method, like this:

def rgba_to_hex(color, alpha = 1.0):
   return "#{0:02x}{1:02x}{2:02x}{3:02x}".format(
                                           int(alpha       * 255),
                                           int(color.red   * 255),
                                           int(color.green * 255),
                                           int(color.blue  * 255))

def get_color(style_context, preferred_color, fallback_color, alpha = 1.0):
    color = rgba_to_hex(style_context.lookup_color(preferred_color)[1], alpha)
    if color == '#000000':
        color = rgba_to_hex(style_context.lookup_color(fallback_color)[1], alpha)
    return color

This defaults alpha to fully opaque (1.0), just in case, and allows you to do stuff like:

bg_color = get_color(style_context, 'dark_bg_color', 'theme_bg_color', 0.75)

for a 75% opaque setting, using the theme colors!!

What do you think of this? I still think we need a gsettings variable to make this optional and configurable. The file already implements get_number, now we just need to add that variable to the schema the org.mate.hud.gschema.xml file (under mate-hud/usr/share/glib-2.0/schemas)

If you do this, you will need to compile the schema file:

sudo cp ./usr/share/glib-2.0/schemas/*.gschema.xml /usr/share/glib-2.0/schemas/
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/

Thoughts? :slight_smile:

2 Likes

This WORKS! And looks cool, too! B-)

I am sorry for the late response, I've got a busy week...

Just now I finally did what you showed up there, but I opted for 65% opacity, this time around. I added the same alpha value to selected_bg_color too, just to make selection also transparent. And this is what I got now:

Pretty cool! :slight_smile:

I don't (yet) really know how to make schemas, though... I am not a dev, I just like to tinker every once in a while. XD But I agree it would be really nice to have an option for this in dconf-editor. Making it official would be great. :slight_smile: