summaryrefslogtreecommitdiff
path: root/x11-wm/spectrwm/files/clock_format.patch
blob: 6c74bf70cd596d63f6c3b12775096fa12eaeefb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--- scrotwm.c.orig	2009-10-24 16:21:19.000000000 +0200
+++ scrotwm.c	2009-10-24 16:58:55.000000000 +0200
@@ -193,6 +193,7 @@
 int			bar_height = 0;
 int			stack_enabled = 1;
 int			clock_enabled = 1;
+char			*clock_format = NULL;
 int			title_name_enabled = 0;
 int			title_class_enabled = 0;
 pid_t			bar_pid;
@@ -839,7 +840,7 @@
 	else {
 		time(&tmt);
 		localtime_r(&tmt, &tm);
-		strftime(s, sizeof s, "%a %b %d %R %Z %Y    ", &tm);
+		strftime(s, sizeof s, clock_format, &tm);
 	}
 
 	for (i = 0; i < ScreenCount(display); i++) {
@@ -851,7 +852,7 @@
 			if (stack_enabled)
 				stack = r->ws->cur_layout->name;
 
-			snprintf(loc, sizeof loc, "%d:%d %s   %s %s    %s",
+			snprintf(loc, sizeof loc, "%d:%d %s   %s    %s    %s",
 			    x++, r->ws->idx + 1, stack, s, bar_ext,
 			    bar_vertext);
 			bar_print(r, loc);
@@ -3293,10 +3294,11 @@
 #define SWM_CONF_FILE	"scrotwm.conf"
 
 enum	{ SWM_S_BAR_DELAY, SWM_S_BAR_ENABLED, SWM_S_STACK_ENABLED,
-	  SWM_S_CLOCK_ENABLED, SWM_S_CYCLE_EMPTY, SWM_S_CYCLE_VISIBLE,
-	  SWM_S_SS_ENABLED, SWM_S_TERM_WIDTH, SWM_S_TITLE_CLASS_ENABLED,
-	  SWM_S_TITLE_NAME_ENABLED, SWM_S_BAR_FONT, SWM_S_BAR_ACTION,
-	  SWM_S_SPAWN_TERM, SWM_S_SS_APP, SWM_S_DIALOG_RATIO };
+	  SWM_S_CLOCK_ENABLED, SWM_S_CLOCK_FORMAT, SWM_S_CYCLE_EMPTY,
+	  SWM_S_CYCLE_VISIBLE, SWM_S_SS_ENABLED, SWM_S_TERM_WIDTH,
+	  SWM_S_TITLE_CLASS_ENABLED, SWM_S_TITLE_NAME_ENABLED,
+	  SWM_S_BAR_FONT, SWM_S_BAR_ACTION, SWM_S_SPAWN_TERM,
+	  SWM_S_SS_APP, SWM_S_DIALOG_RATIO };
 
 int
 setconfvalue(char *selector, char *value, int flags)
@@ -3314,6 +3316,12 @@
 	case SWM_S_CLOCK_ENABLED:
 		clock_enabled = atoi(value);
 		break;
+	case SWM_S_CLOCK_FORMAT:
+		if (clock_format != NULL)
+			free(clock_format);
+		if ((clock_format = strdup(value)) == NULL)
+			err(1, "setconfvalue: clock_format");
+		break;
 	case SWM_S_CYCLE_EMPTY:
 		cycle_empty = atoi(value);
 		break;
@@ -3407,6 +3415,7 @@
 	{ "bind",			setconfbinding,	0 },
 	{ "stack_enabled",		setconfvalue,	SWM_S_STACK_ENABLED },
 	{ "clock_enabled",		setconfvalue,	SWM_S_CLOCK_ENABLED },
+	{ "clock_format",		setconfvalue,	SWM_S_CLOCK_FORMAT },
 	{ "color_focus",		setconfcolor,	SWM_S_COLOR_FOCUS },
 	{ "color_unfocus",		setconfcolor,	SWM_S_COLOR_UNFOCUS },
 	{ "cycle_empty",		setconfvalue,	SWM_S_CYCLE_EMPTY },
@@ -4468,6 +4477,13 @@
 	if (cfile)
 		conf_load(cfile);
 
+	if (clock_format == NULL) {
+		if ((clock_format = strdup("%a %b %d %R %Z %Y"))
+		    == NULL) {
+			errx(1, "strdup");
+		}
+	}
+
 	/* setup all bars */
 	for (i = 0; i < ScreenCount(display); i++)
 		TAILQ_FOREACH(r, &screens[i].rl, entry) {