1

I am working on a widget manager like conky in gnome. I want to hide only my ap my application icon(display all other running apps icons) from running apps or from hereenter image description here

this is my qml file

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12

Window {
    id:window
    visible: true
    width: 500
    flags: Qt.AlignLeft
    height: 375
    color: "transparent"
    title: qsTr("Nidgets")
    Timer{
        interval:100
        running: true
        repeat: true
        onTriggered: {
            time.text = Qt.formatDateTime(new Date(), "hh:mm A")
            date.text = Qt.formatDateTime(new Date(), "yyyy MMMM dd")
        }
    }

    Item {
        id: element1
        x: 0
        y: 0
        width: 200
        anchors.fill: parent
        height: 200
        focus: true
        Keys.onPressed: {
            if ((event.key === Qt.Key_F11) && (event.modifiers & Qt.ControlModifier)){
                if(window.flags == Qt.FramelessWindowHint)
                    window.flags = 0
                else
                    window.flags = Qt.FramelessWindowHint
            }
        }

        Text {
            id: date
            x: 310
            y: 205
            color: "#ffffff"
            text: Qt.formatDateTime(new Date(), "yyyy MMMM dd")
            font.pixelSize: 24
        }

        Text {
            id: time
            x: 74
            y: 86
            color: "#ffffff"
            anchors.centerIn: parent
            text: Qt.formatDateTime(new Date(), "hh:mm A")
            anchors.verticalCenterOffset: -45
            anchors.horizontalCenterOffset: 35
            font.pointSize: 75

        }


    }
}

my main.py file

import sys
from PyQt5.QtCore import QObject, QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtQuick import QQuickView
from PyQt5.QtQml import QQmlApplicationEngine
from threading import Thread
import os
import importlib

if __name__ == '__main__':
    myApp = QApplication(sys.argv)

    engine = QQmlApplicationEngine()
    context = engine.rootContext()
    context.setContextProperty("main", engine)

    engine.load('main.qml')

    win = engine.rootObjects()[0]
    win.show()

    sys.exit(myApp.exec_())
1

There is apparently no easy way that is exposed to the user. It comes down to assigning the _NET_WM_STATE_SKIP_TASKBAR to the window.

See here on Askubuntu for a few possibilities to externally change the window properties after the window has been created. Using devilspie will systematically hide windows that match certain rules from the taskbar. Specific windows can be hidden from the taskbar using wmctrl. This could for example be done in a wrapper startup script.

The better way is to set the window state from within the code of the application where the window is created. For python, it would come down to a statement such as window.set_property("skip-taskbar-hint", True) for GTK. See here for a few hints: https://stackoverflow.com/questions/22256507/how-to-make-a-program-skip-the-task-bar-task-list-in-gnu-linux.

|improve this answer|||||
  • What about NoDisplay=true in that application's .desktop file? Would that help? – DK Bose Jan 6 at 10:15
  • My first thaught was to look into the desktop file. That would hide it from the menus, but indeed, it could hide it from the taskbar as well. I will need to test! – vanadium Jan 6 at 12:34
  • 1
    Nope, it is as I taught. The item is hidden from the menu, but appears on the Dock when running. – vanadium Jan 6 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.