[SOLVED] Hiding or removing a running application text/icon from the panel

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Post Reply
dnl
Level 2
Level 2
Posts: 53
Joined: Mon Dec 26, 2016 3:21 am

[SOLVED] Hiding or removing a running application text/icon from the panel

Post by dnl »

I am running LM 18.3 and LM19.1 on two systems with the Cinnamon desktop. I have been using CrossOver to run an old application I wrote may years ago to run in Windows. I recently rewrote it in python using PyQt for the graphical interface. There is one remaining problem to solve before the new python app can fully replace the old windows app.

When I run the old app in CrossOver (or when I ran it in Windows), there is no text/icon entry that appears on the panel or taskbar. I would ilke to reproduce this feature in the python app.

How can a running app text/icon item be hidden or removed from the panel? I have searched for solutions and the only solution I found is to use compiz. At least, I think compiz offers a solution; however, it does not seem like a very good long-term solution.

If that is not possible, is it possible to move the text/icon item to another panel and then hide that panel?
Last edited by dnl on Tue May 28, 2019 4:44 pm, edited 1 time in total.
dnl
Level 2
Level 2
Posts: 53
Joined: Mon Dec 26, 2016 3:21 am

Re: Hiding or removing a running application text/icon from the panel

Post by dnl »

OK. It appears no one knows how to do this.

My old app does keep its icon/text out of the taskbar (Windows) and panel (Linux). I could not remember how until I did more digging today and rediscovered how. The app is written in Visual Basic 6 and the forms in VB6 have a property that can be set to hide themselves from the taskbar. Apparently WINE and CrossOver successfully implement whatever is needed to support this feature on at least the Cinnamon desktop.

Does anyone have any information on how this works or how this might be applied to other apps?

Programs with icons in the system tray somehow accomplish this. How do they do it?

Alternatively, how can I put an icon in the system tray for my program so that when it runs it does not put anything else in the panel?

Any help or thoughts would be appreciated?
User avatar
smurphos
Level 17
Level 17
Posts: 7332
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Hiding or removing a running application text/icon from the panel

Post by smurphos »

In your code you need to give the Window manager some hints about how you want your window to be treated. E.g. to not have a panel entry your applications window may need to have _NET_WM_STATE_SKIP_TASKBAR set - https://standards.freedesktop.org/wm-sp ... 0472615568

No clue however how/if PyQt supports that....
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
dnl
Level 2
Level 2
Posts: 53
Joined: Mon Dec 26, 2016 3:21 am

Re: Hiding or removing a running application text/icon from the panel

Post by dnl »

smurphos wrote:
Tue May 28, 2019 1:24 am
In your code you need to give the Window manager some hints about how you want your window to be treated. E.g. to not have a panel entry your applications window may need to have _NET_WM_STATE_SKIP_TASKBAR set - https://standards.freedesktop.org/wm-sp ... 0472615568

No clue however how/if PyQt supports that....
Thank you very much for the link. Good stuff.

I have some understanding of messaging in Windows so it appears I need to gain as much or maybe a greater understanding for PyQt and X11. At least I have something to work on. Thanks.
dnl
Level 2
Level 2
Posts: 53
Joined: Mon Dec 26, 2016 3:21 am

Re: Hiding or removing a running application text/icon from the panel

Post by dnl »

While looking through the Extended Window Manager Hints document I noticed the window type _NET_WM_WINDOW_TYPE_UTILITY, which corresponds nicely with what I am trying to do. I then looked through the Qt class reference and discovered that the Qt.Tool window type automatically sets this attribute.

I altered my code to include Qt.Tool in the set of window flags I was already setting and that allowed my program to run without a button in the panel but that created a problem; my program would no longer shutdown when I closed the PyQt widget/window I was displaying.

After a little more digging, I discovered that the Q.Tool attribute causes the quit_on_close flag to be cleared. I corrected this by resetting that flag after showing the widget. So my solution is briefly this ...

Code: Select all

class myWidget(QtWidgets.QWidget):
    def __init__(self, parent=None):
        super(myWidget, self).__init__(parent)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
                            QtCore.Qt.WindowStaysOnTopHint |
                            QtCore.Qt.Tool)
        ...
if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    w = myWidget()
    w.show()
    w.setAttribute(QtCore.Qt.WA_QuitOnClose)
    app.exec_(sys.exit())
Thanks again to smurphos for the link and suggestion.
Post Reply

Return to “Cinnamon”