autolinux


Logs | Files | README | LICENSE | GitLab


1
commit c81d3f98a08507bdbdbb758791d1108d613632f5
2
Author: Connor Etherington <[email protected]>
3
Date:   Wed Mar 22 21:31:51 2023 +0200
4
5
    Auto-Commit Update 22.03.2023 - 21:31:51
6
---
7
 AutoLinux                   | Bin 109536 -> 110128 bytes
8
 AutoLinux.c                 |   6 ++----
9
 AutoLinux.o                 | Bin 107296 -> 0 bytes
10
 config.h                    |  27 +++++++++++++++++++++------
11
 drw.o                       | Bin 10320 -> 0 bytes
12
 package.json                |  20 ++++++++++++++++++++
13
 patch/bar_tags.c            |   6 ++++--
14
 patch/cust/bar_date.c       |  39 +++++++++++++++++++++++++++++++++++++++
15
 patch/cust/bar_date.h       |   2 ++
16
 patch/cust/bar_datetime.c   |  34 ++++++++++++++++++++++++++++++++++
17
 patch/cust/bar_datetime.h   |   2 ++
18
 patch/{ => cust}/bar_time.c |  28 ++++++++++++++--------------
19
 patch/{ => cust}/bar_time.h |   0
20
 patch/include.c             |   3 ++-
21
 patch/include.h             |   3 ++-
22
 util.o                      | Bin 2224 -> 0 bytes
23
 16 files changed, 142 insertions(+), 28 deletions(-)
24
25
diff --git a/AutoLinux b/AutoLinux
26
index a9a76d1..087f349 100755
27
Binary files a/AutoLinux and b/AutoLinux differ
28
diff --git a/AutoLinux.c b/AutoLinux.c
29
index 8b9f814..9a1ddf2 100644
30
--- a/AutoLinux.c
31
+++ b/AutoLinux.c
32
@@ -69,11 +69,10 @@
33
 #define SPTAGMASK		(((1 << LENGTH(scratchpads))-1) << LENGTH(tags))
34
 #define TEXTW(X)                (drw_fontset_getwidth(drw, (X)) + lrpad)
35
 #define TRUNC(X,A,B)            (MAX((A), MIN((X), (B))))
36
-#define currentTime() { .v = (const char*[]){ "/bin/sh", "-c", "date '+%H:%M:%S'", NULL } }
37
 
38
 /* enums */
39
 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
40
-enum { SchemeNorm, SchemeSel }; /* color schemes */
41
+enum { SchemeNorm, SchemeSel, SchemeTime, SchemeActive, SchemeInactive }; /* color schemes */
42
 enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
43
        NetWMFullscreen, NetActiveWindow, NetWMWindowType,
44
        NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
45
@@ -136,9 +135,8 @@ typedef struct {
46
 	int alignment; // see bar alignment enum
47
 	int (*widthfunc)(Bar *bar, BarWidthArg *a);
48
 	int (*drawfunc)(Bar *bar, BarDrawArg *a);
49
-	int (*timefunc)(Bar *bar, BarDrawArg *a);
50
 	int (*clickfunc)(Bar *bar, Arg *arg, BarClickArg *a);
51
-	char *name; // for debugging             //
52
+	char *name; // for debugging
53
 	int x, w; // position, width for internal use
54
 } BarRule;
55
 
56
diff --git a/AutoLinux.o b/AutoLinux.o
57
deleted file mode 100644
58
index 7c77353..0000000
59
Binary files a/AutoLinux.o and /dev/null differ
60
diff --git a/config.h b/config.h
61
index 799af40..d772b0a 100644
62
--- a/config.h
63
+++ b/config.h
64
@@ -54,12 +54,25 @@ static char normfgcolor[]           = "#41fdfe";
65
 static char selfgcolor[]            = "#00ff00";
66
 static char selbordercolor[]        = "#c9c9c9";
67
 static char selbgcolor[]            = "#1A2026";
68
+static char timefgcolor[]           = "#1A2026";
69
+static char timebordercolor[]       = "#ff5782";
70
+static char timebgcolor[]           = "#ff5782";
71
+static char activefgcolor[]         = "#EFEFEF";
72
+static char activebordercolor[]     = "#ff5782";
73
+static char activebgcolor[]         = "#1A2026";
74
+static char inactivefgcolor[]       = "#ff5782";
75
+static char inactivebordercolor[]   = "#ff5782";
76
+static char inactivebgcolor[]       = "#1A2026";
77
 
