tabbed

Simple tabbing application for X11.
git clone git://r-36.net/tabbed
Log | Files | Refs | README | LICENSE

commit 2f2e21c0bb53e60c663ad617a186ca4f1d50f83a
parent aa5f91e0d54333e4da247528f5eacb721710d16d
Author: Enno Boland (tox) <tox@s01.de>
Date:   Mon,  7 Sep 2009 14:21:26 +0200

event system works, some code arranging
Diffstat:
config.def.h | 21++++++++++-----------
tabbed.c | 21++++++++++++---------
2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -35,7 +35,6 @@ static const char normbgcolor[] = "#202020"; static const char normfgcolor[] = "#c0c0c0"; static const char selbgcolor[] = "#884400"; static const char selfgcolor[] = "#f0f0f0"; - static const char *surfexec[] = { "surf", "-x" }; #define MODKEY ControlMask @@ -45,15 +44,15 @@ Key keys[] = { \ { MODKEY, XK_t, newtab, { 0 } }, { MODKEY|ShiftMask, XK_l, rotate, { .i = +1 } }, { MODKEY|ShiftMask, XK_h, rotate, { .i = -1 } }, - { MODKEY|ShiftMask, XK_1, move, { .i = 1 } }, - { MODKEY|ShiftMask, XK_2, move, { .i = 2 } }, - { MODKEY|ShiftMask, XK_3, move, { .i = 3 } }, - { MODKEY|ShiftMask, XK_4, move, { .i = 4 } }, - { MODKEY|ShiftMask, XK_5, move, { .i = 5 } }, - { MODKEY|ShiftMask, XK_6, move, { .i = 6 } }, - { MODKEY|ShiftMask, XK_7, move, { .i = 7 } }, - { MODKEY|ShiftMask, XK_8, move, { .i = 8 } }, - { MODKEY|ShiftMask, XK_9, move, { .i = 9 } }, - { MODKEY|ShiftMask, XK_0, move, { .i = 0 } }, + { MODKEY, XK_1, move, { .i = 1 } }, + { MODKEY, XK_2, move, { .i = 2 } }, + { MODKEY, XK_3, move, { .i = 3 } }, + { MODKEY, XK_4, move, { .i = 4 } }, + { MODKEY, XK_5, move, { .i = 5 } }, + { MODKEY, XK_6, move, { .i = 6 } }, + { MODKEY, XK_7, move, { .i = 7 } }, + { MODKEY, XK_8, move, { .i = 8 } }, + { MODKEY, XK_9, move, { .i = 9 } }, + { MODKEY, XK_0, move, { .i = 10 } }, }; #endif diff --git a/tabbed.c b/tabbed.c @@ -17,7 +17,7 @@ /* macros */ #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define LENGTH(x) (sizeof x / sizeof x[0]) -#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) +#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) enum { ColFG, ColBG, ColLast }; /* color */ @@ -50,12 +50,16 @@ typedef struct { } font; } DC; /* draw context */ -typedef struct Client Client; -struct Client { +typedef struct Client { char name[256]; struct Client *next; Window win; -}; +} Client; + +typedef struct Listener { + int fd; + struct Listener *next; +} Listener; /* function declarations */ static void cleanup(void); @@ -209,24 +213,23 @@ keypress(XEvent *e) { void move(const Arg *arg) { - + puts("move to nth tab"); } void newtab(const Arg *arg) { - + puts("opening new tab"); } void rotate(const Arg *arg) { - + puts("next/prev tab"); } void run(void) { XEvent ev; - /* main event loop, also reads status text from stdin */ XSync(dpy, False); while(running) { XNextEvent(dpy, &ev); @@ -260,7 +263,7 @@ setup(void) { win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0, dc.norm[ColFG], dc.norm[ColBG]); XSelectInput(dpy, win, StructureNotifyMask|PointerMotionMask| - ButtonReleaseMask|ButtonPressMask|ExposureMask| + ButtonPressMask|ExposureMask|KeyPressMask| LeaveWindowMask); wmh = XAllocWMHints(); wmh->input = False;