diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index e360f42..27e86bc 100755 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -290,8 +290,8 @@ colors: # # Window opacity as a floating point number from `0.0` to `1.0`. # The value `0.0` is completely transparent and `1.0` is opaque. -# background_opacity: 1.0 -background_opacity: 0.95 +background_opacity: 1.0 +# background_opacity: 0.95 #selection: #semantic_escape_chars: ",│`|:\"' ()[]{}<>\t" diff --git a/.config/compton/compton.conf b/.config/compton/compton.conf index 8a5b05b..290bdeb 100755 --- a/.config/compton/compton.conf +++ b/.config/compton/compton.conf @@ -38,8 +38,7 @@ opacity-rule = [ "99:name *?= 'Call'", "95:name *?= 'nmon'", "95:name *?= 'httping'", "96:name *?= 'xmobar'", -"95:class_g *?= 'emacs'", -"95:class_g *?= 'alacritty'", +"100:class_g *?= 'emacs'", "95:class_g *?= 'surf' && name *?='suckless.org'", "95:class_g *?= 'tabbed'", "95:name *?= 'newsboat'", diff --git a/.config/xmobar/xmobarrc0 b/.config/xmobar/xmobarrc0 index d1674a3..cca44ab 100755 --- a/.config/xmobar/xmobarrc0 +++ b/.config/xmobar/xmobarrc0 @@ -13,7 +13,7 @@ Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=t , persistent = True , iconRoot = "/home/dt/.xmonad/xpm/" -- default: "." , commands = [ Run Date "%a, %b %d %Y, %H:%M:%S" "date" 10 - , Run Network "enp4s0" ["-t", "up dn "] 10 + , Run Network "enp6s0" ["-t", "up dn "] 10 , Run Cpu ["-t", " cpu (%)","-H","50","--high","red"] 10 , Run Memory ["-t", " mem (%)"] 10 , Run DiskU [("/", " hdd ()")] [] 3600 @@ -21,5 +21,5 @@ Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=t ] , sepChar = "%" , alignSep = "}{" - , template = " | %UnsafeStdinReader% }{ %cpu% %memory% %disku% %enp4s0% %date% " + , template = " | %UnsafeStdinReader% }{ %cpu% %memory% %disku% %enp6s0% %date% " } diff --git a/.config/xmobar/xmobarrc1 b/.config/xmobar/xmobarrc1 index d1674a3..cca44ab 100755 --- a/.config/xmobar/xmobarrc1 +++ b/.config/xmobar/xmobarrc1 @@ -13,7 +13,7 @@ Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=t , persistent = True , iconRoot = "/home/dt/.xmonad/xpm/" -- default: "." , commands = [ Run Date "%a, %b %d %Y, %H:%M:%S" "date" 10 - , Run Network "enp4s0" ["-t", "up dn "] 10 + , Run Network "enp6s0" ["-t", "up dn "] 10 , Run Cpu ["-t", " cpu (%)","-H","50","--high","red"] 10 , Run Memory ["-t", " mem (%)"] 10 , Run DiskU [("/", " hdd ()")] [] 3600 @@ -21,5 +21,5 @@ Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=t ] , sepChar = "%" , alignSep = "}{" - , template = " | %UnsafeStdinReader% }{ %cpu% %memory% %disku% %enp4s0% %date% " + , template = " | %UnsafeStdinReader% }{ %cpu% %memory% %disku% %enp6s0% %date% " } diff --git a/.config/xmobar/xmobarrc2 b/.config/xmobar/xmobarrc2 index d1674a3..cca44ab 100755 --- a/.config/xmobar/xmobarrc2 +++ b/.config/xmobar/xmobarrc2 @@ -13,7 +13,7 @@ Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=t , persistent = True , iconRoot = "/home/dt/.xmonad/xpm/" -- default: "." , commands = [ Run Date "%a, %b %d %Y, %H:%M:%S" "date" 10 - , Run Network "enp4s0" ["-t", "up dn "] 10 + , Run Network "enp6s0" ["-t", "up dn "] 10 , Run Cpu ["-t", " cpu (%)","-H","50","--high","red"] 10 , Run Memory ["-t", " mem (%)"] 10 , Run DiskU [("/", " hdd ()")] [] 3600 @@ -21,5 +21,5 @@ Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=t ] , sepChar = "%" , alignSep = "}{" - , template = " | %UnsafeStdinReader% }{ %cpu% %memory% %disku% %enp4s0% %date% " + , template = " | %UnsafeStdinReader% }{ %cpu% %memory% %disku% %enp6s0% %date% " } diff --git a/.doom.d/init.el b/.doom.d/init.el index 0fbf60c..e3bd2c5 100644 --- a/.doom.d/init.el +++ b/.doom.d/init.el @@ -172,3 +172,15 @@ :config ;;literate (default +bindings +smartparens)) +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(org-agenda-files (quote ("~/org-basics.org" "~/Documents/org/orgmode.org")))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/dmenu/LICENSE b/dmenu/LICENSE old mode 100755 new mode 100644 index 9762166..6ed8ad3 --- a/dmenu/LICENSE +++ b/dmenu/LICENSE @@ -9,7 +9,7 @@ MIT/X Consortium License © 2009 Evan Gates © 2010-2012 Connor Lane Smith © 2014-2019 Hiltjo Posthuma -© 2015-2019 Quentin Rameau +© 2015-2018 Quentin Rameau Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/dmenu/Makefile b/dmenu/Makefile old mode 100755 new mode 100644 diff --git a/dmenu/README b/dmenu/README old mode 100755 new mode 100644 diff --git a/dmenu/arg.h b/dmenu/arg.h old mode 100755 new mode 100644 diff --git a/dmenu/config.def.h b/dmenu/config.def.h old mode 100755 new mode 100644 index 317fa2f..8ce09c3 --- a/dmenu/config.def.h +++ b/dmenu/config.def.h @@ -2,6 +2,8 @@ /* Default settings; can be overriden by command line. */ static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ +static int centered = 0; /* -c option; centers dmenu on screen */ +static int min_width = 500; /* minimum width when centered */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { "monospace:size=10" @@ -11,6 +13,8 @@ static const char *colors[SchemeLast][2] = { /* fg bg */ [SchemeNorm] = { "#bbbbbb", "#222222" }, [SchemeSel] = { "#eeeeee", "#005577" }, + [SchemeSelHighlight] = { "#ffc978", "#005577" }, + [SchemeNormHighlight] = { "#ffc978", "#222222" }, [SchemeOut] = { "#000000", "#00ffff" }, }; /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ @@ -22,3 +26,6 @@ static unsigned int lineheight = 0; /* -h option; minimum height of a me * for example: " /?\"&[]" */ static const char worddelimiters[] = " "; + +/* Size of the window border */ +static const unsigned int border_width = 5; diff --git a/dmenu/config.h b/dmenu/config.h old mode 100755 new mode 100644 index 0242baf..84c60fe --- a/dmenu/config.h +++ b/dmenu/config.h @@ -2,6 +2,8 @@ /* Default settings; can be overriden by command line. */ static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ +static int centered = 0; /* -c option; centers dmenu on screen */ +static int min_width = 500; /* minimum width when centered */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { "Mononoki Nerd Font:size=10" @@ -9,8 +11,10 @@ static const char *fonts[] = { static const char *prompt = NULL; /* -p option; prompt to the left of input field */ static const char *colors[SchemeLast][2] = { /* fg bg */ - [SchemeNorm] = { "#bbc5ff", "#292d3e" }, - [SchemeSel] = { "#292d3e", "#82aaff" }, + [SchemeNorm] = { "#bbc5ff", "#282a36" }, + [SchemeSel] = { "#282a36", "#82aaff" }, + [SchemeSelHighlight] = { "#82aaff", "#000000" }, + [SchemeNormHighlight] = { "#f1fa8c", "#000000" }, [SchemeOut] = { "#000000", "#00ffff" }, }; /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ @@ -22,3 +26,6 @@ static unsigned int lineheight = 22; /* -h option; minimum height of a m * for example: " /?\"&[]" */ static const char worddelimiters[] = " "; + +/* Size of the window border */ +static const unsigned int border_width = 0; diff --git a/dmenu/config.mk b/dmenu/config.mk old mode 100755 new mode 100644 diff --git a/dmenu/dmenu b/dmenu/dmenu index 64033d2..61c6c2e 100755 Binary files a/dmenu/dmenu and b/dmenu/dmenu differ diff --git a/dmenu/dmenu-lineheight-4.7.diff b/dmenu/dmenu-lineheight-4.7.diff deleted file mode 100755 index f6dfa5c..0000000 --- a/dmenu/dmenu-lineheight-4.7.diff +++ /dev/null @@ -1,76 +0,0 @@ -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 */ diff --git a/dmenu/dmenu.1 b/dmenu/dmenu.1 old mode 100755 new mode 100644 index 7ef34d2..868c7df --- a/dmenu/dmenu.1 +++ b/dmenu/dmenu.1 @@ -40,6 +40,9 @@ which lists programs in the user's $PATH and runs the result in their $SHELL. .B \-b dmenu appears at the bottom of the screen. .TP +.B \-c +dmenu appears centered on the screen. +.TP .B \-f dmenu grabs the keyboard before reading stdin if not reading from a tty. This is faster, but will lock up X until stdin reaches end\-of\-file. diff --git a/dmenu/dmenu.c b/dmenu/dmenu.c old mode 100755 new mode 100644 index 2b6c882..8f544d2 --- a/dmenu/dmenu.c +++ b/dmenu/dmenu.c @@ -24,9 +24,11 @@ * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org))) #define LENGTH(X) (sizeof X / sizeof X[0]) #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) +#define NUMBERSMAXDIGITS 100 +#define NUMBERSBUFSIZE (NUMBERSMAXDIGITS * 2) + 1 /* enums */ -enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ +enum { SchemeNorm, SchemeSel, SchemeOut, SchemeNormHighlight, SchemeSelHighlight, SchemeLast }; /* color schemes */ struct item { char *text; @@ -34,6 +36,7 @@ struct item { int out; }; +static char numbers[NUMBERSBUFSIZE] = ""; static char text[BUFSIZ] = ""; static char *embed; static int bh, mw, mh; @@ -89,6 +92,15 @@ calcoffsets(void) break; } +static int +max_textw(void) +{ + int len = 0; + for (struct item *item = items; item && item->text; item++) + len = MAX(TEXTW(item->text), len); + return len; +} + static void cleanup(void) { @@ -113,6 +125,42 @@ cistrstr(const char *s, const char *sub) return NULL; } +static void +drawhighlights(struct item *item, int x, int y, int maxw) +{ + char restorechar, tokens[sizeof text], *highlight, *token; + int indentx, highlightlen; + + drw_setscheme(drw, scheme[item == sel ? SchemeSelHighlight : SchemeNormHighlight]); + strcpy(tokens, text); + for (token = strtok(tokens, " "); token; token = strtok(NULL, " ")) { + highlight = fstrstr(item->text, token); + while (highlight) { + // Move item str end, calc width for highlight indent, & restore + highlightlen = highlight - item->text; + restorechar = *highlight; + item->text[highlightlen] = '\0'; + indentx = TEXTW(item->text); + item->text[highlightlen] = restorechar; + + // Move highlight str end, draw highlight, & restore + restorechar = highlight[strlen(token)]; + highlight[strlen(token)] = '\0'; + drw_text( + drw, + x + indentx - (lrpad / 2) - 1, + y, + MIN(maxw - indentx, TEXTW(highlight) - lrpad), + bh, 0, highlight, 0 + ); + highlight[strlen(token)] = restorechar; + + if (strlen(highlight) - strlen(token) < strlen(token)) break; + highlight = fstrstr(highlight + strlen(token), token); + } + } +} + static int drawitem(struct item *item, int x, int y, int w) { @@ -123,7 +171,24 @@ drawitem(struct item *item, int x, int y, int w) else drw_setscheme(drw, scheme[SchemeNorm]); - return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); + int r = drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); + drawhighlights(item, x, y, w); + return r; +} + +static void +recalculatenumbers() +{ + unsigned int numer = 0, denom = 0; + struct item *item; + if (matchend) { + numer++; + for (item = matchend; item && item->left; item = item->left) + numer++; + } + for (item = items; item && item->text; item++) + denom++; + snprintf(numbers, NUMBERSBUFSIZE, "%d/%d", numer, denom); } static void @@ -151,6 +216,7 @@ drawmenu(void) drw_rect(drw, x + curpos, 2 + (bh-fh)/2, 2, fh - 4, 1, 0); } + recalculatenumbers(); if (lines > 0) { /* draw vertical list */ for (item = curr; item != next; item = item->right) @@ -165,13 +231,15 @@ drawmenu(void) } x += w; for (item = curr; item != next; item = item->right) - x = drawitem(item, x, 0, MIN(TEXTW(item->text), mw - x - TEXTW(">"))); + x = drawitem(item, x, 0, MIN(TEXTW(item->text), mw - x - TEXTW(">") - TEXTW(numbers))); if (next) { w = TEXTW(">"); drw_setscheme(drw, scheme[SchemeNorm]); - drw_text(drw, mw - w, 0, w, bh, lrpad / 2, ">", 0); + drw_text(drw, mw - w - TEXTW(numbers), 0, w, bh, lrpad / 2, ">", 0); } } + drw_setscheme(drw, scheme[SchemeNorm]); + drw_text(drw, mw - TEXTW(numbers), 0, TEXTW(numbers), bh, lrpad / 2, numbers, 0); drw_map(drw, win, 0, 0, mw, mh); } @@ -556,11 +624,6 @@ run(void) if (XFilterEvent(&ev, None)) continue; switch(ev.type) { - case DestroyNotify: - if (ev.xdestroywindow.window != win) - break; - cleanup(); - exit(1); case Expose: if (ev.xexpose.count == 0) drw_map(drw, win, 0, 0, mw, mh); @@ -612,6 +675,7 @@ setup(void) bh = MAX(bh,lineheight); /* make a menu line AT LEAST 'lineheight' tall */ lines = MAX(lines, 0); mh = (lines + 1) * bh; + promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; #ifdef XINERAMA i = 0; if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) { @@ -638,9 +702,16 @@ setup(void) if (INTERSECT(x, y, 1, 1, info[i])) break; - x = info[i].x_org; - y = info[i].y_org + (topbar ? 0 : info[i].height - mh); - mw = info[i].width; + if (centered) { + mw = MIN(MAX(max_textw() + promptw, min_width), info[i].width); + x = info[i].x_org + ((info[i].width - mw) / 2); + y = info[i].y_org + ((info[i].height - mh) / 2); + } else { + x = info[i].x_org; + y = info[i].y_org + (topbar ? 0 : info[i].height - mh); + mw = info[i].width; + } + XFree(info); } else #endif @@ -648,11 +719,17 @@ setup(void) if (!XGetWindowAttributes(dpy, parentwin, &wa)) die("could not get embedding window attributes: 0x%lx", parentwin); - x = 0; - y = topbar ? 0 : wa.height - mh; - mw = wa.width; + + if (centered) { + mw = MIN(MAX(max_textw() + promptw, min_width), wa.width); + x = (wa.width - mw) / 2; + y = (wa.height - mh) / 2; + } else { + x = 0; + y = topbar ? 0 : wa.height - mh; + mw = wa.width; + } } - promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; inputw = MIN(inputw, mw/3); match(); @@ -660,9 +737,10 @@ setup(void) swa.override_redirect = True; swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; - win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, + win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width, CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); + XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel); XSetClassHint(dpy, win, &ch); /* open input methods */ @@ -673,7 +751,7 @@ setup(void) XMapRaised(dpy, win); XSetInputFocus(dpy, win, RevertToParent, CurrentTime); if (embed) { - XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask); + XSelectInput(dpy, parentwin, FocusChangeMask); if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) { for (i = 0; i < du && dws[i] != win; ++i) XSelectInput(dpy, dws[i], FocusChangeMask); @@ -709,6 +787,8 @@ main(int argc, char *argv[]) topbar = 0; else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ fast = 1; + else if (!strcmp(argv[i], "-c")) /* centers dmenu on screen */ + centered = 1; else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ fstrncmp = strncasecmp; fstrstr = cistrstr; diff --git a/dmenu/dmenu.o b/dmenu/dmenu.o index 583732e..90ece45 100644 Binary files a/dmenu/dmenu.o and b/dmenu/dmenu.o differ diff --git a/dmenu/dmenu_path b/dmenu/dmenu_path old mode 100755 new mode 100644 diff --git a/dmenu/drw.c b/dmenu/drw.c old mode 100755 new mode 100644 diff --git a/dmenu/drw.h b/dmenu/drw.h old mode 100755 new mode 100644 diff --git a/dmenu/drw.o b/dmenu/drw.o index 0fe974c..6220007 100644 Binary files a/dmenu/drw.o and b/dmenu/drw.o differ diff --git a/dmenu/stest b/dmenu/stest index c0bb011..3ec07e4 100755 Binary files a/dmenu/stest and b/dmenu/stest differ diff --git a/dmenu/stest.1 b/dmenu/stest.1 old mode 100755 new mode 100644 diff --git a/dmenu/stest.c b/dmenu/stest.c old mode 100755 new mode 100644 diff --git a/dmenu/stest.o b/dmenu/stest.o index a595841..437b258 100644 Binary files a/dmenu/stest.o and b/dmenu/stest.o differ diff --git a/dmenu/util.c b/dmenu/util.c old mode 100755 new mode 100644 diff --git a/dmenu/util.h b/dmenu/util.h old mode 100755 new mode 100644 diff --git a/dmenu/util.o b/dmenu/util.o index 3ccd52c..336703c 100644 Binary files a/dmenu/util.o and b/dmenu/util.o differ