rename jdwm to awesome
This commit is contained in:
parent
604ab3e702
commit
6f528063be
39
Makefile
39
Makefile
|
@ -1,16 +1,15 @@
|
||||||
# jdwm - Julien's dynamic window manager
|
# awesome
|
||||||
# © 2007 Julien Danjou
|
# © 2007 Julien Danjou
|
||||||
# © 2006-2007 Anselm R. Garbe, Sander van Dijk
|
|
||||||
|
|
||||||
include config.mk
|
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}
|
OBJ = ${SRC:.c=.o} ${LAYOUTS:.c=.o}
|
||||||
|
|
||||||
all: options jdwm
|
all: options awesome
|
||||||
|
|
||||||
options:
|
options:
|
||||||
@echo jdwm build options:
|
@echo awesome build options:
|
||||||
@echo "LAYOUTS = ${LAYOUTS}"
|
@echo "LAYOUTS = ${LAYOUTS}"
|
||||||
@echo "CFLAGS = ${CFLAGS}"
|
@echo "CFLAGS = ${CFLAGS}"
|
||||||
@echo "LDFLAGS = ${LDFLAGS}"
|
@echo "LDFLAGS = ${LDFLAGS}"
|
||||||
|
@ -20,44 +19,44 @@ options:
|
||||||
@echo -e \\t\(CC\) $<
|
@echo -e \\t\(CC\) $<
|
||||||
@${CC} -c ${CFLAGS} $< -o $@
|
@${CC} -c ${CFLAGS} $< -o $@
|
||||||
|
|
||||||
${OBJ}: jdwm.h config.mk
|
${OBJ}: awesome.h config.mk
|
||||||
|
|
||||||
jdwm: ${OBJ}
|
awesome: ${OBJ}
|
||||||
@echo -e \\t\(CC\) ${OBJ} -o $@
|
@echo -e \\t\(CC\) ${OBJ} -o $@
|
||||||
@${CC} -o $@ ${OBJ} ${LDFLAGS}
|
@${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo cleaning
|
@echo cleaning
|
||||||
@rm -f jdwm ${OBJ} jdwm-${VERSION}.tar.gz
|
@rm -f awesome ${OBJ} awesome-${VERSION}.tar.gz
|
||||||
@rm -rf doc
|
@rm -rf doc
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
@echo creating dist tarball
|
@echo creating dist tarball
|
||||||
@mkdir -p jdwm-${VERSION}
|
@mkdir -p awesome-${VERSION}
|
||||||
@cp -R LICENSE Makefile README config.*.h config.mk \
|
@cp -R LICENSE Makefile README config.*.h config.mk \
|
||||||
jdwm.1 jdwm.h grid.h tile.h mem.h ${SRC} ${LAYOUTS} jdwm-${VERSION}
|
awesome.1 awesome.h grid.h tile.h mem.h ${SRC} ${LAYOUTS} awesome-${VERSION}
|
||||||
@tar -cf jdwm-${VERSION}.tar jdwm-${VERSION}
|
@tar -cf awesome-${VERSION}.tar awesome-${VERSION}
|
||||||
@gzip jdwm-${VERSION}.tar
|
@gzip awesome-${VERSION}.tar
|
||||||
@rm -rf jdwm-${VERSION}
|
@rm -rf awesome-${VERSION}
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
|
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
|
||||||
@mkdir -p ${DESTDIR}${PREFIX}/bin
|
@mkdir -p ${DESTDIR}${PREFIX}/bin
|
||||||
@cp -f jdwm ${DESTDIR}${PREFIX}/bin
|
@cp -f awesome ${DESTDIR}${PREFIX}/bin
|
||||||
@chmod 755 ${DESTDIR}${PREFIX}/bin/jdwm
|
@chmod 755 ${DESTDIR}${PREFIX}/bin/awesome
|
||||||
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
|
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
|
||||||
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
||||||
@sed "s/VERSION/${VERSION}/g" < jdwm.1 > ${DESTDIR}${MANPREFIX}/man1/jdwm.1
|
@sed "s/VERSION/${VERSION}/g" < awesome.1 > ${DESTDIR}${MANPREFIX}/man1/awesome.1
|
||||||
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/jdwm.1
|
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/awesome.1
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
|
@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
|
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
|
||||||
@rm -f ${DESTDIR}${MANPREFIX}/man1/jdwm.1
|
@rm -f ${DESTDIR}${MANPREFIX}/man1/awesome.1
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
@echo generating documentation
|
@echo generating documentation
|
||||||
@doxygen jdwm.doxygen
|
@doxygen awesome.doxygen
|
||||||
|
|
||||||
.PHONY: all options clean dist install uninstall doc
|
.PHONY: all options clean dist install uninstall doc
|
||||||
|
|
28
README
28
README
|
@ -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.
|
It's based on dwm.
|
||||||
|
|
||||||
Requirements
|
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
|
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).
|
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):
|
necessary as root):
|
||||||
|
|
||||||
make clean install
|
make clean install
|
||||||
|
|
||||||
Running jdwm
|
Running awesome
|
||||||
-----------
|
-----------
|
||||||
Add the following line to your .xinitrc to start jdwm using startx
|
Add the following line to your .xinitrc to start awesome using startx
|
||||||
or to .xsession to start jdwm using gdm/kdm/xdm...:
|
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.:
|
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
|
In order to display status info in the bar, you can do something
|
||||||
like this in your .xinitrc:
|
like this in your .xinitrc:
|
||||||
|
@ -38,10 +38,10 @@ like this in your .xinitrc:
|
||||||
do
|
do
|
||||||
echo `date` `uptime | sed 's/.*,//'`
|
echo `date` `uptime | sed 's/.*,//'`
|
||||||
sleep 1
|
sleep 1
|
||||||
done | jdwm
|
done | awesome
|
||||||
|
|
||||||
|
|
||||||
Configuration
|
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.
|
and (re)compiling the source code.
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
#include "jdwm.h"
|
#include "awesome.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
|
@ -65,13 +65,13 @@ gettextprop(Display *disp, Window w, Atom atom, char *text, unsigned int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cleanup(Display *disp, jdwm_config *jdwmconf)
|
cleanup(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
close(STDIN_FILENO);
|
close(STDIN_FILENO);
|
||||||
while(stack)
|
while(stack)
|
||||||
{
|
{
|
||||||
unban(stack);
|
unban(stack);
|
||||||
unmanage(stack, &dc, NormalState, jdwmconf);
|
unmanage(stack, &dc, NormalState, awesomeconf);
|
||||||
}
|
}
|
||||||
if(dc.font.set)
|
if(dc.font.set)
|
||||||
XFreeFontSet(disp, dc.font.set);
|
XFreeFontSet(disp, dc.font.set);
|
||||||
|
@ -80,7 +80,7 @@ cleanup(Display *disp, jdwm_config *jdwmconf)
|
||||||
XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp));
|
XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp));
|
||||||
XFreePixmap(disp, dc.drawable);
|
XFreePixmap(disp, dc.drawable);
|
||||||
XFreeGC(disp, dc.gc);
|
XFreeGC(disp, dc.gc);
|
||||||
XDestroyWindow(disp, jdwmconf->statusbar.window);
|
XDestroyWindow(disp, awesomeconf->statusbar.window);
|
||||||
XFreeCursor(disp, cursor[CurNormal]);
|
XFreeCursor(disp, cursor[CurNormal]);
|
||||||
XFreeCursor(disp, cursor[CurResize]);
|
XFreeCursor(disp, cursor[CurResize]);
|
||||||
XFreeCursor(disp, cursor[CurMove]);
|
XFreeCursor(disp, cursor[CurMove]);
|
||||||
|
@ -107,7 +107,7 @@ getstate(Display *disp, Window w)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
scan(Display *disp, jdwm_config *jdwmconf)
|
scan(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
unsigned int i, num;
|
unsigned int i, num;
|
||||||
Window *wins, d1, d2;
|
Window *wins, d1, d2;
|
||||||
|
@ -121,7 +121,7 @@ scan(Display *disp, jdwm_config *jdwmconf)
|
||||||
|| wa.override_redirect || XGetTransientForHint(disp, wins[i], &d1))
|
|| wa.override_redirect || XGetTransientForHint(disp, wins[i], &d1))
|
||||||
continue;
|
continue;
|
||||||
if(wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState)
|
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 */
|
/* now the transients */
|
||||||
for(i = 0; i < num; i++)
|
for(i = 0; i < num; i++)
|
||||||
|
@ -130,7 +130,7 @@ scan(Display *disp, jdwm_config *jdwmconf)
|
||||||
continue;
|
continue;
|
||||||
if(XGetTransientForHint(disp, wins[i], &d1)
|
if(XGetTransientForHint(disp, wins[i], &d1)
|
||||||
&& (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState))
|
&& (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)
|
if(wins)
|
||||||
XFree(wins);
|
XFree(wins);
|
||||||
|
@ -138,11 +138,11 @@ scan(Display *disp, jdwm_config *jdwmconf)
|
||||||
|
|
||||||
/** Setup everything before running
|
/** Setup everything before running
|
||||||
* \param disp Display ref
|
* \param disp Display ref
|
||||||
* \param jdwmconf jdwm config ref
|
* \param awesomeconf awesome config ref
|
||||||
* \todo clean things...
|
* \todo clean things...
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
setup(Display *disp, jdwm_config *jdwmconf)
|
setup(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
|
|
||||||
|
@ -165,27 +165,27 @@ setup(Display *disp, jdwm_config *jdwmconf)
|
||||||
wa.cursor = cursor[CurNormal];
|
wa.cursor = cursor[CurNormal];
|
||||||
XChangeWindowAttributes(disp, DefaultRootWindow(disp), CWEventMask | CWCursor, &wa);
|
XChangeWindowAttributes(disp, DefaultRootWindow(disp), CWEventMask | CWCursor, &wa);
|
||||||
XSelectInput(disp, DefaultRootWindow(disp), wa.event_mask);
|
XSelectInput(disp, DefaultRootWindow(disp), wa.event_mask);
|
||||||
grabkeys(disp, jdwmconf);
|
grabkeys(disp, awesomeconf);
|
||||||
compileregs(jdwmconf);
|
compileregs(awesomeconf);
|
||||||
/* bar */
|
/* bar */
|
||||||
dc.h = jdwmconf->statusbar.height = dc.font.height + 2;
|
dc.h = awesomeconf->statusbar.height = dc.font.height + 2;
|
||||||
wa.override_redirect = 1;
|
wa.override_redirect = 1;
|
||||||
wa.background_pixmap = ParentRelative;
|
wa.background_pixmap = ParentRelative;
|
||||||
wa.event_mask = ButtonPressMask | ExposureMask;
|
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,
|
DefaultDepth(disp, DefaultScreen(disp)), CopyFromParent,
|
||||||
DefaultVisual(disp, DefaultScreen(disp)),
|
DefaultVisual(disp, DefaultScreen(disp)),
|
||||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||||
XDefineCursor(disp, jdwmconf->statusbar.window, cursor[CurNormal]);
|
XDefineCursor(disp, awesomeconf->statusbar.window, cursor[CurNormal]);
|
||||||
updatebarpos(disp, jdwmconf->statusbar);
|
updatebarpos(disp, awesomeconf->statusbar);
|
||||||
XMapRaised(disp, jdwmconf->statusbar.window);
|
XMapRaised(disp, awesomeconf->statusbar.window);
|
||||||
/* pixmap for everything */
|
/* 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);
|
dc.gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0);
|
||||||
XSetLineAttributes(disp, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(disp, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
if(!dc.font.set)
|
if(!dc.font.set)
|
||||||
XSetFont(disp, dc.gc, dc.font.xfont->fid);
|
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
|
void
|
||||||
uicb_quit(Display *disp __attribute__ ((unused)),
|
uicb_quit(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config *jdwmconf __attribute__((unused)),
|
awesome_config *awesomeconf __attribute__((unused)),
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
readin = running = False;
|
readin = running = False;
|
||||||
|
@ -255,7 +255,7 @@ xerror(Display * edpy, XErrorEvent * ee)
|
||||||
&& ee->error_code == BadAccess)
|
&& ee->error_code == BadAccess)
|
||||||
|| (ee->request_code == X_CopyArea && ee->error_code == BadDrawable))
|
|| (ee->request_code == X_CopyArea && ee->error_code == BadDrawable))
|
||||||
return 0;
|
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);
|
ee->request_code, ee->error_code);
|
||||||
|
|
||||||
return xerrorxlib(edpy, ee); /* may call exit */
|
return xerrorxlib(edpy, ee); /* may call exit */
|
||||||
|
@ -270,17 +270,17 @@ main(int argc, char *argv[])
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
Display * dpy;
|
Display * dpy;
|
||||||
Window root;
|
Window root;
|
||||||
jdwm_config jdwmconf;
|
awesome_config awesomeconf;
|
||||||
|
|
||||||
if(argc == 2 && !strcmp("-v", argv[1]))
|
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)
|
else if(argc != 1)
|
||||||
eprint("usage: jdwm [-v]\n");
|
eprint("usage: awesome [-v]\n");
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
|
|
||||||
|
|
||||||
if(!(dpy = XOpenDisplay(NULL)))
|
if(!(dpy = XOpenDisplay(NULL)))
|
||||||
eprint("jdwm: cannot open display\n");
|
eprint("awesome: cannot open display\n");
|
||||||
xfd = ConnectionNumber(dpy);
|
xfd = ConnectionNumber(dpy);
|
||||||
root = RootWindow(dpy, DefaultScreen(dpy));
|
root = RootWindow(dpy, DefaultScreen(dpy));
|
||||||
XSetErrorHandler(xerrorstart);
|
XSetErrorHandler(xerrorstart);
|
||||||
|
@ -290,19 +290,19 @@ main(int argc, char *argv[])
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
if(otherwm)
|
if(otherwm)
|
||||||
eprint("jdwm: another window manager is already running\n");
|
eprint("awesome: another window manager is already running\n");
|
||||||
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
XSetErrorHandler(NULL);
|
XSetErrorHandler(NULL);
|
||||||
xerrorxlib = XSetErrorHandler(xerror);
|
xerrorxlib = XSetErrorHandler(xerror);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
parse_config(dpy, DefaultScreen(dpy), &dc, &jdwmconf);
|
parse_config(dpy, DefaultScreen(dpy), &dc, &awesomeconf);
|
||||||
setup(dpy, &jdwmconf);
|
setup(dpy, &awesomeconf);
|
||||||
drawstatus(dpy, &jdwmconf);
|
drawstatus(dpy, &awesomeconf);
|
||||||
scan(dpy, &jdwmconf);
|
scan(dpy, &awesomeconf);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
void (*handler[LASTEvent]) (XEvent *, jdwm_config *) =
|
void (*handler[LASTEvent]) (XEvent *, awesome_config *) =
|
||||||
{
|
{
|
||||||
[ButtonPress] = handle_event_buttonpress,
|
[ButtonPress] = handle_event_buttonpress,
|
||||||
[ConfigureRequest] = handle_event_configurerequest,
|
[ConfigureRequest] = handle_event_configurerequest,
|
||||||
|
@ -334,35 +334,35 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
if(FD_ISSET(STDIN_FILENO, &rd))
|
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:
|
case -1:
|
||||||
strncpy(jdwmconf.statustext, strerror(errno), sizeof(jdwmconf.statustext) - 1);
|
strncpy(awesomeconf.statustext, strerror(errno), sizeof(awesomeconf.statustext) - 1);
|
||||||
jdwmconf.statustext[sizeof(jdwmconf.statustext) - 1] = '\0';
|
awesomeconf.statustext[sizeof(awesomeconf.statustext) - 1] = '\0';
|
||||||
readin = False;
|
readin = False;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
strncpy(jdwmconf.statustext, "EOF", 4);
|
strncpy(awesomeconf.statustext, "EOF", 4);
|
||||||
readin = False;
|
readin = False;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
for(jdwmconf.statustext[r] = '\0', p = jdwmconf.statustext + strlen(jdwmconf.statustext) - 1;
|
for(awesomeconf.statustext[r] = '\0', p = awesomeconf.statustext + strlen(awesomeconf.statustext) - 1;
|
||||||
p >= jdwmconf.statustext && *p == '\n'; *p-- = '\0');
|
p >= awesomeconf.statustext && *p == '\n'; *p-- = '\0');
|
||||||
for(; p >= jdwmconf.statustext && *p != '\n'; --p);
|
for(; p >= awesomeconf.statustext && *p != '\n'; --p);
|
||||||
if(p > jdwmconf.statustext)
|
if(p > awesomeconf.statustext)
|
||||||
strncpy(jdwmconf.statustext, p + 1, sizeof(jdwmconf.statustext));
|
strncpy(awesomeconf.statustext, p + 1, sizeof(awesomeconf.statustext));
|
||||||
}
|
}
|
||||||
drawstatus(dpy, &jdwmconf);
|
drawstatus(dpy, &awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(XPending(dpy))
|
while(XPending(dpy))
|
||||||
{
|
{
|
||||||
XNextEvent(dpy, &ev);
|
XNextEvent(dpy, &ev);
|
||||||
if(handler[ev.type])
|
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);
|
XCloseDisplay(dpy);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
|
@ -1,5 +1,5 @@
|
||||||
DOXYFILE_ENCODING = UTF-8
|
DOXYFILE_ENCODING = UTF-8
|
||||||
PROJECT_NAME = jdwm
|
PROJECT_NAME = awesome
|
||||||
PROJECT_NUMBER = 0.0
|
PROJECT_NUMBER = 0.0
|
||||||
OUTPUT_DIRECTORY = doc
|
OUTPUT_DIRECTORY = doc
|
||||||
CREATE_SUBDIRS = NO
|
CREATE_SUBDIRS = NO
|
|
@ -9,7 +9,7 @@
|
||||||
* Calls to fetch an X event from the event queue are blocking. Due reading
|
* 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
|
* 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
|
* 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
|
* array which is accessed whenever a new event has been fetched. This allows
|
||||||
* event dispatching in O(1) time.
|
* event dispatching in O(1) time.
|
||||||
*
|
*
|
||||||
|
@ -17,13 +17,13 @@
|
||||||
* set the override_redirect flag. Clients are organized in a global
|
* set the override_redirect flag. Clients are organized in a global
|
||||||
* doubly-linked client list, the focus history is remembered through 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
|
* 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
|
* creates a small title window, which is resized whenever the (_NET_)WM_NAME
|
||||||
* properties are updated or the client is moved/resized.
|
* properties are updated or the client is moved/resized.
|
||||||
*
|
*
|
||||||
* Keys and tagging rules are organized as arrays and defined in the config.h
|
* 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,
|
* 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.
|
* represented by the lt pointer.
|
||||||
*
|
*
|
||||||
* To understand everything else, start reading main.c:main().
|
* 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 */
|
Bool gettextprop(Display *, Window, Atom, char *, unsigned int); /* return text property, UTF-8 compliant */
|
||||||
void updatebarpos(Display *, Statusbar); /* updates the bar position */
|
void updatebarpos(Display *, Statusbar); /* updates the bar position */
|
||||||
void uicb_quit(Display *, jdwm_config *, const char *); /* quit jdwm nicely */
|
void uicb_quit(Display *, awesome_config *, const char *); /* quit awesome nicely */
|
||||||
int xerror(Display *, XErrorEvent *); /* jdwm's X error handler */
|
int xerror(Display *, XErrorEvent *); /* awesome's X error handler */
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,6 +1,6 @@
|
||||||
# Configuration file for jdwm
|
# Configuration file for awesome
|
||||||
|
|
||||||
jdwm:
|
awesome:
|
||||||
{
|
{
|
||||||
# Default bar position
|
# Default bar position
|
||||||
barpos = "BarTop";
|
barpos = "BarTop";
|
52
client.c
52
client.c
|
@ -5,7 +5,7 @@
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
#include "jdwm.h"
|
#include "awesome.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
@ -235,39 +235,39 @@ detach(Client * c)
|
||||||
* \param drawcontext drawcontext ref
|
* \param drawcontext drawcontext ref
|
||||||
* \param c client
|
* \param c client
|
||||||
* \param selscreen True if current screen is selected
|
* \param selscreen True if current screen is selected
|
||||||
* \param jdwmconf jdwm config
|
* \param awesomeconf awesome config
|
||||||
*/
|
*/
|
||||||
void
|
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 is NULL or invisible, take next client in the stack */
|
||||||
if((!c && selscreen) || (c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags)))
|
if((!c && selscreen) || (c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags)))
|
||||||
for(c = stack; c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags); c = c->snext);
|
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 a client was selected but it's not the current client, unfocus it */
|
||||||
if(sel && sel != c)
|
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]);
|
XSetWindowBorder(sel->display, sel->win, drawcontext->norm[ColBorder]);
|
||||||
setclienttrans(sel, jdwmconf->opacity_unfocused);
|
setclienttrans(sel, awesomeconf->opacity_unfocused);
|
||||||
}
|
}
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
grabbuttons(c, True, jdwmconf->modkey, jdwmconf->numlockmask);
|
grabbuttons(c, True, awesomeconf->modkey, awesomeconf->numlockmask);
|
||||||
}
|
}
|
||||||
if(!selscreen)
|
if(!selscreen)
|
||||||
return;
|
return;
|
||||||
sel = c;
|
sel = c;
|
||||||
drawstatus(disp, jdwmconf);
|
drawstatus(disp, awesomeconf);
|
||||||
if(sel)
|
if(sel)
|
||||||
{
|
{
|
||||||
XSetWindowBorder(sel->display, sel->win, drawcontext->sel[ColBorder]);
|
XSetWindowBorder(sel->display, sel->win, drawcontext->sel[ColBorder]);
|
||||||
XSetInputFocus(sel->display, sel->win, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(sel->display, sel->win, RevertToPointerRoot, CurrentTime);
|
||||||
for(c = stack; c; c = c->snext)
|
for(c = stack; c; c = c->snext)
|
||||||
if(c != sel)
|
if(c != sel)
|
||||||
setclienttrans(c, jdwmconf->opacity_unfocused);
|
setclienttrans(c, awesomeconf->opacity_unfocused);
|
||||||
setclienttrans(sel, -1);
|
setclienttrans(sel, -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -276,13 +276,13 @@ focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, jdwm_config *j
|
||||||
|
|
||||||
/** Kill selected client
|
/** Kill selected client
|
||||||
* \param disp Display ref
|
* \param disp Display ref
|
||||||
* \param jdwmconf jdwm config
|
* \param awesomeconf awesome config
|
||||||
* \param arg unused
|
* \param arg unused
|
||||||
* \ingroup ui_callback
|
* \ingroup ui_callback
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
uicb_killclient(Display *disp __attribute__ ((unused)),
|
uicb_killclient(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config *jdwmconf __attribute__ ((unused)),
|
awesome_config *awesomeconf __attribute__ ((unused)),
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
@ -327,7 +327,7 @@ loadprops(Client * c, int ntags)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
int i;
|
||||||
Client *c, *t = NULL;
|
Client *c, *t = NULL;
|
||||||
|
@ -336,7 +336,7 @@ manage(Display * disp, DC *drawcontext, Window w, XWindowAttributes * wa, jdwm_c
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
c = p_new(Client, 1);
|
c = p_new(Client, 1);
|
||||||
c->tags = p_new(Bool, jdwmconf->ntags);
|
c->tags = p_new(Bool, awesomeconf->ntags);
|
||||||
c->win = w;
|
c->win = w;
|
||||||
c->ftview = True;
|
c->ftview = True;
|
||||||
c->x = c->rw = wa->x;
|
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;
|
c->x = c->rx = wax;
|
||||||
if(c->y < way)
|
if(c->y < way)
|
||||||
c->y = c->ry = way;
|
c->y = c->ry = way;
|
||||||
c->border = jdwmconf->borderpx;
|
c->border = awesomeconf->borderpx;
|
||||||
}
|
}
|
||||||
wc.border_width = c->border;
|
wc.border_width = c->border;
|
||||||
XConfigureWindow(disp, w, CWBorderWidth, &wc);
|
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 */
|
configure(c); /* propagates border_width, if size doesn't change */
|
||||||
updatesizehints(c);
|
updatesizehints(c);
|
||||||
XSelectInput(disp, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
XSelectInput(disp, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
||||||
grabbuttons(c, False, jdwmconf->modkey, jdwmconf->numlockmask);
|
grabbuttons(c, False, awesomeconf->modkey, awesomeconf->numlockmask);
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
if((rettrans = XGetTransientForHint(disp, w, &trans) == Success))
|
if((rettrans = XGetTransientForHint(disp, w, &trans) == Success))
|
||||||
for(t = clients; t && t->win != trans; t = t->next);
|
for(t = clients; t && t->win != trans; t = t->next);
|
||||||
if(t)
|
if(t)
|
||||||
for(i = 0; i < jdwmconf->ntags; i++)
|
for(i = 0; i < awesomeconf->ntags; i++)
|
||||||
c->tags[i] = t->tags[i];
|
c->tags[i] = t->tags[i];
|
||||||
if(!loadprops(c, jdwmconf->ntags))
|
if(!loadprops(c, awesomeconf->ntags))
|
||||||
applyrules(c, jdwmconf);
|
applyrules(c, awesomeconf);
|
||||||
if(!c->isfloating)
|
if(!c->isfloating)
|
||||||
c->isfloating = (rettrans == Success) || c->isfixed;
|
c->isfloating = (rettrans == Success) || c->isfixed;
|
||||||
saveprops(c, jdwmconf->ntags);
|
saveprops(c, awesomeconf->ntags);
|
||||||
attach(c);
|
attach(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
XMoveResizeWindow(disp, c->win, c->x, c->y, c->w, c->h); /* some windows require this */
|
XMoveResizeWindow(disp, c->win, c->x, c->y, c->w, c->h); /* some windows require this */
|
||||||
ban(c);
|
ban(c);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -461,7 +461,7 @@ resize(Client * c, int x, int y, int w, int h, Bool sizehints)
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_moveresize(Display *disp __attribute__ ((unused)),
|
uicb_moveresize(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh;
|
int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh;
|
||||||
|
@ -528,7 +528,7 @@ unban(Client * c)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unmanage(Client * c, DC *drawcontext, long state, jdwm_config *jdwmconf)
|
unmanage(Client * c, DC *drawcontext, long state, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
|
@ -539,14 +539,14 @@ unmanage(Client * c, DC *drawcontext, long state, jdwm_config *jdwmconf)
|
||||||
detach(c);
|
detach(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
if(sel == 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);
|
XUngrabButton(c->display, AnyButton, AnyModifier, c->win);
|
||||||
setclientstate(c, state);
|
setclientstate(c, state);
|
||||||
XSync(c->display, False);
|
XSync(c->display, False);
|
||||||
XSetErrorHandler(xerror);
|
XSetErrorHandler(xerror);
|
||||||
XUngrabServer(c->display);
|
XUngrabServer(c->display);
|
||||||
if(state != NormalState)
|
if(state != NormalState)
|
||||||
arrange(c->display, jdwmconf);
|
arrange(c->display, awesomeconf);
|
||||||
p_delete(&c->tags);
|
p_delete(&c->tags);
|
||||||
p_delete(&c);
|
p_delete(&c);
|
||||||
}
|
}
|
||||||
|
@ -617,7 +617,7 @@ updatesizehints(Client * c)
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_settrans(Display *disp __attribute__ ((unused)),
|
uicb_settrans(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config *jdwmconf __attribute__ ((unused)),
|
awesome_config *awesomeconf __attribute__ ((unused)),
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
double delta = 100.0;
|
double delta = 100.0;
|
||||||
|
|
12
client.h
12
client.h
|
@ -33,16 +33,16 @@ void attach(Client *); /* attaches c to global client list */
|
||||||
void ban(Client *); /* bans c */
|
void ban(Client *); /* bans c */
|
||||||
void configure(Client *); /* send synthetic configure event */
|
void configure(Client *); /* send synthetic configure event */
|
||||||
void detach(Client *); /* detaches c from global client list */
|
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 focus(Display *, DC *, Client *, Bool, awesome_config *); /* focus c if visible && !NULL, or focus top visible */
|
||||||
void manage(Display *, DC *, Window, XWindowAttributes *, jdwm_config *); /* manage new client */
|
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 resize(Client *, int, int, int, int, Bool); /* resize with given coordinates c */
|
||||||
void unban(Client *); /* unbans 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 updatesizehints(Client *); /* update the size hint variables of c */
|
||||||
void updatetitle(Client *); /* update the name of c */
|
void updatetitle(Client *); /* update the name of c */
|
||||||
void saveprops(Client * c, int); /* saves client properties */
|
void saveprops(Client * c, int); /* saves client properties */
|
||||||
void uicb_killclient(Display *, jdwm_config *, const char *); /* kill client */
|
void uicb_killclient(Display *, awesome_config *, const char *); /* kill client */
|
||||||
void uicb_moveresize(Display *, jdwm_config *, const char *); /* move and resize window */
|
void uicb_moveresize(Display *, awesome_config *, const char *); /* move and resize window */
|
||||||
void uicb_settrans(Display *, jdwm_config *, const char *);
|
void uicb_settrans(Display *, awesome_config *, const char *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
166
config.c
166
config.c
|
@ -8,7 +8,7 @@
|
||||||
#include <libconfig.h>
|
#include <libconfig.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
|
||||||
#include "jdwm.h"
|
#include "awesome.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
@ -23,7 +23,7 @@ static unsigned long initcolor(const char *colstr, Display *, int);
|
||||||
static unsigned int get_numlockmask(Display *);
|
static unsigned int get_numlockmask(Display *);
|
||||||
|
|
||||||
/** Main configuration object for parsing*/
|
/** Main configuration object for parsing*/
|
||||||
config_t jdwmlibconf;
|
config_t awesomelibconf;
|
||||||
|
|
||||||
/** Link a name to a function */
|
/** Link a name to a function */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -96,7 +96,7 @@ static const NameFuncLink KeyfuncList[] = {
|
||||||
/* layouts/tile.c */
|
/* layouts/tile.c */
|
||||||
{"setmwfact", uicb_setmwfact},
|
{"setmwfact", uicb_setmwfact},
|
||||||
{"incnmaster", uicb_incnmaster},
|
{"incnmaster", uicb_incnmaster},
|
||||||
/* jdwm.c */
|
/* awesome.c */
|
||||||
{"quit", uicb_quit},
|
{"quit", uicb_quit},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -147,26 +147,26 @@ extern DC dc;
|
||||||
* \todo not really working nor safe I guess
|
* \todo not really working nor safe I guess
|
||||||
*/
|
*/
|
||||||
void
|
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);
|
config_destroy(&awesomelibconf);
|
||||||
p_delete(&jdwmconf->rules);
|
p_delete(&awesomeconf->rules);
|
||||||
p_delete(&jdwmconf->tags);
|
p_delete(&awesomeconf->tags);
|
||||||
p_delete(&jdwmconf->selected_tags);
|
p_delete(&awesomeconf->selected_tags);
|
||||||
p_delete(&jdwmconf->layouts);
|
p_delete(&awesomeconf->layouts);
|
||||||
p_delete(&jdwmconf->tag_layouts);
|
p_delete(&awesomeconf->tag_layouts);
|
||||||
parse_config(disp, DefaultScreen(disp), &dc, jdwmconf);
|
parse_config(disp, DefaultScreen(disp), &dc, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set default configuration
|
/** Set default configuration
|
||||||
* \param jdwmconf jdwm config ref
|
* \param awesomeconf awesome config ref
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
set_default_config(jdwm_config *jdwmconf)
|
set_default_config(awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
strcpy(jdwmconf->statustext, "jdwm-" VERSION);
|
strcpy(awesomeconf->statustext, "awesome-" VERSION);
|
||||||
jdwmconf->statusbar.width = 0;
|
awesomeconf->statusbar.width = 0;
|
||||||
jdwmconf->statusbar.height = 0;
|
awesomeconf->statusbar.height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Parse configuration file and initialize some stuff
|
/** Parse configuration file and initialize some stuff
|
||||||
|
@ -175,7 +175,7 @@ set_default_config(jdwm_config *jdwmconf)
|
||||||
* \param drawcontext Draw context
|
* \param drawcontext Draw context
|
||||||
*/
|
*/
|
||||||
void
|
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 *conftags;
|
||||||
config_setting_t *conflayouts, *confsublayouts;
|
config_setting_t *conflayouts, *confsublayouts;
|
||||||
|
@ -185,7 +185,7 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
|
||||||
const char *tmp, *homedir;
|
const char *tmp, *homedir;
|
||||||
char *confpath;
|
char *confpath;
|
||||||
|
|
||||||
set_default_config(jdwmconf);
|
set_default_config(awesomeconf);
|
||||||
|
|
||||||
homedir = getenv("HOME");
|
homedir = getenv("HOME");
|
||||||
confpath = p_new(char, strlen(homedir) + strlen(JDWM_CONFIG_FILE) + 2);
|
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, "/");
|
||||||
strcat(confpath, JDWM_CONFIG_FILE);
|
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",
|
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 */
|
/* font */
|
||||||
initfont(config_lookup_string(&jdwmlibconf, "jdwm.font"), disp, drawcontext);
|
initfont(config_lookup_string(&awesomelibconf, "awesome.font"), disp, drawcontext);
|
||||||
|
|
||||||
/* layouts */
|
/* layouts */
|
||||||
conflayouts = config_lookup(&jdwmlibconf, "jdwm.layouts");
|
conflayouts = config_lookup(&awesomelibconf, "awesome.layouts");
|
||||||
|
|
||||||
if(!conflayouts)
|
if(!conflayouts)
|
||||||
eprint("layouts not found in configuration file\n");
|
eprint("layouts not found in configuration file\n");
|
||||||
|
|
||||||
jdwmconf->nlayouts = config_setting_length(conflayouts);
|
awesomeconf->nlayouts = config_setting_length(conflayouts);
|
||||||
jdwmconf->layouts = p_new(Layout, jdwmconf->nlayouts + 1);
|
awesomeconf->layouts = p_new(Layout, awesomeconf->nlayouts + 1);
|
||||||
for(i = 0; (confsublayouts = config_setting_get_elem(conflayouts, i)); i++)
|
for(i = 0; (confsublayouts = config_setting_get_elem(conflayouts, i)); i++)
|
||||||
{
|
{
|
||||||
jdwmconf->layouts[i].symbol = config_setting_get_string_elem(confsublayouts, 0);
|
awesomeconf->layouts[i].symbol = config_setting_get_string_elem(confsublayouts, 0);
|
||||||
jdwmconf->layouts[i].arrange =
|
awesomeconf->layouts[i].arrange =
|
||||||
name_func_lookup(config_setting_get_string_elem(confsublayouts, 1), LayoutsList);
|
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");
|
eprint("unknown layout in configuration file\n");
|
||||||
|
|
||||||
j = textw(jdwmconf->layouts[i].symbol);
|
j = textw(awesomeconf->layouts[i].symbol);
|
||||||
if(j > jdwmconf->statusbar.width)
|
if(j > awesomeconf->statusbar.width)
|
||||||
jdwmconf->statusbar.width = j;
|
awesomeconf->statusbar.width = j;
|
||||||
}
|
}
|
||||||
|
|
||||||
jdwmconf->layouts[i].symbol = NULL;
|
awesomeconf->layouts[i].symbol = NULL;
|
||||||
jdwmconf->layouts[i].arrange = NULL;
|
awesomeconf->layouts[i].arrange = NULL;
|
||||||
|
|
||||||
/** \todo put this in set_default_layout */
|
/** \todo put this in set_default_layout */
|
||||||
jdwmconf->current_layout = jdwmconf->layouts;
|
awesomeconf->current_layout = awesomeconf->layouts;
|
||||||
/* tags */
|
/* tags */
|
||||||
conftags = config_lookup(&jdwmlibconf, "jdwm.tags");
|
conftags = config_lookup(&awesomelibconf, "awesome.tags");
|
||||||
|
|
||||||
if(!conftags)
|
if(!conftags)
|
||||||
eprint("tags not found in configuration file\n");
|
eprint("tags not found in configuration file\n");
|
||||||
|
|
||||||
jdwmconf->ntags = config_setting_length(conftags);
|
awesomeconf->ntags = config_setting_length(conftags);
|
||||||
jdwmconf->tags = p_new(const char *, jdwmconf->ntags);
|
awesomeconf->tags = p_new(const char *, awesomeconf->ntags);
|
||||||
jdwmconf->selected_tags = p_new(Bool, jdwmconf->ntags);
|
awesomeconf->selected_tags = p_new(Bool, awesomeconf->ntags);
|
||||||
jdwmconf->prev_selected_tags = p_new(Bool, jdwmconf->ntags);
|
awesomeconf->prev_selected_tags = p_new(Bool, awesomeconf->ntags);
|
||||||
jdwmconf->tag_layouts = p_new(Layout *, jdwmconf->ntags);
|
awesomeconf->tag_layouts = p_new(Layout *, awesomeconf->ntags);
|
||||||
|
|
||||||
for(i = 0; (tmp = config_setting_get_string_elem(conftags, i)); i++)
|
for(i = 0; (tmp = config_setting_get_string_elem(conftags, i)); i++)
|
||||||
{
|
{
|
||||||
jdwmconf->tags[i] = tmp;
|
awesomeconf->tags[i] = tmp;
|
||||||
jdwmconf->selected_tags[i] = False;
|
awesomeconf->selected_tags[i] = False;
|
||||||
jdwmconf->prev_selected_tags[i] = False;
|
awesomeconf->prev_selected_tags[i] = False;
|
||||||
/** \todo add support for default tag/layout in configuration file */
|
/** \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 */
|
/* select first tag by default */
|
||||||
jdwmconf->selected_tags[0] = True;
|
awesomeconf->selected_tags[0] = True;
|
||||||
jdwmconf->prev_selected_tags[0] = True;
|
awesomeconf->prev_selected_tags[0] = True;
|
||||||
|
|
||||||
/* rules */
|
/* rules */
|
||||||
confrules = config_lookup(&jdwmlibconf, "jdwm.rules");
|
confrules = config_lookup(&awesomelibconf, "awesome.rules");
|
||||||
|
|
||||||
if(!confrules)
|
if(!confrules)
|
||||||
eprint("rules not found in configuration file\n");
|
eprint("rules not found in configuration file\n");
|
||||||
|
|
||||||
jdwmconf->nrules = config_setting_length(confrules);
|
awesomeconf->nrules = config_setting_length(confrules);
|
||||||
jdwmconf->rules = p_new(Rule, jdwmconf->nrules);
|
awesomeconf->rules = p_new(Rule, awesomeconf->nrules);
|
||||||
for(i = 0; (confsubrules = config_setting_get_elem(confrules, i)); i++)
|
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"));
|
awesomeconf->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"));
|
awesomeconf->rules[i].tags = config_setting_get_string(config_setting_get_member(confsubrules, "tags"));
|
||||||
if(jdwmconf->rules[i].tags && !strlen(jdwmconf->rules[i].tags))
|
if(awesomeconf->rules[i].tags && !strlen(awesomeconf->rules[i].tags))
|
||||||
jdwmconf->rules[i].tags = NULL;
|
awesomeconf->rules[i].tags = NULL;
|
||||||
jdwmconf->rules[i].isfloating =
|
awesomeconf->rules[i].isfloating =
|
||||||
config_setting_get_bool(config_setting_get_member(confsubrules, "float"));
|
config_setting_get_bool(config_setting_get_member(confsubrules, "float"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* modkey */
|
/* 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 */
|
/* find numlock mask */
|
||||||
jdwmconf->numlockmask = get_numlockmask(disp);
|
awesomeconf->numlockmask = get_numlockmask(disp);
|
||||||
|
|
||||||
/* keys */
|
/* keys */
|
||||||
confkeys = config_lookup(&jdwmlibconf, "jdwm.keys");
|
confkeys = config_lookup(&awesomelibconf, "awesome.keys");
|
||||||
|
|
||||||
if(!confkeys)
|
if(!confkeys)
|
||||||
eprint("keys not found in configuration file\n");
|
eprint("keys not found in configuration file\n");
|
||||||
|
|
||||||
jdwmconf->nkeys = config_setting_length(confkeys);
|
awesomeconf->nkeys = config_setting_length(confkeys);
|
||||||
jdwmconf->keys = p_new(Key, jdwmconf->nkeys);
|
awesomeconf->keys = p_new(Key, awesomeconf->nkeys);
|
||||||
|
|
||||||
for(i = 0; (confsubkeys = config_setting_get_elem(confkeys, i)); i++)
|
for(i = 0; (confsubkeys = config_setting_get_elem(confkeys, i)); i++)
|
||||||
{
|
{
|
||||||
confkeysmasks = config_setting_get_elem(confsubkeys, 0);
|
confkeysmasks = config_setting_get_elem(confsubkeys, 0);
|
||||||
for(j = 0; (confkeymaskelem = config_setting_get_elem(confkeysmasks, j)); j++)
|
for(j = 0; (confkeymaskelem = config_setting_get_elem(confkeysmasks, j)); j++)
|
||||||
jdwmconf->keys[i].mod |= key_mask_lookup(config_setting_get_string(confkeymaskelem));
|
awesomeconf->keys[i].mod |= key_mask_lookup(config_setting_get_string(confkeymaskelem));
|
||||||
jdwmconf->keys[i].keysym = XStringToKeysym(config_setting_get_string_elem(confsubkeys, 1));
|
awesomeconf->keys[i].keysym = XStringToKeysym(config_setting_get_string_elem(confsubkeys, 1));
|
||||||
jdwmconf->keys[i].func =
|
awesomeconf->keys[i].func =
|
||||||
name_func_lookup(config_setting_get_string_elem(confsubkeys, 2), KeyfuncList);
|
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 */
|
/* barpos */
|
||||||
tmp = config_lookup_string(&jdwmlibconf, "jdwm.barpos");
|
tmp = config_lookup_string(&awesomelibconf, "awesome.barpos");
|
||||||
|
|
||||||
if(!strncmp(tmp, "BarTop", 6))
|
if(!strncmp(tmp, "BarTop", 6))
|
||||||
jdwmconf->statusbar_default_position = BarTop;
|
awesomeconf->statusbar_default_position = BarTop;
|
||||||
else if(!strncmp(tmp, "BarBot", 6))
|
else if(!strncmp(tmp, "BarBot", 6))
|
||||||
jdwmconf->statusbar_default_position = BarBot;
|
awesomeconf->statusbar_default_position = BarBot;
|
||||||
else if(!strncmp(tmp, "BarOff", 6))
|
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 */
|
/* borderpx */
|
||||||
jdwmconf->borderpx = config_lookup_int(&jdwmlibconf, "jdwm.borderpx");
|
awesomeconf->borderpx = config_lookup_int(&awesomelibconf, "awesome.borderpx");
|
||||||
|
|
||||||
/* opacity */
|
/* opacity */
|
||||||
jdwmconf->opacity_unfocused = config_lookup_int(&jdwmlibconf, "jdwm.opacity_unfocused");
|
awesomeconf->opacity_unfocused = config_lookup_int(&awesomelibconf, "awesome.opacity_unfocused");
|
||||||
if(jdwmconf->opacity_unfocused >= 100)
|
if(awesomeconf->opacity_unfocused >= 100)
|
||||||
jdwmconf->opacity_unfocused = -1;
|
awesomeconf->opacity_unfocused = -1;
|
||||||
|
|
||||||
/* snap */
|
/* snap */
|
||||||
jdwmconf->snap = config_lookup_int(&jdwmlibconf, "jdwm.snap");
|
awesomeconf->snap = config_lookup_int(&awesomelibconf, "awesome.snap");
|
||||||
|
|
||||||
/* nmaster */
|
/* nmaster */
|
||||||
jdwmconf->nmaster = config_lookup_int(&jdwmlibconf, "jdwm.nmaster");
|
awesomeconf->nmaster = config_lookup_int(&awesomelibconf, "awesome.nmaster");
|
||||||
|
|
||||||
/* mwfact */
|
/* mwfact */
|
||||||
jdwmconf->mwfact = config_lookup_float(&jdwmlibconf, "jdwm.mwfact");
|
awesomeconf->mwfact = config_lookup_float(&awesomelibconf, "awesome.mwfact");
|
||||||
|
|
||||||
/* resize_hints */
|
/* resize_hints */
|
||||||
jdwmconf->resize_hints = config_lookup_float(&jdwmlibconf, "jdwm.resize_hints");
|
awesomeconf->resize_hints = config_lookup_float(&awesomelibconf, "awesome.resize_hints");
|
||||||
|
|
||||||
/* colors */
|
/* 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);
|
disp, scr);
|
||||||
dc.norm[ColBG] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.normal_bg_color"), disp, scr);
|
dc.norm[ColBG] = initcolor(config_lookup_string(&awesomelibconf, "awesome.normal_bg_color"), disp, scr);
|
||||||
dc.norm[ColFG] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.normal_fg_color"), disp, scr);
|
dc.norm[ColFG] = initcolor(config_lookup_string(&awesomelibconf, "awesome.normal_fg_color"), disp, scr);
|
||||||
dc.sel[ColBorder] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.focus_border_color"),
|
dc.sel[ColBorder] = initcolor(config_lookup_string(&awesomelibconf, "awesome.focus_border_color"),
|
||||||
disp, scr);
|
disp, scr);
|
||||||
dc.sel[ColBG] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.focus_bg_color"), disp, scr);
|
dc.sel[ColBG] = initcolor(config_lookup_string(&awesomelibconf, "awesome.focus_bg_color"), disp, scr);
|
||||||
dc.sel[ColFG] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.focus_fg_color"), disp, scr);
|
dc.sel[ColFG] = initcolor(config_lookup_string(&awesomelibconf, "awesome.focus_fg_color"), disp, scr);
|
||||||
|
|
||||||
p_delete(&confpath);
|
p_delete(&confpath);
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ initfont(const char *fontstr, Display * disp, DC * drawcontext)
|
||||||
if(missing)
|
if(missing)
|
||||||
{
|
{
|
||||||
while(n--)
|
while(n--)
|
||||||
fprintf(stderr, "jdwm: missing fontset: %s\n", missing[n]);
|
fprintf(stderr, "awesome: missing fontset: %s\n", missing[n]);
|
||||||
XFreeStringList(missing);
|
XFreeStringList(missing);
|
||||||
}
|
}
|
||||||
if(drawcontext->font.set)
|
if(drawcontext->font.set)
|
||||||
|
|
14
config.h
14
config.h
|
@ -3,7 +3,7 @@
|
||||||
#ifndef JDWM_CONFIG_H
|
#ifndef JDWM_CONFIG_H
|
||||||
#define JDWM_CONFIG_H
|
#define JDWM_CONFIG_H
|
||||||
|
|
||||||
#define JDWM_CONFIG_FILE ".jdwmrc"
|
#define JDWM_CONFIG_FILE ".awesomerc"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
@ -38,19 +38,19 @@ typedef struct
|
||||||
Bool isfloating;
|
Bool isfloating;
|
||||||
} Rule;
|
} Rule;
|
||||||
|
|
||||||
typedef struct jdwm_config jdwm_config;
|
typedef struct awesome_config awesome_config;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char *symbol;
|
const char *symbol;
|
||||||
void (*arrange) (Display *, jdwm_config *);
|
void (*arrange) (Display *, awesome_config *);
|
||||||
} Layout;
|
} Layout;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned long mod;
|
unsigned long mod;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
void (*func) (Display *, jdwm_config *, const char *);
|
void (*func) (Display *, awesome_config *, const char *);
|
||||||
const char *arg;
|
const char *arg;
|
||||||
} Key;
|
} Key;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ typedef struct
|
||||||
} Statusbar;
|
} Statusbar;
|
||||||
|
|
||||||
/** Main configuration structure */
|
/** Main configuration structure */
|
||||||
struct jdwm_config
|
struct awesome_config
|
||||||
{
|
{
|
||||||
/** Tag list */
|
/** Tag list */
|
||||||
const char **tags;
|
const char **tags;
|
||||||
|
@ -118,7 +118,7 @@ struct jdwm_config
|
||||||
Statusbar statusbar;
|
Statusbar statusbar;
|
||||||
};
|
};
|
||||||
|
|
||||||
void parse_config(Display *, int, DC *, jdwm_config *); /* parse configuration file */
|
void parse_config(Display *, int, DC *, awesome_config *); /* parse configuration file */
|
||||||
void uicb_reload(Display *, jdwm_config *, const char *); /* reload configuration file */
|
void uicb_reload(Display *, awesome_config *, const char *); /* reload configuration file */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# jdwm version
|
# awesome version
|
||||||
VERSION = 0.0
|
VERSION = 0.0
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
24
draw.c
24
draw.c
|
@ -105,37 +105,37 @@ textnw(const char *text, unsigned int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drawstatus(Display *disp, jdwm_config * jdwmconf)
|
drawstatus(Display *disp, awesome_config * awesomeconf)
|
||||||
{
|
{
|
||||||
int x, i;
|
int x, i;
|
||||||
dc.x = dc.y = 0;
|
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]);
|
dc.w = textw(awesomeconf->tags[i]);
|
||||||
if(jdwmconf->selected_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);
|
drawsquare(sel && sel->tags[i], isoccupied(i), dc.sel, disp);
|
||||||
}
|
}
|
||||||
else
|
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);
|
drawsquare(sel && sel->tags[i], isoccupied(i), dc.norm, disp);
|
||||||
}
|
}
|
||||||
dc.x += dc.w;
|
dc.x += dc.w;
|
||||||
}
|
}
|
||||||
dc.w = jdwmconf->statusbar.width;
|
dc.w = awesomeconf->statusbar.width;
|
||||||
drawtext(disp, jdwmconf->current_layout->symbol, dc.norm);
|
drawtext(disp, awesomeconf->current_layout->symbol, dc.norm);
|
||||||
x = dc.x + dc.w;
|
x = dc.x + dc.w;
|
||||||
dc.w = textw(jdwmconf->statustext);
|
dc.w = textw(awesomeconf->statustext);
|
||||||
dc.x = DisplayWidth(disp, DefaultScreen(disp)) - dc.w;
|
dc.x = DisplayWidth(disp, DefaultScreen(disp)) - dc.w;
|
||||||
if(dc.x < x)
|
if(dc.x < x)
|
||||||
{
|
{
|
||||||
dc.x = x;
|
dc.x = x;
|
||||||
dc.w = DisplayWidth(disp, DefaultScreen(disp)) - x;
|
dc.w = DisplayWidth(disp, DefaultScreen(disp)) - x;
|
||||||
}
|
}
|
||||||
drawtext(disp, jdwmconf->statustext, dc.norm);
|
drawtext(disp, awesomeconf->statustext, dc.norm);
|
||||||
if((dc.w = dc.x - x) > jdwmconf->statusbar.height)
|
if((dc.w = dc.x - x) > awesomeconf->statusbar.height)
|
||||||
{
|
{
|
||||||
dc.x = x;
|
dc.x = x;
|
||||||
if(sel)
|
if(sel)
|
||||||
|
@ -146,6 +146,6 @@ drawstatus(Display *disp, jdwm_config * jdwmconf)
|
||||||
else
|
else
|
||||||
drawtext(disp, NULL, dc.norm);
|
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);
|
XSync(disp, False);
|
||||||
}
|
}
|
||||||
|
|
2
draw.h
2
draw.h
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#define textw(text) (textnw(text, strlen(text)) + dc.font.height)
|
#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);
|
unsigned int textnw(const char *, unsigned int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
138
event.c
138
event.c
|
@ -4,7 +4,7 @@
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
#include "jdwm.h"
|
#include "awesome.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
|
@ -19,7 +19,7 @@ extern Cursor cursor[CurLast];
|
||||||
extern Client *clients, *sel; /* global client list */
|
extern Client *clients, *sel; /* global client list */
|
||||||
extern Atom netatom[NetLast];
|
extern Atom netatom[NetLast];
|
||||||
|
|
||||||
#define CLEANMASK(mask) (mask & ~(jdwmconf->numlockmask | LockMask))
|
#define CLEANMASK(mask) (mask & ~(awesomeconf->numlockmask | LockMask))
|
||||||
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
||||||
|
|
||||||
static Client *
|
static Client *
|
||||||
|
@ -32,7 +32,7 @@ getclient(Window w)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
movemouse(Client * c, jdwm_config *jdwmconf)
|
movemouse(Client * c, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
int x1, y1, ocx, ocy, di, nx, ny;
|
int x1, y1, ocx, ocy, di, nx, ny;
|
||||||
unsigned int dui;
|
unsigned int dui;
|
||||||
|
@ -56,19 +56,19 @@ movemouse(Client * c, jdwm_config *jdwmconf)
|
||||||
case ConfigureRequest:
|
case ConfigureRequest:
|
||||||
case Expose:
|
case Expose:
|
||||||
case MapRequest:
|
case MapRequest:
|
||||||
handle_event_maprequest(&ev, jdwmconf);
|
handle_event_maprequest(&ev, awesomeconf);
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
XSync(c->display, False);
|
XSync(c->display, False);
|
||||||
nx = ocx + (ev.xmotion.x - x1);
|
nx = ocx + (ev.xmotion.x - x1);
|
||||||
ny = ocy + (ev.xmotion.y - y1);
|
ny = ocy + (ev.xmotion.y - y1);
|
||||||
if(abs(wax + nx) < jdwmconf->snap)
|
if(abs(wax + nx) < awesomeconf->snap)
|
||||||
nx = wax;
|
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;
|
nx = wax + waw - c->w - 2 * c->border;
|
||||||
if(abs(way - ny) < jdwmconf->snap)
|
if(abs(way - ny) < awesomeconf->snap)
|
||||||
ny = way;
|
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;
|
ny = way + wah - c->h - 2 * c->border;
|
||||||
resize(c, nx, ny, c->w, c->h, False);
|
resize(c, nx, ny, c->w, c->h, False);
|
||||||
break;
|
break;
|
||||||
|
@ -77,7 +77,7 @@ movemouse(Client * c, jdwm_config *jdwmconf)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
resizemouse(Client * c, jdwm_config *jdwmconf)
|
resizemouse(Client * c, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
int ocx, ocy;
|
int ocx, ocy;
|
||||||
int nw, nh;
|
int nw, nh;
|
||||||
|
@ -103,7 +103,7 @@ resizemouse(Client * c, jdwm_config *jdwmconf)
|
||||||
case ConfigureRequest:
|
case ConfigureRequest:
|
||||||
case Expose:
|
case Expose:
|
||||||
case MapRequest:
|
case MapRequest:
|
||||||
handle_event_maprequest(&ev, jdwmconf);
|
handle_event_maprequest(&ev, awesomeconf);
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
XSync(c->display, False);
|
XSync(c->display, False);
|
||||||
|
@ -118,69 +118,69 @@ resizemouse(Client * c, jdwm_config *jdwmconf)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_buttonpress(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
int i, x;
|
int i, x;
|
||||||
Client *c;
|
Client *c;
|
||||||
XButtonPressedEvent *ev = &e->xbutton;
|
XButtonPressedEvent *ev = &e->xbutton;
|
||||||
|
|
||||||
if(jdwmconf->statusbar.window == ev->window)
|
if(awesomeconf->statusbar.window == ev->window)
|
||||||
{
|
{
|
||||||
x = 0;
|
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->x < x)
|
||||||
{
|
{
|
||||||
if(ev->button == Button1)
|
if(ev->button == Button1)
|
||||||
{
|
{
|
||||||
if(ev->state & jdwmconf->modkey)
|
if(ev->state & awesomeconf->modkey)
|
||||||
uicb_tag(e->xany.display, jdwmconf, jdwmconf->tags[i]);
|
uicb_tag(e->xany.display, awesomeconf, awesomeconf->tags[i]);
|
||||||
else
|
else
|
||||||
uicb_view(e->xany.display, jdwmconf, jdwmconf->tags[i]);
|
uicb_view(e->xany.display, awesomeconf, awesomeconf->tags[i]);
|
||||||
}
|
}
|
||||||
else if(ev->button == Button3)
|
else if(ev->button == Button3)
|
||||||
{
|
{
|
||||||
if(ev->state & jdwmconf->modkey)
|
if(ev->state & awesomeconf->modkey)
|
||||||
uicb_toggletag(e->xany.display, jdwmconf, jdwmconf->tags[i]);
|
uicb_toggletag(e->xany.display, awesomeconf, awesomeconf->tags[i]);
|
||||||
else
|
else
|
||||||
uicb_toggleview(e->xany.display, jdwmconf, jdwmconf->tags[i]);
|
uicb_toggleview(e->xany.display, awesomeconf, awesomeconf->tags[i]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((ev->x < x + jdwmconf->statusbar.width) && ev->button == Button1)
|
if((ev->x < x + awesomeconf->statusbar.width) && ev->button == Button1)
|
||||||
uicb_setlayout(e->xany.display, jdwmconf, NULL);
|
uicb_setlayout(e->xany.display, awesomeconf, NULL);
|
||||||
}
|
}
|
||||||
else if((c = getclient(ev->window)))
|
else if((c = getclient(ev->window)))
|
||||||
{
|
{
|
||||||
focus(c->display, &dc, c, ev->same_screen, jdwmconf);
|
focus(c->display, &dc, c, ev->same_screen, awesomeconf);
|
||||||
if(CLEANMASK(ev->state) != jdwmconf->modkey)
|
if(CLEANMASK(ev->state) != awesomeconf->modkey)
|
||||||
return;
|
return;
|
||||||
if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating))
|
if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating))
|
||||||
{
|
{
|
||||||
restack(e->xany.display, jdwmconf);
|
restack(e->xany.display, awesomeconf);
|
||||||
movemouse(c, jdwmconf);
|
movemouse(c, awesomeconf);
|
||||||
}
|
}
|
||||||
else if(ev->button == Button2)
|
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)
|
else if(ev->button == Button3 && (IS_ARRANGE(floating) || c->isfloating) && !c->isfixed)
|
||||||
{
|
{
|
||||||
restack(e->xany.display, jdwmconf);
|
restack(e->xany.display, awesomeconf);
|
||||||
resizemouse(c, jdwmconf);
|
resizemouse(c, awesomeconf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(DefaultRootWindow(e->xany.display) == ev->window && !sel)
|
else if(DefaultRootWindow(e->xany.display) == ev->window && !sel)
|
||||||
{
|
{
|
||||||
if(ev->button == Button4)
|
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)
|
else if(ev->button == Button5)
|
||||||
uicb_tag_viewprev(e->xany.display, jdwmconf, NULL);
|
uicb_tag_viewprev(e->xany.display, awesomeconf, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_configurerequest(XEvent * e, jdwm_config *jdwmconf __attribute__ ((unused)))
|
handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
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 */
|
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)))
|
if((ev->value_mask & (CWX | CWY)) && !(ev->value_mask & (CWWidth | CWHeight)))
|
||||||
configure(c);
|
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);
|
XMoveResizeWindow(e->xany.display, c->win, c->x, c->y, c->w, c->h);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -228,7 +228,7 @@ handle_event_configurerequest(XEvent * e, jdwm_config *jdwmconf __attribute__ ((
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_configurenotify(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XConfigureEvent *ev = &e->xconfigure;
|
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;
|
DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)) = ev->width;
|
||||||
DisplayHeight(e->xany.display, DefaultScreen(e->xany.display)) = ev->height;
|
DisplayHeight(e->xany.display, DefaultScreen(e->xany.display)) = ev->height;
|
||||||
XFreePixmap(e->xany.display, dc.drawable);
|
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)));
|
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, jdwmconf->statusbar.window, DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), jdwmconf->statusbar.height);
|
XResizeWindow(e->xany.display, awesomeconf->statusbar.window, DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), awesomeconf->statusbar.height);
|
||||||
updatebarpos(e->xany.display, jdwmconf->statusbar);
|
updatebarpos(e->xany.display, awesomeconf->statusbar);
|
||||||
arrange(e->xany.display, jdwmconf);
|
arrange(e->xany.display, awesomeconf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_destroynotify(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_destroynotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
||||||
|
|
||||||
if((c = getclient(ev->window)))
|
if((c = getclient(ev->window)))
|
||||||
unmanage(c, &dc, WithdrawnState, jdwmconf);
|
unmanage(c, &dc, WithdrawnState, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_enternotify(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XCrossingEvent *ev = &e->xcrossing;
|
XCrossingEvent *ev = &e->xcrossing;
|
||||||
|
@ -263,55 +263,55 @@ handle_event_enternotify(XEvent * e, jdwm_config *jdwmconf)
|
||||||
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
||||||
return;
|
return;
|
||||||
if((c = getclient(ev->window)))
|
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))
|
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
|
void
|
||||||
handle_event_expose(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_expose(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XExposeEvent *ev = &e->xexpose;
|
XExposeEvent *ev = &e->xexpose;
|
||||||
|
|
||||||
if(!ev->count && jdwmconf->statusbar.window == ev->window)
|
if(!ev->count && awesomeconf->statusbar.window == ev->window)
|
||||||
drawstatus(e->xany.display, jdwmconf);
|
drawstatus(e->xany.display, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_keypress(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_keypress(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
XKeyEvent *ev = &e->xkey;
|
XKeyEvent *ev = &e->xkey;
|
||||||
|
|
||||||
keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0);
|
keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0);
|
||||||
for(i = 0; i < jdwmconf->nkeys; i++)
|
for(i = 0; i < awesomeconf->nkeys; i++)
|
||||||
if(keysym == jdwmconf->keys[i].keysym
|
if(keysym == awesomeconf->keys[i].keysym
|
||||||
&& CLEANMASK(jdwmconf->keys[i].mod) == CLEANMASK(ev->state) && jdwmconf->keys[i].func)
|
&& CLEANMASK(awesomeconf->keys[i].mod) == CLEANMASK(ev->state) && awesomeconf->keys[i].func)
|
||||||
jdwmconf->keys[i].func(e->xany.display, jdwmconf, jdwmconf->keys[i].arg);
|
awesomeconf->keys[i].func(e->xany.display, awesomeconf, awesomeconf->keys[i].arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_leavenotify(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XCrossingEvent *ev = &e->xcrossing;
|
XCrossingEvent *ev = &e->xcrossing;
|
||||||
|
|
||||||
if((ev->window == DefaultRootWindow(e->xany.display)) && !ev->same_screen)
|
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
|
void
|
||||||
handle_event_mappingnotify(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_mappingnotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XMappingEvent *ev = &e->xmapping;
|
XMappingEvent *ev = &e->xmapping;
|
||||||
|
|
||||||
XRefreshKeyboardMapping(ev);
|
XRefreshKeyboardMapping(ev);
|
||||||
if(ev->request == MappingKeyboard)
|
if(ev->request == MappingKeyboard)
|
||||||
grabkeys(e->xany.display, jdwmconf);
|
grabkeys(e->xany.display, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_maprequest(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_maprequest(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
static XWindowAttributes wa;
|
static XWindowAttributes wa;
|
||||||
XMapRequestEvent *ev = &e->xmaprequest;
|
XMapRequestEvent *ev = &e->xmaprequest;
|
||||||
|
@ -321,11 +321,11 @@ handle_event_maprequest(XEvent * e, jdwm_config *jdwmconf)
|
||||||
if(wa.override_redirect)
|
if(wa.override_redirect)
|
||||||
return;
|
return;
|
||||||
if(!getclient(ev->window))
|
if(!getclient(ev->window))
|
||||||
manage(e->xany.display, &dc, ev->window, &wa, jdwmconf);
|
manage(e->xany.display, &dc, ev->window, &wa, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_propertynotify(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Window trans;
|
Window trans;
|
||||||
|
@ -342,7 +342,7 @@ handle_event_propertynotify(XEvent * e, jdwm_config *jdwmconf)
|
||||||
case XA_WM_TRANSIENT_FOR:
|
case XA_WM_TRANSIENT_FOR:
|
||||||
XGetTransientForHint(e->xany.display, c->win, &trans);
|
XGetTransientForHint(e->xany.display, c->win, &trans);
|
||||||
if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL)))
|
if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL)))
|
||||||
arrange(e->xany.display, jdwmconf);
|
arrange(e->xany.display, awesomeconf);
|
||||||
break;
|
break;
|
||||||
case XA_WM_NORMAL_HINTS:
|
case XA_WM_NORMAL_HINTS:
|
||||||
updatesizehints(c);
|
updatesizehints(c);
|
||||||
|
@ -352,35 +352,35 @@ handle_event_propertynotify(XEvent * e, jdwm_config *jdwmconf)
|
||||||
{
|
{
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
if(c == sel)
|
if(c == sel)
|
||||||
drawstatus(e->xany.display, jdwmconf);
|
drawstatus(e->xany.display, awesomeconf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_unmapnotify(XEvent * e, jdwm_config *jdwmconf)
|
handle_event_unmapnotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XUnmapEvent *ev = &e->xunmap;
|
XUnmapEvent *ev = &e->xunmap;
|
||||||
|
|
||||||
if((c = getclient(ev->window)) && ev->event == DefaultRootWindow(e->xany.display) && (ev->send_event || !c->unmapped--))
|
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
|
void
|
||||||
grabkeys(Display *disp, jdwm_config *jdwmconf)
|
grabkeys(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
KeyCode code;
|
KeyCode code;
|
||||||
|
|
||||||
XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp));
|
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);
|
code = XKeysymToKeycode(disp, awesomeconf->keys[i].keysym);
|
||||||
XGrabKey(disp, code, jdwmconf->keys[i].mod, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
|
XGrabKey(disp, code, awesomeconf->keys[i].mod, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
|
||||||
XGrabKey(disp, code, jdwmconf->keys[i].mod | LockMask, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
|
XGrabKey(disp, code, awesomeconf->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, awesomeconf->keys[i].mod | awesomeconf->numlockmask, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync);
|
||||||
XGrabKey(disp, code, jdwmconf->keys[i].mod | jdwmconf->numlockmask | LockMask, DefaultRootWindow(disp), True,
|
XGrabKey(disp, code, awesomeconf->keys[i].mod | awesomeconf->numlockmask | LockMask, DefaultRootWindow(disp), True,
|
||||||
GrabModeAsync, GrabModeAsync);
|
GrabModeAsync, GrabModeAsync);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
26
event.h
26
event.h
|
@ -5,19 +5,19 @@
|
||||||
|
|
||||||
#include "config.h"
|
#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_buttonpress(XEvent *, awesome_config *);
|
||||||
void handle_event_configurerequest(XEvent *, jdwm_config *);
|
void handle_event_configurerequest(XEvent *, awesome_config *);
|
||||||
void handle_event_configurenotify(XEvent *, jdwm_config *);
|
void handle_event_configurenotify(XEvent *, awesome_config *);
|
||||||
void handle_event_destroynotify(XEvent *, jdwm_config *);
|
void handle_event_destroynotify(XEvent *, awesome_config *);
|
||||||
void handle_event_enternotify(XEvent *, jdwm_config *);
|
void handle_event_enternotify(XEvent *, awesome_config *);
|
||||||
void handle_event_expose(XEvent *, jdwm_config *);
|
void handle_event_expose(XEvent *, awesome_config *);
|
||||||
void handle_event_keypress(XEvent *, jdwm_config *);
|
void handle_event_keypress(XEvent *, awesome_config *);
|
||||||
void handle_event_leavenotify(XEvent *, jdwm_config *);
|
void handle_event_leavenotify(XEvent *, awesome_config *);
|
||||||
void handle_event_mappingnotify(XEvent *, jdwm_config *);
|
void handle_event_mappingnotify(XEvent *, awesome_config *);
|
||||||
void handle_event_maprequest(XEvent *, jdwm_config *);
|
void handle_event_maprequest(XEvent *, awesome_config *);
|
||||||
void handle_event_propertynotify(XEvent *, jdwm_config *);
|
void handle_event_propertynotify(XEvent *, awesome_config *);
|
||||||
void handle_event_unmapnotify(XEvent *, jdwm_config *);
|
void handle_event_unmapnotify(XEvent *, awesome_config *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
114
layout.c
114
layout.c
|
@ -4,7 +4,7 @@
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
#include "jdwm.h"
|
#include "awesome.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "layouts/floating.h"
|
#include "layouts/floating.h"
|
||||||
|
@ -16,84 +16,84 @@ extern Client *clients, *sel; /* global client list */
|
||||||
extern DC dc;
|
extern DC dc;
|
||||||
|
|
||||||
void
|
void
|
||||||
arrange(Display * disp, jdwm_config *jdwmconf)
|
arrange(Display * disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(c = clients; c; c = c->next)
|
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);
|
unban(c);
|
||||||
else
|
else
|
||||||
ban(c);
|
ban(c);
|
||||||
jdwmconf->current_layout->arrange(disp, jdwmconf);
|
awesomeconf->current_layout->arrange(disp, awesomeconf);
|
||||||
focus(disp, &dc, NULL, True, jdwmconf);
|
focus(disp, &dc, NULL, True, awesomeconf);
|
||||||
restack(disp, jdwmconf);
|
restack(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_focusnext(Display *disp __attribute__ ((unused)),
|
uicb_focusnext(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config * jdwmconf,
|
awesome_config * awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
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)
|
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)
|
if(c)
|
||||||
{
|
{
|
||||||
focus(c->display, &dc, c, True, jdwmconf);
|
focus(c->display, &dc, c, True, awesomeconf);
|
||||||
restack(c->display, jdwmconf);
|
restack(c->display, awesomeconf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_focusprev(Display *disp __attribute__ ((unused)),
|
uicb_focusprev(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
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)
|
if(!c)
|
||||||
{
|
{
|
||||||
for(c = clients; c && c->next; c = c->next);
|
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)
|
if(c)
|
||||||
{
|
{
|
||||||
focus(c->display, &dc, c, True, jdwmconf);
|
focus(c->display, &dc, c, True, awesomeconf);
|
||||||
restack(c->display, jdwmconf);
|
restack(c->display, awesomeconf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
loadjdwmprops(Display *disp, jdwm_config * jdwmconf)
|
loadawesomeprops(Display *disp, awesome_config * awesomeconf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *prop;
|
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))
|
if(gettextprop(disp, DefaultRootWindow(disp), JDWMPROPS_ATOM(disp), prop, awesomeconf->ntags + 1))
|
||||||
for(i = 0; i < jdwmconf->ntags && prop[i]; i++)
|
for(i = 0; i < awesomeconf->ntags && prop[i]; i++)
|
||||||
jdwmconf->selected_tags[i] = prop[i] == '1';
|
awesomeconf->selected_tags[i] = prop[i] == '1';
|
||||||
|
|
||||||
p_delete(&prop);
|
p_delete(&prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
restack(Display * disp, jdwm_config *jdwmconf)
|
restack(Display * disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
drawstatus(disp, jdwmconf);
|
drawstatus(disp, awesomeconf);
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
if(sel->isfloating || IS_ARRANGE(floating))
|
if(sel->isfloating || IS_ARRANGE(floating))
|
||||||
|
@ -101,7 +101,7 @@ restack(Display * disp, jdwm_config *jdwmconf)
|
||||||
if(!IS_ARRANGE(floating))
|
if(!IS_ARRANGE(floating))
|
||||||
{
|
{
|
||||||
wc.stack_mode = Below;
|
wc.stack_mode = Below;
|
||||||
wc.sibling = jdwmconf->statusbar.window;
|
wc.sibling = awesomeconf->statusbar.window;
|
||||||
if(!sel->isfloating)
|
if(!sel->isfloating)
|
||||||
{
|
{
|
||||||
XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc);
|
XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc);
|
||||||
|
@ -109,7 +109,7 @@ restack(Display * disp, jdwm_config *jdwmconf)
|
||||||
}
|
}
|
||||||
for(c = clients; c; c = c->next)
|
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;
|
continue;
|
||||||
XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc);
|
XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc);
|
||||||
wc.sibling = c->win;
|
wc.sibling = c->win;
|
||||||
|
@ -120,14 +120,14 @@ restack(Display * disp, jdwm_config *jdwmconf)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
savejdwmprops(Display *disp, jdwm_config *jdwmconf)
|
saveawesomeprops(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *prop;
|
char *prop;
|
||||||
|
|
||||||
prop = p_new(char, jdwmconf->ntags + 1);
|
prop = p_new(char, awesomeconf->ntags + 1);
|
||||||
for(i = 0; i < jdwmconf->ntags; i++)
|
for(i = 0; i < awesomeconf->ntags; i++)
|
||||||
prop[i] = jdwmconf->selected_tags[i] ? '1' : '0';
|
prop[i] = awesomeconf->selected_tags[i] ? '1' : '0';
|
||||||
prop[i] = '\0';
|
prop[i] = '\0';
|
||||||
XChangeProperty(disp, DefaultRootWindow(disp),
|
XChangeProperty(disp, DefaultRootWindow(disp),
|
||||||
JDWMPROPS_ATOM(disp), XA_STRING, 8,
|
JDWMPROPS_ATOM(disp), XA_STRING, 8,
|
||||||
|
@ -136,54 +136,54 @@ savejdwmprops(Display *disp, jdwm_config *jdwmconf)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_setlayout(Display *disp, jdwm_config * jdwmconf, const char *arg)
|
uicb_setlayout(Display *disp, awesome_config * awesomeconf, const char *arg)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if(!arg)
|
if(!arg)
|
||||||
{
|
{
|
||||||
if(!(++jdwmconf->current_layout)->symbol)
|
if(!(++awesomeconf->current_layout)->symbol)
|
||||||
jdwmconf->current_layout = &jdwmconf->layouts[0];
|
awesomeconf->current_layout = &awesomeconf->layouts[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i = strtol(arg, NULL, 10);
|
i = strtol(arg, NULL, 10);
|
||||||
if(i < 0 || i >= jdwmconf->nlayouts)
|
if(i < 0 || i >= awesomeconf->nlayouts)
|
||||||
return;
|
return;
|
||||||
jdwmconf->current_layout = &jdwmconf->layouts[i];
|
awesomeconf->current_layout = &awesomeconf->layouts[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
for(c = clients; c; c = c->next)
|
for(c = clients; c; c = c->next)
|
||||||
c->ftview = True;
|
c->ftview = True;
|
||||||
|
|
||||||
if(sel)
|
if(sel)
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
else
|
else
|
||||||
drawstatus(disp, jdwmconf);
|
drawstatus(disp, awesomeconf);
|
||||||
|
|
||||||
savejdwmprops(disp, jdwmconf);
|
saveawesomeprops(disp, awesomeconf);
|
||||||
|
|
||||||
for(j = 0; j < jdwmconf->ntags; j++)
|
for(j = 0; j < awesomeconf->ntags; j++)
|
||||||
if (jdwmconf->selected_tags[j])
|
if (awesomeconf->selected_tags[j])
|
||||||
jdwmconf->tag_layouts[j] = jdwmconf->current_layout;
|
awesomeconf->tag_layouts[j] = awesomeconf->current_layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_togglebar(Display *disp,
|
uicb_togglebar(Display *disp,
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if(jdwmconf->statusbar.position == BarOff)
|
if(awesomeconf->statusbar.position == BarOff)
|
||||||
jdwmconf->statusbar.position = (jdwmconf->statusbar.position == BarOff) ? BarTop : jdwmconf->statusbar_default_position;
|
awesomeconf->statusbar.position = (awesomeconf->statusbar.position == BarOff) ? BarTop : awesomeconf->statusbar_default_position;
|
||||||
else
|
else
|
||||||
jdwmconf->statusbar.position = BarOff;
|
awesomeconf->statusbar.position = BarOff;
|
||||||
updatebarpos(disp, jdwmconf->statusbar);
|
updatebarpos(disp, awesomeconf->statusbar);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
XEvent ev;
|
||||||
|
|
||||||
|
@ -205,48 +205,48 @@ maximize(int x, int y, int w, int h, jdwm_config *jdwmconf)
|
||||||
else
|
else
|
||||||
sel->isfloating = False;
|
sel->isfloating = False;
|
||||||
|
|
||||||
drawstatus(sel->display, jdwmconf);
|
drawstatus(sel->display, awesomeconf);
|
||||||
|
|
||||||
while(XCheckMaskEvent(sel->display, EnterWindowMask, &ev));
|
while(XCheckMaskEvent(sel->display, EnterWindowMask, &ev));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_togglemax(Display *disp __attribute__ ((unused)),
|
uicb_togglemax(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
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
|
void
|
||||||
uicb_toggleverticalmax(Display *disp __attribute__ ((unused)),
|
uicb_toggleverticalmax(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if(sel)
|
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
|
void
|
||||||
uicb_togglehorizontalmax(Display *disp __attribute__ ((unused)),
|
uicb_togglehorizontalmax(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if(sel)
|
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
|
void
|
||||||
uicb_zoom(Display *disp __attribute__ ((unused)),
|
uicb_zoom(Display *disp __attribute__ ((unused)),
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
detach(sel);
|
detach(sel);
|
||||||
attach(sel);
|
attach(sel);
|
||||||
focus(sel->display, &dc, sel, True, jdwmconf);
|
focus(sel->display, &dc, sel, True, awesomeconf);
|
||||||
arrange(sel->display, jdwmconf);
|
arrange(sel->display, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
26
layout.h
26
layout.h
|
@ -6,21 +6,21 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
/** Check if current layout is arranged with a layout */
|
/** 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)
|
#define JDWMPROPS_ATOM(disp) XInternAtom(disp, "_JDWM_PROPERTIES", False)
|
||||||
|
|
||||||
void arrange(Display *, jdwm_config *); /* arranges all windows depending on the layout in use */
|
void arrange(Display *, awesome_config *); /* arranges all windows depending on the layout in use */
|
||||||
void restack(Display *, jdwm_config *); /* restores z layers of all clients */
|
void restack(Display *, awesome_config *); /* restores z layers of all clients */
|
||||||
void uicb_focusnext(Display *, jdwm_config *, const char *); /* focuses next visible client */
|
void uicb_focusnext(Display *, awesome_config *, const char *); /* focuses next visible client */
|
||||||
void uicb_focusprev(Display *, jdwm_config *, const char *); /* focuses prev visible client */
|
void uicb_focusprev(Display *, awesome_config *, const char *); /* focuses prev visible client */
|
||||||
void uicb_setlayout(Display *, jdwm_config *, const char *); /* sets layout, NULL means next layout */
|
void uicb_setlayout(Display *, awesome_config *, const char *); /* sets layout, NULL means next layout */
|
||||||
void uicb_togglebar(Display *, jdwm_config *, const char *); /* shows/hides the bar */
|
void uicb_togglebar(Display *, awesome_config *, const char *); /* shows/hides the bar */
|
||||||
void uicb_togglemax(Display *, jdwm_config *, const char *); /* toggles maximization of floating client */
|
void uicb_togglemax(Display *, awesome_config *, const char *); /* toggles maximization of floating client */
|
||||||
void uicb_toggleverticalmax(Display *, jdwm_config *, const char *);
|
void uicb_toggleverticalmax(Display *, awesome_config *, const char *);
|
||||||
void uicb_togglehorizontalmax(Display *, jdwm_config *, const char *);
|
void uicb_togglehorizontalmax(Display *, awesome_config *, const char *);
|
||||||
void uicb_zoom(Display *, jdwm_config *, const char *); /* set current window first in stack */
|
void uicb_zoom(Display *, awesome_config *, const char *); /* set current window first in stack */
|
||||||
void loadjdwmprops(Display *, jdwm_config *);
|
void loadawesomeprops(Display *, awesome_config *);
|
||||||
void savejdwmprops(Display *disp, jdwm_config *);
|
void saveawesomeprops(Display *disp, awesome_config *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
extern Client *clients; /* global client */
|
extern Client *clients; /* global client */
|
||||||
|
|
||||||
void
|
void
|
||||||
floating(Display *disp __attribute__ ((unused)), jdwm_config *jdwmconf)
|
floating(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
|
||||||
{ /* default floating layout */
|
{ /* default floating layout */
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(c = clients; c; c = c->next)
|
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)
|
if(c->ftview)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
#ifndef JDWM_FLOATING_H
|
#ifndef JDWM_FLOATING_H
|
||||||
#define JDWM_FLOATING_H
|
#define JDWM_FLOATING_H
|
||||||
|
|
||||||
void floating(Display *, jdwm_config *); /* floating layout */
|
void floating(Display *, awesome_config *); /* floating layout */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,13 +9,13 @@ extern Client *clients; /* global client list and stack */
|
||||||
extern DC dc;
|
extern DC dc;
|
||||||
|
|
||||||
void
|
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;
|
unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(n = 0, c = clients; c; c = c->next)
|
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++;
|
n++;
|
||||||
|
|
||||||
/* grid dimensions */
|
/* grid dimensions */
|
||||||
|
@ -29,14 +29,14 @@ grid(Display *disp, jdwm_config *jdwmconf)
|
||||||
cw = waw / (cols ? cols : 1);
|
cw = waw / (cols ? cols : 1);
|
||||||
|
|
||||||
for(i = 0, c = clients; c; c = c->next)
|
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);
|
unban(c);
|
||||||
if(c->isfloating)
|
if(c->isfloating)
|
||||||
continue;
|
continue;
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
cx = (i / rows) * cw;
|
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 */
|
/* adjust height/width of last row/column's windows */
|
||||||
ah = ((i + 1) % rows == 0) ? wah - ch * rows : 0;
|
ah = ((i + 1) % rows == 0) ? wah - ch * rows : 0;
|
||||||
aw = (i >= rows * (cols - 1)) ? waw - cw * cols : 0;
|
aw = (i >= rows * (cols - 1)) ? waw - cw * cols : 0;
|
||||||
|
@ -45,6 +45,6 @@ grid(Display *disp, jdwm_config *jdwmconf)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ban(c);
|
ban(c);
|
||||||
focus(disp, &dc, NULL, True, jdwmconf);
|
focus(disp, &dc, NULL, True, awesomeconf);
|
||||||
restack(disp, jdwmconf);
|
restack(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
/* grid.c */
|
/* grid.c */
|
||||||
void grid(Display *, jdwm_config *);
|
void grid(Display *, awesome_config *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,7 +9,7 @@ extern Client *clients; /* global client list */
|
||||||
extern DC dc;
|
extern DC dc;
|
||||||
|
|
||||||
static void
|
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;
|
int n, nx, ny, nh, nw, i;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
@ -19,7 +19,7 @@ fibonacci(Display *disp, jdwm_config *jdwmconf, int shape)
|
||||||
nw = waw;
|
nw = waw;
|
||||||
nh = wah;
|
nh = wah;
|
||||||
for(n = 0, c = clients; c; c = c->next)
|
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++;
|
n++;
|
||||||
for(i = 0, c = clients; c; c = c->next)
|
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);
|
resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False);
|
||||||
}
|
}
|
||||||
focus(disp, &dc, NULL, True, jdwmconf);
|
focus(disp, &dc, NULL, True, awesomeconf);
|
||||||
restack(disp, jdwmconf);
|
restack(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
dwindle(Display *disp, jdwm_config *jdwmconf)
|
dwindle(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
fibonacci(disp, jdwmconf, 1);
|
fibonacci(disp, awesomeconf, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spiral(Display *disp, jdwm_config *jdwmconf)
|
spiral(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
fibonacci(disp, jdwmconf, 0);
|
fibonacci(disp, awesomeconf, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef JDWM_SPIRAL_H
|
#ifndef JDWM_SPIRAL_H
|
||||||
#define JDWM_SPIRAL_H
|
#define JDWM_SPIRAL_H
|
||||||
|
|
||||||
void dwindle(Display *, jdwm_config *); /* dwindle windows */
|
void dwindle(Display *, awesome_config *); /* dwindle windows */
|
||||||
void spiral(Display *, jdwm_config *); /* spiral windows */
|
void spiral(Display *, awesome_config *); /* spiral windows */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,13 +14,13 @@ extern Client *sel, *clients;
|
||||||
/* static */
|
/* static */
|
||||||
|
|
||||||
static double mwfact = 0.6;
|
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;
|
static int nmaster = 2;
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_incnmaster(Display *disp,
|
uicb_incnmaster(Display *disp,
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char * arg)
|
const char * arg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -28,23 +28,23 @@ uicb_incnmaster(Display *disp,
|
||||||
if(!IS_ARRANGE(tile) && !IS_ARRANGE(tileleft) && !IS_ARRANGE(bstack) && !IS_ARRANGE(bstackportrait))
|
if(!IS_ARRANGE(tile) && !IS_ARRANGE(tileleft) && !IS_ARRANGE(bstack) && !IS_ARRANGE(bstackportrait))
|
||||||
return;
|
return;
|
||||||
if(!arg)
|
if(!arg)
|
||||||
nmaster = jdwmconf->nmaster;
|
nmaster = awesomeconf->nmaster;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i = strtol(arg, (char **) NULL, 10);
|
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;
|
return;
|
||||||
nmaster += i;
|
nmaster += i;
|
||||||
}
|
}
|
||||||
if(sel)
|
if(sel)
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
else
|
else
|
||||||
drawstatus(disp, jdwmconf);
|
drawstatus(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_setmwfact(Display *disp,
|
uicb_setmwfact(Display *disp,
|
||||||
jdwm_config * jdwmconf,
|
awesome_config * awesomeconf,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
double delta;
|
double delta;
|
||||||
|
@ -54,7 +54,7 @@ uicb_setmwfact(Display *disp,
|
||||||
|
|
||||||
/* arg handling, manipulate mwfact */
|
/* arg handling, manipulate mwfact */
|
||||||
if(!arg)
|
if(!arg)
|
||||||
mwfact = jdwmconf->mwfact;
|
mwfact = awesomeconf->mwfact;
|
||||||
else if(1 == sscanf(arg, "%lf", &delta))
|
else if(1 == sscanf(arg, "%lf", &delta))
|
||||||
{
|
{
|
||||||
if(arg[0] != '+' && arg[0] != '-')
|
if(arg[0] != '+' && arg[0] != '-')
|
||||||
|
@ -66,32 +66,32 @@ uicb_setmwfact(Display *disp,
|
||||||
else if(mwfact > 0.9)
|
else if(mwfact > 0.9)
|
||||||
mwfact = 0.9;
|
mwfact = 0.9;
|
||||||
}
|
}
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_tile(jdwm_config *jdwmconf, const Bool right)
|
_tile(awesome_config *awesomeconf, const Bool right)
|
||||||
{
|
{
|
||||||
unsigned int nx, ny, nw, nh, mw;
|
unsigned int nx, ny, nw, nh, mw;
|
||||||
int n, th, i, mh;
|
int n, th, i, mh;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(n = 0, c = clients; c; c = c->next)
|
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++;
|
n++;
|
||||||
|
|
||||||
/* window geoms */
|
/* window geoms */
|
||||||
mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster;
|
mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster;
|
||||||
mw = (n <= nmaster) ? waw : mwfact * waw;
|
mw = (n <= nmaster) ? waw : mwfact * waw;
|
||||||
th = (n > nmaster) ? wah / (n - nmaster) : 0;
|
th = (n > nmaster) ? wah / (n - nmaster) : 0;
|
||||||
if(n > nmaster && th < jdwmconf->statusbar.height)
|
if(n > nmaster && th < awesomeconf->statusbar.height)
|
||||||
th = wah;
|
th = wah;
|
||||||
|
|
||||||
nx = wax;
|
nx = wax;
|
||||||
ny = way;
|
ny = way;
|
||||||
for(i = 0, c = clients; c; c = c->next)
|
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;
|
continue;
|
||||||
|
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
|
@ -122,7 +122,7 @@ _tile(jdwm_config *jdwmconf, const Bool right)
|
||||||
else
|
else
|
||||||
nh = th - 2 * c->border;
|
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)
|
if(n > nmaster && th != wah)
|
||||||
ny += nh + 2 * c->border;
|
ny += nh + 2 * c->border;
|
||||||
i++;
|
i++;
|
||||||
|
@ -130,26 +130,26 @@ _tile(jdwm_config *jdwmconf, const Bool right)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tile(Display *disp __attribute__ ((unused)), jdwm_config *jdwmconf)
|
tile(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
_tile(jdwmconf, True);
|
_tile(awesomeconf, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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
|
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;
|
int i, n, nx, ny, nw, nh, mw, mh, tw, th;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(n = 0, c = clients; c; c = c->next)
|
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++;
|
n++;
|
||||||
|
|
||||||
/* window geoms */
|
/* window geoms */
|
||||||
|
@ -160,7 +160,7 @@ _bstack(jdwm_config *jdwmconf, Bool portrait)
|
||||||
|
|
||||||
for(i = 0, c = clients; c; c = c->next)
|
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;
|
continue;
|
||||||
|
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
|
@ -199,13 +199,13 @@ _bstack(jdwm_config *jdwmconf, Bool portrait)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bstack(Display *disp __attribute__ ((unused)), jdwm_config *jdwmconf)
|
bstack(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
_bstack(jdwmconf, False);
|
_bstack(awesomeconf, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bstackportrait(Display *disp __attribute__ ((unused)), jdwm_config *jdwmconf)
|
bstackportrait(Display *disp __attribute__ ((unused)), awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
_bstack(jdwmconf, True);
|
_bstack(awesomeconf, True);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
void uicb_incnmaster(Display *, jdwm_config *, const char *); /* change number of master windows */
|
void uicb_incnmaster(Display *, awesome_config *, const char *); /* change number of master windows */
|
||||||
void uicb_setmwfact(Display *, jdwm_config *, const char *); /* sets master width factor */
|
void uicb_setmwfact(Display *, awesome_config *, const char *); /* sets master width factor */
|
||||||
void tile(Display *, jdwm_config *);
|
void tile(Display *, awesome_config *);
|
||||||
void tileleft(Display *, jdwm_config *);
|
void tileleft(Display *, awesome_config *);
|
||||||
void bstack(Display *, jdwm_config *);
|
void bstack(Display *, awesome_config *);
|
||||||
void bstackportrait(Display *, jdwm_config *);
|
void bstackportrait(Display *, awesome_config *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
142
tag.c
142
tag.c
|
@ -33,7 +33,7 @@ idxoftag(const char *tag_to_find, const char **tags, int ntags)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
applyrules(Client * c, jdwm_config *jdwmconf)
|
applyrules(Client * c, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
int i, j, len = 0;
|
int i, j, len = 0;
|
||||||
regmatch_t tmp;
|
regmatch_t tmp;
|
||||||
|
@ -53,12 +53,12 @@ applyrules(Client * c, jdwm_config *jdwmconf)
|
||||||
XGetClassHint(c->display, c->win, &ch);
|
XGetClassHint(c->display, c->win, &ch);
|
||||||
snprintf(prop, len + 1, "%s:%s:%s",
|
snprintf(prop, len + 1, "%s:%s:%s",
|
||||||
ch.res_class ? ch.res_class : "", ch.res_name ? ch.res_name : "", c->name);
|
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))
|
if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0))
|
||||||
{
|
{
|
||||||
c->isfloating = jdwmconf->rules[i].isfloating;
|
c->isfloating = awesomeconf->rules[i].isfloating;
|
||||||
for(j = 0; regs[i].tagregex && j < jdwmconf->ntags; j++)
|
for(j = 0; regs[i].tagregex && j < awesomeconf->ntags; j++)
|
||||||
if(!regexec(regs[i].tagregex, jdwmconf->tags[j], 1, &tmp, 0))
|
if(!regexec(regs[i].tagregex, awesomeconf->tags[j], 1, &tmp, 0))
|
||||||
{
|
{
|
||||||
matched = True;
|
matched = True;
|
||||||
c->tags[j] = True;
|
c->tags[j] = True;
|
||||||
|
@ -70,33 +70,33 @@ applyrules(Client * c, jdwm_config *jdwmconf)
|
||||||
if(ch.res_name)
|
if(ch.res_name)
|
||||||
XFree(ch.res_name);
|
XFree(ch.res_name);
|
||||||
if(!matched)
|
if(!matched)
|
||||||
for(i = 0; i < jdwmconf->ntags; i++)
|
for(i = 0; i < awesomeconf->ntags; i++)
|
||||||
c->tags[i] = jdwmconf->selected_tags[i];
|
c->tags[i] = awesomeconf->selected_tags[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
compileregs(jdwm_config * jdwmconf)
|
compileregs(awesome_config * awesomeconf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
regex_t *reg;
|
regex_t *reg;
|
||||||
|
|
||||||
if(regs)
|
if(regs)
|
||||||
return;
|
return;
|
||||||
regs = p_new(Regs, jdwmconf->nrules);
|
regs = p_new(Regs, awesomeconf->nrules);
|
||||||
for(i = 0; i < jdwmconf->nrules; i++)
|
for(i = 0; i < awesomeconf->nrules; i++)
|
||||||
{
|
{
|
||||||
if(jdwmconf->rules[i].prop)
|
if(awesomeconf->rules[i].prop)
|
||||||
{
|
{
|
||||||
reg = p_new(regex_t, 1);
|
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(®);
|
p_delete(®);
|
||||||
else
|
else
|
||||||
regs[i].propregex = reg;
|
regs[i].propregex = reg;
|
||||||
}
|
}
|
||||||
if(jdwmconf->rules[i].tags)
|
if(awesomeconf->rules[i].tags)
|
||||||
{
|
{
|
||||||
reg = p_new(regex_t, 1);
|
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(®);
|
p_delete(®);
|
||||||
else
|
else
|
||||||
regs[i].tagregex = reg;
|
regs[i].tagregex = reg;
|
||||||
|
@ -130,19 +130,19 @@ isvisible(Client * c, Bool * tags, int ntags)
|
||||||
* \ingroup ui_callback
|
* \ingroup ui_callback
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
uicb_tag(Display *disp, jdwm_config *jdwmconf, const char *arg)
|
uicb_tag(Display *disp, awesome_config *awesomeconf, const char *arg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
for(i = 0; i < jdwmconf->ntags; i++)
|
for(i = 0; i < awesomeconf->ntags; i++)
|
||||||
sel->tags[i] = arg == NULL;
|
sel->tags[i] = arg == NULL;
|
||||||
i = idxoftag(arg, jdwmconf->tags, jdwmconf->ntags);
|
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
|
||||||
if(i >= 0 && i < jdwmconf->ntags)
|
if(i >= 0 && i < awesomeconf->ntags)
|
||||||
sel->tags[i] = True;
|
sel->tags[i] = True;
|
||||||
saveprops(sel, jdwmconf->ntags);
|
saveprops(sel, awesomeconf->ntags);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Toggle floating state of a client
|
/** Toggle floating state of a client
|
||||||
|
@ -152,7 +152,7 @@ uicb_tag(Display *disp, jdwm_config *jdwmconf, const char *arg)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
uicb_togglefloating(Display *disp,
|
uicb_togglefloating(Display *disp,
|
||||||
jdwm_config * jdwmconf,
|
awesome_config * awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if(!sel)
|
if(!sel)
|
||||||
|
@ -169,8 +169,8 @@ uicb_togglefloating(Display *disp,
|
||||||
sel->rw = sel->w;
|
sel->rw = sel->w;
|
||||||
sel->rh = sel->h;
|
sel->rh = sel->h;
|
||||||
}
|
}
|
||||||
saveprops(sel, jdwmconf->ntags);
|
saveprops(sel, awesomeconf->ntags);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Toggle tag view
|
/** Toggle tag view
|
||||||
|
@ -180,7 +180,7 @@ uicb_togglefloating(Display *disp,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
uicb_toggletag(Display *disp,
|
uicb_toggletag(Display *disp,
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -188,13 +188,13 @@ uicb_toggletag(Display *disp,
|
||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
i = idxoftag(arg, jdwmconf->tags, jdwmconf->ntags);
|
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
|
||||||
sel->tags[i] = !sel->tags[i];
|
sel->tags[i] = !sel->tags[i];
|
||||||
for(j = 0; j < jdwmconf->ntags && !sel->tags[j]; j++);
|
for(j = 0; j < awesomeconf->ntags && !sel->tags[j]; j++);
|
||||||
if(j == jdwmconf->ntags)
|
if(j == awesomeconf->ntags)
|
||||||
sel->tags[i] = True;
|
sel->tags[i] = True;
|
||||||
saveprops(sel, jdwmconf->ntags);
|
saveprops(sel, awesomeconf->ntags);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a tag to viewed tags
|
/** Add a tag to viewed tags
|
||||||
|
@ -204,70 +204,70 @@ uicb_toggletag(Display *disp,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
uicb_toggleview(Display *disp,
|
uicb_toggleview(Display *disp,
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
i = idxoftag(arg, jdwmconf->tags, jdwmconf->ntags);
|
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
|
||||||
jdwmconf->selected_tags[i] = !jdwmconf->selected_tags[i];
|
awesomeconf->selected_tags[i] = !awesomeconf->selected_tags[i];
|
||||||
for(j = 0; j < jdwmconf->ntags && !jdwmconf->selected_tags[j]; j++);
|
for(j = 0; j < awesomeconf->ntags && !awesomeconf->selected_tags[j]; j++);
|
||||||
if(j == jdwmconf->ntags)
|
if(j == awesomeconf->ntags)
|
||||||
jdwmconf->selected_tags[i] = True; /* cannot toggle last view */
|
awesomeconf->selected_tags[i] = True; /* cannot toggle last view */
|
||||||
savejdwmprops(disp, jdwmconf);
|
saveawesomeprops(disp, awesomeconf);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** View tag
|
/** View tag
|
||||||
* \param disp Display ref
|
* \param disp Display ref
|
||||||
* \param jdwmconf jdwm config ref
|
* \param awesomeconf awesome config ref
|
||||||
* \param arg tag to view
|
* \param arg tag to view
|
||||||
* \ingroup ui_callback
|
* \ingroup ui_callback
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
uicb_view(Display *disp,
|
uicb_view(Display *disp,
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
int i;
|
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];
|
awesomeconf->prev_selected_tags[i] = awesomeconf->selected_tags[i];
|
||||||
jdwmconf->selected_tags[i] = arg == NULL;
|
awesomeconf->selected_tags[i] = arg == NULL;
|
||||||
}
|
}
|
||||||
i = idxoftag(arg, jdwmconf->tags, jdwmconf->ntags);
|
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
|
||||||
if(i >= 0 && i < jdwmconf->ntags)
|
if(i >= 0 && i < awesomeconf->ntags)
|
||||||
{
|
{
|
||||||
jdwmconf->selected_tags[i] = True;
|
awesomeconf->selected_tags[i] = True;
|
||||||
jdwmconf->current_layout = jdwmconf->tag_layouts[i];
|
awesomeconf->current_layout = awesomeconf->tag_layouts[i];
|
||||||
}
|
}
|
||||||
savejdwmprops(disp, jdwmconf);
|
saveawesomeprops(disp, awesomeconf);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** View previously selected tags
|
/** View previously selected tags
|
||||||
* \param disp Display ref
|
* \param disp Display ref
|
||||||
* \param jdwmconf jdwm config ref
|
* \param awesomeconf awesome config ref
|
||||||
* \param arg unused
|
* \param arg unused
|
||||||
* \ingroup ui_callback
|
* \ingroup ui_callback
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
uicb_viewprevtags(Display * disp,
|
uicb_viewprevtags(Display * disp,
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Bool t;
|
Bool t;
|
||||||
|
|
||||||
for(i = 0; i < jdwmconf->ntags; i++)
|
for(i = 0; i < awesomeconf->ntags; i++)
|
||||||
{
|
{
|
||||||
t = jdwmconf->selected_tags[i];
|
t = awesomeconf->selected_tags[i];
|
||||||
jdwmconf->selected_tags[i] = jdwmconf->prev_selected_tags[i];
|
awesomeconf->selected_tags[i] = awesomeconf->prev_selected_tags[i];
|
||||||
jdwmconf->prev_selected_tags[i] = t;
|
awesomeconf->prev_selected_tags[i] = t;
|
||||||
}
|
}
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** View next tag
|
/** View next tag
|
||||||
|
@ -277,23 +277,23 @@ uicb_viewprevtags(Display * disp,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
uicb_tag_viewnext(Display *disp,
|
uicb_tag_viewnext(Display *disp,
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int firsttag = -1;
|
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;
|
firsttag = i;
|
||||||
jdwmconf->selected_tags[i] = False;
|
awesomeconf->selected_tags[i] = False;
|
||||||
}
|
}
|
||||||
if(++firsttag >= jdwmconf->ntags)
|
if(++firsttag >= awesomeconf->ntags)
|
||||||
firsttag = 0;
|
firsttag = 0;
|
||||||
jdwmconf->selected_tags[firsttag] = True;
|
awesomeconf->selected_tags[firsttag] = True;
|
||||||
savejdwmprops(disp, jdwmconf);
|
saveawesomeprops(disp, awesomeconf);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** View previous tag
|
/** View previous tag
|
||||||
|
@ -303,21 +303,21 @@ uicb_tag_viewnext(Display *disp,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
uicb_tag_viewprev(Display *disp,
|
uicb_tag_viewprev(Display *disp,
|
||||||
jdwm_config *jdwmconf,
|
awesome_config *awesomeconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int firsttag = -1;
|
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;
|
firsttag = i;
|
||||||
jdwmconf->selected_tags[i] = False;
|
awesomeconf->selected_tags[i] = False;
|
||||||
}
|
}
|
||||||
if(--firsttag < 0)
|
if(--firsttag < 0)
|
||||||
firsttag = jdwmconf->ntags - 1;
|
firsttag = awesomeconf->ntags - 1;
|
||||||
jdwmconf->selected_tags[firsttag] = True;
|
awesomeconf->selected_tags[firsttag] = True;
|
||||||
savejdwmprops(disp, jdwmconf);
|
saveawesomeprops(disp, awesomeconf);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
20
tag.h
20
tag.h
|
@ -9,17 +9,17 @@
|
||||||
/** Check if a client is tiled */
|
/** Check if a client is tiled */
|
||||||
#define IS_TILED(client, tags, ntags) (client && !client->isfloating && isvisible(client, tags, ntags))
|
#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);
|
Bool isvisible(Client *, Bool *, int);
|
||||||
void applyrules(Client * c, jdwm_config *); /* applies rules to c */
|
void applyrules(Client * c, awesome_config *); /* applies rules to c */
|
||||||
void uicb_tag(Display *, jdwm_config *, const char *); /* tags sel with arg's index */
|
void uicb_tag(Display *, awesome_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_togglefloating(Display *, awesome_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_toggletag(Display *, awesome_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_toggleview(Display *, awesome_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_view(Display *, awesome_config *, const char *); /* views the tag with arg's index */
|
||||||
void uicb_viewprevtags(Display *, jdwm_config *, const char *);
|
void uicb_viewprevtags(Display *, awesome_config *, const char *);
|
||||||
void uicb_tag_viewnext(Display *, jdwm_config *, const char *); /* view only tag just after the first selected */
|
void uicb_tag_viewnext(Display *, awesome_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 uicb_tag_viewprev(Display *, awesome_config *, const char *); /* view only tag just before the first selected */
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
4
util.c
4
util.c
|
@ -22,7 +22,7 @@ eprint(const char *fmt, ...)
|
||||||
|
|
||||||
void
|
void
|
||||||
spawn(Display * disp,
|
spawn(Display * disp,
|
||||||
jdwm_config * jdwmconf __attribute__ ((unused)),
|
awesome_config * awesomeconf __attribute__ ((unused)),
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
static char *shell = NULL;
|
static char *shell = NULL;
|
||||||
|
@ -41,7 +41,7 @@ spawn(Display * disp,
|
||||||
close(ConnectionNumber(disp));
|
close(ConnectionNumber(disp));
|
||||||
setsid();
|
setsid();
|
||||||
execl(shell, shell, "-c", arg, (char *) NULL);
|
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");
|
perror(" failed");
|
||||||
}
|
}
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
2
util.h
2
util.h
|
@ -61,6 +61,6 @@ xrealloc(void **ptr, ssize_t newsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
void eprint(const char *, ...) __attribute__ ((noreturn)) __attribute__ ((format(printf, 1, 2)));
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue