mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-05-13 07:10:35 +01:00
hyprctl: Add IPC support for Hyprsunset (#9315)
* Add IPC support for Hyprsunset * clang-format * Add documentation
This commit is contained in:
parent
fa246cb6ed
commit
2cfa5d2408
2 changed files with 19 additions and 0 deletions
|
@ -22,6 +22,7 @@ commands:
|
||||||
getoption <option> → Gets the config option status (values)
|
getoption <option> → Gets the config option status (values)
|
||||||
globalshortcuts → Lists all global shortcuts
|
globalshortcuts → Lists all global shortcuts
|
||||||
hyprpaper ... → Issue a hyprpaper request
|
hyprpaper ... → Issue a hyprpaper request
|
||||||
|
hyprsunset ... → Issue a hyprsunset request
|
||||||
instances → Lists all running instances of Hyprland with
|
instances → Lists all running instances of Hyprland with
|
||||||
their info
|
their info
|
||||||
keyword <name> <value> → Issue a keyword to call a config keyword
|
keyword <name> <value> → Issue a keyword to call a config keyword
|
||||||
|
@ -81,6 +82,16 @@ requests:
|
||||||
flags:
|
flags:
|
||||||
See 'hyprctl --help')#";
|
See 'hyprctl --help')#";
|
||||||
|
|
||||||
|
const std::string_view HYPRSUNSET_HELP = R"#(usage: hyprctl [flags] hyprsunset <request>
|
||||||
|
|
||||||
|
requests:
|
||||||
|
temperature <temp> → Enable blue-light filter
|
||||||
|
identity → Disable blue-light filter
|
||||||
|
gamma <gamma> → Enable gamma filter
|
||||||
|
|
||||||
|
flags:
|
||||||
|
See 'hyprctl --help')#";
|
||||||
|
|
||||||
const std::string_view NOTIFY_HELP = R"#(usage: hyprctl [flags] notify <icon> <time_ms> <color> <message...>
|
const std::string_view NOTIFY_HELP = R"#(usage: hyprctl [flags] notify <icon> <time_ms> <color> <message...>
|
||||||
|
|
||||||
icon:
|
icon:
|
||||||
|
|
|
@ -282,6 +282,10 @@ int requestHyprpaper(std::string arg) {
|
||||||
return requestIPC(".hyprpaper.sock", arg);
|
return requestIPC(".hyprpaper.sock", arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int requestHyprsunset(std::string arg) {
|
||||||
|
return requestIPC(".hyprsunset.sock", arg);
|
||||||
|
}
|
||||||
|
|
||||||
void batchRequest(std::string arg, bool json) {
|
void batchRequest(std::string arg, bool json) {
|
||||||
std::string commands = arg.substr(arg.find_first_of(' ') + 1);
|
std::string commands = arg.substr(arg.find_first_of(' ') + 1);
|
||||||
|
|
||||||
|
@ -386,6 +390,8 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
if (cmd == "hyprpaper") {
|
if (cmd == "hyprpaper") {
|
||||||
std::println("{}", HYPRPAPER_HELP);
|
std::println("{}", HYPRPAPER_HELP);
|
||||||
|
} else if (cmd == "hyprsunset") {
|
||||||
|
std::println("{}", HYPRSUNSET_HELP);
|
||||||
} else if (cmd == "notify") {
|
} else if (cmd == "notify") {
|
||||||
std::println("{}", NOTIFY_HELP);
|
std::println("{}", NOTIFY_HELP);
|
||||||
} else if (cmd == "output") {
|
} else if (cmd == "output") {
|
||||||
|
@ -467,6 +473,8 @@ int main(int argc, char** argv) {
|
||||||
batchRequest(fullRequest, json);
|
batchRequest(fullRequest, json);
|
||||||
else if (fullRequest.contains("/hyprpaper"))
|
else if (fullRequest.contains("/hyprpaper"))
|
||||||
exitStatus = requestHyprpaper(fullRequest);
|
exitStatus = requestHyprpaper(fullRequest);
|
||||||
|
else if (fullRequest.contains("/hyprsunset"))
|
||||||
|
exitStatus = requestHyprsunset(fullRequest);
|
||||||
else if (fullRequest.contains("/switchxkblayout"))
|
else if (fullRequest.contains("/switchxkblayout"))
|
||||||
exitStatus = request(fullRequest, 2);
|
exitStatus = request(fullRequest, 2);
|
||||||
else if (fullRequest.contains("/seterror"))
|
else if (fullRequest.contains("/seterror"))
|
||||||
|
|
Loading…
Reference in a new issue