0

As my desktop background changes, I've seen the Unity Launcher's hue automatically updates to adapt with the background color. # This is used in other UI elements as well, for instance - the background of dash and notifications

I now want to programatically access this hue because using this color in a script, I plan to theme a few other things based on whatever the current hue is.

In worst case I could just use the current destkop background image and calculate something similar to what Unity is doing to get a hue from it, but I wouldn't know how it extracts that from an image.

Even if I do, it may be slightly off from how the launcher's looking and it won't look good. Besides, unity's already doing some calculations under the hood to get this hue, so we might as well re-use that.

Is there a command using which I could get this directly from Unity? How does unity do this?

#: A few screenshots to show how it adapts to the background:

enter image description here enter image description here enter image description here enter image description here

6
  • Might be related but is unanswered: askubuntu.com/questions/334800/… – Peeyush Kushwaha Jul 11 '18 at 7:47
  • Install compiz-config-settings-manager. From unity plugin you can tweak it, although most are hardcoded. For notify-osd it can be easily changed if patched version of notify-osd feom leolik ppa. – Khurshid Alam Jul 14 '18 at 3:57
  • @Khurshid I don't want to tweak it, just get to know the color so I can theme some other things (unrelated to unity) with that color – Peeyush Kushwaha Jul 14 '18 at 4:04
  • You can get some color value using dconf-dump. But first see which one you need using ccsm. – Khurshid Alam Jul 14 '18 at 4:52
  • @KhurshidAlam through ccsm, in unity plugin there is an option for background color in "General" tab, but it's set to transparent (opacity 0, #000000). You can manually set it to something else, but I don't think it's being updated as unity generates the colors for dash based on the desktop background images – Peeyush Kushwaha Jul 15 '18 at 17:28
0

Easiest way I suppose is to take a screenshot of app 0 according to xwin, which is in fact the desktop. It skins based on that value as far as I can tell

3
  • This doesn't work. Because as you can see in the screenshots, the launcher is translucent, so for instance in the second screenshot, even if I have the ability to programatically take the screenshot, I'm not sure how I'd extract the single color which is used for theming from it – Peeyush Kushwaha Jul 11 '18 at 7:41
  • that's why you have to grab window zero. it's how the vlc wallpaper video app works. it's not a screenshot proper, it's a grab of the "desktop window" – RobotHumans Jul 11 '18 at 15:07
  • Can you tell me what command should I use to do this? I tried import -window 0 screenshot.png but that turns my pointer to crosshairs to select the area, and when I do select an area it's just like a regular screenshot – Peeyush Kushwaha Jul 11 '18 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.