1
0
Fork 0
mirror of https://gitlab.com/dwt1/dotfiles.git synced 2023-02-13 20:55:19 -05:00

Updating the suckless builds.

This commit is contained in:
Derek Taylor 2019-02-12 12:08:05 -06:00
parent fcdf31b890
commit 09aa764012
4 changed files with 313 additions and 0 deletions

76
dmenu/dmenu-lineheight-4.7.diff Executable file
View file

@ -0,0 +1,76 @@
diff --git a/config.def.h b/config.def.h
index a9122f7..6d936b7 100644
--- a/config.def.h
+++ b/config.def.h
@@ -16,4 +16,5 @@
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
static unsigned int lines = 0;
+static unsigned int lineheight = 0; /* -h option; minimum height of a menu line */
/*
diff --git a/dmenu.1 b/dmenu.1
index d3ab805..9fe4434 100644
--- a/dmenu.1
+++ b/dmenu.1
@@ -50,6 +50,9 @@ dmenu matches menu items case insensitively.
.BI \-l " lines"
dmenu lists items vertically, with the given number of lines.
.TP
+.BI \-h " height"
+dmenu uses a menu line of at least 'height' pixels tall, but no less than 8.
+.TP
.BI \-m " monitor"
dmenu is displayed on the monitor number supplied. Monitor numbers are starting
from 0.
diff --git a/dmenu.c b/dmenu.c
index a07f8e3..25832a7 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -130,7 +130,7 @@ drawmenu(void)
{
unsigned int curpos;
struct item *item;
- int x = 0, y = 0, w;
+ int x = 0, y = 0, fh = drw->fonts->h, w;
drw_setscheme(drw, scheme[SchemeNorm]);
drw_rect(drw, 0, 0, mw, mh, 1, 1);
@@ -145,9 +145,9 @@ drawmenu(void)
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
drw_font_getexts(drw->fonts, text, cursor, &curpos, NULL);
if ((curpos += lrpad / 2 - 1) < w) {
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
+ drw_rect(drw, x + curpos, 2 + (bh-fh)/2, 2, fh - 4, 1, 0);
}
if (lines > 0) {
@@ -676,7 +676,8 @@ setup(void)
utf8 = XInternAtom(dpy, "UTF8_STRING", False);
/* calculate menu geometry */
bh = drw->fonts->h + 2;
+ bh = MAX(bh,lineheight); /* make a menu line AT LEAST 'lineheight' tall */
lines = MAX(lines, 0);
mh = (lines + 1) * bh;
#ifdef XINERAMA
@@ -754,6 +755,7 @@ setup(void)
usage(void)
{
fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
+ " [-h height]\n"
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
exit(1);
}
@@ -787,6 +789,10 @@ main(int argc, char *argv[])
prompt = argv[++i];
else if (!strcmp(argv[i], "-fn")) /* font or font set */
fonts[0] = argv[++i];
+ else if(!strcmp(argv[i], "-h")) { /* minimum height of one menu line */
+ lineheight = atoi(argv[++i]);
+ lineheight = MAX(lineheight,8); /* reasonable default in case of value too small/negative */
+ }
else if (!strcmp(argv[i], "-nb")) /* normal background color */
normbgcolor = argv[++i];
else if (!strcmp(argv[i], "-nf")) /* normal foreground color */

View file

