unhide hidden i3bar when mode is active
Patch status: merged
Patch by jj
Long description:
This patch also handles unhiding of i3bar in case the i3bar modifier key is pressed for activating a new binding mode.
To apply this patch, use:
curl http://cr.i3wm.org/patch/136/raw.patch | git am
b/i3bar/src/xcb.c
16 |
@@ -80,6 +80,9 @@ ev_io *xkb_io; |
17 |
/* The name of current binding mode */ |
18 |
static mode binding; |
19 |
|
20 |
+/* Indicates whether a new binding mode was recently activated */ |
21 |
+bool activated_mode = false; |
22 |
+ |
23 |
/* The parsed colors */ |
24 |
struct xcb_colors_t { |
25 |
uint32_t bar_fg; |
26 |
@@ -843,7 +846,7 @@ void xkb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { |
27 |
modstate = mods & config.modifier; |
28 |
} |
29 |
|
30 |
-#define DLOGMOD(modmask, status, barfunc) \ |
31 |
+#define DLOGMOD(modmask, status) \ |
32 |
do { \ |
33 |
switch (modmask) { \ |
34 |
case ShiftMask: \ |
35 |
@@ -868,14 +871,17 @@ void xkb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { |
36 |
DLOG("Mod5Mask got " #status "!\n"); \ |
37 |
break; \ |
38 |
} \ |
39 |
- barfunc(); \ |
40 |
} while (0) |
41 |
|
42 |
if (modstate != mod_pressed) { |
43 |
if (modstate == 0) { |
44 |
- DLOGMOD(config.modifier, released, hide_bars); |
45 |
+ DLOGMOD(config.modifier, released); |
46 |
+ if (!activated_mode) |
47 |
+ hide_bars(); |
48 |
} else { |
49 |
- DLOGMOD(config.modifier, pressed, unhide_bars); |
50 |
+ DLOGMOD(config.modifier, pressed); |
51 |
+ activated_mode = false; |
52 |
+ unhide_bars(); |
53 |
} |
54 |
mod_pressed = modstate; |
55 |
} |
56 |
@@ -1752,5 +1758,6 @@ void redraw_bars(void) { |
57 |
void set_current_mode(struct mode *current) { |
58 |
I3STRING_FREE(binding.name); |
59 |
binding = *current; |
60 |
+ activated_mode = binding.name != NULL; |
61 |
return; |
62 |
} |