Using macros instead of hardcoded paths
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
#ifndef HYPRLAND_SERVICE_H
|
||||
#define HYPRLAND_SERVICE_H
|
||||
|
||||
#define HYPRLAND_CONF_DIR "~/.config/hypr/"
|
||||
#define FLOATING_RULE_CONF_FILE HYPRLAND_CONF_DIR "hyprland/floatbydefault.conf"
|
||||
#define HYPRCTL_BINARY "/usr/bin/hyprctl"
|
||||
#define NULL_PATH "/dev/null"
|
||||
#define SET_FLOATING_RULE "/usr/bin/echo 'windowrule = float,class:.*' > " FLOATING_RULE_CONF_FILE
|
||||
#define REMOVE_FLOATING_RULE "/usr/bin/cat " NULL_PATH " > " FLOATING_RULE_CONF_FILE
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include "Workspace.h"
|
||||
|
||||
@@ -24,12 +24,12 @@ std::string HyprlandService::exec(const std::string& command) {
|
||||
};
|
||||
|
||||
Workspace HyprlandService::getCurrentWorkspace() {
|
||||
json j = json::parse(exec("/usr/bin/hyprctl activeworkspace -j"));
|
||||
json j = json::parse(exec(HYPRCTL_BINARY " activeworkspace -j"));
|
||||
return j.get<Workspace>();
|
||||
};
|
||||
|
||||
std::list<Client> HyprlandService::getClients() {
|
||||
json j = json::parse(exec("/usr/bin/hyprctl clients -j"));
|
||||
json j = json::parse(exec(HYPRCTL_BINARY " clients -j"));
|
||||
return j.get<std::list<Client>>();
|
||||
};
|
||||
|
||||
@@ -49,11 +49,11 @@ std::list<Client> HyprlandService::getClientsOnActiveWorkspace() {
|
||||
};
|
||||
|
||||
void HyprlandService::setClientFloating(Client& c) {
|
||||
exec("/usr/bin/hyprctl dispatch setfloating address:" + c.address);
|
||||
exec(HYPRCTL_BINARY " dispatch setfloating address:" + c.address);
|
||||
};
|
||||
|
||||
void HyprlandService::setClientTiled(Client& c) {
|
||||
exec("/usr/bin/hyprctl dispatch settiled address:" + c.address);
|
||||
exec(HYPRCTL_BINARY " dispatch settiled address:" + c.address);
|
||||
}
|
||||
|
||||
void HyprlandService::toggleClientFloating(Client& c) {
|
||||
|
||||
Reference in New Issue
Block a user