Skip to content

Commit

Permalink
clipctl: add reload command
Browse files Browse the repository at this point in the history
  • Loading branch information
N-R-K committed Jun 8, 2024
1 parent a5f4f50 commit 5ff8284
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/clipctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static bool _nonnull_ should_enable(struct config *cfg, const char *mode_str) {

int main(int argc, char *argv[]) {
_drop_(config_free) struct config cfg = setup("clipctl");
die_on(argc != 2, "Usage: clipctl <enable|disable|toggle|status>\n");
die_on(argc != 2, "Usage: clipctl <enable|disable|toggle|reload|status>\n");

pid_t pid = get_clipmenud_pid();
die_on(pid == -ENOENT, "clipmenud is not running\n");
Expand All @@ -82,6 +82,10 @@ int main(int argc, char *argv[]) {
if (streq(argv[1], "status")) {
printf("%s\n", is_enabled(&cfg) ? "enabled" : "disabled");
return 0;
} else if (streq(argv[1], "reload")) {
expect(kill(pid, SIGHUP) == 0);
dbg("Sent signal to pid %d\n", pid);
return 0;
}

bool want_enable = should_enable(&cfg, argv[1]);
Expand Down

0 comments on commit 5ff8284

Please sign in to comment.