rename jdwm to awesome

This commit is contained in:
Julien Danjou 2007-09-10 12:06:54 +02:00
parent 604ab3e702
commit 6f528063be
30 changed files with 506 additions and 507 deletions

View File

@ -1,16 +1,15 @@
# jdwm - Julien's dynamic window manager
# awesome
# © 2007 Julien Danjou
# © 2006-2007 Anselm R. Garbe, Sander van Dijk
include config.mk
SRC = client.c draw.c event.c layout.c jdwm.c tag.c util.c config.c
SRC = client.c draw.c event.c layout.c awesome.c tag.c util.c config.c
OBJ = ${SRC:.c=.o} ${LAYOUTS:.c=.o}
all: options jdwm
all: options awesome
options:
@echo jdwm build options:
@echo awesome build options:
@echo "LAYOUTS = ${LAYOUTS}"
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@ -20,44 +19,44 @@ options:
@echo -e \\t\(CC\) $<
@${CC} -c ${CFLAGS} $< -o $@
${OBJ}: jdwm.h config.mk
${OBJ}: awesome.h config.mk
jdwm: ${OBJ}
awesome: ${OBJ}
@echo -e \\t\(CC\) ${OBJ} -o $@
@${CC} -o $@ ${OBJ} ${LDFLAGS}
clean:
@echo cleaning
@rm -f jdwm ${OBJ} jdwm-${VERSION}.tar.gz
@rm -f awesome ${OBJ} awesome-${VERSION}.tar.gz
@rm -rf doc
dist: clean
@echo creating dist tarball
@mkdir -p jdwm-${VERSION}
@mkdir -p awesome-${VERSION}
@cp -R LICENSE Makefile README config.*.h config.mk \
jdwm.1 jdwm.h grid.h tile.h mem.h ${SRC} ${LAYOUTS} jdwm-${VERSION}
@tar -cf jdwm-${VERSION}.tar jdwm-${VERSION}
@gzip jdwm-${VERSION}.tar
@rm -rf jdwm-${VERSION}
awesome.1 awesome.h grid.h tile.h mem.h ${SRC} ${LAYOUTS} awesome-${VERSION}
@tar -cf awesome-${VERSION}.tar awesome-${VERSION}
@gzip awesome-${VERSION}.tar
@rm -rf awesome-${VERSION}
install: all
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin
@cp -f jdwm ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/jdwm
@cp -f awesome ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/awesome
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
@sed "s/VERSION/${VERSION}/g" < jdwm.1 > ${DESTDIR}${MANPREFIX}/man1/jdwm.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/jdwm.1
@sed "s/VERSION/${VERSION}/g" < awesome.1 > ${DESTDIR}${MANPREFIX}/man1/awesome.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/awesome.1
uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
@rm -f ${DESTDIR}${PREFIX}/bin/jdwm
@rm -f ${DESTDIR}${PREFIX}/bin/awesome
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/jdwm.1
@rm -f ${DESTDIR}${MANPREFIX}/man1/awesome.1
doc:
@echo generating documentation
@doxygen jdwm.doxygen
@doxygen awesome.doxygen
.PHONY: all options clean dist install uninstall doc

28
README
View File

@ -1,35 +1,35 @@
jdwm - Julien's dynamic window manager
awesome - Julien's dynamic window manager
============================
jdwm is an extremely fast, small, and dynamic window manager for X.
awesome is an extremely fast, small, and dynamic window manager for X.
It's based on dwm.
Requirements
------------
In order to build jdwm you need the Xlib header files and libconfig.
In order to build awesome you need the Xlib header files and libconfig.
Installation
------------
Edit config.mk to match your local setup (jdwm is installed into
Edit config.mk to match your local setup (awesome is installed into
the /usr/local namespace by default).
Afterwards enter the following command to build and install jdwm (if
Afterwards enter the following command to build and install awesome (if
necessary as root):
make clean install
Running jdwm
Running awesome
-----------
Add the following line to your .xinitrc to start jdwm using startx
or to .xsession to start jdwm using gdm/kdm/xdm...:
Add the following line to your .xinitrc to start awesome using startx
or to .xsession to start awesome using gdm/kdm/xdm...:
exec jdwm
exec awesome
In order to connect jdwm to a specific display, make sure that
In order to connect awesome to a specific display, make sure that
the DISPLAY environment variable is set correctly, e.g.:
DISPLAY=foo.bar:1 exec jdwm
DISPLAY=foo.bar:1 exec awesome
(This will start jdwm on display :1 of the host foo.bar.)
(This will start awesome on display :1 of the host foo.bar.)
In order to display status info in the bar, you can do something
like this in your .xinitrc:
@ -38,10 +38,10 @@ like this in your .xinitrc:
do
echo `date` `uptime | sed 's/.*,//'`
sleep 1
done | jdwm
done | awesome
Configuration
-------------
The configuration of jdwm is done by creating a custom config.h
The configuration of awesome is done by creating a custom config.h
and (re)compiling the source code.

View File

View File

@ -12,7 +12,7 @@
#include <X11/Xproto.h>
#include <X11/Xutil.h>
#include "jdwm.h"
#include "awesome.h"
#include "util.h"
#include "event.h"
#include "layout.h"
@ -65,13 +65,13 @@ gettextprop(Display *disp, Window w, Atom atom, char *text, unsigned int size)
}
static void
cleanup(Display *disp, jdwm_config *jdwmconf)
cleanup(Display *disp, awesome_config *awesomeconf)
{
close(STDIN_FILENO);
while(stack)
{
unban(stack);
unmanage(stack, &dc, NormalState, jdwmconf);
unmanage(stack, &dc, NormalState, awesomeconf);
}
if(dc.font.set)
XFreeFontSet(disp, dc.font.set);
@ -80,7 +80,7 @@ cleanup(Display *disp, jdwm_config *jdwmconf)
XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp));
XFreePixmap(disp, dc.drawable);
XFreeGC(disp, dc.gc);
XDestroyWindow(disp, jdwmconf->statusbar.window);
XDestroyWindow(disp, awesomeconf->statusbar.window);
XFreeCursor(disp, cursor[CurNormal]);
XFreeCursor(disp, cursor[CurResize]);
XFreeCursor(disp, cursor[CurMove]);
@ -107,7 +107,7 @@ getstate(Display *disp, Window w)
}
static void
scan(Display *disp, jdwm_config *jdwmconf)
scan(Display *disp, awesome_config *awesomeconf)
{
unsigned int i, num;
Window *wins, d1, d2;
@ -121,7 +121,7 @@ scan(Display *disp, jdwm_config *jdwmconf)
|| wa.override_redirect || XGetTransientForHint(disp, wins[i], &d1))
continue;
if(wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState)
manage(disp, &dc, wins[i], &wa, jdwmconf);
manage(disp, &dc, wins[i], &wa, awesomeconf);
}
/* now the transients */
for(i = 0; i < num; i++)
@ -130,7 +130,7 @@ scan(Display *disp, jdwm_config *jdwmconf)
continue;
if(XGetTransientForHint(disp, wins[i], &d1)
&& (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState))
manage(disp, &dc, wins[i], &wa, jdwmconf);
manage(disp, &dc, wins[i], &wa, awesomeconf);
}
if(wins)
XFree(wins);
@ -138,11 +138,11 @@ scan(Display *disp, jdwm_config *jdwmconf)
/** Setup everything before running
* \param disp Display ref
* \param jdwmconf jdwm config ref
* \param awesomeconf awesome config ref
* \todo clean things...
*/
static void
setup(Display *disp, jdwm_config *jdwmconf)
setup(Display *disp, awesome_config *awesomeconf)
{
XSetWindowAttributes wa;
@ -165,27 +165,27 @@ setup(Display *disp, jdwm_config *jdwmconf)
wa.cursor = cursor[CurNormal];
XChangeWindowAttributes(disp, DefaultRootWindow(disp), CWEventMask | CWCursor, &wa);
XSelectInput(disp, DefaultRootWindow(disp), wa.event_mask);
grabkeys(disp, jdwmconf);
compileregs(jdwmconf);
grabkeys(disp, awesomeconf);
compileregs(awesomeconf);
/* bar */
dc.h = jdwmconf->statusbar.height = dc.font.height + 2;
dc.h = awesomeconf->statusbar.height = dc.font.height + 2;
wa.override_redirect = 1;
wa.background_pixmap = ParentRelative;
wa.event_mask = ButtonPressMask | ExposureMask;
jdwmconf->statusbar.window = XCreateWindow(disp, DefaultRootWindow(disp), 0, 0, DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, 0,
awesomeconf->statusbar.window = XCreateWindow(disp, DefaultRootWindow(disp), 0, 0, DisplayWidth(disp, DefaultScreen(disp)), awesomeconf->statusbar.height, 0,
DefaultDepth(disp, DefaultScreen(disp)), CopyFromParent,
DefaultVisual(disp, DefaultScreen(disp)),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(disp, jdwmconf->statusbar.window, cursor[CurNormal]);
updatebarpos(disp, jdwmconf->statusbar);
XMapRaised(disp, jdwmconf->statusbar.window);
XDefineCursor(disp, awesomeconf->statusbar.window, cursor[CurNormal]);
updatebarpos(disp, awesomeconf->statusbar);
XMapRaised(disp, awesomeconf->statusbar.window);
/* pixmap for everything */
dc.drawable = XCreatePixmap(disp, DefaultRootWindow(disp), DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, DefaultDepth(disp, DefaultScreen(disp)));
dc.drawable = XCreatePixmap(disp, DefaultRootWindow(disp), DisplayWidth(disp, DefaultScreen(disp)), awesomeconf->statusbar.height, DefaultDepth(disp, DefaultScreen(disp)));
dc.gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0);
XSetLineAttributes(disp, dc.gc, 1, LineSolid, CapButt, JoinMiter);
if(!dc.font.set)
XSetFont(disp, dc.gc, dc.font.xfont->fid);
loadjdwmprops(disp, jdwmconf);
loadawesomeprops(disp, awesomeconf);
}
/*
@ -203,7 +203,7 @@ xerrorstart(Display * dsply __attribute__ ((unused)), XErrorEvent * ee __attribu
void
uicb_quit(Display *disp __attribute__ ((unused)),
jdwm_config *jdwmconf __attribute__((unused)),
awesome_config *awesomeconf __attribute__((unused)),
const char *arg __attribute__ ((unused)))
{
readin = running = False;
@ -255,7 +255,7 @@ xerror(Display * edpy, XErrorEvent * ee)
&& ee->error_code == BadAccess)
|| (ee->request_code == X_CopyArea && ee->error_code == BadDrawable))
return 0;
fprintf(stderr, "jdwm: fatal error: request code=%d, error code=%d\n",
fprintf(stderr, "awesome: fatal error: request code=%d, error code=%d\n",
ee->request_code, ee->error_code);
return xerrorxlib(edpy, ee); /* may call exit */
@ -270,17 +270,17 @@ main(int argc, char *argv[])
XEvent ev;
Display * dpy;
Window root;
jdwm_config jdwmconf;
awesome_config awesomeconf;
if(argc == 2 && !strcmp("-v", argv[1]))
eprint("jdwm-" VERSION " © 2007 Julien Danjou\n");
eprint("awesome-" VERSION " © 2007 Julien Danjou\n");
else if(argc != 1)
eprint("usage: jdwm [-v]\n");
eprint("usage: awesome [-v]\n");
setlocale(LC_CTYPE, "");
if(!(dpy = XOpenDisplay(NULL)))
eprint("jdwm: cannot open display\n");
eprint("awesome: cannot open display\n");
xfd = ConnectionNumber(dpy);
root = RootWindow(dpy, DefaultScreen(dpy));
XSetErrorHandler(xerrorstart);
@ -290,19 +290,19 @@ main(int argc, char *argv[])
XSync(dpy, False);
if(otherwm)
eprint("jdwm: another window manager is already running\n");
eprint("awesome: another window manager is already running\n");
XSync(dpy, False);
XSetErrorHandler(NULL);
xerrorxlib = XSetErrorHandler(xerror);
XSync(dpy, False);
parse_config(dpy, DefaultScreen(dpy), &dc, &jdwmconf);
setup(dpy, &jdwmconf);
drawstatus(dpy, &jdwmconf);
scan(dpy, &jdwmconf);
parse_config(dpy, DefaultScreen(dpy), &dc, &awesomeconf);
setup(dpy, &awesomeconf);
drawstatus(dpy, &awesomeconf);
scan(dpy, &awesomeconf);
XSync(dpy, False);
void (*handler[LASTEvent]) (XEvent *, jdwm_config *) =
void (*handler[LASTEvent]) (XEvent *, awesome_config *) =
{
[ButtonPress] = handle_event_buttonpress,
[ConfigureRequest] = handle_event_configurerequest,
@ -334,35 +334,35 @@ main(int argc, char *argv[])
}
if(FD_ISSET(STDIN_FILENO, &rd))
{
switch (r = read(STDIN_FILENO, jdwmconf.statustext, sizeof(jdwmconf.statustext) - 1))
switch (r = read(STDIN_FILENO, awesomeconf.statustext, sizeof(awesomeconf.statustext) - 1))
{
case -1:
strncpy(jdwmconf.statustext, strerror(errno), sizeof(jdwmconf.statustext) - 1);
jdwmconf.statustext[sizeof(jdwmconf.statustext) - 1] = '\0';
strncpy(awesomeconf.statustext, strerror(errno), sizeof(awesomeconf.statustext) - 1);
awesomeconf.statustext[sizeof(awesomeconf.statustext) - 1] = '\0';
readin = False;
break;
case 0:
strncpy(jdwmconf.statustext, "EOF", 4);
strncpy(awesomeconf.statustext, "EOF", 4);
readin = False;
break;
default:
for(jdwmconf.statustext[r] = '\0', p = jdwmconf.statustext + strlen(jdwmconf.statustext) - 1;
p >= jdwmconf.statustext && *p == '\n'; *p-- = '\0');
for(; p >= jdwmconf.statustext && *p != '\n'; --p);
if(p > jdwmconf.statustext)
strncpy(jdwmconf.statustext, p + 1, sizeof(jdwmconf.statustext));
for(awesomeconf.statustext[r] = '\0', p = awesomeconf.statustext + strlen(awesomeconf.statustext) - 1;
p >= awesomeconf.statustext && *p == '\n'; *p-- = '\0');
for(; p >= awesomeconf.statustext && *p != '\n'; --p);
if(p > awesomeconf.statustext)
strncpy(awesomeconf.statustext, p + 1, sizeof(awesomeconf.statustext));
}
drawstatus(dpy, &jdwmconf);
drawstatus(dpy, &awesomeconf);
}
while(XPending(dpy))
{
XNextEvent(dpy, &ev);
if(handler[ev.type])
(handler[ev.type]) (&ev, &jdwmconf); /* call handler */
(handler[ev.type]) (&ev, &awesomeconf); /* call handler */
}
}
cleanup(dpy, &jdwmconf);
cleanup(dpy, &awesomeconf);
XCloseDisplay(dpy);
return 0;

