|
Lines 1-79
Link Here
|
| 1 |
--- scrotwm.c.orig 2009-10-24 16:21:19.000000000 +0200 |
|
|
| 2 |
+++ scrotwm.c 2009-10-24 16:58:55.000000000 +0200 |
| 3 |
@@ -193,6 +193,7 @@ |
| 4 |
int bar_height = 0; |
| 5 |
int stack_enabled = 1; |
| 6 |
int clock_enabled = 1; |
| 7 |
+char *clock_format = NULL; |
| 8 |
int title_name_enabled = 0; |
| 9 |
int title_class_enabled = 0; |
| 10 |
pid_t bar_pid; |
| 11 |
@@ -839,7 +840,7 @@ |
| 12 |
else { |
| 13 |
time(&tmt); |
| 14 |
localtime_r(&tmt, &tm); |
| 15 |
- strftime(s, sizeof s, "%a %b %d %R %Z %Y ", &tm); |
| 16 |
+ strftime(s, sizeof s, clock_format, &tm); |
| 17 |
} |
| 18 |
|
| 19 |
for (i = 0; i < ScreenCount(display); i++) { |
| 20 |
@@ -851,7 +852,7 @@ |
| 21 |
if (stack_enabled) |
| 22 |
stack = r->ws->cur_layout->name; |
| 23 |
|
| 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); |
| 28 |
bar_print(r, loc); |
| 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) { |