Initial commit: Geminux 0.1.0 (helio) for Planet Computers Gemini PDA (MT6797X)
This commit is contained in:
commit
034c1f61b1
816 files changed
+223435
No files matched your search
@@ -0,0 +1,37 @@
|
||||
# Geminux dwm Makefile
|
||||
include config.mk
|
||||
|
||||
SRC = drw.c dwm.c util.c
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
all: options dwm
|
||||
|
||||
options:
|
||||
@echo dwm build options:
|
||||
@echo "CFLAGS = $(CFLAGS)"
|
||||
@echo "LDFLAGS = $(LDFLAGS)"
|
||||
@echo "CC = $(CC)"
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
$(OBJ): config.h config.mk drw.h util.h
|
||||
|
||||
config.h:
|
||||
cp config.def.h $@
|
||||
|
||||
dwm: $(OBJ)
|
||||
$(CC) -o $@ $(OBJ) $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f dwm $(OBJ) config.h
|
||||
|
||||
install: all
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f dwm $(DESTDIR)$(PREFIX)/bin/dwm
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwm
|
||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||
sed "s/VERSION/$(VERSION)/g" < dwm.1 > $(DESTDIR)$(MANPREFIX)/man1/dwm.1
|
||||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dwm.1
|
||||
|
||||
.PHONY: all options clean install
|
||||
@@ -0,0 +1,165 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
/* Geminux DWM configuration (Gemini PDA 2160x1080 HiDPI, Mod4 = Fn+Alt, systray, Pango) */
|
||||
#include <X11/XF86keysym.h>
|
||||
|
||||
/* appearance */
|
||||
static unsigned int borderpx = 3;
|
||||
static unsigned int snap = 24;
|
||||
static const int showbar = 1;
|
||||
static const int topbar = 1;
|
||||
static const unsigned int systraypinning = 0;
|
||||
static const unsigned int systrayonleft = 0;
|
||||
static const unsigned int systrayspacing = 6;
|
||||
static const int systraypinningfailfirst = 1;
|
||||
static const int showsystray = 1;
|
||||
static const char *font = "Fira Code, DejaVuSansM Nerd Font 20px";
|
||||
static char normbgcolor[64] = "#0b0e14";
|
||||
static char normbordercolor[64] = "#283444";
|
||||
static char normfgcolor[64] = "#e6e1cf";
|
||||
static char selbgcolor[64] = "#2b5278";
|
||||
static char selbordercolor[64] = "#59c2ff";
|
||||
static char selfgcolor[64] = "#ffffff";
|
||||
static char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "geminux-callscreen", NULL, NULL, ~0U, 0, -1 },
|
||||
{ "geminux-lock", NULL, NULL, ~0U, 1, -1 },
|
||||
{ "geminux-control", NULL, NULL, 0, 1, -1 },
|
||||
{ "geminux-themes", NULL, NULL, 0, 1, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
static const float mfact = 0.55;
|
||||
static const int nmaster = 1;
|
||||
static const int resizehints = 0;
|
||||
static const int lockfullscreen = 1;
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile },
|
||||
{ "[M]", monocle },
|
||||
{ "><>", NULL },
|
||||
{ "###", grid },
|
||||
};
|
||||
|
||||
/* key definitions: Mod4 = Fn+Alt (Super_L) on Gemini PDA keyboard */
|
||||
#define MODKEY Mod4Mask
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
/* commands */
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
static const char *launchercmd[] = { "geminux-launcher", NULL };
|
||||
static const char *controlcmd[] = { "geminux-control", NULL };
|
||||
static const char *dialercmd[] = { "geminux-dialer", NULL };
|
||||
static const char *smscmd[] = { "geminux-sms", NULL };
|
||||
static const char *netcmd[] = { "geminux-net", NULL };
|
||||
static const char *cameracmd[] = { "geminux-camera", NULL };
|
||||
static const char *themescmd[] = { "geminux-themes", NULL };
|
||||
static const char *lockcmd[] = { "geminux-lock", NULL };
|
||||
static const char *shotcmd[] = {
|
||||
"/bin/sh", "-c",
|
||||
"mkdir -p ~/Pictures && scrot ~/Pictures/screenshot-$(date +%Y%m%d-%H%M%S).png",
|
||||
NULL
|
||||
};
|
||||
static const char *briupcmd[] = { "brightnessctl", "set", "+10%", NULL };
|
||||
static const char *bridowncmd[] = { "brightnessctl", "set", "10%-", NULL };
|
||||
static const char *volupcmd[] = {
|
||||
"/bin/sh", "-c", "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+ && pkill -USR1 geminux-statusd || true", NULL
|
||||
};
|
||||
static const char *voldowncmd[] = {
|
||||
"/bin/sh", "-c", "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- && pkill -USR1 geminux-statusd || true", NULL
|
||||
};
|
||||
static const char *volmutecmd[] = {
|
||||
"/bin/sh", "-c", "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && pkill -USR1 geminux-statusd || true", NULL
|
||||
};
|
||||
|
||||
static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd} },
|
||||
{ MODKEY, XK_p, spawn, {.v = launchercmd} },
|
||||
{ 0, XK_Menu, spawn, {.v = launchercmd} },
|
||||
{ 0, XF86XK_MenuKB, spawn, {.v = launchercmd} },
|
||||
{ 0, XF86XK_Launch1, spawn, {.v = launchercmd} },
|
||||
{ MODKEY, XK_c, spawn, {.v = controlcmd} },
|
||||
{ MODKEY, XK_d, spawn, {.v = dialercmd} },
|
||||
{ MODKEY, XK_s, spawn, {.v = smscmd} },
|
||||
{ MODKEY, XK_n, spawn, {.v = netcmd} },
|
||||
{ MODKEY, XK_v, spawn, {.v = cameracmd} },
|
||||
{ MODKEY, XK_t, spawn, {.v = themescmd} },
|
||||
{ MODKEY|ShiftMask, XK_l, spawn, {.v = lockcmd} },
|
||||
{ 0, XF86XK_ScreenSaver, spawn, {.v = lockcmd} },
|
||||
{ 0, XK_Print, spawn, {.v = shotcmd} },
|
||||
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = briupcmd} },
|
||||
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = bridowncmd} },
|
||||
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = volupcmd} },
|
||||
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = voldowncmd} },
|
||||
{ 0, XF86XK_AudioMute, spawn, {.v = volmutecmd} },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1} },
|
||||
{ MODKEY, XK_Down, focusstack, {.i = +1} },
|
||||
{ MODKEY, XK_Up, focusstack, {.i = -1} },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1} },
|
||||
{ MODKEY, XK_o, incnmaster, {.i = -1} },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_space, zoom, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_q, killclient, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
{ MODKEY, XK_F1, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_F2, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_F3, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_F4, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_g, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0U} },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0U} },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1} },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1} },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1} },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1} },
|
||||
{ MODKEY|ShiftMask, XK_r, reloadxres, {0} },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
TAGKEYS( XK_4, 3)
|
||||
TAGKEYS( XK_5, 4)
|
||||
TAGKEYS( XK_6, 5)
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_q, quit, {0} },
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
static const Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLauncher, 0, Button1, spawn, {.v = launchercmd} },
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[1]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkCloseBtn, 0, Button1, killclient, {0} },
|
||||
{ ClkStatusText, 0, Button1, spawn, {.v = controlcmd} },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
};
|
||||
@@ -0,0 +1,165 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
/* Geminux DWM configuration (Gemini PDA 2160x1080 HiDPI, Mod4 = Fn+Alt, systray, Pango) */
|
||||
#include <X11/XF86keysym.h>
|
||||
|
||||
/* appearance */
|
||||
static unsigned int borderpx = 3;
|
||||
static unsigned int snap = 24;
|
||||
static const int showbar = 1;
|
||||
static const int topbar = 1;
|
||||
static const unsigned int systraypinning = 0;
|
||||
static const unsigned int systrayonleft = 0;
|
||||
static const unsigned int systrayspacing = 6;
|
||||
static const int systraypinningfailfirst = 1;
|
||||
static const int showsystray = 1;
|
||||
static const char *font = "Fira Code, DejaVuSansM Nerd Font 20px";
|
||||
static char normbgcolor[64] = "#0b0e14";
|
||||
static char normbordercolor[64] = "#283444";
|
||||
static char normfgcolor[64] = "#e6e1cf";
|
||||
static char selbgcolor[64] = "#2b5278";
|
||||
static char selbordercolor[64] = "#59c2ff";
|
||||
static char selfgcolor[64] = "#ffffff";
|
||||
static char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "geminux-callscreen", NULL, NULL, ~0U, 0, -1 },
|
||||
{ "geminux-lock", NULL, NULL, ~0U, 1, -1 },
|
||||
{ "geminux-control", NULL, NULL, 0, 1, -1 },
|
||||
{ "geminux-themes", NULL, NULL, 0, 1, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
static const float mfact = 0.55;
|
||||
static const int nmaster = 1;
|
||||
static const int resizehints = 0;
|
||||
static const int lockfullscreen = 1;
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile },
|
||||
{ "[M]", monocle },
|
||||
{ "><>", NULL },
|
||||
{ "###", grid },
|
||||
};
|
||||
|
||||
/* key definitions: Mod4 = Fn+Alt (Super_L) on Gemini PDA keyboard */
|
||||
#define MODKEY Mod4Mask
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
/* commands */
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
static const char *launchercmd[] = { "geminux-launcher", NULL };
|
||||
static const char *controlcmd[] = { "geminux-control", NULL };
|
||||
static const char *dialercmd[] = { "geminux-dialer", NULL };
|
||||
static const char *smscmd[] = { "geminux-sms", NULL };
|
||||
static const char *netcmd[] = { "geminux-net", NULL };
|
||||
static const char *cameracmd[] = { "geminux-camera", NULL };
|
||||
static const char *themescmd[] = { "geminux-themes", NULL };
|
||||
static const char *lockcmd[] = { "geminux-lock", NULL };
|
||||
static const char *shotcmd[] = {
|
||||
"/bin/sh", "-c",
|
||||
"mkdir -p ~/Pictures && scrot ~/Pictures/screenshot-$(date +%Y%m%d-%H%M%S).png",
|
||||
NULL
|
||||
};
|
||||
static const char *briupcmd[] = { "brightnessctl", "set", "+10%", NULL };
|
||||
static const char *bridowncmd[] = { "brightnessctl", "set", "10%-", NULL };
|
||||
static const char *volupcmd[] = {
|
||||
"/bin/sh", "-c", "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+ && pkill -USR1 geminux-statusd || true", NULL
|
||||
};
|
||||
static const char *voldowncmd[] = {
|
||||
"/bin/sh", "-c", "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- && pkill -USR1 geminux-statusd || true", NULL
|
||||
};
|
||||
static const char *volmutecmd[] = {
|
||||
"/bin/sh", "-c", "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && pkill -USR1 geminux-statusd || true", NULL
|
||||
};
|
||||
|
||||
static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd} },
|
||||
{ MODKEY, XK_p, spawn, {.v = launchercmd} },
|
||||
{ 0, XK_Menu, spawn, {.v = launchercmd} },
|
||||
{ 0, XF86XK_MenuKB, spawn, {.v = launchercmd} },
|
||||
{ 0, XF86XK_Launch1, spawn, {.v = launchercmd} },
|
||||
{ MODKEY, XK_c, spawn, {.v = controlcmd} },
|
||||
{ MODKEY, XK_d, spawn, {.v = dialercmd} },
|
||||
{ MODKEY, XK_s, spawn, {.v = smscmd} },
|
||||
{ MODKEY, XK_n, spawn, {.v = netcmd} },
|
||||
{ MODKEY, XK_v, spawn, {.v = cameracmd} },
|
||||
{ MODKEY, XK_t, spawn, {.v = themescmd} },
|
||||
{ MODKEY|ShiftMask, XK_l, spawn, {.v = lockcmd} },
|
||||
{ 0, XF86XK_ScreenSaver, spawn, {.v = lockcmd} },
|
||||
{ 0, XK_Print, spawn, {.v = shotcmd} },
|
||||
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = briupcmd} },
|
||||
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = bridowncmd} },
|
||||
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = volupcmd} },
|
||||
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = voldowncmd} },
|
||||
{ 0, XF86XK_AudioMute, spawn, {.v = volmutecmd} },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1} },
|
||||
{ MODKEY, XK_Down, focusstack, {.i = +1} },
|
||||
{ MODKEY, XK_Up, focusstack, {.i = -1} },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1} },
|
||||
{ MODKEY, XK_o, incnmaster, {.i = -1} },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_space, zoom, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_q, killclient, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
{ MODKEY, XK_F1, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_F2, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_F3, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_F4, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_g, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0U} },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0U} },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1} },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1} },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1} },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1} },
|
||||
{ MODKEY|ShiftMask, XK_r, reloadxres, {0} },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
TAGKEYS( XK_4, 3)
|
||||
TAGKEYS( XK_5, 4)
|
||||
TAGKEYS( XK_6, 5)
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_q, quit, {0} },
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
static const Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLauncher, 0, Button1, spawn, {.v = launchercmd} },
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[1]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkCloseBtn, 0, Button1, killclient, {0} },
|
||||
{ ClkStatusText, 0, Button1, spawn, {.v = controlcmd} },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
# Geminux dwm build configuration (Pango + HarfBuzz + systray + .Xresources + Xinerama)
|
||||
VERSION = 6.5-geminux
|
||||
|
||||
PREFIX = /usr
|
||||
MANPREFIX = $(PREFIX)/share/man
|
||||
|
||||
PKG_CONFIG ?= pkg-config
|
||||
|
||||
INCS = $(shell $(PKG_CONFIG) --cflags fontconfig freetype2 xft pango pangoxft harfbuzz x11 xinerama)
|
||||
LIBS = $(shell $(PKG_CONFIG) --libs fontconfig freetype2 xft pango pangoxft harfbuzz x11 xinerama)
|
||||
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" -DXINERAMA
|
||||
CFLAGS = -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -O2 $(INCS) $(CPPFLAGS)
|
||||
LDFLAGS = $(LIBS)
|
||||
|
||||
CC ?= cc
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
/* Pango + HarfBuzz + Xft drawing backend for Geminux DWM */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
#include <pango/pango.h>
|
||||
#include <pango/pangoxft.h>
|
||||
|
||||
#include "drw.h"
|
||||
#include "util.h"
|
||||
|
||||
Drw *drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) {
|
||||
Drw *drw = ecalloc(1, sizeof(Drw));
|
||||
drw->dpy = dpy;
|
||||
drw->screen = screen;
|
||||
drw->root = root;
|
||||
drw->w = w;
|
||||
drw->h = h;
|
||||
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
|
||||
drw->gc = XCreateGC(dpy, root, 0, NULL);
|
||||
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||
return drw;
|
||||
}
|
||||
|
||||
void drw_resize(Drw *drw, unsigned int w, unsigned int h) {
|
||||
if (!drw) return;
|
||||
drw->w = w;
|
||||
drw->h = h;
|
||||
if (drw->drawable)
|
||||
XFreePixmap(drw->dpy, drw->drawable);
|
||||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
||||
}
|
||||
|
||||
void drw_free(Drw *drw) {
|
||||
if (!drw) return;
|
||||
if (drw->drawable)
|
||||
XFreePixmap(drw->dpy, drw->drawable);
|
||||
if (drw->gc)
|
||||
XFreeGC(drw->dpy, drw->gc);
|
||||
drw_font_free(drw->font);
|
||||
free(drw);
|
||||
}
|
||||
|
||||
Fnt *drw_font_create(Drw *drw, const char font[]) {
|
||||
Fnt *fnt = ecalloc(1, sizeof(Fnt));
|
||||
PangoFontMetrics *metrics;
|
||||
|
||||
fnt->dpy = drw->dpy;
|
||||
fnt->fontmap = pango_xft_get_font_map(drw->dpy, drw->screen);
|
||||
fnt->context = pango_font_map_create_context(fnt->fontmap);
|
||||
fnt->desc = pango_font_description_from_string(font && font[0] ? font : "Fira Code 18px");
|
||||
pango_context_set_font_description(fnt->context, fnt->desc);
|
||||
|
||||
metrics = pango_context_get_metrics(fnt->context, fnt->desc, pango_language_get_default());
|
||||
fnt->h = (unsigned int)((pango_font_metrics_get_ascent(metrics) +
|
||||
pango_font_metrics_get_descent(metrics)) / PANGO_SCALE);
|
||||
if (fnt->h < 12) fnt->h = 18;
|
||||
pango_font_metrics_unref(metrics);
|
||||
|
||||
fnt->layout = pango_layout_new(fnt->context);
|
||||
pango_layout_set_font_description(fnt->layout, fnt->desc);
|
||||
return fnt;
|
||||
}
|
||||
|
||||
void drw_font_free(Fnt *font) {
|
||||
if (!font) return;
|
||||
if (font->layout) g_object_unref(font->layout);
|
||||
if (font->context) g_object_unref(font->context);
|
||||
if (font->desc) pango_font_description_free(font->desc);
|
||||
free(font);
|
||||
}
|
||||
|
||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname) {
|
||||
if (!drw || !dest || !clrname) return;
|
||||
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
||||
DefaultColormap(drw->dpy, drw->screen), clrname, dest)) {
|
||||
fprintf(stderr, "dwm: warning: cannot allocate color '%s', using #ffffff\n", clrname);
|
||||
XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
||||
DefaultColormap(drw->dpy, drw->screen), "#ffffff", dest);
|
||||
}
|
||||
}
|
||||
|
||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) {
|
||||
Clr *ret;
|
||||
if (!drw || !clrnames || clrcount == 0) return NULL;
|
||||
ret = ecalloc(clrcount, sizeof(XftColor));
|
||||
for (size_t i = 0; i < clrcount; i++)
|
||||
drw_clr_create(drw, &ret[i], clrnames[i]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void drw_setfont(Drw *drw, Fnt *font) {
|
||||
if (drw) drw->font = font;
|
||||
}
|
||||
|
||||
void drw_setscheme(Drw *drw, Clr *scm) {
|
||||
if (drw) drw->scheme = scm;
|
||||
}
|
||||
|
||||
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert) {
|
||||
if (!drw || !drw->scheme) return;
|
||||
XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
|
||||
if (filled)
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||
else
|
||||
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
|
||||
}
|
||||
|
||||
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h,
|
||||
unsigned int lpad, const char *text, int invert, Bool markup) {
|
||||
char buf[1024];
|
||||
int ty, render = x || y || w || h;
|
||||
unsigned int ew, eh;
|
||||
XftDraw *d = NULL;
|
||||
|
||||
if (!drw || (render && !drw->scheme) || !text || !drw->font)
|
||||
return 0;
|
||||
|
||||
if (!render) {
|
||||
w = ~0;
|
||||
} else {
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||
d = XftDrawCreate(drw->dpy, drw->drawable,
|
||||
DefaultVisual(drw->dpy, drw->screen),
|
||||
DefaultColormap(drw->dpy, drw->screen));
|
||||
x += (int)lpad;
|
||||
if (w > lpad) w -= lpad;
|
||||
}
|
||||
|
||||
size_t len = strlen(text);
|
||||
if (len >= sizeof(buf)) len = sizeof(buf) - 1;
|
||||
memcpy(buf, text, len);
|
||||
buf[len] = '\0';
|
||||
|
||||
if (len > 0 && w > 0) {
|
||||
drw_font_getexts(drw->font, buf, (unsigned int)len, &ew, &eh, markup);
|
||||
while (len > 3 && ew > w) {
|
||||
len--;
|
||||
while (len > 0 && (buf[len] & 0xc0) == 0x80) len--;
|
||||
if (len >= 3) memcpy(buf + len - 3, "...", 3);
|
||||
buf[len] = '\0';
|
||||
drw_font_getexts(drw->font, buf, (unsigned int)len, &ew, &eh, markup);
|
||||
}
|
||||
|
||||
if (render && d) {
|
||||
if (markup)
|
||||
pango_layout_set_markup(drw->font->layout, buf, -1);
|
||||
else
|
||||
pango_layout_set_text(drw->font->layout, buf, -1);
|
||||
ty = y + (int)(h - eh) / 2;
|
||||
if (ty < y) ty = y;
|
||||
pango_xft_render_layout(d, &drw->scheme[invert ? ColBg : ColFg],
|
||||
drw->font->layout, x * PANGO_SCALE, ty * PANGO_SCALE);
|
||||
if (markup)
|
||||
pango_layout_set_attributes(drw->font->layout, NULL);
|
||||
}
|
||||
x += (int)ew;
|
||||
}
|
||||
|
||||
if (d) XftDrawDestroy(d);
|
||||
return x + (render ? (int)w : 0);
|
||||
}
|
||||
|
||||
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) {
|
||||
if (!drw) return;
|
||||
XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y);
|
||||
XSync(drw->dpy, False);
|
||||
}
|
||||
|
||||
unsigned int drw_font_getwidth(Drw *drw, const char *text, Bool markup) {
|
||||
unsigned int w = 0, h = 0;
|
||||
if (!drw || !drw->font || !text || !text[0]) return 0;
|
||||
drw_font_getexts(drw->font, text, (unsigned int)strlen(text), &w, &h, markup);
|
||||
return w;
|
||||
}
|
||||
|
||||
void drw_font_getexts(Fnt *font, const char *text, unsigned int len,
|
||||
unsigned int *w, unsigned int *h, Bool markup) {
|
||||
PangoRectangle r;
|
||||
if (!font || !text) {
|
||||
if (w) *w = 0;
|
||||
if (h) *h = 0;
|
||||
return;
|
||||
}
|
||||
if (markup)
|
||||
pango_layout_set_markup(font->layout, text, (int)len);
|
||||
else
|
||||
pango_layout_set_text(font->layout, text, (int)len);
|
||||
pango_layout_get_extents(font->layout, NULL, &r);
|
||||
if (markup)
|
||||
pango_layout_set_attributes(font->layout, NULL);
|
||||
if (w) *w = (unsigned int)((r.width + PANGO_SCALE - 1) / PANGO_SCALE);
|
||||
if (h) *h = (unsigned int)((r.height + PANGO_SCALE - 1) / PANGO_SCALE);
|
||||
if (h && *h == 0) *h = font->h;
|
||||
}
|
||||
|
||||
Cur *drw_cur_create(Drw *drw, int shape) {
|
||||
Cur *cur;
|
||||
if (!drw) return NULL;
|
||||
cur = ecalloc(1, sizeof(Cur));
|
||||
cur->cursor = XCreateFontCursor(drw->dpy, shape);
|
||||
return cur;
|
||||
}
|
||||
|
||||
void drw_cur_free(Drw *drw, Cur *cursor) {
|
||||
if (!cursor) return;
|
||||
if (drw) XFreeCursor(drw->dpy, cursor->cursor);
|
||||
free(cursor);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#ifndef DWM_DRW_H
|
||||
#define DWM_DRW_H
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
#include <pango/pango.h>
|
||||
#include <pango/pangoxft.h>
|
||||
|
||||
typedef struct {
|
||||
Cursor cursor;
|
||||
} Cur;
|
||||
|
||||
typedef struct Fnt {
|
||||
Display *dpy;
|
||||
unsigned int h;
|
||||
PangoLayout *layout;
|
||||
PangoFontMap *fontmap;
|
||||
PangoContext *context;
|
||||
PangoFontDescription *desc;
|
||||
} Fnt;
|
||||
|
||||
enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */
|
||||
typedef XftColor Clr;
|
||||
|
||||
typedef struct {
|
||||
unsigned int w, h;
|
||||
Display *dpy;
|
||||
int screen;
|
||||
Window root;
|
||||
Drawable drawable;
|
||||
GC gc;
|
||||
Clr *scheme;
|
||||
Fnt *font;
|
||||
} Drw;
|
||||
|
||||
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
|
||||
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
|
||||
void drw_free(Drw *drw);
|
||||
|
||||
Fnt *drw_font_create(Drw *drw, const char font[]);
|
||||
void drw_font_free(Fnt *font);
|
||||
unsigned int drw_font_getwidth(Drw *drw, const char *text, Bool markup);
|
||||
void drw_font_getexts(Fnt *font, const char *text, unsigned int len,
|
||||
unsigned int *w, unsigned int *h, Bool markup);
|
||||
|
||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
||||
|
||||
Cur *drw_cur_create(Drw *drw, int shape);
|
||||
void drw_cur_free(Drw *drw, Cur *cursor);
|
||||
|
||||
void drw_setscheme(Drw *drw, Clr *scm);
|
||||
void drw_setfont(Drw *drw, Fnt *font);
|
||||
|
||||
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
|
||||
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h,
|
||||
unsigned int lpad, const char *text, int invert, Bool markup);
|
||||
|
||||
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
|
||||
|
||||
#endif
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
.TH DWM 1 dwm\-VERSION
|
||||
.SH NAME
|
||||
dwm \- dynamic window manager
|
||||
.SH SYNOPSIS
|
||||
.B dwm
|
||||
.RB [ \-v ]
|
||||
.SH DESCRIPTION
|
||||
dwm is a dynamic window manager for X. It manages windows in tiled, monocle
|
||||
and floating layouts. Either layout can be applied dynamically, optimising the
|
||||
environment for the application in use and the task performed.
|
||||
.P
|
||||
In tiled layouts windows are managed in a master and stacking area. The master
|
||||
area on the left contains one window by default, and the stacking area on the
|
||||
right contains all other windows. The number of master area windows can be
|
||||
adjusted from zero to an arbitrary number. In monocle layout all windows are
|
||||
maximised to the screen size. In floating layout windows can be resized and
|
||||
moved freely. Dialog windows are always managed floating, regardless of the
|
||||
layout applied.
|
||||
.P
|
||||
Windows are grouped by tags. Each window can be tagged with one or multiple
|
||||
tags. Selecting certain tags displays all windows with these tags.
|
||||
.P
|
||||
Each screen contains a small status bar which displays all available tags, the
|
||||
layout, the title of the focused window, and the text read from the root window
|
||||
name property, if the screen is focused. A floating window is indicated with an
|
||||
empty square and a maximised floating window is indicated with a filled square
|
||||
before the windows title. The selected tags are indicated with a different
|
||||
color. The tags of the focused window are indicated with a filled square in the
|
||||
top left corner. The tags which are applied to one or more windows are
|
||||
indicated with an empty square in the top left corner.
|
||||
.P
|
||||
The attach below patch makes newly spawned windows attach after the currently
|
||||
selected window
|
||||
.P
|
||||
dwm draws a small border around windows to indicate the focus state.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
prints version information to standard output, then exits.
|
||||
.SH USAGE
|
||||
.SS Status bar
|
||||
.TP
|
||||
.B X root window name
|
||||
is read and displayed in the status text area. It can be set with the
|
||||
.BR xsetroot (1)
|
||||
command.
|
||||
.TP
|
||||
.B Button1
|
||||
click on a tag label to display all windows with that tag, click on the layout
|
||||
label toggles between tiled and floating layout.
|
||||
.TP
|
||||
.B Button3
|
||||
click on a tag label adds/removes all windows with that tag to/from the view.
|
||||
.TP
|
||||
.B Mod4\-Button1
|
||||
click on a tag label applies that tag to the focused window.
|
||||
.TP
|
||||
.B Mod4\-Button3
|
||||
click on a tag label adds/removes that tag to/from the focused window.
|
||||
.SS Keyboard commands
|
||||
.TP
|
||||
.B Mod4\-Shift\-Return
|
||||
Start
|
||||
.BR st(1).
|
||||
.TP
|
||||
.B Mod4\-p
|
||||
Spawn
|
||||
.BR dmenu(1)
|
||||
for launching other programs.
|
||||
.TP
|
||||
.B Mod4\-,
|
||||
Focus previous screen, if any.
|
||||
.TP
|
||||
.B Mod4\-.
|
||||
Focus next screen, if any.
|
||||
.TP
|
||||
.B Mod4\-Shift\-,
|
||||
Send focused window to previous screen, if any.
|
||||
.TP
|
||||
.B Mod4\-Shift\-.
|
||||
Send focused window to next screen, if any.
|
||||
.TP
|
||||
.B Mod4\-b
|
||||
Toggles bar on and off.
|
||||
.TP
|
||||
.B Mod4\-t
|
||||
Sets tiled layout.
|
||||
.TP
|
||||
.B Mod4\-f
|
||||
Sets floating layout.
|
||||
.TP
|
||||
.B Mod4\-m
|
||||
Sets monocle layout.
|
||||
.TP
|
||||
.B Mod4\-space
|
||||
Toggles between current and previous layout.
|
||||
.TP
|
||||
.B Mod4\-Control\-,
|
||||
Cycles backwards in layout list.
|
||||
.TP
|
||||
.B Mod4\-Control\-.
|
||||
Cycles forwards in layout list.
|
||||
.TP
|
||||
.B Mod4\-j
|
||||
Focus next window.
|
||||
.TP
|
||||
.B Mod4\-k
|
||||
Focus previous window.
|
||||
.TP
|
||||
.B Mod4\-i
|
||||
Increase number of windows in master area.
|
||||
.TP
|
||||
.B Mod4\-d
|
||||
Decrease number of windows in master area.
|
||||
.TP
|
||||
.B Mod4\-l
|
||||
Increase master area size.
|
||||
.TP
|
||||
.B Mod4\-h
|
||||
Decrease master area size.
|
||||
.TP
|
||||
.B Mod4\-Return
|
||||
Zooms/cycles focused window to/from master area (tiled layouts only).
|
||||
.TP
|
||||
.B Mod4\-Shift\-c
|
||||
Close focused window.
|
||||
.TP
|
||||
.B Mod4\-Shift\-space
|
||||
Toggle focused window between tiled and floating state.
|
||||
.TP
|
||||
.B Mod4\-Tab
|
||||
Toggles to the previously selected tags.
|
||||
.TP
|
||||
.B Mod4\-Shift\-[1..n]
|
||||
Apply nth tag to focused window.
|
||||
.TP
|
||||
.B Mod4\-Shift\-0
|
||||
Apply all tags to focused window.
|
||||
.TP
|
||||
.B Mod4\-Control\-Shift\-[1..n]
|
||||
Add/remove nth tag to/from focused window.
|
||||
.TP
|
||||
.B Mod4\-[1..n]
|
||||
View all windows with nth tag.
|
||||
.TP
|
||||
.B Mod4\-0
|
||||
View all windows with any tag.
|
||||
.TP
|
||||
.B Mod4\-Control\-[1..n]
|
||||
Add/remove all windows with nth tag to/from the view.
|
||||
.TP
|
||||
.B Mod4\-Shift\-q
|
||||
Quit dwm.
|
||||
.SS Mouse commands
|
||||
.TP
|
||||
.B Mod4\-Button1
|
||||
Move focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||
.TP
|
||||
.B Mod4\-Button2
|
||||
Toggles focused window between floating and tiled state.
|
||||
.TP
|
||||
.B Mod4\-Button3
|
||||
Resize focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||
.SH CUSTOMIZATION
|
||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||
code, or by setting X resources.
|
||||
.P
|
||||
The following X resource settings can be set:
|
||||
.TP
|
||||
.BI dwm.font
|
||||
defines the font or font set used.
|
||||
.TP
|
||||
.BI dwm.background
|
||||
defines the normal background color.
|
||||
.IR #RGB ,
|
||||
.IR #RRGGBB ,
|
||||
and X color names are supported.
|
||||
.TP
|
||||
.BI dwm.border
|
||||
defines the normal border color
|
||||
.TP
|
||||
.BI dwm.selbackground
|
||||
defines the selected background color
|
||||
.TP
|
||||
.BI dwm.selforeground
|
||||
defines the selected foreground color
|
||||
.TP
|
||||
.BI dwm.selborder
|
||||
defines the selected border color
|
||||
.TP
|
||||
.BI dwm.tabactivebackground
|
||||
defines the background color for active tabs
|
||||
.TP
|
||||
.BI dwm.tabactiveforeground
|
||||
defines the foreground color for active tabs
|
||||
.TP
|
||||
.BI dwm.tabactiveborder
|
||||
defines the border color for active tabs
|
||||
.TP
|
||||
.BI dwm.tabinactivebackground
|
||||
defines the background color for inactive tabs
|
||||
.TP
|
||||
.BI dwm.tabinactiveforeground
|
||||
defines the foreground color for inactive tabs
|
||||
.TP
|
||||
.BI dwm.tabinactiveborder
|
||||
defines the border color for inactive tabs
|
||||
.SH SEE ALSO
|
||||
.BR dmenu (1),
|
||||
.BR st (1)
|
||||
.SH ISSUES
|
||||
Java applications which use the XToolkit/XAWT backend may draw grey windows
|
||||
only. The XToolkit/XAWT backend breaks ICCCM-compliance in recent JDK 1.5 and early
|
||||
JDK 1.6 versions, because it assumes a reparenting window manager. Possible workarounds
|
||||
are using JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or setting the
|
||||
environment variable
|
||||
.BR AWT_TOOLKIT=MToolkit
|
||||
(to use the older Motif backend instead) or running
|
||||
.B xprop -root -f _NET_WM_NAME 32a -set _NET_WM_NAME LG3D
|
||||
or
|
||||
.B wmname LG3D
|
||||
(to pretend that a non-reparenting window manager is running that the
|
||||
XToolkit/XAWT backend can recognize) or when using OpenJDK setting the environment variable
|
||||
.BR _JAVA_AWT_WM_NONREPARENTING=1 .
|
||||
.SH BUGS
|
||||
Send all bug reports with a patch to hackers@suckless.org.
|
||||
+2331
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,42 @@
|
||||
/* cc transient.c -o transient -lX11 */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
int main(void) {
|
||||
Display *d;
|
||||
Window r, f, t = None;
|
||||
XSizeHints h;
|
||||
XEvent e;
|
||||
|
||||
d = XOpenDisplay(NULL);
|
||||
if (!d)
|
||||
exit(1);
|
||||
r = DefaultRootWindow(d);
|
||||
|
||||
f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
|
||||
h.min_width = h.max_width = h.min_height = h.max_height = 400;
|
||||
h.flags = PMinSize | PMaxSize;
|
||||
XSetWMNormalHints(d, f, &h);
|
||||
XStoreName(d, f, "floating");
|
||||
XMapWindow(d, f);
|
||||
|
||||
XSelectInput(d, f, ExposureMask);
|
||||
while (1) {
|
||||
XNextEvent(d, &e);
|
||||
|
||||
if (t == None) {
|
||||
sleep(5);
|
||||
t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
|
||||
XSetTransientForHint(d, t, f);
|
||||
XStoreName(d, t, "transient");
|
||||
XMapWindow(d, t);
|
||||
XSelectInput(d, t, ExposureMask);
|
||||
}
|
||||
}
|
||||
|
||||
XCloseDisplay(d);
|
||||
exit(0);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
void *
|
||||
ecalloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if (!(p = calloc(nmemb, size)))
|
||||
die("calloc:");
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
die(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
|
||||
fputc(' ', stderr);
|
||||
perror(NULL);
|
||||
} else {
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
||||
#endif
|
||||
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
|
||||
|
||||
void die(const char *fmt, ...);
|
||||
void *ecalloc(size_t nmemb, size_t size);
|
||||
Reference in new issue
Block a user