diff options
author | David Eklov <david.eklov@gmail.com> | 2016-07-12 22:42:16 -0500 |
---|---|---|
committer | David Eklov <david.eklov@gmail.com> | 2016-07-13 08:20:40 -0500 |
commit | ea0a93c5c4a8caf8b61ef177315b3f42f4c623ec (patch) | |
tree | a38996a1ea485a7c0148f767438aa8089a4568c4 /swaylock | |
parent | Merge pull request #744 from thejan2009/tabbed-stacked-layout-fixes (diff) | |
download | sway-ea0a93c5c4a8caf8b61ef177315b3f42f4c623ec.tar.gz sway-ea0a93c5c4a8caf8b61ef177315b3f42f4c623ec.tar.zst sway-ea0a93c5c4a8caf8b61ef177315b3f42f4c623ec.zip |
swaylock: Add -f option to detach from the controlling terminal, fixes #725
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); |