xdo-0.5.2/ 0000755 0000000 0000000 00000000000 12702731171 011007 5 ustar root root xdo-0.5.2/doc/ 0000755 0000000 0000000 00000000000 12702731171 011554 5 ustar root root xdo-0.5.2/doc/xdo.1 0000644 0000000 0000000 00000010515 12702731171 012432 0 ustar root root '\" t
.\" Title: xdo
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.1
.\" Date: 03/23/2016
.\" Manual: Xdo Manual
.\" Source: Xdo 0.5.2
.\" Language: English
.\"
.TH "XDO" "1" "03/23/2016" "Xdo 0\&.5\&.2" "Xdo Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
xdo \- Perform actions on windows
.SH "SYNOPSIS"
.sp
\fBxdo\fR \fIACTION\fR [\fIOPTIONS\fR] [\fIWID\fR \&...]
.SH "DESCRIPTION"
.sp
Apply the given action to the given windows\&.
.sp
If no window IDs and no options are given, the action applies to the focused window\&.
.SH "ACTIONS"
.PP
\fBclose\fR
.RS 4
Close the window\&.
.RE
.PP
\fBkill\fR
.RS 4
Kill the client\&.
.RE
.PP
\fBhide\fR
.RS 4
Unmap the window\&.
.RE
.PP
\fBshow\fR
.RS 4
Map the window\&.
.RE
.PP
\fBraise\fR
.RS 4
Raise the window\&.
.RE
.PP
\fBlower\fR
.RS 4
Lower the window\&.
.RE
.PP
\fBbelow\fR
.RS 4
Put the window below the target (see
\fB\-t\fR)\&.
.RE
.PP
\fBabove\fR
.RS 4
Put the window above the target (see
\fB\-t\fR)\&.
.RE
.PP
\fBmove\fR
.RS 4
Move the window\&.
.RE
.PP
\fBresize\fR
.RS 4
Resize the window\&.
.RE
.PP
\fBactivate\fR
.RS 4
Activate the window\&.
.RE
.PP
\fBid\fR
.RS 4
Print the window\(cqs ID\&.
.RE
.PP
\fBpid\fR
.RS 4
Print the window\(cqs pid\&.
.RE
.PP
\fBkey\fR
.RS 4
Simulate a key press/release event\&.
.RE
.PP
\fBbutton\fR
.RS 4
Simulate a button press/release event\&.
.RE
.PP
\fB\-h\fR
.RS 4
Print the synopsis and exit\&.
.RE
.PP
\fB\-v\fR
.RS 4
Print the version and exit\&.
.RE
.SH "OPTIONS"
.sp
When options are provided, the action applies to all the children of the root window that match the comparisons implied by the options in relation to the focused window\&.
.PP
\fB\-r\fR
.RS 4
Distinct ID\&.
.RE
.PP
\fB\-c\fR
.RS 4
Same class\&.
.RE
.PP
\fB\-C\fR
.RS 4
Distinct class\&.
.RE
.PP
\fB\-d\fR
.RS 4
Same desktop\&.
.RE
.PP
\fB\-D\fR
.RS 4
Distinct desktop\&.
.RE
.PP
\fB\-n\fR \fIINSTANCE_NAME\fR
.RS 4
The window has the given instance name\&.
.RE
.PP
\fB\-N\fR \fICLASS_NAME\fR
.RS 4
The window has the given class name\&.
.RE
.PP
\fB\-a\fR \fIWM_NAME\fR
.RS 4
The window has the given wm name\&.
.RE
.PP
\fB\-t\fR \fIWID\fR
.RS 4
The target window for the
\fBbelow\fR
and
\fBabove\fR
actions\&.
.RE
.PP
\fB\-p\fR \fIPID\fR
.RS 4
The window has the given pid\&.
.RE
.PP
\fB\-k\fR \fICODE\fR
.RS 4
Use the given code for the
\fBkey\fR
and
\fBbutton\fR
actions\&.
.RE
.PP
\fB\-x\fR \fI[\(+-]PIXELS\fR
.RS 4
Window x coordinate (or delta) for the
\fBmove\fR
action\&.
.RE
.PP
\fB\-y\fR \fI[\(+-]PIXELS\fR
.RS 4
Window y coordinate (or delta) for the
\fBmove\fR
action\&.
.RE
.PP
\fB\-w\fR \fI[\(+-]PIXELS\fR
.RS 4
Window width (or delta) for the
\fBresize\fR
action\&.
.RE
.PP
\fB\-h\fR \fI[\(+-]PIXELS\fR
.RS 4
Window height (or delta) for the
\fBresize\fR
action\&.
.RE
.PP
\fB\-s\fR
.RS 4
Handle symbolic desktop numbers\&.
.RE
.SH "EXAMPLES"
.sp
Close the focused window:
.sp
.if n \{\
.RS 4
.\}
.nf
xdo close
.fi
.if n \{\
.RE
.\}
.sp
Close all the windows having the same class as the focused window:
.sp
.if n \{\
.RS 4
.\}
.nf
xdo close \-c
.fi
.if n \{\
.RE
.\}
.sp
Hide all the windows of the current desktop except the focused window:
.sp
.if n \{\
.RS 4
.\}
.nf
xdo hide \-dr
.fi
.if n \{\
.RE
.\}
.sp
Activate the window which ID is 0x00800109:
.sp
.if n \{\
.RS 4
.\}
.nf
xdo activate 0x00800109
.fi
.if n \{\
.RE
.\}
.sp
Send fake key press/release events with keycode 24 to the focused window:
.sp
.if n \{\
.RS 4
.\}
.nf
xdo key \-k 24
.fi
.if n \{\
.RE
.\}
xdo-0.5.2/doc/xdo.1.txt 0000644 0000000 0000000 00000004675 12702731171 013262 0 ustar root root :man source: Xdo
:man version: {revnumber}
:man manual: Xdo Manual
xdo(1)
======
Name
----
xdo - Perform actions on windows
Synopsis
--------
*xdo* 'ACTION' ['OPTIONS'] ['WID' ...]
Description
-----------
Apply the given action to the given windows.
If no window IDs and no options are given, the action applies to the focused window.
Actions
-------
*close*::
Close the window.
*kill*::
Kill the client.
*hide*::
Unmap the window.
*show*::
Map the window.
*raise*::
Raise the window.
*lower*::
Lower the window.
*below*::
Put the window below the target (see *-t*).
*above*::
Put the window above the target (see *-t*).
*move*::
Move the window.
*resize*::
Resize the window.
*activate*::
Activate the window.
*id*::
Print the window's ID.
*pid*::
Print the window's pid.
*key*::
Simulate a key press/release event.
*button*::
Simulate a button press/release event.
*-h*::
Print the synopsis and exit.
*-v*::
Print the version and exit.
Options
-------
When options are provided, the action applies to all the children of the root window that match the comparisons implied by the options in relation to the focused window.
*-r*::
Distinct ID.
*-c*::
Same class.
*-C*::
Distinct class.
*-d*::
Same desktop.
*-D*::
Distinct desktop.
*-n* 'INSTANCE_NAME'::
The window has the given instance name.
*-N* 'CLASS_NAME'::
The window has the given class name.
*-a* 'WM_NAME'::
The window has the given wm name.
*-t* 'WID'::
The target window for the *below* and *above* actions.
*-p* 'PID'::
The window has the given pid.
*-k* 'CODE'::
Use the given code for the *key* and *button* actions.
*-x* '[±]PIXELS'::
Window x coordinate (or delta) for the *move* action.
*-y* '[±]PIXELS'::
Window y coordinate (or delta) for the *move* action.
*-w* '[±]PIXELS'::
Window width (or delta) for the *resize* action.
*-h* '[±]PIXELS'::
Window height (or delta) for the *resize* action.
*-s*::
Handle symbolic desktop numbers.
Examples
--------
Close the focused window:
----
xdo close
----
Close all the windows having the same class as the focused window:
----
xdo close -c
----
Hide all the windows of the current desktop except the focused window:
----
xdo hide -dr
----
Activate the window which ID is 0x00800109:
----
xdo activate 0x00800109
----
Send fake key press/release events with keycode 24 to the focused window:
----
xdo key -k 24
----
////
vim: set ft=asciidoc:
////
xdo-0.5.2/helpers.c 0000644 0000000 0000000 00000000553 12702731171 012620 0 ustar root root #include
#include
#include
#include "helpers.h"
void warn(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
}
__attribute__((noreturn))
void err(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
exit(EXIT_FAILURE);
}
xdo-0.5.2/helpers.h 0000644 0000000 0000000 00000000311 12702731171 012615 0 ustar root root #ifndef _HELPERS_H
#define _HELPERS_H
#define MAXLEN 256
#define MIN(A, B) ((A) < (B) ? (A) : (B))
void warn(char *, ...);
__attribute__((noreturn))
void err(char *, ...);
#endif
xdo-0.5.2/README.asciidoc 0000777 0000000 0000000 00000000000 12713754062 015706 2doc/xdo.1.txt ustar root root xdo-0.5.2/xdo.c 0000644 0000000 0000000 00000027145 12702731171 011756 0 ustar root root #include
#include
#include
#include
#include
#include
#include
#include
#include
#include "helpers.h"
#include "xdo.h"
int main(int argc, char *argv[])
{
if (argc < 2)
err("No arguments given.\n");
void (*action) (xcb_window_t win);
if (strcmp(argv[1], "id") == 0)
action = window_id;
else if (strcmp(argv[1], "pid") == 0)
action = window_pid;
else if (strcmp(argv[1], "activate") == 0)
action = window_activate;
else if (strcmp(argv[1], "hide") == 0)
action = window_hide;
else if (strcmp(argv[1], "show") == 0)
action = window_show;
else if (strcmp(argv[1], "move") == 0)
action = window_move;
else if (strcmp(argv[1], "resize") == 0)
action = window_resize;
else if (strcmp(argv[1], "close") == 0)
action = window_close;
else if (strcmp(argv[1], "kill") == 0)
action = window_kill;
else if (strcmp(argv[1], "raise") == 0)
action = window_raise;
else if (strcmp(argv[1], "lower") == 0)
action = window_lower;
else if (strcmp(argv[1], "below") == 0)
action = window_below;
else if (strcmp(argv[1], "above") == 0)
action = window_above;
else if (strcmp(argv[1], "key") == 0)
action = key_press_release;
else if (strcmp(argv[1], "button") == 0)
action = button_press_release;
else if (strcmp(argv[1], "-h") == 0)
return usage();
else if (strcmp(argv[1], "-v") == 0)
return version();
else
err("Unknown action: '%s'.\n", argv[1]);
init();
argc--, argv++;
int opt;
while ((opt = getopt(argc, argv, "rcCdDsn:N:a:p:k:t:x:y:h:w:")) != -1) {
switch (opt) {
case 'r':
cfg.wid = VALUE_DIFFERENT;
break;
case 'c':
cfg.class = VALUE_SAME;
break;
case 'C':
cfg.class = VALUE_DIFFERENT;
break;
case 'd':
cfg.desktop = VALUE_SAME;
break;
case 'D':
cfg.desktop = VALUE_DIFFERENT;
break;
case 'n':
cfg.instance_name = optarg;
break;
case 'N':
cfg.class_name = optarg;
break;
case 'a':
cfg.wm_name = optarg;
break;
case 'p':
cfg.pid = atoi(optarg);
break;
case 't':
cfg.target = strtol(optarg, NULL, 0);
break;
case 'k':
cfg.evt_code = atoi(optarg);
break;
case 's':
cfg.symb_desks = true;
break;
case 'x':
cfg.x = optarg;
break;
case 'y':
cfg.y = optarg;
break;
case 'w':
cfg.width = optarg;
break;
case 'h':
cfg.height = optarg;
break;
}
}
int num = argc - optind;
char **args = argv + optind;
setup();
int hits = 0;
xcb_window_t win = XCB_NONE;
char class[MAXLEN] = {0};
uint32_t desktop = 0;
if (cfg.wid != VALUE_IGNORE || cfg.class != VALUE_IGNORE)
get_active_window(&win);
if (cfg.class != VALUE_IGNORE)
get_class(win, class, sizeof(class));
if (cfg.desktop != VALUE_IGNORE)
get_current_desktop(&desktop);
if (num > 0) {
char *end;
for (int i = 0; i < num; i++) {
errno = 0;
long int w = strtol(args[i], &end, 0);
if (errno != 0 || *end != '\0') {
warn("Invalid window ID: '%s'.\n", args[i]);
} else if (match(w, win, desktop, class)) {
(*action)(w);
hits++;
}
}
} else {
if (cfg.class == VALUE_IGNORE
&& cfg.desktop == VALUE_IGNORE
&& cfg.class_name == NULL
&& cfg.instance_name == NULL
&& cfg.wm_name == NULL
&& cfg.pid == 0) {
xcb_window_t win;
get_active_window(&win);
if (win != XCB_NONE) {
(*action)(win);
hits++;
}
} else {
xcb_query_tree_reply_t *qtr = xcb_query_tree_reply(dpy, xcb_query_tree(dpy, root), NULL);
if (qtr == NULL)
err("Failed to query the window tree.\n");
int len = xcb_query_tree_children_length(qtr);
xcb_window_t *wins = xcb_query_tree_children(qtr);
for (int i = 0; i < len; i++) {
xcb_window_t w = wins[i];
if (match(w, win, desktop, class)) {
(*action)(w);
hits++;
}
}
free(qtr);
}
}
finish();
if (hits > 0)
return EXIT_SUCCESS;
else
return EXIT_FAILURE;
}
bool match(xcb_window_t w, xcb_window_t win, uint32_t desktop, char* class)
{
char c[MAXLEN] = {0}, i[MAXLEN] = {0}, n[MAXLEN] = {0};
uint32_t d, p;
return (cfg.wid == VALUE_IGNORE || (cfg.wid == VALUE_DIFFERENT && w != win)) &&
(cfg.class == VALUE_IGNORE ||
(get_class(w, c, sizeof(c)) &&
((cfg.class == VALUE_SAME && strcmp(class, c) == 0) ||
(cfg.class == VALUE_DIFFERENT && strcmp(class, c) != 0)))) &&
(cfg.class_name == NULL || (get_class(w, c, sizeof(c))
&& strcmp(cfg.class_name, c) == 0)) &&
(cfg.instance_name == NULL || (get_instance(w, i, sizeof(i))
&& strcmp(cfg.instance_name, i) == 0)) &&
(cfg.wm_name == NULL || (get_wm_name(w, n, sizeof(n))
&& strcmp(cfg.wm_name, n) == 0)) &&
(cfg.pid == 0 || (get_pid(w, &p) && p == cfg.pid)) &&
(cfg.desktop == VALUE_IGNORE ||
(get_desktop(w, &d) &&
((cfg.desktop == VALUE_SAME && DESKEQ(desktop, d)) ||
(cfg.desktop == VALUE_DIFFERENT && !DESKEQ(desktop, d)))));
}
void init(void)
{
cfg.class = cfg.desktop = cfg.wid = VALUE_IGNORE;
cfg.class_name = cfg.instance_name = NULL;
cfg.x = cfg.y = cfg.width = cfg.height = NULL;
cfg.pid = 0;
cfg.evt_code = XCB_NONE;
cfg.symb_desks = false;
}
int usage(void)
{
printf("xdo ACTION [OPTIONS] [WID ...]\n");
return EXIT_SUCCESS;
}
int version(void)
{
printf("%s\n", VERSION);
return EXIT_SUCCESS;
}
void setup(void)
{
dpy = xcb_connect(NULL, &default_screen);
if (xcb_connection_has_error(dpy))
err("Can't open display.\n");
xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(dpy)).data;
if (screen == NULL)
err("Can't acquire screen.\n");
root = screen->root;
ewmh = malloc(sizeof(xcb_ewmh_connection_t));
if (xcb_ewmh_init_atoms_replies(ewmh, xcb_ewmh_init_atoms(dpy, ewmh), NULL) == 0)
err("Can't initialize EWMH atoms.\n");
}
void finish(void)
{
xcb_flush(dpy);
xcb_ewmh_connection_wipe(ewmh);
free(ewmh);
xcb_disconnect(dpy);
}
void get_active_window(xcb_window_t *win)
{
if (xcb_ewmh_get_active_window_reply(ewmh, xcb_ewmh_get_active_window(ewmh, default_screen), win, NULL) != 1)
err("Can't determine the active window.\n");
}
bool get_class(xcb_window_t win, char *class, size_t len)
{
xcb_icccm_get_wm_class_reply_t icr;
if (xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &icr, NULL) == 1) {
strncpy(class, icr.class_name, len);
return true;
} else {
return false;
}
}
bool get_instance(xcb_window_t win, char *instance, size_t len)
{
xcb_icccm_get_wm_class_reply_t icr;
if (xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &icr, NULL) == 1) {
strncpy(instance, icr.instance_name, len);
return true;
} else {
return false;
}
}
bool get_wm_name(xcb_window_t win, char *wm_name, size_t len)
{
xcb_icccm_get_text_property_reply_t itr;
if (xcb_icccm_get_wm_name_reply(dpy, xcb_icccm_get_wm_name(dpy, win), &itr, NULL) == 1) {
strncpy(wm_name, itr.name, len);
return true;
} else {
return false;
}
}
bool get_pid(xcb_window_t win, uint32_t *pid)
{
return (xcb_ewmh_get_wm_pid_reply(ewmh, xcb_ewmh_get_wm_pid(ewmh, win), pid, NULL) == 1);
}
bool get_desktop(xcb_window_t win, uint32_t *desktop)
{
return (xcb_ewmh_get_wm_desktop_reply(ewmh, xcb_ewmh_get_wm_desktop(ewmh, win), desktop, NULL) == 1 && (*desktop != ALL_DESKS || cfg.symb_desks));
}
bool get_current_desktop(uint32_t *desktop)
{
return (xcb_ewmh_get_current_desktop_reply(ewmh, xcb_ewmh_get_current_desktop(ewmh, default_screen), desktop, NULL) == 1);
}
void window_close(xcb_window_t win)
{
xcb_ewmh_request_close_window(ewmh, default_screen, win, XCB_CURRENT_TIME, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER);
}
void window_kill(xcb_window_t win)
{
xcb_kill_client(dpy, win);
}
void window_hide(xcb_window_t win)
{
xcb_unmap_window(dpy, win);
}
void window_show(xcb_window_t win)
{
xcb_map_window(dpy, win);
}
void window_raise(xcb_window_t win)
{
uint32_t values[] = {XCB_STACK_MODE_ABOVE};
xcb_configure_window(dpy, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
}
void window_lower(xcb_window_t win)
{
uint32_t values[] = {XCB_STACK_MODE_BELOW};
xcb_configure_window(dpy, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
}
void window_stack(xcb_window_t win, uint32_t mode)
{
uint16_t mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
uint32_t values[] = {cfg.target, mode};
xcb_configure_window(dpy, win, mask, values);
}
void window_above(xcb_window_t win)
{
window_stack(win, XCB_STACK_MODE_ABOVE);
}
void window_below(xcb_window_t win)
{
window_stack(win, XCB_STACK_MODE_BELOW);
}
#define SETGEOM(v) \
if (cfg.v != NULL) { \
uint32_t v = atoi(cfg.v); \
if (ISRELA(cfg.v)) \
values[i] += v; \
else \
values[i] = v; \
} \
i++;
void window_move(xcb_window_t win)
{
xcb_get_geometry_reply_t *geo = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, win), NULL);
if (geo == NULL)
return;
uint32_t values[2] = {geo->x, geo->y};
int i = 0;
SETGEOM(x)
SETGEOM(y)
xcb_configure_window(dpy, win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values);
}
void window_resize(xcb_window_t win)
{
xcb_get_geometry_reply_t *geo = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, win), NULL);
if (geo == NULL)
return;
uint32_t values[2] = {geo->width, geo->height};
int i = 0;
SETGEOM(width)
SETGEOM(height)
xcb_configure_window(dpy, win, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values);
}
#undef SETGEOM
void window_activate(xcb_window_t win)
{
xcb_ewmh_request_change_active_window(ewmh, default_screen, win, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER, XCB_CURRENT_TIME, XCB_NONE);
}
void window_id(xcb_window_t win)
{
printf("0x%08X\n", win);
}
void window_pid(xcb_window_t win)
{
uint32_t pid;
if (get_pid(win, &pid))
printf("%i\n", pid);
}
void fake_input(xcb_window_t win, uint8_t evt, uint8_t code)
{
xcb_test_fake_input(dpy, evt, code, XCB_CURRENT_TIME, win, 0, 0, 0);
}
void key_press_release(xcb_window_t win)
{
fake_input(win, XCB_KEY_PRESS, cfg.evt_code);
fake_input(win, XCB_KEY_RELEASE, cfg.evt_code);
}
void button_press_release(xcb_window_t win)
{
fake_input(win, XCB_BUTTON_PRESS, cfg.evt_code);
fake_input(win, XCB_BUTTON_RELEASE, cfg.evt_code);
}
xdo-0.5.2/xdo.h 0000644 0000000 0000000 00000003624 12702731171 011757 0 ustar root root #ifndef _XDO_H
#define _XDO_H
#define ALL_DESKS 0xFFFFFFFF
#define DESKEQ(d1,d2) (d1 == d2 || (cfg.symb_desks && (d1 == ALL_DESKS || d2 == ALL_DESKS)))
#define ISRELA(s) (s[0] == '+' || s[0] == '-')
typedef enum {
VALUE_IGNORE,
VALUE_SAME,
VALUE_DIFFERENT
} value_cmp_t;
typedef struct {
value_cmp_t wid;
value_cmp_t class;
value_cmp_t desktop;
char *class_name;
char *instance_name;
char *wm_name;
char *x;
char *y;
char *width;
char *height;
uint32_t pid;
uint8_t evt_code;
bool symb_desks;
long int target;
} config_t;
xcb_connection_t *dpy;
int default_screen;
xcb_window_t root;
xcb_ewmh_connection_t *ewmh;
config_t cfg;
bool match(xcb_window_t w, xcb_window_t win, uint32_t desktop, char* class);
void init(void);
int usage(void);
int version(void);
void setup(void);
void finish(void);
void get_active_window(xcb_window_t *win);
bool get_class(xcb_window_t win, char *class, size_t len);
bool get_instance(xcb_window_t win, char *instance, size_t len);
bool get_wm_name(xcb_window_t win, char *wm_name, size_t len);
bool get_pid(xcb_window_t win, uint32_t *pid);
bool get_desktop(xcb_window_t win, uint32_t *desktop);
bool get_current_desktop(uint32_t *desktop);
void window_close(xcb_window_t win);
void window_kill(xcb_window_t win);
void window_hide(xcb_window_t win);
void window_show(xcb_window_t win);
void window_raise(xcb_window_t win);
void window_lower(xcb_window_t win);
void window_stack(xcb_window_t win, uint32_t mode);
void window_above(xcb_window_t win);
void window_below(xcb_window_t win);
void window_move(xcb_window_t win);
void window_resize(xcb_window_t win);
void window_activate(xcb_window_t win);
void window_id(xcb_window_t win);
void window_pid(xcb_window_t win);
void fake_input(xcb_window_t win, uint8_t evt, uint8_t code);
void key_press_release(xcb_window_t win);
void button_press_release(xcb_window_t win);
#endif
xdo-0.5.2/LICENSE 0000644 0000000 0000000 00000002427 12702731171 012021 0 ustar root root Copyright (c) 2013, Bastien Dejean
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
xdo-0.5.2/VERSION 0000644 0000000 0000000 00000000005 12702731171 012052 0 ustar root root 0.5.2 xdo-0.5.2/.gitignore 0000644 0000000 0000000 00000000015 12702731171 012773 0 ustar root root xdo
*.o
tags
xdo-0.5.2/Sourcedeps 0000644 0000000 0000000 00000000074 12702731171 013047 0 ustar root root helpers.o: helpers.c helpers.h
xdo.o: xdo.c helpers.h xdo.h
xdo-0.5.2/Makefile 0000644 0000000 0000000 00000001635 12702731171 012454 0 ustar root root NAME := xdo
VERCMD ?= git describe 2> /dev/null
VERSION := $(shell $(VERCMD) || cat VERSION)
CPPFLAGS += -D_POSIX_C_SOURCE=200112L -DVERSION=\"$(VERSION)\"
CFLAGS += -std=c99 -pedantic -Wall -Wextra
LDLIBS := -lxcb -lxcb-icccm -lxcb-ewmh -lxcb-xtest
PREFIX ?= /usr/local
BINPREFIX ?= $(PREFIX)/bin
MANPREFIX ?= $(PREFIX)/share/man
SRC := $(wildcard *.c)
OBJ := $(SRC:.c=.o)
all: $(NAME)
debug: CFLAGS += -O0 -g
debug: $(NAME)
include Sourcedeps
$(OBJ): Makefile
$(NAME): $(OBJ)
install:
mkdir -p "$(DESTDIR)$(BINPREFIX)"
cp -p $(NAME) "$(DESTDIR)$(BINPREFIX)"
mkdir -p "$(DESTDIR)$(MANPREFIX)/man1"
cp -p doc/$(NAME).1 "$(DESTDIR)$(MANPREFIX)/man1"
uninstall:
rm -f "$(DESTDIR)$(BINPREFIX)/$(NAME)"
rm -f $(DESTDIR)$(MANPREFIX)/man1/$(NAME).1
doc:
a2x -v -d manpage -f manpage -a revnumber=$(VERSION) doc/$(NAME).1.txt
clean:
rm -f $(OBJ) $(NAME)
.PHONY: all debug install uninstall doc clean