SysTray-Icon always to small (no PB bug?)

Linux specific forum
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

SysTray-Icon always to small (no PB bug?)

Post by Kukulkan »

Hi,

I'm on KDE Neon 5.12 (Plasma 5.12.3) and since a while, the SysTray-Icons of my own programs, all compiled with PB 5.46 LTS (x64) , are always very small:

Image

Code: Select all

#size = 64; change to image size for test

; create some image
icon.i = CreateImage(#PB_Any, #size, #size, 32)
StartDrawing(ImageOutput(icon.i))
Box(1,1,#size,#size, RGBA(255,0,0,255))
StopDrawing()

; open some window
win.i = OpenWindow(#PB_Any, 0, 0, 230, 90, "Test, simply close me", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If win.i
 
  ; AddTrayIcon
  winId.i = WindowID(win.i)
  tray.i = AddSysTrayIcon(#PB_Any, winId.i, ImageID(icon.i))
  SysTrayIconToolTip(tray.i, "Test ToolTip")
 
  Repeat
    Event = WaitWindowEvent()
    If Event = #PB_Event_SysTray
      Debug "Tray event"
    EndIf
  Until Event = #PB_Event_CloseWindow
EndIf
RemoveSysTrayIcon(tray.i)
End
I'd expect an icon which is completely red. But I get a very small version only. It is the same with any loaded image (second icon in my screenshot). No matter how big you make the image, it is always to small :-(

As other SysTray-Images are fine, I assume some PB bug?
Last edited by Kukulkan on Tue Mar 27, 2018 4:27 pm, edited 1 time in total.
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 538
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: [PB5.46] SysTray-Icon always to small

Post by Sicro »

No problem on my linux with xfce4 and purebasic 5.62 (x64):
Image
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: [PB5.46] SysTray-Icon always to small

Post by Marc56us »

It works well for me too (Debian 9 / xfce on VirtualBox on Windows 10 x64)

Image

:wink:
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: [PB5.46] SysTray-Icon always to small

Post by Kukulkan »

Okay, this is strange. So it is an issue with the KDE Plasma SysTray? Will have to verify this.

Thanks for testing!
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: [PB5.46] SysTray-Icon always to small (no PB bug?)

Post by Kukulkan »

Seems to be some KDE issue. On Kubuntu 17.10 it's working better. For the test tool it's fine. But if I use some loaded PNG image, the icon is blurry (looking like down-scaled to 16px first and then re-scaled to SysTray size).

On KDE Neon, if I start several times, it works in about 20% of the test cases. In 80% it's to small (like in my screenshot).

I think I can't fix this for now. Hope that KDE is fixing the SysTray soon...
Bitblazer
Enthusiast
Enthusiast
Posts: 733
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: [PB5.46] SysTray-Icon always to small (no PB bug?)

Post by Bitblazer »

Snoop inside other apps written in other languages and check their resource information or source to see what they supply. In worst case, i would simply manually try to set a 32bpp 32x32 PNG icon and a 64x64 version. Obviously without any text in it, due to the potential down/upscaling effects which might happen. Put a 32x32 and 64x64 version into your PB binary via "xincludebinary" and use catchimage and then systray commands to apply them (first via the PB systray library, then KDE API calls). Check which one works flawlessly and post the resulting routines in linux tips&tricks pls ;)
see removesystrayicon/addsystrayicon/ChangeSysTrayIcon
webpage - discord chat links -> purebasic GPT4All
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: [PB5.46] SysTray-Icon always to small (no PB bug?)

Post by Kukulkan »

Hi Bitblazer,

thanks for your answer, but my app is cross platform (Win/Lin/Mac) and already uses 32x32 PNG icon with transparency together with CatchImage to set the tray icon using PB functions since years. But for Plasma KDE desktops it fails and I tried with all kind of sizes and had no success. Also, it sometimes works and the second try with the same binary fails again. I don't like to add KDE specific API, because PB Apps are GTK and probably there is not even KDE installed or running. The reason for using PB like cross-platform tools is to get rid of exactly such workarounds... :(

BTW, The StackOverflow link is a Windows related issue and does not apply to me. :wink:

For the moment it seems that I have to live with that. I realized that also Thunderbird MinimizeToTray AddOn is having the same issues with the Tray icon. Seems it is a KDE Plasma related bug and no one wants to fix it. I found similar TrayIcon/NotificationIcon related bugs in KDE bug tracker since 2005. They always pop-up again and never get fixed...
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: [PB5.46] SysTray-Icon always to small (no PB bug?)

Post by Shardik »

I have tested your program on these different Linux distributions with PB 5.62 and GTK3:

Code: Select all

+  Bodhi Linux 4.5.0 x86 with Moksha 0.2.1
-  ElementaryOS 0.2.1 'Luna' x86 with Pantheon (no tray icon)
+  Kubuntu 14.04 x86 with KDE 4.13.3 and Plasma 4.11.11
-  Kubuntu 16.04.4 x86 with KDE 5.18.0 and Plasma 5.5.5 (tiny tray icon)
+  Linux MATE 16.04 x86 with MATE
+  Linux Mint 18 'Sarah' x86 with Cinnamon
+  Lubuntu 16.04 x86 with LXDE
-  Ubuntu 14.04 x86 with Unity (no tray icon)
-  Ubuntu 16.04 x86 with Unity (no tray icon)
-  Ubuntu 17.10 x86 with Gnome 3 (Unity theme) using Wayland (no tray icon)
-  Ubuntu 17.10 x86 with Gnome 3 (Unity theme) using Xorg (no tray icon)
+  Ubuntu Budgie 17.10 x86 with Budgie
+  Xubuntu 16.04 x86 with Xfce
It seems to be the same situation as in my posting in your thread about broken tray icon events: ElementaryOS and Ubuntu don't support tray icons and KDE 5 / Plasma 5 seem to have problems with tray icons while KDE 4 / Plasma 4 didn't have these problems...
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: [PB5.46] SysTray-Icon always to small (no PB bug?)

Post by Kukulkan »

Hi Shardik,

thanks for the test!

I think on Ubuntu it is because of the unity system settings:

This is what helped for me in the past:
1) Run the following command in your console window to get the current settings:

gsettings get com.canonical.Unity.Panel systray-whitelist

2) Now, add the program name to the list. So if it was ['JavaEmbeddedFrame', 'Mumble', 'Wine', 'Skype'] before, make it look like this:

gsettings set com.canonical.Unity.Panel systray-whitelist "['JavaEmbeddedFrame', 'Mumble', 'Wine', 'Skype', 'myApp']"

Alternatively, run this in your console window in order to show all kind of systray icons:

gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"
Does this help for your unity and/or ubuntu systems?
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: [PB5.46] SysTray-Icon always to small (no PB bug?)

Post by Shardik »

Kukulkan wrote:Does this help for your unity and/or ubuntu systems?
I have tested your modification on Ubuntu 14.04 x86 and Ubuntu 16.04 x86 (both with Unity). Both distributions don't find your specified scheme:
Keine derartiges Schema "com.canonical.Unity.Panel"
I have done Google searches and have found only hacks, Ubuntu source code manipulations with recompilations and specific inofficial PPAs for displaying systray icons. But to be fair: Canonical said already 2010 officially "Farewell to the notification area"... :wink:
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: [PB5.46] SysTray-Icon always to small (no PB bug?)

Post by Kukulkan »

Hi Shardik,

thanks very much for your testing! Sad to hear. So this is one of many reasons for many people using an alternative desktop solution like KDE, XFCE etc. I never had success with Unity desktop at all - Running KDE all the time (currently KDE Neon). Not perfect, but much better for me and my needs.

Kind Regards, and have a nice long weekend!
Post Reply