├── .gitignore ├── README.md ├── build.sh ├── dmenu ├── cfg │ ├── config.h │ └── config.mk ├── inactive │ ├── README.md │ └── bakkeby-01-dmenu-alpha-9b38fda6feda68f95754d5b8932b1a69471df960.diff └── patches │ ├── 01. dmenu-border-9b38fda6feda68f95754d5b8932b1a69471df960.diff │ ├── 02. dmenu-fuzzymatch-9b38fda6feda68f95754d5b8932b1a69471df960.diff │ ├── 03. dmenu-scroll-9b38fda6feda68f95754d5b8932b1a69471df960.diff │ ├── 04. dmenu-mousesupport-9b38fda6feda68f95754d5b8932b1a69471df960.diff │ └── mitch-01-dmenu-xyw-9b38fda6feda68f95754d5b8932b1a69471df960.diff ├── dwm ├── README.md ├── broken │ └── dwm-scratchpad-20221102-ba56fe9.diff ├── cfg │ ├── config.h │ └── config.mk ├── inactive │ ├── dwm-09-xrdb-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-28-rule-refresh-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-30-taglabels-hide-inactive-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ └── mitch-06-rounded_corners-f04cac6d6e39cd9e3fc4fae526e3d1e8df5e34b2.patch └── patches │ ├── dwm-00-center-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-01-actualfullscreen-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-01-fullgaps-f04cac6d6e39cd9e3fc4fae526e3d1e8df5e34b2.diff │ ├── dwm-02-pertag-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-03-resizecorners-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-04-rotatestack-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-05-savefloats-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-06-autoresize-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-07-urgent-border-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-08-underlinetags-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-11-barpadding-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-12-statuspadding-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-13-monoclesymbol-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-14-statusallmons-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-15-decorhints-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-16-unicode_ellipsis-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-17-sticky-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-18-stickyindicator-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-19-steam-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-20-ewmhtags-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-21-noborderflicker-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-22-removeborder-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-24-columngaps-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-25-attachabove-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-26-notitle-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-27-alpha-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-28-resizeable-borders-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-29-systray-alpha-FIXED-KINDA-SHITTY-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── dwm-30-hide_vacant_tags-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── mitch-00-setmfact_fullgaps-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── mitch-01-remove_dmenucmd-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ ├── mitch-02-remove_snap-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff │ └── mitch-03-remove-dirtomon-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff ├── sent ├── cfg │ ├── config.h │ └── config.mk └── patches │ ├── mitch-01-pledge_OpenBSD-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.patch │ ├── sent-01-inverted-colors-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.diff │ ├── sent-02-progress-bar-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.diff │ ├── sent-03-cmdline-options-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.diff │ └── sent-04-bilinear_scaling-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.diff ├── slock ├── cfg │ ├── config.h │ └── config.mk └── patches │ ├── mitch-01-openbsd-35633d45672d14bd798c478c45d1a17064701aa9.patch │ ├── mitch-02-openbsd_Makefile.patch │ ├── slock-01-dwmlogo-35633d45672d14bd798c478c45d1a17064701aa9.diff │ ├── slock-02-terminalkeys-35633d45672d14bd798c478c45d1a17064701aa9.diff │ ├── slock-03-quickcancel-35633d45672d14bd798c478c45d1a17064701aa9.diff │ ├── slock-04-mediakeys-35633d45672d14bd798c478c45d1a17064701aa9.diff │ └── slock-05-contrlclear-35633d45672d14bd798c478c45d1a17064701aa9.diff ├── st ├── broken │ ├── 99. st-alpha-0.8.5.diff │ └── README.md ├── cfg │ ├── config.h │ └── config.mk ├── inactive │ ├── 17. st-w3mimage-9ba7ecf7b15ec2986c6142036706aa353b249ef9.diff │ ├── README.md │ └── XX. st-newterm-9ba7ecf7b15ec2986c6142036706aa353b249ef9.diff ├── patches │ ├── 01. st-anysize-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 02. st-copyurl_highlighturl-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 03. st-clipboard-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 04. st-scrollback-[0]-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 05. st-scrollback-mouse-[1]-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 06. st-scrollback-mouse-[2]-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 07. st-vertcenter-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 08. st-bold-is-not-bright-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 09. st-spoiler-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 10. st-xclearwin-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 11. st-plumb_without_shell_OSC-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 12. st-boxdraw_v2-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 13. st-swapmouse-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 15. st-disable-bold-italic-fonts-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 16. st-blinking_cursor-4536f46cfff50c66a115755def0155d8e246b02f.diff │ ├── 18. st-themed_cursor-0.8.5.diff │ ├── 98. st-single-buffering-9ba7ecf7b15ec2986c6142036706aa353b249ef9.diff │ ├── mitch-01-desktop-and-icon-4536f46cfff50c66a115755def0155d8e246b02f.patch │ ├── mitch-02-stwrapper-4536f46cfff50c66a115755def0155d8e246b02f.patch │ └── mitch-03-openbsd_no_terminfo-4536f46cfff50c66a115755def0155d8e246b02f.patch └── res │ ├── st.desktop │ ├── st.png │ └── stwrapper └── tabbed ├── cfg ├── config.h └── config.mk └── patches ├── 01. tabbed-autohide-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.diff ├── 02. tabbed-clientnumber-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.diff ├── 03. tabbed-icon-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.diff ├── 04. tabbed-alpha-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.diff ├── 05. tabbed-bar_height-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.diff └── mitch-01-pledge_OpenBSD-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.patch /.gitignore: -------------------------------------------------------------------------------- 1 | *~* 2 | *.tar.* 3 | *.tgz 4 | *.o 5 | *.out 6 | *.bak 7 | *.bk 8 | *.tmp 9 | *.temp 10 | *.rej 11 | *.orig 12 | *\:w 13 | 14 | blind/blind 15 | dmenu/dmenu 16 | dmenu/stest 17 | dmenu/dmenu/stest 18 | dwm/dwm 19 | quark/quark 20 | sent/sent 21 | slock/slock 22 | st/st 23 | tabbed/tabbed 24 | slstatus/slstatus 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # suckless 2 | 3 | ## Building 4 | 5 | `./build.sh $name` 6 | 7 | For questions, feel free to [contact me](mailto:mitch@wvr.sh) or comment on the [git issues](https://github.com/mitchweaver/suckless/issues) 8 | 9 | ## Troubleshooting 10 | 11 | #### It won't build on my machine! 12 | 13 | Make sure you have `${LIBS}`, `${CFLAGS}`, and friends set correctly in `config.mk`. 14 | Notice: I use OpenBSD on most of my machines so that tends to be what is currently uncommented. 15 | If you're on Linux, NetBSD, etc you will need to comment/uncomment things appropriately. 16 | 17 | Is everything set right but still not building? Let me know! 18 | 19 | #### I can't find `#include `, what/where is that? 20 | 21 | These headers are how I include themes from my auto-rice script, which you can see [here](https://github.com/mitchweaver/bin/blob/master/bin/rice). 22 | 23 | This script dumps a `.h` file to the `~/.cache` directory containing the theme template. 24 | This `.h` gets included in the build from `-I${HOME}/.cache/themes` in each `config.mk`. 25 | 26 | You'll need to provide *your own* `.h` theme template, (or just dont source themes and paste in whatever) 27 | 28 | ## Screenshots 29 | ------ 30 | 31 | **[dwm](http://github.com/MitchWeaver/suckless/tree/master/dwm)**: 32 | 33 | ![obsd_sepia_rice](https://i.imgur.com/C1zSkJM.png) 34 | 35 | ![obsd_sepia_rice2](https://i.imgur.com/ecCsAkD.png) 36 | 37 | **[dmenu](http://github.com/MitchWeaver/suckless/tree/master/dwm)**: 38 | 39 | ![dmenu](https://i.imgur.com/1E9EsSB.png) 40 | 41 | ### See also 42 | ------- 43 | 44 | [bin](http://github.com/mitchweaver/bin) - helpful scripts 45 | [dots](http://github.com/mitchweaver/dots) - dotfiles 46 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # -*-*-*-*-*-*-*-*- SETTINGS -*-*-*-*-*-*-*-*-*-*-*-*-*-*--* 4 | DWM_VERSION=e81f17d4c196aaed6893fd4beed49991caa3e2a4 # 09 Apr 2023 5 | # DWM_VERSION=bb2e7222baeec7776930354d0e9f210cc2aaad5f # 08 Jul 2020 6 | ST_VERSION=00085199039ee63acc7b1ecb7e3774a9c3552b2a # 02 Oct 2022 7 | DMENU_VERSION=1d2b462acf1210b8f86966b8dd9bb6e36e369ee1 # 23 Oct 2022 8 | TABBED_VERSION=dabf6a25ab01107fc1e0464ee6a3e369d1626f97 # 12 May 2020 9 | SURF_VERSION=d068a3878b6b9f2841a49cd7948cdf9d62b55585 # 08 Feb 2019 10 | SENT_VERSION=2649e8d5334f7e37a1710c60fb740ecfe91b9f9e # 13 May 2020 11 | SLOCK_VERSION=35633d45672d14bd798c478c45d1a17064701aa9 # 25 Mar 2017 12 | 13 | # do not remove this, needed for order of patches! 14 | export LC_ALL=C 15 | 16 | export PREFIX="${HOME}/.local" 17 | # -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 18 | 19 | usage() { 20 | die 'Usage: ./build.sh [dwm] [st] [dmenu] [tabbed] [surf]' 21 | } 22 | 23 | die() { 24 | >&2 printf '%s\n' "$*" 25 | exit 1 26 | } 27 | 28 | clone() { 29 | mkdir -p "$1" 30 | cd "$1" 31 | [ -d "$1" ] || git clone "$2/$1" 32 | cd "$1" 33 | git clean -df 34 | git fetch --all 35 | git reset --hard "$3" 36 | cd "$START_PWD" 37 | } 38 | 39 | [ "$1" ] || usage 40 | 41 | build() { 42 | START_PWD=$(dirname "$0") 43 | [ "$START_PWD" = . ] && START_PWD=$PWD 44 | for name ; do 45 | cd "$START_PWD" 46 | 47 | sl=git://git.suckless.org 48 | case $name in 49 | st) clone "$name" $sl $ST_VERSION ;; 50 | dwm) clone "$name" $sl $DWM_VERSION ;; 51 | surf) clone "$name" $sl $SURF_VERSION ;; 52 | dmenu) clone "$name" $sl $DMENU_VERSION ;; 53 | tabbed) clone "$name" $sl $TABBED_VERSION ;; 54 | sent) clone "$name" $sl $SENT_VERSION ;; 55 | slock) clone "$name" $sl $SLOCK_VERSION ;; 56 | *) usage 57 | esac 58 | 59 | cd "$name" 60 | 61 | if ls -A1q patches | grep -q . >/dev/null 2>&1 ; then 62 | for patch in patches/* ; do 63 | printf '%s' "===> applying ${patch#patches/}..." 64 | patch -s -l -p0 < "$patch" || exit 1 65 | printf '%s\n' ' OK!' 66 | done 67 | fi 68 | 69 | printf '%s\n\n' 'Patching succeeded!' 70 | 71 | [ -f cfg/config.h ] && cp -f cfg/config.h "$name"/config.h 72 | [ -f cfg/config.mk ] && cp -f cfg/config.mk "$name"/config.mk 73 | 74 | cd "$name" 75 | make clean 76 | make 77 | 78 | case $name in 79 | slock) 80 | >&2 printf '\n%s\n' 'Need to install to /usr/local due to suid:' 81 | case $(uname) in 82 | Linux) 83 | sudo make PREFIX=/usr/local install 84 | sudo chmod u+s /usr/local/bin/slock 85 | ;; 86 | OpenBSD) 87 | doas make PREFIX=/usr/local install 88 | doas chmod u+s /usr/local/bin/slock 89 | esac 90 | 91 | # not all linux distros have nobody/nogroup 92 | if ! grep nobody /etc/passwd >/dev/null ; then 93 | >&2 echo 'Non-priviledge user nobody does not exist, adding...' 94 | sudo useradd nobody 95 | fi 96 | if ! grep nogroup /etc/group >/dev/null ; then 97 | >&2 echo 'Non-priviledge group nobody does not exist, adding...' 98 | sudo groupadd nogroup 99 | fi 100 | 101 | ;; 102 | *) 103 | make PREFIX="$PREFIX" install 104 | esac 105 | done 106 | } 107 | 108 | comptest() { 109 | printf 'Running compiler test...' 110 | printf '%s\n' 'int main() { return 0 ; }' > /tmp/$$.c 111 | ${CC:-gcc} /tmp/$$.c -o /tmp/$$ 112 | chmod +x /tmp/$$ 113 | if /tmp/$$ ; then 114 | rm /tmp/$$.c /tmp/$$ 115 | printf ' %s\n\n' 'Passed!' 116 | else 117 | die "Something wrong with your compiler! Aborting." 118 | fi 119 | } 120 | 121 | main() { 122 | for cmd in make ${CC:-gcc} ld git patch ; do 123 | command -v "$cmd" >/dev/null || die "missing: $cmd" 124 | done 125 | comptest 126 | build "$@" 127 | } 128 | 129 | main "$@" 130 | -------------------------------------------------------------------------------- /dmenu/cfg/config.h: -------------------------------------------------------------------------------- 1 | static const char *fonts[] = { 2 | /* "spleen:pixelsize=22:antialias=true:autohint=true", */ 3 | "ShureTechMono Nerd Font:pixelsize=22:antialias=true:autohint=true", 4 | "Terminus:pixelsize=18:antialias=false:autohint=false", 5 | "Hack:pixelsize=20:antialias=true:autohint=true", 6 | "Noto Color Emoji:pixelsize=22:antialias=true:autohint=true", 7 | "Unifont:pixelsize=22" 8 | }; 9 | /* "cozette:size=10:antialias=false:autohint=false", */ 10 | /* "Terminus:pixelsize=18:antialias=false:autohint=false" */ 11 | /* "Hack:pixelsize=20:antialias=true:autohint=true", */ 12 | /* "Noto Sans CJK JP:pixelsize=22:antialias=true:autohint=true", */ 13 | /* "Noto Sans CJK HK:pixelsize=22:antialias=true:autohint=true", */ 14 | /* "Noto Sans CJK KR:pixelsize=22:antialias=true:autohint=true", */ 15 | /* "Noto Sans CJK SC:pixelsize=22:antialias=true:autohint=true", */ 16 | /* "Noto Sans CJK TC:pixelsize=22:antialias=true:autohint=true", */ 17 | 18 | /* static double opacity = 0.8; // opacity patch */ 19 | 20 | /* static const unsigned int baralpha = 0xd0; */ 21 | /* static const unsigned int borderalpha = OPAQUE; */ 22 | /* static const unsigned int alphas[][3] = { */ 23 | /* /1* fg bg border *1/ */ 24 | /* [SchemeNorm] = { OPAQUE, baralpha, borderalpha }, */ 25 | /* [SchemeSel] = { OPAQUE, baralpha, borderalpha }, */ 26 | /* }; */ 27 | 28 | static const unsigned int border_width = 2; 29 | static int fuzzy = 1; 30 | 31 | // theme, included from ${HOME}/.cache/themes in config.mk 32 | #include 33 | 34 | static const char *prompt = NULL; /* -p option; prompt to the left of input field */ 35 | static const char worddelimiters[] = " /?\"&[].:,"; 36 | static int topbar = 1; 37 | static unsigned int lines = 0; 38 | -------------------------------------------------------------------------------- /dmenu/cfg/config.mk: -------------------------------------------------------------------------------- 1 | VERSION = 4.8 2 | 3 | PREFIX = ${HOME}/.local 4 | MANPREFIX = ${PREFIX}/share/man 5 | 6 | # OpenBSD / Linux 7 | X11INC = /usr/X11R6/include 8 | X11LIB = /usr/X11R6/lib 9 | # NetBSD 10 | # X11INC = /usr/X11R7/include 11 | # X11LIB = /usr/X11R7/lib 12 | 13 | XINERAMALIBS = -lXinerama 14 | XINERAMAFLAGS = -DXINERAMA 15 | 16 | FREETYPELIBS = -lfontconfig -lXft 17 | 18 | # LINUX 19 | FREETYPEINC = /usr/include/freetype2 20 | # OPENBSD / NetBSD 21 | # FREETYPEINC = $(X11INC)/freetype2 22 | 23 | INCS = -I${X11INC} -I${FREETYPEINC} -I${HOME}/.cache/themes 24 | 25 | # OpenBSD / Linux 26 | LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lm -lXrender 27 | # NetBSD 28 | # LIBS = -Wl,-R${X11LIB} -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lm -lXrender 29 | 30 | CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} 31 | CFLAGS = -O2 -pipe -fstack-protector-strong -std=c99 -pedantic -Wall ${INCS} ${CPPFLAGS} 32 | LDFLAGS = -s ${LIBS} 33 | 34 | CC = cc 35 | -------------------------------------------------------------------------------- /dmenu/inactive/README.md: -------------------------------------------------------------------------------- 1 | alpha patch causes to segfault not sure why; todo 2 | -------------------------------------------------------------------------------- /dmenu/inactive/bakkeby-01-dmenu-alpha-9b38fda6feda68f95754d5b8932b1a69471df960.diff: -------------------------------------------------------------------------------- 1 | --- dmenu/dmenu.c 2 | +++ dmenu/dmenu.c 3 | @@ -24,6 +24,8 @@ 4 | * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org))) 5 | #define LENGTH(X) (sizeof X / sizeof X[0]) 6 | #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) 7 | +#define OPAQUE 0xffU 8 | +#define OPACITY "_NET_WM_WINDOW_OPACITY" 9 | 10 | /* enums */ 11 | enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ 12 | @@ -50,6 +52,11 @@ static Display *dpy; 13 | static Window root, parentwin, win; 14 | static XIC xic; 15 | 16 | +static int useargb = 0; 17 | +static Visual *visual; 18 | +static int depth; 19 | +static Colormap cmap; 20 | + 21 | static Drw *drw; 22 | static Clr *scheme[SchemeLast]; 23 | 24 | @@ -518,6 +525,43 @@ paste(void) 25 | drawmenu(); 26 | } 27 | 28 | +static void 29 | +xinitvisual() 30 | +{ 31 | + XVisualInfo *infos; 32 | + XRenderPictFormat *fmt; 33 | + int nitems; 34 | + int i; 35 | + 36 | + XVisualInfo tpl = { 37 | + .screen = screen, 38 | + .depth = 32, 39 | + .class = TrueColor 40 | + }; 41 | + long masks = VisualScreenMask | VisualDepthMask | VisualClassMask; 42 | + 43 | + infos = XGetVisualInfo(dpy, masks, &tpl, &nitems); 44 | + visual = NULL; 45 | + for(i = 0; i < nitems; i ++) { 46 | + fmt = XRenderFindVisualFormat(dpy, infos[i].visual); 47 | + if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { 48 | + visual = infos[i].visual; 49 | + depth = infos[i].depth; 50 | + cmap = XCreateColormap(dpy, root, visual, AllocNone); 51 | + useargb = 1; 52 | + break; 53 | + } 54 | + } 55 | + 56 | + XFree(infos); 57 | + 58 | + if (! visual) { 59 | + visual = DefaultVisual(dpy, screen); 60 | + depth = DefaultDepth(dpy, screen); 61 | + cmap = DefaultColormap(dpy, screen); 62 | + } 63 | +} 64 | + 65 | static void 66 | readstdin(void) 67 | { 68 | @@ -602,7 +646,7 @@ setup(void) 69 | #endif 70 | /* init appearance */ 71 | for (j = 0; j < SchemeLast; j++) 72 | - scheme[j] = drw_scm_create(drw, colors[j], 2); 73 | + scheme[j] = drw_scm_create(drw, colors[j], alphas[j], 2); 74 | 75 | clip = XInternAtom(dpy, "CLIPBOARD", False); 76 | utf8 = XInternAtom(dpy, "UTF8_STRING", False); 77 | @@ -657,14 +701,14 @@ setup(void) 78 | 79 | /* create menu window */ 80 | swa.override_redirect = True; 81 | - swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; 82 | + swa.background_pixel = 0; 83 | + swa.colormap = cmap; 84 | swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask | 85 | ButtonPressMask; 86 | win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width, 87 | - CopyFromParent, CopyFromParent, CopyFromParent, 88 | - CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); 89 | + depth, InputOutput, visual, 90 | + CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &swa); 91 | XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel); 92 | XSetClassHint(dpy, win, &ch); 93 | 94 | - 95 | /* input methods */ 96 | @@ -690,7 +734,8 @@ static void 97 | usage(void) 98 | { 99 | fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" 100 | - " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr); 101 | + " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n" 102 | + " [ -o opacity]\n", stderr); 103 | exit(1); 104 | } 105 | 106 | @@ -719,6 +764,8 @@ main(int argc, char *argv[]) 107 | lines = atoi(argv[++i]); 108 | else if (!strcmp(argv[i], "-m")) 109 | mon = atoi(argv[++i]); 110 | + else if (!strcmp(argv[i], "-o")) /* opacity */ 111 | + opacity = atof(argv[++i]); 112 | else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ 113 | prompt = argv[++i]; 114 | else if (!strcmp(argv[i], "-fn")) /* font or font set */ 115 | @@ -747,7 +794,8 @@ main(int argc, char *argv[]) 116 | if (!XGetWindowAttributes(dpy, parentwin, &wa)) 117 | die("could not get embedding window attributes: 0x%lx", 118 | parentwin); 119 | - drw = drw_create(dpy, screen, root, wa.width, wa.height); 120 | + xinitvisual(); 121 | + drw = drw_create(dpy, screen, root, wa.width, wa.height, visual, depth, cmap); 122 | if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) 123 | die("no fonts could be loaded."); 124 | lrpad = drw->fonts->h; 125 | --- dmenu/drw.c 126 | +++ dmenu/drw.c 127 | @@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen) 128 | } 129 | 130 | Drw * 131 | -drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) 132 | +drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap) 133 | { 134 | Drw *drw = ecalloc(1, sizeof(Drw)); 135 | 136 | @@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h 137 | drw->root = root; 138 | drw->w = w; 139 | drw->h = h; 140 | - drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); 141 | - drw->gc = XCreateGC(dpy, root, 0, NULL); 142 | + drw->visual = visual; 143 | + drw->depth = depth; 144 | + drw->cmap = cmap; 145 | + drw->drawable = XCreatePixmap(dpy, root, w, h, depth); 146 | + drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL); 147 | XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); 148 | 149 | return drw; 150 | @@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h) 151 | drw->h = h; 152 | if (drw->drawable) 153 | XFreePixmap(drw->dpy, drw->drawable); 154 | - drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); 155 | + drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth); 156 | } 157 | 158 | void 159 | @@ -193,21 +196,22 @@ drw_fontset_free(Fnt *font) 160 | } 161 | 162 | void 163 | -drw_clr_create(Drw *drw, Clr *dest, const char *clrname) 164 | +drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha) 165 | { 166 | if (!drw || !dest || !clrname) 167 | return; 168 | 169 | - if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), 170 | - DefaultColormap(drw->dpy, drw->screen), 171 | + if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap, 172 | clrname, dest)) 173 | die("error, cannot allocate color '%s'", clrname); 174 | + 175 | + dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24); 176 | } 177 | 178 | /* Wrapper to create color schemes. The caller has to call free(3) on the 179 | * returned color scheme when done using it. */ 180 | Clr * 181 | -drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) 182 | +drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount) 183 | { 184 | size_t i; 185 | Clr *ret; 186 | @@ -217,7 +221,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) 187 | return NULL; 188 | 189 | for (i = 0; i < clrcount; i++) 190 | - drw_clr_create(drw, &ret[i], clrnames[i]); 191 | + drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]); 192 | return ret; 193 | } 194 | 195 | @@ -273,9 +277,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp 196 | } else { 197 | XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); 198 | XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); 199 | - d = XftDrawCreate(drw->dpy, drw->drawable, 200 | - DefaultVisual(drw->dpy, drw->screen), 201 | - DefaultColormap(drw->dpy, drw->screen)); 202 | + d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap); 203 | x += lpad; 204 | w -= lpad; 205 | } 206 | --- dmenu/drw.h 207 | +++ dmenu/drw.h 208 | @@ -20,6 +20,9 @@ typedef struct { 209 | Display *dpy; 210 | int screen; 211 | Window root; 212 | + Visual *visual; 213 | + unsigned int depth; 214 | + Colormap cmap; 215 | Drawable drawable; 216 | GC gc; 217 | Clr *scheme; 218 | @@ -27,7 +30,7 @@ typedef struct { 219 | } Drw; 220 | 221 | /* Drawable abstraction */ 222 | -Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); 223 | +Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap); 224 | void drw_resize(Drw *drw, unsigned int w, unsigned int h); 225 | void drw_free(Drw *drw); 226 | 227 | @@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text); 228 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); 229 | 230 | /* Colorscheme abstraction */ 231 | -void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); 232 | -Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); 233 | +void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha); 234 | +Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount); 235 | 236 | /* Cursor abstraction */ 237 | Cur *drw_cur_create(Drw *drw, int shape); 238 | -- 239 | 2.17.1 240 | 241 | -------------------------------------------------------------------------------- /dmenu/patches/01. dmenu-border-9b38fda6feda68f95754d5b8932b1a69471df960.diff: -------------------------------------------------------------------------------- 1 | --- dmenu/dmenu.c 2 | +++ dmenu/dmenu.c 3 | @@ -654,9 +654,10 @@ setup(void) 4 | swa.override_redirect = True; 5 | swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; 6 | swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; 7 | - win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, 8 | + win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width, 9 | CopyFromParent, CopyFromParent, CopyFromParent, 10 | CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); 11 | + XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel); 12 | XSetClassHint(dpy, win, &ch); 13 | 14 | /* open input methods */ 15 | -------------------------------------------------------------------------------- /dmenu/patches/02. dmenu-fuzzymatch-9b38fda6feda68f95754d5b8932b1a69471df960.diff: -------------------------------------------------------------------------------- 1 | --- dmenu/config.def.h 2 | +++ dmenu/config.def.h_new 3 | @@ -2,6 +2,7 @@ 4 | /* Default settings; can be overriden by command line. */ 5 | 6 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ 7 | +static int fuzzy = 1; /* -F option; if 0, dmenu doesn't use fuzzy matching */ 8 | /* -fn option overrides fonts[0]; default X11 font or font set */ 9 | static const char *fonts[] = { 10 | "monospace:size=10" 11 | --- dmenu/dmenu.c 12 | +++ dmenu/dmenu.c_new 13 | @@ -1,6 +1,7 @@ 14 | /* See LICENSE file for copyright and license details. */ 15 | #include 16 | #include 17 | +#include 18 | #include 19 | #include 20 | #include 21 | @@ -32,6 +33,7 @@ struct item { 22 | char *text; 23 | struct item *left, *right; 24 | int out; 25 | + double distance; 26 | }; 27 | 28 | static char text[BUFSIZ] = ""; 29 | @@ -210,9 +212,94 @@ grabkeyboard(void) 30 | die("cannot grab keyboard"); 31 | } 32 | 33 | +int 34 | +compare_distance(const void *a, const void *b) 35 | +{ 36 | + struct item *da = *(struct item **) a; 37 | + struct item *db = *(struct item **) b; 38 | + 39 | + if (!db) 40 | + return 1; 41 | + if (!da) 42 | + return -1; 43 | + 44 | + return da->distance == db->distance ? 0 : da->distance < db->distance ? -1 : 1; 45 | +} 46 | + 47 | +void 48 | +fuzzymatch(void) 49 | +{ 50 | + /* bang - we have so much memory */ 51 | + struct item *it; 52 | + struct item **fuzzymatches = NULL; 53 | + char c; 54 | + int number_of_matches = 0, i, pidx, sidx, eidx; 55 | + int text_len = strlen(text), itext_len; 56 | + 57 | + matches = matchend = NULL; 58 | + 59 | + /* walk through all items */ 60 | + for (it = items; it && it->text; it++) { 61 | + if (text_len) { 62 | + itext_len = strlen(it->text); 63 | + pidx = 0; /* pointer */ 64 | + sidx = eidx = -1; /* start of match, end of match */ 65 | + /* walk through item text */ 66 | + for (i = 0; i < itext_len && (c = it->text[i]); i++) { 67 | + /* fuzzy match pattern */ 68 | + if (!fstrncmp(&text[pidx], &c, 1)) { 69 | + if(sidx == -1) 70 | + sidx = i; 71 | + pidx++; 72 | + if (pidx == text_len) { 73 | + eidx = i; 74 | + break; 75 | + } 76 | + } 77 | + } 78 | + /* build list of matches */ 79 | + if (eidx != -1) { 80 | + /* compute distance */ 81 | + /* add penalty if match starts late (log(sidx+2)) 82 | + * add penalty for long a match without many matching characters */ 83 | + it->distance = log(sidx + 2) + (double)(eidx - sidx - text_len); 84 | + /* fprintf(stderr, "distance %s %f\n", it->text, it->distance); */ 85 | + appenditem(it, &matches, &matchend); 86 | + number_of_matches++; 87 | + } 88 | + } else { 89 | + appenditem(it, &matches, &matchend); 90 | + } 91 | + } 92 | + 93 | + if (number_of_matches) { 94 | + /* initialize array with matches */ 95 | + if (!(fuzzymatches = realloc(fuzzymatches, number_of_matches * sizeof(struct item*)))) 96 | + die("cannot realloc %u bytes:", number_of_matches * sizeof(struct item*)); 97 | + for (i = 0, it = matches; it && i < number_of_matches; i++, it = it->right) { 98 | + fuzzymatches[i] = it; 99 | + } 100 | + /* sort matches according to distance */ 101 | + qsort(fuzzymatches, number_of_matches, sizeof(struct item*), compare_distance); 102 | + /* rebuild list of matches */ 103 | + matches = matchend = NULL; 104 | + for (i = 0, it = fuzzymatches[i]; i < number_of_matches && it && \ 105 | + it->text; i++, it = fuzzymatches[i]) { 106 | + appenditem(it, &matches, &matchend); 107 | + } 108 | + free(fuzzymatches); 109 | + } 110 | + curr = sel = matches; 111 | + calcoffsets(); 112 | +} 113 | + 114 | static void 115 | match(void) 116 | { 117 | + if (fuzzy) { 118 | + fuzzymatch(); 119 | + return; 120 | + } 121 | static char **tokv = NULL; 122 | static int tokn = 0; 123 | 124 | @@ -702,6 +789,8 @@ main(int argc, char *argv[]) 125 | topbar = 0; 126 | else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ 127 | fast = 1; 128 | + else if (!strcmp(argv[i], "-F")) /* grabs keyboard before reading stdin */ 129 | + fuzzy = 0; 130 | else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ 131 | fstrncmp = strncasecmp; 132 | fstrstr = cistrstr; 133 | -- 134 | 2.22.0 135 | 136 | -------------------------------------------------------------------------------- /dmenu/patches/03. dmenu-scroll-9b38fda6feda68f95754d5b8932b1a69471df960.diff: -------------------------------------------------------------------------------- 1 | --- dmenu/dmenu.c 2 | +++ dmenu/dmenu.c_new 3 | @@ -131,9 +131,10 @@ drawitem(struct item *item, int x, int y, int w) 4 | static void 5 | drawmenu(void) 6 | { 7 | - unsigned int curpos; 8 | + static int curpos, oldcurlen; 9 | struct item *item; 10 | int x = 0, y = 0, w; 11 | + int curlen, rcurlen; 12 | 13 | drw_setscheme(drw, scheme[SchemeNorm]); 14 | drw_rect(drw, 0, 0, mw, mh, 1, 1); 15 | @@ -144,14 +145,21 @@ drawmenu(void) 16 | } 17 | /* draw input field */ 18 | w = (lines > 0 || !matches) ? mw - x : inputw; 19 | - drw_setscheme(drw, scheme[SchemeNorm]); 20 | - drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0); 21 | + w -= lrpad / 2; 22 | + x += lrpad / 2; 23 | 24 | - curpos = TEXTW(text) - TEXTW(&text[cursor]); 25 | - if ((curpos += lrpad / 2 - 1) < w) { 26 | - drw_setscheme(drw, scheme[SchemeNorm]); 27 | - drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0); 28 | - } 29 | + rcurlen = drw_fontset_getwidth(drw, text + cursor); 30 | + curlen = drw_fontset_getwidth(drw, text) - rcurlen; 31 | + curpos += curlen - oldcurlen; 32 | + curpos = MIN(w, MAX(0, curpos)); 33 | + curpos = MAX(curpos, w - rcurlen); 34 | + curpos = MIN(curpos, curlen); 35 | + oldcurlen = curlen; 36 | + 37 | + drw_setscheme(drw, scheme[SchemeNorm]); 38 | + drw_text_align(drw, x, 0, curpos, bh, text, cursor, AlignR); 39 | + drw_text_align(drw, x + curpos, 0, w - curpos, bh, text + cursor, strlen(text) - cursor, AlignL); 40 | + drw_rect(drw, x + curpos - 1, 2, 2, bh - 4, 1, 0); 41 | 42 | if (lines > 0) { 43 | /* draw vertical list */ 44 | --- dmenu/drw.c 45 | +++ dmenu/drw.c_new 46 | @@ -364,6 +364,175 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp 47 | return x + (render ? w : 0); 48 | } 49 | 50 | +int 51 | +utf8nextchar(const char *str, int len, int i, int inc) 52 | +{ 53 | + int n; 54 | + 55 | + for (n = i + inc; n + inc >= 0 && n + inc <= len 56 | + && (str[n] & 0xc0) == 0x80; n += inc) 57 | + ; 58 | + return n; 59 | +} 60 | + 61 | +int 62 | +drw_text_align(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int textlen, int align) 63 | +{ 64 | + int ty; 65 | + unsigned int ew; 66 | + XftDraw *d = NULL; 67 | + Fnt *usedfont, *curfont, *nextfont; 68 | + size_t len; 69 | + int utf8strlen, utf8charlen, render = x || y || w || h; 70 | + long utf8codepoint = 0; 71 | + const char *utf8str; 72 | + FcCharSet *fccharset; 73 | + FcPattern *fcpattern; 74 | + FcPattern *match; 75 | + XftResult result; 76 | + int charexists = 0; 77 | + int i, n; 78 | + 79 | + if (!drw || (render && !drw->scheme) || !text || !drw->fonts || textlen <= 0 80 | + || (align != AlignL && align != AlignR)) 81 | + return 0; 82 | + 83 | + if (!render) { 84 | + w = ~w; 85 | + } else { 86 | + XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel); 87 | + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); 88 | + d = XftDrawCreate(drw->dpy, drw->drawable, 89 | + DefaultVisual(drw->dpy, drw->screen), 90 | + DefaultColormap(drw->dpy, drw->screen)); 91 | + } 92 | + 93 | + usedfont = drw->fonts; 94 | + i = align == AlignL ? 0 : textlen; 95 | + x = align == AlignL ? x : x + w; 96 | + while (1) { 97 | + utf8strlen = 0; 98 | + nextfont = NULL; 99 | + /* if (align == AlignL) */ 100 | + utf8str = text + i; 101 | + 102 | + while ((align == AlignL && i < textlen) || (align == AlignR && i > 0)) { 103 | + if (align == AlignL) { 104 | + utf8charlen = utf8decode(text + i, &utf8codepoint, MIN(textlen - i, UTF_SIZ)); 105 | + if (!utf8charlen) { 106 | + textlen = i; 107 | + break; 108 | + } 109 | + } else { 110 | + n = utf8nextchar(text, textlen, i, -1); 111 | + utf8charlen = utf8decode(text + n, &utf8codepoint, MIN(textlen - n, UTF_SIZ)); 112 | + if (!utf8charlen) { 113 | + textlen -= i; 114 | + text += i; 115 | + i = 0; 116 | + break; 117 | + } 118 | + } 119 | + for (curfont = drw->fonts; curfont; curfont = curfont->next) { 120 | + charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint); 121 | + if (charexists) { 122 | + if (curfont == usedfont) { 123 | + utf8strlen += utf8charlen; 124 | + i += align == AlignL ? utf8charlen : -utf8charlen; 125 | + } else { 126 | + nextfont = curfont; 127 | + } 128 | + break; 129 | + } 130 | + } 131 | + 132 | + if (!charexists || nextfont) 133 | + break; 134 | + else 135 | + charexists = 0; 136 | + } 137 | + 138 | + if (align == AlignR) 139 | + utf8str = text + i; 140 | + 141 | + if (utf8strlen) { 142 | + drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL); 143 | + /* shorten text if necessary */ 144 | + if (align == AlignL) { 145 | + for (len = utf8strlen; len && ew > w; ) { 146 | + len = utf8nextchar(utf8str, len, len, -1); 147 | + drw_font_getexts(usedfont, utf8str, len, &ew, NULL); 148 | + } 149 | + } else { 150 | + for (len = utf8strlen; len && ew > w; ) { 151 | + n = utf8nextchar(utf8str, len, 0, +1); 152 | + utf8str += n; 153 | + len -= n; 154 | + drw_font_getexts(usedfont, utf8str, len, &ew, NULL); 155 | + } 156 | + } 157 | + 158 | + if (len) { 159 | + if (render) { 160 | + ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent; 161 | + XftDrawStringUtf8(d, &drw->scheme[ColFg], 162 | + usedfont->xfont, align == AlignL ? x : x - ew, ty, (XftChar8 *)utf8str, len); 163 | + } 164 | + x += align == AlignL ? ew : -ew; 165 | + w -= ew; 166 | + } 167 | + if (len < utf8strlen) 168 | + break; 169 | + } 170 | + 171 | + if ((align == AlignR && i <= 0) || (align == AlignL && i >= textlen)) { 172 | + break; 173 | + } else if (nextfont) { 174 | + charexists = 0; 175 | + usedfont = nextfont; 176 | + } else { 177 | + /* Regardless of whether or not a fallback font is found, the 178 | + * character must be drawn. */ 179 | + charexists = 1; 180 | + 181 | + fccharset = FcCharSetCreate(); 182 | + FcCharSetAddChar(fccharset, utf8codepoint); 183 | + 184 | + if (!drw->fonts->pattern) { 185 | + /* Refer to the comment in xfont_create for more information. */ 186 | + die("the first font in the cache must be loaded from a font string."); 187 | + } 188 | + 189 | + fcpattern = FcPatternDuplicate(drw->fonts->pattern); 190 | + FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); 191 | + FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); 192 | + 193 | + FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); 194 | + FcDefaultSubstitute(fcpattern); 195 | + match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result); 196 | + 197 | + FcCharSetDestroy(fccharset); 198 | + FcPatternDestroy(fcpattern); 199 | + 200 | + if (match) { 201 | + usedfont = xfont_create(drw, NULL, match); 202 | + if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) { 203 | + for (curfont = drw->fonts; curfont->next; curfont = curfont->next) 204 | + ; /* NOP */ 205 | + curfont->next = usedfont; 206 | + } else { 207 | + xfont_free(usedfont); 208 | + usedfont = drw->fonts; 209 | + } 210 | + } 211 | + } 212 | + } 213 | + if (d) 214 | + XftDrawDestroy(d); 215 | + 216 | + return x; 217 | +} 218 | + 219 | void 220 | drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) 221 | { 222 | --- dmenu/drw.h 223 | +++ dmenu/drw.h_new 224 | @@ -13,6 +13,7 @@ typedef struct Fnt { 225 | } Fnt; 226 | 227 | enum { ColFg, ColBg }; /* Clr scheme index */ 228 | +enum { AlignL, AlignR }; 229 | typedef XftColor Clr; 230 | 231 | typedef struct { 232 | @@ -52,6 +53,7 @@ void drw_setscheme(Drw *drw, Clr *scm); 233 | /* Drawing functions */ 234 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); 235 | int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); 236 | +int drw_text_align(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int textlen, int align); 237 | 238 | /* Map functions */ 239 | void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); 240 | -------------------------------------------------------------------------------- /dmenu/patches/04. dmenu-mousesupport-9b38fda6feda68f95754d5b8932b1a69471df960.diff: -------------------------------------------------------------------------------- 1 | --- dmenu/dmenu.c 2 | +++ dmenu/dmenu.c 3 | @@ -500,6 +500,119 @@ draw: 4 | drawmenu(); 5 | } 6 | 7 | +static void 8 | +buttonpress(XEvent *e) 9 | +{ 10 | + struct item *item; 11 | + XButtonPressedEvent *ev = &e->xbutton; 12 | + int x = 0, y = 0, h = bh, w; 13 | + 14 | + if (ev->window != win) 15 | + return; 16 | + 17 | + /* right-click: exit */ 18 | + if (ev->button == Button3) 19 | + exit(1); 20 | + 21 | + if (prompt && *prompt) 22 | + x += promptw; 23 | + 24 | + /* input field */ 25 | + w = (lines > 0 || !matches) ? mw - x : inputw; 26 | + 27 | + /* left-click on input: clear input, 28 | + * NOTE: if there is no left-arrow the space for < is reserved so 29 | + * add that to the input width */ 30 | + if (ev->button == Button1 && 31 | + ((lines <= 0 && ev->x >= 0 && ev->x <= x + w + 32 | + ((!prev || !curr->left) ? TEXTW("<") : 0)) || 33 | + (lines > 0 && ev->y >= y && ev->y <= y + h))) { 34 | + insert(NULL, -cursor); 35 | + drawmenu(); 36 | + return; 37 | + } 38 | + /* middle-mouse click: paste selection */ 39 | + if (ev->button == Button2) { 40 | + XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY, 41 | + utf8, utf8, win, CurrentTime); 42 | + drawmenu(); 43 | + return; 44 | + } 45 | + /* scroll up */ 46 | + if (ev->button == Button4 && prev) { 47 | + sel = curr = prev; 48 | + calcoffsets(); 49 | + drawmenu(); 50 | + return; 51 | + } 52 | + /* scroll down */ 53 | + if (ev->button == Button5 && next) { 54 | + sel = curr = next; 55 | + calcoffsets(); 56 | + drawmenu(); 57 | + return; 58 | + } 59 | + if (ev->button != Button1) 60 | + return; 61 | + if (ev->state & ~ControlMask) 62 | + return; 63 | + if (lines > 0) { 64 | + /* vertical list: (ctrl)left-click on item */ 65 | + w = mw - x; 66 | + for (item = curr; item != next; item = item->right) { 67 | + y += h; 68 | + if (ev->y >= y && ev->y <= (y + h)) { 69 | + puts(item->text); 70 | + if (!(ev->state & ControlMask)) 71 | + exit(0); 72 | + sel = item; 73 | + if (sel) { 74 | + sel->out = 1; 75 | + drawmenu(); 76 | + } 77 | + return; 78 | + } 79 | + } 80 | + } else if (matches) { 81 | + /* left-click on left arrow */ 82 | + x += inputw; 83 | + w = TEXTW("<"); 84 | + if (prev && curr->left) { 85 | + if (ev->x >= x && ev->x <= x + w) { 86 | + sel = curr = prev; 87 | + calcoffsets(); 88 | + drawmenu(); 89 | + return; 90 | + } 91 | + } 92 | + /* horizontal list: (ctrl)left-click on item */ 93 | + for (item = curr; item != next; item = item->right) { 94 | + x += w; 95 | + w = MIN(TEXTW(item->text), mw - x - TEXTW(">")); 96 | + if (ev->x >= x && ev->x <= x + w) { 97 | + puts(item->text); 98 | + if (!(ev->state & ControlMask)) 99 | + exit(0); 100 | + sel = item; 101 | + if (sel) { 102 | + sel->out = 1; 103 | + drawmenu(); 104 | + } 105 | + return; 106 | + } 107 | + } 108 | + /* left-click on right arrow */ 109 | + w = TEXTW(">"); 110 | + x = mw - w; 111 | + if (next && ev->x >= x && ev->x <= x + w) { 112 | + sel = curr = next; 113 | + calcoffsets(); 114 | + drawmenu(); 115 | + return; 116 | + } 117 | + } 118 | +} 119 | + 120 | static void 121 | paste(void) 122 | { 123 | @@ -556,6 +669,9 @@ run(void) 124 | if (XFilterEvent(&ev, None)) 125 | continue; 126 | switch(ev.type) { 127 | + case ButtonPress: 128 | + buttonpress(&ev); 129 | + break; 130 | case DestroyNotify: 131 | if (ev.xdestroywindow.window != win) 132 | break; 133 | @@ -653,7 +769,8 @@ setup(void) 134 | /* create menu window */ 135 | swa.override_redirect = True; 136 | swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; 137 | - swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; 138 | + swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask | 139 | + ButtonPressMask; 140 | win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width, 141 | CopyFromParent, CopyFromParent, CopyFromParent, 142 | CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); 143 | -------------------------------------------------------------------------------- /dmenu/patches/mitch-01-dmenu-xyw-9b38fda6feda68f95754d5b8932b1a69471df960.diff: -------------------------------------------------------------------------------- 1 | /* http://github.com/mitchweaver/suckless */ 2 | /* edited to avoid collision with -w windowid argument */ 3 | --- dmenu/dmenu.c 4 | +++ dmenu/dmenu.c_new 5 | @@ -36,6 +36,9 @@ struct item { 6 | static char text[BUFSIZ] = ""; 7 | static char *embed; 8 | static int bh, mw, mh; 9 | +static int dmx = 0; /* put dmenu at this x offset */ 10 | +static int dmy = 0; /* put dmenu at this y offset (measured from the bottom if topbar is 0) */ 11 | +static unsigned int dmw = 0; /* make dmenu this wide */ 12 | static int inputw = 0, promptw; 13 | static int lrpad; /* sum of left and right padding */ 14 | static size_t cursor; 15 | @@ -705,19 +708,19 @@ setup(void) 16 | if (INTERSECT(x, y, 1, 1, info[i])) 17 | break; 18 | 19 | - x = info[i].x_org; 20 | - y = info[i].y_org + (topbar ? 0 : info[i].height - mh); 21 | - mw = info[i].width; 22 | + x = info[i].x_org + dmx; 23 | + y = info[i].y_org + (topbar ? dmy : info[i].height - mh - dmy); 24 | + mw = (dmw>0 ? dmw : info[i].width); 25 | XFree(info); 26 | } else 27 | #endif 28 | { 29 | if (!XGetWindowAttributes(dpy, parentwin, &wa)) 30 | die("could not get embedding window attributes: 0x%lx", 31 | parentwin); 32 | - x = 0; 33 | - y = topbar ? 0 : wa.height - mh; 34 | - mw = wa.width; 35 | + x = dmx; 36 | + y = topbar ? dmy : wa.height - mh - dmy; 37 | + mw = (dmw>0 ? dmw : wa.width); 38 | } 39 | promptw = (prompt && *prompt) ? TEXTW(prompt) : 0; 40 | inputw = MIN(inputw, mw/3); 41 | @@ -783,6 +786,12 @@ main(int argc, char *argv[]) 42 | /* these options take one argument */ 43 | else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */ 44 | lines = atoi(argv[++i]); 45 | + else if (!strcmp(argv[i], "-x")) /* window x offset */ 46 | + dmx = atoi(argv[++i]); 47 | + else if (!strcmp(argv[i], "-y")) /* window y offset (from bottom up if -b) */ 48 | + dmy = atoi(argv[++i]); 49 | + else if (!strcmp(argv[i], "-wi")) /* make dmenu this wide */ 50 | + dmw = atoi(argv[++i]); 51 | else if (!strcmp(argv[i], "-m")) 52 | mon = atoi(argv[++i]); 53 | else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ 54 | -------------------------------------------------------------------------------- /dwm/README.md: -------------------------------------------------------------------------------- 1 | # dwm 2 | 3 | ## misc notes 4 | 5 | ### "live" relaunch 6 | 7 | to relaunch dwm without losing open windows: 8 | 9 | ``` 10 | while : ; do 11 | dwm && break || continue 12 | done 13 | ``` 14 | 15 | If dwm is manually closed, it will exit 0 thus 16 | breaking and exiting your X session as normal. 17 | 18 | If you kill dwm forcefully, like with `pkill`, it will exit 1 19 | causing the loop to continue and relaunching dwm. 20 | This won't close your X session so all your opened apps will remain. 21 | 22 | note: may want to add a sleep in there in case your dwm 23 | breaks for some reason (ex: segfaults) 24 | 25 | ### picom 26 | 27 | 28 | to prevent picom, (or compton), drawing shadows on 29 | your status bar add these lines to `picom.conf`: 30 | 31 | ``` 32 | shadow-exclude = [ 33 | "class_g *= 'dwm'", 34 | "name *= 'dwm'" 35 | ] 36 | ``` 37 | 38 | ### conky 39 | 40 | make sure you have this line else dwm will try to manage it as a window 41 | ``` 42 | own_window_type = ‘override’ 43 | ``` 44 | -------------------------------------------------------------------------------- /dwm/broken/dwm-scratchpad-20221102-ba56fe9.diff: -------------------------------------------------------------------------------- 1 | # diff --git a/config.def.h b/config.def.h 2 | # index 9efa774..0b8b310 100644 3 | # --- a/config.def.h 4 | # +++ b/config.def.h 5 | # @@ -59,11 +59,14 @@ static const Layout layouts[] = { 6 | # static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ 7 | # static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; 8 | # static const char *termcmd[] = { "st", NULL }; 9 | # +static const char scratchpadname[] = "scratchpad"; 10 | # +static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL }; 11 | 12 | # static const Key keys[] = { 13 | # /* modifier key function argument */ 14 | # { MODKEY, XK_p, spawn, {.v = dmenucmd } }, 15 | # { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, 16 | # + { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, 17 | # { MODKEY, XK_b, togglebar, {0} }, 18 | # { MODKEY, XK_j, focusstack, {.i = +1 } }, 19 | # { MODKEY, XK_k, focusstack, {.i = -1 } }, 20 | diff --git a/dwm.c b/dwm.c 21 | index 253aba7..4abf8d3 100644 22 | --- dwm/dwm.c 23 | +++ dwm/dwm.c 24 | @@ -212,6 +212,7 @@ static void tagmon(const Arg *arg); 25 | static void tile(Monitor *m); 26 | static void togglebar(const Arg *arg); 27 | static void togglefloating(const Arg *arg); 28 | +static void togglescratch(const Arg *arg); 29 | static void togglesticky(const Arg *arg); 30 | static void togglefullscr(const Arg *arg); 31 | static void toggletag(const Arg *arg); 32 | @@ -272,6 +273,8 @@ static Window root, wmcheckwin; 33 | /* configuration, allows nested code to access above variables */ 34 | #include "config.h" 35 | 36 | +static unsigned int scratchtag = 1 << LENGTH(tags); 37 | + 38 | /* compile-time check if all tags fit into an unsigned int bit array. */ 39 | struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; 40 | 41 | @@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa) 42 | c->y = MAX(c->y, c->mon->wy); 43 | c->bw = borderpx; 44 | 45 | + selmon->tagset[selmon->seltags] &= ~scratchtag; 46 | + if (!strcmp(c->name, scratchpadname)) { 47 | + c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag; 48 | + c->isfloating = True; 49 | + c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2); 50 | + c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2); 51 | + } 52 | + 53 | wc.border_width = c->bw; 54 | XConfigureWindow(dpy, w, CWBorderWidth, &wc); 55 | XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); 56 | @@ -1641,6 +1652,7 @@ spawn(const Arg *arg) 57 | { 58 | if (arg->v == dmenucmd) 59 | dmenumon[0] = '0' + selmon->num; 60 | + selmon->tagset[selmon->seltags] &= ~scratchtag; 61 | if (fork() == 0) { 62 | if (dpy) 63 | close(ConnectionNumber(dpy)); 64 | @@ -1719,6 +1731,28 @@ togglefloating(const Arg *arg) 65 | arrange(selmon); 66 | } 67 | 68 | +void 69 | +togglescratch(const Arg *arg) 70 | +{ 71 | + Client *c; 72 | + unsigned int found = 0; 73 | + 74 | + for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next); 75 | + if (found) { 76 | + unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag; 77 | + if (newtagset) { 78 | + selmon->tagset[selmon->seltags] = newtagset; 79 | + focus(NULL); 80 | + arrange(selmon); 81 | + } 82 | + if (ISVISIBLE(c)) { 83 | + focus(c); 84 | + restack(selmon); 85 | + } 86 | + } else 87 | + spawn(arg); 88 | +} 89 | + 90 | void 91 | toggletag(const Arg *arg) 92 | { 93 | -------------------------------------------------------------------------------- /dwm/cfg/config.mk: -------------------------------------------------------------------------------- 1 | VERSION = 6.4 2 | 3 | PREFIX = /usr/local 4 | MANPREFIX = ${PREFIX}/share/man 5 | 6 | X11INC = /usr/X11R6/include 7 | X11LIB = /usr/X11R6/lib 8 | 9 | XINERAMALIBS = -lXinerama 10 | XINERAMAFLAGS = -DXINERAMA 11 | 12 | FREETYPELIBS = -lfontconfig -lXft 13 | FREETYPEINC = /usr/include/freetype2 14 | 15 | INCS = -I${X11INC} -I${FREETYPEINC} -I${HOME}/.cache/themes 16 | LIBS = -L${X11LIB} -lX11 -lXext ${XINERAMALIBS} ${FREETYPELIBS} 17 | 18 | CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} -O3 -pipe -fomit-frame-pointer -fipa-pta -fno-semantic-interposition -fno-trapping-math -fno-math-errno -fasynchronous-unwind-tables 19 | CFLAGS = -w -std=c99 ${INCS} ${CPPFLAGS} -O3 -pipe -fomit-frame-pointer -fipa-pta -fno-semantic-interposition -fno-trapping-math -fno-math-errno -fasynchronous-unwind-tables -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -falign-functions=32 20 | LDFLAGS = ${LIBS} -lXrender -fuse-ld=mold -Wl,-O1 -Wl,--as-needed 21 | -------------------------------------------------------------------------------- /dwm/inactive/dwm-09-xrdb-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | #From e7c65d2ce902a19a20daa751b42f8ba0209fdb61 Mon Sep 17 00:00:00 2001 2 | #From: NekoCWD 3 | #Date: Sun, 22 Jan 2023 23:42:57 +0300 4 | #Subject: [PATCH] [dwm] xrdb update 6.4 5 | 6 | #--- 7 | # config.def.h | 22 ++++++++++--------- 8 | # drw.c | 2 +- 9 | # drw.h | 2 +- 10 | # dwm.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 11 | # 4 files changed, 76 insertions(+), 12 deletions(-) 12 | 13 | #diff --git a/config.def.h b/config.def.h 14 | #index 061ad66..686b947 100644 15 | #--- a/config.def.h 16 | #+++ b/config.def.h 17 | #@@ -7,15 +7,16 @@ static const int showbar = 1; /* 0 means no bar */ 18 | # static const int topbar = 1; /* 0 means bottom bar */ 19 | # static const char *fonts[] = { "monospace:size=10" }; 20 | # static const char dmenufont[] = "monospace:size=10"; 21 | #-static const char col_gray1[] = "#222222"; 22 | #-static const char col_gray2[] = "#444444"; 23 | #-static const char col_gray3[] = "#bbbbbb"; 24 | #-static const char col_gray4[] = "#eeeeee"; 25 | #-static const char col_cyan[] = "#005577"; 26 | #-static const char *colors[][3] = { 27 | #- /* fg bg border */ 28 | #- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 29 | #- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 30 | +static char normbgcolor[] = "#222222"; 31 | +static char normbordercolor[] = "#444444"; 32 | +static char normfgcolor[] = "#bbbbbb"; 33 | +static char selfgcolor[] = "#eeeeee"; 34 | +static char selbordercolor[] = "#005577"; 35 | +static char selbgcolor[] = "#005577"; 36 | +static char *colors[][3] = { 37 | #+ /* fg bg border */ 38 | #+ [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor }, 39 | #+ [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor }, 40 | # }; 41 | # /* tagging */ 42 | #@@ -56,7 +57,7 @@ static const Layout layouts[] = { 43 | # #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } 44 | # /* commands */ 45 | #-static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; 46 | #+static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL }; 47 | # static const char *termcmd[] = { "st", NULL }; 48 | # # static const Key keys[] = { 49 | # @@ -84,6 +85,7 @@ static const Key keys[] = { 50 | # { MODKEY, XK_period, focusmon, {.i = +1 } }, 51 | # { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, 52 | # { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, 53 | # + { MODKEY, XK_F5, xrdb, {.v = NULL } }, 54 | # TAGKEYS( XK_1, 0) 55 | # TAGKEYS( XK_2, 1) 56 | # TAGKEYS( XK_3, 2) 57 | diff --git a/drw.c b/drw.c 58 | index a58a2b4..f8a82f5 100644 59 | --- dwm/drw.c 60 | +++ dwm/drw.c 61 | @@ -195,7 +195,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname) 62 | /* Wrapper to create color schemes. The caller has to call free(3) on the 63 | * returned color scheme when done using it. */ 64 | Clr * 65 | -drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) 66 | +drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount) 67 | { 68 | size_t i; 69 | Clr *ret; 70 | diff --git a/drw.h b/drw.h 71 | index 6471431..bdbf950 100644 72 | --- dwm/drw.h 73 | +++ dwm/drw.h 74 | @@ -40,7 +40,7 @@ void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned in 75 | 76 | /* Colorscheme abstraction */ 77 | void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); 78 | -Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); 79 | +Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount); 80 | 81 | /* Cursor abstraction */ 82 | Cur *drw_cur_create(Drw *drw, int shape); 83 | diff --git a/dwm.c b/dwm.c 84 | index e5efb6a..3fe76be 100644 85 | --- dwm/dwm.c 86 | +++ dwm/dwm.c 87 | @@ -35,6 +35,7 @@ 88 | #include 89 | #include 90 | #include 91 | +#include 92 | #include 93 | #ifdef XINERAMA 94 | #include 95 | @@ -56,6 +57,21 @@ 96 | #define HEIGHT(X) ((X)->h + 2 * (X)->bw) 97 | #define TAGMASK ((1 << LENGTH(tags)) - 1) 98 | #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) 99 | +#define XRDB_LOAD_COLOR(R,V) if (XrmGetResource(xrdb, R, NULL, &type, &value) == True) { \ 100 | + if (value.addr != NULL && strnlen(value.addr, 8) == 7 && value.addr[0] == '#') { \ 101 | + int i = 1; \ 102 | + for (; i <= 6; i++) { \ 103 | + if (value.addr[i] < 48) break; \ 104 | + if (value.addr[i] > 57 && value.addr[i] < 65) break; \ 105 | + if (value.addr[i] > 70 && value.addr[i] < 97) break; \ 106 | + if (value.addr[i] > 102) break; \ 107 | + } \ 108 | + if (i == 7) { \ 109 | + strncpy(V, value.addr, 7); \ 110 | + V[7] = '\0'; \ 111 | + } \ 112 | + } \ 113 | + } 114 | 115 | /* enums */ 116 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 117 | @@ -178,6 +194,7 @@ static void grabkeys(void); 118 | static void incnmaster(const Arg *arg); 119 | static void keypress(XEvent *e); 120 | static void killclient(const Arg *arg); 121 | +static void loadxrdb(void); 122 | static void manage(Window w, XWindowAttributes *wa); 123 | static void mappingnotify(XEvent *e); 124 | static void maprequest(XEvent *e); 125 | @@ -233,6 +250,7 @@ static Monitor *wintomon(Window w); 126 | static int xerror(Display *dpy, XErrorEvent *ee); 127 | static int xerrordummy(Display *dpy, XErrorEvent *ee); 128 | static int xerrorstart(Display *dpy, XErrorEvent *ee); 129 | +static void xrdb(const Arg *arg); 130 | static void zoom(const Arg *arg); 131 | 132 | /* variables */ 133 | @@ -1019,6 +1037,37 @@ killclient(const Arg *arg) 134 | } 135 | } 136 | 137 | +void 138 | +loadxrdb() 139 | +{ 140 | + Display *display; 141 | + char * resm; 142 | + XrmDatabase xrdb; 143 | + char *type; 144 | + XrmValue value; 145 | + 146 | + display = XOpenDisplay(NULL); 147 | + 148 | + if (display != NULL) { 149 | + resm = XResourceManagerString(display); 150 | + 151 | + if (resm != NULL) { 152 | + xrdb = XrmGetStringDatabase(resm); 153 | + 154 | + if (xrdb != NULL) { 155 | + XRDB_LOAD_COLOR("dwm.normbordercolor", normbordercolor); 156 | + XRDB_LOAD_COLOR("dwm.normbgcolor", normbgcolor); 157 | + XRDB_LOAD_COLOR("dwm.normfgcolor", normfgcolor); 158 | + XRDB_LOAD_COLOR("dwm.selbordercolor", selbordercolor); 159 | + XRDB_LOAD_COLOR("dwm.selbgcolor", selbgcolor); 160 | + XRDB_LOAD_COLOR("dwm.selfgcolor", selfgcolor); 161 | + } 162 | + } 163 | + } 164 | + 165 | + XCloseDisplay(display); 166 | +} 167 | + 168 | void 169 | manage(Window w, XWindowAttributes *wa) 170 | { 171 | @@ -2110,6 +2159,17 @@ xerrorstart(Display *dpy, XErrorEvent *ee) 172 | return -1; 173 | } 174 | 175 | +void 176 | +xrdb(const Arg *arg) 177 | +{ 178 | + loadxrdb(); 179 | + int i; 180 | + for (i = 0; i < LENGTH(colors); i++) 181 | + scheme[i] = drw_scm_create(drw, colors[i], 3); 182 | + focus(NULL); 183 | + arrange(NULL); 184 | +} 185 | + 186 | void 187 | zoom(const Arg *arg) 188 | { 189 | @@ -2134,6 +2194,8 @@ main(int argc, char *argv[]) 190 | if (!(dpy = XOpenDisplay(NULL))) 191 | die("dwm: cannot open display"); 192 | checkotherwm(); 193 | + XrmInitialize(); 194 | + loadxrdb(); 195 | setup(); 196 | #ifdef __OpenBSD__ 197 | if (pledge("stdio rpath proc exec", NULL) == -1) 198 | -- 199 | 2.38.2 200 | 201 | -------------------------------------------------------------------------------- /dwm/inactive/dwm-28-rule-refresh-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2023-05-09 23:57:20.799802224 -0500 2 | +++ dwm/dwm.c 2023-05-09 23:59:15.739751165 -0500 3 | @@ -254,6 +254,7 @@ 4 | static void updatenumlockmask(void); 5 | static void updatesizehints(Client *c); 6 | static void updatestatus(void); 7 | +static void updaterules(Client *c); 8 | static void updatetitle(Client *c); 9 | static void updatewindowtype(Client *c); 10 | static void updatewmhints(Client *c); 11 | @@ -1335,8 +1336,10 @@ 12 | drawbars(); 13 | break; 14 | } 15 | - if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) 16 | + if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { 17 | updatetitle(c); 18 | + updaterules(c); 19 | + } 20 | if (ev->atom == netatom[NetWMWindowType]) 21 | updatewindowtype(c); 22 | if (ev->atom == motifatom) 23 | @@ -2380,6 +2383,54 @@ 24 | } 25 | 26 | void 27 | +updaterules(Client *c) 28 | +{ 29 | + //applyrules(c) 30 | + const char *class, *instance; 31 | + unsigned int i; 32 | + const Rule *r; 33 | + Monitor *m; 34 | + XClassHint ch = { NULL, NULL }; 35 | + 36 | + /* rule matching */ 37 | + XGetClassHint(dpy, c->win, &ch); 38 | + class = ch.res_class ? ch.res_class : broken; 39 | + instance = ch.res_name ? ch.res_name : broken; 40 | + char found_rule = 0; 41 | + 42 | + for (i = 0; i < LENGTH(rules); i++) { 43 | + r = &rules[i]; 44 | + if ((!r->title || strstr(c->name, r->title)) 45 | + && (!r->class || strstr(class, r->class)) 46 | + && (!r->instance || strstr(instance, r->instance))) 47 | + { 48 | + c->isfloating = r->isfloating; 49 | + 50 | + if(!found_rule) 51 | + { 52 | + c->tags=0; 53 | + found_rule=1; 54 | + } 55 | + c->tags |= r->tags; 56 | + for (m = mons; m && m->num != r->monitor; m = m->next); 57 | + if (m) 58 | + c->mon = m; 59 | + } 60 | + } 61 | + if (ch.res_class) 62 | + XFree(ch.res_class); 63 | + if (ch.res_name) 64 | + XFree(ch.res_name); 65 | + c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; 66 | + 67 | + // end apply rules 68 | + if (c->isfloating) 69 | + resize(c, c->x, c->y, 70 | + c->w, c->h, 0); 71 | + arrange(c->mon); 72 | +} 73 | + 74 | +void 75 | updatetitle(Client *c) 76 | { 77 | if (!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) 78 | -------------------------------------------------------------------------------- /dwm/inactive/dwm-30-taglabels-hide-inactive-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | # diff -pu dwm.git/config.def.h dwm.programtags+hidewithvacanttags/config.def.h 2 | # --- dwm/config.def.h 2021-02-27 20:04:32.030570909 -0600 3 | # +++ dwm/config.def.h 2021-03-15 16:32:37.586956549 -0500 4 | # @@ -21,6 +21,10 @@ static const char *colors[][3] = { 5 | # /* tagging */ 6 | # static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 7 | 8 | # +static const char ptagf[] = "[%s %s]"; /* format of a tag label */ 9 | # +static const char etagf[] = "[%s]"; /* format of an empty tag */ 10 | # +static const int lcaselbl = 0; /* 1 means make tag label lowercase */ 11 | # + 12 | # static const Rule rules[] = { 13 | # /* xprop(1): 14 | # * WM_CLASS(STRING) = instance, class 15 | --- dwm/dwm.c 16 | +++ dwm/dwm.c 17 | @@ -20,6 +20,7 @@ 18 | * 19 | * To understand everything else, start reading main(). 20 | */ 21 | +#include /* for tolower function, very tiny standard library */ 22 | #include 23 | #include 24 | #include 25 | @@ -352,6 +353,8 @@ 26 | int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */ 27 | }; 28 | 29 | +unsigned int tagw[LENGTH(tags)]; 30 | + 31 | /* compile-time check if all tags fit into an unsigned int bit array. */ 32 | struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; 33 | 34 | @@ -517,7 +520,7 @@ 35 | void 36 | buttonpress(XEvent *e) 37 | { 38 | - unsigned int i, x, click; 39 | + unsigned int i, x, click, occ = 0; 40 | Arg arg = {0}; 41 | Client *c; 42 | Monitor *m; 43 | @@ -532,9 +535,14 @@ 44 | } 45 | if (ev->window == selmon->barwin) { 46 | i = x = 0; 47 | - do 48 | - x += TEXTW(tags[i]); 49 | - while (ev->x >= x && ++i < LENGTH(tags)); 50 | + for (c = m->clients; c; c = c->next) 51 | + occ |= c->tags == 255 ? 0 : c->tags; 52 | + do { 53 | + /* do not reserve space for vacant tags */ 54 | + if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) 55 | + continue; 56 | + x += tagw[i]; 57 | + } while (ev->x >= x && ++i < LENGTH(tags)); 58 | if (i < LENGTH(tags)) { 59 | click = ClkTagBar; 60 | arg.ui = 1 << i; 61 | @@ -887,6 +895,8 @@ 62 | int boxw = drw->fonts->h / 6 + 2; 63 | unsigned int i, occ = 0, urg = 0; 64 | Client *c; 65 | + char tagdisp[64]; 66 | + char *masterclientontag[LENGTH(tags)]; 67 | 68 | if (!m->showbar) 69 | return; 70 | @@ -903,22 +913,45 @@ 71 | 72 | resizebarwin(m); 73 | 74 | + for (i = 0; i < LENGTH(tags); i++) 75 | + masterclientontag[i] = NULL; 76 | + 77 | for (c = m->clients; c; c = c->next) { 78 | - occ |= c->tags; 79 | + /* occ |= c->tags; */ 80 | + occ |= c->tags == 255 ? 0 : c->tags; 81 | if (c->isurgent) 82 | urg |= c->tags; 83 | + for (i = 0; i < LENGTH(tags); i++) 84 | + if (!masterclientontag[i] && c->tags & (1<win, &ch); 87 | + masterclientontag[i] = ch.res_class; 88 | + if (lcaselbl) 89 | + masterclientontag[i][0] = tolower(masterclientontag[i][0]); 90 | + } 91 | } 92 | x = 0; 93 | for (i = 0; i < LENGTH(tags); i++) { 94 | w = TEXTW(tags[i]); 95 | + /* do not draw vacant tags */ 96 | + if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) 97 | + continue; 98 | + 99 | + if (masterclientontag[i]) 100 | + snprintf(tagdisp, 64, ptagf, tags[i], masterclientontag[i]); 101 | + else 102 | + snprintf(tagdisp, 64, etagf, tags[i]); 103 | + masterclientontag[i] = tagdisp; 104 | + tagw[i] = w = TEXTW(masterclientontag[i]); 105 | drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); 106 | - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); 107 | - if (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */ 108 | - drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0); 109 | - if (occ & 1 << i) 110 | - drw_rect(drw, x + boxs, boxs, boxw, boxw, 111 | - m == selmon && selmon->sel && selmon->sel->tags & 1 << i, 112 | - urg & 1 << i); 113 | + /* drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); */ 114 | + /* if (ulineall || m->tagset[m->seltags] & 1 << i) /1* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) *1/ */ 115 | + /* drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0); */ 116 | + /* if (occ & 1 << i) */ 117 | + /* drw_rect(drw, x + boxs, boxs, boxw, boxw, */ 118 | + /* m == selmon && selmon->sel && selmon->sel->tags & 1 << i, */ 119 | + /* urg & 1 << i); */ 120 | + drw_text(drw, x, 0, w, bh, lrpad / 2, masterclientontag[i], urg & 1 << i); 121 | x += w; 122 | } 123 | w = TEXTW(m->ltsymbol); 124 | -------------------------------------------------------------------------------- /dwm/inactive/mitch-06-rounded_corners-f04cac6d6e39cd9e3fc4fae526e3d1e8df5e34b2.patch: -------------------------------------------------------------------------------- 1 | /* -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* */ 2 | /* Back by popular demand, the dwm rounded corners patch. */ 3 | /* http://github.com/mitchweaver/suckless */ 4 | /* -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* */ 5 | /* Things to know about this patch: */ 6 | /* 1. You need to add '-lXext' to the libraries linked in config.mk */ 7 | /* LIBS = -L${X11LIB} -lX11 -lXext */ 8 | /* 2. You need to set a CORNER_RADIUS integer in your config.h: */ 9 | /* static const int CORNER_RADIUS = 10; */ 10 | /* 3. You must have "borderpx = 0;" in your config.h */ 11 | /* 4. This patch assumes ALL other "OFFICIAL" and "mitch" patches have been applied. */ 12 | /* -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* */ 13 | --- dwm/dwm.c Mon Feb 24 21:41:55 2020 14 | +++ dwm/dwm.c Mon Feb 24 21:48:42 2020 15 | @@ -39,6 +39,7 @@ 16 | #ifdef XINERAMA 17 | #include 18 | #endif /* XINERAMA */ 19 | +#include 20 | #include 21 | 22 | #include "drw.h" 23 | @@ -241,6 +242,7 @@ 24 | static int xerrordummy(Display *dpy, XErrorEvent *ee); 25 | static int xerrorstart(Display *dpy, XErrorEvent *ee); 26 | static void xinitvisual(); 27 | +static void drawroundedcorners(Client *c); 28 | 29 | /* variables */ 30 | static const char broken[] = "broken"; 31 | @@ -1133,6 +1135,9 @@ 32 | unfocus(selmon->sel, 0); 33 | c->mon->sel = c; 34 | arrange(c->mon); 35 | + 36 | + drawroundedcorners(c); 37 | + 38 | XMapWindow(dpy, c->win); 39 | focus(NULL); 40 | } 41 | @@ -1337,6 +1342,55 @@ 42 | XSync(dpy, False); 43 | } 44 | 45 | +void drawroundedcorners(Client *c) { 46 | + // if set to zero in config.h, do not attempt to round 47 | + if(CORNER_RADIUS < 0) return; 48 | + 49 | + // NOTE: this is extremely hacky and surely could be optimized. 50 | + // Any X wizards out there reading this, please pull request. 51 | + if (CORNER_RADIUS > 0 && c && !c->isfullscreen) { 52 | + Window win; 53 | + win = c->win; 54 | + if(!win) return; 55 | + 56 | + XWindowAttributes win_attr; 57 | + if(!XGetWindowAttributes(dpy, win, &win_attr)) return; 58 | + 59 | + // set in config.h: 60 | + int dia = 2 * CORNER_RADIUS; 61 | + int w = c->w; 62 | + int h = c->h; 63 | + if(w < dia || h < dia) return; 64 | + 65 | + Pixmap mask; 66 | + mask = XCreatePixmap(dpy, win, w, h, 1); 67 | + if(!mask) return; 68 | + 69 | + XGCValues xgcv; 70 | + GC shape_gc; 71 | + shape_gc = XCreateGC(dpy, mask, 0, &xgcv); 72 | + 73 | + if(!shape_gc) { 74 | + XFreePixmap(dpy, mask); 75 | + free(shape_gc); 76 | + return; 77 | + } 78 | + 79 | + XSetForeground(dpy, shape_gc, 0); 80 | + XFillRectangle(dpy, mask, shape_gc, 0, 0, w, h); 81 | + XSetForeground(dpy, shape_gc, 1); 82 | + XFillArc(dpy, mask, shape_gc, 0, 0, dia, dia, 0, 23040); 83 | + XFillArc(dpy, mask, shape_gc, w-dia-1, 0, dia, dia, 0, 23040); 84 | + XFillArc(dpy, mask, shape_gc, 0, h-dia-1, dia, dia, 0, 23040); 85 | + XFillArc(dpy, mask, shape_gc, w-dia-1, h-dia-1, dia, dia, 0, 23040); 86 | + XFillRectangle(dpy, mask, shape_gc, CORNER_RADIUS, 0, w-dia, h); 87 | + XFillRectangle(dpy, mask, shape_gc, 0, CORNER_RADIUS, w, h-dia); 88 | + XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, mask, ShapeSet); 89 | + XFreePixmap(dpy, mask); 90 | + XFreeGC(dpy, shape_gc); 91 | + } 92 | +} 93 | + 94 | void 95 | resizemouse(const Arg *arg) 96 | { 97 | @@ -1393,6 +1447,9 @@ 98 | 99 | if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) 100 | resize(c, nx, ny, nw, nh, 1); 101 | + 102 | + drawroundedcorners(c); 103 | + 104 | break; 105 | } 106 | } while (ev.type != ButtonRelease); 107 | @@ -1406,6 +1463,7 @@ 108 | selmon = m; 109 | focus(NULL); 110 | } 111 | + drawroundedcorners(c); 112 | } 113 | 114 | void 115 | -------------------------------------------------------------------------------- /dwm/patches/dwm-00-center-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2 | +++ dwm/dwm.c 3 | @@ -92,7 +92,7 @@ struct Client { 4 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; 5 | int bw, oldbw; 6 | unsigned int tags; 7 | - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; 8 | + int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen; 9 | Client *next; 10 | Client *snext; 11 | Monitor *mon; 12 | @@ -137,6 +137,7 @@ typedef struct { 13 | const char *instance; 14 | const char *title; 15 | unsigned int tags; 16 | + int iscentered; 17 | int isfloating; 18 | int monitor; 19 | } Rule; 20 | @@ -296,6 +297,7 @@ applyrules(Client *c) 21 | && (!r->class || strstr(class, r->class)) 22 | && (!r->instance || strstr(instance, r->instance))) 23 | { 24 | + c->iscentered = r->iscentered; 25 | c->isfloating = r->isfloating; 26 | c->tags |= r->tags; 27 | for (m = mons; m && m->num != r->monitor; m = m->next); 28 | @@ -1063,6 +1065,11 @@ manage(Window w, XWindowAttributes *wa) 29 | && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); 30 | c->bw = borderpx; 31 | 32 | + if(c->iscentered) { 33 | + c->x = (c->mon->mw - WIDTH(c)) / 2; 34 | + c->y = (c->mon->mh - HEIGHT(c)) / 2; 35 | + } 36 | + 37 | wc.border_width = c->bw; 38 | XConfigureWindow(dpy, w, CWBorderWidth, &wc); 39 | XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->pix); 40 | -------------------------------------------------------------------------------- /dwm/patches/dwm-01-actualfullscreen-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | # diff --git a/config.def.h b/config.def.h 2 | # index 1c0b587..8cd3204 100644 3 | # --- a/config.def.h 4 | # +++ b/config.def.h 5 | # @@ -78,6 +78,7 @@ static Key keys[] = { 6 | # { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 7 | # { MODKEY, XK_space, setlayout, {0} }, 8 | # { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 9 | # + { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, 10 | # { MODKEY, XK_0, view, {.ui = ~0 } }, 11 | # { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, 12 | # { MODKEY, XK_comma, focusmon, {.i = -1 } }, 13 | diff --git dwm/dwm.1 dwm/dwm.1 14 | index 13b3729..a368d05 100644 15 | --- dwm/dwm.1 16 | +++ dwm/dwm.1 17 | @@ -116,6 +116,9 @@ Zooms/cycles focused window to/from master area (tiled layouts only). 18 | .B Mod1\-Shift\-c 19 | Close focused window. 20 | .TP 21 | +.B Mod1\-Shift\-f 22 | +Toggle fullscreen for focused window. 23 | +.TP 24 | .B Mod1\-Shift\-space 25 | Toggle focused window between tiled and floating state. 26 | .TP 27 | diff --git dwm/dwm.c dwm/dwm.c 28 | index 4465af1..c1b899a 100644 29 | --- dwm/dwm.c 30 | +++ dwm/dwm.c 31 | @@ -211,6 +211,7 @@ static void tagmon(const Arg *arg); 32 | static void tile(Monitor *); 33 | static void togglebar(const Arg *arg); 34 | static void togglefloating(const Arg *arg); 35 | +static void togglefullscr(const Arg *arg); 36 | static void toggletag(const Arg *arg); 37 | static void toggleview(const Arg *arg); 38 | static void unfocus(Client *c, int setfocus); 39 | @@ -1719,6 +1720,13 @@ togglefloating(const Arg *arg) 40 | arrange(selmon); 41 | } 42 | 43 | +void 44 | +togglefullscr(const Arg *arg) 45 | +{ 46 | + if(selmon->sel) 47 | + setfullscreen(selmon->sel, !selmon->sel->isfullscreen); 48 | +} 49 | + 50 | void 51 | toggletag(const Arg *arg) 52 | { 53 | -- 54 | 2.30.2 55 | 56 | -------------------------------------------------------------------------------- /dwm/patches/dwm-01-fullgaps-f04cac6d6e39cd9e3fc4fae526e3d1e8df5e34b2.diff: -------------------------------------------------------------------------------- 1 | --- dwm/config.def.h 2 | +++ dwm/config.def.h 3 | @@ -2,6 +2,7 @@ 4 | 5 | /* appearance */ 6 | static const unsigned int borderpx = 1; /* border pixel of windows */ 7 | +static const unsigned int gappx = 5; /* gaps between windows */ 8 | static const unsigned int snap = 32; /* snap pixel */ 9 | static const int showbar = 1; /* 0 means no bar */ 10 | static const int topbar = 1; /* 0 means bottom bar */ 11 | @@ -84,6 +85,9 @@ static Key keys[] = { 12 | { MODKEY, XK_period, focusmon, {.i = +1 } }, 13 | { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, 14 | { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, 15 | + { MODKEY, XK_minus, setgaps, {.i = -1 } }, 16 | + { MODKEY, XK_equal, setgaps, {.i = +1 } }, 17 | + { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } }, 18 | TAGKEYS( XK_1, 0) 19 | TAGKEYS( XK_2, 1) 20 | TAGKEYS( XK_3, 2) 21 | --- dwm/dwm.c 22 | +++ dwm/dwm.c 23 | @@ -119,6 +119,7 @@ struct Monitor { 24 | int by; /* bar geometry */ 25 | int mx, my, mw, mh; /* screen size */ 26 | int wx, wy, ww, wh; /* window area */ 27 | + int gappx; /* gaps between windows */ 28 | unsigned int seltags; 29 | unsigned int sellt; 30 | unsigned int tagset[2]; 31 | @@ -199,6 +200,7 @@ static void sendmon(Client *c, Monitor *m); 32 | static void setclientstate(Client *c, long state); 33 | static void setfocus(Client *c); 34 | static void setfullscreen(Client *c, int fullscreen); 35 | +static void setgaps(const Arg *arg); 36 | static void setlayout(const Arg *arg); 37 | static void setmfact(const Arg *arg); 38 | static void setup(void); 39 | @@ -638,6 +640,7 @@ createmon(void) 40 | m->nmaster = nmaster; 41 | m->showbar = showbar; 42 | m->topbar = topbar; 43 | + m->gappx = gappx; 44 | m->lt[0] = &layouts[0]; 45 | m->lt[1] = &layouts[1 % LENGTH(layouts)]; 46 | strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); 47 | @@ -1497,6 +1500,16 @@ setfullscreen(Client *c, int fullscreen) 48 | } 49 | } 50 | 51 | +void 52 | +setgaps(const Arg *arg) 53 | +{ 54 | + if ((arg->i == 0) || (selmon->gappx + arg->i < 0)) 55 | + selmon->gappx = 0; 56 | + else 57 | + selmon->gappx += arg->i; 58 | + arrange(selmon); 59 | +} 60 | + 61 | void 62 | setlayout(const Arg *arg) 63 | { 64 | @@ -1704,18 +1704,19 @@ 65 | if (n > m->nmaster) 66 | mw = m->nmaster ? m->ww * m->mfact : 0; 67 | else 68 | - mw = m->ww; 69 | - for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) 70 | + 71 | + mw = m->ww - m->gappx; 72 | + for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) 73 | if (i < m->nmaster) { 74 | - h = (m->wh - my) / (MIN(n, m->nmaster) - i); 75 | - resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); 76 | - if (my + HEIGHT(c) < m->wh) 77 | - my += HEIGHT(c); 78 | + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx; 79 | + resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0); 80 | + if (my + HEIGHT(c) + m->gappx < m->wh) 81 | + my += HEIGHT(c) + m->gappx; 82 | } else { 83 | - h = (m->wh - ty) / (n - i); 84 | - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); 85 | - if (ty + HEIGHT(c) < m->wh) 86 | - ty += HEIGHT(c); 87 | + h = (m->wh - ty) / (n - i) - m->gappx; 88 | + resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0); 89 | + if (ty + HEIGHT(c) + m->gappx < m->wh) 90 | + ty += HEIGHT(c) + m->gappx; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /dwm/patches/dwm-02-pertag-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | diff --git dwm/dwm.c dwm/dwm.c 2 | index 664c527..ac8e4ec 100644 3 | --- dwm/dwm.c 4 | +++ dwm/dwm.c 5 | @@ -111,6 +111,7 @@ typedef struct { 6 | void (*arrange)(Monitor *); 7 | } Layout; 8 | 9 | +typedef struct Pertag Pertag; 10 | struct Monitor { 11 | char ltsymbol[16]; 12 | float mfact; 13 | @@ -130,6 +131,7 @@ struct Monitor { 14 | Monitor *next; 15 | Window barwin; 16 | const Layout *lt[2]; 17 | + Pertag *pertag; 18 | }; 19 | 20 | typedef struct { 21 | @@ -272,6 +274,15 @@ static Window root, wmcheckwin; 22 | /* configuration, allows nested code to access above variables */ 23 | #include "config.h" 24 | 25 | +struct Pertag { 26 | + unsigned int curtag, prevtag; /* current and previous tag */ 27 | + int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */ 28 | + float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */ 29 | + unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */ 30 | + const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */ 31 | + int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */ 32 | +}; 33 | + 34 | /* compile-time check if all tags fit into an unsigned int bit array. */ 35 | struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; 36 | 37 | @@ -632,6 +643,7 @@ Monitor * 38 | createmon(void) 39 | { 40 | Monitor *m; 41 | + unsigned int i; 42 | 43 | m = ecalloc(1, sizeof(Monitor)); 44 | m->tagset[0] = m->tagset[1] = 1; 45 | @@ -642,6 +654,20 @@ createmon(void) 46 | m->lt[0] = &layouts[0]; 47 | m->lt[1] = &layouts[1 % LENGTH(layouts)]; 48 | strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); 49 | + m->pertag = ecalloc(1, sizeof(Pertag)); 50 | + m->pertag->curtag = m->pertag->prevtag = 1; 51 | + 52 | + for (i = 0; i <= LENGTH(tags); i++) { 53 | + m->pertag->nmasters[i] = m->nmaster; 54 | + m->pertag->mfacts[i] = m->mfact; 55 | + 56 | + m->pertag->ltidxs[i][0] = m->lt[0]; 57 | + m->pertag->ltidxs[i][1] = m->lt[1]; 58 | + m->pertag->sellts[i] = m->sellt; 59 | + 60 | + m->pertag->showbars[i] = m->showbar; 61 | + } 62 | + 63 | return m; 64 | } 65 | 66 | @@ -967,7 +993,7 @@ grabkeys(void) 67 | void 68 | incnmaster(const Arg *arg) 69 | { 70 | - selmon->nmaster = MAX(selmon->nmaster + arg->i, 0); 71 | + selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0); 72 | arrange(selmon); 73 | } 74 | 75 | @@ -1502,9 +1528,9 @@ void 76 | setlayout(const Arg *arg) 77 | { 78 | if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) 79 | - selmon->sellt ^= 1; 80 | + selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1; 81 | if (arg && arg->v) 82 | - selmon->lt[selmon->sellt] = (Layout *)arg->v; 83 | + selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v; 84 | strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); 85 | if (selmon->sel) 86 | arrange(selmon); 87 | @@ -1523,7 +1549,7 @@ setmfact(const Arg *arg) 88 | f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; 89 | if (f < 0.05 || f > 0.95) 90 | return; 91 | - selmon->mfact = f; 92 | + selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f; 93 | arrange(selmon); 94 | } 95 | 96 | @@ -1702,7 +1728,7 @@ tile(Monitor *m) 97 | void 98 | togglebar(const Arg *arg) 99 | { 100 | - selmon->showbar = !selmon->showbar; 101 | + selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar; 102 | updatebarpos(selmon); 103 | XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); 104 | arrange(selmon); 105 | @@ -1741,9 +1767,33 @@ void 106 | toggleview(const Arg *arg) 107 | { 108 | unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); 109 | + int i; 110 | 111 | if (newtagset) { 112 | selmon->tagset[selmon->seltags] = newtagset; 113 | + 114 | + if (newtagset == ~0) { 115 | + selmon->pertag->prevtag = selmon->pertag->curtag; 116 | + selmon->pertag->curtag = 0; 117 | + } 118 | + 119 | + /* test if the user did not select the same tag */ 120 | + if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) { 121 | + selmon->pertag->prevtag = selmon->pertag->curtag; 122 | + for (i = 0; !(newtagset & 1 << i); i++) ; 123 | + selmon->pertag->curtag = i + 1; 124 | + } 125 | + 126 | + /* apply settings for this view */ 127 | + selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag]; 128 | + selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag]; 129 | + selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; 130 | + selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; 131 | + selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1]; 132 | + 133 | + if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag]) 134 | + togglebar(NULL); 135 | + 136 | focus(NULL); 137 | arrange(selmon); 138 | } 139 | @@ -2038,11 +2088,37 @@ updatewmhints(Client *c) 140 | void 141 | view(const Arg *arg) 142 | { 143 | + int i; 144 | + unsigned int tmptag; 145 | + 146 | if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) 147 | return; 148 | selmon->seltags ^= 1; /* toggle sel tagset */ 149 | - if (arg->ui & TAGMASK) 150 | + if (arg->ui & TAGMASK) { 151 | selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; 152 | + selmon->pertag->prevtag = selmon->pertag->curtag; 153 | + 154 | + if (arg->ui == ~0) 155 | + selmon->pertag->curtag = 0; 156 | + else { 157 | + for (i = 0; !(arg->ui & 1 << i); i++) ; 158 | + selmon->pertag->curtag = i + 1; 159 | + } 160 | + } else { 161 | + tmptag = selmon->pertag->prevtag; 162 | + selmon->pertag->prevtag = selmon->pertag->curtag; 163 | + selmon->pertag->curtag = tmptag; 164 | + } 165 | + 166 | + selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag]; 167 | + selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag]; 168 | + selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag]; 169 | + selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt]; 170 | + selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1]; 171 | + 172 | + if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag]) 173 | + togglebar(NULL); 174 | + 175 | focus(NULL); 176 | arrange(selmon); 177 | } 178 | -------------------------------------------------------------------------------- /dwm/patches/dwm-03-resizecorners-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | diff -r -u dwm/dwm.c dwm/dwm.c 2 | --- dwm/dwm.c 2019-02-02 07:55:28.000000000 -0500 3 | +++ dwm/dwm.c 2022-01-17 22:38:33.614493243 -0500 4 | @@ -1291,9 +1291,14 @@ 5 | resizemouse(const Arg *arg) 6 | { 7 | int ocx, ocy, nw, nh; 8 | + int ocx2, ocy2, nx, ny; 9 | Client *c; 10 | Monitor *m; 11 | XEvent ev; 12 | + int horizcorner, vertcorner; 13 | + int di; 14 | + unsigned int dui; 15 | + Window dummy; 16 | Time lasttime = 0; 17 | 18 | if (!(c = selmon->sel)) 19 | @@ -1303,10 +1308,18 @@ 20 | restack(selmon); 21 | ocx = c->x; 22 | ocy = c->y; 23 | + ocx2 = c->x + c->w; 24 | + ocy2 = c->y + c->h; 25 | if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, 26 | None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) 27 | return; 28 | - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); 29 | + if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui)) 30 | + return; 31 | + horizcorner = nx < c->w / 2; 32 | + vertcorner = ny < c->h / 2; 33 | + XWarpPointer (dpy, None, c->win, 0, 0, 0, 0, 34 | + horizcorner ? (-c->bw) : (c->w + c->bw -1), 35 | + vertcorner ? (-c->bw) : (c->h + c->bw -1)); 36 | do { 37 | XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); 38 | switch(ev.type) { 39 | @@ -1320,8 +1333,11 @@ 40 | continue; 41 | lasttime = ev.xmotion.time; 42 | 43 | - nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); 44 | - nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); 45 | + nx = horizcorner ? ev.xmotion.x : c->x; 46 | + ny = vertcorner ? ev.xmotion.y : c->y; 47 | + nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1); 48 | + nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1); 49 | + 50 | if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww 51 | && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) 52 | { 53 | @@ -1330,11 +1346,13 @@ 54 | togglefloating(NULL); 55 | } 56 | if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) 57 | - resize(c, c->x, c->y, nw, nh, 1); 58 | + resize(c, nx, ny, nw, nh, 1); 59 | break; 60 | } 61 | } while (ev.type != ButtonRelease); 62 | - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); 63 | + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, 64 | + horizcorner ? (-c->bw) : (c->w + c->bw - 1), 65 | + vertcorner ? (-c->bw) : (c->h + c->bw - 1)); 66 | XUngrabPointer(dpy, CurrentTime); 67 | while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 68 | if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { 69 | -------------------------------------------------------------------------------- /dwm/patches/dwm-04-rotatestack-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2 | +++ dwm/dwm.c 3 | @@ -165,6 +165,8 @@ static void detachstack(Client *c); 4 | static Monitor *dirtomon(int dir); 5 | static void drawbar(Monitor *m); 6 | static void drawbars(void); 7 | +static void enqueue(Client *c); 8 | +static void enqueuestack(Client *c); 9 | static void enternotify(XEvent *e); 10 | static void expose(XEvent *e); 11 | static void focus(Client *c); 12 | @@ -194,6 +196,7 @@ static void resize(Client *c, int x, int y, int w, int h, int interact); 13 | static void resizeclient(Client *c, int x, int y, int w, int h); 14 | static void resizemouse(const Arg *arg); 15 | static void restack(Monitor *m); 16 | +static void rotatestack(const Arg *arg); 17 | static void run(void); 18 | static void scan(void); 19 | static int sendevent(Client *c, Atom proto); 20 | @@ -765,6 +768,28 @@ drawbars(void) 21 | } 22 | 23 | void 24 | +enqueue(Client *c) 25 | +{ 26 | + Client *l; 27 | + for (l = c->mon->clients; l && l->next; l = l->next); 28 | + if (l) { 29 | + l->next = c; 30 | + c->next = NULL; 31 | + } 32 | +} 33 | + 34 | +void 35 | +enqueuestack(Client *c) 36 | +{ 37 | + Client *l; 38 | + for (l = c->mon->stack; l && l->snext; l = l->snext); 39 | + if (l) { 40 | + l->snext = c; 41 | + c->snext = NULL; 42 | + } 43 | +} 44 | + 45 | +void 46 | enternotify(XEvent *e) 47 | { 48 | Client *c; 49 | @@ -1390,6 +1415,38 @@ restack(Monitor *m) 50 | } 51 | 52 | void 53 | +rotatestack(const Arg *arg) 54 | +{ 55 | + Client *c = NULL, *f; 56 | + 57 | + if (!selmon->sel) 58 | + return; 59 | + f = selmon->sel; 60 | + if (arg->i > 0) { 61 | + for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next)); 62 | + if (c){ 63 | + detach(c); 64 | + attach(c); 65 | + detachstack(c); 66 | + attachstack(c); 67 | + } 68 | + } else { 69 | + if ((c = nexttiled(selmon->clients))){ 70 | + detach(c); 71 | + enqueue(c); 72 | + detachstack(c); 73 | + enqueuestack(c); 74 | + } 75 | + } 76 | + if (c){ 77 | + arrange(selmon); 78 | + //unfocus(f, 1); 79 | + focus(f); 80 | + restack(selmon); 81 | + } 82 | +} 83 | + 84 | +void 85 | run(void) 86 | { 87 | XEvent ev; 88 | -------------------------------------------------------------------------------- /dwm/patches/dwm-05-savefloats-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2 | +++ dwm/dwm.c 3 | @@ -88,6 +88,7 @@ struct Client { 4 | char name[256]; 5 | float mina, maxa; 6 | int x, y, w, h; 7 | + int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */ 8 | int oldx, oldy, oldw, oldh; 9 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; 10 | int bw, oldbw; 11 | @@ -1056,6 +1057,10 @@ manage(Window w, XWindowAttributes *wa) 12 | updatewindowtype(c); 13 | updatesizehints(c); 14 | updatewmhints(c); 15 | + c->sfx = c->x; 16 | + c->sfy = c->y; 17 | + c->sfw = c->w; 18 | + c->sfh = c->h; 19 | XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); 20 | grabbuttons(c, 0); 21 | if (!c->isfloating) 22 | @@ -1714,8 +1719,16 @@ togglefloating(const Arg *arg) 23 | return; 24 | selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; 25 | if (selmon->sel->isfloating) 26 | - resize(selmon->sel, selmon->sel->x, selmon->sel->y, 27 | - selmon->sel->w, selmon->sel->h, 0); 28 | + /* restore last known float dimensions */ 29 | + resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy, 30 | + selmon->sel->sfw, selmon->sel->sfh, False); 31 | + else { 32 | + /* save last known float dimensions */ 33 | + selmon->sel->sfx = selmon->sel->x; 34 | + selmon->sel->sfy = selmon->sel->y; 35 | + selmon->sel->sfw = selmon->sel->w; 36 | + selmon->sel->sfh = selmon->sel->h; 37 | + } 38 | arrange(selmon); 39 | } 40 | -------------------------------------------------------------------------------- /dwm/patches/dwm-06-autoresize-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | diff --git dwm/dwm.c dwm/dwm.c 2 | index 0362114..e4e8514 100644 3 | --- dwm/dwm.c 4 | +++ dwm/dwm.c 5 | @@ -92,7 +92,7 @@ struct Client { 6 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; 7 | int bw, oldbw; 8 | unsigned int tags; 9 | - int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen; 10 | + int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen, needresize; 11 | Client *next; 12 | Client *snext; 13 | Monitor *mon; 14 | @@ -621,6 +621,8 @@ configurerequest(XEvent *e) 15 | configure(c); 16 | if (ISVISIBLE(c)) 17 | XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); 18 | + else 19 | + c->needresize = 1; 20 | } else 21 | configure(c); 22 | } else { 23 | @@ -1611,6 +1613,12 @@ showhide(Client *c) 24 | if (ISVISIBLE(c)) { 25 | /* show clients top down */ 26 | XMoveWindow(dpy, c->win, c->x, c->y); 27 | + if (c->needresize) { 28 | + c->needresize = 0; 29 | + XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); 30 | + } else { 31 | + XMoveWindow(dpy, c->win, c->x, c->y); 32 | + } 33 | if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) 34 | resize(c, c->x, c->y, c->w, c->h, 0); 35 | showhide(c->snext); 36 | -------------------------------------------------------------------------------- /dwm/patches/dwm-07-urgent-border-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2 | +++ dwm/dwm.c 3 | @@ -58,7 +58,7 @@ 4 | 5 | /* enums */ 6 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 7 | -enum { SchemeNorm, SchemeSel }; /* color schemes */ 8 | +enum { SchemeNorm, SchemeSel, SchemeUrg }; /* color schemes */ 9 | enum { NetSupported, NetWMName, NetWMState, NetWMCheck, 10 | NetWMFullscreen, NetActiveWindow, NetWMWindowType, 11 | NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ 12 | @@ -2222,8 +2250,11 @@ updatewmhints(Client *c) { 13 | if (c == selmon->sel && wmh->flags & XUrgencyHint) { 14 | wmh->flags &= ~XUrgencyHint; 15 | XSetWMHints(dpy, c->win, wmh); 16 | - } else 17 | + } else { 18 | c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0; 19 | + if (c->isurgent) 20 | + XSetWindowBorder(dpy, c->win, scheme[SchemeUrg][ColBorder].pixel); 21 | + } 22 | if (wmh->flags & InputHint) 23 | -------------------------------------------------------------------------------- /dwm/patches/dwm-08-underlinetags-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | # --- dwm/config.def.h 2 | # +++ dwm/config.def.h 3 | # @@ -21,6 +21,11 @@ static const char *colors[][3] = { 4 | # /* tagging */ 5 | # static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 6 | 7 | # +static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */ 8 | # +static const unsigned int ulinestroke = 2; /* thickness / height of the underline */ 9 | # +static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */ 10 | # +static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */ 11 | # + 12 | # static const Rule rules[] = { 13 | # /* xprop(1): 14 | # * WM_CLASS(STRING) = instance, class 15 | --- dwm/dwm.c 16 | +++ dwm/dwm.c 17 | @@ -719,6 +719,8 @@ drawbar(Monitor *m) 18 | w = TEXTW(tags[i]); 19 | drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); 20 | drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); 21 | + if (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */ 22 | + drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0); 23 | if (occ & 1 << i) 24 | drw_rect(drw, x + boxs, boxs, boxw, boxw, 25 | m == selmon && selmon->sel && selmon->sel->tags & 1 << i, 26 | -------------------------------------------------------------------------------- /dwm/patches/dwm-11-barpadding-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | // NOTE: remember to add to config.h: 2 | // static const int vertpad = 10; /* vertical padding of bar */ 3 | // static const int sidepad = 10; /* horizontal padding of bar */ 4 | --- dwm/dwm.c 2019-12-10 17:24:37.945708263 +1300 5 | +++ dwm/dwm.c 2019-12-10 17:41:46.192676099 +1300 6 | @@ -241,6 +241,8 @@ static int screen; 7 | static int sw, sh; /* X display screen geometry width, height */ 8 | static int bh, blw = 0; /* bar geometry */ 9 | static int lrpad; /* sum of left and right padding for text */ 10 | +static int vp; /* vertical padding for bar */ 11 | +static int sp; /* side padding for bar */ 12 | static int (*xerrorxlib)(Display *, XErrorEvent *); 13 | static unsigned int numlockmask = 0; 14 | static void (*handler[LASTEvent]) (XEvent *) = { 15 | @@ -567,7 +569,7 @@ configurenotify(XEvent *e) 16 | for (c = m->clients; c; c = c->next) 17 | if (c->isfullscreen) 18 | resizeclient(c, m->mx, m->my, m->mw, m->mh); 19 | - XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh); 20 | + XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh); 21 | } 22 | focus(NULL); 23 | arrange(NULL); 24 | @@ -705,7 +707,7 @@ drawbar(Monitor *m) 25 | if (m == selmon) { /* status is only drawn on selected monitor */ 26 | drw_setscheme(drw, scheme[SchemeNorm]); 27 | tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ 28 | - drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); 29 | + drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0); 30 | } 31 | 32 | for (c = m->clients; c; c = c->next) { 33 | @@ -731,12 +733,12 @@ drawbar(Monitor *m) 34 | if ((w = m->ww - sw - x) > bh) { 35 | if (m->sel) { 36 | drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); 37 | - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); 38 | + drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0); 39 | if (m->sel->isfloating) 40 | drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); 41 | } else { 42 | drw_setscheme(drw, scheme[SchemeNorm]); 43 | - drw_rect(drw, x, 0, w, bh, 1, 1); 44 | + drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1); 45 | } 46 | } 47 | drw_map(drw, m->barwin, 0, 0, m->ww, bh); 48 | @@ -1547,6 +1549,9 @@ setup(void) 49 | lrpad = drw->fonts->h; 50 | bh = drw->fonts->h + 2; 51 | updategeom(); 52 | + sp = sidepad; 53 | + vp = (topbar == 1) ? vertpad : - vertpad; 54 | + 55 | /* init atoms */ 56 | utf8string = XInternAtom(dpy, "UTF8_STRING", False); 57 | wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); 58 | @@ -1573,6 +1578,7 @@ setup(void) 59 | /* init bars */ 60 | updatebars(); 61 | updatestatus(); 62 | + updatebarpos(selmon); 63 | /* supporting window for NetWMCheck */ 64 | wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0); 65 | XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32, 66 | @@ -1701,7 +1707,7 @@ togglebar(const Arg *arg) 67 | { 68 | selmon->showbar = !selmon->showbar; 69 | updatebarpos(selmon); 70 | - XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); 71 | + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh); 72 | arrange(selmon); 73 | } 74 | 75 | @@ -1811,7 +1817,7 @@ updatebars(void) 76 | for (m = mons; m; m = m->next) { 77 | if (m->barwin) 78 | continue; 79 | - m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen), 80 | + m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, DefaultDepth(dpy, screen), 81 | CopyFromParent, DefaultVisual(dpy, screen), 82 | CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); 83 | XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); 84 | @@ -1826,11 +1832,11 @@ updatebarpos(Monitor *m) 85 | m->wy = m->my; 86 | m->wh = m->mh; 87 | if (m->showbar) { 88 | - m->wh -= bh; 89 | - m->by = m->topbar ? m->wy : m->wy + m->wh; 90 | - m->wy = m->topbar ? m->wy + bh : m->wy; 91 | + m->wh = m->wh - vertpad - bh; 92 | + m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad; 93 | + m->wy = m->topbar ? m->wy + bh + vp : m->wy; 94 | } else 95 | - m->by = -bh; 96 | + m->by = -bh - vp; 97 | } 98 | 99 | void 100 | -------------------------------------------------------------------------------- /dwm/patches/dwm-12-statuspadding-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | /* 2 | * http://github.com/mitchweaver/suckless 3 | * dwm-statuspadding patch, but with barpadding patch support 4 | * 5 | * --------- NOTE: ADD TO YOUR CONFIG.H: --------- 6 | * +static const int horizpadbar = 2; // horizontal padding for statusbar 7 | * +static const int vertpadbar = 0; // vertical padding for statusbar 8 | */ 9 | --- dwm/dwm.c 10 | +++ dwm/dwm.c 11 | @@ -704,8 +704,8 @@ drawbar(Monitor *m) 12 | /* draw status first so it can be overdrawn by tags later */ 13 | if (m == selmon) { /* status is only drawn on selected monitor */ 14 | drw_setscheme(drw, scheme[SchemeNorm]); 15 | - tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ 16 | - drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0); 17 | + tw = TEXTW(stext); 18 | + drw_text(drw, m->ww - tw - 2 * sp, 0, sw, bh, lrpad / 2, stext, 0); 19 | } 20 | 21 | for (c = m->clients; c; c = c->next) { 22 | @@ -1544,8 +1544,8 @@ setup(void) 23 | drw = drw_create(dpy, screen, root, sw, sh); 24 | if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) 25 | die("no fonts could be loaded."); 26 | - lrpad = drw->fonts->h; 27 | - bh = drw->fonts->h + 2; 28 | + lrpad = drw->fonts->h + horizpadbar; 29 | + bh = drw->fonts->h + vertpadbar; 30 | updategeom(); 31 | /* init atoms */ 32 | utf8string = XInternAtom(dpy, "UTF8_STRING", False); 33 | -- 34 | 2.7.4 35 | 36 | -------------------------------------------------------------------------------- /dwm/patches/dwm-13-monoclesymbol-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2 | +++ dwm/dwm.c 3 | @@ -1103,14 +1103,8 @@ maprequest(XEvent *e) 4 | void 5 | monocle(Monitor *m) 6 | { 7 | - unsigned int n = 0; 8 | Client *c; 9 | 10 | - for (c = m->clients; c; c = c->next) 11 | - if (ISVISIBLE(c)) 12 | - n++; 13 | - if (n > 0) /* override layout symbol */ 14 | - snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); 15 | for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) 16 | resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); 17 | } 18 | -------------------------------------------------------------------------------- /dwm/patches/dwm-14-statusallmons-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2 | +++ dwm/dwm.c 3 | @@ -715,7 +715,7 @@ drawbar(Monitor *m) 4 | Client *c; 5 | 6 | /* draw status first so it can be overdrawn by tags later */ 7 | - if (m == selmon) { /* status is only drawn on selected monitor */ 8 | + if (m == selmon || 1) { /* status is only drawn on selected monitor */ 9 | drw_setscheme(drw, scheme[SchemeNorm]); 10 | sw = TEXTW(stext) - lrpad / 2; /* no right padding so status text hugs the corner */ 11 | drw_text(drw, m->ww - sw, 0, sw, bh, lrpad / 2 - 2, stext, 0); 12 | @@ -1991,9 +1991,11 @@ updatetitle(Client *c) 13 | void 14 | updatestatus(void) 15 | { 16 | + Monitor* m; 17 | if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) 18 | strcpy(stext, "dwm-"VERSION); 19 | - drawbar(selmon); 20 | + for(m = mons; m; m = m->next) 21 | + drawbar(m); 22 | } 23 | 24 | void 25 | -------------------------------------------------------------------------------- /dwm/patches/dwm-15-decorhints-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | /* Remember to add to config.h: */ 2 | /* +static const int decorhints = 1; /1* 1 means respect decoration hints *1/ */ 3 | --- dwm/dwm.c 4 | +++ dwm/dwm.c 5 | @@ -57,6 +57,13 @@ 6 | #define TAGMASK ((1 << LENGTH(tags)) - 1) 7 | #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) 8 | 9 | +#define MWM_HINTS_FLAGS_FIELD 0 10 | +#define MWM_HINTS_DECORATIONS_FIELD 2 11 | +#define MWM_HINTS_DECORATIONS (1 << 1) 12 | +#define MWM_DECOR_ALL (1 << 0) 13 | +#define MWM_DECOR_BORDER (1 << 1) 14 | +#define MWM_DECOR_TITLE (1 << 3) 15 | + 16 | /* enums */ 17 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 18 | enum { SchemeNorm, SchemeSel }; /* color schemes */ 19 | @@ -220,6 +227,7 @@ static void updatebarpos(Monitor *m); 20 | static void updatebars(void); 21 | static void updateclientlist(void); 22 | static int updategeom(void); 23 | +static void updatemotifhints(Client *c); 24 | static void updatenumlockmask(void); 25 | static void updatesizehints(Client *c); 26 | static void updatestatus(void); 27 | @@ -259,7 +267,7 @@ static void (*handler[LASTEvent]) (XEvent *) = { 28 | [PropertyNotify] = propertynotify, 29 | [UnmapNotify] = unmapnotify 30 | }; 31 | -static Atom wmatom[WMLast], netatom[NetLast]; 32 | +static Atom wmatom[WMLast], netatom[NetLast], motifatom; 33 | static int running = 1; 34 | static Cur *cursor[CurLast]; 35 | static Clr **scheme; 36 | @@ -1155,6 +1155,7 @@ 37 | updatewindowtype(c); 38 | updatesizehints(c); 39 | updatewmhints(c); 40 | + updatemotifhints(c); 41 | c->sfx = c->x; 42 | c->sfy = c->y; 43 | c->sfw = c->w; 44 | @@ -1242,6 +1251,8 @@ propertynotify(XEvent *e) 45 | } 46 | if (ev->atom == netatom[NetWMWindowType]) 47 | updatewindowtype(c); 48 | + if (ev->atom == motifatom) 49 | + updatemotifhints(c); 50 | } 51 | } 52 | 53 | @@ -1562,6 +1573,7 @@ setup(void) 54 | netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); 55 | netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); 56 | netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); 57 | + motifatom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False); 58 | netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); 59 | netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); 60 | netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); 61 | @@ -1925,6 +1937,39 @@ updategeom(void) 62 | return dirty; 63 | } 64 | 65 | +void 66 | +updatemotifhints(Client *c) 67 | +{ 68 | + Atom real; 69 | + int format; 70 | + unsigned char *p = NULL; 71 | + unsigned long n, extra; 72 | + unsigned long *motif; 73 | + int width, height; 74 | + 75 | + if (!decorhints) 76 | + return; 77 | + 78 | + if (XGetWindowProperty(dpy, c->win, motifatom, 0L, 5L, False, motifatom, 79 | + &real, &format, &n, &extra, &p) == Success && p != NULL) { 80 | + motif = (unsigned long*)p; 81 | + if (motif[MWM_HINTS_FLAGS_FIELD] & MWM_HINTS_DECORATIONS) { 82 | + width = WIDTH(c); 83 | + height = HEIGHT(c); 84 | + 85 | + if (motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_ALL || 86 | + motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_BORDER || 87 | + motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_TITLE) 88 | + c->bw = c->oldbw = borderpx; 89 | + else 90 | + c->bw = c->oldbw = 0; 91 | + 92 | + resize(c, c->x, c->y, width - (2*c->bw), height - (2*c->bw), 0); 93 | + } 94 | + XFree(p); 95 | + } 96 | +} 97 | + 98 | void 99 | updatenumlockmask(void) 100 | { 101 | -- 102 | 103 | -------------------------------------------------------------------------------- /dwm/patches/dwm-16-unicode_ellipsis-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | diff --git a/drw.c b/drw.c 2 | index ced7d37..95da860 100644 3 | --- dwm/drw.c 4 | +++ dwm/drw.c 5 | @@ -285,7 +285,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp 6 | 7 | usedfont = drw->fonts; 8 | if (!ellipsis_width && render) 9 | - ellipsis_width = drw_fontset_getwidth(drw, "..."); 10 | + ellipsis_width = drw_fontset_getwidth(drw, "…"); 11 | while (1) { 12 | ew = ellipsis_len = utf8strlen = 0; 13 | utf8str = text; 14 | @@ -339,7 +339,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp 15 | w -= ew; 16 | } 17 | if (render && overflow) 18 | - drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert); 19 | + drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "…", invert); 20 | 21 | if (!*text || overflow) { 22 | break; 23 | -------------------------------------------------------------------------------- /dwm/patches/dwm-17-sticky-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2023-05-07 22:41:25.388362593 -0500 2 | +++ dwm/dwm.c 2023-05-07 22:46:19.660481655 -0500 3 | @@ -50,7 +50,7 @@ 4 | #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) 5 | #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ 6 | * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) 7 | -#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) 8 | +#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky) 9 | #define LENGTH(X) (sizeof X / sizeof X[0]) 10 | #define MOUSEMASK (BUTTONMASK|PointerMotionMask) 11 | #define WIDTH(X) ((X)->w + 2 * (X)->bw) 12 | @@ -84,7 +84,7 @@ 13 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 14 | enum { SchemeNorm, SchemeSel, SchemeUrg }; /* color schemes */ 15 | enum { NetSupported, NetWMName, NetWMState, NetWMCheck, 16 | - NetWMFullscreen, NetActiveWindow, NetWMWindowType, 17 | + NetWMFullscreen, NetWMSticky, NetActiveWindow, NetWMWindowType, 18 | NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ 19 | enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ 20 | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, 21 | @@ -116,7 +116,7 @@ 22 | int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; 23 | int bw, oldbw; 24 | unsigned int tags; 25 | - int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen, needresize; 26 | + int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen, needresize, issticky; 27 | Client *next; 28 | Client *snext; 29 | Monitor *mon; 30 | @@ -232,6 +232,7 @@ 31 | static void setfocus(Client *c); 32 | static void setfullscreen(Client *c, int fullscreen); 33 | static void setlayout(const Arg *arg); 34 | +static void setsticky(Client *c, int sticky); 35 | static void setmfact(const Arg *arg); 36 | static void setup(void); 37 | static void seturgent(Client *c, int urg); 38 | @@ -242,6 +243,7 @@ 39 | static void tile(Monitor *m); 40 | static void togglebar(const Arg *arg); 41 | static void togglefloating(const Arg *arg); 42 | +static void togglesticky(const Arg *arg); 43 | static void togglefullscr(const Arg *arg); 44 | static void toggletag(const Arg *arg); 45 | static void toggleview(const Arg *arg); 46 | @@ -571,6 +573,9 @@ 47 | || cme->data.l[2] == netatom[NetWMFullscreen]) 48 | setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ 49 | || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); 50 | + if (cme->data.l[1] == netatom[NetWMSticky] 51 | + || cme->data.l[2] == netatom[NetWMSticky]) 52 | + setsticky(c, (cme->data.l[0] == 1 || (cme->data.l[0] == 2 && !c->issticky))); 53 | } else if (cme->message_type == netatom[NetActiveWindow]) { 54 | if (c != selmon->sel && !c->isurgent) 55 | seturgent(c, 1); 56 | @@ -1664,6 +1669,22 @@ 57 | } 58 | 59 | void 60 | +setsticky(Client *c, int sticky) 61 | +{ 62 | + 63 | + if(sticky && !c->issticky) { 64 | + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, 65 | + PropModeReplace, (unsigned char *) &netatom[NetWMSticky], 1); 66 | + c->issticky = 1; 67 | + } else if(!sticky && c->issticky){ 68 | + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, 69 | + PropModeReplace, (unsigned char *)0, 0); 70 | + c->issticky = 0; 71 | + arrange(c->mon); 72 | + } 73 | +} 74 | + 75 | +void 76 | setlayout(const Arg *arg) 77 | { 78 | if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) 79 | @@ -1736,6 +1757,7 @@ 80 | netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); 81 | netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); 82 | netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); 83 | + netatom[NetWMSticky] = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False); 84 | netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); 85 | netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); 86 | netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); 87 | @@ -1916,6 +1938,15 @@ 88 | } 89 | 90 | void 91 | +togglesticky(const Arg *arg) 92 | +{ 93 | + if (!selmon->sel) 94 | + return; 95 | + setsticky(selmon->sel, !selmon->sel->issticky); 96 | + arrange(selmon); 97 | +} 98 | + 99 | +void 100 | toggletag(const Arg *arg) 101 | { 102 | unsigned int newtags; 103 | @@ -2266,6 +2297,9 @@ 104 | 105 | if (state == netatom[NetWMFullscreen]) 106 | setfullscreen(c, 1); 107 | + if (state == netatom[NetWMSticky]) { 108 | + setsticky(c, 1); 109 | + } 110 | if (wtype == netatom[NetWMWindowTypeDialog]) 111 | c->isfloating = 1; 112 | } 113 | -------------------------------------------------------------------------------- /dwm/patches/dwm-18-stickyindicator-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | # diff -pu dwm.stickypatch/config.def.h dwm.stickyindicator/config.def.h 2 | # --- dwm.stickypatch/config.def.h 2021-02-28 23:51:25.118904642 -0600 3 | # +++ dwm.stickyindicator/config.def.h 2021-03-15 20:19:53.533323727 -0500 4 | # @@ -17,6 +17,8 @@ static const char *colors[][3] = { 5 | # [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 6 | # [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 7 | # }; 8 | # +static const XPoint stickyicon[] = { {0,0}, {4,0}, {4,8}, {2,6}, {0,8}, {0,0} }; /* represents the icon as an array of vertices */ 9 | # +static const XPoint stickyiconbb = {4,8}; /* defines the bottom right corner of the polygon's bounding box (speeds up scaling) */ 10 | 11 | # /* tagging */ 12 | # static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 13 | diff -pu dwm.stickypatch/drw.c dwm.stickyindicator/drw.c 14 | --- dwm/drw.c 2021-02-28 23:51:06.992237482 -0600 15 | +++ dwm/drw.c 2021-03-15 20:19:19.499990633 -0500 16 | @@ -248,6 +248,26 @@ drw_rect(Drw *drw, int x, int y, unsigne 17 | XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1); 18 | } 19 | 20 | +void 21 | +drw_polygon(Drw *drw, int x, int y, int ow, int oh, int sw, int sh, const XPoint *points, int npoints, int shape, int filled) /* wrapper function to scale and draw a polygon with X11 */ 22 | +{ 23 | + if (!drw || !drw->scheme) 24 | + return; 25 | + XSetForeground(drw->dpy, drw->gc, drw->scheme[ColFg].pixel); 26 | + if (!filled) { /* reduces the scaled width and height by 1 when drawing the outline to compensate for X11 drawing the line 1 pixel over */ 27 | + sw -= 1; 28 | + sh -= 1; 29 | + } 30 | + XPoint scaledpoints[npoints]; 31 | + memcpy(scaledpoints, points, npoints); 32 | + for (int v = 0; v < npoints; v++) 33 | + scaledpoints[v] = (XPoint){ .x = points[v].x * sw / ow + x, .y = points[v].y * sh / oh + y }; 34 | + if (filled) 35 | + XFillPolygon(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, shape, CoordModeOrigin); /* Change shape to 'Convex' or 'Complex' in dwm.c if the shape is not 'Nonconvex' */ 36 | + else 37 | + XDrawLines(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, CoordModeOrigin); 38 | +} 39 | + 40 | int 41 | drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert) 42 | { 43 | diff -pu dwm.stickypatch/drw.h dwm.stickyindicator/drw.h 44 | --- dwm/drw.h 2021-02-28 23:51:06.992237482 -0600 45 | +++ dwm/drw.h 2021-03-01 01:34:02.739074730 -0600 46 | @@ -51,6 +51,7 @@ void drw_setscheme(Drw *drw, Clr *scm); 47 | 48 | /* Drawing functions */ 49 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); 50 | +void drw_polygon(Drw *drw, int x, int y, int ow, int oh, int sw, int sh, const XPoint *points, int npoints, int shape, int filled); 51 | int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); 52 | 53 | /* Map functions */ 54 | diff -pu dwm.stickypatch/dwm.c dwm.stickyindicator/dwm.c 55 | --- dwm/dwm.c 2021-02-28 23:51:25.118904642 -0600 56 | +++ dwm/dwm.c 2021-03-15 20:12:32.063326766 -0500 57 | @@ -736,6 +736,8 @@ drawbar(Monitor *m) 58 | drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); 59 | if (m->sel->isfloating) 60 | drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); 61 | + if (m->sel->issticky) 62 | + drw_polygon(drw, x + boxs, m->sel->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, boxw * stickyiconbb.y / stickyiconbb.x, stickyicon, LENGTH(stickyicon), Nonconvex, m->sel->tags & m->tagset[m->seltags]); 63 | } else { 64 | drw_setscheme(drw, scheme[SchemeNorm]); 65 | drw_rect(drw, x, 0, w, bh, 1, 1); 66 | -------------------------------------------------------------------------------- /dwm/patches/dwm-19-steam-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | From 2550931c66e10e667ce56a6761cbadd12b331c52 Mon Sep 17 00:00:00 2001 2 | From: bakkeby 3 | Date: Mon, 10 Aug 2020 16:45:00 +0200 4 | Subject: [PATCH] Steam patch 5 | 6 | Steam, and steam windows (games), trigger a ConfigureNotify request every time the window 7 | gets focus. More so, the configure event passed along from Steam tends to have the wrong 8 | x and y coordinates which can make the window, if floating, jump around the screen. 9 | 10 | This patch works around this age-old issue by ignoring the x and y co-ordinates for 11 | ConfigureNotify requests relating to Steam windows. 12 | --- 13 | dwm.c | 20 +++++++++++++------- 14 | 1 file changed, 13 insertions(+), 7 deletions(-) 15 | 16 | diff --git dwm/dwm.c dwm/dwm.c 17 | index 4465af1..598d36d 100644 18 | --- dwm/dwm.c 19 | +++ dwm/dwm.c 20 | @@ -93,6 +93,7 @@ struct Client { 21 | int bw, oldbw; 22 | unsigned int tags; 23 | int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen, needresize, issticky; 24 | + int issteam; 25 | Client *next; 26 | Client *snext; 27 | Monitor *mon; 28 | @@ -291,6 +292,9 @@ applyrules(Client *c) 29 | class = ch.res_class ? ch.res_class : broken; 30 | instance = ch.res_name ? ch.res_name : broken; 31 | 32 | + if (strstr(class, "Steam") || strstr(class, "steam_app_")) 33 | + c->issteam = 1; 34 | + 35 | for (i = 0; i < LENGTH(rules); i++) { 36 | r = &rules[i]; 37 | if ((!r->title || strstr(c->name, r->title)) 38 | @@ -588,13 +592,15 @@ configurerequest(XEvent *e) 39 | c->bw = ev->border_width; 40 | else if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) { 41 | m = c->mon; 42 | - if (ev->value_mask & CWX) { 43 | - c->oldx = c->x; 44 | - c->x = m->mx + ev->x; 45 | - } 46 | - if (ev->value_mask & CWY) { 47 | - c->oldy = c->y; 48 | - c->y = m->my + ev->y; 49 | + if (!c->issteam) { 50 | + if (ev->value_mask & CWX) { 51 | + c->oldx = c->x; 52 | + c->x = m->mx + ev->x; 53 | + } 54 | + if (ev->value_mask & CWY) { 55 | + c->oldy = c->y; 56 | + c->y = m->my + ev->y; 57 | + } 58 | } 59 | if (ev->value_mask & CWWidth) { 60 | c->oldw = c->w; 61 | -- 62 | 2.19.1 63 | 64 | -------------------------------------------------------------------------------- /dwm/patches/dwm-20-ewmhtags-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm 2023-05-07 23:21:48.526656251 -0500 2 | +++ dwm/dwm.c 2023-05-07 23:24:30.069524719 -0500 3 | @@ -56,6 +56,7 @@ 4 | #define WIDTH(X) ((X)->w + 2 * (X)->bw) 5 | #define HEIGHT(X) ((X)->h + 2 * (X)->bw) 6 | #define TAGMASK ((1 << LENGTH(tags)) - 1) 7 | +#define TAGSLENGTH (LENGTH(tags)) 8 | #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) 9 | #define XRDB_LOAD_COLOR(R,V) if (XrmGetResource(xrdb, R, NULL, &type, &value) == True) { \ 10 | if (value.addr != NULL && strnlen(value.addr, 8) == 7 && value.addr[0] == '#') { \ 11 | @@ -85,7 +86,7 @@ 12 | enum { SchemeNorm, SchemeSel, SchemeUrg }; /* color schemes */ 13 | enum { NetSupported, NetWMName, NetWMState, NetWMCheck, 14 | NetWMFullscreen, NetWMSticky, NetActiveWindow, NetWMWindowType, 15 | - NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ 16 | + NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */ 17 | enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ 18 | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, 19 | ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ 20 | @@ -231,6 +232,8 @@ 21 | static int sendevent(Client *c, Atom proto); 22 | static void sendmon(Client *c, Monitor *m); 23 | static void setclientstate(Client *c, long state); 24 | +static void setcurrentdesktop(void); 25 | +static void setdesktopnames(void); 26 | static void setfocus(Client *c); 27 | static void setfullscreen(Client *c, int fullscreen); 28 | static void setgaps(const Arg *arg); 29 | @@ -238,6 +241,8 @@ 30 | static void setsticky(Client *c, int sticky); 31 | static void setmfact(const Arg *arg); 32 | static void setup(void); 33 | +static void setnumdesktops(void); 34 | +static void setviewport(void); 35 | static void seturgent(Client *c, int urg); 36 | static void showhide(Client *c); 37 | static void spawn(const Arg *arg); 38 | @@ -253,6 +258,7 @@ 39 | static void unfocus(Client *c, int setfocus); 40 | static void unmanage(Client *c, int destroyed); 41 | static void unmapnotify(XEvent *e); 42 | +static void updatecurrentdesktop(void); 43 | static void updatebarpos(Monitor *m); 44 | static void updatebars(void); 45 | static void updateclientlist(void); 46 | @@ -1614,6 +1620,23 @@ 47 | PropModeReplace, (unsigned char *)data, 2); 48 | } 49 | 50 | +void 51 | +setcurrentdesktop(void){ 52 | + long data[] = { 0 }; 53 | + XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); 54 | +} 55 | +void setdesktopnames(void){ 56 | + XTextProperty text; 57 | + Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH, XUTF8StringStyle, &text); 58 | + XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]); 59 | +} 60 | + 61 | +void 62 | +setnumdesktops(void){ 63 | + long data[] = { TAGSLENGTH }; 64 | + XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); 65 | +} 66 | + 67 | int 68 | sendevent(Client *c, Atom proto) 69 | { 70 | @@ -1782,6 +1805,10 @@ 71 | netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); 72 | netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); 73 | netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); 74 | + netatom[NetDesktopViewport] = XInternAtom(dpy, "_NET_DESKTOP_VIEWPORT", False); 75 | + netatom[NetNumberOfDesktops] = XInternAtom(dpy, "_NET_NUMBER_OF_DESKTOPS", False); 76 | + netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False); 77 | + netatom[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES", False); 78 | /* init cursors */ 79 | cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); 80 | cursor[CurResize] = drw_cur_create(drw, XC_sizing); 81 | @@ -1805,6 +1832,10 @@ 82 | /* EWMH support per view */ 83 | XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, 84 | PropModeReplace, (unsigned char *) netatom, NetLast); 85 | + setnumdesktops(); 86 | + setcurrentdesktop(); 87 | + setdesktopnames(); 88 | + setviewport(); 89 | XDeleteProperty(dpy, root, netatom[NetClientList]); 90 | /* select events */ 91 | wa.cursor = cursor[CurNormal]->cursor; 92 | @@ -1855,6 +1886,12 @@ 93 | } 94 | 95 | void 96 | +setviewport(void){ 97 | + long data[] = { 0, 0 }; 98 | + XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2); 99 | +} 100 | + 101 | +void 102 | spawn(const Arg *arg) 103 | { 104 | struct sigaction sa; 105 | @@ -1981,6 +2018,7 @@ 106 | focus(NULL); 107 | arrange(selmon); 108 | } 109 | + updatecurrentdesktop(); 110 | } 111 | 112 | void 113 | @@ -2017,6 +2055,17 @@ 114 | focus(NULL); 115 | arrange(selmon); 116 | } 117 | + updatecurrentdesktop(); 118 | +} 119 | + 120 | +void updatecurrentdesktop(void){ 121 | + long rawdata[] = { selmon->tagset[selmon->seltags] }; 122 | + int i=0; 123 | + while(*rawdata >> i+1){ 124 | + i++; 125 | + } 126 | + long data[] = { i }; 127 | + XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); 128 | } 129 | 130 | void 131 | @@ -2384,6 +2433,7 @@ 132 | 133 | focus(NULL); 134 | arrange(selmon); 135 | + updatecurrentdesktop(); 136 | } 137 | 138 | Client * 139 | -------------------------------------------------------------------------------- /dwm/patches/dwm-21-noborderflicker-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | diff --git dwm.c dwm.c 2 | index a96f33c..34d1321 100644 3 | --- dwm/dwm.c 4 | +++ dwm/dwm.c 5 | @@ -236,6 +236,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); 6 | static void zoom(const Arg *arg); 7 | 8 | /* variables */ 9 | +static Client *lastfocused = NULL; 10 | static const char broken[] = "broken"; 11 | static char stext[256]; 12 | static int screen; 13 | @@ -799,7 +800,11 @@ focus(Client *c) 14 | detachstack(c); 15 | attachstack(c); 16 | grabbuttons(c, 1); 17 | + /* set new focused border first to avoid flickering */ 18 | XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); 19 | + /* lastfocused may be us if another window was unmanaged */ 20 | + if (lastfocused && lastfocused != c) 21 | + XSetWindowBorder(dpy, lastfocused->win, scheme[SchemeNorm][ColBorder].pixel); 22 | setfocus(c); 23 | } else { 24 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 25 | @@ -1758,7 +1763,7 @@ unfocus(Client *c, int setfocus) 26 | if (!c) 27 | return; 28 | grabbuttons(c, 0); 29 | - XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); 30 | + lastfocused = c; 31 | if (setfocus) { 32 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 33 | XDeleteProperty(dpy, root, netatom[NetActiveWindow]); 34 | @@ -1784,6 +1789,8 @@ unmanage(Client *c, int destroyed) 35 | XSetErrorHandler(xerror); 36 | XUngrabServer(dpy); 37 | } 38 | + if (lastfocused == c) 39 | + lastfocused = NULL; 40 | free(c); 41 | focus(NULL); 42 | updateclientlist(); 43 | -------------------------------------------------------------------------------- /dwm/patches/dwm-22-removeborder-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | diff --git a/dwm.c b/dwm.c 2 | index 5646a5c..27e29df 100644 3 | --- dwm/dwm.c 4 | +++ dwm/dwm.c 5 | @@ -1283,12 +1283,26 @@ void 6 | resizeclient(Client *c, int x, int y, int w, int h) 7 | { 8 | XWindowChanges wc; 9 | + unsigned int n; 10 | + Client *nbc; 11 | 12 | c->oldx = c->x; c->x = wc.x = x; 13 | c->oldy = c->y; c->y = wc.y = y; 14 | c->oldw = c->w; c->w = wc.width = w; 15 | c->oldh = c->h; c->h = wc.height = h; 16 | wc.border_width = c->bw; 17 | + 18 | + for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++); 19 | + 20 | + if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) { 21 | + } else { 22 | + if (c->mon->lt[c->mon->sellt]->arrange == monocle || n == 1) { 23 | + wc.border_width = 0; 24 | + c->w = wc.width += c->bw * 2; 25 | + c->h = wc.height += c->bw * 2; 26 | + } 27 | + } 28 | + 29 | XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); 30 | configure(c); 31 | XSync(dpy, False); 32 | -------------------------------------------------------------------------------- /dwm/patches/dwm-24-columngaps-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | From f0792e4daf566be0304aad18e43d16c044844f16 Mon Sep 17 00:00:00 2001 2 | From: Georgios Oxinos 3 | Date: Sun, 24 Jan 2021 16:38:28 +0100 4 | Subject: [PATCH] [dwm][patch] patch that adds gaps to column layout 5 | 6 | --- 7 | config.def.h | 3 +++ 8 | dwm.c | 29 +++++++++++++++++++++++++++++ 9 | 2 files changed, 32 insertions(+) 10 | 11 | diff --git a/dwm.c b/dwm.c 12 | index 4465af1..e72e00a 100644 13 | --- dwm/dwm.c 14 | +++ dwm/dwm.c 15 | @@ -1670,6 +1670,35 @@ tagmon(const Arg *arg) 16 | sendmon(selmon->sel, dirtomon(arg->i)); 17 | } 18 | 19 | +void 20 | +col(Monitor *m) { 21 | + unsigned int i, n, h, w, x, y, mw; 22 | + Client *c; 23 | + 24 | + for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); 25 | + if(n == 0) 26 | + return; 27 | + 28 | + if(n > m->nmaster) 29 | + mw = m->nmaster ? m->ww * m->mfact : 0; 30 | + else 31 | + mw = m->ww - m->gappx; 32 | + 33 | + for(i = 0, x = y = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { 34 | + if(i < m->nmaster) { 35 | + w = (mw - x) / (MIN(n, m->nmaster) - i); 36 | + resize(c, x + m->wx, m->wy + m->gappx, w - (2*c->bw), m->wh - (2*c->bw) - 2*m->gappx, False); 37 | + if (x + WIDTH(c) + m->gappx < m->ww) 38 | + x += WIDTH(c) + m->gappx; 39 | + } else { 40 | + h = (m->wh - y) / (n - i) - m->gappx; 41 | + resize(c, x + m->wx, m->wy + y, m->ww - x - (2*c->bw) - m->gappx, h - (2*c->bw), False); 42 | + if (y + HEIGHT(c) + m->gappx < m->wh) 43 | + y += HEIGHT(c) + m->gappx; 44 | + } 45 | + } 46 | +} 47 | + 48 | void 49 | tile(Monitor *m) 50 | { 51 | -- 52 | 2.27.0 53 | 54 | -------------------------------------------------------------------------------- /dwm/patches/dwm-25-attachabove-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | diff --git a/local/src/dwm/dwm.c b/local/src/dwm/dwm.c 2 | index 83e44e0..94392b4 100644 3 | --- dwm/dwm.c 4 | +++ dwm/dwm.c 5 | @@ -164,6 +164,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac 6 | static void arrange(Monitor *m); 7 | static void arrangemon(Monitor *m); 8 | static void attach(Client *c); 9 | +static void attachabove(Client *c); 10 | static void attachstack(Client *c); 11 | static void buttonpress(XEvent *e); 12 | static void checkotherwm(void); 13 | @@ -431,6 +432,20 @@ attach(Client *c) 14 | c->mon->clients = c; 15 | } 16 | 17 | +void 18 | +attachabove(Client *c) 19 | +{ 20 | + if (c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating) { 21 | + attach(c); 22 | + return; 23 | + } 24 | + 25 | + Client *at; 26 | + for (at = c->mon->clients; at->next != c->mon->sel; at = at->next); 27 | + c->next = at->next; 28 | + at->next = c; 29 | +} 30 | + 31 | void 32 | attachstack(Client *c) 33 | { 34 | @@ -1272,7 +1287,7 @@ manage(Window w, XWindowAttributes *wa) 35 | c->isfloating = c->oldstate = trans != None || c->isfixed; 36 | if (c->isfloating) 37 | XRaiseWindow(dpy, c->win); 38 | - attach(c); 39 | + attachabove(c); 40 | attachstack(c); 41 | XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, 42 | (unsigned char *) &(c->win), 1); 43 | @@ -1633,7 +1648,7 @@ sendmon(Client *c, Monitor *m) 44 | detachstack(c); 45 | c->mon = m; 46 | c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ 47 | - attach(c); 48 | + attachabove(c); 49 | attachstack(c); 50 | focus(NULL); 51 | arrange(NULL); 52 | @@ -2122,7 +2137,7 @@ updategeom(void) 53 | m->clients = c->next; 54 | detachstack(c); 55 | c->mon = mons; 56 | - attach(c); 57 | + attachabove(c); 58 | attachstack(c); 59 | } 60 | if (m == selmon) 61 | -------------------------------------------------------------------------------- /dwm/patches/dwm-26-notitle-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2023-05-09 23:26:36.147295961 -0500 2 | +++ dwm/dwm.c 2023-05-09 23:29:33.863881483 -0500 3 | @@ -72,8 +72,8 @@ 4 | NetWMFullscreen, NetWMSticky, NetActiveWindow, NetWMWindowType, 5 | NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */ 6 | enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ 7 | -enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, 8 | - ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ 9 | +enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin, ClkWinTitle, 10 | + ClkRootWin, ClkLast }; /* clicks */ 11 | 12 | typedef union { 13 | int i; 14 | @@ -806,17 +806,8 @@ 15 | x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); 16 | 17 | if ((w = m->ww - tw - x) > bh) { 18 | - if (m->sel) { 19 | - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); 20 | - drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0); 21 | - if (m->sel->isfloating) 22 | - drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); 23 | - if (m->sel->issticky) 24 | - drw_polygon(drw, x + boxs, m->sel->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, boxw * stickyiconbb.y / stickyiconbb.x, stickyicon, LENGTH(stickyicon), Nonconvex, m->sel->tags & m->tagset[m->seltags]); 25 | - } else { 26 | - drw_setscheme(drw, scheme[SchemeNorm]); 27 | - drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1); 28 | - } 29 | + drw_setscheme(drw, scheme[SchemeNorm]); 30 | + drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1); 31 | } 32 | drw_map(drw, m->barwin, 0, 0, m->ww, bh); 33 | } 34 | @@ -1337,11 +1328,8 @@ 35 | drawbars(); 36 | break; 37 | } 38 | - if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { 39 | + if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) 40 | updatetitle(c); 41 | - if (c == c->mon->sel) 42 | - drawbar(c->mon); 43 | - } 44 | if (ev->atom == netatom[NetWMWindowType]) 45 | updatewindowtype(c); 46 | if (ev->atom == motifatom) 47 | -------------------------------------------------------------------------------- /dwm/patches/dwm-28-resizeable-borders-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2023-05-10 00:28:47.332302706 -0500 2 | +++ dwm/dwm.c 2023-05-10 00:33:32.888841481 -0500 3 | @@ -119,6 +119,7 @@ struct Monitor { 4 | int mx, my, mw, mh; /* screen size */ 5 | int wx, wy, ww, wh; /* window area */ 6 | int gappx; /* gaps between windows */ 7 | + unsigned int borderpx; 8 | unsigned int seltags; 9 | unsigned int sellt; 10 | unsigned int tagset[2]; 11 | @@ -217,6 +217,7 @@ 12 | static void scan(void); 13 | static int sendevent(Client *c, Atom proto); 14 | static void sendmon(Client *c, Monitor *m); 15 | +static void setborderpx(const Arg *arg); 16 | static void setclientstate(Client *c, long state); 17 | static void setcurrentdesktop(void); 18 | static void setdesktopnames(void); 19 | @@ -717,6 +718,7 @@ 20 | m->nmaster = nmaster; 21 | m->showbar = showbar; 22 | m->topbar = topbar; 23 | + m->borderpx = borderpx; 24 | m->gappx = gappx; 25 | m->lt[0] = &layouts[0]; 26 | m->lt[1] = &layouts[1 % LENGTH(layouts)]; 27 | @@ -1156,7 +1158,7 @@ 28 | c->y = c->mon->wy + c->mon->wh - HEIGHT(c); 29 | c->x = MAX(c->x, c->mon->wx); 30 | c->y = MAX(c->y, c->mon->wy); 31 | - c->bw = borderpx; 32 | + c->bw = c->mon->borderpx; 33 | 34 | if(c->iscentered) { 35 | c->x = (c->mon->mw - WIDTH(c)) / 2; 36 | @@ -1580,6 +1582,40 @@ 37 | } 38 | 39 | void 40 | +setborderpx(const Arg *arg) 41 | +{ 42 | + Client *c; 43 | + int prev_borderpx = selmon->borderpx; 44 | + 45 | + if (arg->i == 0) 46 | + selmon->borderpx = borderpx; 47 | + else if (selmon->borderpx + arg->i < 0) 48 | + selmon->borderpx = 0; 49 | + else 50 | + selmon->borderpx += arg->i; 51 | + 52 | + for (c = selmon->clients; c; c = c->next) 53 | + { 54 | + if (c->bw + arg->i < 0) 55 | + c->bw = selmon->borderpx = 0; 56 | + else 57 | + c->bw = selmon->borderpx; 58 | + if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) 59 | + { 60 | + if (arg->i != 0 && prev_borderpx + arg->i >= 0) 61 | + resize(c, c->x, c->y, c->w-(arg->i*2), c->h-(arg->i*2), 0); 62 | + else if (arg->i != 0) 63 | + resizeclient(c, c->x, c->y, c->w, c->h); 64 | + else if (prev_borderpx > borderpx) 65 | + resize(c, c->x, c->y, c->w + 2*(prev_borderpx - borderpx), c->h + 2*(prev_borderpx - borderpx), 0); 66 | + else if (prev_borderpx < borderpx) 67 | + resize(c, c->x, c->y, c->w-2*(borderpx - prev_borderpx), c->h-2*(borderpx - prev_borderpx), 0); 68 | + } 69 | + } 70 | + arrange(selmon); 71 | +} 72 | + 73 | +void 74 | setclientstate(Client *c, long state) 75 | { 76 | long data[] = { state, None }; 77 | -------------------------------------------------------------------------------- /dwm/patches/dwm-30-hide_vacant_tags-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2 | +++ dwm/dwm.c 3 | @@ -532,9 +532,15 @@ 4 | } 5 | if (ev->window == selmon->barwin) { 6 | i = x = 0; 7 | - do 8 | + unsigned int occ = 0; 9 | + for(c = m->clients; c; c=c->next) 10 | + occ |= c->tags; 11 | + do { 12 | + /* Do not reserve space for vacant tags */ 13 | + if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) 14 | + continue; 15 | x += TEXTW(tags[i]); 16 | - while (ev->x >= x && ++i < LENGTH(tags)); 17 | + } while (ev->x >= x && ++i < LENGTH(tags)); 18 | if (i < LENGTH(tags)) { 19 | click = ClkTagBar; 20 | arg.ui = 1 << i; 21 | @@ -910,15 +916,18 @@ 22 | } 23 | x = 0; 24 | for (i = 0; i < LENGTH(tags); i++) { 25 | + /* Do not draw vacant tags */ 26 | + if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) 27 | + continue; 28 | w = TEXTW(tags[i]); 29 | drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); 30 | drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); 31 | if (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */ 32 | drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0); 33 | - if (occ & 1 << i) 34 | - drw_rect(drw, x + boxs, boxs, boxw, boxw, 35 | - m == selmon && selmon->sel && selmon->sel->tags & 1 << i, 36 | - urg & 1 << i); 37 | + /* if (occ & 1 << i) */ 38 | + /* drw_rect(drw, x + boxs, boxs, boxw, boxw, */ 39 | + /* m == selmon && selmon->sel && selmon->sel->tags & 1 << i, */ 40 | + /* urg & 1 << i); */ 41 | x += w; 42 | } 43 | w = TEXTW(m->ltsymbol); 44 | -------------------------------------------------------------------------------- /dwm/patches/mitch-00-setmfact_fullgaps-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | /* 2 | * http://github.com/mitchweaver/suckless 3 | * 4 | * smfact patch, but with "fullgaps" support 5 | * (obviously assumes you have "fullgaps" patch applied) 6 | * 7 | * --------- MAKE SURE YOU HAVE THESE IN YOUR CONFIG.H: ---------- 8 | * static const unsigned int minwsz = 20; /* min height of a client for smfact */ 9 | * static const float smfact = 0.00; /* factor of tiled clients [0.00..0.95] */ 10 | * { MODKEY|ShiftMask, XK_h, setsmfact, {.f = +0.05} }, 11 | * { MODKEY|ShiftMask, XK_l, setsmfact, {.f = -0.05} }, 12 | * --------------------------------------------------------------- 13 | */ 14 | --- dwm/dwm.c 2011-12-19 16:02:46.000000000 +0100 15 | +++ dwm/dwm.c 2013-04-06 21:00:46.620830452 +0200 16 | @@ -69,6 +69,7 @@ typedef union { 17 | int i; 18 | unsigned int ui; 19 | float f; 20 | + float sf; 21 | const void *v; 22 | } Arg; 23 | 24 | @@ -127,6 +128,7 @@ typedef struct { 25 | struct Monitor { 26 | char ltsymbol[16]; 27 | float mfact; 28 | + float smfact; 29 | int nmaster; 30 | int num; 31 | int by; /* bar geometry */ 32 | @@ -220,6 +222,7 @@ static void setfocus(Client *c); 33 | static void setfullscreen(Client *c, Bool fullscreen); 34 | static void setlayout(const Arg *arg); 35 | static void setmfact(const Arg *arg); 36 | +static void setsmfact(const Arg *arg); 37 | static void setup(void); 38 | static void setnumdesktops(void); 39 | static void setviewport(void); 40 | @@ -651,6 +654,7 @@ createmon(void) { 41 | die("fatal: could not malloc() %u bytes\n", sizeof(Monitor)); 42 | m->tagset[0] = m->tagset[1] = 1; 43 | m->mfact = mfact; 44 | + m->smfact = smfact; 45 | m->nmaster = nmaster; 46 | m->showbar = showbar; 47 | m->topbar = topbar; 48 | @@ -1581,6 +1585,19 @@ setmfact(const Arg *arg) { 49 | } 50 | 51 | void 52 | +setsmfact(const Arg *arg) { 53 | + float sf; 54 | + 55 | + if(!arg || !selmon->lt[selmon->sellt]->arrange) 56 | + return; 57 | + sf = arg->sf < 1.0 ? arg->sf + selmon->smfact : arg->sf - 1.0; 58 | + if(sf < 0 || sf > 0.9) 59 | + return; 60 | + selmon->smfact = sf; 61 | + arrange(selmon); 62 | +} 63 | + 64 | +void 65 | setup(void) 66 | { 67 | 68 | @@ -1703,7 +1720,7 @@ textnw(const char *text, unsigned int le 69 | 70 | void 71 | tile(Monitor *m) 72 | { 73 | - unsigned int i, n, h, mw, my, ty; 74 | + unsigned int i, n, h, smh, mw, my, ty; 75 | Client *c; 76 | 77 | --- dwm/dwm.c 2020-06-12 14:49:30.008825067 -0500 78 | +++ dwm/dwm.c 2020-06-12 14:49:27.064796984 -0500 79 | @@ -1910,10 +1910,23 @@ 80 | if (my + HEIGHT(c) + m->gappx < m->wh) 81 | my += HEIGHT(c) + m->gappx; 82 | } else { 83 | - h = (m->wh - ty) / (n - i) - m->gappx; 84 | - resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0); 85 | - if (ty + HEIGHT(c) + m->gappx < m->wh) 86 | - ty += HEIGHT(c) + m->gappx; 87 | + smh = m->mh * m->smfact; 88 | + if(!(nexttiled(c->next))) 89 | + h = (m->wh - ty) / (n - i) - m->gappx; 90 | + else 91 | + h = (m->wh - smh - ty) / (n - i) - m->gappx; 92 | + if(h < minwsz) { 93 | + c->isfloating = True; 94 | + XRaiseWindow(dpy, c->win); 95 | + resize(c, m->mx + (m->mw / 2 - WIDTH(c) / 2), m->my + (m->mh / 2 - HEIGHT(c) / 2), m->ww - mw - (2*c->bw), h - (2*c->bw), False); 96 | + ty -= HEIGHT(c); 97 | + } 98 | + else 99 | + resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), False); 100 | + if(!(nexttiled(c->next)) && (ty + HEIGHT(c) + m->gappx + smh < m->wh)) 101 | + ty += HEIGHT(c) + smh + m->gappx; 102 | + else if (ty + HEIGHT(c) + m->gappx < m->wh) 103 | + ty += HEIGHT(c) + m->gappx; 104 | } 105 | } 106 | 107 | -------------------------------------------------------------------------------- /dwm/patches/mitch-01-remove_dmenucmd-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c 2 | +++ dwm/dwm.c 3 | @@ -1811,8 +1811,6 @@ 4 | { 5 | struct sigaction sa; 6 | 7 | - if (arg->v == dmenucmd) 8 | - dmenumon[0] = '0' + selmon->num; 9 | if (fork() == 0) { 10 | if (dpy) 11 | close(ConnectionNumber(dpy)); 12 | -------------------------------------------------------------------------------- /dwm/patches/mitch-02-remove_snap-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | // http://github.com/mitchweaver/suckless 2 | --- dwm/dwm.c 3 | +++ dwm/dwm.c 4 | @@ -1246,17 +1246,6 @@ 5 | 6 | nx = ocx + (ev.xmotion.x - x); 7 | ny = ocy + (ev.xmotion.y - y); 8 | - if (abs(selmon->wx - nx) < snap) 9 | - nx = selmon->wx; 10 | - else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) 11 | - nx = selmon->wx + selmon->ww - WIDTH(c); 12 | - if (abs(selmon->wy - ny) < snap) 13 | - ny = selmon->wy; 14 | - else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) 15 | - ny = selmon->wy + selmon->wh - HEIGHT(c); 16 | - if (!c->isfloating && selmon->lt[selmon->sellt]->arrange 17 | - && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) 18 | - togglefloating(NULL); 19 | if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) 20 | resize(c, nx, ny, c->w, c->h, 1); 21 | break; 22 | @@ -1419,13 +1408,6 @@ 23 | nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1); 24 | nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1); 25 | 26 | - if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww 27 | - && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) 28 | - { 29 | - if (!c->isfloating && selmon->lt[selmon->sellt]->arrange 30 | - && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) 31 | - togglefloating(NULL); 32 | - } 33 | if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) 34 | resize(c, nx, ny, nw, nh, 1); 35 | break; 36 | -------------------------------------------------------------------------------- /dwm/patches/mitch-03-remove-dirtomon-e81f17d4c196aaed6893fd4beed49991caa3e2a4.diff: -------------------------------------------------------------------------------- 1 | --- dwm/dwm.c Sun Mar 1 04:23:03 2020 2 | +++ dwm/dwm.c Sun Mar 1 04:23:26 2020 3 | @@ -168,7 +168,6 @@ 4 | static void destroynotify(XEvent *e); 5 | static void detach(Client *c); 6 | static void detachstack(Client *c); 7 | -static Monitor *dirtomon(int dir); 8 | static void drawbar(Monitor *m); 9 | static void drawbars(void); 10 | static void enqueue(Client *c); 11 | @@ -735,21 +734,6 @@ 12 | for (t = c->mon->stack; t && !ISVISIBLE(t); t = t->snext); 13 | c->mon->sel = t; 14 | } 15 | -} 16 | - 17 | -Monitor * 18 | -dirtomon(int dir) 19 | -{ 20 | - Monitor *m = NULL; 21 | - 22 | - if (dir > 0) { 23 | - if (!(m = selmon->next)) 24 | - m = mons; 25 | - } else if (selmon == mons) 26 | - for (m = mons; m->next; m = m->next); 27 | - else 28 | - for (m = mons; m->next != selmon; m = m->next); 29 | - return m; 30 | } 31 | 32 | void 33 | -------------------------------------------------------------------------------- /sent/cfg/config.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | static char *fontfallbacks[] = { 4 | "dejavu sans", 5 | "roboto", 6 | "ubuntu", 7 | }; 8 | 9 | #define NUMFONTSCALES 42 10 | #define FONTSZ(x) ((int)(10.0 * powf(1.1288, (x)))) /* x in [0, NUMFONTSCALES-1] */ 11 | 12 | static const char *colors[] = { 13 | "#000000", /* foreground color */ 14 | "#FFFFFF", /* background color */ 15 | }; 16 | 17 | static const char *inverted_colors[] = { 18 | "#FFFFFF", /* foreground color */ 19 | "#000000", /* background color */ 20 | }; 21 | 22 | /* height of the presentation progress bar */ 23 | static const int progressheight = 10; 24 | 25 | static const float linespacing = 1.4; 26 | 27 | /* how much screen estate is to be used at max for the content */ 28 | static const float usablewidth = 0.75; 29 | static const float usableheight = 0.75; 30 | 31 | static Mousekey mshortcuts[] = { 32 | /* button function argument */ 33 | { Button1, advance, {.i = +1} }, 34 | { Button3, advance, {.i = -1} }, 35 | { Button4, advance, {.i = -1} }, 36 | { Button5, advance, {.i = +1} }, 37 | }; 38 | 39 | static Shortcut shortcuts[] = { 40 | /* keysym function argument */ 41 | { XK_Escape, quit, {0} }, 42 | { XK_q, quit, {0} }, 43 | { XK_Right, advance, {.i = +1} }, 44 | { XK_Left, advance, {.i = -1} }, 45 | { XK_Return, advance, {.i = +1} }, 46 | { XK_space, advance, {.i = +1} }, 47 | { XK_BackSpace, advance, {.i = -1} }, 48 | { XK_l, advance, {.i = +1} }, 49 | { XK_h, advance, {.i = -1} }, 50 | { XK_j, advance, {.i = +1} }, 51 | { XK_k, advance, {.i = -1} }, 52 | { XK_Down, advance, {.i = +1} }, 53 | { XK_Up, advance, {.i = -1} }, 54 | { XK_Next, advance, {.i = +1} }, 55 | { XK_Prior, advance, {.i = -1} }, 56 | { XK_n, advance, {.i = +1} }, 57 | { XK_p, advance, {.i = -1} }, 58 | { XK_r, reload, {0} }, 59 | }; 60 | 61 | static Filter filters[] = { 62 | { "\\.ff$", "cat" }, 63 | { "\\.ff.bz2$", "bunzip2" }, 64 | { "\\.[a-z0-9]+$", "2ff" }, 65 | }; 66 | -------------------------------------------------------------------------------- /sent/cfg/config.mk: -------------------------------------------------------------------------------- 1 | # sent version 2 | VERSION = 1 3 | 4 | # paths 5 | PREFIX = /usr/local 6 | MANPREFIX = ${PREFIX}/share/man 7 | 8 | X11INC = /usr/X11R6/include 9 | X11LIB = /usr/X11R6/lib 10 | 11 | # -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 12 | # Linux 13 | INCS = -I. -I/usr/include -I/usr/include/freetype2 -I${X11INC} 14 | LIBS = -L/usr/lib -lc -lm -L${X11LIB} -lXft -lfontconfig -lX11 15 | 16 | # OpenBSD 17 | # INCS = -I. -I${X11INC} -I${X11INC}/freetype2 18 | 19 | # FreeBSD 20 | #INCS = -I. -I/usr/local/include -I/usr/local/include/freetype2 -I${X11INC} 21 | #LIBS = -L/usr/local/lib -lc -lm -L${X11LIB} -lXft -lfontconfig -lX11 22 | # -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 23 | 24 | CPPFLAGS = -DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600 25 | CFLAGS += -std=c99 -pedantic -Wall ${INCS} ${CPPFLAGS} 26 | LDFLAGS += ${LIBS} 27 | 28 | CC ?= cc 29 | -------------------------------------------------------------------------------- /sent/patches/mitch-01-pledge_OpenBSD-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.patch: -------------------------------------------------------------------------------- 1 | --- sent/sent.c 2 | +++ sent/sent.c 3 | @@ -736,6 +736,12 @@ 4 | int 5 | main(int argc, char *argv[]) 6 | { 7 | + 8 | +#ifdef __OpenBSD__ 9 | + if (pledge("stdio flock unix rpath", NULL) == -1) 10 | + die("pledge"); 11 | +#endif 12 | + 13 | FILE *fp = NULL; 14 | 15 | ARGBEGIN { 16 | -------------------------------------------------------------------------------- /sent/patches/sent-01-inverted-colors-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.diff: -------------------------------------------------------------------------------- 1 | --- sent/config.def.h 2 | +++ sent/config.def.h 3 | @@ -13,6 +13,11 @@ static const char *colors[] = { 4 | "#FFFFFF", /* background color */ 5 | }; 6 | 7 | +static const char *inverted_colors[] = { 8 | + "#FFFFFF", /* foreground color */ 9 | + "#000000", /* background color */ 10 | +}; 11 | + 12 | static const float linespacing = 1.4; 13 | 14 | /* how much screen estate is to be used at max for the content */ 15 | --- sent/sent.1 16 | +++ sent/sent.1 17 | @@ -6,6 +6,7 @@ 18 | .Sh SYNOPSIS 19 | .Nm 20 | .Op Fl v 21 | +.Op Fl i 22 | .Op Ar file 23 | .Sh DESCRIPTION 24 | .Nm 25 | @@ -21,6 +22,8 @@ few minutes. 26 | .Bl -tag -width Ds 27 | .It Fl v 28 | Print version information to stdout and exit. 29 | +.It Fl i 30 | +Use the colors from the inverted color array. 31 | .El 32 | .Sh USAGE 33 | .Bl -tag -width Ds 34 | --- sent/sent.c 35 | +++ sent/sent.c 36 | @@ -25,6 +25,8 @@ 37 | 38 | char *argv0; 39 | 40 | +int use_inverted_colors = 0; 41 | + 42 | /* macros */ 43 | #define LEN(a) (sizeof(a) / sizeof(a)[0]) 44 | #define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) 45 | @@ -586,7 +588,11 @@ xinit() 46 | 47 | if (!(d = drw_create(xw.dpy, xw.scr, xw.win, xw.w, xw.h))) 48 | die("sent: Unable to create drawing context"); 49 | - sc = drw_scm_create(d, colors, 2); 50 | + if (use_inverted_colors) { 51 | + sc = drw_scm_create(d, inverted_colors, 2); 52 | + } else { 53 | + sc = drw_scm_create(d, colors, 2); 54 | + } 55 | drw_setscheme(d, sc); 56 | XSetWindowBackground(xw.dpy, xw.win, sc[ColBg].pixel); 57 | 58 | @@ -687,6 +693,9 @@ main(int argc, char *argv[]) 59 | case 'v': 60 | fprintf(stderr, "sent-"VERSION"\n"); 61 | return 0; 62 | + case 'i': 63 | + use_inverted_colors = 1; 64 | + break; 65 | default: 66 | usage(); 67 | } ARGEND 68 | -------------------------------------------------------------------------------- /sent/patches/sent-02-progress-bar-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.diff: -------------------------------------------------------------------------------- 1 | --- sent/config.def.h 2 | +++ sent/config.def.h 3 | @@ -19,6 +19,9 @@ static const float linespacing = 1.4; 4 | static const float usablewidth = 0.75; 5 | static const float usableheight = 0.75; 6 | 7 | +/* height of the presentation progress bar */ 8 | +static const int progressheight = 5; 9 | + 10 | static Mousekey mshortcuts[] = { 11 | /* button function argument */ 12 | { Button1, advance, {.i = +1} }, 13 | --- sent/sent.c 14 | +++ sent/sent.c 15 | @@ -533,6 +533,12 @@ xdraw() 16 | 0, 17 | slides[idx].lines[i], 18 | 0); 19 | + if (idx != 0 && progressheight != 0) { 20 | + drw_rect(d, 21 | + 0, xw.h - progressheight, 22 | + (xw.w * idx)/(slidecount - 1), progressheight, 23 | + 1, 0); 24 | + } 25 | drw_map(d, xw.win, 0, 0, xw.w, xw.h); 26 | } else { 27 | if (!(im->state & SCALED)) 28 | -------------------------------------------------------------------------------- /sent/patches/sent-03-cmdline-options-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.diff: -------------------------------------------------------------------------------- 1 | --- sent/sent.1 2 | +++ sent/sent.1 3 | @@ -5,6 +5,9 @@ 4 | .Nd simple plaintext presentation tool 5 | .Sh SYNOPSIS 6 | .Nm 7 | +.Op Fl f Ar font 8 | +.Op Fl c Ar fgcolor 9 | +.Op Fl b Ar bgcolor 10 | .Op Fl v 11 | .Op Ar file 12 | .Sh DESCRIPTION 13 | @@ -21,6 +24,14 @@ few minutes. 14 | .Bl -tag -width Ds 15 | .It Fl i 16 | Use the colors from the inverted color array. 17 | +.It Fl f Ar font 18 | +Defines the 19 | +.Ar font 20 | +when sent is run. 21 | +.It Fl c Ar fgcolor 22 | +Defines the foreground color when sent is run. 23 | +.It Fl b Ar bgcolor 24 | +Defines the background color when sent is run. 25 | .El 26 | .Sh USAGE 27 | .Bl -tag -width Ds 28 | diff --git a/sent.c b/sent.c 29 | index c50a572..0b36e32 100644 30 | --- sent/sent.c 31 | +++ sent/sent.c 32 | @@ -675,7 +675,7 @@ configure(XEvent *e) 33 | void 34 | usage() 35 | { 36 | - die("usage: %s [file]", argv0); 37 | + die("usage: %s [-c fgcolor] [-b bgcolor] [-f font] [file]", argv0); 38 | } 39 | 40 | int 41 | @@ -687,6 +687,15 @@ main(int argc, char *argv[]) 42 | case 'i': 43 | use_inverted_colors = 1; 44 | break; 45 | + case 'f': 46 | + fontfallbacks[0] = EARGF(usage()); 47 | + break; 48 | + case 'c': 49 | + colors[0] = EARGF(usage()); 50 | + break; 51 | + case 'b': 52 | + colors[1] = EARGF(usage()); 53 | + break; 54 | default: 55 | usage(); 56 | } ARGEND 57 | -------------------------------------------------------------------------------- /sent/patches/sent-04-bilinear_scaling-2649e8d5334f7e37a1710c60fb740ecfe91b9f9e.diff: -------------------------------------------------------------------------------- 1 | --- sent/sent.c 2 | +++ sent/sent.c 3 | @@ -282,27 +282,66 @@ ffprepare(Image *img) 4 | img->state |= SCALED; 5 | } 6 | 7 | +static unsigned char double_to_uchar_clamp255(double dbl) 8 | +{ 9 | + dbl = round(dbl); 10 | + 11 | + return 12 | + (dbl < 0.0) ? 0 : 13 | + (dbl > 255.0) ? 255 : (unsigned char)dbl; 14 | +} 15 | + 16 | +static int int_clamp(int integer, int lower, int upper) 17 | +{ 18 | + if (integer < lower) 19 | + return lower; 20 | + else if (integer >= upper) 21 | + return upper - 1; 22 | + else 23 | + return integer; 24 | +} 25 | + 26 | void 27 | ffscale(Image *img) 28 | { 29 | - unsigned int x, y; 30 | - unsigned int width = img->ximg->width; 31 | - unsigned int height = img->ximg->height; 32 | - char* newBuf = img->ximg->data; 33 | - unsigned char* ibuf; 34 | - unsigned int jdy = img->ximg->bytes_per_line / 4 - width; 35 | - unsigned int dx = (img->bufwidth << 10) / width; 36 | - 37 | - for (y = 0; y < height; y++) { 38 | - unsigned int bufx = img->bufwidth / width; 39 | - ibuf = &img->buf[y * img->bufheight / height * img->bufwidth * 3]; 40 | - 41 | - for (x = 0; x < width; x++) { 42 | - *newBuf++ = (ibuf[(bufx >> 10)*3+2]); 43 | - *newBuf++ = (ibuf[(bufx >> 10)*3+1]); 44 | - *newBuf++ = (ibuf[(bufx >> 10)*3+0]); 45 | + const unsigned width = img->ximg->width; 46 | + const unsigned height = img->ximg->height; 47 | + unsigned char* newBuf = (unsigned char*)img->ximg->data; 48 | + const unsigned jdy = img->ximg->bytes_per_line / 4 - width; 49 | + 50 | + const double x_scale = ((double)img->bufwidth/(double)width); 51 | + const double y_scale = ((double)img->bufheight/(double)height); 52 | + 53 | + for (unsigned y = 0; y < height; ++y) { 54 | + const double old_y = (double)y * y_scale; 55 | + const double y_factor = ceil(old_y) - old_y; 56 | + const int old_y_int_0 = int_clamp((int)floor(old_y), 0, img->bufheight); 57 | + const int old_y_int_1 = int_clamp((int)ceil(old_y), 0, img->bufheight); 58 | + 59 | + for (unsigned x = 0; x < width; ++x) { 60 | + const double old_x = (double)x * x_scale; 61 | + const double x_factor = ceil(old_x) - old_x; 62 | + const int old_x_int_0 = int_clamp((int)floor(old_x), 0, img->bufwidth); 63 | + const int old_x_int_1 = int_clamp((int)ceil(old_x), 0, img->bufwidth); 64 | + 65 | + const unsigned c00_pos = 3*((old_x_int_0) + ((old_y_int_0)*img->bufwidth)); 66 | + const unsigned c01_pos = 3*((old_x_int_0) + ((old_y_int_1)*img->bufwidth)); 67 | + const unsigned c10_pos = 3*((old_x_int_1) + ((old_y_int_0)*img->bufwidth)); 68 | + const unsigned c11_pos = 3*((old_x_int_1) + ((old_y_int_1)*img->bufwidth)); 69 | + 70 | + for (int i = 2; i >= 0 ; --i) { 71 | + const unsigned char c00 = img->buf[c00_pos + i]; 72 | + const unsigned char c01 = img->buf[c01_pos + i]; 73 | + const unsigned char c10 = img->buf[c10_pos + i]; 74 | + const unsigned char c11 = img->buf[c11_pos + i]; 75 | + 76 | + const double x_result_0 = (double)c00*x_factor + (double)c10*(1.0 - x_factor); 77 | + const double x_result_1 = (double)c01*x_factor + (double)c11*(1.0 - x_factor); 78 | + const double result = x_result_0*y_factor + x_result_1*(1.0 - y_factor); 79 | + 80 | + *newBuf++ = double_to_uchar_clamp255(result); 81 | + } 82 | newBuf++; 83 | - bufx += dx; 84 | } 85 | newBuf += jdy; 86 | } 87 | -------------------------------------------------------------------------------- /slock/cfg/config.h: -------------------------------------------------------------------------------- 1 | /* time in seconds to cancel lock with mouse movement */ 2 | static const int timetocancel = 3; 3 | 4 | /* allow control key to trigger fail on clear */ 5 | static const int controlkeyclear = 0; 6 | 7 | /* user and group to drop privileges to */ 8 | static const char *user = "nobody"; 9 | static const char *group = "nogroup"; 10 | 11 | static const char *colorname[NUMCOLS] = { 12 | [BACKGROUND] = "black", /* after initialization */ 13 | [INIT] = "#2d2d2d", /* after initialization */ 14 | [INPUT] = "#005577", /* during input */ 15 | [FAILED] = "#CC3333", /* wrong password */ 16 | }; 17 | 18 | /* treat a cleared input like a wrong password (color) */ 19 | static const int failonclear = 0; 20 | 21 | 22 | /* insert grid pattern with scale 1:1, the size can be changed with logosize */ 23 | static const int logosize = 75; 24 | static const int logow = 12; /* grid width and height for right center alignment*/ 25 | static const int logoh = 6; 26 | 27 | static XRectangle rectangles[9] = { 28 | /* x y w h */ 29 | { 0, 3, 1, 3 }, 30 | { 1, 3, 2, 1 }, 31 | { 0, 5, 8, 1 }, 32 | { 3, 0, 1, 5 }, 33 | { 5, 3, 1, 2 }, 34 | { 7, 3, 1, 2 }, 35 | { 8, 3, 4, 1 }, 36 | { 9, 4, 1, 2 }, 37 | { 11, 4, 1, 2 }, 38 | 39 | }; 40 | -------------------------------------------------------------------------------- /slock/cfg/config.mk: -------------------------------------------------------------------------------- 1 | VERSION = 1.4 2 | 3 | # paths 4 | PREFIX = /usr/local 5 | MANPREFIX = ${PREFIX}/share/man 6 | 7 | X11INC = /usr/X11R6/include 8 | X11LIB = /usr/X11R6/lib 9 | 10 | XINERAMALIBS = -lXinerama 11 | XINERAMAFLAGS = -DXINERAMA 12 | FREETYPELIBS = -lXft 13 | 14 | # OpenBSD 15 | # FREETYPEINC = /usr/X11R6/include/freetype2 16 | # Linux 17 | FREETYPEINC = /usr/include/freetype2 18 | 19 | INCS = -I. -I/usr/include -I${X11INC} -I${FREETYPEINC} 20 | 21 | CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} 22 | LDFLAGS = -s ${LIBS} 23 | 24 | # OpenBSD 25 | # LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXext -lXrandr ${XINERAMALIBS} ${FREETYPELIBS} 26 | # Linux 27 | LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext -lXrandr ${XINERAMALIBS} ${FREETYPELIBS} 28 | 29 | # Linux 30 | CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -DHAVE_SHADOW_H ${XINERAMAFLAGS} 31 | # OpenBSD / FreeBSD 32 | # CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE ${XINERAMAFLAGS} -DHAVE_BSD_AUTH 33 | # NetBSD 34 | # CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE -D_NETBSD_SOURCE ${XINERAMAFLAGS} 35 | 36 | # OpenBSD 37 | # COMPATSRC = 38 | # Linux / FreeBSD / NetBSD 39 | COMPATSRC = explicit_bzero.c 40 | 41 | CC = cc 42 | -------------------------------------------------------------------------------- /slock/patches/mitch-01-openbsd-35633d45672d14bd798c478c45d1a17064701aa9.patch: -------------------------------------------------------------------------------- 1 | $OpenBSD: patch-slock_c,v 1.4 2020/05/24 17:24:24 sthen Exp $ 2 | 3 | Add back bsd-auth support, removed in 04143fd68dbc 4 | 5 | Index: slock.c 6 | --- slock/slock.c 7 | +++ slock/slock.c 8 | @@ -19,6 +19,11 @@ 9 | #include 10 | #include 11 | 12 | +#if HAVE_BSD_AUTH 13 | +#include 14 | +#include 15 | +#endif 16 | + 17 | #include "arg.h" 18 | #include "util.h" 19 | 20 | @@ -83,6 +88,7 @@ dontkillme(void) 21 | } 22 | #endif 23 | 24 | +#ifndef HAVE_BSD_AUTH 25 | static const char * 26 | gethash(void) 27 | { 28 | @@ -123,13 +129,21 @@ gethash(void) 29 | 30 | return hash; 31 | } 32 | +#endif /* HAVE_BSD_AUTH */ 33 | 34 | static void 35 | +#ifdef HAVE_BSD_AUTH 36 | +readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens) 37 | +#else 38 | readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 39 | const char *hash) 40 | +#endif 41 | { 42 | XRRScreenChangeNotifyEvent *rre; 43 | - char buf[32], passwd[256], *inputhash; 44 | + char buf[32], passwd[256]; 45 | +#ifndef HAVE_BSD_AUTH 46 | + char *inputhash; 47 | +#endif 48 | int num, screen, running, failure, oldc; 49 | unsigned int len, color; 50 | KeySym ksym; 51 | @@ -160,10 +174,14 @@ readpw(Display *dpy, struct xrandr *rr, struct lock ** 52 | case XK_Return: 53 | passwd[len] = '\0'; 54 | errno = 0; 55 | +#ifdef HAVE_BSD_AUTH 56 | + running = !auth_userokay(getlogin(), NULL, "auth-slock", passwd); 57 | +#else 58 | if (!(inputhash = crypt(passwd, hash))) 59 | fprintf(stderr, "slock: crypt: %s\n", strerror(errno)); 60 | else 61 | running = !!strcmp(inputhash, hash); 62 | +#endif 63 | if (running) { 64 | XBell(dpy, 100); 65 | failure = 1; 66 | @@ -303,7 +321,9 @@ main(int argc, char **argv) { 67 | struct group *grp; 68 | uid_t duid; 69 | gid_t dgid; 70 | +#ifndef HAVE_BSD_AUTH 71 | const char *hash; 72 | +#endif 73 | Display *dpy; 74 | int s, nlocks, nscreens; 75 | 76 | @@ -331,14 +351,23 @@ main(int argc, char **argv) { 77 | dontkillme(); 78 | #endif 79 | 80 | +#ifndef HAVE_BSD_AUTH 81 | hash = gethash(); 82 | errno = 0; 83 | if (!crypt("", hash)) 84 | die("slock: crypt: %s\n", strerror(errno)); 85 | +#endif 86 | 87 | if (!(dpy = XOpenDisplay(NULL))) 88 | die("slock: cannot open display\n"); 89 | 90 | +/* 91 | + * don't drop groups for bsd-auth, slock runs as the user's normal 92 | + * uid, and requires gid auth from the setgid bit. (without bsd-auth 93 | + * slock needs to start with uid root or gid _shadow to read spwd.db, 94 | + * and is unable to use non-password methods) 95 | + */ 96 | +#ifndef HAVE_BSD_AUTH 97 | /* drop privileges */ 98 | if (setgroups(0, NULL) < 0) 99 | die("slock: setgroups: %s\n", strerror(errno)); 100 | @@ -346,6 +375,7 @@ main(int argc, char **argv) { 101 | die("slock: setgid: %s\n", strerror(errno)); 102 | if (setuid(duid) < 0) 103 | die("slock: setuid: %s\n", strerror(errno)); 104 | +#endif 105 | 106 | /* check for Xrandr support */ 107 | rr.active = XRRQueryExtension(dpy, &rr.evbase, &rr.errbase); 108 | @@ -381,7 +411,11 @@ main(int argc, char **argv) { 109 | } 110 | 111 | /* everything is now blank. Wait for the correct password */ 112 | +#ifdef HAVE_BSD_AUTH 113 | + readpw(dpy, &rr, locks, nscreens); 114 | +#else 115 | readpw(dpy, &rr, locks, nscreens, hash); 116 | +#endif 117 | 118 | return 0; 119 | } 120 | -------------------------------------------------------------------------------- /slock/patches/mitch-02-openbsd_Makefile.patch: -------------------------------------------------------------------------------- 1 | --- slock/Makefile 2 | +++ slock/Makefile 3 | @@ -15,8 +15,7 @@ 4 | @echo "CC = ${CC}" 5 | 6 | .c.o: 7 | - @echo CC $< 8 | - @${CC} -c ${CFLAGS} $< 9 | + ${CC} -c ${CFLAGS} $< 10 | 11 | ${OBJ}: config.h config.mk arg.h util.h 12 | 13 | @@ -25,8 +24,7 @@ 14 | @cp config.def.h $@ 15 | 16 | slock: ${OBJ} 17 | - @echo CC -o $@ 18 | - @${CC} -o $@ ${OBJ} ${LDFLAGS} 19 | + ${CC} -o $@ ${OBJ} ${LDFLAGS} 20 | 21 | clean: 22 | @echo cleaning 23 | @@ -42,15 +40,10 @@ 24 | @rm -rf slock-${VERSION} 25 | 26 | install: all 27 | - @echo installing executable file to ${DESTDIR}${PREFIX}/bin 28 | - @mkdir -p ${DESTDIR}${PREFIX}/bin 29 | - @cp -f slock ${DESTDIR}${PREFIX}/bin 30 | - @chmod 755 ${DESTDIR}${PREFIX}/bin/slock 31 | - @chmod u+s ${DESTDIR}${PREFIX}/bin/slock 32 | - @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 33 | - @mkdir -p ${DESTDIR}${MANPREFIX}/man1 34 | - @sed "s/VERSION/${VERSION}/g" ${DESTDIR}${MANPREFIX}/man1/slock.1 35 | - @chmod 644 ${DESTDIR}${MANPREFIX}/man1/slock.1 36 | + install -Dm0755 slock ${DESTDIR}${PREFIX}/bin 37 | + sed "s/VERSION/${VERSION}/g" < slock.1 > slock.1.tmp 38 | + mv -f slock.1.tmp slock.1 39 | + install -Dm0644 slock.1 ${DESTDIR}${MANPREFIX}/man1 40 | 41 | uninstall: 42 | @echo removing executable file from ${DESTDIR}${PREFIX}/bin 43 | -------------------------------------------------------------------------------- /slock/patches/slock-01-dwmlogo-35633d45672d14bd798c478c45d1a17064701aa9.diff: -------------------------------------------------------------------------------- 1 | --- slock/config.def.h 2 | +++ slock/config.def.h 3 | @@ -3,10 +3,30 @@ static const char *user = "nobody"; 4 | static const char *group = "nogroup"; 5 | 6 | static const char *colorname[NUMCOLS] = { 7 | - [INIT] = "black", /* after initialization */ 8 | + [BACKGROUND] = "black", /* after initialization */ 9 | + [INIT] = "#2d2d2d", /* after initialization */ 10 | [INPUT] = "#005577", /* during input */ 11 | [FAILED] = "#CC3333", /* wrong password */ 12 | }; 13 | 14 | /* treat a cleared input like a wrong password (color) */ 15 | static const int failonclear = 1; 16 | + 17 | +/* insert grid pattern with scale 1:1, the size can be changed with logosize */ 18 | +static const int logosize = 75; 19 | +static const int logow = 12; /* grid width and height for right center alignment*/ 20 | +static const int logoh = 6; 21 | + 22 | +static XRectangle rectangles[9] = { 23 | + /* x y w h */ 24 | + { 0, 3, 1, 3 }, 25 | + { 1, 3, 2, 1 }, 26 | + { 0, 5, 8, 1 }, 27 | + { 3, 0, 1, 5 }, 28 | + { 5, 3, 1, 2 }, 29 | + { 7, 3, 1, 2 }, 30 | + { 8, 3, 4, 1 }, 31 | + { 9, 4, 1, 2 }, 32 | + { 11, 4, 1, 2 }, 33 | + 34 | +}; 35 | 36 | --- slock/slock.c 37 | +++ slock/slock.c 38 | @@ -1,5 +1,6 @@ 39 | /* See LICENSE file for license details. */ 40 | -#define _XOPEN_SOURCE 500 41 | +#define _XOPEN_SOURCE 500 42 | +#define LENGTH(X) (sizeof X / sizeof X[0]) 43 | #if HAVE_SHADOW_H 44 | #include 45 | #endif 46 | @@ -15,9 +16,13 @@ 47 | #include 48 | #include 49 | #include 50 | +#ifdef XINERAMA 51 | +#include 52 | +#endif 53 | #include 54 | #include 55 | #include 56 | +#include 57 | 58 | #include "arg.h" 59 | #include "util.h" 60 | @@ -25,17 +30,25 @@ 61 | char *argv0; 62 | 63 | enum { 64 | + BACKGROUND, 65 | INIT, 66 | INPUT, 67 | FAILED, 68 | NUMCOLS 69 | }; 70 | 71 | +#include "config.h" 72 | + 73 | struct lock { 74 | int screen; 75 | Window root, win; 76 | Pixmap pmap; 77 | unsigned long colors[NUMCOLS]; 78 | + unsigned int x, y; 79 | + unsigned int xoff, yoff, mw, mh; 80 | + Drawable drawable; 81 | + GC gc; 82 | + XRectangle rectangles[LENGTH(rectangles)]; 83 | }; 84 | 85 | struct xrandr { 86 | @@ -44,8 +57,6 @@ struct xrandr { 87 | int errbase; 88 | }; 89 | 90 | -#include "config.h" 91 | - 92 | static void 93 | die(const char *errstr, ...) 94 | { 95 | @@ -124,6 +135,32 @@ gethash(void) 96 | return hash; 97 | } 98 | 99 | +static void 100 | +resizerectangles(struct lock *lock) 101 | +{ 102 | + int i; 103 | + 104 | + for (i = 0; i < LENGTH(rectangles); i++){ 105 | + lock->rectangles[i].x = (rectangles[i].x * logosize) 106 | + + lock->xoff + ((lock->mw) / 2) - (logow / 2 * logosize); 107 | + lock->rectangles[i].y = (rectangles[i].y * logosize) 108 | + + lock->yoff + ((lock->mh) / 2) - (logoh / 2 * logosize); 109 | + lock->rectangles[i].width = rectangles[i].width * logosize; 110 | + lock->rectangles[i].height = rectangles[i].height * logosize; 111 | + } 112 | +} 113 | + 114 | +static void 115 | +drawlogo(Display *dpy, struct lock *lock, int color) 116 | +{ 117 | + XSetForeground(dpy, lock->gc, lock->colors[BACKGROUND]); 118 | + XFillRectangle(dpy, lock->drawable, lock->gc, 0, 0, lock->x, lock->y); 119 | + XSetForeground(dpy, lock->gc, lock->colors[color]); 120 | + XFillRectangles(dpy, lock->drawable, lock->gc, lock->rectangles, LENGTH(rectangles)); 121 | + XCopyArea(dpy, lock->drawable, lock->win, lock->gc, 0, 0, lock->x, lock->y, 0, 0); 122 | + XSync(dpy, False); 123 | +} 124 | + 125 | static void 126 | readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 127 | const char *hash) 128 | @@ -190,10 +227,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 129 | color = len ? INPUT : ((failure || failonclear) ? FAILED : INIT); 130 | if (running && oldc != color) { 131 | for (screen = 0; screen < nscreens; screen++) { 132 | - XSetWindowBackground(dpy, 133 | - locks[screen]->win, 134 | - locks[screen]->colors[color]); 135 | - XClearWindow(dpy, locks[screen]->win); 136 | + drawlogo(dpy, locks[screen], color); 137 | } 138 | oldc = color; 139 | } 140 | @@ -228,6 +262,10 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen) 141 | XColor color, dummy; 142 | XSetWindowAttributes wa; 143 | Cursor invisible; 144 | +#ifdef XINERAMA 145 | + XineramaScreenInfo *info; 146 | + int n; 147 | +#endif 148 | 149 | if (dpy == NULL || screen < 0 || !(lock = malloc(sizeof(struct lock)))) 150 | return NULL; 151 | @@ -241,12 +279,31 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen) 152 | lock->colors[i] = color.pixel; 153 | } 154 | 155 | + lock->x = DisplayWidth(dpy, lock->screen); 156 | + lock->y = DisplayHeight(dpy, lock->screen); 157 | +#ifdef XINERAMA 158 | + if ((info = XineramaQueryScreens(dpy, &n))) { 159 | + lock->xoff = info[0].x_org; 160 | + lock->yoff = info[0].y_org; 161 | + lock->mw = info[0].width; 162 | + lock->mh = info[0].height; 163 | + } else 164 | +#endif 165 | + { 166 | + lock->xoff = lock->yoff = 0; 167 | + lock->mw = lock->x; 168 | + lock->mh = lock->y; 169 | + } 170 | + lock->drawable = XCreatePixmap(dpy, lock->root, 171 | + lock->x, lock->y, DefaultDepth(dpy, screen)); 172 | + lock->gc = XCreateGC(dpy, lock->root, 0, NULL); 173 | + XSetLineAttributes(dpy, lock->gc, 1, LineSolid, CapButt, JoinMiter); 174 | + 175 | /* init */ 176 | wa.override_redirect = 1; 177 | - wa.background_pixel = lock->colors[INIT]; 178 | + wa.background_pixel = lock->colors[BACKGROUND]; 179 | lock->win = XCreateWindow(dpy, lock->root, 0, 0, 180 | - DisplayWidth(dpy, lock->screen), 181 | - DisplayHeight(dpy, lock->screen), 182 | + lock->x, lock->y, 183 | 0, DefaultDepth(dpy, lock->screen), 184 | CopyFromParent, 185 | DefaultVisual(dpy, lock->screen), 186 | @@ -256,6 +313,8 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen) 187 | &color, &color, 0, 0); 188 | XDefineCursor(dpy, lock->win, invisible); 189 | 190 | + resizerectangles(lock); 191 | + 192 | /* Try to grab mouse pointer *and* keyboard for 600ms, else fail the lock */ 193 | for (i = 0, ptgrab = kbgrab = -1; i < 6; i++) { 194 | if (ptgrab != GrabSuccess) { 195 | @@ -276,6 +335,7 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen) 196 | XRRSelectInput(dpy, lock->win, RRScreenChangeNotifyMask); 197 | 198 | XSelectInput(dpy, lock->root, SubstructureNotifyMask); 199 | + drawlogo(dpy, lock, INIT); 200 | return lock; 201 | } 202 | 203 | @@ -391,5 +451,12 @@ main(int argc, char **argv) { 204 | /* everything is now blank. Wait for the correct password */ 205 | readpw(dpy, &rr, locks, nscreens, hash); 206 | 207 | + for (nlocks = 0, s = 0; s < nscreens; s++) { 208 | + XFreePixmap(dpy, locks[s]->drawable); 209 | + XFreeGC(dpy, locks[s]->gc); 210 | + } 211 | + 212 | + XSync(dpy, 0); 213 | + XCloseDisplay(dpy); 214 | return 0; 215 | } 216 | -------------------------------------------------------------------------------- /slock/patches/slock-02-terminalkeys-35633d45672d14bd798c478c45d1a17064701aa9.diff: -------------------------------------------------------------------------------- 1 | --- slock/slock.c 2 | +++ slock/slock.c 3 | @@ -156,6 +156,22 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 4 | IsPFKey(ksym) || 5 | IsPrivateKeypadKey(ksym)) 6 | continue; 7 | + if (ev.xkey.state & ControlMask) { 8 | + switch (ksym) { 9 | + case XK_u: 10 | + ksym = XK_Escape; 11 | + break; 12 | + case XK_m: 13 | + ksym = XK_Return; 14 | + break; 15 | + case XK_j: 16 | + ksym = XK_Return; 17 | + break; 18 | + case XK_h: 19 | + ksym = XK_BackSpace; 20 | + break; 21 | + } 22 | + } 23 | switch (ksym) { 24 | case XK_Return: 25 | passwd[len] = '\0'; 26 | -- 27 | 2.26.2 28 | 29 | -------------------------------------------------------------------------------- /slock/patches/slock-03-quickcancel-35633d45672d14bd798c478c45d1a17064701aa9.diff: -------------------------------------------------------------------------------- 1 | --- slock/slock.c 2 | +++ slock/slock.c 3 | @@ -13,6 +13,7 @@ 4 | #include 5 | #include 6 | #include 7 | +#include 8 | #include 9 | #include 10 | #include 11 | @@ -24,6 +25,8 @@ 12 | 13 | char *argv0; 14 | 15 | +static time_t locktime; 16 | + 17 | enum { 18 | INIT, 19 | INPUT, 20 | @@ -141,6 +144,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 21 | oldc = INIT; 22 | 23 | while (running && !XNextEvent(dpy, &ev)) { 24 | + running = !((time(NULL) - locktime < timetocancel) && (ev.type == MotionNotify)); 25 | if (ev.type == KeyPress) { 26 | explicit_bzero(&buf, sizeof(buf)); 27 | num = XLookupString(&ev.xkey, buf, sizeof(buf), &ksym, 0); 28 | @@ -268,6 +272,7 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen) 29 | 30 | XSelectInput(dpy, lock->root, SubstructureNotifyMask); 31 | drawlogo(dpy, lock, INIT); 32 | + locktime = time(NULL); 33 | return lock; 34 | } 35 | 36 | -- 37 | 2.23.0 38 | 39 | -------------------------------------------------------------------------------- /slock/patches/slock-04-mediakeys-35633d45672d14bd798c478c45d1a17064701aa9.diff: -------------------------------------------------------------------------------- 1 | --- slock/slock.c 2 | +++ slock/slock.c 3 | @@ -18,6 +18,7 @@ 4 | #include 5 | #include 6 | #include 7 | +#include 8 | 9 | #include "arg.h" 10 | #include "util.h" 11 | @@ -157,6 +158,18 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 12 | IsPrivateKeypadKey(ksym)) 13 | continue; 14 | switch (ksym) { 15 | + case XF86XK_AudioPlay: 16 | + case XF86XK_AudioStop: 17 | + case XF86XK_AudioPrev: 18 | + case XF86XK_AudioNext: 19 | + case XF86XK_AudioRaiseVolume: 20 | + case XF86XK_AudioLowerVolume: 21 | + case XF86XK_AudioMute: 22 | + case XF86XK_AudioMicMute: 23 | + case XF86XK_MonBrightnessDown: 24 | + case XF86XK_MonBrightnessUp: 25 | + XSendEvent(dpy, DefaultRootWindow(dpy), True, KeyPressMask, &ev); 26 | + break; 27 | case XK_Return: 28 | passwd[len] = '\0'; 29 | errno = 0; 30 | -------------------------------------------------------------------------------- /slock/patches/slock-05-contrlclear-35633d45672d14bd798c478c45d1a17064701aa9.diff: -------------------------------------------------------------------------------- 1 | --- slock/slock.c 2 | +++ slock/slock.c 3 | @@ -180,8 +180,9 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 4 | passwd[len--] = '\0'; 5 | break; 6 | default: 7 | - if (num && !iscntrl((int)buf[0]) && 8 | - (len + num < sizeof(passwd))) { 9 | + if (controlkeyclear && iscntrl((int)buf[0])) 10 | + continue; 11 | + if (num && (len + num < sizeof(passwd))) { 12 | memcpy(passwd + len, buf, num); 13 | len += num; 14 | } 15 | -------------------------------------------------------------------------------- /st/broken/99. st-alpha-0.8.5.diff: -------------------------------------------------------------------------------- 1 | --- st/st.h 2 | +++ st/st.h 3 | @@ -146,6 +146,7 @@ 4 | extern unsigned int defaultfg; 5 | extern unsigned int defaultbg; 6 | extern unsigned int defaultcs; 7 | +extern float alpha; 8 | extern MouseKey mkeys[]; 9 | extern const int boxdraw, boxdraw_bold, boxdraw_braille; 10 | 11 | --- st/x.c 12 | +++ st/x.c 13 | @@ -266,6 +266,8 @@ 14 | 15 | static Cursor cursor; 16 | static XColor xmousefg, xmousebg; 17 | +XWindowAttributes attr; 18 | +XVisualInfo vis; 19 | 20 | static int cursorblinks = 0; 21 | 22 | @@ -1208,7 +1210,17 @@ 23 | if (!(xw.dpy = XOpenDisplay(NULL))) 24 | die("can't open display\n"); 25 | xw.scr = XDefaultScreen(xw.dpy); 26 | - xw.vis = XDefaultVisual(xw.dpy, xw.scr); 27 | + 28 | + if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { 29 | + parent = XRootWindow(xw.dpy, xw.scr); 30 | + xw.depth = 32; 31 | + } else { 32 | + XGetWindowAttributes(xw.dpy, parent, &attr); 33 | + xw.depth = attr.depth; 34 | + } 35 | + 36 | + XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis); 37 | + xw.vis = vis.visual; 38 | 39 | /* font */ 40 | if (!FcInit()) 41 | 42 | --- st/x.c 43 | +++ st/x.c 44 | @@ -105,6 +105,7 @@ typedef struct { 45 | XSetWindowAttributes attrs; 46 | int scr; 47 | int isfixed; /* is fixed geometry? */ 48 | + int depth; /* bit depth */ 49 | int l, t; /* left and top offset */ 50 | int gm; /* geometry mask */ 51 | } XWindow; 52 | @@ -243,6 +244,7 @@ static char *usedfont = NULL; 53 | static double usedfontsize = 0; 54 | static double defaultfontsize = 0; 55 | 56 | +static char *opt_alpha = NULL; 57 | static char *opt_class = NULL; 58 | static char **opt_cmd = NULL; 59 | static char *opt_embed = NULL; 60 | @@ -736,7 +738,7 @@ xresize(int col, int row) 61 | 62 | XFreePixmap(xw.dpy, xw.buf); 63 | xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, 64 | - DefaultDepth(xw.dpy, xw.scr)); 65 | + xw.depth); 66 | XftDrawChange(xw.draw, xw.buf); 67 | xclear(0, 0, win.w, win.h); 68 | 69 | @@ -796,6 +798,13 @@ xloadcols(void) 70 | else 71 | die("could not allocate color %d\n", i); 72 | } 73 | + 74 | + /* set alpha value of bg color */ 75 | + if (opt_alpha) 76 | + alpha = strtof(opt_alpha, NULL); 77 | + dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); 78 | + dc.col[defaultbg].pixel &= 0x00FFFFFF; 79 | + dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; 80 | loaded = 1; 81 | } 82 | 83 | /* adjust fixed window geometry */ 84 | @@ -1152,19 +1173,15 @@ xinit(int cols, int rows) 85 | | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; 86 | xw.attrs.colormap = xw.cmap; 87 | 88 | - if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) 89 | - parent = XRootWindow(xw.dpy, xw.scr); 90 | xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, 91 | - win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, 92 | + win.w, win.h, 0, xw.depth, InputOutput, 93 | xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity 94 | | CWEventMask | CWColormap, &xw.attrs); 95 | 96 | memset(&gcvalues, 0, sizeof(gcvalues)); 97 | gcvalues.graphics_exposures = False; 98 | - dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, 99 | - &gcvalues); 100 | - xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, 101 | - DefaultDepth(xw.dpy, xw.scr)); 102 | + xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); 103 | + dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues); 104 | XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); 105 | XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); 106 | 107 | @@ -2019,6 +2036,9 @@ main(int argc, char *argv[]) 108 | case 'a': 109 | allowaltscreen = 0; 110 | break; 111 | + case 'A': 112 | + opt_alpha = EARGF(usage()); 113 | + break; 114 | case 'c': 115 | opt_class = EARGF(usage()); 116 | break; 117 | -------------------------------------------------------------------------------- /st/broken/README.md: -------------------------------------------------------------------------------- 1 | # broken 2 | 3 | ## alpha 4 | 5 | Using this with the other patches in the collection gives "bad request" 6 | when trying to open st. Not sure why, need to look into fixing. 7 | -------------------------------------------------------------------------------- /st/cfg/config.mk: -------------------------------------------------------------------------------- 1 | VERSION = 0.8.2 2 | 3 | PREFIX = ${HOME}/.local 4 | MANPREFIX = $(PREFIX)/share/man 5 | 6 | # OpenBSD / Linux 7 | X11INC = /usr/X11R6/include 8 | X11LIB = /usr/X11R6/lib 9 | 10 | # NetBSD 11 | # X11INC = /usr/X11R7/include 12 | # X11LIB = /usr/X11R7/lib 13 | 14 | INCS = -I$(X11INC) \ 15 | `pkg-config --cflags fontconfig` \ 16 | `pkg-config --cflags freetype2` \ 17 | -I${HOME}/.cache/themes 18 | 19 | # Linux 20 | LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXcursor -lXrender `pkg-config --libs fontconfig` `pkg-config --libs freetype2` 21 | 22 | # OpenBSD 23 | #LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft -lXrender \ 24 | # `pkg-config --libs fontconfig` \ 25 | # `pkg-config --libs freetype2` 26 | 27 | # NetBSD 28 | # LIBS = -Wl,-R${X11LIB} -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender `pkg-config --libs fontconfig` `pkg-config --libs freetype2` 29 | 30 | STCFLAGS = $(INCS) $(CPPFLAGS) $(CFLAGS) -O3 -pipe -fomit-frame-pointer -fipa-pta -fno-semantic-interposition -fno-trapping-math -fno-math-errno -fasynchronous-unwind-tables -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -falign-functions=32 31 | STLDFLAGS = $(LIBS) $(LDFLAGS) -fuse-ld=mold -Wl,-O1 -Wl,--as-needed 32 | CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -O3 -pipe -fomit-frame-pointer -fipa-pta -fno-semantic-interposition -fno-trapping-math -fno-math-errno -fasynchronous-unwind-tables 33 | 34 | CC = cc 35 | -------------------------------------------------------------------------------- /st/inactive/17. st-w3mimage-9ba7ecf7b15ec2986c6142036706aa353b249ef9.diff: -------------------------------------------------------------------------------- 1 | --- st/x.c 2 | +++ st/x.c 3 | @@ -1594,6 +1594,8 @@ xsettitle(char *p) 4 | int 5 | xstartdraw(void) 6 | { 7 | + if (IS_SET(MODE_VISIBLE)) 8 | + XCopyArea(xw.dpy, xw.win, xw.buf, dc.gc, 0, 0, win.w, win.h, 0, 0); 9 | return IS_SET(MODE_VISIBLE); 10 | } 11 | 12 | 13 | base-commit: 43a395ae91f7d67ce694e65edeaa7bbc720dd027 14 | -- 15 | 16 | -------------------------------------------------------------------------------- /st/inactive/README.md: -------------------------------------------------------------------------------- 1 | # inactive 2 | 3 | ## alpha 4 | 5 | Alpha allows transparency, but breaks w3m-image preview functionality. 6 | 7 | ## newterm 8 | 9 | Something with my dwm doesn't allow this to work, need to research. 10 | 11 | ## single-buffering / st-w3mimage 12 | 13 | Two different methods of getting w3mimage to work in st. 14 | Both are buggy in their own ways. 15 | -------------------------------------------------------------------------------- /st/inactive/XX. st-newterm-9ba7ecf7b15ec2986c6142036706aa353b249ef9.diff: -------------------------------------------------------------------------------- 1 | diff --git a/st.c b/st.c 2 | index b8e6077..044e29b 100644 3 | --- st/st.c 4 | +++ st/st.c 5 | @@ -153,6 +153,7 @@ typedef struct { 6 | } STREscape; 7 | 8 | static void execsh(char *, char **); 9 | +static char *getcwd_by_pid(pid_t pid); 10 | static void stty(char **); 11 | static void sigchld(int); 12 | static void ttywriteraw(const char *, size_t); 13 | @@ -1059,6 +1060,26 @@ tswapscreen(void) 14 | tfulldirt(); 15 | } 16 | 17 | +void 18 | +newterm(const Arg* a) 19 | +{ 20 | + switch (fork()) { 21 | + case -1: 22 | + die("fork failed: %s\n", strerror(errno)); 23 | + break; 24 | + case 0: 25 | + chdir(getcwd_by_pid(pid)); 26 | + execlp("st", "./st", NULL); 27 | + break; 28 | + } 29 | +} 30 | + 31 | +static char *getcwd_by_pid(pid_t pid) { 32 | + char buf[32]; 33 | + snprintf(buf, sizeof buf, "/proc/%d/cwd", pid); 34 | + return realpath(buf, NULL); 35 | +} 36 | + 37 | void 38 | tscrolldown(int orig, int n) 39 | { 40 | 41 | --- st/st.h 42 | +++ st/st.h 43 | @@ -110,6 +110,7 @@ 44 | 45 | void resettitle(void); 46 | 47 | +void newterm(const Arg *); 48 | void selclear(void); 49 | void selinit(void); 50 | void selstart(int, int, int); 51 | 52 | -------------------------------------------------------------------------------- /st/patches/01. st-anysize-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/x.c 2 | +++ st/x.c 3 | @@ -78,6 +78,7 @@ typedef XftGlyphFontSpec GlyphFontSpec; 4 | typedef struct { 5 | int tw, th; /* tty width and height */ 6 | int w, h; /* window width and height */ 7 | + int hborderpx, vborderpx; 8 | int ch; /* char height */ 9 | int cw; /* char width */ 10 | int mode; /* window state/mode flags */ 11 | @@ -311,7 +312,7 @@ zoomreset(const Arg *arg) 12 | int 13 | evcol(XEvent *e) 14 | { 15 | - int x = e->xbutton.x - borderpx; 16 | + int x = e->xbutton.x - win.hborderpx; 17 | LIMIT(x, 0, win.tw - 1); 18 | return x / win.cw; 19 | } 20 | @@ -319,7 +320,7 @@ evcol(XEvent *e) 21 | int 22 | evrow(XEvent *e) 23 | { 24 | - int y = e->xbutton.y - borderpx; 25 | + int y = e->xbutton.y - win.vborderpx; 26 | LIMIT(y, 0, win.th - 1); 27 | return y / win.ch; 28 | } 29 | @@ -675,6 +676,9 @@ cresize(int width, int height) 30 | col = MAX(1, col); 31 | row = MAX(1, row); 32 | 33 | + win.hborderpx = (win.w - col * win.cw) / 2; 34 | + win.vborderpx = (win.h - row * win.ch) / 2; 35 | + 36 | tresize(col, row); 37 | xresize(col, row); 38 | ttyresize(win.tw, win.th); 39 | @@ -793,8 +797,8 @@ xhints(void) 40 | sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize; 41 | sizeh->height = win.h; 42 | sizeh->width = win.w; 43 | - sizeh->height_inc = win.ch; 44 | - sizeh->width_inc = win.cw; 45 | + sizeh->height_inc = 1; 46 | + sizeh->width_inc = 1; 47 | sizeh->base_height = 2 * borderpx; 48 | sizeh->base_width = 2 * borderpx; 49 | sizeh->min_height = win.ch + 2 * borderpx; 50 | @@ -1022,8 +1026,8 @@ xinit(int cols, int rows) 51 | xloadcols(); 52 | 53 | /* adjust fixed window geometry */ 54 | - win.w = 2 * borderpx + cols * win.cw; 55 | - win.h = 2 * borderpx + rows * win.ch; 56 | + win.w = 2 * win.hborderpx + cols * win.cw; 57 | + win.h = 2 * win.vborderpx + rows * win.ch; 58 | if (xw.gm & XNegative) 59 | xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2; 60 | if (xw.gm & YNegative) 61 | @@ -1123,7 +1127,7 @@ xinit(int cols, int rows) 62 | int 63 | xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y) 64 | { 65 | - float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp; 66 | + float winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, xp, yp; 67 | ushort mode, prevmode = USHRT_MAX; 68 | Font *font = &dc.font; 69 | int frcflags = FRC_NORMAL; 70 | @@ -1259,7 +1263,7 @@ void 71 | xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y) 72 | { 73 | int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1); 74 | - int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, 75 | + int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, 76 | width = charlen * win.cw; 77 | Color *fg, *bg, *temp, revfg, revbg, truefg, truebg; 78 | XRenderColor colfg, colbg; 79 | @@ -1349,17 +1353,17 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i 80 | 81 | /* Intelligent cleaning up of the borders. */ 82 | if (x == 0) { 83 | - xclear(0, (y == 0)? 0 : winy, borderpx, 84 | + xclear(0, (y == 0)? 0 : winy, win.vborderpx, 85 | winy + win.ch + 86 | - ((winy + win.ch >= borderpx + win.th)? win.h : 0)); 87 | + ((winy + win.ch >= win.vborderpx + win.th)? win.h : 0)); 88 | } 89 | - if (winx + width >= borderpx + win.tw) { 90 | + if (winx + width >= win.hborderpx + win.tw) { 91 | xclear(winx + width, (y == 0)? 0 : winy, win.w, 92 | - ((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch))); 93 | + ((winy + win.ch >= win.vborderpx + win.th)? win.h : (winy + win.ch))); 94 | } 95 | if (y == 0) 96 | - xclear(winx, 0, winx + width, borderpx); 97 | - if (winy + win.ch >= borderpx + win.th) 98 | + xclear(winx, 0, winx + width, win.hborderpx); 99 | + if (winy + win.ch >= win.vborderpx + win.th) 100 | xclear(winx, winy + win.ch, winx + width, win.h); 101 | 102 | /* Clean up the region we want to draw to. */ 103 | @@ -1452,35 +1456,35 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) 104 | case 3: /* Blinking Underline */ 105 | case 4: /* Steady Underline */ 106 | XftDrawRect(xw.draw, &drawcol, 107 | - borderpx + cx * win.cw, 108 | - borderpx + (cy + 1) * win.ch - \ 109 | + win.hborderpx + cx * win.cw, 110 | + win.vborderpx + (cy + 1) * win.ch - \ 111 | cursorthickness, 112 | win.cw, cursorthickness); 113 | break; 114 | case 5: /* Blinking bar */ 115 | case 6: /* Steady bar */ 116 | XftDrawRect(xw.draw, &drawcol, 117 | - borderpx + cx * win.cw, 118 | - borderpx + cy * win.ch, 119 | + win.hborderpx + cx * win.cw, 120 | + win.vborderpx + cy * win.ch, 121 | cursorthickness, win.ch); 122 | break; 123 | } 124 | } else { 125 | XftDrawRect(xw.draw, &drawcol, 126 | - borderpx + cx * win.cw, 127 | - borderpx + cy * win.ch, 128 | + win.hborderpx + cx * win.cw, 129 | + win.vborderpx + cy * win.ch, 130 | win.cw - 1, 1); 131 | XftDrawRect(xw.draw, &drawcol, 132 | - borderpx + cx * win.cw, 133 | - borderpx + cy * win.ch, 134 | + win.hborderpx + cx * win.cw, 135 | + win.vborderpx + cy * win.ch, 136 | 1, win.ch - 1); 137 | XftDrawRect(xw.draw, &drawcol, 138 | - borderpx + (cx + 1) * win.cw - 1, 139 | - borderpx + cy * win.ch, 140 | + win.hborderpx + (cx + 1) * win.cw - 1, 141 | + win.vborderpx + cy * win.ch, 142 | 1, win.ch - 1); 143 | XftDrawRect(xw.draw, &drawcol, 144 | - borderpx + cx * win.cw, 145 | - borderpx + (cy + 1) * win.ch - 1, 146 | + win.hborderpx + cx * win.cw, 147 | + win.vborderpx + (cy + 1) * win.ch - 1, 148 | win.cw, 1); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /st/patches/02. st-copyurl_highlighturl-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/st.c 2 | +++ st/st.c 3 | @@ -200,6 +200,8 @@ static void tdefutf8(char); 4 | static int32_t tdefcolor(int *, int *, int); 5 | static void tdeftran(char); 6 | static void tstrsequence(uchar); 7 | +static void tsetcolor(int, int, int, uint32_t, uint32_t); 8 | +static char * findlastany(char *, const char**, size_t); 9 | 10 | static void drawregion(int, int, int, int); 11 | 12 | @@ -2602,3 +2604,125 @@ redraw(void) 13 | tfulldirt(); 14 | draw(); 15 | } 16 | + 17 | +void 18 | +tsetcolor( int row, int start, int end, uint32_t fg, uint32_t bg ) 19 | +{ 20 | + int i = start; 21 | + for( ; i < end; ++i ) 22 | + { 23 | + term.line[row][i].fg = fg; 24 | + term.line[row][i].bg = bg; 25 | + } 26 | +} 27 | + 28 | +char * 29 | +findlastany(char *str, const char** find, size_t len) 30 | +{ 31 | + char* found = NULL; 32 | + int i = 0; 33 | + for(found = str + strlen(str) - 1; found >= str; --found) { 34 | + for(i = 0; i < len; i++) { 35 | + if(strncmp(found, find[i], strlen(find[i])) == 0) { 36 | + return found; 37 | + } 38 | + } 39 | + } 40 | + 41 | + return NULL; 42 | +} 43 | + 44 | +/* 45 | +** Select and copy the previous url on screen (do nothing if there's no url). 46 | +** 47 | +** FIXME: doesn't handle urls that span multiple lines; will need to add support 48 | +** for multiline "getsel()" first 49 | +*/ 50 | +void 51 | +copyurl(const Arg *arg) { 52 | + /* () and [] can appear in urls, but excluding them here will reduce false 53 | + * positives when figuring out where a given url ends. 54 | + */ 55 | + static char URLCHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 56 | + "abcdefghijklmnopqrstuvwxyz" 57 | + "0123456789-._~:/?#@!$&'*+,;=%"; 58 | + 59 | + static const char* URLSTRINGS[] = {"http://", "https://"}; 60 | + 61 | + /* remove highlighting from previous selection if any */ 62 | + if(sel.ob.x >= 0 && sel.oe.x >= 0) 63 | + tsetcolor(sel.nb.y, sel.ob.x, sel.oe.x + 1, defaultfg, defaultbg); 64 | + 65 | + int i = 0, 66 | + row = 0, /* row of current URL */ 67 | + col = 0, /* column of current URL start */ 68 | + startrow = 0, /* row of last occurrence */ 69 | + colend = 0, /* column of last occurrence */ 70 | + passes = 0; /* how many rows have been scanned */ 71 | + 72 | + char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */ 73 | + char *c = NULL, 74 | + *match = NULL; 75 | + 76 | + row = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y : term.bot; 77 | + LIMIT(row, term.top, term.bot); 78 | + startrow = row; 79 | + 80 | + colend = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.x : term.col; 81 | + LIMIT(colend, 0, term.col); 82 | + 83 | + /* 84 | + ** Scan from (term.bot,term.col) to (0,0) and find 85 | + ** next occurrance of a URL 86 | + */ 87 | + while(passes !=term.bot + 2) { 88 | + /* Read in each column of every row until 89 | + ** we hit previous occurrence of URL 90 | + */ 91 | + for (col = 0, i = 0; col < colend; ++col,++i) { 92 | + /* assume ascii */ 93 | + if (term.line[row][col].u > 127) 94 | + continue; 95 | + linestr[i] = term.line[row][col].u; 96 | + } 97 | + linestr[term.col] = '\0'; 98 | + 99 | + if ((match = findlastany(linestr, URLSTRINGS, 100 | + sizeof(URLSTRINGS)/sizeof(URLSTRINGS[0])))) 101 | + break; 102 | + 103 | + if (--row < term.top) 104 | + row = term.bot; 105 | + 106 | + colend = term.col; 107 | + passes++; 108 | + }; 109 | + 110 | + if (match) { 111 | + /* must happen before trim */ 112 | + selclear(); 113 | + sel.ob.x = strlen(linestr) - strlen(match); 114 | + 115 | + /* trim the rest of the line from the url match */ 116 | + for (c = match; *c != '\0'; ++c) 117 | + if (!strchr(URLCHARS, *c)) { 118 | + *c = '\0'; 119 | + break; 120 | + } 121 | + 122 | + /* highlight selection by inverting terminal colors */ 123 | + tsetcolor(row, sel.ob.x, sel.ob.x + strlen( match ), defaultbg, defaultfg); 124 | + 125 | + /* select and copy */ 126 | + sel.mode = 1; 127 | + sel.type = SEL_REGULAR; 128 | + sel.oe.x = sel.ob.x + strlen(match)-1; 129 | + sel.ob.y = sel.oe.y = row; 130 | + selnormalize(); 131 | + tsetdirt(sel.nb.y, sel.ne.y); 132 | + xsetsel(getsel()); 133 | + xclipcopy(); 134 | + } 135 | + 136 | + free(linestr); 137 | +} 138 | --- st/st.h 139 | +++ st/st.h 140 | @@ -84,6 +84,7 @@ void printscreen(const Arg *); 141 | void printsel(const Arg *); 142 | void sendbreak(const Arg *); 143 | void toggleprinter(const Arg *); 144 | +void copyurl(const Arg *); 145 | 146 | int tattrset(int); 147 | void tnew(int, int); 148 | -------------------------------------------------------------------------------- /st/patches/03. st-clipboard-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/x.c 2 | +++ st/x.c 3 | @@ -624,6 +624,8 @@ setsel(char *str, Time t) 4 | XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t); 5 | if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win) 6 | selclear(); 7 | + 8 | + xclipcopy(); 9 | } 10 | 11 | void 12 | -------------------------------------------------------------------------------- /st/patches/05. st-scrollback-mouse-[1]-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/st.h 2022-10-02 12:13:33.877655410 -0500 2 | +++ st/st.h 2022-10-02 12:13:30.892658781 -0500 3 | @@ -77,6 +77,13 @@ 4 | const char *s; 5 | } Arg; 6 | 7 | +typedef struct { 8 | + uint b; 9 | + uint mask; 10 | + void (*func)(const Arg *); 11 | + const Arg arg; 12 | +} MouseKey; 13 | + 14 | void die(const char *, ...); 15 | void redraw(void); 16 | void draw(void); 17 | @@ -127,3 +134,5 @@ 18 | extern unsigned int defaultfg; 19 | extern unsigned int defaultbg; 20 | extern unsigned int defaultcs; 21 | +extern MouseKey mkeys[]; 22 | + 23 | --- st/x.c 2022-10-02 12:15:07.498521980 -0500 24 | +++ st/x.c 2022-10-02 12:16:37.796325000 -0500 25 | @@ -471,6 +471,7 @@ 26 | { 27 | int btn = e->xbutton.button; 28 | struct timespec now; 29 | + MouseKey *mk; 30 | int snap; 31 | 32 | if (1 <= btn && btn <= 11) 33 | @@ -481,6 +482,14 @@ 34 | return; 35 | } 36 | 37 | + for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) { 38 | + if (e->xbutton.button == mk->b 39 | + && match(mk->mask, e->xbutton.state)) { 40 | + mk->func(&mk->arg); 41 | + return; 42 | + } 43 | + } 44 | + 45 | if (mouseaction(e, 0)) 46 | return; 47 | -------------------------------------------------------------------------------- /st/patches/06. st-scrollback-mouse-[2]-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/st.c Thu Feb 27 18:19:25 2020 2 | +++ st/st.c Thu Feb 27 18:19:25 2020 3 | @@ -1058,6 +1058,11 @@ tnew(int col, int row) 4 | treset(); 5 | } 6 | 7 | +int tisaltscr(void) 8 | +{ 9 | + return IS_SET(MODE_ALTSCREEN); 10 | +} 11 | + 12 | void 13 | tswapscreen(void) 14 | { 15 | --- st/st.h 16 | +++ st/st.h 17 | @@ -95,6 +95,7 @@ void sendbreak(const Arg *); 18 | void toggleprinter(const Arg *); 19 | 20 | int tattrset(int); 21 | +int tisaltscr(void); 22 | void tnew(int, int); 23 | void tresize(int, int); 24 | void tsetdirtattr(int); 25 | --- st/x.c Thu Feb 27 18:19:25 2020 26 | +++ st/x.c Thu Feb 27 18:19:10 2020 27 | @@ -429,6 +429,7 @@ 28 | { 29 | MouseShortcut *ms; 30 | 31 | + if (tisaltscr()) 32 | for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { 33 | if (ms->release == release && 34 | ms->button == e->xbutton.button && 35 | -------------------------------------------------------------------------------- /st/patches/07. st-vertcenter-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/x.c Tue Mar 20 00:28:57 2018 2 | +++ st/x.c Tue Mar 20 00:29:02 2018 3 | @@ -80,6 +80,7 @@ 4 | int w, h; /* window width and height */ 5 | int ch; /* char height */ 6 | int cw; /* char width */ 7 | + int cyo; /* char y offset */ 8 | int mode; /* window state/mode flags */ 9 | int cursor; /* cursor style */ 10 | } TermWindow; 11 | @@ -949,6 +950,7 @@ 12 | /* Setting character width and height. */ 13 | win.cw = ceilf(dc.font.width * cwscale); 14 | win.ch = ceilf(dc.font.height * chscale); 15 | + win.cyo = ceilf(dc.font.height * (chscale - 1) / 2); 16 | 17 | FcPatternDel(pattern, FC_SLANT); 18 | FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); 19 | @@ -1130,7 +1132,7 @@ 20 | FcCharSet *fccharset; 21 | int i, f, numspecs = 0; 22 | 23 | - for (i = 0, xp = winx, yp = winy + font->ascent; i < len; ++i) { 24 | + for (i = 0, xp = winx, yp = winy + font->ascent + win.cyo; i < len; ++i) { 25 | /* Fetch rune and mode for current glyph. */ 26 | rune = glyphs[i].u; 27 | mode = glyphs[i].mode; 28 | @@ -1155,7 +1157,7 @@ 29 | font = &dc.bfont; 30 | frcflags = FRC_BOLD; 31 | } 32 | - yp = winy + font->ascent; 33 | + yp = winy + font->ascent + win.cyo; 34 | } 35 | 36 | /* Lookup character index with default font. */ 37 | @@ -1371,12 +1373,12 @@ 38 | 39 | /* Render underline and strikethrough. */ 40 | if (base.mode & ATTR_UNDERLINE) { 41 | - XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1, 42 | + XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent * chscale + 1, 43 | width, 1); 44 | } 45 | 46 | if (base.mode & ATTR_STRUCK) { 47 | - XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent * chscale / 3, 48 | + XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent / 3, 49 | width, 1); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /st/patches/08. st-bold-is-not-bright-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/x.c 2 | +++ st/x.c 3 | @@ -1296,10 +1296,6 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i 4 | bg = &dc.col[base.bg]; 5 | } 6 | 7 | - /* Change basic system colors [0-7] to bright system colors [8-15] */ 8 | - if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7)) 9 | - fg = &dc.col[base.fg + 8]; 10 | - 11 | if (IS_SET(MODE_REVERSE)) { 12 | if (fg == &dc.col[defaultfg]) { 13 | fg = &dc.col[defaultbg]; 14 | -- 15 | 2.20.1 16 | 17 | -------------------------------------------------------------------------------- /st/patches/09. st-spoiler-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/x.c 2 | +++ st/x.c 3 | @@ -1330,9 +1330,14 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i 4 | } 5 | 6 | if (base.mode & ATTR_REVERSE) { 7 | - temp = fg; 8 | - fg = bg; 9 | - bg = temp; 10 | + if (bg == fg) { 11 | + bg = &dc.col[defaultfg]; 12 | + fg = &dc.col[defaultbg]; 13 | + } else { 14 | + temp = fg; 15 | + fg = bg; 16 | + bg = temp; 17 | + } 18 | } 19 | 20 | if (base.mode & ATTR_BLINK && win.mode & MODE_BLINK) 21 | -------------------------------------------------------------------------------- /st/patches/10. st-xclearwin-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/st.c 2 | +++ st/st.c 3 | @@ -2004,11 +2004,8 @@ 4 | fprintf(stderr, "erresc: invalid color j=%d, p=%s\n", 5 | j, p ? p : "(null)"); 6 | } else { 7 | - /* 8 | - * TODO if defaultbg color is changed, borders 9 | - * are dirty 10 | - */ 11 | tfulldirt(); 12 | + redraw(); 13 | } 14 | return; 15 | } 16 | --- st/win.h 17 | +++ st/win.h 18 | @@ -37,3 +37,4 @@ void xsetpointermotion(int); 19 | void xsetsel(char *); 20 | int xstartdraw(void); 21 | void xximspot(int, int); 22 | +void xclearwin(void); 23 | --- st/x.c 24 | +++ st/x.c 25 | @@ -825,6 +825,12 @@ xclear(int x1, int y1, int x2, int y2) 26 | x1, y1, x2-x1, y2-y1); 27 | } 28 | 29 | +void 30 | +xclearwin(void) 31 | +{ 32 | + xclear(0, 0, win.w, win.h); 33 | +} 34 | + 35 | void 36 | xhints(void) 37 | { 38 | -- 39 | 40 | -------------------------------------------------------------------------------- /st/patches/11. st-plumb_without_shell_OSC-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | /* 2 | * plumb_cmd is run on mouse button 3 click, with argument set to 3 | * current selection and with cwd set to the cwd of the active shell 4 | * 5 | * static char *plumb_cmd = "opn"; 6 | * 7 | */ 8 | --- st/st.c 9 | +++ st/st.c 10 | @@ -27,6 +27,9 @@ 11 | #elif defined(__FreeBSD__) || defined(__DragonFly__) 12 | #include 13 | #endif 14 | +#if defined(__OpenBSD__) 15 | + #include 16 | +#endif 17 | 18 | /* Arbitrary sizes */ 19 | #define UTF_INVALID 0xFFFD 20 | @@ -232,6 +235,22 @@ static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; 21 | static Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; 22 | static Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; 23 | 24 | +int 25 | +subprocwd(char *path) 26 | +{ 27 | +#if defined(__linux) 28 | + if (snprintf(path, PATH_MAX, "/proc/%d/cwd", pid) < 0) 29 | + return -1; 30 | + return 0; 31 | +#elif defined(__OpenBSD__) 32 | + size_t sz = PATH_MAX; 33 | + int name[3] = {CTL_KERN, KERN_PROC_CWD, pid}; 34 | + if (sysctl(name, 3, path, &sz, 0, 0) == -1) 35 | + return -1; 36 | + return 0; 37 | +#endif 38 | +} 39 | + 40 | ssize_t 41 | xwrite(int fd, const char *s, size_t len) 42 | { 43 | @@ -810,7 +829,7 @@ ttynew(char *line, char *cmd, char *out, char **args) 44 | break; 45 | default: 46 | #ifdef __OpenBSD__ 47 | - if (pledge("stdio rpath tty proc", NULL) == -1) 48 | + if (pledge("stdio rpath tty proc ps exec", NULL) == -1) 49 | die("pledge\n"); 50 | #endif 51 | close(s); 52 | --- st/st.h 53 | +++ st/st.h 54 | @@ -110,6 +110,8 @@ void *xmalloc(size_t); 55 | void *xrealloc(void *, size_t); 56 | char *xstrdup(char *); 57 | 58 | +int subprocwd(char *); 59 | + 60 | /* config.h globals */ 61 | extern char *utmp; 62 | extern char *stty_args; 63 | --- st/x.c 64 | +++ st/x.c 65 | @@ -5,6 +5,7 @@ 66 | #include 67 | #include 68 | #include 69 | +#include 70 | #include 71 | #include 72 | #include 73 | @@ -635,6 +636,29 @@ xsetsel(char *str) 74 | setsel(str, CurrentTime); 75 | } 76 | 77 | +void 78 | +plumb(char *sel) { 79 | + if (sel == NULL) 80 | + return; 81 | + char cwd[PATH_MAX]; 82 | + pid_t child; 83 | + if (subprocwd(cwd) != 0) 84 | + return; 85 | + 86 | + switch(child = fork()) { 87 | + case -1: 88 | + return; 89 | + case 0: 90 | + if (chdir(cwd) != 0) 91 | + exit(1); 92 | + if (execvp(plumb_cmd, (char *const []){plumb_cmd, sel, 0}) == -1) 93 | + exit(1); 94 | + exit(0); 95 | + //default: // NOTE: uncomment these lines if you want to 96 | + //waitpid(child, NULL, 0); // wait after forking, (you probably dont) 97 | + } 98 | +} 99 | + 100 | void 101 | brelease(XEvent *e) 102 | { 103 | @@ -647,6 +671,8 @@ brelease(XEvent *e) 104 | selpaste(NULL); 105 | else if (e->xbutton.button == Button1) 106 | mousesel(e, 1); 107 | + else if (e->xbutton.button == Button3) 108 | + plumb(xsel.primary); 109 | } 110 | 111 | void 112 | -------------------------------------------------------------------------------- /st/patches/13. st-swapmouse-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/x.c 2 | +++ st/x.c 3 | @@ -254,6 +254,9 @@ static char *opt_title = NULL; 4 | 5 | static int oldbutton = 3; /* button event on startup: 3 = release */ 6 | 7 | +static Cursor cursor; 8 | +static XColor xmousefg, xmousebg; 9 | + 10 | void 11 | clipcopy(const Arg *dummy) 12 | { 13 | @@ -1099,10 +1102,8 @@ void 14 | xinit(int cols, int rows) 15 | { 16 | XGCValues gcvalues; 17 | - Cursor cursor; 18 | Window parent; 19 | pid_t thispid = getpid(); 20 | - XColor xmousefg, xmousebg; 21 | 22 | if (!(xw.dpy = XOpenDisplay(NULL))) 23 | 24 | @@ -1683,6 +1684,12 @@ xsetmode(int set, unsigned int flags) 25 | { 26 | int mode = win.mode; 27 | MODBIT(win.mode, set, flags); 28 | + if (flags & MODE_MOUSE) { 29 | + if (win.mode & MODE_MOUSE) 30 | + XUndefineCursor(xw.dpy, xw.win); 31 | + else 32 | + XDefineCursor(xw.dpy, xw.win, cursor); 33 | + } 34 | if ((win.mode & MODE_REVERSE) != (mode & MODE_REVERSE)) 35 | redraw(); 36 | } 37 | -------------------------------------------------------------------------------- /st/patches/15. st-disable-bold-italic-fonts-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | // allow disabling of bold and/or italic fonts 2 | --- st/config.def.h 3 | +++ st/config.def.h 4 | @@ -6,6 +6,12 @@ 5 | * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html 6 | */ 7 | static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; 8 | + 9 | +/* disable bold, italic and roman fonts globally */ 10 | +int disablebold = 0; 11 | +int disableitalic = 0; 12 | +int disableroman = 0; 13 | + 14 | static int borderpx = 2; 15 | 16 | /* 17 | --- st/x.c 18 | +++ st/x.c 19 | @@ -233,6 +233,11 @@ static char *usedfont = NULL; 20 | static double usedfontsize = 0; 21 | static double defaultfontsize = 0; 22 | 23 | +/* declared in config.h */ 24 | +extern int disablebold; 25 | +extern int disableitalic; 26 | +extern int disableroman; 27 | + 28 | static char *opt_class = NULL; 29 | static char **opt_cmd = NULL; 30 | static char *opt_embed = NULL; 31 | @@ -960,7 +965,10 @@ xloadfonts(char *fontstr, double fontsize) 32 | win.ch = ceilf(dc.font.height * chscale); 33 | 34 | FcPatternDel(pattern, FC_SLANT); 35 | - FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); 36 | + if (!disableitalic) 37 | + FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); 38 | + if (!disableroman) 39 | + FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); 40 | if (xloadfont(&dc.ifont, pattern)) 41 | die("can't open font %s\n", fontstr); 42 | 43 | -- 44 | 2.21.0 45 | 46 | -------------------------------------------------------------------------------- /st/patches/16. st-blinking_cursor-4536f46cfff50c66a115755def0155d8e246b02f.diff: -------------------------------------------------------------------------------- 1 | --- st/config.def.h 2 | +++ st/config.def.h 3 | @@ -133,13 +133,20 @@ static unsigned int defaultcs = 256; 4 | static unsigned int defaultrcs = 257; 5 | 6 | /* 7 | - * Default shape of cursor 8 | - * 2: Block ("█") 9 | - * 4: Underline ("_") 10 | - * 6: Bar ("|") 11 | - * 7: Snowman ("☃") 12 | + * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81 13 | + * Default style of cursor 14 | + * 0: Blinking block 15 | + * 1: Blinking block (default) 16 | + * 2: Steady block ("█") 17 | + * 3: Blinking underline 18 | + * 4: Steady underline ("_") 19 | + * 5: Blinking bar 20 | + * 6: Steady bar ("|") 21 | + * 7: Blinking st cursor 22 | + * 8: Steady st cursor 23 | */ 24 | -static unsigned int cursorshape = 2; 25 | +static unsigned int cursorstyle = 1; 26 | +static Rune stcursor = 0x2603; /* snowman (U+2603) */ 27 | 28 | /* 29 | * Default columns and rows numbers 30 | --- st/x.c 31 | +++ st/x.c 32 | @@ -265,6 +265,8 @@ 33 | static Cursor cursor; 34 | static XColor xmousefg, xmousebg; 35 | 36 | +static int cursorblinks = 0; 37 | + 38 | void 39 | clipcopy(const Arg *dummy) 40 | { 41 | @@ -1526,16 +1527,19 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) 42 | /* draw the new one */ 43 | if (IS_SET(MODE_FOCUSED)) { 44 | switch (win.cursor) { 45 | - case 7: /* st extension */ 46 | - g.u = 0x2603; /* snowman (U+2603) */ 47 | + case 0: /* Blinking block */ 48 | + case 1: /* Blinking block (default) */ 49 | + if (IS_SET(MODE_BLINK)) 50 | + break; 51 | /* FALLTHROUGH */ 52 | - case 0: /* Blinking Block */ 53 | - case 1: /* Blinking Block (Default) */ 54 | - case 2: /* Steady Block */ 55 | + case 2: /* Steady block */ 56 | xdrawglyph(g, cx, cy); 57 | break; 58 | - case 3: /* Blinking Underline */ 59 | - case 4: /* Steady Underline */ 60 | + case 3: /* Blinking underline */ 61 | + if (IS_SET(MODE_BLINK)) 62 | + break; 63 | + /* FALLTHROUGH */ 64 | + case 4: /* Steady underline */ 65 | XftDrawRect(xw.draw, &drawcol, 66 | borderpx + cx * win.cw, 67 | borderpx + (cy + 1) * win.ch - \ 68 | @@ -1543,12 +1547,23 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) 69 | win.cw, cursorthickness); 70 | break; 71 | case 5: /* Blinking bar */ 72 | + if (IS_SET(MODE_BLINK)) 73 | + break; 74 | + /* FALLTHROUGH */ 75 | case 6: /* Steady bar */ 76 | XftDrawRect(xw.draw, &drawcol, 77 | win.hborderpx + cx * win.cw, 78 | win.vborderpx + cy * win.ch, 79 | cursorthickness, win.ch); 80 | break; 81 | + case 7: /* Blinking st cursor */ 82 | + if (IS_SET(MODE_BLINK)) 83 | + break; 84 | + /* FALLTHROUGH */ 85 | + case 8: /* Steady st cursor */ 86 | + g.u = stcursor; 87 | + xdrawglyph(g, cx, cy); 88 | + break; 89 | } 90 | } else { 91 | XftDrawRect(xw.draw, &drawcol, 92 | @@ -1690,9 +1705,12 @@ xsetmode(int set, unsigned int flags) 93 | int 94 | xsetcursor(int cursor) 95 | { 96 | - if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */ 97 | + if (!BETWEEN(cursor, 0, 8)) /* 7-8: st extensions */ 98 | return 1; 99 | win.cursor = cursor; 100 | + cursorblinks = win.cursor == 0 || win.cursor == 1 || 101 | + win.cursor == 3 || win.cursor == 5 || 102 | + win.cursor == 7; 103 | return 0; 104 | } 105 | 106 | @@ -1936,6 +1954,10 @@ run(void) 107 | if (FD_ISSET(ttyfd, &rfd) || xev) { 108 | if (!drawing) { 109 | trigger = now; 110 | + if (IS_SET(MODE_BLINK)) { 111 | + win.mode ^= MODE_BLINK; 112 | + } 113 | + lastblink = now; 114 | drawing = 1; 115 | } 116 | timeout = (maxlatency - TIMEDIFF(now, trigger)) \ 117 | @@ -1946,7 +1968,7 @@ run(void) 118 | 119 | /* idle detected or maxlatency exhausted -> draw */ 120 | timeout = -1; 121 | - if (blinktimeout && tattrset(ATTR_BLINK)) { 122 | + if (blinktimeout && (cursorblinks || tattrset(ATTR_BLINK))) { 123 | timeout = blinktimeout - TIMEDIFF(now, lastblink); 124 | if (timeout <= 0) { 125 | if (-timeout > blinktimeout) /* start visible */ 126 | @@ -1982,7 +2004,7 @@ main(int argc, char *argv[]) 127 | { 128 | xw.l = xw.t = 0; 129 | xw.isfixed = False; 130 | - xsetcursor(cursorshape); 131 | + xsetcursor(cursorstyle); 132 | 133 | ARGBEGIN { 134 | case 'a': 135 | -- 136 | 2.20.1 137 | 138 | -------------------------------------------------------------------------------- /st/patches/18. st-themed_cursor-0.8.5.diff: -------------------------------------------------------------------------------- 1 | diff --git a/x.c b/x.c 2 | index c343ba2..5a7461e 100644 3 | --- st/x.c 4 | +++ st/x.c 5 | @@ -14,6 +14,7 @@ 6 | #include 7 | #include 8 | #include 9 | +#include 10 | 11 | static char *argv0; 12 | #include "arg.h" 13 | @@ -1076,23 +1079,9 @@ xinit(int cols, int rows) 14 | die("XCreateIC failed. Could not obtain input method.\n"); 15 | 16 | /* white cursor, black outline */ 17 | - cursor = XCreateFontCursor(xw.dpy, mouseshape); 18 | + cursor = XcursorLibraryLoadCursor(xw.dpy, mouseshape); 19 | XDefineCursor(xw.dpy, xw.win, cursor); 20 | 21 | - if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) { 22 | - xmousefg.red = 0xffff; 23 | - xmousefg.green = 0xffff; 24 | - xmousefg.blue = 0xffff; 25 | - } 26 | - 27 | - if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) { 28 | - xmousebg.red = 0x0000; 29 | - xmousebg.green = 0x0000; 30 | - xmousebg.blue = 0x0000; 31 | - } 32 | - 33 | - XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg); 34 | - 35 | xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); 36 | xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False); 37 | xw.netwmname = XInternAtom(xw.dpy, "_NET_WM_NAME", False); 38 | -------------------------------------------------------------------------------- /st/patches/98. st-single-buffering-9ba7ecf7b15ec2986c6142036706aa353b249ef9.diff: -------------------------------------------------------------------------------- 1 | /* 2 | * Why do images not work in st using the w3m image hack? 3 | * 4 | * w3mimg uses a hack that draws an image on top of the terminal emulator Drawable 5 | * window. The hack relies on the terminal to use a single buffer to draw its 6 | * contents directly. 7 | * 8 | * st uses double-buffered drawing so the image is quickly replaced and may show a 9 | * short flicker effect. 10 | * 11 | * Below is a patch example to change st double-buffering to a single Drawable 12 | * buffer. 13 | */ 14 | --- st/x.c 15 | +++ st/x.c 16 | @@ -732,10 +732,6 @@ xresize(int col, int row) 17 | win.tw = col * win.cw; 18 | win.th = row * win.ch; 19 | 20 | - XFreePixmap(xw.dpy, xw.buf); 21 | - xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, 22 | - DefaultDepth(xw.dpy, xw.scr)); 23 | - XftDrawChange(xw.draw, xw.buf); 24 | xclear(0, 0, win.w, win.h); 25 | 26 | /* resize to new width */ 27 | @@ -1148,8 +1144,7 @@ xinit(int cols, int rows) 28 | gcvalues.graphics_exposures = False; 29 | dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, 30 | &gcvalues); 31 | - xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, 32 | - DefaultDepth(xw.dpy, xw.scr)); 33 | + xw.buf = xw.win; 34 | XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); 35 | XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); 36 | 37 | @@ -1632,8 +1627,6 @@ xdrawline(Line line, int x1, int y1, int x2) 38 | void 39 | xfinishdraw(void) 40 | { 41 | - XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, win.w, 42 | - win.h, 0, 0); 43 | XSetForeground(xw.dpy, dc.gc, 44 | dc.col[IS_SET(MODE_REVERSE)? 45 | defaultfg : defaultbg].pixel); 46 | -------------------------------------------------------------------------------- /st/patches/mitch-01-desktop-and-icon-4536f46cfff50c66a115755def0155d8e246b02f.patch: -------------------------------------------------------------------------------- 1 | --- st/Makefile 2 | +++ st/Makefile 3 | @@ -50,6 +50,10 @@ 4 | chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1 5 | tic -sx st.info 6 | @echo Please see the README file regarding the terminfo entry of st. 7 | + mkdir -p $(DESTDIR)$(PREFIX)/share/icons 8 | + mkdir -p $(DESTDIR)$(PREFIX)/share/applications 9 | + install -D -m 0755 ../res/st.desktop $(DESTDIR)$(PREFIX)/share/applications/st.desktop 10 | + install -D -m 0644 ../res/st.png $(DESTDIR)$(PREFIX)/share/icons/st.png 11 | 12 | uninstall: 13 | rm -f $(DESTDIR)$(PREFIX)/bin/st 14 | -------------------------------------------------------------------------------- /st/patches/mitch-02-stwrapper-4536f46cfff50c66a115755def0155d8e246b02f.patch: -------------------------------------------------------------------------------- 1 | --- st/Makefile 2020-05-25 10:55:23.124057917 -0500 2 | +++ st/Makefile 2020-05-25 10:57:53.824765898 -0500 3 | @@ -44,6 +44,7 @@ 4 | install: st 5 | mkdir -p $(DESTDIR)$(PREFIX)/bin 6 | cp -f st $(DESTDIR)$(PREFIX)/bin 7 | + install -D -m 0755 ../res/stwrapper $(DESTDIR)$(PREFIX)/bin/stwrapper 8 | chmod 755 $(DESTDIR)$(PREFIX)/bin/st 9 | mkdir -p $(DESTDIR)$(MANPREFIX)/man1 10 | sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1 11 | -------------------------------------------------------------------------------- /st/patches/mitch-03-openbsd_no_terminfo-4536f46cfff50c66a115755def0155d8e246b02f.patch: -------------------------------------------------------------------------------- 1 | --- st/Makefile Mon May 10 11:02:55 2021 2 | +++ st/Makefile Mon May 10 11:04:05 2021 3 | @@ -49,8 +49,7 @@ 4 | mkdir -p $(DESTDIR)$(MANPREFIX)/man1 5 | sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1 6 | chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1 7 | - tic -sx st.info 8 | - @echo Please see the README file regarding the terminfo entry of st. 9 | + if [ "`uname`" != OpenBSD ] ; then tic -sx st.info ; fi 10 | mkdir -p $(DESTDIR)$(PREFIX)/share/icons 11 | mkdir -p $(DESTDIR)$(PREFIX)/share/applications 12 | install -D -m 0755 ../res/st.desktop $(DESTDIR)$(PREFIX)/share/applications/st.desktop 13 | -------------------------------------------------------------------------------- /st/res/st.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Simple Terminal 3 | GenericName=Terminal 4 | Comment=Suckless Simple Terminal 5 | Keywords=st;simple;suckless;shell;prompt;command;commandline;cmd; 6 | 7 | TryExec=st 8 | Exec=stwrapper 9 | Icon=/home/mitch/.local/share/icons/st.png 10 | 11 | Type=Application 12 | Categories=System;TerminalEmulator; 13 | StartupWMClass=Simple Terminal 14 | StartupNotify=false 15 | Terminal=false 16 | X-GNOME-SingleWindow=false 17 | -------------------------------------------------------------------------------- /st/res/st.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitchweaver/suckless/e722b7dfed483a221c7d8cbe628e8b0e2978a6e8/st/res/st.png -------------------------------------------------------------------------------- /st/res/stwrapper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # http://github.com/mitchweaver/suckless 4 | # 5 | # wrapper for suckless simple terminal 6 | # 7 | 8 | case $1 in 9 | -h|--help) 10 | >&2 printf 'Usage: %s [-t]\n' "${0##*/}" 11 | ;; 12 | -t|--tabbed) 13 | shift 14 | nohup tabbed -c -k -n 'Simple Terminal' -r 2 \ 15 | st \ 16 | -w '' \ 17 | -c 'Simple Terminal' \ 18 | -t 'Simple Terminal' \ 19 | "$@" >/dev/null 2>&1 & 20 | ;; 21 | *) 22 | nohup \ 23 | st \ 24 | -c 'Simple Terminal' \ 25 | -t 'Simple Terminal' \ 26 | "$@" >/dev/null 2>&1 & 27 | esac 28 | -------------------------------------------------------------------------------- /tabbed/cfg/config.h: -------------------------------------------------------------------------------- 1 | /* static const char font[] = "spleen:pixelsize=24:antialias=true:autohint=true"; */ 2 | static const char font[] = "ShureTechMono Nerd Font:pixelsize=24:antialias=true:autohint=true"; 3 | /* static const char font[] = "Terminus:pixelsize=20:antialias=false:autohint=false"; */ 4 | /* static const char font[] = "Hack:pixelsize=20:antialias=true:autohint=true"; */ 5 | /* static const char font[] = "cozette:pixelsize=10:antialias=false:autohint=false"; */ 6 | /* static const char font[] = "Terminus:pixelsize=18:antialias=false:autohint=false"; */ 7 | /* static const char font[] = "ShureTechMono Nerd Font:pixelsize=16:antialias=true:autohint=true"; */ 8 | /* static const char font[] = "Roboto Mono:pixelsize=20:antialias=true:autohint=true"; */ 9 | /* static const char font[] = "tewi:pixelsize=10:antialias=false:autohint=false"; */ 10 | 11 | static const int barheight = 30; 12 | 13 | // theme, included from ${HOME}/.cache/themes in config.mk 14 | #include 15 | 16 | static const char before[] = "<"; 17 | static const char after[] = ">"; 18 | // what to show in titles after truncation 19 | static const char titletrim[] = "..."; 20 | // the minimum size a tab can be 21 | static const int tabwidth = 80; 22 | 23 | /* Where to place a new tab when it is opened. When npisrelative is True, 24 | * then the current position is changed + newposition. If npisrelative 25 | * is False, then newposition is an absolute position. */ 26 | static int newposition = 1; 27 | static Bool npisrelative = True; 28 | static const Bool foreground = False; 29 | static const Bool urgentswitch = False; 30 | 31 | #define SETPROP(p) { \ 32 | .v = (char *[]){ "/bin/sh", "-c", \ 33 | "prop=\"`xwininfo -children -id $1 | grep '^ 0x' |" \ 34 | "sed -e's@^ *\\(0x[0-9a-f]*\\) \"\\([^\"]*\\)\".*@\\1 \\2@' |" \ 35 | "xargs -0 printf %b | dmenu -l 10`\" &&" \ 36 | "xprop -id $1 -f $0 8s -set $0 \"$prop\"", \ 37 | p, winid, NULL \ 38 | } \ 39 | } 40 | 41 | static const Key keys[] = { 42 | /* modifier key function argument */ 43 | { ControlMask, XK_n, focusonce, { 0 } }, 44 | { ControlMask, XK_n, spawn, { 0 } }, 45 | 46 | /* ------ shifts to next tab ------ */ 47 | { ControlMask|ShiftMask, XK_k, rotate, { .i = +1 } }, 48 | { ControlMask|ShiftMask, XK_j, rotate, { .i = -1 } }, 49 | 50 | { ControlMask, XK_Tab, rotate, { .i = +1 } }, 51 | { ControlMask|ShiftMask, XK_Tab, rotate, { .i = -1 } }, 52 | { ShiftMask, XK_Tab, rotate, { .i = 0 } }, // back-&-forth 53 | 54 | /* ------- moves a tab left or right in stack ---- */ 55 | { ControlMask|ShiftMask, XK_h, movetab, { .i = -1 } }, 56 | { ControlMask|ShiftMask, XK_l, movetab, { .i = +1 } }, 57 | { ControlMask, XK_w, killclient, { 0 } }, 58 | 59 | { ControlMask, XK_1, move, { .i = 0 } }, 60 | { ControlMask, XK_2, move, { .i = 1 } }, 61 | { ControlMask, XK_3, move, { .i = 2 } }, 62 | { ControlMask, XK_4, move, { .i = 3 } }, 63 | { ControlMask, XK_5, move, { .i = 4 } }, 64 | { ControlMask, XK_6, move, { .i = 5 } }, 65 | { ControlMask, XK_7, move, { .i = 6 } }, 66 | { ControlMask, XK_8, move, { .i = 7 } }, 67 | { ControlMask, XK_9, move, { .i = 8 } }, 68 | { ControlMask, XK_0, move, { .i = 9 } }, 69 | { 0, XK_F11, fullscreen, { 0 } }, 70 | }; 71 | -------------------------------------------------------------------------------- /tabbed/cfg/config.mk: -------------------------------------------------------------------------------- 1 | VERSION=4.7 2 | 3 | PREFIX = ${HOME}/.local 4 | MANPREFIX = ${PREFIX}/share/man 5 | 6 | XINERAMALIBS = -lXinerama 7 | XINERAMAFLAGS = -DXINERAMA 8 | 9 | FREETYPELIBS = -lfontconfig -lXft 10 | 11 | # -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 12 | # OpenBSD / Linux 13 | X11INC = /usr/X11R6/include 14 | X11LIB = /usr/X11R6/lib 15 | 16 | # NetBSD 17 | # X11INC = /usr/X11R7/include 18 | # X11LIB = /usr/X11R7/lib 19 | # -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 20 | 21 | # -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 22 | # OpenBSD 23 | # FREETYPEINC = ${X11INC}/freetype2 24 | # Linux 25 | FREETYPEINC = /usr/include/freetype2 26 | # -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 27 | 28 | INCS = -I${X11INC} -I${FREETYPEINC} -I${HOME}/.cache/themes 29 | LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lm -lXrender 30 | 31 | CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} 32 | CFLAGS = -O2 -pipe -fstack-protector-all -std=c99 -pedantic -Wall ${INCS} ${CPPFLAGS} 33 | LDFLAGS = -s ${LIBS} 34 | 35 | CC = cc 36 | -------------------------------------------------------------------------------- /tabbed/patches/01. tabbed-autohide-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.diff: -------------------------------------------------------------------------------- 1 | --- tabbed/tabbed.c Thu Feb 27 03:09:16 2020 2 | +++ tabbed/tabbed.c Thu Feb 27 03:12:22 2020 3 | @@ -152,7 +152,7 @@ 4 | [MapRequest] = maprequest, 5 | [PropertyNotify] = propertynotify, 6 | }; 7 | -static int bh, obh, wx, wy, ww, wh; 8 | +static int bh, obh, wx, wy, ww, wh, vbh; 9 | static unsigned int numlockmask; 10 | static Bool running = True, nextfocus, doinitspawn = True, 11 | fillagain = False, closelastclient = False, 12 | @@ -315,7 +315,7 @@ 13 | drawbar(void) 14 | { 15 | XftColor *col; 16 | - int c, cc, fc, width; 17 | + int c, cc, fc, width, nbh, i; 18 | char *name = NULL; 19 | 20 | if (nclients == 0) { 21 | @@ -323,12 +323,21 @@ 22 | dc.w = ww; 23 | XFetchName(dpy, win, &name); 24 | drawtext(name ? name : "", dc.norm); 25 | - XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, bh, 0, 0); 26 | + XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, vbh, 0, 0); 27 | XSync(dpy, False); 28 | 29 | return; 30 | } 31 | 32 | + nbh = nclients > 1 ? vbh : 0; 33 | + if (bh != nbh) { 34 | + bh = nbh; 35 | + for (i = 0; i < nclients; i++) 36 | + XMoveResizeWindow(dpy, clients[i]->win, 0, bh, ww, wh - bh); 37 | + } 38 | + if (bh == 0) 39 | + return; 40 | + 41 | width = ww; 42 | cc = ww / tabwidth; 43 | if (nclients > cc) 44 | @@ -975,7 +984,7 @@ 45 | screen = DefaultScreen(dpy); 46 | root = RootWindow(dpy, screen); 47 | initfont(font); 48 | - bh = dc.h = dc.font.height + 2; 49 | + vbh = dc.h = dc.font.height + 2; 50 | 51 | /* init atoms */ 52 | wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); 53 | -------------------------------------------------------------------------------- /tabbed/patches/02. tabbed-clientnumber-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.diff: -------------------------------------------------------------------------------- 1 | --- tabbed/tabbed.c 2 | +++ tabbed/tabbed.c 3 | @@ -318,6 +318,7 @@ drawbar(void) 4 | XftColor *col; 5 | int c, cc, fc, width; 6 | char *name = NULL; 7 | + char tabtitle[256]; 8 | 9 | if (nclients == 0) { 10 | dc.x = 0; 11 | @@ -359,7 +360,9 @@ drawbar(void) 12 | } else { 13 | col = clients[c]->urgent ? dc.urg : dc.norm; 14 | } 15 | - drawtext(clients[c]->name, col); 16 | + snprintf(tabtitle, sizeof(tabtitle), "%d: %s", 17 | + c + 1, clients[c]->name); 18 | + drawtext(tabtitle, col); 19 | dc.x += dc.w; 20 | clients[c]->tabx = dc.x; 21 | } 22 | -------------------------------------------------------------------------------- /tabbed/patches/04. tabbed-alpha-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.diff: -------------------------------------------------------------------------------- 1 | # 2 | # remember to add "-lXrender" to ${LIBS} in config.mk 3 | # 4 | --- tabbed/tabbed.c 5 | +++ tabbed/tabbed.c 6 | @@ -170,6 +170,9 @@ static char **cmd; 7 | static char *wmname = "tabbed"; 8 | static const char *geometry; 9 | 10 | +static Colormap cmap; 11 | +static Visual *visual = NULL; 12 | + 13 | char *argv0; 14 | 15 | /* configuration, allows nested code to access above variables */ 16 | @@ -255,8 +258,8 @@ configurenotify(const XEvent *e) 17 | ww = ev->width; 18 | wh = ev->height; 19 | XFreePixmap(dpy, dc.drawable); 20 | - dc.drawable = XCreatePixmap(dpy, root, ww, wh, 21 | - DefaultDepth(dpy, screen)); 22 | + dc.drawable = XCreatePixmap(dpy, win, ww, wh, 23 | + 32); 24 | 25 | if (!obh && (wh <= bh)) { 26 | obh = bh; 27 | @@ -399,7 +402,7 @@ drawtext(const char *text, XftColor col[ColLast]) 28 | ; 29 | } 30 | 31 | - d = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen)); 32 | + d = XftDrawCreate(dpy, dc.drawable, visual, cmap); 33 | XftDrawStringUtf8(d, &col[ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len); 34 | XftDrawDestroy(d); 35 | } 36 | @@ -564,7 +567,7 @@ getcolor(const char *colstr) 37 | { 38 | XftColor color; 39 | 40 | - if (!XftColorAllocName(dpy, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen), colstr, &color)) 41 | + if (!XftColorAllocName(dpy, visual, cmap, colstr, &color)) 42 | die("%s: cannot allocate color '%s'\n", argv0, colstr); 43 | 44 | return color; 45 | @@ -1016,18 +1019,60 @@ setup(void) 46 | wy = dh + wy - wh - 1; 47 | } 48 | 49 | + XVisualInfo *vis; 50 | + XRenderPictFormat *fmt; 51 | + int nvi; 52 | + int i; 53 | + 54 | + XVisualInfo tpl = { 55 | + .screen = screen, 56 | + .depth = 32, 57 | + .class = TrueColor 58 | + }; 59 | + 60 | + vis = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &tpl, &nvi); 61 | + for(i = 0; i < nvi; i ++) { 62 | + fmt = XRenderFindVisualFormat(dpy, vis[i].visual); 63 | + if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { 64 | + visual = vis[i].visual; 65 | + break; 66 | + } 67 | + } 68 | + 69 | + XFree(vis); 70 | + 71 | + if (! visual) { 72 | + fprintf(stderr, "Couldn't find ARGB visual.\n"); 73 | + exit(1); 74 | + } 75 | + 76 | + cmap = XCreateColormap( dpy, root, visual, None); 77 | dc.norm[ColBG] = getcolor(normbgcolor); 78 | dc.norm[ColFG] = getcolor(normfgcolor); 79 | dc.sel[ColBG] = getcolor(selbgcolor); 80 | dc.sel[ColFG] = getcolor(selfgcolor); 81 | dc.urg[ColBG] = getcolor(urgbgcolor); 82 | dc.urg[ColFG] = getcolor(urgfgcolor); 83 | - dc.drawable = XCreatePixmap(dpy, root, ww, wh, 84 | - DefaultDepth(dpy, screen)); 85 | - dc.gc = XCreateGC(dpy, root, 0, 0); 86 | 87 | - win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0, 88 | - dc.norm[ColFG].pixel, dc.norm[ColBG].pixel); 89 | + XSetWindowAttributes attrs; 90 | + attrs.background_pixel = dc.norm[ColBG].pixel; 91 | + attrs.border_pixel = dc.norm[ColFG].pixel; 92 | + attrs.bit_gravity = NorthWestGravity; 93 | + attrs.event_mask = FocusChangeMask | KeyPressMask 94 | + | ExposureMask | VisibilityChangeMask | StructureNotifyMask 95 | + | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; 96 | + attrs.background_pixmap = None ; 97 | + attrs.colormap = cmap; 98 | + 99 | + win = XCreateWindow(dpy, root, wx, wy, 100 | + ww, wh, 0, 32, InputOutput, 101 | + visual, CWBackPixmap | CWBorderPixel | CWBitGravity 102 | + | CWEventMask | CWColormap, &attrs); 103 | + 104 | + dc.drawable = XCreatePixmap(dpy, win, ww, wh, 105 | + 32); 106 | + dc.gc = XCreateGC(dpy, dc.drawable, 0, 0); 107 | + 108 | XMapRaised(dpy, win); 109 | XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask | 110 | ButtonPressMask | ExposureMask | KeyPressMask | 111 | -------------------------------------------------------------------------------- /tabbed/patches/05. tabbed-bar_height-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.diff: -------------------------------------------------------------------------------- 1 | --- tabbed/config.def.h 2 | +++ tabbed/config.def.h 3 | @@ -10,7 +10,7 @@ static const char before[] = "<"; 4 | static const int tabwidth = 200; 5 | static const Bool foreground = True; 6 | static Bool urgentswitch = False; 7 | - 8 | +static const int barHeight = 24; 9 | /* 10 | * Where to place a new tab when it is opened. When npisrelative is True, 11 | * then the current position is changed + newposition. If npisrelative 12 | --- tabbed/tabbed.c 13 | +++ tabbed/tabbed.c 14 | @@ -920,7 +920,7 @@ setup(void) { 15 | screen = DefaultScreen(dpy); 16 | root = RootWindow(dpy, screen); 17 | initfont(font); 18 | - vbh = dc.h = dc.font.height + 2; 19 | + vbh = dc.h = barheight; 20 | 21 | /* init atoms */ 22 | wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); 23 | -------------------------------------------------------------------------------- /tabbed/patches/mitch-01-pledge_OpenBSD-dabf6a25ab01107fc1e0464ee6a3e369d1626f97.patch: -------------------------------------------------------------------------------- 1 | --- tabbed/tabbed.c 2 | +++ tabbed/tabbed.c 3 | @@ -1280,6 +1280,15 @@ 4 | int 5 | main(int argc, char *argv[]) 6 | { 7 | + 8 | +#ifdef __OpenBSD__ 9 | + if (pledge("stdio rpath unix proc exec dns", NULL) == -1) 10 | + { 11 | + fprintf (stderr, "%s: pledge\n", "tabbed"); 12 | + exit ( 1 ); 13 | + } 14 | +#endif 15 | + 16 | Bool detach = False; 17 | int replace = 0; 18 | char *pstr; 19 | --------------------------------------------------------------------------------