Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-11-21 09:58:49

xlaus
Member
Registered: 2018-11-21
Posts: 4

Difficulty controlling size of xfce4 plugin icon on panel

I have a deskbar panel with a row size of 112px. The trouble is that the weather panel plugin tries to scale its icons to the full width of the panel which looks quite bad, I want to set padding or margins around the plugin to force the icon down to a more sensible, less blurry size. However I've had no luck so far.
This is what it looks like now:
3VkyeaWl.png

Things I've tried adding to ~/.config/gtk-2.0/gtkrc with no success:

#xfce4-weather { margin: 45px; }
#xfce4-weather { padding: 45px; }
#xfce4-weather-plugin { margin: 45px; }
#xfce4-weather-plugin { padding: 45px; }
#weather-20 { margin: 45px; }
#weather-20 { padding: 45px; }

I'm no css expert so I don't know what else to try, but maybe someone else does.
There's also the ~/.config/xfce4/panel/weather-20.rc file but it doesn't seem to have any parameters for size or margins.

Offline

#2 2018-11-21 12:00:19

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,492

Re: Difficulty controlling size of xfce4 plugin icon on panel

Hello and welcome.

Can you confirm which GTK version of the weather plugin you have? This will dictate which settings and where to place them.

ldd $(locate libweather.so) | grep gtk

GTK3 css should go into ~/.config/gtk-3.0/gtk.css and GTK2 configs in ~/.gtkrc-2.0.

With gtk2, you could use something like:

style "my-weather-plugin"
{
   xthickness = 5
   ythickness = 5
}
widget "*weather*" style "my-weather-plugin"

...but you can only make smalle adjustments before clipping happens. Thats just the nature of GTK2.

You can get more finer control with GTK3 with something like:

#weather-17* {
-gtk-icon-transform: scale(.5);
}

...where "17" is the plugin number that you can get from:

xfconf-query -c xfce4-panel -lv | grep weather

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2018-11-21 21:03:24

xlaus
Member
Registered: 2018-11-21
Posts: 4

Re: Difficulty controlling size of xfce4 plugin icon on panel

ToZ wrote:

Can you confirm which GTK version of the weather plugin you have? This will dictate which settings and where to place them.

ldd $(locate libweather.so) | grep gtk

ldd returns a 'missing file argument' error when I attempt this. So I went ahead and tried both solutions in their respective gtk files.

style "my-weather-plugin"
{
   xthickness = 5
   ythickness = 5
}
widget "*weather*" style "my-weather-plugin"
#weather-20 {
-gtk-icon-transform: scale(.5);
}

(Mine appears to be weather-20 but I also tried weather-17 to be sure)

After restarting the panel both times there was no visual difference at all with either selection added to ~/gtk-2.0/gtkrc or ~/gtk-3.0/gtk.css, even after fiddling with thickness/scale values and trying again.

Offline

#4 2018-11-21 22:03:16

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,492

Re: Difficulty controlling size of xfce4 plugin icon on panel

Which distro and version are you using?

To find the weather plugin gtk version, first locate the file then run ldd against it. For example:

$ locate libweather.so
/usr/lib/xfce4/panel/plugins/libweather.so
$ ldd /usr/lib/xfce4/panel/plugins/libweather.so | grep gtk
	libgtk-3.so.0 => /usr/lib/libgtk-3.so.0 (0x00007f3af0511000)

...added to ~/gtk-2.0/gtkrc or ~/gtk-3.0/gtk.css...

To confirm, gtk2 config statements go into the ~/.gtkrc-2.0 ($HOME/.gtkrc-2.0) file.
gtk3 css statements go into the ~/.config/gtk-3.0/gtk.css ($HOME/.config/gtk-3.0/gtk.css) file.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2018-11-21 22:21:11

xlaus
Member
Registered: 2018-11-21
Posts: 4

Re: Difficulty controlling size of xfce4 plugin icon on panel

Right, sorry. I was just using the wrong gtk file. It's definitely a gtk2 plugin. Unfortunately the provided settings in ~/.gtk-2.0 simply cause the icon to clipped at the sides like you suspected, rather than scaling down.

style "my-weather-plugin"
{
   xthickness = 5
   ythickness = 5
}
widget "*weather*" style "my-weather-plugin"

The distro is Debian 9.6 stretch

Frustratingly, I know it can be done somehow. Here's a snip from another xfce4 desktop I found with a similar width deskbar and the same weather plugin/icons as me but scaled much more nicely.
oWchjX3l.png

Last edited by xlaus (2018-11-21 22:21:57)

Offline

#6 2018-11-22 12:08:37

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,492

Re: Difficulty controlling size of xfce4 plugin icon on panel

Perhaps a config parameter exists that allows you to do this in gtk2 and if it does, I can't seem to figure it out.

As a workaround, you could manually resize the icons so that the image becomes smaller in the canvas - it would give the same result. To do so, first make a copy of the icon theme over to ~/.config/xfce4/weather/icons:

mkdir  ~/.config/xfce4/weather/icons
cp -r /usr/share/xfce4/weather/icons/liquid  ~/.config/xfce4/weather/icons

...then edit the newly copied theme.info file and change the name (so it is easier to identify in a dropdown menu later).

Since you are using a row size of 112, you would change the icons in the 128 folder. You can use imagemagick to automate the conversion of these icons. Run the following command inside the 128 folder to shrink the icons by about 40%:

 for f in *.png; do convert $f -resize 128x128 -background transparent -gravity center -extent 192x192 $f; convert $f -resize 128x128 $f; done

Then go into the weather plugin's appearance tab and select your new icon theme.

Note: if you need the icons smaller, increase the 192x192 value in the command above. If you need them larger, increase the value.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2018-11-22 13:25:43

xlaus
Member
Registered: 2018-11-21
Posts: 4

Re: Difficulty controlling size of xfce4 plugin icon on panel

Thanks! The extra padding on the top and bottom of the icon makes the panel look quite spaced out, but it's much preferable to how it looked before. I do wonder if there's something that can be entered in the weather plugin configuration (weather-20.rc or something else) that tells it to use the 48x48 icons with no scaling.

Offline

#8 2018-11-22 14:15:30

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,492

Re: Difficulty controlling size of xfce4 plugin icon on panel

xlaus wrote:

Thanks! The extra padding on the top and bottom of the icon makes the panel look quite spaced out

Try the following script instead (make sure you re-copy over the original files first):

for f in *.png; do convert $f -background transparent -gravity center -extent 192x128 $f; done

...it will just expand the canvas to the left and right of the image.

I do wonder if there's something that can be entered in the weather plugin configuration (weather-20.rc or something else) that tells it to use the 48x48 icons with no scaling.

Unfortunately no. You'll get many more configurability options with the GTK3 version of the plugin when your distro starts using it.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.010 seconds, 8 queries executed - Memory usage: 572.16 KiB (Peak: 589.01 KiB) ]