Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IPC support for Hyprsunset #9315

Merged
merged 3 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions hyprctl/Strings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const std::string_view USAGE = R"#(usage: hyprctl [flags] <command> [args...|--h
getoption <option> → Gets the config option status (values)
globalshortcuts → Lists all global shortcuts
hyprpaper ... → Issue a hyprpaper request
hyprsunset ... → Issue a hyprsunset request
instances → Lists all running instances of Hyprland with
their info
keyword <name> <value> → Issue a keyword to call a config keyword
Expand Down Expand Up @@ -81,6 +82,16 @@ const std::string_view HYPRPAPER_HELP = R"#(usage: hyprctl [flags] hyprpaper <re
flags:
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...>

icon:
Expand Down
8 changes: 8 additions & 0 deletions hyprctl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ int requestHyprpaper(std::string arg) {
return requestIPC(".hyprpaper.sock", arg);
}

int requestHyprsunset(std::string arg) {
return requestIPC(".hyprsunset.sock", arg);
}

void batchRequest(std::string arg, bool json) {
std::string commands = arg.substr(arg.find_first_of(' ') + 1);

Expand Down Expand Up @@ -386,6 +390,8 @@ int main(int argc, char** argv) {

if (cmd == "hyprpaper") {
std::println("{}", HYPRPAPER_HELP);
} else if (cmd == "hyprsunset") {
std::println("{}", HYPRSUNSET_HELP);
} else if (cmd == "notify") {
std::println("{}", NOTIFY_HELP);
} else if (cmd == "output") {
Expand Down Expand Up @@ -467,6 +473,8 @@ int main(int argc, char** argv) {
batchRequest(fullRequest, json);
else if (fullRequest.contains("/hyprpaper"))
exitStatus = requestHyprpaper(fullRequest);
else if (fullRequest.contains("/hyprsunset"))
exitStatus = requestHyprsunset(fullRequest);
else if (fullRequest.contains("/switchxkblayout"))
exitStatus = request(fullRequest, 2);
else if (fullRequest.contains("/seterror"))
Expand Down
Loading