View File

@ -1,5 +1,5 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = jdwm
PROJECT_NAME = awesome
PROJECT_NUMBER = 0.0
OUTPUT_DIRECTORY = doc
CREATE_SUBDIRS = NO

View File

@ -9,7 +9,7 @@
* Calls to fetch an X event from the event queue are blocking. Due reading
* status text from standard input, a select()-driven main loop has been
* implemented which selects for reads on the X connection and STDIN_FILENO to
* handle all data smoothly. The event handlers of jdwm are organized in an
* handle all data smoothly. The event handlers of awesome are organized in an
* array which is accessed whenever a new event has been fetched. This allows
* event dispatching in O(1) time.
*
@ -17,13 +17,13 @@
* set the override_redirect flag. Clients are organized in a global
* doubly-linked client list, the focus history is remembered through a global
* stack list. Each client contains an array of Bools of the same size as the
* global tags array to indicate the tags of a client. For each client jdwm
* global tags array to indicate the tags of a client. For each client awesome
* creates a small title window, which is resized whenever the (_NET_)WM_NAME
* properties are updated or the client is moved/resized.
*
* Keys and tagging rules are organized as arrays and defined in the config.h
* file. These arrays are kept static in event.o and tag.o respectively,
* because no other part of jdwm needs access to them. The current layout is
* because no other part of awesome needs access to them. The current layout is
* represented by the lt pointer.
*
* To understand everything else, start reading main.c:main().
@ -43,7 +43,7 @@ enum
Bool gettextprop(Display *, Window, Atom, char *, unsigned int); /* return text property, UTF-8 compliant */
void updatebarpos(Display *, Statusbar); /* updates the bar position */
void uicb_quit(Display *, jdwm_config *, const char *); /* quit jdwm nicely */
int xerror(Display *, XErrorEvent *); /* jdwm's X error handler */
void uicb_quit(Display *, awesome_config *, const char *); /* quit awesome nicely */
int xerror(Display *, XErrorEvent *); /* awesome's X error handler */
#endif

View File

