mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-10-10 10:40:04 -05:00
Some checks failed
debian-build / build (push) Has been cancelled
Check locale / ubuntu64 (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <map>
|
|
#include <mutex>
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace advss {
|
|
|
|
class FocusNotifier final : public QObject {
|
|
Q_OBJECT
|
|
Q_CLASSINFO("D-Bus Interface",
|
|
"com.obsproject.Studio.Plugin.SceneSwitcher")
|
|
|
|
static std::mutex _mutex;
|
|
static int activePID;
|
|
static std::string activeTitle;
|
|
// Maps KWin internal window ID to {pid, title}
|
|
static std::map<std::string, std::pair<int, std::string>> _windows;
|
|
|
|
public:
|
|
using QObject::QObject;
|
|
|
|
static int getActiveWindowPID();
|
|
static std::string getActiveWindowTitle();
|
|
static std::vector<std::pair<int, std::string>> getWindowList();
|
|
|
|
public slots:
|
|
void focusChanged(const int pid);
|
|
void focusTitle(const QString &title);
|
|
void focusUpdate(const int pid, const QString &title);
|
|
void windowAdded(const QString &id, const int pid,
|
|
const QString &title);
|
|
void windowRemoved(const QString &id);
|
|
void windowTitleChanged(const QString &id, const QString &title);
|
|
};
|
|
|
|
bool isKWinAvailable();
|
|
bool startKWinScript(QString &scriptObjectPath);
|
|
bool stopKWinScript(const QString &scriptObjectPath);
|
|
bool registerKWinDBusListener(FocusNotifier *notifier);
|
|
void printDBusError();
|
|
|
|
} // namespace advss
|