fix workspace interactivity
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
#include <iostream>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <sigc++/sigc++.h>
|
#include <sigc++/sigc++.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -43,7 +42,7 @@ class HyprlandService {
|
|||||||
void printMonitor(const Monitor &mon) const;
|
void printMonitor(const Monitor &mon) const;
|
||||||
|
|
||||||
sigc::signal<void(std::string, std::string)> socketEventSignal;
|
sigc::signal<void(std::string, std::string)> socketEventSignal;
|
||||||
sigc::signal<void(int)> workspaceStateChanged;
|
sigc::signal<void()> workspaceStateChanged;
|
||||||
sigc::signal<void()> monitorStateChanged;
|
sigc::signal<void()> monitorStateChanged;
|
||||||
|
|
||||||
Monitor *getMonitorById(int id);
|
Monitor *getMonitorById(int id);
|
||||||
@@ -52,14 +51,14 @@ class HyprlandService {
|
|||||||
const Monitor *getMonitorByIndex(std::size_t index) const;
|
const Monitor *getMonitorByIndex(std::size_t index) const;
|
||||||
void switchToWorkspace(int workspaceId);
|
void switchToWorkspace(int workspaceId);
|
||||||
|
|
||||||
std::map<int, WorkspaceState> getAllWorkspaces() const {
|
std::map<int, WorkspaceState*> getAllWorkspaces() const {
|
||||||
return this->workspaces;
|
return this->workspaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
std::map<int, Monitor> monitors;
|
std::map<int, Monitor> monitors;
|
||||||
std::map<int, WorkspaceState> workspaces;
|
std::map<int, WorkspaceState*> workspaces;
|
||||||
|
|
||||||
std::string get_socket_path();
|
std::string get_socket_path();
|
||||||
bool on_socket_read(Glib::IOCondition condition);
|
bool on_socket_read(Glib::IOCondition condition);
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ class WorkspaceIndicator : public Gtk::Box {
|
|||||||
int monitorId;
|
int monitorId;
|
||||||
sigc::connection workspaceConnection;
|
sigc::connection workspaceConnection;
|
||||||
sigc::connection monitorConnection;
|
sigc::connection monitorConnection;
|
||||||
|
std::map<int, Gtk::Label *> workspaceLabels;
|
||||||
|
|
||||||
void rebuild();
|
void rebuild();
|
||||||
void on_workspace_update(int monitorId);
|
void on_workspace_update();
|
||||||
void on_monitor_update();
|
void on_monitor_update();
|
||||||
void clear_children();
|
void refreshLabel(Gtk::Label *label, HyprlandService::WorkspaceState state);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ void Bar::setup_ui() {
|
|||||||
|
|
||||||
trayWidget = Gtk::make_managed<TrayWidget>(trayService);
|
trayWidget = Gtk::make_managed<TrayWidget>(trayService);
|
||||||
right_box.append(*trayWidget);
|
right_box.append(*trayWidget);
|
||||||
right_box.append(homeAssistant);
|
// right_box.append(homeAssistant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bar::load_css() {
|
void Bar::load_css() {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "services/hyprland.hpp"
|
#include "services/hyprland.hpp"
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@@ -35,13 +34,16 @@ HyprlandService::~HyprlandService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HyprlandService::on_hyprland_event(std::string event, std::string data) {
|
void HyprlandService::on_hyprland_event(std::string event, std::string data) {
|
||||||
|
if (event == "monitoradded" || event == "monitorremoved") {
|
||||||
|
refresh_monitors();
|
||||||
|
}
|
||||||
|
|
||||||
if (event == "urgent") {
|
if (event == "urgent") {
|
||||||
handle_urgent_window(data);
|
handle_urgent_window(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_workspace_event(event) || event == "focusedmon" ||
|
if (event == "workspace" || event == "focusedmon" || event == "monitoradded" ||
|
||||||
event == "monitoradded" || event == "monitorremoved") {
|
event == "monitorremoved" || event == "movewindow" || event == "activewindow") {
|
||||||
refresh_monitors();
|
|
||||||
refresh_workspaces();
|
refresh_workspaces();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,7 +82,6 @@ void HyprlandService::start() {
|
|||||||
Glib::IOCondition::IO_ERR);
|
Glib::IOCondition::IO_ERR);
|
||||||
|
|
||||||
refresh_monitors();
|
refresh_monitors();
|
||||||
refresh_workspaces();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HyprlandService::on_socket_read(Glib::IOCondition condition) {
|
bool HyprlandService::on_socket_read(Glib::IOCondition condition) {
|
||||||
@@ -140,26 +141,11 @@ void HyprlandService::refresh_monitors() {
|
|||||||
this->monitors.clear();
|
this->monitors.clear();
|
||||||
this->workspaces.clear();
|
this->workspaces.clear();
|
||||||
|
|
||||||
std::string output;
|
std::string output = SystemHelper::get_command_output(kMonitorCommand);
|
||||||
|
|
||||||
try {
|
|
||||||
output = SystemHelper::get_command_output(kMonitorCommand);
|
|
||||||
} catch (const std::exception &ex) {
|
|
||||||
std::cerr << "[Hyprland] Failed to query monitors: " << ex.what()
|
|
||||||
<< std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto monitorsJson = nlohmann::json::parse(output, nullptr, false);
|
auto monitorsJson = nlohmann::json::parse(output, nullptr, false);
|
||||||
if (!monitorsJson.is_array()) {
|
|
||||||
std::cerr << "[Hyprland] Unexpected monitor payload" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto &monitorJson : monitorsJson) {
|
for (const auto &monitorJson : monitorsJson) {
|
||||||
if (!monitorJson.is_object()) {
|
assert(monitorJson.is_object());
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Monitor monitor;
|
Monitor monitor;
|
||||||
monitor.id = monitorJson.value("id", -1);
|
monitor.id = monitorJson.value("id", -1);
|
||||||
@@ -167,11 +153,7 @@ void HyprlandService::refresh_monitors() {
|
|||||||
monitor.x = monitorJson.value("x", 0);
|
monitor.x = monitorJson.value("x", 0);
|
||||||
monitor.y = monitorJson.value("y", 0);
|
monitor.y = monitorJson.value("y", 0);
|
||||||
|
|
||||||
if (monitorJson.contains("activeWorkspace") &&
|
monitor.focusedWorkspaceId = monitorJson["activeWorkspace"].value("id", -1);
|
||||||
monitorJson["activeWorkspace"].is_object()) {
|
|
||||||
monitor.focusedWorkspaceId =
|
|
||||||
monitorJson["activeWorkspace"].value("id", -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (monitor.id >= 0) {
|
if (monitor.id >= 0) {
|
||||||
this->monitors[monitor.id] = monitor;
|
this->monitors[monitor.id] = monitor;
|
||||||
@@ -181,78 +163,63 @@ void HyprlandService::refresh_monitors() {
|
|||||||
WorkspaceState wsState;
|
WorkspaceState wsState;
|
||||||
wsState.focused = false;
|
wsState.focused = false;
|
||||||
wsState.active = false;
|
wsState.active = false;
|
||||||
wsState.urgentWindows.clear();
|
|
||||||
wsState.label = std::to_string(slot);
|
wsState.label = std::to_string(slot);
|
||||||
wsState.monitorId = monitor.id;
|
wsState.monitorId = monitor.id;
|
||||||
|
|
||||||
int id = slot + monitor.id * HyprlandService::kWorkspaceSlotCount;
|
int id = slot + monitor.id * HyprlandService::kWorkspaceSlotCount;
|
||||||
wsState.hyprId = id;
|
wsState.hyprId = id;
|
||||||
this->workspaces[id] = wsState;
|
this->workspaces[id] = new WorkspaceState(wsState);
|
||||||
this->monitors[monitor.id].workspaceStates[slot] = &this->workspaces[id];
|
this->monitors[monitor.id].workspaceStates[slot] = this->workspaces[id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->refresh_workspaces();
|
||||||
monitorStateChanged.emit();
|
monitorStateChanged.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called every time when workspace changes have been detected.
|
||||||
|
* Used to Update the internal state for the Workspaces,
|
||||||
|
*/
|
||||||
void HyprlandService::refresh_workspaces() {
|
void HyprlandService::refresh_workspaces() {
|
||||||
if (monitors.empty()) {
|
std::string output = SystemHelper::get_command_output(kWorkspaceCommand);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string output;
|
|
||||||
|
|
||||||
try {
|
|
||||||
output = SystemHelper::get_command_output(kWorkspaceCommand);
|
|
||||||
} catch (const std::exception &ex) {
|
|
||||||
std::cerr << "[Hyprland] Failed to query workspaces: " << ex.what()
|
|
||||||
<< std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto workspacesJson = nlohmann::json::parse(output, nullptr, false);
|
auto workspacesJson = nlohmann::json::parse(output, nullptr, false);
|
||||||
if (!workspacesJson.is_array()) {
|
|
||||||
std::cerr << "[Hyprland] Unexpected workspace payload" << std::endl;
|
for (auto &[id, ws] : this->workspaces) {
|
||||||
return;
|
ws->focused = false;
|
||||||
|
ws->active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
output = SystemHelper::get_command_output(kMonitorCommand);
|
||||||
|
auto monitorsJson = nlohmann::json::parse(output, nullptr, false);
|
||||||
|
|
||||||
|
for (const auto &monitorJson : monitorsJson) {
|
||||||
|
|
||||||
|
|
||||||
|
const int monitorId = monitorJson.value("id", -1);
|
||||||
|
const int focusedWorkspaceId = monitorJson["activeWorkspace"].value("id", -1);
|
||||||
|
|
||||||
|
auto monitorIt = this->monitors.find(monitorId);
|
||||||
|
|
||||||
|
monitorIt->second.focusedWorkspaceId = focusedWorkspaceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &workspaceJson : workspacesJson) {
|
for (const auto &workspaceJson : workspacesJson) {
|
||||||
if (!workspaceJson.is_object()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int workspaceId = workspaceJson.value("id", -1);
|
const int workspaceId = workspaceJson.value("id", -1);
|
||||||
|
std::map<int, WorkspaceState *>::iterator workspaceStateIt = this->workspaces.find(workspaceId);
|
||||||
|
WorkspaceState *workspaceState = workspaceStateIt->second;
|
||||||
|
|
||||||
std::cout << "Workspace ID: " << workspaceId << std::endl;
|
|
||||||
|
|
||||||
assert(workspaceId != -1);
|
workspaceState->focused = monitors
|
||||||
|
.at(workspaceState->monitorId)
|
||||||
|
.focusedWorkspaceId ==
|
||||||
|
workspaceId;
|
||||||
|
workspaceState->active = true;
|
||||||
|
|
||||||
std::map<int, WorkspaceState>::iterator workspaceStateIt = this->workspaces.find(workspaceId);
|
this->workspaces[workspaceId] = workspaceState;
|
||||||
|
|
||||||
if (workspaceStateIt == this->workspaces.end()) {
|
|
||||||
assert(false); // should not happen
|
|
||||||
}
|
|
||||||
|
|
||||||
WorkspaceState *workspaceState = &workspaceStateIt->second;
|
|
||||||
workspaceState->hyprId = workspaceId;
|
|
||||||
workspaceState->focused = (this->monitors[workspaceState->monitorId].focusedWorkspaceId == workspaceId);
|
|
||||||
workspaceState->active =
|
|
||||||
workspaceState->focused || workspaceJson.value("windows", 0) > 0;
|
|
||||||
workspaceState->urgentWindows.clear();
|
|
||||||
|
|
||||||
if (workspaceJson.contains("urgent") &&
|
|
||||||
workspaceJson["urgent"].is_boolean()) {
|
|
||||||
if (workspaceJson["urgent"].get<bool>()) {
|
|
||||||
workspaceState->urgentWindows.push_back(workspaceId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->workspaces[workspaceId] = *workspaceState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &pair : monitors) {
|
workspaceStateChanged.emit();
|
||||||
workspaceStateChanged.emit(pair.first);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HyprlandService::Monitor *HyprlandService::getMonitorById(int id) {
|
HyprlandService::Monitor *HyprlandService::getMonitorById(int id) {
|
||||||
@@ -275,15 +242,14 @@ const HyprlandService::Monitor *HyprlandService::getMonitorById(int id) const {
|
|||||||
return &it->second;
|
return &it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
HyprlandService::Monitor *
|
HyprlandService::Monitor *HyprlandService::getMonitorByIndex(std::size_t index) {
|
||||||
HyprlandService::getMonitorByIndex(std::size_t index) {
|
|
||||||
if (index >= monitors.size()) {
|
if (index >= monitors.size()) {
|
||||||
throw std::runtime_error("Monitor index out of bounds: " +
|
throw std::runtime_error("Monitor index out of bounds: " + std::to_string(index));
|
||||||
std::to_string(index));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto it = monitors.begin();
|
auto it = monitors.begin();
|
||||||
std::advance(it, static_cast<long>(index));
|
std::advance(it, static_cast<long>(index));
|
||||||
|
|
||||||
return &it->second;
|
return &it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,60 +266,35 @@ void HyprlandService::switchToWorkspace(int workspaceId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HyprlandService::handle_urgent_window(std::string windowAddress) {
|
void HyprlandService::handle_urgent_window(std::string windowAddress) {
|
||||||
std::string output;
|
std::string output = SystemHelper::get_command_output(kClientsCommand);
|
||||||
// TODO: fix bugs first
|
|
||||||
return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
output = SystemHelper::get_command_output(kClientsCommand);
|
|
||||||
} catch (const std::exception &ex) {
|
|
||||||
std::cerr << "[Hyprland] Failed to query clients: " << ex.what()
|
|
||||||
<< std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto clientsJson = nlohmann::json::parse(output, nullptr, false);
|
auto clientsJson = nlohmann::json::parse(output, nullptr, false);
|
||||||
if (!clientsJson.is_array()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int workspaceId = -1;
|
for (const auto &clientJson : clientsJson) {
|
||||||
|
if (!clientJson.is_object()) {
|
||||||
for (const auto &client : clientsJson) {
|
|
||||||
if (!client.is_object())
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string addr = client.value("address", "");
|
|
||||||
if (addr == "0x" + windowAddress) {
|
|
||||||
if (client.contains("workspace") &&
|
|
||||||
client["workspace"].is_object()) {
|
|
||||||
workspaceId = client["workspace"].value("id", -1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (workspaceId == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto &pair : monitors) {
|
|
||||||
auto &monitor = pair.second;
|
|
||||||
bool changed = false;
|
|
||||||
|
|
||||||
for (auto &wsPair : monitor.workspaceStates) {
|
|
||||||
if (wsPair.second->hyprId == workspaceId) {
|
|
||||||
if (wsPair.second->urgentWindows.empty()) {
|
|
||||||
wsPair.second->urgentWindows.push_back(workspaceId);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
const std::string addr = clientJson.value("address", "");
|
||||||
this->workspaceStateChanged.emit(monitor.id);
|
if (addr != windowAddress) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int workspaceId = clientJson.value("workspace", -1);
|
||||||
|
if (workspaceId < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto workspaceIt = this->workspaces.find(workspaceId);
|
||||||
|
if (workspaceIt == this->workspaces.end()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkspaceState *wsState = workspaceIt->second;
|
||||||
|
wsState->urgentWindows.push_back(1);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
workspaceStateChanged.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HyprlandService::printMonitor(const Monitor &mon) const {
|
void HyprlandService::printMonitor(const Monitor &mon) const {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "widgets/workspaceIndicator.hpp"
|
#include "widgets/workspaceIndicator.hpp"
|
||||||
|
#include "services/hyprland.hpp"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gtkmm/gestureclick.h>
|
#include <gtkmm/gestureclick.h>
|
||||||
#include <gtkmm/widget.h>
|
#include <gtkmm/widget.h>
|
||||||
@@ -16,6 +18,23 @@ WorkspaceIndicator::WorkspaceIndicator(HyprlandService &service, int monitorId)
|
|||||||
monitorConnection = service.monitorStateChanged.connect(
|
monitorConnection = service.monitorStateChanged.connect(
|
||||||
sigc::mem_fun(*this, &WorkspaceIndicator::on_monitor_update));
|
sigc::mem_fun(*this, &WorkspaceIndicator::on_monitor_update));
|
||||||
|
|
||||||
|
for (int i = 1; i <= HyprlandService::kWorkspaceSlotCount; ++i) {
|
||||||
|
auto label = Gtk::make_managed<Gtk::Label>(std::to_string(i));
|
||||||
|
label->add_css_class("workspace-pill");
|
||||||
|
|
||||||
|
auto gesture = Gtk::GestureClick::create();
|
||||||
|
gesture->set_button(GDK_BUTTON_PRIMARY);
|
||||||
|
gesture->signal_released().connect(
|
||||||
|
[this, i, &service](int, double, double) {
|
||||||
|
service.switchToWorkspace(
|
||||||
|
i + this->monitorId * HyprlandService::kWorkspaceSlotCount);
|
||||||
|
});
|
||||||
|
label->add_controller(gesture);
|
||||||
|
|
||||||
|
workspaceLabels[i] = label;
|
||||||
|
append(*label);
|
||||||
|
}
|
||||||
|
|
||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,53 +48,42 @@ WorkspaceIndicator::~WorkspaceIndicator() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceIndicator::on_workspace_update(int monitorId) {
|
void WorkspaceIndicator::on_workspace_update() {
|
||||||
if (this->monitorId != monitorId && monitorId != -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceIndicator::on_monitor_update() { rebuild(); }
|
void WorkspaceIndicator::on_monitor_update() { rebuild(); }
|
||||||
|
|
||||||
|
void WorkspaceIndicator::refreshLabel(Gtk::Label *label, HyprlandService::WorkspaceState state) {
|
||||||
|
label->remove_css_class("workspace-pill-active");
|
||||||
|
label->remove_css_class("workspace-pill-focused");
|
||||||
|
label->remove_css_class("workspace-pill-urgent");
|
||||||
|
|
||||||
|
auto gesture = Gtk::GestureClick::create();
|
||||||
|
gesture->set_button(GDK_BUTTON_PRIMARY);
|
||||||
|
gesture->signal_released().connect(
|
||||||
|
[this, state](int, double, double) {
|
||||||
|
service.switchToWorkspace(state.hyprId);
|
||||||
|
});
|
||||||
|
label->add_controller(gesture);
|
||||||
|
|
||||||
|
if (state.urgentWindows.size() > 0) {
|
||||||
|
label->add_css_class("workspace-pill-urgent");
|
||||||
|
} else {
|
||||||
|
if (state.focused) {
|
||||||
|
label->add_css_class("workspace-pill-focused");
|
||||||
|
} else if (state.active) {
|
||||||
|
label->add_css_class("workspace-pill-active");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WorkspaceIndicator::rebuild() {
|
void WorkspaceIndicator::rebuild() {
|
||||||
HyprlandService hypr = this->service;
|
HyprlandService::Monitor *mon = service.getMonitorById(this->monitorId);
|
||||||
int i = 0;
|
|
||||||
for (auto &[id, workspaceState] : hypr.getAllWorkspaces()) {
|
|
||||||
if (workspaceState.monitorId != this->monitorId) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (auto [id, workspaceState] : mon->workspaceStates) {
|
||||||
auto label = Gtk::make_managed<Gtk::Label>(workspaceState.label);
|
assert(id > 0);
|
||||||
label->add_css_class("workspace-pill");
|
Gtk::Label *label = workspaceLabels[id];
|
||||||
|
this->refreshLabel(label, *workspaceState);
|
||||||
auto gesture = Gtk::GestureClick::create();
|
|
||||||
gesture->set_button(GDK_BUTTON_PRIMARY);
|
|
||||||
gesture->signal_released().connect(
|
|
||||||
[this, id](int, double, double) { service.switchToWorkspace(id); });
|
|
||||||
label->add_controller(gesture);
|
|
||||||
|
|
||||||
if (workspaceState.urgentWindows.empty()) {
|
|
||||||
if (workspaceState.focused) {
|
|
||||||
label->add_css_class("workspace-pill-focused");
|
|
||||||
} else if (workspaceState.active) {
|
|
||||||
label->add_css_class("workspace-pill-active");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
label->add_css_class("workspace-pill-urgent");
|
|
||||||
}
|
|
||||||
|
|
||||||
append(*label);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorkspaceIndicator::clear_children() {
|
|
||||||
Gtk::Widget *child = get_first_child();
|
|
||||||
while (child != nullptr) {
|
|
||||||
Gtk::Widget *next = child->get_next_sibling();
|
|
||||||
remove(*child);
|
|
||||||
child = next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user