1

I am using Ubuntu Mate 20.04 How can I customize the appearance (i.e. background, font color... ) of tooltips?
Maybe through dconf-editor or command line?

Parsa Mousavi
  • 3,305
  • 16
  • 37
obaino
  • 328

1 Answers1

2

You can install Gtk2 and Gtk3 themes and most of them has a structure like this :

$tree . -d
.
├── assets
├── gnome-shell
│   └── assets
├── gtk-2.0
│   ├── apps
│   └── assets
├── gtk-3.0
├── metacity-1
└── xfwm4

In the gtk-3.0 directory you can find a file named gtk.css . Open it with your favorite text editor and search for ToolTips. There should be some properties like this :

tooltip {
   padding: 4px;
   /* not working */
   border-radius: 5px;
   box-shadow: none;
   text-shadow: 0 1px black; 
}

tooltip.background {
   background-color: rgba(0, 0, 0, 0.8);
   background-clip: padding-box;
   border: 1px solid rgba(255, 255, 255, 0.1); 
}

tooltip decoration {
     background-color: transparent; 
}
tooltip * {
     padding: 4px;
     background-color: transparent;
     color: white; 
}

You can change the background color of your tooltips via the background-color property.

And in the gtk-2.0 directory there's file named gtkrc which might contain a line like this :

# Tooltip colors
gtk-color-scheme = "tooltip_fg_color:#ffffff\ntooltip_bg_color:#000000"

If you want to change the tooltip background color for a gtk2 program ( they are very rare by now) you can adjust it.

You can change the theme via command line without the need to log-out and log-back . For example for a theme called Sweet :

gsettings set org.gnome.desktop.interface gtk-theme Sweet
gsettings set org.gnome.desktop.wm.preferences theme Sweet 

Happy hacking :)

EDIT : These are just for Gtk apps . But you haven't mentioned that you want to change the tooltips of Gtk or Qt apps . So if you want to customize Qt5 apps you can use a nice theme engine called Kvantum which is very customizable and is SVG based , so you can edit the background color of the tooltips via editing the theme files with something like Inkscape

Parsa Mousavi
  • 3,305
  • 16
  • 37
  • @DKBose Edited the typo . Thanks for pointing out. – Parsa Mousavi May 26 '20 at 07:44
  • 1
    All this will work, but it is safer to change the theme files in ~/.config directory of current user. – N0rbert May 26 '20 at 07:54
  • @N0rbert AFAIK gtk themes go to either /usr/share/themes/ or ~/.themes not ~/.config . Do you mean that we should put css files in ~/.config ? – Parsa Mousavi May 26 '20 at 07:59
  • @ParsaMousavi He means to edit ~/.config/gtk-3.0/gtk.css or ~/.config/gtk-2.0/gtk.css – obaino May 26 '20 at 08:01
  • @obaino, yes "to edit ~/.config/gtk-3/gtk.css or ~/.config/gtk-2/gtk.css " . Thanks :) – N0rbert May 26 '20 at 08:01
  • @N0rbert OK. Does it override current themes settings ? and if yes , then how can you apply a theme ? – Parsa Mousavi May 26 '20 at 08:03
  • @ParsaMousavi I have edited your answer to include what I mean. Yes, it overrides current theme. +1 from me :) – N0rbert May 26 '20 at 08:09
  • @N0rbert So after that using themes will make no sense. What's the problem with using ~/.themes directory ? I think it's better to start off with a theme and then begin hacking. This makes more room for customization. – Parsa Mousavi May 26 '20 at 08:10
  • @N0rbert The answer at this point is kind of meaningless I think. At the beginning and at the end we're talking about themes and in the middle we're working with ~/.config . I think we have to update the answer either to adapt it to your opinion or mine . – Parsa Mousavi May 26 '20 at 08:15
  • OK, please adapt to your original ideas about ~/themes. – N0rbert May 26 '20 at 08:19