GODT-1427: fix window status tray-icon for i3 wm [skip-ci]

This commit is contained in:
Romain LE JEUNE
2022-08-24 21:29:41 +02:00
committed by Jakub
parent 35bc5de40f
commit a9c038bcb6
3 changed files with 19 additions and 1 deletions

View File

@ -41,9 +41,23 @@ QMLBackend::QMLBackend()
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
void QMLBackend::init() void QMLBackend::init()
{ {
users_ = new UserList(this); users_ = new UserList(this);
app().grpc().setLog(&app().log()); app().grpc().setLog(&app().log());
#ifdef Q_OS_LINUX
QProcess process;
QString pidof("pidof");
QStringList args = QStringList() << "i3";
process.start(pidof, args);
process.waitForReadyRead();
if(!process.readAllStandardOutput().isEmpty()) {
useQtDialogFlag_ = true;
app().log().info("Bridge is running on i3 Window manager.");
}
#endif // Q_OS_LiNUX
this->connectGrpcEvents(); this->connectGrpcEvents();
QString error; QString error;

View File

@ -78,6 +78,7 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
Q_PROPERTY(QString currentKeychain READ currentKeychain NOTIFY currentKeychainChanged) // _ string `property:"currentKeychain"` Q_PROPERTY(QString currentKeychain READ currentKeychain NOTIFY currentKeychainChanged) // _ string `property:"currentKeychain"`
Q_PROPERTY(UserList* users MEMBER users_ NOTIFY usersChanged) Q_PROPERTY(UserList* users MEMBER users_ NOTIFY usersChanged)
Q_PROPERTY(bool dockIconVisible READ dockIconVisible WRITE setDockIconVisible NOTIFY dockIconVisibleChanged) // _ bool `property:dockIconVisible` Q_PROPERTY(bool dockIconVisible READ dockIconVisible WRITE setDockIconVisible NOTIFY dockIconVisibleChanged) // _ bool `property:dockIconVisible`
Q_PROPERTY(bool useQtDialogFlag READ useQtDialogFlag NOTIFY useQtDialogFlagChanged) // _ bool `property:useQtDialogFlag`
// Qt Property system setters & getters. // Qt Property system setters & getters.
bool showOnStartup() const { bool v = false; app().grpc().showOnStartup(v); return v; }; bool showOnStartup() const { bool v = false; app().grpc().showOnStartup(v); return v; };
@ -109,6 +110,7 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
QString currentKeychain() const { QString keychain; app().grpc().currentKeychain(keychain); return keychain; } QString currentKeychain() const { QString keychain; app().grpc().currentKeychain(keychain); return keychain; }
bool dockIconVisible() const { return getDockIconVisibleState(); }; bool dockIconVisible() const { return getDockIconVisibleState(); };
void setDockIconVisible(bool visible) { setDockIconVisibleState(visible); emit dockIconVisibleChanged(visible); } void setDockIconVisible(bool visible) { setDockIconVisibleState(visible); emit dockIconVisibleChanged(visible); }
bool useQtDialogFlag() const { return useQtDialogFlag_; }
signals: // Signal used by the Qt property system. Many of them are unused but required to avoir warning from the QML engine. signals: // Signal used by the Qt property system. Many of them are unused but required to avoir warning from the QML engine.
void showSplashScreenChanged(bool value); void showSplashScreenChanged(bool value);
@ -138,6 +140,7 @@ signals: // Signal used by the Qt property system. Many of them are unused but r
void portSMTPChanged(int port); void portSMTPChanged(int port);
void usersChanged(UserList* users); void usersChanged(UserList* users);
void dockIconVisibleChanged(bool value); void dockIconVisibleChanged(bool value);
void useQtDialogFlagChanged(bool value);
public slots: // slot for signals received from QML -> To be forwarded to Bridge via RPC Client calls. public slots: // slot for signals received from QML -> To be forwarded to Bridge via RPC Client calls.
void toggleAutostart(bool active); // _ func(makeItActive bool) `slot:"toggleAutostart"` void toggleAutostart(bool active); // _ func(makeItActive bool) `slot:"toggleAutostart"`
@ -223,6 +226,7 @@ private: // data members
QString goos_; ///< The cached version of the GOOS variable. QString goos_; ///< The cached version of the GOOS variable.
QUrl logsPath_; ///< The logs path. Retrieved from bridge on startup. QUrl logsPath_; ///< The logs path. Retrieved from bridge on startup.
QUrl licensePath_; ///< The license path. Retrieved from bridge on startup. QUrl licensePath_; ///< The license path. Retrieved from bridge on startup.
bool useQtDialogFlag_ { false }; ///< Define if the status window needs to propose QtDialog flag (i3wm case)
friend class AppController; friend class AppController;
}; };

View File

@ -30,7 +30,7 @@ Window {
height: contentLayout.implicitHeight height: contentLayout.implicitHeight
width: contentLayout.implicitWidth width: contentLayout.implicitWidth
flags: (Qt.platform.os === "linux" ? Qt.Tool : 0) | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint | Qt.WindowStaysOnTopHint | Qt.WA_TranslucentBackground flags: (Qt.platform.os === "linux" ? Qt.Tool : 0) | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint | Qt.WindowStaysOnTopHint | Qt.WA_TranslucentBackground | (Backend.useQtDialogFlag ? Qt.Dialog : 0)
color: "transparent" color: "transparent"
property ColorScheme colorScheme: ProtonStyle.currentStyle property ColorScheme colorScheme: ProtonStyle.currentStyle