Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-xtheme-20220218-001337-dwm-6.3.diff - sites - public wiki contents of suckl…
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-xtheme-20220218-001337-dwm-6.3.diff (5188B)
---
1 diff --git a/Makefile b/Makefile
2 index 77bcbc0..fadb218 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -17,16 +17,23 @@ options:
6 .c.o:
7 ${CC} -c ${CFLAGS} $<
8
9 -${OBJ}: config.h config.mk
10 +${OBJ}: config.h theme_beg.h config.mk
11
12 -config.h:
13 - cp config.def.h $@
14 +theme.h:
15 + ./xtheme
16 +
17 +theme_beg.h:
18 + ./themesetup
19 +
20 +config.h: theme.h
21 + cp -n config.def.h $@
22
23 dwm: ${OBJ}
24 ${CC} -o $@ ${OBJ} ${LDFLAGS}
25 + rm -f theme_{beg,end}.h
26
27 clean:
28 - rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
29 + rm -f dwm ${OBJ} theme_{beg,end}.h dwm-${VERSION}.tar.gz
30
31 dist: clean
32 mkdir -p dwm-${VERSION}
33 diff --git a/config.def.h b/config.def.h
34 index a2ac963..359c520 100644
35 --- a/config.def.h
36 +++ b/config.def.h
37 @@ -1,11 +1,15 @@
38 /* See LICENSE file for copyright and license details. */
39
40 +/* theme management */
41 +# include "theme_beg.h" /* this is a compile-time generated header file…
42 +# include "theme.h"
43 +
44 /* appearance */
45 -static const unsigned int borderpx = 1; /* border pixel of wind…
46 -static const unsigned int snap = 32; /* snap pixel */
47 -static const int showbar = 1; /* 0 means no bar */
48 -static const int topbar = 1; /* 0 means bottom bar */
49 -static const char *fonts[] = { "monospace:size=10" };
50 +static const unsigned int borderpx = DWM_BORDERPX; /* border pi…
51 +static const unsigned int snap = DWM_SNAP; /* snap pixe…
52 +static const int showbar = DWM_SHOWBAR; /* 0 means n…
53 +static const int topbar = DWM_TOPBAR; /* 0 means b…
54 +static const char *fonts[] = DWM_FONT;
55 static const char dmenufont[] = "monospace:size=10";
56 static const char col_gray1[] = "#222222";
57 static const char col_gray2[] = "#444444";
58 @@ -13,9 +17,9 @@ static const char col_gray3[] = "#bbbbbb";
59 static const char col_gray4[] = "#eeeeee";
60 static const char col_cyan[] = "#005577";
61 static const char *colors[][3] = {
62 - /* fg bg border */
63 - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
64 - [SchemeSel] = { col_gray4, col_cyan, col_cyan },
65 + /* fg bg border …
66 + [SchemeNorm] = { DWM_FOREGROUND, DWM_BACKGROUND, DWM_BORD…
67 + [SchemeSel] = { DWM_SELFOREGROUND, DWM_SELBACKGROUND, DWM_SELB…
68 };
69
70 /* tagging */
71 @@ -60,6 +64,9 @@ static char dmenumon[2] = "0"; /* component of dmenucm…
72 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", d…
73 static const char *termcmd[] = { "st", NULL };
74
75 +/* theme management */
76 +# include "theme_end.h" /* this is a compile-time generated header file…
77 +
78 static Key keys[] = {
79 /* modifier key function argu…
80 { MODKEY, XK_p, spawn, {.v …
81 diff --git a/themesetup b/themesetup
82 new file mode 100755
83 index 0000000..e8710c1
84 --- /dev/null
85 +++ b/themesetup
86 @@ -0,0 +1,5 @@
87 +#!/bin/sh
88 +
89 +echo \# if $(cat theme.h | cut -d' ' -f3 | sed "s/^/defined /;s/$/ ||/"…
90 +echo -e "# error (conflicting macro names)\n# endif" >> theme_beg.h
91 +cat theme.h | cut -d' ' -f3 | sed "s/^/# undef /;" > theme_end.h
92 diff --git a/xtable.md b/xtable.md
93 new file mode 100644
94 index 0000000..ff87701
95 --- /dev/null
96 +++ b/xtable.md
97 @@ -0,0 +1,13 @@
98 +| TYPE | RESOURCE | DEFAULT …
99 +|:---------:|:-----------------:|:---------------------:|:-------------…
100 +| U | borderpx | 1 …
101 +| U | snap | …
102 +| I | showbar | …
103 +| I | topbar | …
104 +| SA | font | …
105 +| S | foreground | #…
106 +| S | background | #…
107 +| S | border | …
108 +| S | selforeground | #07364…
109 +| S | selbackground | #2aa19…
110 +| S | selborder | #c…
111 diff --git a/xtheme b/xtheme
112 new file mode 100755
113 index 0000000..9a2f299
114 --- /dev/null
115 +++ b/xtheme
116 @@ -0,0 +1,63 @@
117 +#!/bin/sh
118 +
119 +prefix=dwm
120 +themeout=theme.h
121 +xtable=xtable.md
122 +
123 +rm -f $themeout
124 +
125 +set_resource ()
126 +{
127 + T=$1
128 + M=$2
129 + V=$3
130 +
131 + case $T in
132 + S)
133 + V=\"$V\"
134 + ;;
135 + SA)
136 + V="{\"$(echo $V | sed 's/, /", "/g')\"}"
137 + esac
138 +
139 + echo "# define $M $V" >> $themeout
140 +}
141 +
142 +cat "$xtable" …
143 + sed '1,2d;s/\(^|\t*\)\|\(|$\)//g;s/\t\+|\t\+/|/g' …
144 + while IFS='|' read T R D A
145 + do
146 + m=$(echo "$prefix"'_'"$R" | tr '[:lower:]' '[:upper:]')
147 +
148 + l=''
149 +
150 + for r in "$R" "$A"
151 + do
152 + [[ "$r" == '' ]] && continue
153 +
154 + e=0
155 +
156 + for p in "$prefix" ''
157 + do
158 + l="$( …
159 + xrdb -query …
160 + | grep -P "^$p\*?\.?$r:…
161 + | sed 's/\s\+/ /g' | cu…
162 + )"
163 +
164 + if [[ "$l" != '' ]]
165 + then
166 + e=1
167 + set_resource $T $m "$l"
168 + break
169 + fi
170 + done
171 +
172 + [[ $e == 1 ]] && break
173 + done
174 +
175 + if [[ "$l" == '' ]]
176 + then
177 + set_resource $T $m "$D"
178 + fi
179 + done
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.