@ -1,6 +1,6 @@
# Configuration file for jdwm
# Configuration file for awesome
jdwm:
awesome:
{
# Default bar position
barpos = "BarTop";

View File

@ -5,7 +5,7 @@
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "jdwm.h"
#include "awesome.h"
#include "util.h"
#include "layout.h"
#include "tag.h"
@ -235,39 +235,39 @@ detach(Client * c)
* \param drawcontext drawcontext ref
* \param c client
* \param selscreen True if current screen is selected
* \param jdwmconf jdwm config
* \param awesomeconf awesome config
*/
void
focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, jdwm_config *jdwmconf)
focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, awesome_config *awesomeconf)
{
/* if c is NULL or invisible, take next client in the stack */
if((!c && selscreen) || (c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags)))
for(c = stack; c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags); c = c->snext);
if((!c && selscreen) || (c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags)))
for(c = stack; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->snext);
/* if a client was selected but it's not the current client, unfocus it */
if(sel && sel != c)
{
grabbuttons(sel, False, jdwmconf->modkey, jdwmconf->numlockmask);
grabbuttons(sel, False, awesomeconf->modkey, awesomeconf->numlockmask);
XSetWindowBorder(sel->display, sel->win, drawcontext->norm[ColBorder]);
setclienttrans(sel, jdwmconf->opacity_unfocused);
setclienttrans(sel, awesomeconf->opacity_unfocused);
}
if(c)
{
detachstack(c);
attachstack(c);
grabbuttons(c, True, jdwmconf->modkey, jdwmconf->numlockmask);
grabbuttons(c, True, awesomeconf->modkey, awesomeconf->numlockmask);
}
if(!selscreen)
return;
sel = c;
drawstatus(disp, jdwmconf);
drawstatus(disp, awesomeconf);
if(sel)
{
XSetWindowBorder(sel->display, sel->win, drawcontext->sel[ColBorder]);
XSetInputFocus(sel->display, sel->win, RevertToPointerRoot, CurrentTime);
for(c = stack; c; c = c->snext)
if(c != sel)
setclienttrans(c, jdwmconf->opacity_unfocused);
setclienttrans(c, awesomeconf->opacity_unfocused);
setclienttrans(sel, -1);
}
else
@ -276,13 +276,13 @@ focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, jdwm_config *j
/** Kill selected client
* \param disp Display ref
* \param jdwmconf jdwm config
* \param awesomeconf awesome config
* \param arg unused
* \ingroup ui_callback
*/
void
uicb_killclient(Display *disp __attribute__ ((unused)),
jdwm_config *jdwmconf __attribute__ ((unused)),
awesome_config *awesomeconf __attribute__ ((unused)),
const char *arg __attribute__ ((unused)))
{
XEvent ev;
@ -327,7 +327,7 @@ loadprops(Client * c, int ntags)
}
void
manage(Display * disp, DC *drawcontext, Window w, XWindowAttributes * wa, jdwm_config *jdwmconf)
manage(Display * disp, DC *drawcontext, Window w, XWindowAttributes * wa, awesome_config *awesomeconf)
{
int i;
Client *c, *t = NULL;
@ -336,7 +336,7 @@ manage(Display * disp, DC *drawcontext, Window w, XWindowAttributes * wa, jdwm_c
XWindowChanges wc;
c = p_new(Client, 1);
c->tags = p_new(Bool, jdwmconf->ntags);
c->tags = p_new(Bool, awesomeconf->ntags);
c->win = w;
c->ftview = True;
c->x = c->rw = wa->x;
@ -362,7 +362,7 @@ manage(Display * disp, DC *drawcontext, Window w, XWindowAttributes * wa, jdwm_c
c->x = c->rx = wax;
if(c->y < way)
c->y = c->ry = way;
c->border = jdwmconf->borderpx;
c->border = awesomeconf->borderpx;
}
wc.border_width = c->border;
XConfigureWindow(disp, w, CWBorderWidth, &wc);
@ -370,23 +370,23 @@ manage(Display * disp, DC *drawcontext, Window w, XWindowAttributes * wa, jdwm_c
configure(c); /* propagates border_width, if size doesn't change */
updatesizehints(c);
XSelectInput(disp, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
grabbuttons(c, False, jdwmconf->modkey, jdwmconf->numlockmask);
grabbuttons(c, False, awesomeconf->modkey, awesomeconf->numlockmask);
updatetitle(c);
if((rettrans = XGetTransientForHint(disp, w, &trans) == Success))
for(t = clients; t && t->win != trans; t = t->next);
if(t)
for(i = 0; i < jdwmconf->ntags; i++)
for(i = 0; i < awesomeconf->ntags; i++)
c->tags[i] = t->tags[i];
if(!loadprops(c, jdwmconf->ntags))
applyrules(c, jdwmconf);
if(!loadprops(c, awesomeconf->ntags))
applyrules(c, awesomeconf);
if(!c->isfloating)
c->isfloating = (rettrans == Success) || c->isfixed;
saveprops(c, jdwmconf->ntags);
saveprops(c, awesomeconf->ntags);
attach(c);
attachstack(c);
XMoveResizeWindow(disp, c->win, c->x, c->y, c->w, c->h); /* some windows require this */
ban(c);
arrange(disp, jdwmconf);
arrange(disp, awesomeconf);
}
void
@ -461,7 +461,7 @@ resize(Client * c, int x, int y, int w, int h, Bool sizehints)
void
uicb_moveresize(Display *disp __attribute__ ((unused)),
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg)
{
int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh;
@ -528,7 +528,7 @@ unban(Client * c)
}
void
unmanage(Client * c, DC *drawcontext, long state, jdwm_config *jdwmconf)
unmanage(Client * c, DC *drawcontext, long state, awesome_config *awesomeconf)
{
XWindowChanges wc;
@ -539,14 +539,14 @@ unmanage(Client * c, DC *drawcontext, long state, jdwm_config *jdwmconf)
detach(c);
detachstack(c);
if(sel == c)
focus(c->display, drawcontext, NULL, True, jdwmconf);
focus(c->display, drawcontext, NULL, True, awesomeconf);
XUngrabButton(c->display, AnyButton, AnyModifier, c->win);
setclientstate(c, state);
XSync(c->display, False);
XSetErrorHandler(xerror);
XUngrabServer(c->display);
if(state != NormalState)
arrange(c->display, jdwmconf);
arrange(c->display, awesomeconf);
p_delete(&c->tags);
p_delete(&c);
}
@ -617,7 +617,7 @@ updatesizehints(Client * c)
void
uicb_settrans(Display *disp __attribute__ ((unused)),
jdwm_config *jdwmconf __attribute__ ((unused)),
awesome_config *awesomeconf __attribute__ ((unused)),
const char *arg)
{
double delta = 100.0;

View File

@ -33,16 +33,16 @@ void attach(Client *); /* attaches c to global client list */
void ban(Client *); /* bans c */
void configure(Client *); /* send synthetic configure event */
void detach(Client *); /* detaches c from global client list */
void focus(Display *, DC *, Client *, Bool, jdwm_config *); /* focus c if visible && !NULL, or focus top visible */
void manage(Display *, DC *, Window, XWindowAttributes *, jdwm_config *); /* manage new client */
void focus(Display *, DC *, Client *, Bool, awesome_config *); /* focus c if visible && !NULL, or focus top visible */
void manage(Display *, DC *, Window, XWindowAttributes *, awesome_config *); /* manage new client */
void resize(Client *, int, int, int, int, Bool); /* resize with given coordinates c */
void unban(Client *); /* unbans c */
void unmanage(Client *, DC *, long, jdwm_config *); /* unmanage c */
void unmanage(Client *, DC *, long, awesome_config *); /* unmanage c */
void updatesizehints(Client *); /* update the size hint variables of c */
void updatetitle(Client *); /* update the name of c */
void saveprops(Client * c, int); /* saves client properties */
void uicb_killclient(Display *, jdwm_config *, const char *); /* kill client */
void uicb_moveresize(Display *, jdwm_config *, const char *); /* move and resize window */
void uicb_settrans(Display *, jdwm_config *, const char *);
void uicb_killclient(Display *, awesome_config *, const char *); /* kill client */
void uicb_moveresize(Display *, awesome_config *, const char *); /* move and resize window */
void uicb_settrans(Display *, awesome_config *, const char *);
#endif

166
config.c
View File

@ -8,7 +8,7 @@
#include <libconfig.h>
#include <X11/keysym.h>
#include "jdwm.h"
#include "awesome.h"
#include "util.h"
#include "layout.h"
#include "tag.h"
@ -23,7 +23,7 @@ static unsigned long initcolor(const char *colstr, Display *, int);
static unsigned int get_numlockmask(Display *);
/** Main configuration object for parsing*/
config_t jdwmlibconf;
config_t awesomelibconf;
/** Link a name to a function */
typedef struct
@ -96,7 +96,7 @@ static const NameFuncLink KeyfuncList[] = {
/* layouts/tile.c */
{"setmwfact", uicb_setmwfact},
{"incnmaster", uicb_incnmaster},
/* jdwm.c */
/* awesome.c */
{"quit", uicb_quit},
{NULL, NULL}
};
@ -147,26 +147,26 @@ extern DC dc;
* \todo not really working nor safe I guess
*/
void
uicb_reload(Display *disp, jdwm_config *jdwmconf, const char *arg __attribute__ ((unused)))
uicb_reload(Display *disp, awesome_config *awesomeconf, const char *arg __attribute__ ((unused)))
{
config_destroy(&jdwmlibconf);
p_delete(&jdwmconf->rules);
p_delete(&jdwmconf->tags);
p_delete(&jdwmconf->selected_tags);
p_delete(&jdwmconf->layouts);
p_delete(&jdwmconf->tag_layouts);
parse_config(disp, DefaultScreen(disp), &dc, jdwmconf);
config_destroy(&awesomelibconf);
p_delete(&awesomeconf->rules);
p_delete(&awesomeconf->tags);
p_delete(&awesomeconf->selected_tags);
p_delete(&awesomeconf->layouts);
p_delete(&awesomeconf->tag_layouts);
parse_config(disp, DefaultScreen(disp), &dc, awesomeconf);
}
/** Set default configuration
* \param jdwmconf jdwm config ref
* \param awesomeconf awesome config ref
*/
static void
set_default_config(jdwm_config *jdwmconf)
set_default_config(awesome_config *awesomeconf)
{
strcpy(jdwmconf->statustext, "jdwm-" VERSION);
jdwmconf->statusbar.width = 0;
jdwmconf->statusbar.height = 0;
strcpy(awesomeconf->statustext, "awesome-" VERSION);
awesomeconf->statusbar.width = 0;
awesomeconf->statusbar.height = 0;
}
/** Parse configuration file and initialize some stuff
@ -175,7 +175,7 @@ set_default_config(jdwm_config *jdwmconf)
* \param drawcontext Draw context
*/
void
parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
parse_config(Display * disp, int scr, DC * drawcontext, awesome_config *awesomeconf)
{
config_setting_t *conftags;
config_setting_t *conflayouts, *confsublayouts;
@ -185,7 +185,7 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
const char *tmp, *homedir;
char *confpath;
set_default_config(jdwmconf);
set_default_config(awesomeconf);
homedir = getenv("HOME");
confpath = p_new(char, strlen(homedir) + strlen(JDWM_CONFIG_FILE) + 2);
@ -193,151 +193,151 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
strcat(confpath, "/");
strcat(confpath, JDWM_CONFIG_FILE);
config_init(&jdwmlibconf);
config_init(&awesomelibconf);
if(config_read_file(&jdwmlibconf, confpath) == CONFIG_FALSE)
if(config_read_file(&awesomelibconf, confpath) == CONFIG_FALSE)
eprint("error parsing configuration file at line %d: %s\n",
config_error_line(&jdwmlibconf), config_error_text(&jdwmlibconf));
config_error_line(&awesomelibconf), config_error_text(&awesomelibconf));
/* font */
initfont(config_lookup_string(&jdwmlibconf, "jdwm.font"), disp, drawcontext);
initfont(config_lookup_string(&awesomelibconf, "awesome.font"), disp, drawcontext);
/* layouts */
conflayouts = config_lookup(&jdwmlibconf, "jdwm.layouts");
conflayouts = config_lookup(&awesomelibconf, "awesome.layouts");
if(!conflayouts)
eprint("layouts not found in configuration file\n");
jdwmconf->nlayouts = config_setting_length(conflayouts);
jdwmconf->layouts = p_new(Layout, jdwmconf->nlayouts + 1);
awesomeconf->nlayouts = config_setting_length(conflayouts);
awesomeconf->layouts = p_new(Layout, awesomeconf->nlayouts + 1);
for(i = 0; (confsublayouts = config_setting_get_elem(conflayouts, i)); i++)
{
jdwmconf->layouts[i].symbol = config_setting_get_string_elem(confsublayouts, 0);
jdwmconf->layouts[i].arrange =
awesomeconf->layouts[i].symbol = config_setting_get_string_elem(confsublayouts, 0);
awesomeconf->layouts[i].arrange =
name_func_lookup(config_setting_get_string_elem(confsublayouts, 1), LayoutsList);
if(!jdwmconf->layouts[i].arrange)
if(!awesomeconf->layouts[i].arrange)
eprint("unknown layout in configuration file\n");
j = textw(jdwmconf->layouts[i].symbol);
if(j > jdwmconf->statusbar.width)
jdwmconf->statusbar.width = j;
j = textw(awesomeconf->layouts[i].symbol);
if(j > awesomeconf->statusbar.width)
awesomeconf->statusbar.width = j;
}
jdwmconf->layouts[i].symbol = NULL;
jdwmconf->layouts[i].arrange = NULL;
awesomeconf->layouts[i].symbol = NULL;
awesomeconf->layouts[i].arrange = NULL;
/** \todo put this in set_default_layout */
jdwmconf->current_layout = jdwmconf->layouts;
awesomeconf->current_layout = awesomeconf->layouts;
/* tags */
conftags = config_lookup(&jdwmlibconf, "jdwm.tags");
conftags = config_lookup(&awesomelibconf, "awesome.tags");
if(!conftags)
eprint("tags not found in configuration file\n");
jdwmconf->ntags = config_setting_length(conftags);
jdwmconf->tags = p_new(const char *, jdwmconf->ntags);
jdwmconf->selected_tags = p_new(Bool, jdwmconf->ntags);
jdwmconf->prev_selected_tags = p_new(Bool, jdwmconf->ntags);
jdwmconf->tag_layouts = p_new(Layout *, jdwmconf->ntags);
awesomeconf->ntags = config_setting_length(conftags);
awesomeconf->tags = p_new(const char *, awesomeconf->ntags);
awesomeconf->selected_tags = p_new(Bool, awesomeconf->ntags);
awesomeconf->prev_selected_tags = p_new(Bool, awesomeconf->ntags);
awesomeconf->tag_layouts = p_new(Layout *, awesomeconf->ntags);
for(i = 0; (tmp = config_setting_get_string_elem(conftags, i)); i++)
{
jdwmconf->tags[i] = tmp;
jdwmconf->selected_tags[i] = False;
jdwmconf->prev_selected_tags[i] = False;
awesomeconf->tags[i] = tmp;
awesomeconf->selected_tags[i] = False;
awesomeconf->prev_selected_tags[i] = False;
/** \todo add support for default tag/layout in configuration file */
jdwmconf->tag_layouts[i] = jdwmconf->layouts;
awesomeconf->tag_layouts[i] = awesomeconf->layouts;
}
/* select first tag by default */
jdwmconf->selected_tags[0] = True;
jdwmconf->prev_selected_tags[0] = True;
awesomeconf->selected_tags[0] = True;
awesomeconf->prev_selected_tags[0] = True;
/* rules */
confrules = config_lookup(&jdwmlibconf, "jdwm.rules");
confrules = config_lookup(&awesomelibconf, "awesome.rules");
if(!confrules)
eprint("rules not found in configuration file\n");
jdwmconf->nrules = config_setting_length(confrules);
jdwmconf->rules = p_new(Rule, jdwmconf->nrules);
awesomeconf->nrules = config_setting_length(confrules);
awesomeconf->rules = p_new(Rule, awesomeconf->nrules);
for(i = 0; (confsubrules = config_setting_get_elem(confrules, i)); i++)
{
jdwmconf->rules[i].prop = config_setting_get_string(config_setting_get_member(confsubrules, "name"));
jdwmconf->rules[i].tags = config_setting_get_string(config_setting_get_member(confsubrules, "tags"));
if(jdwmconf->rules[i].tags && !strlen(jdwmconf->rules[i].tags))
jdwmconf->rules[i].tags = NULL;
jdwmconf->rules[i].isfloating =
awesomeconf->rules[i].prop = config_setting_get_string(config_setting_get_member(confsubrules, "name"));
awesomeconf->rules[i].tags = config_setting_get_string(config_setting_get_member(confsubrules, "tags"));
if(awesomeconf->rules[i].tags && !strlen(awesomeconf->rules[i].tags))
awesomeconf->rules[i].tags = NULL;
awesomeconf->rules[i].isfloating =
config_setting_get_bool(config_setting_get_member(confsubrules, "float"));
}
/* modkey */
jdwmconf->modkey = key_mask_lookup(config_lookup_string(&jdwmlibconf, "jdwm.modkey"));
awesomeconf->modkey = key_mask_lookup(config_lookup_string(&awesomelibconf, "awesome.modkey"));
/* find numlock mask */
jdwmconf->numlockmask = get_numlockmask(disp);
awesomeconf->numlockmask = get_numlockmask(disp);
/* keys */
confkeys = config_lookup(&jdwmlibconf, "jdwm.keys");
confkeys = config_lookup(&awesomelibconf, "awesome.keys");
if(!confkeys)
eprint("keys not found in configuration file\n");
jdwmconf->nkeys = config_setting_length(confkeys);
jdwmconf->keys = p_new(Key, jdwmconf->nkeys);
awesomeconf->nkeys = config_setting_length(confkeys);
awesomeconf->keys = p_new(Key, awesomeconf->nkeys);
for(i = 0; (confsubkeys = config_setting_get_elem(confkeys, i)); i++)
{
confkeysmasks = config_setting_get_elem(confsubkeys, 0);
for(j = 0; (confkeymaskelem = config_setting_get_elem(confkeysmasks, j)); j++)
jdwmconf->keys[i].mod |= key_mask_lookup(config_setting_get_string(confkeymaskelem));
jdwmconf->keys[i].keysym = XStringToKeysym(config_setting_get_string_elem(confsubkeys, 1));
jdwmconf->keys[i].func =
awesomeconf->keys[i].mod |= key_mask_lookup(config_setting_get_string(confkeymaskelem));
awesomeconf->keys[i].keysym = XStringToKeysym(config_setting_get_string_elem(confsubkeys, 1));
awesomeconf->keys[i].func =
name_func_lookup(config_setting_get_string_elem(confsubkeys, 2), KeyfuncList);
jdwmconf->keys[i].arg = config_setting_get_string_elem(confsubkeys, 3);
awesomeconf->keys[i].arg = config_setting_get_string_elem(confsubkeys, 3);
}
/* barpos */
tmp = config_lookup_string(&jdwmlibconf, "jdwm.barpos");
tmp = config_lookup_string(&awesomelibconf, "awesome.barpos");
if(!strncmp(tmp, "BarTop", 6))
jdwmconf->statusbar_default_position = BarTop;
awesomeconf->statusbar_default_position = BarTop;
else if(!strncmp(tmp, "BarBot", 6))
jdwmconf->statusbar_default_position = BarBot;
awesomeconf->statusbar_default_position = BarBot;
else if(!strncmp(tmp, "BarOff", 6))
jdwmconf->statusbar_default_position = BarOff;
awesomeconf->statusbar_default_position = BarOff;
jdwmconf->statusbar.position = jdwmconf->statusbar_default_position;
awesomeconf->statusbar.position = awesomeconf->statusbar_default_position;
/* borderpx */
jdwmconf->borderpx = config_lookup_int(&jdwmlibconf, "jdwm.borderpx");
awesomeconf->borderpx = config_lookup_int(&awesomelibconf, "awesome.borderpx");
/* opacity */
jdwmconf->opacity_unfocused = config_lookup_int(&jdwmlibconf, "jdwm.opacity_unfocused");
if(jdwmconf->opacity_unfocused >= 100)
jdwmconf->opacity_unfocused = -1;
awesomeconf->opacity_unfocused = config_lookup_int(&awesomelibconf, "awesome.opacity_unfocused");
if(awesomeconf->opacity_unfocused >= 100)
awesomeconf->opacity_unfocused = -1;
/* snap */
jdwmconf->snap = config_lookup_int(&jdwmlibconf, "jdwm.snap");
awesomeconf->snap = config_lookup_int(&awesomelibconf, "awesome.snap");
/* nmaster */
jdwmconf->nmaster = config_lookup_int(&jdwmlibconf, "jdwm.nmaster");
awesomeconf->nmaster = config_lookup_int(&awesomelibconf, "awesome.nmaster");
/* mwfact */
jdwmconf->mwfact = config_lookup_float(&jdwmlibconf, "jdwm.mwfact");
awesomeconf->mwfact = config_lookup_float(&awesomelibconf, "awesome.mwfact");
/* resize_hints */
jdwmconf->resize_hints = config_lookup_float(&jdwmlibconf, "jdwm.resize_hints");
awesomeconf->resize_hints = config_lookup_float(&awesomelibconf, "awesome.resize_hints");
/* colors */
dc.norm[ColBorder] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.normal_border_color"),
dc.norm[ColBorder] = initcolor(config_lookup_string(&awesomelibconf, "awesome.normal_border_color"),
disp, scr);
dc.norm[ColBG] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.normal_bg_color"), disp, scr);
dc.norm[ColFG] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.normal_fg_color"), disp, scr);
dc.sel[ColBorder] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.focus_border_color"),
dc.norm[ColBG] = initcolor(config_lookup_string(&awesomelibconf, "awesome.normal_bg_color"), disp, scr);
dc.norm[ColFG] = initcolor(config_lookup_string(&awesomelibconf, "awesome.normal_fg_color"), disp, scr);
dc.sel[ColBorder] = initcolor(config_lookup_string(&awesomelibconf, "awesome.focus_border_color"),
disp, scr);
dc.sel[ColBG] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.focus_bg_color"), disp, scr);
dc.sel[ColFG] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.focus_fg_color"), disp, scr);
dc.sel[ColBG] = initcolor(config_lookup_string(&awesomelibconf, "awesome.focus_bg_color"), disp, scr);
dc.sel[ColFG] = initcolor(config_lookup_string(&awesomelibconf, "awesome.focus_fg_color"), disp, scr);
p_delete(&confpath);
}
@ -360,7 +360,7 @@ initfont(const char *fontstr, Display * disp, DC * drawcontext)
if(missing)
{
while(n--)
fprintf(stderr, "jdwm: missing fontset: %s\n", missing[n]);
fprintf(stderr, "awesome: missing fontset: %s\n", missing[n]);
XFreeStringList(missing);
}
if(drawcontext->font.set)

View File

@ -3,7 +3,7 @@
#ifndef JDWM_CONFIG_H
#define JDWM_CONFIG_H
#define JDWM_CONFIG_FILE ".jdwmrc"
#define JDWM_CONFIG_FILE ".awesomerc"
#include <X11/Xlib.h>
@ -38,19 +38,19 @@ typedef struct
Bool isfloating;
} Rule;
typedef struct jdwm_config jdwm_config;
typedef struct awesome_config awesome_config;
typedef struct
{
const char *symbol;
void (*arrange) (Display *, jdwm_config *);
void (*arrange) (Display *, awesome_config *);
} Layout;
typedef struct
{
unsigned long mod;
KeySym keysym;
void (*func) (Display *, jdwm_config *, const char *);
void (*func) (Display *, awesome_config *, const char *);
const char *arg;
} Key;
@ -68,7 +68,7 @@ typedef struct
} Statusbar;
/** Main configuration structure */
struct jdwm_config
struct awesome_config
{
/** Tag list */
const char **tags;
@ -118,7 +118,7 @@ struct jdwm_config
Statusbar statusbar;
};
void parse_config(Display *, int, DC *, jdwm_config *); /* parse configuration file */
void uicb_reload(Display *, jdwm_config *, const char *); /* reload configuration file */
void parse_config(Display *, int, DC *, awesome_config *); /* parse configuration file */
void uicb_reload(Display *, awesome_config *, const char *); /* reload configuration file */
#endif

View File

@ -1,4 +1,4 @@
# jdwm version
# awesome version
VERSION = 0.0
# Customize below to fit your system

24
draw.c
View File

@ -105,37 +105,37 @@ textnw(const char *text, unsigned int len)
}
void
drawstatus(Display *disp, jdwm_config * jdwmconf)
drawstatus(Display *disp, awesome_config * awesomeconf)
{
int x, i;
dc.x = dc.y = 0;
for(i = 0; i < jdwmconf->ntags; i++)
for(i = 0; i < awesomeconf->ntags; i++)
{
dc.w = textw(jdwmconf->tags[i]);
if(jdwmconf->selected_tags[i])
dc.w = textw(awesomeconf->tags[i]);
if(awesomeconf->selected_tags[i])
{
drawtext(disp, jdwmconf->tags[i], dc.sel);
drawtext(disp, awesomeconf->tags[i], dc.sel);
drawsquare(sel && sel->tags[i], isoccupied(i), dc.sel, disp);
}
else
{
drawtext(disp, jdwmconf->tags[i], dc.norm);
drawtext(disp, awesomeconf->tags[i], dc.norm);
drawsquare(sel && sel->tags[i], isoccupied(i), dc.norm, disp);
}
dc.x += dc.w;
}
dc.w = jdwmconf->statusbar.width;
drawtext(disp, jdwmconf->current_layout->symbol, dc.norm);
dc.w = awesomeconf->statusbar.width;
drawtext(disp, awesomeconf->current_layout->symbol, dc.norm);
x = dc.x + dc.w;
dc.w = textw(jdwmconf->statustext);
dc.w = textw(awesomeconf->statustext);
dc.x = DisplayWidth(disp, DefaultScreen(disp)) - dc.w;
if(dc.x < x)
{
dc.x = x;
dc.w = DisplayWidth(disp, DefaultScreen(disp)) - x;
}
drawtext(disp, jdwmconf->statustext, dc.norm);
if((dc.w = dc.x - x) > jdwmconf->statusbar.height)
drawtext(disp, awesomeconf->statustext, dc.norm);
if((dc.w = dc.x - x) > awesomeconf->statusbar.height)
{
dc.x = x;
if(sel)
@ -146,6 +146,6 @@ drawstatus(Display *disp, jdwm_config * jdwmconf)
else
drawtext(disp, NULL, dc.norm);
}
XCopyArea(disp, dc.drawable, jdwmconf->statusbar.window, dc.gc, 0, 0, DisplayWidth(disp, DefaultScreen(disp)), jdwmconf->statusbar.height, 0, 0);
XCopyArea(disp, dc.drawable, awesomeconf->statusbar.window, dc.gc, 0, 0, DisplayWidth(disp, DefaultScreen(disp)), awesomeconf->statusbar.height, 0, 0);
XSync(disp, False);
}

