diff --git a/PKGBUILD b/PKGBUILD index 9220530..05fdbe3 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -21,7 +21,7 @@ optdepends=("amarok: for music player monitor" makedepends=('automoc4' 'cmake') source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz) install=${pkgname}.install -md5sums=('b5f8383c198e7059f463678f84a16273') +md5sums=('23b3f2f2d0a8bd87354d721cbf43ee22') backup=('usr/share/config/extsysmon.conf') changelog=CHANGELOG diff --git a/sources/desktop-panel/desktop-panel.cpp b/sources/desktop-panel/desktop-panel.cpp index 08dd4ef..c3b4b23 100644 --- a/sources/desktop-panel/desktop-panel.cpp +++ b/sources/desktop-panel/desktop-panel.cpp @@ -22,17 +22,24 @@ #include #include #include -#include +#include +#include +#include +#include +#include #include #include #include #include +#include #include #include CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num) - : Plasma::Label(wid) + : Plasma::Label(wid), + number(num), + widget(wid) { // debug QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); @@ -42,10 +49,7 @@ CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num) else debug = false; - if (debug) qDebug() << "[PTM-DP]" << "Init label" << num; - - number = num; - widget = wid; + if (debug) qDebug() << "[PTM-DP]" << "Init label" << number; } @@ -115,6 +119,7 @@ void DesktopPanel::init() // read variables configChanged(); + connect(this, SIGNAL(activate()), this, SLOT(changePanelsState())); } @@ -155,6 +160,21 @@ QStringList DesktopPanel::getDesktopNames() } +QList DesktopPanel::getPanels() +{ + if (debug) qDebug() << "[PTM-DP]" << "[getPanels]"; + + QList panels; + for (int i=0; icorona()->containments().count(); i++) { + qDebug() << containment()->corona()->containments()[i]->containmentType(); + if (containment()->corona()->containments()[i]->containmentType() == Plasma::Containment::PanelContainment) + panels.append(containment()->corona()->containments()[i]); + } + + return panels; +} + + QString DesktopPanel::parsePattern(const QString rawLine, const int num) { if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]"; @@ -231,6 +251,30 @@ void DesktopPanel::reinit() } +void DesktopPanel::changePanelsState() +{ + if (debug) qDebug() << "[PTM-DP]" << "[changePanelsState]"; + + QList panels = getPanels(); + for (int i=0; iview()->isVisible(); + int winId = panels[i]->view()->winId(); + if (wasVisible) { + if (debug) qDebug() << "[PTM-DP]" << "[changePanelsState]" << ":" << "Hide panel"; + KWindowInfo oldInfo = KWindowSystem::windowInfo(winId, NET::WMState); + oldState = oldInfo.state(); + panels[i]->view()->setVisible(false); + } else { + if (debug) qDebug() << "[PTM-DP]" << "[changePanelsState]" << ":" << "Show panel"; + panels[i]->view()->setVisible(true); + KWindowSystem::clearState(winId, NET::KeepAbove); + KWindowSystem::setState(winId, oldState | NET::StaysOnTop); + KWindowSystem::setOnAllDesktops(winId, true); + } + } +} + + int DesktopPanel::setCurrentDesktop(const int number) { if (debug) qDebug() << "[PTM-DP]" << "[setCurrentDesktop]"; diff --git a/sources/desktop-panel/desktop-panel.h b/sources/desktop-panel/desktop-panel.h index 3ba643a..1f29389 100644 --- a/sources/desktop-panel/desktop-panel.h +++ b/sources/desktop-panel/desktop-panel.h @@ -68,7 +68,8 @@ public slots: // configuration interface void configAccepted(); void configChanged(); - // event + // events + void changePanelsState(); int setCurrentDesktop(const int number); private slots: @@ -80,6 +81,7 @@ protected: private: // functions QStringList getDesktopNames(); + QList getPanels(); void updateText(); // ui QGraphicsLinearLayout *layout; @@ -88,6 +90,7 @@ private: bool debug; // data engine int currentDesktop; + int oldState; Plasma::DataEngine *extsysmonEngine; // configuration interface Ui::AppearanceWidget uiAppConfig; diff --git a/sources/ext-sysmon/extsysmon.cpp b/sources/ext-sysmon/extsysmon.cpp index f2cac7e..b91d1d7 100644 --- a/sources/ext-sysmon/extsysmon.cpp +++ b/sources/ext-sysmon/extsysmon.cpp @@ -46,7 +46,6 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args) setMinimumPollingInterval(333); readConfiguration(); - setKeys(); } @@ -164,43 +163,6 @@ QStringList ExtendedSysMon::sources() const } -void ExtendedSysMon::setKeys() -{ - if (debug) qDebug() << "[DE]" << "[setKeys]"; - - // custom - for (int i=0; itoUnicode(process.output).trimmed(); + int count = 0; + for (int i=0; i updateConfiguration(const QMap rawConfig); };