add hyprland socket support
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <gtk4-layer-shell/gtk4-layer-shell.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include "services/hyprland.hpp"
|
||||
#include "widgets/clock.hpp"
|
||||
|
||||
|
||||
class Bar : public Gtk::Window {
|
||||
public:
|
||||
class Bar : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
Bar();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
Clock clock;
|
||||
HyprlandService hyprland;
|
||||
Gtk::CenterBox main_box{};
|
||||
|
||||
void setup_ui();
|
||||
|
||||
28
include/services/hyprland.hpp
Normal file
28
include/services/hyprland.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <glibmm.h>
|
||||
#include <sigc++/sigc++.h>
|
||||
#include <string>
|
||||
|
||||
class HyprlandService
|
||||
{
|
||||
public:
|
||||
HyprlandService();
|
||||
~HyprlandService();
|
||||
|
||||
// Setup the connection
|
||||
void start();
|
||||
|
||||
// Signal that emits (EventName, EventData)
|
||||
// Example: emits ("workspace", "1")
|
||||
sigc::signal<void(std::string, std::string)> on_event;
|
||||
void on_hyprland_event(std::string event, std::string data);
|
||||
|
||||
private:
|
||||
int m_fd = -1; // File descriptor for the socket
|
||||
std::string m_buffer; // Buffer to handle partial socket reads
|
||||
|
||||
bool on_socket_read(Glib::IOCondition condition);
|
||||
void parse_message(const std::string &line);
|
||||
std::string get_socket_path();
|
||||
};
|
||||
@@ -1,12 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtkmm/label.h>
|
||||
#include <gtkmm.h>
|
||||
#include <gtk4-layer-shell/gtk4-layer-shell.h>
|
||||
#include <gtkmm.h>
|
||||
#include <gtkmm/label.h>
|
||||
|
||||
#include "interface/updateable.ipp"
|
||||
|
||||
class Clock : public Gtk::Label, public IUpdatable {
|
||||
public:
|
||||
class Clock : public Gtk::Label, public IUpdatable
|
||||
{
|
||||
public:
|
||||
bool onUpdate();
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user