Commit Graph

5624 Commits

Author SHA1 Message Date
Michael Stapelberg bf3cd41b5d 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-26 09:56:42 +02:00
Michael Stapelberg 1a9a9cc68d Revert "Check if output is disabled in handle_output()"
This reverts commit e71c304444.

It turns out that several users have workflows in which they turn off
their monitors without using e.g. `xrandr --output DP-1 --off`. The
result is that the monitors are disconnected, but not disabled.

With commit e71c304444, i3 started to see
these two states as one and the same state, but that causes more harm
than it does good. For example, for some users with only one monitor, i3
would just exit when these users turned off their monitor.

related to #1858, #1839

fixes #1845
2015-08-25 20:09:56 +02:00
Michael Stapelberg f1bb9524ca Merge pull request #1864 from Airblader/feature-1861-class-instance
Added '%class' and '%instance' as placeholders for the title_format
2015-08-25 19:29:17 +02:00
Ingo Bürk 2938fc0ab1 Added '%class' and '%instance' as placeholders for the title_format directive.
relates to #1861
2015-08-25 19:22:05 +02:00
Michael Stapelberg 3d8b7e32e5 Merge pull request #1863 from Airblader/feature-tray-output-config
Add 'tray_output primary' to the default config
2015-08-25 19:09:37 +02:00
Ingo Bürk e2e7b70d00 Add 'tray_output primary' to the default config 2015-08-25 18:56:05 +02:00
Michael Stapelberg 1784906d6d docs/userguide: document behavior of tray_output with multiple bars
fixes #1855
2015-08-25 09:23:41 +02:00
Michael Stapelberg 3f259d0e83 docs/debugging: make it clearer that you need to reload i3 2015-08-24 20:50:18 +02:00
Michael Stapelberg c95d6e328e Merge pull request #1853 from shdown/issue-1852
i3-msg: strdup getenv() result before freeing
2015-08-20 22:29:24 +02:00
shdown f8b0ac2bff i3-msg: strdup getenv() result before freeing
Fixes #1852.
2015-08-20 23:07:41 +03:00
Michael Stapelberg 180a8c8cea Merge pull request #1850 from Airblader/feature-docs-8
[docs] Move client.background to the list of colorclasses
2015-08-18 09:51:34 +02:00
Ingo Bürk 39fbb2c5dd Add client.background to the list of all available colorclasses rather than mentioning it as something special afterwards. 2015-08-18 00:05:06 +02:00
Michael Stapelberg 3755f6e76e Merge pull request #1838 from obfusk/rm-useless-get_first_output-call
remove useless get_first_output() call
2015-08-10 19:19:24 +02:00
Michael Stapelberg 45e2375ccc Merge pull request #1837 from obfusk/fix-branch-info
hacking-howto: re-word branches info
2015-08-10 19:18:43 +02:00
Felix C. Stegerman 12d35cc2bc remove useless get_first_output() call 2015-08-10 17:51:09 +02:00
Felix C. Stegerman c827b5cb47 hacking-howto: re-word branches info
fixes #1836
2015-08-10 17:31:28 +02:00
Michael Stapelberg d3608bb6eb userguide: explain i3-config-wizard’s behavior
fixes #1782
2015-08-07 08:41:39 +02:00
Michael Stapelberg f76a2fdf68 layout restore: remove remaining criteria when swallowing window
fixes #1817
2015-08-06 21:35:34 +02:00
Michael Stapelberg 0fb784f5cb Translate bindsym bindings upon ISO_Next_Group
With commit c738b2e454 we changed i3 so
that the default keybindings can be used when ISO_Next_Group is enabled,
but bindings which explicitly use Mode_switch have precedence. This
behavior required the use of bindcode instead of bindsym.

With this commit, when switching from group 1 to group 2 using
ISO_Next_Group, i3 will re-translate all keybindings (looking at column
2/3, regardless of whether the keybinding itself specifies Mode_switch)
and re-grab them.

That way, the keybinding “bindsym $mod+x nop foo” will work when
pressing $mod+x without Mode_switch and when pressing the corresponding
$mod+x (different key) with Mode_switch. A binding such as “bindsym
Mode_switch+$mod+x nop bar” will still have precedence.

The intention here is to make bindsym keybindings work well with dual
keyboard layouts (such as {dvorak, us} or {us, ru}), so that users can
switch between groups and still have their (logical) keybindings behave
the same way.

fixes #1775
2015-08-06 09:32:22 +02:00
Michael Stapelberg fed05ef876 clang-format src/load_layout.c 2015-08-05 22:55:07 +02:00
Michael Stapelberg 9c38aeff0a Merge pull request #1833 from FauxFaux/next
generate parser enums stably: additionally sort on name
2015-08-05 22:45:37 +02:00
Michael Stapelberg 6d022e6dc9 i3-save-tree: retain “rect” for floating_cons 2015-08-05 22:43:18 +02:00
Michael Stapelberg 57438d270d append_layout: load floating containers correctly
fixes #1739
fixes #1271
2015-08-05 22:40:58 +02:00
Chris West (Faux) e31896be0e generate parser enums stably: additionally sort on name 2015-08-05 21:23:51 +01:00
Michael Stapelberg 419b73be9e Merge pull request #1816 from tcreech/tcreech-for-illumos
Changes for compiling i3 on Illumos
2015-08-04 00:10:06 -07:00
Michael Stapelberg fdfe408159 Merge pull request #1789 from shdown/next
Use safe wrappers wherever possible
2015-08-03 10:49:15 -07:00
shdown ad9ecd52fa Use safe wrappers inside "#if 0" too 2015-08-03 12:51:55 +03:00
shdown 7ef3fdec00 .travis.yml: add a wrapped functions grepper script 2015-08-03 12:51:39 +03:00
shdown fa4f1c5b0f config_parser: don't use sizeof(char) 2015-08-03 12:51:20 +03:00
shdown c85d16faa4 Use safe wrappers wherever possible 2015-08-03 12:50:50 +03:00
shdown bc52fae15c libi3: change scalloc() signature to match calloc() 2015-08-03 12:50:13 +03:00
Michael Stapelberg 05fb909636 Merge pull request #1712 from Airblader/feature-next-wm-size-hints-adopted
[Adopted] Use WM_SIZE_HINTS when available to set the geometry of floating windows
2015-08-02 23:52:10 -07:00
Michael Stapelberg 21d4b2319f Properly clear the urgency hint when set by i3.
fixes #1825
2015-08-02 20:50:14 +02:00
Michael Stapelberg 03799dd851 Merge pull request #1822 from acrisci/feature/docs-contributing-formatting
docs: improve formatting for CONTRIBUTING
2015-08-02 09:14:00 -07:00
Tony Crisci 69f7ad91aa docs: improve formatting for CONTRIBUTING 2015-08-01 14:50:55 -04:00
Michael Stapelberg cf199143d9 Merge pull request #1821 from acrisci/feature/dont-log-motion-notify
Don't log motion notify
2015-07-31 00:41:35 -07:00
Tony Crisci 0107d35508 Don't log motion notify
Do not log an XCB_MOTION_NOTIFY event in handlers.c because this
clutters the log.

Only log in the motion notify handler if something important happens.
2015-07-30 22:40:38 -04:00
Michael Stapelberg ad826f06da release.sh: pull website repository before 2015-07-30 22:45:23 +02:00
Michael Stapelberg 5ee679c514 release.sh: the mailing list part is done automatically 2015-07-30 22:43:34 +02:00
Michael Stapelberg abb24a7391 Update debian/changelog 2015-07-30 22:31:06 +02:00
Michael Stapelberg a4ffb23d20 Merge branch 'release-4.10.3' 2015-07-30 22:27:15 +02:00
Michael Stapelberg 2bde6f080e Merge branch 'master' into next 2015-07-30 22:27:15 +02:00
Michael Stapelberg 3cc377166f release i3 4.10.3 2015-07-30 22:26:58 +02:00
Michael Stapelberg 8c116e228b release.sh: replace version in _docs/debugging at the right time 2015-07-30 22:26:45 +02:00
Michael Stapelberg c493cde96e release.sh: bugfix: take docs from tmpdir, not startdir 2015-07-30 22:21:48 +02:00
Michael Stapelberg 5a20394092 release.sh: commit modified debian/changelog
Otherwise, we cannot switch branches.
2015-07-30 22:16:01 +02:00
Michael Stapelberg e362c3cf30 release.sh: 4.10.3 release 2015-07-30 22:07:51 +02:00
Michael Stapelberg f87a78e1a9 release.sh: tell git to prefer “next” when merging 2015-07-30 22:07:13 +02:00
shdown 4446c4d890 i3bar: fix freeing static strings
name and color fields of blocks are freed in clear_statusline, so they
need to be strdup'ed.
2015-07-30 21:42:44 +02:00
Theo Buehler c0f685e7bc mkdirp: do not throw an error if directory exists
If I restart i3 4.10.2 twice, e.g. with

$ i3-msg restart; sleep 3; i3-msg restart

the second time I get the following two errors:

05/22/15 10:46:03 - ERROR: mkdir(/tmp/i3-theo.toAK7N) failed: File exists
05/22/15 10:46:03 - ERROR: Could not create "/tmp/i3-theo.toAK7N" for storing the restart layout, layout will be lost.

The first one is from mkdirp() in src/ipc.c and the second one is from
store_restart_layout() in src/util.c.

Notice that I do _not_ get the ``open()'' or ``Could not write restart layout to
...'' error messages, so the layout writing code after line 260 in
store_restart_layout() succeeded and the layout isn't actually lost.  Thus,
these error messages are a bit misleading, especially the second one (which is
triggered by the failure of mkdirp()).

POSIX says about `mkdir -p':

``Each dir operand that names an existing directory shall be ignored without
error.''

Therefore, I suggest the following simple patch that makes mkdirp() succeed if
the named file exists and actually is a directory.  This silences the second
error as well.
2015-07-30 21:41:24 +02:00