diff options
author | 2016-07-14 13:06:42 -0400 | |
---|---|---|
committer | 2016-07-14 13:06:42 -0400 | |
commit | 136387144cdcaa65c693fb4ffeed437bdd85235f (patch) | |
tree | cbcf54a3154b1baab1d4cbf52ccca3f89accc4fb /swaylock | |
parent | Merge pull request #749 from Hummer12007/patch-2 (diff) | |
parent | swaylock: Add -f option to detach from the controlling terminal, fixes #725 (diff) | |
download | sway-136387144cdcaa65c693fb4ffeed437bdd85235f.tar.gz sway-136387144cdcaa65c693fb4ffeed437bdd85235f.tar.zst sway-136387144cdcaa65c693fb4ffeed437bdd85235f.zip |
Merge pull request #750 from deklov/sway-lock-01
swaylock: Add -f option to detach from the controlling terminal, fixe…
Diffstat (limited to 'swaylock')
-rw-r--r-- | swaylock/main.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/swaylock/main.c b/swaylock/main.c index a0a2f1cb..af1f7a74 100644 --- a/swaylock/main.c +++ b/swaylock/main.c | |||
@@ -333,6 +333,7 @@ int main(int argc, char **argv) { | |||
333 | {"version", no_argument, NULL, 'v'}, | 333 | {"version", no_argument, NULL, 'v'}, |
334 | {"socket", required_argument, NULL, 'p'}, | 334 | {"socket", required_argument, NULL, 'p'}, |
335 | {"no-unlock-indicator", no_argument, NULL, 'u'}, | 335 | {"no-unlock-indicator", no_argument, NULL, 'u'}, |
336 | {"daemonize", no_argument, NULL, 'f'}, | ||
336 | {0, 0, 0, 0} | 337 | {0, 0, 0, 0} |
337 | }; | 338 | }; |
338 | 339 | ||
@@ -346,14 +347,16 @@ int main(int argc, char **argv) { | |||
346 | " -v, --version Show the version number and quit.\n" | 347 | " -v, --version Show the version number and quit.\n" |
347 | " -i, --image [<output>:]<path> Display the given image.\n" | 348 | " -i, --image [<output>:]<path> Display the given image.\n" |
348 | " -u, --no-unlock-indicator Disable the unlock indicator.\n" | 349 | " -u, --no-unlock-indicator Disable the unlock indicator.\n" |
350 | " -f, --daemonize Detach from the controlling terminal.\n" | ||
349 | " --socket <socket> Use the specified socket.\n"; | 351 | " --socket <socket> Use the specified socket.\n"; |
350 | 352 | ||
353 | |||
351 | registry = registry_poll(); | 354 | registry = registry_poll(); |
352 | 355 | ||
353 | int c; | 356 | int c; |
354 | while (1) { | 357 | while (1) { |
355 | int option_index = 0; | 358 | int option_index = 0; |
356 | c = getopt_long(argc, argv, "hc:i:s:tvu", long_options, &option_index); | 359 | c = getopt_long(argc, argv, "hc:i:s:tvuf", long_options, &option_index); |
357 | if (c == -1) { | 360 | if (c == -1) { |
358 | break; | 361 | break; |
359 | } | 362 | } |
@@ -421,6 +424,9 @@ int main(int argc, char **argv) { | |||
421 | case 'u': | 424 | case 'u': |
422 | show_indicator = false; | 425 | show_indicator = false; |
423 | break; | 426 | break; |
427 | case 'f': | ||
428 | daemon(0, 0); | ||
429 | break; | ||
424 | default: | 430 | default: |
425 | fprintf(stderr, "%s", usage); | 431 | fprintf(stderr, "%s", usage); |
426 | exit(EXIT_FAILURE); | 432 | exit(EXIT_FAILURE); |