Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getmouselocation sets the stack #200

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion cmd_getmouselocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ int cmd_getmouselocation(context_t *context) {
{ "help", no_argument, NULL, 'h' },
{ "shell", no_argument, NULL, 's' },
{ "prefix", required_argument, NULL, 'p' },
{ "window-stack", no_argument, NULL, 'w' },
{ 0, 0, 0, 0 },
};
static const char *usage =
"Usage: %s [--shell] [--prefix <STR>]\n"
"--shell - output shell variables for use with eval\n"
"--prefix STR - use prefix for shell variables names (max 16 chars) \n";
"--prefix STR - use prefix for shell variables names (max 16 chars) \n"
"--window-stack - add window to the WINDOW STACK\n";
int option_index;
int output_shell = 0;
int window_stack = 0;
char out_prefix[17] = {'\0'};

while ((c = getopt_long_only(context->argc, context->argv, "+h",
Expand All @@ -36,6 +39,9 @@ int cmd_getmouselocation(context_t *context) {
strncpy(out_prefix, optarg, sizeof(out_prefix)-1);
out_prefix[ sizeof(out_prefix)-1 ] = '\0'; //just in case
break;
case 'w':
window_stack = 1;
break;
default:
fprintf(stderr, usage, cmd);
return EXIT_FAILURE;
Expand All @@ -54,6 +60,9 @@ int cmd_getmouselocation(context_t *context) {
} else {
xdotool_output(context, "x:%d y:%d screen:%d window:%ld", x, y, screen_num, window);
}
if (window_stack) {
window_save(context, window);
}
return ret;
}