Dash-to-dock: Customize border opacity following the dash background value.

Created on 15 May 2016  路  21Comments  路  Source: micheleg/dash-to-dock

Dock border should get same opacity as the rest of the dock, it would look much better IMHO.

enhancement

Most helpful comment

As a workaround, you can edit the file:

~/.local/share/gnome-shell/extensions/[email protected]/stylesheet.css

On line 4 you should have something like this:

border:1px;

Just replace it with:

border:0px;

Then disable/enable the extension.

Result:

capture du 2016-05-15 20-48-38

All 21 comments

Which border are you talking about ? I don't see any border:

capture du 2016-05-15 20-14-10

c2f6af4c-c845-11e5-8ff9-26c13fc7d591

Ah yep, you're right, I tried with 0% opacity and saw the border, my bad !

As a workaround, you can edit the file:

~/.local/share/gnome-shell/extensions/[email protected]/stylesheet.css

On line 4 you should have something like this:

border:1px;

Just replace it with:

border:0px;

Then disable/enable the extension.

Result:

capture du 2016-05-15 20-48-38

Will do, thanks mate!

You're welcome.

@micheleg: I guess a better way to fix this would be to add a new line after line 84 to set border-color with the same value than background-color ; but idk if everyone would like this feature, so, it means adding a GUI option but I don't know the extension well enough to propose a patch...

I guess it would make sense to set the same opacity value used for the bakground to the border as well. From a very quick test it seems this should work. It should not be too complicated, it's a matter of extending the code which retrieve and update the background color for the border too. The relevant code is in https://github.com/micheleg/dash-to-dock/blob/master/theming.js if someone wants to propose a patch.

I'll propose a patch next week.

I took the liberty of looking into this and prepared a patch. https://github.com/franglais125/dash-to-dock/commit/0393fb9e2ea5cd62940b417f9e952ea13831c418

It's in fact just two lines. I use the same information from the background colour to set the border colour.
The only thing left after that is to take care of the shadow, if not there is a shift in colour on the border.

@franglais125 why do we need to set the 'box-shadow' property? Beside this, I was initially thinking of reading the actual border color and only apply the opacity to it, but this is a good first step.

Ah, I see what you mean... I just re-read previous comments. I thought the point was to apply the same color, not the same opacity!

To apply the same color, I needed to remove the shadow-box, because it was making the color darker.

I can re-do the patch, assuming we want to set the _opacity_, and not the _color_ to be the same?

Yes, my initial idea was to apply only the opacity and keep the colour the theme author chose, but I haven't tested in real cases what would be better. In any case, retrieving and storing the border opacity is a bit more tedious but it should be easy following what is done for the background.

So I re-worked the patch... https://github.com/franglais125/dash-to-dock/commit/f4e5ced03f709a702ea87e5e3686852e07ab9c35

One thing to note that is different to the background color is that there might be a maximum opacity for the border (Line 107 of the patch). Say the theme has borders that have a 50% opacity, should we respect this?

The first time I tried it, when setting the opacity to 100% (and if the border follows this), then it can be a bit weird. However, if there is a maximum opacity (set by the theme), then it can look more natural. But this is up to you, how you think is best!

The other doubt I have is for Line 124: does the side matter? In my test, it didn't, but I don't know if this is the same for everyone.

Cheers

I've added to what @franglais125 started to create a patch that keeps the border in sync with the background ..

https://github.com/passingthru67/dash-to-dock/commit/a0bab415fa949a7d458814d86a011a1639114439

I've tested it with different background/border colors and alphas and I haven't seen any issues yet. I can create a pull-request if needed.

@passingthru67 thanks for looking into it!

I don't have my laptop right now, so I can't test it. However I have 2 comments:

1) I do like your idea (about keeping the alphas in sync)! This way the alphas (border to background) will have the same ratio, even after applying the new alpha.

2) However, Line 87 seems to have a division that can go wrong: for instance if a theme has alpha_background = 0, but alpha_border>0. Is this something that could happen? I mean, are there themes where alpha_background could be 0?

Glad you spotted that. I don't know why the background alpha would ever be 0, but it wouldn't hurt to check it to prevent errors.

@passingthru67 I pushed a fix into your branch! https://github.com/passingthru67/dash-to-dock/pull/1

It seems to be working well. I'm wondering if it's really necessary to keep the border/background opacity ratio rather than just applying the same to both element. My argument is:

  1. We are overwriting the original style anyway
  2. The way it is implemented now, if the border have a higher alpha value, it makes sense to remap it's range so that it keeps the ratio but it can go to zero, assuming the user wants a fully transparent dock. However, if the border has a lower alpha (no idea if it makes sense, I haven't used any custom theme since I installed gnome shell,), the opposite case, i.e. the user wants a fully opaque dash, is not achieved. This was indeed the original motivation of this option: making the dock opaque in those themes (including the default one prior to 3.16) which have a semi-transparent dash.

Do you think it's really important to keep the alpha ratio?

Regarding point 2, I considered that case too (wanting fully opaque dash). From the tests I did, it doesn't look like it makes a big difference, except if the border is large.

IMO, keeping the same alpha ratio is more of a detail, and it is up to you to go one way or the other. But that's just my opinion, somebody else might feel more strongly about it.

Like @franglais125 said, it's more of a detail thing (to keep the color balance in line with the theme). I found I liked it better, but some users may prefer it the other way.

@micheleg, whichever way you decide will be fine. Either way the border and background would be capable of reaching full transparency and that seems to be the main issue at hand.

I've merged this pull request. I might reconsider to simplifying the behaviour with a fixed opacity for both border, but this is good enough for now.

Thank you.

Was this page helpful?
0 / 5 - 0 ratings