@ -0,0 +1,74 @@
diff --git a/dwm.c b/dwm.c
index 4465af1..eff2da6 100644
--- a/dwm.c
+++ b/dwm.c
@@ -695,10 +695,10 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
- int x, w, sw = 0;
+ int x, w, sw = 0, tw, mw, ew = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
- unsigned int i, occ = 0, urg = 0;
+ unsigned int i, occ = 0, urg = 0, n = 0;
Client *c;
/* draw status first so it can be overdrawn by tags later */
@@ -709,6 +709,8 @@ drawbar(Monitor *m)
}
for (c = m->clients; c; c = c->next) {
+ if (ISVISIBLE(c))
+ n++;
occ |= c->tags;
if (c->isurgent)
urg |= c->tags;
@@ -729,15 +731,39 @@ drawbar(Monitor *m)
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
if ((w = m->ww - sw - x) > bh) {
- if (m->sel) {
- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
- if (m->sel->isfloating)
- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
- } else {
- drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, x, 0, w, bh, 1, 1);
+ if (n > 0) {
+ tw = TEXTW(m->sel->name) + lrpad;
+ mw = (tw >= w || n == 1) ? 0 : (w - tw) / (n - 1);
+
+ i = 0;
+ for (c = m->clients; c; c = c->next) {
+ if (!ISVISIBLE(c) || c == m->sel)
+ continue;
+ tw = TEXTW(c->name);
+ if(tw < mw)
+ ew += (mw - tw);
+ else
+ i++;
+ }
+ if (i > 0)
+ mw += ew / i;
+
+ for (c = m->clients; c; c = c->next) {
+ if (!ISVISIBLE(c))
+ continue;
+ tw = MIN(m->sel == c ? w : mw, TEXTW(c->name));
+
+ drw_setscheme(drw, scheme[m->sel == c ? SchemeSel : SchemeNorm]);
+ if (tw > 0) /* trap special handling of 0 in drw_text */
+ drw_text(drw, x, 0, tw, bh, lrpad / 2, c->name, 0);
+ if (c->isfloating)
+ drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0);
+ x += tw;
+ w -= tw;
+ }
}
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_rect(drw, x, 0, w, bh, 1, 1);
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
}

101
dwm/dwm-r1615-selfrestart.diff Executable file
View file

@ -0,0 +1,101 @@
# HG changeset patch
# User Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
# Date 1354650884 -7200
# Node ID 6c472a21a5887c5295a331c48c4da188ec2c8413
# Parent aaab44133a6830c9a00263731d098c01cc1d6fb5
selfrestart now magically locates the current dwm (no need to hardcode a path)
diff -r aaab44133a68 -r 6c472a21a588 config.def.h
--- a/config.def.h Tue Dec 04 21:54:44 2012 +0200
+++ b/config.def.h Tue Dec 04 21:54:44 2012 +0200
@@ -54,6 +54,8 @@
static const char *termcmd[] = { "urxvtc", NULL };
static const char *filemancmd[] = { "thunar", NULL };
+#include "selfrestart.c"
+
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_r, spawn, {.v = dmenucmd } },
@@ -89,6 +91,7 @@
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
+ { MODKEY|ShiftMask, XK_r, self_restart, {0} },
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};
@@ -108,4 +111,3 @@
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};
-
diff -r aaab44133a68 -r 6c472a21a588 selfrestart.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/selfrestart.c Tue Dec 04 21:54:44 2012 +0200
@@ -0,0 +1,65 @@
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.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(){
+ struct stat s;
+ int r, length, rate = 42;
+ char *path = NULL;
+
+ 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;
+}
+
+/**
+ * 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);
+}

View file

@ -0,0 +1,62 @@
From 75d5edbe16ee2fc060ff8b05eea17791d6334a59 Mon Sep 17 00:00:00 2001
From: Christopher Drelich <cd@cdrakka.com>
Date: Thu, 24 May 2018 23:24:12 -0400
Subject: [PATCH] Replaces magic numbers in statusbar with configurable
variables.
horizpadbar for horizontal statusbar padding
vertpadbar for vertical statusbar padding
StatusText now has both left and right padding,
as well as the vertical padding that all of the statusbar shares.
Other than the addition of left padding to StatusText, appearance
of the statusbar is identical to pre-patch when using the defaults
in config.def.h
---
config.def.h | 2 ++
dwm.c | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/config.def.h b/config.def.h
index a9ac303..5819399 100644
--- a/config.def.h
+++ b/config.def.h
@@ -5,6 +5,8 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
+static const int horizpadbar = 2; /* horizontal padding for statusbar */
+static const int vertpadbar = 0; /* vertical padding for statusbar */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222";
diff --git a/dwm.c b/dwm.c
index bb95e26..7b9ed42 100644
--- a/dwm.c
+++ b/dwm.c
@@ -704,8 +704,8 @@ drawbar(Monitor *m)
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
- sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
+ sw = TEXTW(stext);
+ drw_text(drw, m->ww - sw, 0, sw, bh, lrpad / 2, stext, 0);
}
for (c = m->clients; c; c = c->next) {
@@ -1544,8 +1544,8 @@ setup(void)
drw = drw_create(dpy, screen, root, sw, sh);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
- lrpad = drw->fonts->h;
- bh = drw->fonts->h + 2;
+ lrpad = drw->fonts->h + horizpadbar;
+ bh = drw->fonts->h + vertpadbar;
updategeom();
/* init atoms */
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
--
2.7.4