Skip to content

Commit

Permalink
Merge pull request #59 from sqrtroot/master
Browse files Browse the repository at this point in the history
Added option to start with the mouse hidden
  • Loading branch information
Airblader authored Oct 22, 2020
2 parents 6f94b74 + 26159ef commit 47d78e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef struct Config {
bool onescreen;
bool ignore_matches;
match_t *matches;
bool start_hidden;
} Config;

typedef struct coordinates_t {
Expand Down
5 changes: 4 additions & 1 deletion man/unclutter-xfixes.man
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ unclutter-xfixes - rewrite of unclutter using the X11-Xfixes extension

== SYNOPSIS

unclutter [*--timeout* _seconds_] [*--jitter* _radius_] [*--exclude-root*] [*--ignore-scrolling*] [*--ignore-buttons* _buttons_] [*--hide-on-touch*] [*--fork*|*-b*] [*--help*|*-h*] [*--version*|*-v*]
unclutter [*--timeout* _seconds_] [*--jitter* _radius_] [*--exclude-root*] [*--ignore-scrolling*] [*--ignore-buttons* _buttons_] [*--hide-on-touch*] [*--fork*|*-b*] [*--help*|*-h*] [*--version*|*-v*] [*--start-hidden*]

Compatibility arguments:

Expand Down Expand Up @@ -39,6 +39,9 @@ pass multiple button numbers by separating them with ','.
*--hide-on-touch*::
Hides the mouse cursor on touch events.

*--start-hidden*::
Starts the cursor hidden.

*--fork*|*-b*::
Fork unclutter to the background.

Expand Down
11 changes: 9 additions & 2 deletions src/unclutter.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Config config = {
.debug = false,
.onescreen = false,
.ignore_matches = false,
.matches = NULL
.matches = NULL,
.start_hidden = false
};

int main(int argc, char *argv[]) {
Expand All @@ -64,6 +65,8 @@ static void run(void) {

display_init();
extensions_init();
if (config.start_hidden)
cursor_hide();
event_init();

exit(EXIT_SUCCESS);
Expand Down Expand Up @@ -102,6 +105,7 @@ static void parse_args(int argc, char *argv[]) {
{ "version", no_argument, 0, 'v' },
{ "help", no_argument, 0, 'h' },
{ "debug", no_argument, 0, 0 },
{ "start-hidden", no_argument, 0, 0},
{ 0, 0, 0, 0 }
};

Expand Down Expand Up @@ -160,6 +164,9 @@ static void parse_args(int argc, char *argv[]) {
} else if (OPT_NAME_IS("keystroke") || OPT_NAME_IS("grab") || OPT_NAME_IS("noevents") || OPT_NAME_IS("reset")) {
ELOG("Using unsupported unclutter argument \"%s\", ignoring.", opt_name);
break;
} else if (OPT_NAME_IS("start-hidden")) {
config.start_hidden = true;
break;
}

print_usage(argv);
Expand Down Expand Up @@ -197,7 +204,7 @@ static void parse_args(int argc, char *argv[]) {
}

static void print_usage(char *argv[]) {
fprintf(stderr, "Usage: %s [--timeout <n>] [--jitter <radius>] [--exclude-root] [--ignore-scrolling] [--ignore-buttons <buttons>] [--hide-on-touch] [-b|--fork] [-v|--version] [-h|--help]", argv[0]);
fprintf(stderr, "Usage: %s [--timeout <n>] [--jitter <radius>] [--exclude-root] [--ignore-scrolling] [--ignore-buttons <buttons>] [--hide-on-touch] [-b|--fork] [-v|--version] [-h|--help] [--start_hidden]", argv[0]);
fprintf(stderr, "\n");
exit(EXIT_FAILURE);
}
Expand Down

0 comments on commit 47d78e0

Please sign in to comment.