introduced i3 command for changing the hidden state and the mode of i3bar
The hidden_state and mode of each i3bar instance can now be controlled from within i3. Therefore, two new i3 command were introduced: _ bar hidden_state show|hide|toggle [<bar_id>] show: always show the bar hide: normal hide mode toggle: toggle between show and hide (individually for each bar) _ bar mode dock|hide|invisible|toggle [<bar_id>] hide,dock: like before invisible: always keep the bar hidden toggle: toggle between dock and hide (individually for each bar) This patch introduces a hidden_state ("hidden_state hide|show") in the barconfig, which indicates the current hidden_state of each i3bar instance. It only affects the bar when in hide mode. Additionally, a new invisible mode was introduced. In order to change the hidden_state or mode of the bar from i3, a barconfig-update event was introduced, for which a bar can subscribe and the bar then gets notified about the currently set hidden_state and mode in its barconfig. For convenience, an id field ("id <bar_id>") was added to the barconfig, where one can set the desired id for the corresponding bar. If the id is not specified, i3 will deterministically choose an id; otherwise, with the previous random approach for finding a new id, which is actually not shared with i3bar, as it would determine its id on startup, the event-subscription would be destroyed on reload. Still, this issue remains when manually changing the bar_id in the config and then reloading. fixes #833, #651
This commit is contained in:
committed by
Michael Stapelberg
parent
f0eba6d15c
commit
e3913093b6
@ -265,4 +265,10 @@ void cmd_scratchpad_show(I3_CMD);
|
||||
*/
|
||||
void cmd_rename_workspace(I3_CMD, char *old_name, char *new_name);
|
||||
|
||||
/**
|
||||
* Implementation of 'bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]'
|
||||
*
|
||||
*/
|
||||
void cmd_bar(I3_CMD, char *bar_type, char *bar_value, char *bar_id);
|
||||
|
||||
#endif
|
||||
|
@ -199,6 +199,9 @@ struct Config {
|
||||
/* just ignore the popup, that is, don’t map it */
|
||||
PDF_IGNORE = 2,
|
||||
} popup_during_fullscreen;
|
||||
|
||||
/* The number of currently parsed barconfigs */
|
||||
int number_barconfigs;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -226,8 +229,11 @@ struct Barconfig {
|
||||
* root window! */
|
||||
char *socket_path;
|
||||
|
||||
/** Bar display mode (hide unless modifier is pressed or show in dock mode) */
|
||||
enum { M_DOCK = 0, M_HIDE = 1 } mode;
|
||||
/** Bar display mode (hide unless modifier is pressed or show in dock mode or always hide in invisible mode) */
|
||||
enum { M_DOCK = 0, M_HIDE = 1, M_INVISIBLE = 2 } mode;
|
||||
|
||||
/* The current hidden_state of the bar, which indicates whether it is hidden or shown */
|
||||
enum { S_HIDE = 0, S_SHOW = 1 } hidden_state;
|
||||
|
||||
/** Bar modifier (to show bar when in hide mode). */
|
||||
enum {
|
||||
@ -323,6 +329,12 @@ void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch);
|
||||
*/
|
||||
void switch_mode(const char *new_mode);
|
||||
|
||||
/**
|
||||
* Sends the current bar configuration as an event to all barconfig_update listeners.
|
||||
* This update mechnism currently only includes the hidden_state and the mode in the config.
|
||||
*
|
||||
*/void update_barconfig();
|
||||
|
||||
/**
|
||||
* Returns a pointer to the Binding with the specified modifiers and keycode
|
||||
* or NULL if no such binding exists.
|
||||
|
@ -62,6 +62,8 @@ CFGFUN(mode_binding, const char *bindtype, const char *modifiers, const char *ke
|
||||
|
||||
CFGFUN(bar_font, const char *font);
|
||||
CFGFUN(bar_mode, const char *mode);
|
||||
CFGFUN(bar_hidden_state, const char *hidden_state);
|
||||
CFGFUN(bar_id, const char *bar_id);
|
||||
CFGFUN(bar_output, const char *output);
|
||||
CFGFUN(bar_verbose, const char *verbose);
|
||||
CFGFUN(bar_modifier, const char *modifier);
|
||||
|
@ -99,4 +99,7 @@ typedef struct i3_ipc_header {
|
||||
/* The window event will be triggered upon window changes */
|
||||
#define I3_IPC_EVENT_WINDOW (I3_IPC_EVENT_MASK | 3)
|
||||
|
||||
/** Bar config update will be triggered to update the bar config */
|
||||
#define I3_IPC_EVENT_BARCONFIG_UPDATE (I3_IPC_EVENT_MASK | 4)
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user