78
 static char *colors[][3] = {
79
 
80
            /*               fg           bg           border   */
81
        [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
82
        [SchemeSel]  = { selfgcolor,  selbgcolor,  selbordercolor  },
83
+       [SchemeTime]  = { timefgcolor, timebgcolor, timebordercolor },
84
+       [SchemeActive]  = { activefgcolor, activebgcolor, activebordercolor },
85
+       [SchemeInactive]  = { inactivefgcolor, inactivebgcolor, inactivebordercolor },
86
+
87
 };
88
 
89
 typedef struct {
90
@@ -78,6 +91,7 @@ static Sp scratchpads[] = {
91
 //----------------------------------------------------------- Tagging ----------------------------------------------------------//
92
 
93
 static const char *tags[] =   { " 1 ", " 2 ", " 3 ", " 4 ", "  ", " 6 ", " 7 ", " 8 ", " 9 " };
94
+//static const char *tags[] =   { "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  " };
95
 //static const char *tags[] =   { " 1 ", " 2 ", " 3 ", " 4 ", "  ", " 6 ", " 7 ", " 8 ", " 9 " };
96
 //static const char *tags[] =   { "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  " };
97
 // static const char *tags[] =  {  " ", " ", " ", " ", " ", " ", " ", " ", " "  };
98
@@ -100,12 +114,13 @@ static const Rule rules[] = {
99
 //-------------------------------------------------------- Bar Allignment -------------------------------------------------------//
100
 
101
 static const BarRule barrules[] = {
102
-   	/* monitor  bar    alignment             widthfunc              drawfunc              clickfunc           name */
103
- /* { -1,       0,     BAR_ALIGN_LEFT,       width_tags,            draw_tags,            click_tags,         "tags"     }, */
104
-    { -1,       0,     BAR_ALIGN_LEFT,       width_ltsymbol,        draw_ltsymbol,        click_ltsymbol,     "layout"   },
105
-    { -1,       0,     BAR_ALIGN_RIGHT,      width_time,            draw_time,            click_time,         "time"     },
106
-  	{ -1,       0,     BAR_ALIGN_CENTER,     width_tags,            draw_tags,            click_tags,         "tags"     },
107
-    { 0,        0,     BAR_ALIGN_NONE,       width_wintitle,        draw_wintitle,        click_wintitle,     "wintitle" },
108
+   	/* monitor  bar    alignment               widthfunc              drawfunc              clickfunc           name */
109
+ /* { -1,       0,     BAR_ALIGN_LEFT,         width_tags,            draw_tags,            click_tags,         "tags"     }, */
110
+  	{ -1,       0,     BAR_ALIGN_CENTER,       width_tags,            draw_tags,            click_tags,         "tags"     },
111
+    { -1,       0,     BAR_ALIGN_LEFT_LEFT,    width_ltsymbol,        draw_ltsymbol,        click_ltsymbol,     "layout"   },
112
+    { 0,        0,     BAR_ALIGN_RIGHT_RIGHT,  width_time,            draw_time,            click_status,       "time"     },
113
+    { 1,        0,     BAR_ALIGN_RIGHT_RIGHT,  width_datetime,        draw_datetime,        click_status,       "datetime" },
114
+    { 0,        0,     BAR_ALIGN_LEFT,         width_wintitle,        draw_wintitle,        click_wintitle,     "wintitle" },
115
 };
116
 
117
 
118
diff --git a/drw.o b/drw.o
119
deleted file mode 100644
120
index 8c310c9..0000000
121
Binary files a/drw.o and /dev/null differ
122
diff --git a/package.json b/package.json
123
new file mode 100644
124
index 0000000..65a87dd
125
--- /dev/null
126
+++ b/package.json
127
@@ -0,0 +1,20 @@
128
+{
129
+  "name": "autolinux",
130
+  "version": "1.0.0",
131
+  "description": "",
132
+  "main": "index.js",
133
+  "scripts": {
134
+    "test": "echo \"Error: no test specified\" && exit 1"
135
+  },
136
+  "repository": {
137
+    "type": "git",
138
+    "url": "git+ssh://[email protected]/a4to/AutoLinux.git"
139
+  },
140
+  "keywords": [],
141
+  "author": "",
142
+  "license": "ISC",
143
+  "bugs": {
144
+    "url": "https://gitlab.com/a4to/AutoLinux/issues"
145
+  },
146
+  "homepage": "https://gitlab.com/a4to/AutoLinux#readme"
147
+}
148
diff --git a/patch/bar_tags.c b/patch/bar_tags.c
149
index 680e1fe..2185973 100644
150
--- a/patch/bar_tags.c
151
+++ b/patch/bar_tags.c
152
@@ -14,7 +14,7 @@ draw_tags(Bar *bar, BarDrawArg *a)
153
 {
154
 	int invert;
155
 	int w, x = a->x;
156
-	int boxs = drw->fonts->h / 9;
157
+  int boxs = drw->fonts->h / 9;
158
 	int boxw = drw->fonts->h / 6 + 2;
159
 	unsigned int i, occ = 0, urg = 0;
160
 	Client *c;
161
@@ -37,9 +37,11 @@ draw_tags(Bar *bar, BarDrawArg *a)
162
 		x += w;
163
 	}
164
 
165
-	return x;
166
+ /* move off center by 5 chars: */
167
+  return x;
168
 }
169
 
170
+
171
 int
172
 click_tags(Bar *bar, Arg *arg, BarClickArg *a)
173
 {
174
diff --git a/patch/cust/bar_date.c b/patch/cust/bar_date.c
175
new file mode 100644
176
index 0000000..00f1128
177
--- /dev/null
178
+++ b/patch/cust/bar_date.c
179
@@ -0,0 +1,39 @@
180
+
181
+#define SH(cmd) (const char*[]){ "/bin/sh", "-c", cmd, NULL }
182
+
183
+// get current time once a second
184
+void get_date(char *time) {
185
+    FILE *fp;
186
+    char buf[100];
187
+    fp = popen("date '+%a, %d %b    '", "r");
188
+    fgets(buf, 100, fp);
189
+    pclose(fp);
190
+    strcpy(time, buf);
191
+}
192
+
193
+int
194
+width_time(Bar *bar, BarWidthArg *a)
195
+{
196
+  return TEXTW("DDD, DD MMM   ") + lrpad;
197
+}
198
+
199
+int
200
+draw_time(Bar *bar, BarDrawArg *a)
201
+{
202
+	int boxs = drw->fonts->h / 9;
203
+	int boxw = drw->fonts->h / 6 + 2;
204
+	int x = a->x, w = a->w;
205
+	Monitor *m = bar->mon;
206
+
207
+	drw_setscheme(drw, scheme[m == selmon ? SchemeActive : SchemeInactive]);
208
+
209
+  char date[100];
210
+  get_date(date);
211
+  date[strlen(date) - 1] = '\0';
212
+
213
+  drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, date, 0);
214
+  drw_map(drw, bar->win, 0, 0, w, bh);
215
+
216
+  return x + w;
217
+}
218
+
219
diff --git a/patch/cust/bar_date.h b/patch/cust/bar_date.h
220
new file mode 100644
221
index 0000000..29416b2
222
--- /dev/null
223
+++ b/patch/cust/bar_date.h
224
@@ -0,0 +1,2 @@
225
+static int width_date(Bar *bar, BarWidthArg *a);
226
+static int draw_date(Bar *bar, BarDrawArg *a);
227
diff --git a/patch/cust/bar_datetime.c b/patch/cust/bar_datetime.c
228
new file mode 100644
229
index 0000000..6b4ca61
230
--- /dev/null
231
+++ b/patch/cust/bar_datetime.c
232
@@ -0,0 +1,34 @@
233
+int
234
+width_datetime(Bar *bar, BarWidthArg *a)
235
+{
236
+  return TEXTW("DDD, DD MMM   00:00  ") + lrpad;
237
+}
238
+
239
+int
240
+draw_datetime(Bar *bar, BarDrawArg *a)
241
+{
242
+	int boxs = drw->fonts->h / 9;
243
+	int boxw = drw->fonts->h / 6 + 2;
244
+	int x = a->x, w = a->w;
245
+	Monitor *m = bar->mon;
246
+
247
+	drw_setscheme(drw, scheme[m == selmon ? SchemeActive : SchemeInactive]);
248
+
249
+  char date[100];
250
+  get_date(date);
251
+  date[strlen(date) - 1] = '\0';
252
+
253
+  char time[100];
254
+  get_time(time);
255
+  time[strlen(time) - 1] = '\0';
256
+
257
+  char date_time[100];
258
+  strcpy(date_time, date);
259
+  strcat(date_time, time);
260
+
261
+  drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, date_time, 0);
262
+  drw_map(drw, bar->win, 0, 0, w, bh);
263
+
264
+  return x + w;
265
+}
266
+
267
diff --git a/patch/cust/bar_datetime.h b/patch/cust/bar_datetime.h
268
new file mode 100644
269
index 0000000..2ca6e2d
270
--- /dev/null
271
+++ b/patch/cust/bar_datetime.h
272
@@ -0,0 +1,2 @@
273
+static int width_datetime(Bar *bar, BarWidthArg *a);
274
+static int draw_datetime(Bar *bar, BarDrawArg *a);
275
diff --git a/patch/bar_time.c b/patch/cust/bar_time.c
276
similarity index 53%
277
rename from patch/bar_time.c
278
rename to patch/cust/bar_time.c
279
index 6e86da4..ec7c771 100644
280
--- a/patch/bar_time.c
281
+++ b/patch/cust/bar_time.c
282
@@ -2,20 +2,28 @@
283
 #define SH(cmd) (const char*[]){ "/bin/sh", "-c", cmd, NULL }
284
 
285
 // get current time once a second
286
-void get_time(char *time) {
287
+void get_date(char *time) {
288
     FILE *fp;
289
     char buf[100];
290
-    fp = popen("date +%H:%M", "r");
291
+    fp = popen("date '+%a, %d %b    '", "r");
292
     fgets(buf, 100, fp);
293
     pclose(fp);
294
     strcpy(time, buf);
295
 }
296
 
297
+void get_time(char *time) {
298
+    FILE *fp;
299
+    char buf[100];
300
+    fp = popen("date '+%H:%M'", "r");
301
+    fgets(buf, 100, fp);
302
+    pclose(fp);
303
+    strcpy(time, buf);
304
+}
305
 
306
 int
307
 width_time(Bar *bar, BarWidthArg *a)
308
 {
309
-  return TEXTW("00:00:00") + lrpad;
310
+  return TEXTW("00:00  ") + lrpad;
311
 }
312
 
313
 int
314
@@ -26,19 +34,11 @@ draw_time(Bar *bar, BarDrawArg *a)
315
 	int x = a->x, w = a->w;
316
 	Monitor *m = bar->mon;
317
 
318
-	drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
319
+	drw_setscheme(drw, scheme[m == selmon ? SchemeActive : SchemeInactive]);
320
 
321
   char time[100];
322
   get_time(time);
323
-  char *time2 = time;
324
-  time2[5] = '\0';
325
-
326
-  return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, time2, 0);
327
-}
328
-
329
-int
330
-click_time(Bar *bar, Arg *arg, BarClickArg *a)
331
-{
332
-  return ClkStatusText;
333
+  time[strlen(time) - 1] = '\0';
334
+  return drw_text(drw, x, 0, w, bh, lrpad / 2, time, 0);
335
 }
336
 
337
diff --git a/patch/bar_time.h b/patch/cust/bar_time.h
338
similarity index 100%
339
rename from patch/bar_time.h
340
rename to patch/cust/bar_time.h
341
diff --git a/patch/include.c b/patch/include.c
342
index b17bd3e..f2fa000 100644
343
--- a/patch/include.c
344
+++ b/patch/include.c
345
@@ -1,6 +1,7 @@
346
 /* Bar functionality */
347
 #include "bar_ltsymbol.c"
348
-#include "bar_time.c"
349
 #include "bar_status.c"
350
 #include "bar_tags.c"
351
 #include "bar_wintitle.c"
352
+#include "cust/bar_time.c"
353
+#include "cust/bar_datetime.c"
354
diff --git a/patch/include.h b/patch/include.h
355
index 0fed3fd..4c8b723 100644
356
--- a/patch/include.h
357
+++ b/patch/include.h
358
@@ -1,6 +1,7 @@
359
 /* Bar functionality */
360
 #include "bar_ltsymbol.h"
361
-#include "bar_time.h"
362
 #include "bar_status.h"
363
 #include "bar_tags.h"
364
 #include "bar_wintitle.h"
365
+#include "cust/bar_time.h"
366
+#include "cust/bar_datetime.h"
367
diff --git a/util.o b/util.o
368
deleted file mode 100644
369
index a36344b..0000000
370
Binary files a/util.o and /dev/null differ