aboutsummaryrefslogtreecommitdiff
path: root/swaylock
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-07-14 13:06:42 -0400
committerGitHub <noreply@github.com>2016-07-14 13:06:42 -0400
commit136387144cdcaa65c693fb4ffeed437bdd85235f (patch)
treecbcf54a3154b1baab1d4cbf52ccca3f89accc4fb /swaylock
parentdff1e7f91bd270b0804456f08b027e63a8666bfc (diff)
parentea0a93c5c4a8caf8b61ef177315b3f42f4c623ec (diff)
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.c8
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) {
{"version", no_argument, NULL, 'v'},
{"socket", required_argument, NULL, 'p'},
{"no-unlock-indicator", no_argument, NULL, 'u'},
+ {"daemonize", no_argument, NULL, 'f'},
{0, 0, 0, 0}
};
@@ -346,14 +347,16 @@ int main(int argc, char **argv) {
" -v, --version Show the version number and quit.\n"
" -i, --image [<output>:]<path> Display the given image.\n"
" -u, --no-unlock-indicator Disable the unlock indicator.\n"
+ " -f, --daemonize Detach from the controlling terminal.\n"
" --socket <socket> Use the specified socket.\n";
+
registry = registry_poll();
int c;
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "hc:i:s:tvu", long_options, &option_index);
+ c = getopt_long(argc, argv, "hc:i:s:tvuf", long_options, &option_index);
if (c == -1) {
break;
}
@@ -421,6 +424,9 @@ int main(int argc, char **argv) {
case 'u':
show_indicator = false;
break;
+ case 'f':
+ daemon(0, 0);
+ break;
default:
fprintf(stderr, "%s", usage);
exit(EXIT_FAILURE);