Commit Graph

84 Commits (0b621292246f2736eeed82ef106f64749c058f68)

Author SHA1 Message Date
Orestis Floros 0b62129224
Remove unused headers
With help from
https://github.com/include-what-you-use/include-what-you-use/
2020-04-20 04:25:06 +02:00
xzfc 1f0c628cde
clang-format: bring back ForeachMacros (#3948)
* clang-format: bring back ForeachMacros

ForeachMacros was disabled in 4211274fcd
due to the breakage of include/queue.h. The currently used version,
clang-format-6.0 doesn't break it.

* Add curly braces

Co-authored-by: Orestis Floros <orestisflo@gmail.com>
2020-02-19 11:31:09 +01:00
Orestis Floros 24a58d2952
Implement focus_wrapping workspace
I had a dilemma about the behaviour here:
1. Prohibit focus leaving the workspace in any case unless if
get_tree_next's initial argument is a workspace. This is what this
commit does (also i3-cycle).
2. Leave the workspace if no warp is possible (eg workspace with single
container or `focus right` with `V[a b c*]`).

Fixes #2180
2019-10-14 13:02:33 +03:00
Konst Mayer 94228fd902 Add setting for minimal width of workspace buttons 2019-06-25 13:10:01 +07:00
Orestis Floros 8ce99cdacb
cfg_workspace: Accept outputs with spaces again
This is a regression from bce088679.

An other way to fix this would be to concatenate strings inside the
strtok loop when an output starts with a double quote but I'd rather
let the parser do the word splitting.

Fixes #3646
2019-03-21 21:31:30 +02:00
nejni-marji 22ac5827b0 Make binding modes case sensitive 2019-01-16 19:32:24 -06:00
Aestek 6d82753d53
Add title_align config directive
Controls the window titles alignment in title bars. Possible values are:
- left
- center
- right

Co-authored-by: Orestis Floros <orestisf1993@gmail.com>
- Made title_align a config directive instead of a command. Helps with
some tree_render() issues we had.
- Made title_max_width the same for all 3 cases.
- Modified title offset calculations and added explanations for each
case.
- Append title_padding to mark_width if a mark exists.

Fixes #1750
2018-10-12 19:58:48 +03:00
Orestis 18dbfe699a userguide: Mention know issues for assign (#3434)
Fixes #3222
Fixes #3293
Related to #2060
2018-10-07 20:24:09 +02:00
Orestis Floros 37d0105c83
Kill misbehaving subscribed clients instead of hanging
This change only affects clients that are subscribed to events, which
should be the main cause of our problems.

In the common case (no buffered data) the behaviour doesn't change at
all: the message is sent directly, no ev_io / ev_timeout callback is
enabled. Once a write to a client's socket is not completed fully
(returns with EAGAIN error), we put the message in the tail of a queue
and init an ev_io callback and a corresponding timer. If the timer is
triggered first, the socket is closed and the client connection is
removed. If the socket becomes writeable before the timeout we either
reset the timer if we couldn't push all the buffered data or completely
remove it if everything was pushed.

We could also replace ipc_send_message() for all client connections in
i3, not just those subscribed to events.

Furthermore, we could limit the amount of messages stored and increase
the timeout (or use multiple timeouts): eg it's ok if a client is not
reading for 10 seconds and we are only holding 5KB of messages for them
but it is not ok if they are inactive for 5 seconds and we have 30MB of
messages held.

Closes #2999
Closes #2539
2018-08-08 19:14:56 +03:00
Orestis Floros bce088679a
Allow multiple assignments of workspaces to outputs
Also makes get_assigned_output work with the primary output:
    workspace X output primary
will now work.

Fixes #555.
2018-07-12 17:07:01 +03:00
Orestis Floros fe6b3b7474
i3bar: make modifier behave like floating_modifier
Pressed modifiers are determined like in click.c:handle_button_press.

Fixes #3234.
2018-04-17 02:00:03 +03:00
Orestis Floros a5014dc7f8
cfg_workspace: memleak on duplicate workspace assignment
assignment->output is set but lost since TAILQ_INSERT_TAIL is never
called when duplicate is set.
This essentially happens on every reload.
2018-03-25 20:27:07 +03:00
hwangcc23 2269b2e795 Add strip_workspace_name
See the issue #3163 (https://github.com/i3/i3/issues/3163).

Add strip_workspace_name to strip off the workspace name.
2018-03-11 12:17:42 +08:00
Bennett Piater f8d6c10d7c
Add default_{,floating_}border to config
userguide: document default_{,floating_}border

201-config-parser.t: add new tokens to $expected_all_tokens

201-config-parser-t: fix whitespace

closes i3/i3#2702
2018-02-15 16:25:56 +01:00
Orestis Floros 315ff17563 Add '--release' flag for bindsym in the bar block
i3bar's handle_button is modified to also handle XCB_BUTTON_RELEASE
events. During these button release events, only custom commands are
checked to avoid sending multiple workspace ipc messages.

The way this patch is implemented will allow to assign a custom command
for both the press and release of the same button:
bar {
  ...
  bindsym buttonX exec command1
  bindsym --release buttonX exec command2
}

Fixes #3068.
2017-12-08 12:16:22 +02:00
Michael Stapelberg 54d61b510d Merge pull request #2953 from CyberShadow/focus_wrapping
Add "focus_wrapping" option
2017-09-27 09:31:39 -07:00
Vladimir Panteleev 50edf495aa
Merge "force_focus_wrapping" option into "focus_wrapping force"
Allow enabling forced focus wrapping by specifying "focus_wrapping
force" in i3's configuration. This syntax supersedes the previous
"force_focus_wrapping yes" one, which remains available for backwards
compatibility.
2017-09-25 18:58:12 +00:00
Vladimir Panteleev 28f7e14650
Add "focus_wrapping" option
Fixes #2352.
2017-09-22 23:40:41 +00:00
Orestis Floros a35854ddf4 Allow assign to output
Implements the "assign" part of issue #2764.
2017-09-17 15:37:17 +03:00
Orestis Floros eaf7a49e28 Allow assign to workspace by number
Makes "assign [<criteria>] workspace number <number>" work in the same
manner as "move to workspace number <number>" instead of assigning the
window to a workspace named "number <number>".

config.spec is modified to expect a 'number' string and an extra
argument is used in cfg_assign.

For workspaces that don't exist yet, workspace_get is used as a
fallback. This also allows the user to assign to "<number> <workspace>"
eg "2: work" and the full name will be used if workspace number 2
doesn't exist yet.

Fixes #2590.
2017-09-15 03:38:13 +03:00
Ingo Bürk d78fd8d91f Introduce --exclude-titlebar flag for mouse bindings. (#2703)
This introduces the flag --exclude-titlebar for mouse bindings which
allows bindings like

    bindsym --whole-window --border --exclude-titlebar button3 focus

fixes #2347
2017-05-02 09:08:42 +02:00
Ingo Bürk 7f84f49846 Don't exit() on redefined binding mode. (#2638)
Doing a hard exit() is a rather harsh action for something i3 can handle
perfectly fine and is only meant to be a check to make debugging easier
for users in certain situations.
2017-01-13 10:01:36 -08:00
Ingo Bürk 33d6a4e829 Validate that a binding mode is not defined more than once. (#2633)
While defining the same mode usually wouldn't hurt and, in fact, the old behavior
allows to split the definition of a binding mode into several blocks, this
can lead to user errors where they accidentally define a mode twice and don't understand
why the mode behaves a certain way (this has been observed in real life :-)).

There's no good usecase for splitting a single binding mode into multiple blocks, thus
the new behavior is better.

fixes #2615
2017-01-13 09:33:29 -08:00
Michael Stapelberg 633a9f7b14 Implement RandR 1.5 support (#2580)
This comes with the intentionally undocumented --disable-randr15 command
line flag and disable-randr15 configuration directive. We will add
documentation before the release if and only if it turns out that users
actually need to use this flag in their setups. Ideally, nobody would
need to use the flag and everything would just keep working, but it’s
better to be safe than sorry.

fixes #1799
2016-11-28 18:20:46 +01:00
Michael Stapelberg f354f53435 Ensure all *.[ch] files include config.h
Including config.h is necessary to get e.g. the _GNU_SOURCE define and
any other definitions that autoconf declares. Hence, config.h needs to
be included as the first header in each file.

This is done either via:
1. Including "common.h" (i3bar)
2. Including "libi3.h"
3. Including "all.h" (i3)
4. Including <config.h> directly

Also remove now-unused I3__FILE__, add copyright/license statement
where missing and switch include/all.h to #pragma once.
2016-10-23 21:09:24 +02:00
Julien Lequertier 4bec3b9d24 Smart option added to hide_edge_borders config param (#2191) (#2191)
Use case:

* When managing multiple terminals in a workspace, the borders makes it easier
to know where the focus is, but when there is only one it's obvious where the
focus is.

* When there's only a web browser for example, the borders are actually counter-
productive since it makes clicking a side scrollbar or a tab a bit harder (if I
smash my cursor to the side or the top of the workspace, I have to move it in
the other direction by just a few pixels to be able to grab it)

Behaviour:

* No borders when there's a single window in a workspace
* Borders when there are multiple windows in a workspace

fixes #2188
2016-05-10 20:27:20 +02:00
Ingo Bürk 018922dcc4 Allow "modifier none" in i3bar to disable the modifier.
This allows "modifier none" (and "modifier off") for the bar config
in order to disable the modifier key altogether. This is useful
for users who use a different approach to hiding / showing the bar,
e.g., a custom keybind that involved multiple keys or scripts.

fixes #2208
2016-02-11 20:51:05 +01:00
Ingo Bürk 811ff07b8e Rename decoration_border to child_border.
fixes #2154
2016-01-09 16:47:33 -05:00
Michael Stapelberg e7f1476180 reload: fix memory leak 2016-01-09 17:06:54 +01:00
Ingo Bürk bcee585e17 Use correct fallback color for decoration_border.
The newly introduced decoration_border color incorrectly uses the default value
for "background" as a fallback when not specified. Instead, it should use the
user-specified "background" as a fallback.

fixes #2149
2016-01-06 09:19:42 -05:00
Lauri Tirkkonen 034a12acad add decoration_border color for the actual client borders
see https://github.com/i3/i3/pull/2136
2016-01-05 12:17:48 +02:00
Ingo Bürk a4afd1b642 Parse colors as color_t instead of colorpixel.
With this patch we remove the temporary draw_util_colorpixel_to_color
function we introduced previously by parsing the colors as color_t to
begin with.

relates to #1278
2015-11-23 22:18:02 +01:00
Michael Stapelberg e48c4cd257 Revert "Bugfix: set group mask 1 by default, correctly compare modifiers"
This reverts commit 9692c1498b.

That commit accidentally defaulted to group mask 1, but the default
should be to match any group mask, so that having multiple layouts
loaded at the same time works.

fixes #2062
2015-11-16 09:00:27 +01:00
Ingo Bürk bc250b26a0 Allow multiple tray_output directives.
This patch introduces the possibility to specify the tray_output directive
multiple times. All values will be used by i3bar, in the order they are
given.

This way, a single bar configuration can be used for several machines with
internal output names "eDP1" and "LVDS-0" by specifying tray_output for both.
Any external output (e.g., "DP-0") will still not receive the tray. The same
effect can be achieved by using "primary", but forces the user to couple the
tray display to the primary output which may not be desirable behavior.

relates to #555
2015-11-01 16:35:17 -05:00
Michael Stapelberg 9692c1498b Bugfix: set group mask 1 by default, correctly compare modifiers
fixes #2002
2015-10-29 08:47:36 +01:00
Ingo Bürk 27db61f504 Fix multiple memory leaks with regular expressions. 2015-10-28 14:40:10 +01:00
David Simon dc05d905c1 Optionally change i3bar color on focused output, implements #2020 2015-10-27 09:12:57 -04:00
Ingo Bürk 82dc747396 Make pango markup in mode names optional with a flag.
This introduces the flag "--pango" on the mode config directive to
explicitly enable pango markup for mode names. Not setting this will
cause the mode name to be rendered as is.
This fixes a regression in 4.11 where mode names containing characters
such as '<' would break user's configs as they didn't escape these
characters.

fixes #1992
2015-10-13 09:23:30 +02:00
Ingo Bürk b744c5e6c6 Refactor parsing of matches to avoid code duplication. 2015-10-04 17:40:25 +02:00
Nils Schneider c87b256200 Revert "Add a timeout: delay_exit_on_zero_displays"
This reverts commit 2c77d7ceed.
2015-09-14 22:34:05 +02:00
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
shdown bc52fae15c libi3: change scalloc() signature to match calloc() 2015-08-03 12:50:13 +03:00
Michael Stapelberg 6be1b28813 Merge pull request #1771 from Airblader/feature-1769
Implement new criterion 'workspace'.
2015-06-30 13:52:54 -07:00
Ingo Bürk be406d036d Implement new criterion 'workspace'.
If the match expression is a plain number (e.g., '99'), the number of a workspace will be compared strictly. Otherwise, the match expression is taken as a regular expression and compared against the workspace's name.
This allows all of the following:

for_window [workspace=5] ...
for_window [workspace="5:foo"] ...
for_window [workspace="foo"] ...

fixes #1769
2015-06-30 20:53:52 +02:00
Ingo Bürk 94a09b3cac Added missing newlines in log statements. 2015-06-30 20:48:35 +02:00
Michael Hofmann bad4203755 Configurable tray padding. 2015-06-28 00:14:37 +02:00
Ingo Bürk 9eb255d5fa Ensure format of dumped bindings for i3bar is compatible with i3 bindings.
fixes #1695
2015-06-18 19:28:24 +02:00
Ingo Bürk 2b6f76852c Implement i3's logic for maintaining a list of 'bindsym' directives and passing it to i3bar through the IPC. 2015-06-05 12:30:53 +02:00
Ingo Bürk ab12d3fc74 Add new command skeleton 'bindsym <button> <command>' for 'bar' block. 2015-06-05 12:30:53 +02:00
Ingo Bürk 9b691bcca2 Introduce a config directive 'binding_mode' in the 'bar' config, pass it through the IPC and parse it in i3bar. 2015-05-31 16:49:09 +02:00