mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:25:58 +01:00
hyprctl: fix hyprpaper
This commit is contained in:
parent
38814e8a95
commit
3fc4ac07e0
1 changed files with 6 additions and 8 deletions
|
@ -193,20 +193,15 @@ void requestHyprpaper(std::string arg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the instance signature
|
if (instanceSignature.empty()) {
|
||||||
auto instanceSig = getenv("HYPRLAND_INSTANCE_SIGNATURE");
|
|
||||||
|
|
||||||
if (!instanceSig) {
|
|
||||||
std::cout << "HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)";
|
std::cout << "HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string instanceSigStr = std::string(instanceSig);
|
|
||||||
|
|
||||||
sockaddr_un serverAddress = {0};
|
sockaddr_un serverAddress = {0};
|
||||||
serverAddress.sun_family = AF_UNIX;
|
serverAddress.sun_family = AF_UNIX;
|
||||||
|
|
||||||
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.hyprpaper.sock";
|
std::string socketPath = "/tmp/hypr/" + instanceSignature + "/.hyprpaper.sock";
|
||||||
|
|
||||||
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
|
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
|
||||||
|
|
||||||
|
@ -215,6 +210,9 @@ void requestHyprpaper(std::string arg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
arg = arg.substr(arg.find_first_of('/') + 1); // strip flags
|
||||||
|
arg = arg.substr(arg.find_first_of(' ') + 1); // strip "hyprpaper"
|
||||||
|
|
||||||
auto sizeWritten = write(SERVERSOCKET, arg.c_str(), arg.length());
|
auto sizeWritten = write(SERVERSOCKET, arg.c_str(), arg.length());
|
||||||
|
|
||||||
if (sizeWritten < 0) {
|
if (sizeWritten < 0) {
|
||||||
|
@ -430,7 +428,7 @@ int main(int argc, char** argv) {
|
||||||
else if (fullRequest.contains("/keyword"))
|
else if (fullRequest.contains("/keyword"))
|
||||||
request(fullRequest, 2);
|
request(fullRequest, 2);
|
||||||
else if (fullRequest.contains("/hyprpaper"))
|
else if (fullRequest.contains("/hyprpaper"))
|
||||||
request(fullRequest, 2);
|
requestHyprpaper(fullRequest);
|
||||||
else if (fullRequest.contains("/--help"))
|
else if (fullRequest.contains("/--help"))
|
||||||
printf("%s", USAGE.c_str());
|
printf("%s", USAGE.c_str());
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue