refactor(bspwm): Better socket handling
- Reconnect on POLLHUP - Switch desktop using socket instead of std::system() Fixes jaagr/lemonbuddy#27
This commit is contained in:
parent
99cb53a565
commit
b8a1dd628e
2 changed files with 85 additions and 27 deletions
include/modules
|
@ -10,8 +10,13 @@
|
|||
|
||||
namespace modules
|
||||
{
|
||||
namespace Bspwm
|
||||
namespace bspwm
|
||||
{
|
||||
typedef struct payload_t {
|
||||
char data[BUFSIZ];
|
||||
size_t len = 0;
|
||||
} payload_t;
|
||||
|
||||
enum Flag
|
||||
{
|
||||
WORKSPACE_NONE,
|
||||
|
@ -53,10 +58,10 @@ namespace modules
|
|||
|
||||
static constexpr auto EVENT_CLICK = "bwm";
|
||||
|
||||
std::map<Bspwm::Flag, std::unique_ptr<drawtypes::Label>> mode_labels;
|
||||
std::map<Bspwm::Flag, std::unique_ptr<drawtypes::Label>> state_labels;
|
||||
std::map<bspwm::Flag, std::unique_ptr<drawtypes::Label>> mode_labels;
|
||||
std::map<bspwm::Flag, std::unique_ptr<drawtypes::Label>> state_labels;
|
||||
|
||||
std::vector<std::unique_ptr<Bspwm::Workspace>> workspaces;
|
||||
std::vector<std::unique_ptr<bspwm::Workspace>> workspaces;
|
||||
std::vector<std::unique_ptr<drawtypes::Label>*> modes;
|
||||
|
||||
std::unique_ptr<drawtypes::IconMap> icons;
|
||||
|
@ -67,7 +72,7 @@ namespace modules
|
|||
|
||||
public:
|
||||
BspwmModule(std::string name, std::string monitor);
|
||||
~BspwmModule() { close(this->socket_fd); }
|
||||
~BspwmModule();
|
||||
|
||||
void start();
|
||||
bool has_event();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue