2012-10-07 16:32:50 +02:00
|
|
|
|
/*
|
|
|
|
|
* vim:ts=4:sw=4:expandtab
|
|
|
|
|
*
|
|
|
|
|
* i3 - an improved dynamic tiling window manager
|
2015-04-04 02:17:56 +02:00
|
|
|
|
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
|
2012-10-07 16:32:50 +02:00
|
|
|
|
*
|
2012-10-08 13:23:48 +02:00
|
|
|
|
* config_directives.h: all config storing functions (see config_parser.c)
|
2012-10-07 16:32:50 +02:00
|
|
|
|
*
|
|
|
|
|
*/
|
2013-12-29 03:11:50 +01:00
|
|
|
|
#pragma once
|
2012-10-07 16:32:50 +02:00
|
|
|
|
|
2016-10-11 09:13:35 +02:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2012-10-08 13:23:48 +02:00
|
|
|
|
#include "config_parser.h"
|
2012-10-07 16:32:50 +02:00
|
|
|
|
|
2014-01-28 04:45:01 +01:00
|
|
|
|
/**
|
Use libxkbcommon for translating keysyms, support all XKB groups.
fixes #1835
This commit improves the translation of keysyms to keycodes by loading
keymaps using libxkbcommon-x11 and using libxkbcommon for figuring out
the keymap, depending on each keybinding’s modifiers. This way, the
upper layers of complex layouts are now usable with i3’s bindsym
directive, such as de_neo’s layer 3 and higher.
Furthermore, the commit generalizes the handling of different XKB
groups. We formerly had support only for two separate groups, the
default group 1, and group 2. While Mode_switch is only one way to
switch to group 2, we called the binding option Mode_switch. With this
commit, the new names Group1, Group2 (an alias for Mode_switch), Group3
and Group4 are introduced for configuring bindings. This is only useful
for advanced keyboard layouts, such as people loading two keyboard
layouts and switching between them (us, ru seems to be a popular
combination).
When grabbing keys, one can only specify the modifier mask, but not an
XKB state mask (or value), so we still dynamically unbind and re-bind
keys whenever the XKB group changes.
The commit was manually tested using the following i3 config:
bindsym Group4+n nop heya from group 4
bindsym Group3+n nop heya from group 3
bindsym Group2+n nop heya from group 2
bindsym n nop heya
bindsym shift+N nop explicit shift binding
bindsym shift+r nop implicit shift binding
bindcode Group2+38 nop fallback overwritten in group 2 only
bindcode 38 nop fallback
…with the following layout:
setxkbmap -layout "us,ua,ru,de" -variant ",winkeys,,neo" \
-option "grp:shift_caps_toggle,grp_led:scroll" \
-model pc104 -rules evdev
By default (xkb group 1, us layout), pressing “n” will result in the
“heya” message appearing. Pressing “a” will result in the “fallback”
message appearing. “j” is not triggered.
By pressing Shift+CapsLock you switch to the next group (xkb group 2, ua
layout). Pressing “a” will result in the “fallback overwritten in group
2 only” message, pressing “n” will still result in “heya”. “j” is not
triggered.
In the next group (xkb group 3, ru layout), pressing “a” will result in
the “fallback” message again, pressing “n” will result in “heya”,
“j” is not triggered.
In the last group (xkb group 4, de_neo layout), pressing “a” will still
result in “fallback”, pressing “n” will result in “heya”, pressing “j”
will result in “heya from group 4”.
Pressing shift+n results in “explicit shift binding”, pressing shift+r
results in “implicit shift binding”. This ensures that keysym
translation falls back to looking at non-shift keys (“r” can be used
instead of ”R”) and that the order of keybindings doesn’t play a role
(“bindsym n” does not override “bindsym shift+n”, even though it’s
specified earlier in the config).
The fallback behavior ensures use-cases such as ticket #1775 are still
covered.
Only binding keys when the X server is in the corresponding XKB group
ensures use-cases such as ticket #585 are still covered.
2015-08-23 22:49:32 +02:00
|
|
|
|
* A utility function to convert a string containing the group and modifiers to
|
|
|
|
|
* the corresponding bit mask.
|
2014-01-28 04:45:01 +01:00
|
|
|
|
*/
|
Use libxkbcommon for translating keysyms, support all XKB groups.
fixes #1835
This commit improves the translation of keysyms to keycodes by loading
keymaps using libxkbcommon-x11 and using libxkbcommon for figuring out
the keymap, depending on each keybinding’s modifiers. This way, the
upper layers of complex layouts are now usable with i3’s bindsym
directive, such as de_neo’s layer 3 and higher.
Furthermore, the commit generalizes the handling of different XKB
groups. We formerly had support only for two separate groups, the
default group 1, and group 2. While Mode_switch is only one way to
switch to group 2, we called the binding option Mode_switch. With this
commit, the new names Group1, Group2 (an alias for Mode_switch), Group3
and Group4 are introduced for configuring bindings. This is only useful
for advanced keyboard layouts, such as people loading two keyboard
layouts and switching between them (us, ru seems to be a popular
combination).
When grabbing keys, one can only specify the modifier mask, but not an
XKB state mask (or value), so we still dynamically unbind and re-bind
keys whenever the XKB group changes.
The commit was manually tested using the following i3 config:
bindsym Group4+n nop heya from group 4
bindsym Group3+n nop heya from group 3
bindsym Group2+n nop heya from group 2
bindsym n nop heya
bindsym shift+N nop explicit shift binding
bindsym shift+r nop implicit shift binding
bindcode Group2+38 nop fallback overwritten in group 2 only
bindcode 38 nop fallback
…with the following layout:
setxkbmap -layout "us,ua,ru,de" -variant ",winkeys,,neo" \
-option "grp:shift_caps_toggle,grp_led:scroll" \
-model pc104 -rules evdev
By default (xkb group 1, us layout), pressing “n” will result in the
“heya” message appearing. Pressing “a” will result in the “fallback”
message appearing. “j” is not triggered.
By pressing Shift+CapsLock you switch to the next group (xkb group 2, ua
layout). Pressing “a” will result in the “fallback overwritten in group
2 only” message, pressing “n” will still result in “heya”. “j” is not
triggered.
In the next group (xkb group 3, ru layout), pressing “a” will result in
the “fallback” message again, pressing “n” will result in “heya”,
“j” is not triggered.
In the last group (xkb group 4, de_neo layout), pressing “a” will still
result in “fallback”, pressing “n” will result in “heya”, pressing “j”
will result in “heya from group 4”.
Pressing shift+n results in “explicit shift binding”, pressing shift+r
results in “implicit shift binding”. This ensures that keysym
translation falls back to looking at non-shift keys (“r” can be used
instead of ”R”) and that the order of keybindings doesn’t play a role
(“bindsym n” does not override “bindsym shift+n”, even though it’s
specified earlier in the config).
The fallback behavior ensures use-cases such as ticket #1775 are still
covered.
Only binding keys when the X server is in the corresponding XKB group
ensures use-cases such as ticket #585 are still covered.
2015-08-23 22:49:32 +02:00
|
|
|
|
i3_event_state_mask_t event_state_from_str(const char *str);
|
2014-01-28 04:45:01 +01:00
|
|
|
|
|
2012-10-08 13:23:48 +02:00
|
|
|
|
/** The beginning of the prototype for every cfg_ function. */
|
2014-05-18 06:44:19 +02:00
|
|
|
|
#define I3_CFG Match *current_match, struct ConfigResultIR *result
|
2012-10-07 16:32:50 +02:00
|
|
|
|
|
2012-10-08 13:23:48 +02:00
|
|
|
|
/* Defines a configuration function, that is, anything that can be called by
|
|
|
|
|
* using 'call cfg_foo()' in parser-specs/.*.spec. Useful so that we don’t need
|
|
|
|
|
* to repeat the definition all the time. */
|
|
|
|
|
#define CFGFUN(name, ...) \
|
2014-06-19 11:20:32 +02:00
|
|
|
|
void cfg_##name(I3_CFG, ##__VA_ARGS__)
|
2012-10-08 13:23:48 +02:00
|
|
|
|
|
|
|
|
|
/* The following functions are called by the config parser, see
|
|
|
|
|
* parser-specs/config.spec. They get the parsed parameters and store them in
|
|
|
|
|
* our data structures, e.g. cfg_font gets a font name and stores it in
|
|
|
|
|
* config.font.
|
2012-10-07 16:32:50 +02:00
|
|
|
|
*
|
2012-10-08 13:23:48 +02:00
|
|
|
|
* Since they are so similar, individual comments were omitted. */
|
|
|
|
|
|
|
|
|
|
CFGFUN(criteria_init, int _state);
|
|
|
|
|
CFGFUN(criteria_add, const char *ctype, const char *cvalue);
|
|
|
|
|
CFGFUN(criteria_pop_state);
|
2012-10-07 16:32:50 +02:00
|
|
|
|
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(font, const char *font);
|
|
|
|
|
CFGFUN(exec, const char *exectype, const char *no_startup_id, const char *command);
|
|
|
|
|
CFGFUN(for_window, const char *command);
|
|
|
|
|
CFGFUN(floating_minimum_size, const long width, const long height);
|
|
|
|
|
CFGFUN(floating_maximum_size, const long width, const long height);
|
|
|
|
|
CFGFUN(default_orientation, const char *orientation);
|
|
|
|
|
CFGFUN(workspace_layout, const char *layout);
|
|
|
|
|
CFGFUN(workspace_back_and_forth, const char *value);
|
|
|
|
|
CFGFUN(focus_follows_mouse, const char *value);
|
2014-03-24 18:03:05 +01:00
|
|
|
|
CFGFUN(mouse_warping, const char *value);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(force_focus_wrapping, const char *value);
|
|
|
|
|
CFGFUN(force_xinerama, const char *value);
|
2016-11-28 18:20:46 +01:00
|
|
|
|
CFGFUN(disable_randr15, const char *value);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(fake_outputs, const char *outputs);
|
|
|
|
|
CFGFUN(force_display_urgency_hint, const long duration_ms);
|
2015-03-30 22:07:48 +02:00
|
|
|
|
CFGFUN(focus_on_window_activation, const char *mode);
|
2015-03-29 00:26:49 +01:00
|
|
|
|
CFGFUN(show_marks, const char *value);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(hide_edge_borders, const char *borders);
|
2017-08-28 04:14:03 +02:00
|
|
|
|
CFGFUN(assign, const char *workspace, bool is_number);
|
2015-03-29 17:30:14 +02:00
|
|
|
|
CFGFUN(no_focus);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(ipc_socket, const char *path);
|
|
|
|
|
CFGFUN(restart_state, const char *path);
|
|
|
|
|
CFGFUN(popup_during_fullscreen, const char *value);
|
2016-01-09 22:47:33 +01:00
|
|
|
|
CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator, const char *child_border);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(color_single, const char *colorclass, const char *color);
|
|
|
|
|
CFGFUN(floating_modifier, const char *modifiers);
|
|
|
|
|
CFGFUN(new_window, const char *windowtype, const char *border, const long width);
|
|
|
|
|
CFGFUN(workspace, const char *workspace, const char *output);
|
2017-05-02 09:08:42 +02:00
|
|
|
|
CFGFUN(binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *border, const char *whole_window, const char *exclude_titlebar, const char *command);
|
2012-10-07 16:32:50 +02:00
|
|
|
|
|
2015-10-12 23:43:47 +02:00
|
|
|
|
CFGFUN(enter_mode, const char *pango_markup, const char *mode);
|
2017-05-02 09:08:42 +02:00
|
|
|
|
CFGFUN(mode_binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *border, const char *whole_window, const char *exclude_titlebar, const char *command);
|
2012-10-07 16:32:50 +02:00
|
|
|
|
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(bar_font, const char *font);
|
2015-03-24 23:07:25 +01:00
|
|
|
|
CFGFUN(bar_separator_symbol, const char *separator);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(bar_mode, const char *mode);
|
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
2013-05-25 14:30:00 +02:00
|
|
|
|
CFGFUN(bar_hidden_state, const char *hidden_state);
|
|
|
|
|
CFGFUN(bar_id, const char *bar_id);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(bar_output, const char *output);
|
|
|
|
|
CFGFUN(bar_verbose, const char *verbose);
|
|
|
|
|
CFGFUN(bar_modifier, const char *modifier);
|
2014-07-04 11:53:22 +02:00
|
|
|
|
CFGFUN(bar_wheel_up_cmd, const char *command);
|
|
|
|
|
CFGFUN(bar_wheel_down_cmd, const char *command);
|
2015-05-02 21:53:23 +02:00
|
|
|
|
CFGFUN(bar_bindsym, const char *button, const char *command);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(bar_position, const char *position);
|
|
|
|
|
CFGFUN(bar_i3bar_command, const char *i3bar_command);
|
|
|
|
|
CFGFUN(bar_color, const char *colorclass, const char *border, const char *background, const char *text);
|
|
|
|
|
CFGFUN(bar_socket_path, const char *socket_path);
|
|
|
|
|
CFGFUN(bar_tray_output, const char *output);
|
2015-06-09 10:06:45 +02:00
|
|
|
|
CFGFUN(bar_tray_padding, const long spacing_px);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(bar_color_single, const char *colorclass, const char *color);
|
|
|
|
|
CFGFUN(bar_status_command, const char *command);
|
2013-08-09 05:30:14 +02:00
|
|
|
|
CFGFUN(bar_binding_mode_indicator, const char *value);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(bar_workspace_buttons, const char *value);
|
2014-05-05 19:56:47 +02:00
|
|
|
|
CFGFUN(bar_strip_workspace_numbers, const char *value);
|
2015-05-02 21:53:23 +02:00
|
|
|
|
CFGFUN(bar_start);
|
2012-10-08 13:23:48 +02:00
|
|
|
|
CFGFUN(bar_finish);
|