mirror of
https://github.com/swaywm/sway.git
synced 2024-11-29 11:21:28 +00:00
swaylock: Add -f option to detach from the controlling terminal, fixes #725
This commit is contained in:
parent
0374154749
commit
ea0a93c5c4
|
@ -333,6 +333,7 @@ int main(int argc, char **argv) {
|
||||||
{"version", no_argument, NULL, 'v'},
|
{"version", no_argument, NULL, 'v'},
|
||||||
{"socket", required_argument, NULL, 'p'},
|
{"socket", required_argument, NULL, 'p'},
|
||||||
{"no-unlock-indicator", no_argument, NULL, 'u'},
|
{"no-unlock-indicator", no_argument, NULL, 'u'},
|
||||||
|
{"daemonize", no_argument, NULL, 'f'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -346,14 +347,16 @@ int main(int argc, char **argv) {
|
||||||
" -v, --version Show the version number and quit.\n"
|
" -v, --version Show the version number and quit.\n"
|
||||||
" -i, --image [<output>:]<path> Display the given image.\n"
|
" -i, --image [<output>:]<path> Display the given image.\n"
|
||||||
" -u, --no-unlock-indicator Disable the unlock indicator.\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";
|
" --socket <socket> Use the specified socket.\n";
|
||||||
|
|
||||||
|
|
||||||
registry = registry_poll();
|
registry = registry_poll();
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while (1) {
|
while (1) {
|
||||||
int option_index = 0;
|
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) {
|
if (c == -1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -421,6 +424,9 @@ int main(int argc, char **argv) {
|
||||||
case 'u':
|
case 'u':
|
||||||
show_indicator = false;
|
show_indicator = false;
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
daemon(0, 0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "%s", usage);
|
fprintf(stderr, "%s", usage);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
Loading…
Reference in a new issue