Lines 1-51
Link Here
|
1 |
--- scrotwm.c.orig 2009-06-29 03:46:08.000000000 +0200 |
1 |
--- scrotwm.c.orig 2009-10-24 16:21:19.000000000 +0200 |
2 |
+++ scrotwm.c 2009-06-28 10:07:24.000000000 +0200 |
2 |
+++ scrotwm.c 2009-10-24 16:58:55.000000000 +0200 |
3 |
@@ -182,6 +182,7 @@ |
3 |
@@ -193,6 +193,7 @@ |
4 |
int bar_verbose = 1; |
|
|
5 |
int bar_height = 0; |
4 |
int bar_height = 0; |
|
|
5 |
int stack_enabled = 1; |
6 |
int clock_enabled = 1; |
6 |
int clock_enabled = 1; |
7 |
+char clock_format[31] = "%a %b %d %R %Z %Y"; |
7 |
+char *clock_format = NULL; |
|
|
8 |
int title_name_enabled = 0; |
9 |
int title_class_enabled = 0; |
8 |
pid_t bar_pid; |
10 |
pid_t bar_pid; |
9 |
GC bar_gc; |
11 |
@@ -839,7 +840,7 @@ |
10 |
XGCValues bar_gcv; |
|
|
11 |
@@ -557,6 +558,7 @@ |
12 |
|
13 |
/* conf file stuff */ |
14 |
#define SWM_CONF_WS "\n= \t" |
15 |
+#define SWM_CONF_VAL_WS "\n\t" |
16 |
#define SWM_CONF_FILE "scrotwm.conf" |
17 |
int |
18 |
conf_load(char *filename) |
19 |
@@ -594,7 +596,7 @@ |
20 |
if ((var = strsep(&cp, SWM_CONF_WS)) == NULL || cp == NULL) |
21 |
break; |
22 |
cp += (long)strspn(cp, SWM_CONF_WS); |
23 |
- if ((val = strsep(&cp, SWM_CONF_WS)) == NULL) |
24 |
+ if ((val = strsep(&cp, SWM_CONF_VAL_WS)) == NULL) |
25 |
break; |
26 |
|
27 |
DNPRINTF(SWM_D_MISC, "conf_load: %s=%s\n",var ,val); |
28 |
@@ -624,6 +626,8 @@ |
29 |
case 'c': |
30 |
if (!strncmp(var, "clock_enabled", strlen("clock_enabled"))) |
31 |
clock_enabled = atoi(val); |
32 |
+ else if (!strncmp(var, "clock_format", strlen("clock_format"))) |
33 |
+ strlcpy(clock_format, val, 31); |
34 |
else if (!varmatch(var, "color_focus", &i)) |
35 |
setscreencolor(val, i, SWM_S_COLOR_FOCUS); |
36 |
else if (!varmatch(var, "color_unfocus", &i)) |
37 |
@@ -779,12 +783,12 @@ |
38 |
else { |
12 |
else { |
39 |
time(&tmt); |
13 |
time(&tmt); |
40 |
localtime_r(&tmt, &tm); |
14 |
localtime_r(&tmt, &tm); |
41 |
- strftime(s, sizeof s, "%a %b %d %R %Z %Y ", &tm); |
15 |
- strftime(s, sizeof s, "%a %b %d %R %Z %Y ", &tm); |
42 |
+ strftime(s, sizeof s, clock_format, &tm); |
16 |
+ strftime(s, sizeof s, clock_format, &tm); |
43 |
} |
17 |
} |
|
|
18 |
|
44 |
for (i = 0; i < ScreenCount(display); i++) { |
19 |
for (i = 0; i < ScreenCount(display); i++) { |
45 |
x = 1; |
20 |
@@ -851,7 +852,7 @@ |
46 |
TAILQ_FOREACH(r, &screens[i].rl, entry) { |
21 |
if (stack_enabled) |
47 |
- snprintf(loc, sizeof loc, "%d:%d %s%s %s", |
22 |
stack = r->ws->cur_layout->name; |
48 |
+ snprintf(loc, sizeof loc, "%d:%d %s %s %s", |
23 |
|
49 |
x++, r->ws->idx + 1, s, bar_ext, bar_vertext); |
24 |
- snprintf(loc, sizeof loc, "%d:%d %s %s %s %s", |
|
|
25 |
+ snprintf(loc, sizeof loc, "%d:%d %s %s %s %s", |
26 |
x++, r->ws->idx + 1, stack, s, bar_ext, |
27 |
bar_vertext); |
50 |
bar_print(r, loc); |
28 |
bar_print(r, loc); |
51 |
} |
29 |
@@ -3293,10 +3294,11 @@ |
|
|
30 |
#define SWM_CONF_FILE "scrotwm.conf" |
31 |
|
32 |
enum { SWM_S_BAR_DELAY, SWM_S_BAR_ENABLED, SWM_S_STACK_ENABLED, |
33 |
- SWM_S_CLOCK_ENABLED, SWM_S_CYCLE_EMPTY, SWM_S_CYCLE_VISIBLE, |
34 |
- SWM_S_SS_ENABLED, SWM_S_TERM_WIDTH, SWM_S_TITLE_CLASS_ENABLED, |
35 |
- SWM_S_TITLE_NAME_ENABLED, SWM_S_BAR_FONT, SWM_S_BAR_ACTION, |
36 |
- SWM_S_SPAWN_TERM, SWM_S_SS_APP, SWM_S_DIALOG_RATIO }; |
37 |
+ SWM_S_CLOCK_ENABLED, SWM_S_CLOCK_FORMAT, SWM_S_CYCLE_EMPTY, |
38 |
+ SWM_S_CYCLE_VISIBLE, SWM_S_SS_ENABLED, SWM_S_TERM_WIDTH, |
39 |
+ SWM_S_TITLE_CLASS_ENABLED, SWM_S_TITLE_NAME_ENABLED, |
40 |
+ SWM_S_BAR_FONT, SWM_S_BAR_ACTION, SWM_S_SPAWN_TERM, |
41 |
+ SWM_S_SS_APP, SWM_S_DIALOG_RATIO }; |
42 |
|
43 |
int |
44 |
setconfvalue(char *selector, char *value, int flags) |
45 |
@@ -3314,6 +3316,12 @@ |
46 |
case SWM_S_CLOCK_ENABLED: |
47 |
clock_enabled = atoi(value); |
48 |
break; |
49 |
+ case SWM_S_CLOCK_FORMAT: |
50 |
+ if (clock_format != NULL) |
51 |
+ free(clock_format); |
52 |
+ if ((clock_format = strdup(value)) == NULL) |
53 |
+ err(1, "setconfvalue: clock_format"); |
54 |
+ break; |
55 |
case SWM_S_CYCLE_EMPTY: |
56 |
cycle_empty = atoi(value); |
57 |
break; |
58 |
@@ -3407,6 +3415,7 @@ |
59 |
{ "bind", setconfbinding, 0 }, |
60 |
{ "stack_enabled", setconfvalue, SWM_S_STACK_ENABLED }, |
61 |
{ "clock_enabled", setconfvalue, SWM_S_CLOCK_ENABLED }, |
62 |
+ { "clock_format", setconfvalue, SWM_S_CLOCK_FORMAT }, |
63 |
{ "color_focus", setconfcolor, SWM_S_COLOR_FOCUS }, |
64 |
{ "color_unfocus", setconfcolor, SWM_S_COLOR_UNFOCUS }, |
65 |
{ "cycle_empty", setconfvalue, SWM_S_CYCLE_EMPTY }, |
66 |
@@ -4468,6 +4477,13 @@ |
67 |
if (cfile) |
68 |
conf_load(cfile); |
69 |
|
70 |
+ if (clock_format == NULL) { |
71 |
+ if ((clock_format = strdup("%a %b %d %R %Z %Y")) |
72 |
+ == NULL) { |
73 |
+ errx(1, "strdup"); |
74 |
+ } |
75 |
+ } |
76 |
+ |
77 |
/* setup all bars */ |
78 |
for (i = 0; i < ScreenCount(display); i++) |
79 |
TAILQ_FOREACH(r, &screens[i].rl, entry) { |