Feuerfuchs / Collapsible-Systray-Cinnamon-Applet

A replacement for the abandoned System Tray Collapsible Cinnamon applet
10 stars 0 forks source link

Custom scale-factor on per-app basis #31

Open Pandiora opened 6 years ago

Pandiora commented 6 years ago

Hi feuerfuchs,

recently I wanted to clean-up my taskbar/systray a little bit and since I wanted only white icons for my systray I had a hard time achieving what I wanted.

The No.1 problem for me is the icon-sizing, which is, very problematic across several apps. Let's say I've a theme with 24x24 icons, which are used. All of these icons respect a guideline and have a padding of say 2px. On the other hand there are apps like teamspeak-client, where you can (Wowsa!) set your own icon-theme in the app-settings, but those icons are 32x32 and doesn't respect those guidelines - there isn't an equivalent padding. So yeah, I know unifying linux is difficult and this task is nearly impossible to automate.

What I'm thinking of is a list in the configuration-window with each app of the systray in it and numeric input-filed besides it, where you can set the scale-factor. We could even hardcode some scale-factors for known problematic apps.

I don't know if this is possible or even easy to achieve, but when I find some time and you're okay with that idea, I would try to code something.

I altered your code to temporarily achieve what I want:

    _resizeStatusItem: function(role, icon) {
        if (icon.obsolete == true) {
            return;
        }

        if (["shutter", "filezilla"].indexOf(role) != -1) {
            global.log("Not resizing " + role + " as it's known to be buggy (" + icon.get_width() + "x" + icon.get_height() + "px)");
        } else if (["teamspeak 3"].indexOf(role) != -1) {
            icon.set_size(20, 20);
        } else {
            let size = this._getIconSize(this._panelHeight);
            icon.set_size(size, size);
            global.log("Resized " + role + " with normalized size (" + icon.get_width() + "x" + icon.get_height() + "px)");
            //Note: dropbox doesn't scale, even though we resize it...
        }
    },
Pandiora commented 6 years ago

Oh and we could also remove the hardcoded stuff for shutter and filezilla by i.e. setting the scale-factor to 1, which then should ignore resizing and leave the icon as it is.