Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CMDOBJS= cmd_click.o cmd_mousemove.o cmd_mousemove_relative.o cmd_mousedown.o \
cmd_getwindowname.o cmd_getwindowclassname.o cmd_behave_screen_edge.o \
cmd_windowminimize.o cmd_exec.o cmd_getwindowgeometry.o \
cmd_windowclose.o cmd_windowquit.o \
cmd_sleep.o cmd_get_display_geometry.o
cmd_sleep.o cmd_get_display_geometry.o cmd_window_override_redirect.o

.PHONY: all
all: xdotool.1 libxdo.$(LIBSUFFIX) libxdo.$(VERLIBSUFFIX) xdotool
Expand Down
54 changes: 54 additions & 0 deletions cmd_window_override_redirect.c
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;
}
1 change: 1 addition & 0 deletions xdotool.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ struct dispatch {
{ "windowsize", cmd_windowsize, },
{ "windowstate", cmd_windowstate, },
{ "windowunmap", cmd_windowunmap, },
{ "window_override_redirect", cmd_window_override_redirect, },

{ "set_num_desktops", cmd_set_num_desktops, },
{ "get_num_desktops", cmd_get_num_desktops, },
Expand Down
1 change: 1 addition & 0 deletions xdotool.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ int cmd_windowreparent(context_t *context);
int cmd_windowsize(context_t *context);
int cmd_windowstate(context_t *context);
int cmd_windowunmap(context_t *context);
int cmd_window_override_redirect(context_t *context);
/* pager-like commands */
int cmd_set_num_desktops(context_t *context);
int cmd_get_num_desktops(context_t *context);
Expand Down