2
draw.h
View File

@ -8,7 +8,7 @@
#define textw(text) (textnw(text, strlen(text)) + dc.font.height)
void drawstatus(Display *, jdwm_config *); /* draw the bar */
void drawstatus(Display *, awesome_config *); /* draw the bar */
unsigned int textnw(const char *, unsigned int);
#endif

138
event.c
View File

@ -4,7 +4,7 @@
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "jdwm.h"
#include "awesome.h"
#include "util.h"
#include "event.h"
#include "layout.h"
@ -19,7 +19,7 @@ extern Cursor cursor[CurLast];
extern Client *clients, *sel; /* global client list */
extern Atom netatom[NetLast];
#define CLEANMASK(mask) (mask & ~(jdwmconf->numlockmask | LockMask))
#define CLEANMASK(mask) (mask & ~(awesomeconf->numlockmask | LockMask))
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
static Client *
@ -32,7 +32,7 @@ getclient(Window w)
}
static void
movemouse(Client * c, jdwm_config *jdwmconf)
movemouse(Client * c, awesome_config *awesomeconf)
{
int x1, y1, ocx, ocy, di, nx, ny;
unsigned int dui;
@ -56,19 +56,19 @@ movemouse(Client * c, jdwm_config *jdwmconf)
case ConfigureRequest:
case Expose:
case MapRequest:
handle_event_maprequest(&ev, jdwmconf);
handle_event_maprequest(&ev, awesomeconf);
break;
case MotionNotify:
XSync(c->display, False);
nx = ocx + (ev.xmotion.x - x1);
ny = ocy + (ev.xmotion.y - y1);
if(abs(wax + nx) < jdwmconf->snap)
if(abs(wax + nx) < awesomeconf->snap)
nx = wax;
else if(abs((wax + waw) - (nx + c->w + 2 * c->border)) < jdwmconf->snap)
else if(abs((wax + waw) - (nx + c->w + 2 * c->border)) < awesomeconf->snap)
nx = wax + waw - c->w - 2 * c->border;
if(abs(way - ny) < jdwmconf->snap)
if(abs(way - ny) < awesomeconf->snap)
ny = way;
else if(abs((way + wah) - (ny + c->h + 2 * c->border)) < jdwmconf->snap)
else if(abs((way + wah) - (ny + c->h + 2 * c->border)) < awesomeconf->snap)
ny = way + wah - c->h - 2 * c->border;
resize(c, nx, ny, c->w, c->h, False);
break;
@ -77,7 +77,7 @@ movemouse(Client * c, jdwm_config *jdwmconf)
}
static void
resizemouse(Client * c, jdwm_config *jdwmconf)
resizemouse(Client * c, awesome_config *awesomeconf)
{
int ocx, ocy;
int nw, nh;
@ -103,7 +103,7 @@ resizemouse(Client * c, jdwm_config *jdwmconf)
case ConfigureRequest:
case Expose:
case MapRequest:
handle_event_maprequest(&ev, jdwmconf);
handle_event_maprequest(&ev, awesomeconf);
break;
case MotionNotify:
XSync(c->display, False);
@ -118,69 +118,69 @@ resizemouse(Client * c, jdwm_config *jdwmconf)
}
void
handle_event_buttonpress(XEvent * e, jdwm_config *jdwmconf)
handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
{
int i, x;
Client *c;
XButtonPressedEvent *ev = &e->xbutton;
if(jdwmconf->statusbar.window == ev->window)
if(awesomeconf->statusbar.window == ev->window)
{
x = 0;
for(i = 0; i < jdwmconf->ntags; i++)
for(i = 0; i < awesomeconf->ntags; i++)
{
x += textw(jdwmconf->tags[i]);
x += textw(awesomeconf->tags[i]);
if(ev->x < x)
{
if(ev->button == Button1)
{
if(ev->state & jdwmconf->modkey)
uicb_tag(e->xany.display, jdwmconf, jdwmconf->tags[i]);
if(ev->state & awesomeconf->modkey)
uicb_tag(e->xany.display, awesomeconf, awesomeconf->tags[i]);
else
uicb_view(e->xany.display, jdwmconf, jdwmconf->tags[i]);
uicb_view(e->xany.display, awesomeconf, awesomeconf->tags[i]);
}
else if(ev->button == Button3)
{
if(ev->state & jdwmconf->modkey)
uicb_toggletag(e->xany.display, jdwmconf, jdwmconf->tags[i]);
if(ev->state & awesomeconf->modkey)
uicb_toggletag(e->xany.display, awesomeconf, awesomeconf->tags[i]);
else
uicb_toggleview(e->xany.display, jdwmconf, jdwmconf->tags[i]);
uicb_toggleview(e->xany.display, awesomeconf, awesomeconf->tags[i]);
}
return;
}
}
if((ev->x < x + jdwmconf->statusbar.width) && ev->button == Button1)
uicb_setlayout(e->xany.display, jdwmconf, NULL);
if((ev->x < x + awesomeconf->statusbar.width) && ev->button == Button1)
uicb_setlayout(e->xany.display, awesomeconf, NULL);
}
else if((c = getclient(ev->window)))
{
focus(c->display, &dc, c, ev->same_screen, jdwmconf);
if(CLEANMASK(ev->state) != jdwmconf->modkey)
focus(c->display, &dc, c, ev->same_screen, awesomeconf);
if(CLEANMASK(ev->state) != awesomeconf->modkey)
return;
if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating))
{
restack(e->xany.display, jdwmconf);
movemouse(c, jdwmconf);
restack(e->xany.display, awesomeconf);
movemouse(c, awesomeconf);
}
else if(ev->button == Button2)
uicb_zoom(e->xany.display, jdwmconf, NULL);
uicb_zoom(e->xany.display, awesomeconf, NULL);
else if(ev->button == Button3 && (IS_ARRANGE(floating) || c->isfloating) && !c->isfixed)
{
restack(e->xany.display, jdwmconf);
resizemouse(c, jdwmconf);
restack(e->xany.display, awesomeconf);
resizemouse(c, awesomeconf);
}
}
else if(DefaultRootWindow(e->xany.display) == ev->window && !sel)
{
if(ev->button == Button4)
uicb_tag_viewnext(e->xany.display, jdwmconf, NULL);
uicb_tag_viewnext(e->xany.display, awesomeconf, NULL);
else if(ev->button == Button5)
uicb_tag_viewprev(e->xany.display, jdwmconf, NULL);
uicb_tag_viewprev(e->xany.display, awesomeconf, NULL);
}
}
void
handle_event_configurerequest(XEvent * e, jdwm_config *jdwmconf __attribute__ ((unused)))
handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf __attribute__ ((unused)))
{
Client *c;
XConfigureRequestEvent *ev = &e->xconfigurerequest;
@ -207,7 +207,7 @@ handle_event_configurerequest(XEvent * e, jdwm_config *jdwmconf __attribute__ ((
c->y = DisplayHeight(c->display, DefaultScreen(c->display)) / 2 - c->h / 2; /* center in y direction */
if((ev->value_mask & (CWX | CWY)) && !(ev->value_mask & (CWWidth | CWHeight)))
configure(c);
if(isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags))
XMoveResizeWindow(e->xany.display, c->win, c->x, c->y, c->w, c->h);
}
else
@ -228,7 +228,7 @@ handle_event_configurerequest(XEvent * e, jdwm_config *jdwmconf __attribute__ ((
}
void
handle_event_configurenotify(XEvent * e, jdwm_config *jdwmconf)
handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
{
XConfigureEvent *ev = &e->xconfigure;
@ -237,25 +237,25 @@ handle_event_configurenotify(XEvent * e, jdwm_config *jdwmconf)
DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)) = ev->width;
DisplayHeight(e->xany.display, DefaultScreen(e->xany.display)) = ev->height;
XFreePixmap(e->xany.display, dc.drawable);
dc.drawable = XCreatePixmap(e->xany.display, DefaultRootWindow(e->xany.display), DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), jdwmconf->statusbar.height, DefaultDepth(e->xany.display, DefaultScreen(e->xany.display)));
XResizeWindow(e->xany.display, jdwmconf->statusbar.window, DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), jdwmconf->statusbar.height);
updatebarpos(e->xany.display, jdwmconf->statusbar);
arrange(e->xany.display, jdwmconf);
dc.drawable = XCreatePixmap(e->xany.display, DefaultRootWindow(e->xany.display), DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), awesomeconf->statusbar.height, DefaultDepth(e->xany.display, DefaultScreen(e->xany.display)));
XResizeWindow(e->xany.display, awesomeconf->statusbar.window, DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), awesomeconf->statusbar.height);
updatebarpos(e->xany.display, awesomeconf->statusbar);
arrange(e->xany.display, awesomeconf);
}
}
void
handle_event_destroynotify(XEvent * e, jdwm_config *jdwmconf)
handle_event_destroynotify(XEvent * e, awesome_config *awesomeconf)
{
Client *c;
XDestroyWindowEvent *ev = &e->xdestroywindow;
if((c = getclient(ev->window)))
unmanage(c, &dc, WithdrawnState, jdwmconf);
unmanage(c, &dc, WithdrawnState, awesomeconf);
}
void
handle_event_enternotify(XEvent * e, jdwm_config *jdwmconf)
handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
{
Client *c;
XCrossingEvent *ev = &e->xcrossing;
@ -263,55 +263,55 @@ handle_event_enternotify(XEvent * e, jdwm_config *jdwmconf)
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
return;
if((c = getclient(ev->window)))
focus(c->display, &dc, c, ev->same_screen, jdwmconf);
focus(c->display, &dc, c, ev->same_screen, awesomeconf);
else if(ev->window == DefaultRootWindow(e->xany.display))
focus(e->xany.display, &dc, NULL, True, jdwmconf);
focus(e->xany.display, &dc, NULL, True, awesomeconf);
}
void
handle_event_expose(XEvent * e, jdwm_config *jdwmconf)
handle_event_expose(XEvent * e, awesome_config *awesomeconf)
{
XExposeEvent *ev = &e->xexpose;
if(!ev->count && jdwmconf->statusbar.window == ev->window)
drawstatus(e->xany.display, jdwmconf);
if(!ev->count && awesomeconf->statusbar.window == ev->window)
drawstatus(e->xany.display, awesomeconf);
}
void
handle_event_keypress(XEvent * e, jdwm_config *jdwmconf)
handle_event_keypress(XEvent * e, awesome_config *awesomeconf)
{
int i;
KeySym keysym;
XKeyEvent *ev = &e->xkey;
keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0);
for(i = 0; i < jdwmconf->nkeys; i++)
if(keysym == jdwmconf->keys[i].keysym
&& CLEANMASK(jdwmconf->keys[i].mod) == CLEANMASK(ev->state) && jdwmconf->keys[i].func)
jdwmconf->keys[i].func(e->xany.display, jdwmconf, jdwmconf->keys[i].arg);
for(i = 0; i < awesomeconf->nkeys; i++)
if(keysym == awesomeconf->keys[i].keysym
&& CLEANMASK(awesomeconf->keys[i].mod) == CLEANMASK(ev->state) && awesomeconf->keys[i].func)
awesomeconf->keys[i].func(e->xany.display, awesomeconf, awesomeconf->keys[i].arg);
}
void
handle_event_leavenotify(XEvent * e, jdwm_config *jdwmconf)
handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf)
{
XCrossingEvent *ev = &e->xcrossing;
if((ev->window == DefaultRootWindow(e->xany.display)) && !ev->same_screen)
focus(e->xany.display, &dc, NULL, ev->same_screen, jdwmconf);
focus(e->xany.display, &dc, NULL, ev->same_screen, awesomeconf);
}
void
handle_event_mappingnotify(XEvent * e, jdwm_config *jdwmconf)
handle_event_mappingnotify(XEvent * e, awesome_config *awesomeconf)
{
XMappingEvent *ev = &e->xmapping;
XRefreshKeyboardMapping(ev);
if(ev->request == MappingKeyboard)
grabkeys(e->xany.display, jdwmconf);
grabkeys(e->xany.display, awesomeconf);
}
void
handle_event_maprequest(XEvent * e, jdwm_config *jdwmconf)
handle_event_maprequest(XEvent * e, awesome_config *awesomeconf)
{
static XWindowAttributes wa;
XMapRequestEvent *ev = &e->xmaprequest;
@ -321,11 +321,11 @@ handle_event_maprequest(XEvent * e, jdwm_config *jdwmconf)
if(wa.override_redirect)
return;
if(!getclient(ev->window))
manage(e->xany.display, &dc, ev->window, &wa, jdwmconf);
manage(e->xany.display, &dc, ev->window, &wa, awesomeconf);
}
void
handle_event_propertynotify(XEvent * e, jdwm_config *jdwmconf)
handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
{
Client *c;
Window trans;
@ -342,7 +342,7 @@ handle_event_propertynotify(XEvent * e, jdwm_config *jdwmconf)
case XA_WM_TRANSIENT_FOR:
XGetTransientForHint(e->xany.display, c->win, &trans);
if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL)))
arrange(e->xany.display, jdwmconf);
arrange(e->xany.display, awesomeconf);
break;
case XA_WM_NORMAL_HINTS:
updatesizehints(c);
@ -352,35 +352,35 @@ handle_event_propertynotify(XEvent * e, jdwm_config *jdwmconf)
{
updatetitle(c);
if(c == sel)
drawstatus(e->xany.display, jdwmconf);
drawstatus(e->xany.display, awesomeconf);
}
}
}
void
handle_event_unmapnotify(XEvent * e, jdwm_config *jdwmconf)
handle_event_unmapnotify(XEvent * e, awesome_config *awesomeconf)
{
Client *c;
XUnmapEvent *ev = &e->xunmap;
if((c = getclient(ev->window)) && ev->event == DefaultRootWindow(e->xany.display) && (ev->send_event || !c->unmapped--))
unmanage(c, &dc, WithdrawnState, jdwmconf);
unmanage(c, &dc, WithdrawnState, awesomeconf);
}
void
grabkeys(Display *disp, jdwm_config *jdwmconf)
grabkeys(Display *disp, awesome_config *awesomeconf)
{
int i;
KeyCode code;
XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp));
for(i = 0; i < jdwmconf->nkeys; i++)
for(i = 0; i < awesomeconf->nkeys; i++)
{
code = XKeysymToKeycode(disp, jdwmconf->keys[i].keysym);
XGrabKey(disp, code, jdwmconf->keys[i].mod, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
XGrabKey(disp, code, jdwmconf->keys[i].mod | LockMask, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
XGrabKey(disp, code, jdwmconf->keys[i].mod | jdwmconf->numlockmask, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
XGrabKey(disp, code, jdwmconf->keys[i].mod | jdwmconf->numlockmask | LockMask, DefaultRootWindow(disp), True,
code = XKeysymToKeycode(disp, awesomeconf->keys[i].keysym);
XGrabKey(disp, code, awesomeconf->keys[i].mod, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
XGrabKey(disp, code, awesomeconf->keys[i].mod | LockMask, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
XGrabKey(disp, code, awesomeconf->keys[i].mod | awesomeconf->numlockmask, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
XGrabKey(disp, code, awesomeconf->keys[i].mod | awesomeconf->numlockmask | LockMask, DefaultRootWindow(disp), True,
GrabModeAsync, GrabModeAsync);
}
}

26
event.h
View File

@ -5,19 +5,19 @@
#include "config.h"
void grabkeys(Display *, jdwm_config *); /* grab all keys defined in config */
void grabkeys(Display *, awesome_config *); /* grab all keys defined in config */
void handle_event_buttonpress(XEvent *, jdwm_config *);
void handle_event_configurerequest(XEvent *, jdwm_config *);
void handle_event_configurenotify(XEvent *, jdwm_config *);
void handle_event_destroynotify(XEvent *, jdwm_config *);
void handle_event_enternotify(XEvent *, jdwm_config *);
void handle_event_expose(XEvent *, jdwm_config *);
void handle_event_keypress(XEvent *, jdwm_config *);
void handle_event_leavenotify(XEvent *, jdwm_config *);
void handle_event_mappingnotify(XEvent *, jdwm_config *);
void handle_event_maprequest(XEvent *, jdwm_config *);
void handle_event_propertynotify(XEvent *, jdwm_config *);
void handle_event_unmapnotify(XEvent *, jdwm_config *);
void handle_event_buttonpress(XEvent *, awesome_config *);
void handle_event_configurerequest(XEvent *, awesome_config *);
void handle_event_configurenotify(XEvent *, awesome_config *);
void handle_event_destroynotify(XEvent *, awesome_config *);
void handle_event_enternotify(XEvent *, awesome_config *);
void handle_event_expose(XEvent *, awesome_config *);
void handle_event_keypress(XEvent *, awesome_config *);
void handle_event_leavenotify(XEvent *, awesome_config *);
void handle_event_mappingnotify(XEvent *, awesome_config *);
void handle_event_maprequest(XEvent *, awesome_config *);
void handle_event_propertynotify(XEvent *, awesome_config *);
void handle_event_unmapnotify(XEvent *, awesome_config *);
#endif

114
layout.c
View File

@ -4,7 +4,7 @@
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "jdwm.h"
#include "awesome.h"
#include "layout.h"
#include "tag.h"
#include "layouts/floating.h"
@ -16,84 +16,84 @@ extern Client *clients, *sel; /* global client list */
extern DC dc;
void
arrange(Display * disp, jdwm_config *jdwmconf)
arrange(Display * disp, awesome_config *awesomeconf)
{
Client *c;
for(c = clients; c; c = c->next)
if(isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags))
unban(c);
else
ban(c);
jdwmconf->current_layout->arrange(disp, jdwmconf);
focus(disp, &dc, NULL, True, jdwmconf);
restack(disp, jdwmconf);
awesomeconf->current_layout->arrange(disp, awesomeconf);
focus(disp, &dc, NULL, True, awesomeconf);
restack(disp, awesomeconf);
}
void
uicb_focusnext(Display *disp __attribute__ ((unused)),
jdwm_config * jdwmconf,
awesome_config * awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *c;
if(!sel)
return;
for(c = sel->next; c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags); c = c->next);
for(c = sel->next; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next);
if(!c)
for(c = clients; c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags); c = c->next);
for(c = clients; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next);
if(c)
{
focus(c->display, &dc, c, True, jdwmconf);
restack(c->display, jdwmconf);
focus(c->display, &dc, c, True, awesomeconf);
restack(c->display, awesomeconf);
}
}
void
uicb_focusprev(Display *disp __attribute__ ((unused)),
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *c;
if(!sel)
return;
for(c = sel->prev; c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags); c = c->prev);
for(c = sel->prev; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->prev);
if(!c)
{
for(c = clients; c && c->next; c = c->next);
for(; c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags); c = c->prev);
for(; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->prev);
}
if(c)
{
focus(c->display, &dc, c, True, jdwmconf);
restack(c->display, jdwmconf);
focus(c->display, &dc, c, True, awesomeconf);
restack(c->display, awesomeconf);
}
}
void
loadjdwmprops(Display *disp, jdwm_config * jdwmconf)
loadawesomeprops(Display *disp, awesome_config * awesomeconf)
{
int i;
char *prop;
prop = p_new(char, jdwmconf->ntags + 1);
prop = p_new(char, awesomeconf->ntags + 1);
if(gettextprop(disp, DefaultRootWindow(disp), JDWMPROPS_ATOM(disp), prop, jdwmconf->ntags + 1))
for(i = 0; i < jdwmconf->ntags && prop[i]; i++)
jdwmconf->selected_tags[i] = prop[i] == '1';
if(gettextprop(disp, DefaultRootWindow(disp), JDWMPROPS_ATOM(disp), prop, awesomeconf->ntags + 1))
for(i = 0; i < awesomeconf->ntags && prop[i]; i++)
awesomeconf->selected_tags[i] = prop[i] == '1';
p_delete(&prop);
}
void
restack(Display * disp, jdwm_config *jdwmconf)
restack(Display * disp, awesome_config *awesomeconf)
{
Client *c;
XEvent ev;
XWindowChanges wc;
drawstatus(disp, jdwmconf);
drawstatus(disp, awesomeconf);
if(!sel)
return;
if(sel->isfloating || IS_ARRANGE(floating))
@ -101,7 +101,7 @@ restack(Display * disp, jdwm_config *jdwmconf)
if(!IS_ARRANGE(floating))
{
wc.stack_mode = Below;
wc.sibling = jdwmconf->statusbar.window;
wc.sibling = awesomeconf->statusbar.window;
if(!sel->isfloating)
{
XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc);
@ -109,7 +109,7 @@ restack(Display * disp, jdwm_config *jdwmconf)
}
for(c = clients; c; c = c->next)
{
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags) || c == sel)
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags) || c == sel)
continue;
XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc);
wc.sibling = c->win;
@ -120,14 +120,14 @@ restack(Display * disp, jdwm_config *jdwmconf)
}
void
savejdwmprops(Display *disp, jdwm_config *jdwmconf)
saveawesomeprops(Display *disp, awesome_config *awesomeconf)
{
int i;
char *prop;
prop = p_new(char, jdwmconf->ntags + 1);
for(i = 0; i < jdwmconf->ntags; i++)
prop[i] = jdwmconf->selected_tags[i] ? '1' : '0';
prop = p_new(char, awesomeconf->ntags + 1);
for(i = 0; i < awesomeconf->ntags; i++)
prop[i] = awesomeconf->selected_tags[i] ? '1' : '0';
prop[i] = '\0';
XChangeProperty(disp, DefaultRootWindow(disp),
JDWMPROPS_ATOM(disp), XA_STRING, 8,
@ -136,54 +136,54 @@ savejdwmprops(Display *disp, jdwm_config *jdwmconf)
}
void
uicb_setlayout(Display *disp, jdwm_config * jdwmconf, const char *arg)
uicb_setlayout(Display *disp, awesome_config * awesomeconf, const char *arg)
{
int i, j;
Client *c;
if(!arg)
{
if(!(++jdwmconf->current_layout)->symbol)
jdwmconf->current_layout = &jdwmconf->layouts[0];
if(!(++awesomeconf->current_layout)->symbol)
awesomeconf->current_layout = &awesomeconf->layouts[0];
}
else
{
i = strtol(arg, NULL, 10);
if(i < 0 || i >= jdwmconf->nlayouts)
if(i < 0 || i >= awesomeconf->nlayouts)
return;
jdwmconf->current_layout = &jdwmconf->layouts[i];
awesomeconf->current_layout = &awesomeconf->layouts[i];
}
for(c = clients; c; c = c->next)
c->ftview = True;
if(sel)
arrange(disp, jdwmconf);
arrange(disp, awesomeconf);
else
drawstatus(disp, jdwmconf);
drawstatus(disp, awesomeconf);
savejdwmprops(disp, jdwmconf);
saveawesomeprops(disp, awesomeconf);
for(j = 0; j < jdwmconf->ntags; j++)
if (jdwmconf->selected_tags[j])
jdwmconf->tag_layouts[j] = jdwmconf->current_layout;
for(j = 0; j < awesomeconf->ntags; j++)
if (awesomeconf->selected_tags[j])
awesomeconf->tag_layouts[j] = awesomeconf->current_layout;
}
void
uicb_togglebar(Display *disp,
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
if(jdwmconf->statusbar.position == BarOff)
jdwmconf->statusbar.position = (jdwmconf->statusbar.position == BarOff) ? BarTop : jdwmconf->statusbar_default_position;
if(awesomeconf->statusbar.position == BarOff)
awesomeconf->statusbar.position = (awesomeconf->statusbar.position == BarOff) ? BarTop : awesomeconf->statusbar_default_position;
else
jdwmconf->statusbar.position = BarOff;
updatebarpos(disp, jdwmconf->statusbar);
arrange(disp, jdwmconf);
awesomeconf->statusbar.position = BarOff;
updatebarpos(disp, awesomeconf->statusbar);
arrange(disp, awesomeconf);
}
static void
maximize(int x, int y, int w, int h, jdwm_config *jdwmconf)
maximize(int x, int y, int w, int h, awesome_config *awesomeconf)
{
XEvent ev;
@ -205,48 +205,48 @@ maximize(int x, int y, int w, int h, jdwm_config *jdwmconf)
else
sel->isfloating = False;
drawstatus(sel->display, jdwmconf);
drawstatus(sel->display, awesomeconf);
while(XCheckMaskEvent(sel->display, EnterWindowMask, &ev));
}
void
uicb_togglemax(Display *disp __attribute__ ((unused)),
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
maximize(wax, way, waw - 2 * jdwmconf->borderpx, wah - 2 * jdwmconf->borderpx, jdwmconf);
maximize(wax, way, waw - 2 * awesomeconf->borderpx, wah - 2 * awesomeconf->borderpx, awesomeconf);
}
void
uicb_toggleverticalmax(Display *disp __attribute__ ((unused)),
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
if(sel)
maximize(sel->x, way, sel->w, wah - 2 * jdwmconf->borderpx, jdwmconf);
maximize(sel->x, way, sel->w, wah - 2 * awesomeconf->borderpx, awesomeconf);
}
void
uicb_togglehorizontalmax(Display *disp __attribute__ ((unused)),
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
if(sel)
maximize(wax, sel->y, waw - 2 * jdwmconf->borderpx, sel->h, jdwmconf);
maximize(wax, sel->y, waw - 2 * awesomeconf->borderpx, sel->h, awesomeconf);
}
void
uicb_zoom(Display *disp __attribute__ ((unused)),
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
if(!sel)
return;
detach(sel);
attach(sel);
focus(sel->display, &dc, sel, True, jdwmconf);
arrange(sel->display, jdwmconf);
focus(sel->display, &dc, sel, True, awesomeconf);
arrange(sel->display, awesomeconf);
}

View File

@ -6,21 +6,21 @@
#include "client.h"
/** Check if current layout is arranged with a layout */
#define IS_ARRANGE(layout) (layout == jdwmconf->current_layout->arrange)
#define IS_ARRANGE(layout) (layout == awesomeconf->current_layout->arrange)
#define JDWMPROPS_ATOM(disp) XInternAtom(disp, "_JDWM_PROPERTIES", False)
void arrange(Display *, jdwm_config *); /* arranges all windows depending on the layout in use */
void restack(Display *, jdwm_config *); /* restores z layers of all clients */
void uicb_focusnext(Display *, jdwm_config *, const char *); /* focuses next visible client */
void uicb_focusprev(Display *, jdwm_config *, const char *); /* focuses prev visible client */
void uicb_setlayout(Display *, jdwm_config *, const char *); /* sets layout, NULL means next layout */
void uicb_togglebar(Display *, jdwm_config *, const char *); /* shows/hides the bar */
void uicb_togglemax(Display *, jdwm_config *, const char *); /* toggles maximization of floating client */
void uicb_toggleverticalmax(Display *, jdwm_config *, const char *);
void uicb_togglehorizontalmax(Display *, jdwm_config *, const char *);
void uicb_zoom(Display *, jdwm_config *, const char *); /* set current window first in stack */
void loadjdwmprops(Display *, jdwm_config *);
void savejdwmprops(Display *disp, jdwm_config *);
void arrange(Display *, awesome_config *); /* arranges all windows depending on the layout in use */
void restack(Display *, awesome_config *); /* restores z layers of all clients */
void uicb_focusnext(Display *, awesome_config *, const char *); /* focuses next visible client */
void uicb_focusprev(Display *, awesome_config *, const char *); /* focuses prev visible client */
void uicb_setlayout(Display *, awesome_config *, const char *); /* sets layout, NULL means next layout */
void uicb_togglebar(Display *, awesome_config *, const char *); /* shows/hides the bar */
void uicb_togglemax(Display *, awesome_config *, const char *); /* toggles maximization of floating client */
void uicb_toggleverticalmax(Display *, awesome_config *, const char *);
void uicb_togglehorizontalmax(Display *, awesome_config *, const char *);
void uicb_zoom(Display *, awesome_config *, const char *); /* set current window first in stack */
void loadawesomeprops(Display *, awesome_config *);
void saveawesomeprops(Display *disp, awesome_config *);
#endif

View File

@ -7,12 +7,12 @@
extern Client *clients; /* global client */
void
floating(Display *disp __attribute__ ((unused)), jdwm_config *jdwmconf)
floating(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
{ /* default floating layout */
Client *c;
for(c = clients; c; c = c->next)
if(isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags))
{
if(c->ftview)
{

View File

@ -3,6 +3,6 @@
#ifndef JDWM_FLOATING_H
#define JDWM_FLOATING_H
void floating(Display *, jdwm_config *); /* floating layout */
void floating(Display *, awesome_config *); /* floating layout */
#endif

View File

@ -9,13 +9,13 @@ extern Client *clients; /* global client list and stack */
extern DC dc;
void
grid(Display *disp, jdwm_config *jdwmconf)
grid(Display *disp, awesome_config *awesomeconf)
{
unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows;
Client *c;
for(n = 0, c = clients; c; c = c->next)
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
n++;
/* grid dimensions */
@ -29,14 +29,14 @@ grid(Display *disp, jdwm_config *jdwmconf)
cw = waw / (cols ? cols : 1);
for(i = 0, c = clients; c; c = c->next)
if(isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags))
{
unban(c);
if(c->isfloating)
continue;
c->ismax = False;
cx = (i / rows) * cw;
cy = (i % rows) * ch + (jdwmconf->statusbar.position == BarTop ? jdwmconf->statusbar.height : 0); // bh? adjust
cy = (i % rows) * ch + (awesomeconf->statusbar.position == BarTop ? awesomeconf->statusbar.height : 0); // bh? adjust
/* adjust height/width of last row/column's windows */
ah = ((i + 1) % rows == 0) ? wah - ch * rows : 0;
aw = (i >= rows * (cols - 1)) ? waw - cw * cols : 0;
@ -45,6 +45,6 @@ grid(Display *disp, jdwm_config *jdwmconf)
}
else
ban(c);
focus(disp, &dc, NULL, True, jdwmconf);
restack(disp, jdwmconf);
focus(disp, &dc, NULL, True, awesomeconf);
restack(disp, awesomeconf);
}

View File

@ -6,6 +6,6 @@
#include "config.h"
/* grid.c */
void grid(Display *, jdwm_config *);
void grid(Display *, awesome_config *);
#endif

View File

@ -9,7 +9,7 @@ extern Client *clients; /* global client list */
extern DC dc;
static void
fibonacci(Display *disp, jdwm_config *jdwmconf, int shape)
fibonacci(Display *disp, awesome_config *awesomeconf, int shape)
{
int n, nx, ny, nh, nw, i;
Client *c;
@ -19,7 +19,7 @@ fibonacci(Display *disp, jdwm_config *jdwmconf, int shape)
nw = waw;
nh = wah;
for(n = 0, c = clients; c; c = c->next)
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
n++;
for(i = 0, c = clients; c; c = c->next)
{
@ -60,19 +60,19 @@ fibonacci(Display *disp, jdwm_config *jdwmconf, int shape)
}
resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False);
}
focus(disp, &dc, NULL, True, jdwmconf);
restack(disp, jdwmconf);
focus(disp, &dc, NULL, True, awesomeconf);
restack(disp, awesomeconf);
}
void
dwindle(Display *disp, jdwm_config *jdwmconf)
dwindle(Display *disp, awesome_config *awesomeconf)
{
fibonacci(disp, jdwmconf, 1);
fibonacci(disp, awesomeconf, 1);
}
void
spiral(Display *disp, jdwm_config *jdwmconf)
spiral(Display *disp, awesome_config *awesomeconf)
{
fibonacci(disp, jdwmconf, 0);
fibonacci(disp, awesomeconf, 0);
}

View File

@ -3,7 +3,7 @@
#ifndef JDWM_SPIRAL_H
#define JDWM_SPIRAL_H
void dwindle(Display *, jdwm_config *); /* dwindle windows */
void spiral(Display *, jdwm_config *); /* spiral windows */
void dwindle(Display *, awesome_config *); /* dwindle windows */
void spiral(Display *, awesome_config *); /* spiral windows */
#endif

View File

@ -14,13 +14,13 @@ extern Client *sel, *clients;
/* static */
static double mwfact = 0.6;
static void _tile(jdwm_config *, const Bool); /* arranges all windows tiled */
static void _tile(awesome_config *, const Bool); /* arranges all windows tiled */
static int nmaster = 2;
void
uicb_incnmaster(Display *disp,
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char * arg)
{
int i;
@ -28,23 +28,23 @@ uicb_incnmaster(Display *disp,
if(!IS_ARRANGE(tile) && !IS_ARRANGE(tileleft) && !IS_ARRANGE(bstack) && !IS_ARRANGE(bstackportrait))
return;
if(!arg)
nmaster = jdwmconf->nmaster;
nmaster = awesomeconf->nmaster;
else
{
i = strtol(arg, (char **) NULL, 10);
if((nmaster + i) < 1 || wah / (nmaster + i) <= 2 * jdwmconf->borderpx)
if((nmaster + i) < 1 || wah / (nmaster + i) <= 2 * awesomeconf->borderpx)
return;
nmaster += i;
}
if(sel)
arrange(disp, jdwmconf);
arrange(disp, awesomeconf);
else
drawstatus(disp, jdwmconf);
drawstatus(disp, awesomeconf);
}
void
uicb_setmwfact(Display *disp,
jdwm_config * jdwmconf,
awesome_config * awesomeconf,
const char *arg)
{
double delta;
@ -54,7 +54,7 @@ uicb_setmwfact(Display *disp,
/* arg handling, manipulate mwfact */
if(!arg)
mwfact = jdwmconf->mwfact;
mwfact = awesomeconf->mwfact;
else if(1 == sscanf(arg, "%lf", &delta))
{
if(arg[0] != '+' && arg[0] != '-')
@ -66,32 +66,32 @@ uicb_setmwfact(Display *disp,
else if(mwfact > 0.9)
mwfact = 0.9;
}
arrange(disp, jdwmconf);
arrange(disp, awesomeconf);
}
static void
_tile(jdwm_config *jdwmconf, const Bool right)
_tile(awesome_config *awesomeconf, const Bool right)
{
unsigned int nx, ny, nw, nh, mw;
int n, th, i, mh;
Client *c;
for(n = 0, c = clients; c; c = c->next)
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
n++;
/* window geoms */
mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster;
mw = (n <= nmaster) ? waw : mwfact * waw;
th = (n > nmaster) ? wah / (n - nmaster) : 0;
if(n > nmaster && th < jdwmconf->statusbar.height)
if(n > nmaster && th < awesomeconf->statusbar.height)
th = wah;
nx = wax;
ny = way;
for(i = 0, c = clients; c; c = c->next)
{
if(!IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(!IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
continue;
c->ismax = False;
@ -122,7 +122,7 @@ _tile(jdwm_config *jdwmconf, const Bool right)
else
nh = th - 2 * c->border;
}
resize(c, nx, ny, nw, nh, jdwmconf->resize_hints);
resize(c, nx, ny, nw, nh, awesomeconf->resize_hints);
if(n > nmaster && th != wah)
ny += nh + 2 * c->border;
i++;
@ -130,26 +130,26 @@ _tile(jdwm_config *jdwmconf, const Bool right)
}
void
tile(Display *disp __attribute__ ((unused)), jdwm_config *jdwmconf)
tile(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
{
_tile(jdwmconf, True);
_tile(awesomeconf, True);
}
void
tileleft(Display *disp __attribute__ ((unused)), jdwm_config *jdwmconf)
tileleft(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
{
_tile(jdwmconf, False);
_tile(awesomeconf, False);
}
static void
_bstack(jdwm_config *jdwmconf, Bool portrait)
_bstack(awesome_config *awesomeconf, Bool portrait)
{
int i, n, nx, ny, nw, nh, mw, mh, tw, th;
Client *c;
for(n = 0, c = clients; c; c = c->next)
if(IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
n++;
/* window geoms */
@ -160,7 +160,7 @@ _bstack(jdwm_config *jdwmconf, Bool portrait)
for(i = 0, c = clients; c; c = c->next)
{
if(!IS_TILED(c, jdwmconf->selected_tags, jdwmconf->ntags))
if(!IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
continue;
c->ismax = False;
@ -199,13 +199,13 @@ _bstack(jdwm_config *jdwmconf, Bool portrait)
}
void
bstack(Display *disp __attribute__ ((unused)), jdwm_config *jdwmconf)
bstack(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
{
_bstack(jdwmconf, False);
_bstack(awesomeconf, False);
}
void
bstackportrait(Display *disp __attribute__ ((unused)), jdwm_config *jdwmconf)
bstackportrait(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
{
_bstack(jdwmconf, True);
_bstack(awesomeconf, True);
}

View File

@ -5,11 +5,11 @@
#include <config.h>
void uicb_incnmaster(Display *, jdwm_config *, const char *); /* change number of master windows */
void uicb_setmwfact(Display *, jdwm_config *, const char *); /* sets master width factor */
void tile(Display *, jdwm_config *);
void tileleft(Display *, jdwm_config *);
void bstack(Display *, jdwm_config *);
void bstackportrait(Display *, jdwm_config *);
void uicb_incnmaster(Display *, awesome_config *, const char *); /* change number of master windows */
void uicb_setmwfact(Display *, awesome_config *, const char *); /* sets master width factor */
void tile(Display *, awesome_config *);
void tileleft(Display *, awesome_config *);
void bstack(Display *, awesome_config *);
void bstackportrait(Display *, awesome_config *);
#endif

142
tag.c
View File

@ -33,7 +33,7 @@ idxoftag(const char *tag_to_find, const char **tags, int ntags)
}
void
applyrules(Client * c, jdwm_config *jdwmconf)
applyrules(Client * c, awesome_config *awesomeconf)
{
int i, j, len = 0;
regmatch_t tmp;
@ -53,12 +53,12 @@ applyrules(Client * c, jdwm_config *jdwmconf)
XGetClassHint(c->display, c->win, &ch);
snprintf(prop, len + 1, "%s:%s:%s",
ch.res_class ? ch.res_class : "", ch.res_name ? ch.res_name : "", c->name);
for(i = 0; i < jdwmconf->nrules; i++)
for(i = 0; i < awesomeconf->nrules; i++)
if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0))
{
c->isfloating = jdwmconf->rules[i].isfloating;
for(j = 0; regs[i].tagregex && j < jdwmconf->ntags; j++)
if(!regexec(regs[i].tagregex, jdwmconf->tags[j], 1, &tmp, 0))
c->isfloating = awesomeconf->rules[i].isfloating;
for(j = 0; regs[i].tagregex && j < awesomeconf->ntags; j++)
if(!regexec(regs[i].tagregex, awesomeconf->tags[j], 1, &tmp, 0))
{
matched = True;
c->tags[j] = True;
@ -70,33 +70,33 @@ applyrules(Client * c, jdwm_config *jdwmconf)
if(ch.res_name)
XFree(ch.res_name);
if(!matched)
for(i = 0; i < jdwmconf->ntags; i++)
c->tags[i] = jdwmconf->selected_tags[i];
for(i = 0; i < awesomeconf->ntags; i++)
c->tags[i] = awesomeconf->selected_tags[i];
}
void
compileregs(jdwm_config * jdwmconf)
compileregs(awesome_config * awesomeconf)
{
int i;
regex_t *reg;
if(regs)
return;
regs = p_new(Regs, jdwmconf->nrules);
for(i = 0; i < jdwmconf->nrules; i++)
regs = p_new(Regs, awesomeconf->nrules);
for(i = 0; i < awesomeconf->nrules; i++)
{
if(jdwmconf->rules[i].prop)
if(awesomeconf->rules[i].prop)
{
reg = p_new(regex_t, 1);
if(regcomp(reg, jdwmconf->rules[i].prop, REG_EXTENDED))
if(regcomp(reg, awesomeconf->rules[i].prop, REG_EXTENDED))
p_delete(&reg);
else
regs[i].propregex = reg;
}
if(jdwmconf->rules[i].tags)
if(awesomeconf->rules[i].tags)
{
reg = p_new(regex_t, 1);
if(regcomp(reg, jdwmconf->rules[i].tags, REG_EXTENDED))
if(regcomp(reg, awesomeconf->rules[i].tags, REG_EXTENDED))
p_delete(&reg);
else
regs[i].tagregex = reg;
@ -130,19 +130,19 @@ isvisible(Client * c, Bool * tags, int ntags)
* \ingroup ui_callback
*/
void
uicb_tag(Display *disp, jdwm_config *jdwmconf, const char *arg)
uicb_tag(Display *disp, awesome_config *awesomeconf, const char *arg)
{
int i;
if(!sel)
return;
for(i = 0; i < jdwmconf->ntags; i++)
for(i = 0; i < awesomeconf->ntags; i++)
sel->tags[i] = arg == NULL;
i = idxoftag(arg, jdwmconf->tags, jdwmconf->ntags);
if(i >= 0 && i < jdwmconf->ntags)
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
if(i >= 0 && i < awesomeconf->ntags)
sel->tags[i] = True;
saveprops(sel, jdwmconf->ntags);
arrange(disp, jdwmconf);
saveprops(sel, awesomeconf->ntags);
arrange(disp, awesomeconf);
}
/** Toggle floating state of a client
@ -152,7 +152,7 @@ uicb_tag(Display *disp, jdwm_config *jdwmconf, const char *arg)
*/
void
uicb_togglefloating(Display *disp,
jdwm_config * jdwmconf,
awesome_config * awesomeconf,
const char *arg __attribute__ ((unused)))
{
if(!sel)
@ -169,8 +169,8 @@ uicb_togglefloating(Display *disp,
sel->rw = sel->w;
sel->rh = sel->h;
}
saveprops(sel, jdwmconf->ntags);
arrange(disp, jdwmconf);
saveprops(sel, awesomeconf->ntags);
arrange(disp, awesomeconf);
}
/** Toggle tag view
@ -180,7 +180,7 @@ uicb_togglefloating(Display *disp,
*/
void
uicb_toggletag(Display *disp,
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg)
{
unsigned int i;
@ -188,13 +188,13 @@ uicb_toggletag(Display *disp,
if(!sel)
return;
i = idxoftag(arg, jdwmconf->tags, jdwmconf->ntags);
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
sel->tags[i] = !sel->tags[i];
for(j = 0; j < jdwmconf->ntags && !sel->tags[j]; j++);
if(j == jdwmconf->ntags)
for(j = 0; j < awesomeconf->ntags && !sel->tags[j]; j++);
if(j == awesomeconf->ntags)
sel->tags[i] = True;
saveprops(sel, jdwmconf->ntags);
arrange(disp, jdwmconf);
saveprops(sel, awesomeconf->ntags);
arrange(disp, awesomeconf);
}
/** Add a tag to viewed tags
@ -204,70 +204,70 @@ uicb_toggletag(Display *disp,
*/
void
uicb_toggleview(Display *disp,
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg)
{
unsigned int i;
int j;
i = idxoftag(arg, jdwmconf->tags, jdwmconf->ntags);
jdwmconf->selected_tags[i] = !jdwmconf->selected_tags[i];
for(j = 0; j < jdwmconf->ntags && !jdwmconf->selected_tags[j]; j++);
if(j == jdwmconf->ntags)
jdwmconf->selected_tags[i] = True; /* cannot toggle last view */
savejdwmprops(disp, jdwmconf);
arrange(disp, jdwmconf);
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
awesomeconf->selected_tags[i] = !awesomeconf->selected_tags[i];
for(j = 0; j < awesomeconf->ntags && !awesomeconf->selected_tags[j]; j++);
if(j == awesomeconf->ntags)
awesomeconf->selected_tags[i] = True; /* cannot toggle last view */
saveawesomeprops(disp, awesomeconf);
arrange(disp, awesomeconf);
}
/** View tag
* \param disp Display ref
* \param jdwmconf jdwm config ref
* \param awesomeconf awesome config ref
* \param arg tag to view
* \ingroup ui_callback
*/
void
uicb_view(Display *disp,
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg)
{
int i;
for(i = 0; i < jdwmconf->ntags; i++)
for(i = 0; i < awesomeconf->ntags; i++)
{
jdwmconf->prev_selected_tags[i] = jdwmconf->selected_tags[i];
jdwmconf->selected_tags[i] = arg == NULL;
awesomeconf->prev_selected_tags[i] = awesomeconf->selected_tags[i];
awesomeconf->selected_tags[i] = arg == NULL;
}
i = idxoftag(arg, jdwmconf->tags, jdwmconf->ntags);
if(i >= 0 && i < jdwmconf->ntags)
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
if(i >= 0 && i < awesomeconf->ntags)
{
jdwmconf->selected_tags[i] = True;
jdwmconf->current_layout = jdwmconf->tag_layouts[i];
awesomeconf->selected_tags[i] = True;
awesomeconf->current_layout = awesomeconf->tag_layouts[i];
}
savejdwmprops(disp, jdwmconf);
arrange(disp, jdwmconf);
saveawesomeprops(disp, awesomeconf);
arrange(disp, awesomeconf);
}
/** View previously selected tags
* \param disp Display ref
* \param jdwmconf jdwm config ref
* \param awesomeconf awesome config ref
* \param arg unused
* \ingroup ui_callback
*/
void
uicb_viewprevtags(Display * disp,
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
int i;
Bool t;
for(i = 0; i < jdwmconf->ntags; i++)
for(i = 0; i < awesomeconf->ntags; i++)
{
t = jdwmconf->selected_tags[i];
jdwmconf->selected_tags[i] = jdwmconf->prev_selected_tags[i];
jdwmconf->prev_selected_tags[i] = t;
t = awesomeconf->selected_tags[i];
awesomeconf->selected_tags[i] = awesomeconf->prev_selected_tags[i];
awesomeconf->prev_selected_tags[i] = t;
}
arrange(disp, jdwmconf);
arrange(disp, awesomeconf);
}
/** View next tag
@ -277,23 +277,23 @@ uicb_viewprevtags(Display * disp,
*/
void
uicb_tag_viewnext(Display *disp,
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
int i;
int firsttag = -1;
for(i = 0; i < jdwmconf->ntags; i++)
for(i = 0; i < awesomeconf->ntags; i++)
{
if(firsttag < 0 && jdwmconf->selected_tags[i])
if(firsttag < 0 && awesomeconf->selected_tags[i])
firsttag = i;
jdwmconf->selected_tags[i] = False;
awesomeconf->selected_tags[i] = False;
}
if(++firsttag >= jdwmconf->ntags)
if(++firsttag >= awesomeconf->ntags)
firsttag = 0;
jdwmconf->selected_tags[firsttag] = True;
savejdwmprops(disp, jdwmconf);
arrange(disp, jdwmconf);
awesomeconf->selected_tags[firsttag] = True;
saveawesomeprops(disp, awesomeconf);
arrange(disp, awesomeconf);
}
/** View previous tag
@ -303,21 +303,21 @@ uicb_tag_viewnext(Display *disp,
*/
void
uicb_tag_viewprev(Display *disp,
jdwm_config *jdwmconf,
awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
int i;
int firsttag = -1;
for(i = jdwmconf->ntags - 1; i >= 0; i--)
for(i = awesomeconf->ntags - 1; i >= 0; i--)
{
if(firsttag < 0 && jdwmconf->selected_tags[i])
if(firsttag < 0 && awesomeconf->selected_tags[i])
firsttag = i;
jdwmconf->selected_tags[i] = False;
awesomeconf->selected_tags[i] = False;
}
if(--firsttag < 0)
firsttag = jdwmconf->ntags - 1;
jdwmconf->selected_tags[firsttag] = True;
savejdwmprops(disp, jdwmconf);
arrange(disp, jdwmconf);
firsttag = awesomeconf->ntags - 1;
awesomeconf->selected_tags[firsttag] = True;
saveawesomeprops(disp, awesomeconf);
arrange(disp, awesomeconf);
}

20
tag.h
View File

@ -9,17 +9,17 @@
/** Check if a client is tiled */
#define IS_TILED(client, tags, ntags) (client && !client->isfloating && isvisible(client, tags, ntags))
void compileregs(jdwm_config *); /* initialize regexps of rules defined in config.h */
void compileregs(awesome_config *); /* initialize regexps of rules defined in config.h */
Bool isvisible(Client *, Bool *, int);
void applyrules(Client * c, jdwm_config *); /* applies rules to c */
void uicb_tag(Display *, jdwm_config *, const char *); /* tags sel with arg's index */
void uicb_togglefloating(Display *, jdwm_config *, const char *); /* toggles sel between floating/tiled state */
void uicb_toggletag(Display *, jdwm_config *, const char *); /* toggles sel tags with arg's index */
void uicb_toggleview(Display *, jdwm_config *, const char *); /* toggles the tag with arg's index (in)visible */
void uicb_view(Display *, jdwm_config *, const char *); /* views the tag with arg's index */
void uicb_viewprevtags(Display *, jdwm_config *, const char *);
void uicb_tag_viewnext(Display *, jdwm_config *, const char *); /* view only tag just after the first selected */
void uicb_tag_viewprev(Display *, jdwm_config *, const char *); /* view only tag just before the first selected */
void applyrules(Client * c, awesome_config *); /* applies rules to c */
void uicb_tag(Display *, awesome_config *, const char *); /* tags sel with arg's index */
void uicb_togglefloating(Display *, awesome_config *, const char *); /* toggles sel between floating/tiled state */
void uicb_toggletag(Display *, awesome_config *, const char *); /* toggles sel tags with arg's index */
void uicb_toggleview(Display *, awesome_config *, const char *); /* toggles the tag with arg's index (in)visible */
void uicb_view(Display *, awesome_config *, const char *); /* views the tag with arg's index */
void uicb_viewprevtags(Display *, awesome_config *, const char *);
void uicb_tag_viewnext(Display *, awesome_config *, const char *); /* view only tag just after the first selected */
void uicb_tag_viewprev(Display *, awesome_config *, const char *); /* view only tag just before the first selected */
typedef struct
{

4
util.c
View File

@ -22,7 +22,7 @@ eprint(const char *fmt, ...)
void
spawn(Display * disp,
jdwm_config * jdwmconf __attribute__ ((unused)),
awesome_config * awesomeconf __attribute__ ((unused)),
const char *arg)
{
static char *shell = NULL;
@ -41,7 +41,7 @@ spawn(Display * disp,
close(ConnectionNumber(disp));
setsid();
execl(shell, shell, "-c", arg, (char *) NULL);
fprintf(stderr, "jdwm: execl '%s -c %s'", shell, arg);
fprintf(stderr, "awesome: execl '%s -c %s'", shell, arg);
perror(" failed");
}
exit(EXIT_SUCCESS);

2
util.h
View File

@ -61,6 +61,6 @@ xrealloc(void **ptr, ssize_t newsize)
}
void eprint(const char *, ...) __attribute__ ((noreturn)) __attribute__ ((format(printf, 1, 2)));
void spawn(Display *, jdwm_config *, const char *);
void spawn(Display *, awesome_config *, const char *);
#endif