-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP to add a way to change a window's OverrideRedirect flag
Possible trick that might help with #480
- Loading branch information
1 parent
33092d8
commit c53b5ba
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include "xdo_cmd.h" | ||
|
||
int cmd_window_override_redirect(context_t *context) { | ||
int ret = 0; | ||
char *cmd = *context->argv; | ||
const char *window_arg = "%1"; | ||
int opsync = 0; | ||
|
||
int c; | ||
enum { opt_unused, opt_help, opt_sync }; | ||
static struct option longopts[] = { | ||
{ "help", no_argument, NULL, opt_help }, | ||
{ 0, 0, 0, 0 }, | ||
}; | ||
static const char *usage = | ||
"Usage: %s [options] <0 or 1>\n" | ||
HELP_SEE_WINDOW_STACK; | ||
|
||
int option_index; | ||
while ((c = getopt_long_only(context->argc, context->argv, "+h", | ||
longopts, &option_index)) != -1) { | ||
switch (c) { | ||
case 'h': | ||
case opt_help: | ||
printf(usage, cmd); | ||
consume_args(context, context->argc); | ||
return EXIT_SUCCESS; | ||
break; | ||
default: | ||
fprintf(stderr, usage, cmd); | ||
return EXIT_FAILURE; | ||
} | ||
} | ||
|
||
consume_args(context, optind); | ||
printf("Args: %d\n", context->argc); | ||
|
||
if (context->argc != 1) { | ||
fprintf(stderr, "You specified the wrong number of args.\n"); | ||
fprintf(stderr, usage, cmd); | ||
return 1; | ||
} | ||
|
||
int val = atoi(context->argv[0]); | ||
consume_args(context, 1); | ||
window_each(context, window_arg, { | ||
ret = xdo_set_window_override_redirect(context->xdo, window, val); | ||
if (ret) { | ||
fprintf(stderr, "xdo_map_window reported an error\n"); | ||
} | ||
}); /* window_each(...) */ | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters