summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Bürk <admin@airblader.de>2020-10-22 13:36:15 +0200
committerGitHub <noreply@github.com>2020-10-22 13:36:15 +0200
commit47d78e0ec8cf5bbbd40bcecfe6424636f4a54c03 (patch)
tree505a11296fb17d1d306cd549552aaa4077ac2259
parent6f94b74b28140d98bee0b32346c66ff77410922e (diff)
parent26159ef47e01c307eae578afb3f47b39ea609a52 (diff)
Merge pull request #59 from sqrtroot/master
Added option to start with the mouse hidden
-rw-r--r--include/types.h1
-rw-r--r--man/unclutter-xfixes.man5
-rw-r--r--src/unclutter.c11
3 files changed, 14 insertions, 3 deletions
diff --git a/include/types.h b/include/types.h
index ccfc3c0..76f06bb 100644
--- a/include/types.h
+++ b/include/types.h
@@ -23,6 +23,7 @@ typedef struct Config {
bool onescreen;
bool ignore_matches;
match_t *matches;
+ bool start_hidden;
} Config;
typedef struct coordinates_t {
diff --git a/man/unclutter-xfixes.man b/man/unclutter-xfixes.man
index 4c6a929..f8daa81 100644
--- a/man/unclutter-xfixes.man
+++ b/man/unclutter-xfixes.man
@@ -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:
@@ -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.
diff --git a/src/unclutter.c b/src/unclutter.c
index 8cac69f..cb6f7b7 100644
--- a/src/unclutter.c
+++ b/src/unclutter.c
@@ -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[]) {
@@ -64,6 +65,8 @@ static void run(void) {
display_init();
extensions_init();
+ if (config.start_hidden)
+ cursor_hide();
event_init();
exit(EXIT_SUCCESS);
@@ -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 }
};
@@ -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);
@@ -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);
}