From 55f1c47e9ce807b9dff83a267cea1972154ce19c Mon Sep 17 00:00:00 2001 From: Shivesh Mandalia Date: Wed, 22 Sep 2021 17:41:24 +0100 Subject: Initial setup of tabbed - Link with a patched version of libXft that allows for coloured emojis - Configure keyboard shortcuts - Add gitignore file --- .gitignore | 4 ++++ config.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ config.mk | 16 +++++++++------ tabbed.1 | 22 ++------------------- 4 files changed, 83 insertions(+), 26 deletions(-) create mode 100644 .gitignore create mode 100644 config.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b1b45c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.o +tabbed +patches +xembed diff --git a/config.h b/config.h new file mode 100644 index 0000000..4c5a3d5 --- /dev/null +++ b/config.h @@ -0,0 +1,67 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const char font[] = "Liga Agave:size=12"; +static const char* normbgcolor = "#222222"; +static const char* normfgcolor = "#cccccc"; +static const char* selbgcolor = "#555555"; +static const char* selfgcolor = "#ffffff"; +static const char* urgbgcolor = "#111111"; +static const char* urgfgcolor = "#cc0000"; +static const char before[] = "<"; +static const char after[] = ">"; +static const char titletrim[] = "..."; +static const int tabwidth = 200; +static const Bool foreground = True; +static Bool urgentswitch = False; + +/* + * Where to place a new tab when it is opened. When npisrelative is True, + * then the current position is changed + newposition. If npisrelative + * is False, then newposition is an absolute position. + */ +static int newposition = 0; +static Bool npisrelative = False; + +#define SETPROP(p) { \ + .v = (char *[]){ "/bin/sh", "-c", \ + "prop=\"`xwininfo -children -id $1 | grep '^ 0x' |" \ + "sed -e's@^ *\\(0x[0-9a-f]*\\) \"\\([^\"]*\\)\".*@\\1 \\2@' |" \ + "xargs -0 printf %b | dmenu -l 10 -w $1`\" &&" \ + "xprop -id $1 -f $0 8s -set $0 \"$prop\"", \ + p, winid, NULL \ + } \ +} + +#define CTRLMODKEY ControlMask +#define ALTMODKEY Mod1Mask +static Key keys[] = { + /* modifier key function argument */ + { CTRLMODKEY|ShiftMask, XK_t, focusonce, { 0 } }, + { CTRLMODKEY|ShiftMask, XK_t, spawn, { 0 } }, + + // { CTRLMODKEY|ShiftMask, XK_l, rotate, { .i = +1 } }, + // { CTRLMODKEY|ShiftMask, XK_h, rotate, { .i = -1 } }, + { CTRLMODKEY|ShiftMask, XK_j, movetab, { .i = -1 } }, + { CTRLMODKEY|ShiftMask, XK_k, movetab, { .i = +1 } }, + // { CTRLMODKEY, XK_Tab, rotate, { .i = 0 } }, + + { CTRLMODKEY, XK_grave, spawn, SETPROP("_TABBED_SELECT_TAB") }, + { ALTMODKEY, XK_1, move, { .i = 0 } }, + { ALTMODKEY, XK_2, move, { .i = 1 } }, + { ALTMODKEY, XK_3, move, { .i = 2 } }, + { ALTMODKEY, XK_4, move, { .i = 3 } }, + { ALTMODKEY, XK_5, move, { .i = 4 } }, + { ALTMODKEY, XK_6, move, { .i = 5 } }, + { ALTMODKEY, XK_7, move, { .i = 6 } }, + { ALTMODKEY, XK_8, move, { .i = 7 } }, + { ALTMODKEY, XK_9, move, { .i = 8 } }, + { ALTMODKEY, XK_0, move, { .i = 9 } }, + + // { CTRLMODKEY, XK_q, killclient, { 0 } }, + + // { CTRLMODKEY, XK_u, focusurgent, { 0 } }, + // { CTRLMODKEY|ShiftMask, XK_u, toggle, { .v = (void*) &urgentswitch } }, + + { 0, XK_F11, fullscreen, { 0 } }, +}; diff --git a/config.mk b/config.mk index 29caa84..28bd80f 100644 --- a/config.mk +++ b/config.mk @@ -7,8 +7,12 @@ VERSION = 0.6 PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib +# Patched Xft with support for coloured emojis +# https://github.com/uditkarode/libxft-bgra +XftINC = /usr/local/include +XftLIB = /usr/local/lib +X11INC = /usr/include +X11LIB = /usr/lib # freetype FREETYPELIBS = -lfontconfig -lXft @@ -17,17 +21,17 @@ FREETYPEINC = /usr/include/freetype2 #FREETYPEINC = ${X11INC}/freetype2 # includes and libs -INCS = -I. -I/usr/include -I$(X11INC) -I${FREETYPEINC} -LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${FREETYPELIBS} +INCS = -I. -I$(XftINC) -I$(X11INC) -I${FREETYPEINC} +LIBS = -lc -L$(XftLIB) -L${X11LIB} -lX11 ${FREETYPELIBS} # flags CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} -LDFLAGS = -s ${LIBS} +LDFLAGS = -Wl,-rpath=$(XftLIB) -s ${LIBS} # Solaris #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" #LDFLAGS = ${LIBS} # compiler and linker -CC = cc +CC = tcc diff --git a/tabbed.1 b/tabbed.1 index 07bdbd7..1ad9336 100644 --- a/tabbed.1 +++ b/tabbed.1 @@ -110,38 +110,20 @@ defines the urgent foreground color. prints version information to stderr, then exits. .SH USAGE .TP -.B Ctrl\-Shift\-Return +.B Ctrl\-Shift\-T open new tab .TP -.B Ctrl\-Shift\-h -previous tab -.TP -.B Ctrl\-Shift\-l -next tab -.TP .B Ctrl\-Shift\-j move selected tab one to the left .TP .B Ctrl\-Shift\-k move selected tab one to the right .TP -.B Ctrl\-Shift\-u -toggle autofocus of urgent tabs -.TP -.B Ctrl\-Tab -toggle between the selected and last selected tab -.TP .B Ctrl\-` open dmenu to either create a new tab appending the entered string or select an already existing tab. .TP -.B Ctrl\-q -close tab -.TP -.B Ctrl\-u -focus next urgent tab -.TP -.B Ctrl\-[0..9] +.B Alt\-[0..9] jumps to nth tab .TP .B F11 -- cgit v1.2.3