t* dwm + patches URI git clone git://git.codevoid.de/dwm-sdk DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit e855cee56205d8e87f98de64c2f38d6ca3b56ba8 DIR parent d55d667e8407d99cdedb7477ecca04da988d518b URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de> Date: Tue, 21 Aug 2018 23:28:23 +0200 Unpatch broken selfrestart, update font, scratchpad... Diffstat: M config.h | 17 ++++++++++------- D selfrestart.c | 78 ------------------------------- 2 files changed, 10 insertions(+), 85 deletions(-) --- DIR diff --git a/config.h b/config.h t@@ -10,8 +10,10 @@ static const int showsystray = 1; /* 0 means no systray */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "Terminus:size=9:embeddedbitmap=true" }; -static const char dmenufont[] = "Terminus:size=9:embeddedbitmap=true"; +//static const char *fonts[] = { "Terminus:size=9:embeddedbitmap=true" }; +//static const char dmenufont[] = "Terminus:size=9:embeddedbitmap=true"; +static const char *fonts[] = { "Fira Mono:pixelsize=20" }; +static const char dmenufont[] = "Fira Mono:pixelsize=20"; static const char col_vdark[] = "#111111"; static const char col_dark[] = "#333333"; t@@ -77,9 +79,12 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *termcmd[] = { "st", NULL }; static const char *mailcmd[] = { "st", "-e", "mutt", NULL }; -static const char *bigtermcmd[] = { "st", "-f Terminus:size=18:embeddedbitmap=true", NULL }; +static const char *bigtermcmd[] = { "st", "-f", "Fira Mono:pixelsize=26", NULL }; + static const char scratchpadname[] = "scratchpad"; -static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "180x51", NULL }; +static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "135x34", NULL }; +static const char *bigscratchpadcmd[] = { "st-lc", "-f", "Fira Mono:pixelsize=26", "-t", scratchpadname, "-g", "100x30", "sacc","codevoid.de", NULL }; + static const char *browsercmd[] = { ".dwm/browser", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *passmenucmd[] = { ".dwm/passmenu", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *browserpaste[] = { ".dwm/browserpaste", NULL }; t@@ -87,8 +92,6 @@ static const char *notescmd[] = { "st", "-e", "vim", "Seafile/NotesSync/not static const char *volumeupcmd[] = { ".dwm/mixer", "+2", NULL }; static const char *volumedowncmd[] = { ".dwm/mixer", "-2", NULL }; -#include "selfrestart.c" - static Key keys[] = { /* modifier key function argument */ // application launcher t@@ -99,6 +102,7 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_p, spawn, {.v = passmenucmd } }, { MODKEY|ShiftMask, XK_m, spawn, {.v = mailcmd } }, { MODKEY, XK_minus, togglescratch, {.v = scratchpadcmd } }, + { MODKEY|ShiftMask, XK_minus, togglescratch, {.v = bigscratchpadcmd } }, { 0, 0x1008ff13,spawn, {.v = volumeupcmd } }, { 0, 0x1008ff11,spawn, {.v = volumedowncmd } }, { MODKEY, XK_p, spawn, {.v = browserpaste } }, t@@ -148,7 +152,6 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_Home, self_restart, {0} }, { MODKEY|ShiftMask, XK_End, quit, {0} }, // /* Media keys */ DIR diff --git a/selfrestart.c b/selfrestart.c t@@ -1,78 +0,0 @@ -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/sysctl.h> -#include <stdio.h> -#include <stdlib.h> - -/** - * Magically finds the current's executable path - * - * I'm doing the do{}while(); trick because Linux (what I'm running) is not - * POSIX compilant and so lstat() cannot be trusted on /proc entries - * - * @return char* the path of the current executable - */ -char *get_dwm_path(){ - char *path = NULL; -#ifdef __FreeBSD__ - int mib[4]; - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PATHNAME; - mib[3] = -1; - char buf[1024]; - size_t cb = sizeof(buf); - sysctl(mib, 4, buf, &cb, NULL, 0); - path = buf; - return path; -#else - struct stat s; - int r, length, rate = 42; - - if(lstat("/proc/self/exe", &s) == -1){ - perror("lstat:"); - return NULL; - } - - length = s.st_size + 1 - rate; - - do{ - length+=rate; - - free(path); - path = malloc(sizeof(char) * length); - - if(path == NULL){ - perror("malloc:"); - return NULL; - } - - r = readlink("/proc/self/exe", path, length); - - if(r == -1){ - perror("readlink:"); - return NULL; - } - }while(r >= length); - - path[r] = '\0'; - return path; -#endif -} - -/** - * self-restart - * - * Initially inspired by: Yu-Jie Lin - * https://sites.google.com/site/yjlnotes/notes/dwm - */ -void self_restart(const Arg *arg) { - char *const argv[] = {get_dwm_path(), NULL}; - - if(argv[0] == NULL){ - return; - } - - execv(argv[0], argv); -}