Commit Graph

2434 Commits (04be42f7cd2febf92939cb6eddf3527397ae4dc3)

Author SHA1 Message Date
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
Michael Stapelberg 6b505d8aca Merge pull request #1733 from Airblader/feature-1732
Added a separate color directive for the binding mode indicator
2015-06-02 08:35:14 +02:00
Ingo Bürk dd2e10868c Fix warning about potentially uninitialized variable. 2015-06-01 17:10:10 +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
Ingo Bürk 27e50b827c Use XCB_NONE instead of hard-coded 0. 2015-05-29 23:49:42 +02:00
Ingo Bürk 3c11f27201 Allow hovering over the window decoration to change the focus if the parent container is split horizontally or vertically.
fixes #1056
2015-05-29 23:49:37 +02:00
Ingo Bürk b22a9ce617 Improve logging of button events. 2015-05-26 16:57:25 +02:00
Ingo Bürk 00c2fe4b69 Grab all buttons when managing a window to also allow 'bindsym --whole-window button4 …' to work correctly.
fixes #1701
2015-05-26 16:56:00 +02:00
Andrzej Pronobis d1262f2b6a Use WM_SIZE_HINTS whenever it's provided to set the geometry of floating windows. 2015-05-19 13:44:48 -04:00
Michael Stapelberg da064cc08f Merge pull request #1698 from Airblader/feature-1696
Added 'move position mouse'
2015-05-17 15:02:50 +02:00
Ingo Bürk 8801de2399 Protect "move position mouse" against a NULL access.
This could happen if two outputs are set up to have a gap in between them and the mouse cursor
being in said gap when the command is triggered.
2015-05-14 13:07:56 -04:00
Ingo Bürk 4a585748a4 Implemented new command 'move [window|container] [to] position mouse|cursor|pointer
fixes #1696
2015-05-12 17:46:06 -04:00
Tony Crisci a74662052a Detect base 16 in cmd criteria
Try to detect base 16 numbers given to `con_id` and `id` for command criteria
by setting the base of strtol to 0. This should also detect octal.

This is necessary because mouse bindings now may be serialized as hex as of
5c32de4.
2015-05-12 17:04:01 -04:00
Michael Stapelberg be2634c91f Merge pull request #1693 from mh21/wm-class-garbage-no-copy
Don't duplicate property value on class change.
2015-05-06 23:55:47 -07:00
Michael Hofmann f2542fc413 No memcpy on class change. 2015-05-06 16:33:15 +02:00
Michael Stapelberg 66a1fa7d46 Merge pull request #1638 from hwangcc23/fix-1489
Add a timeout: delay_exit_on_zero_displays
2015-05-05 00:43:43 -07:00
Michael Stapelberg 1aa42794ed Merge pull request #1685 from Deiz/fix-new-workspace-float
Initialize workspace rect to the output's upon creation
2015-05-02 08:24:54 -07:00
Deiz f0f906a52e Initialize workspace rect to the output's upon creation
The comment immediately following implied that this was the intended
behaviour. Not doing so means that compound commands that both move a
window to a new workspace as well as do something that depends on the
workspace's geometry (e.g. 'move position center' or 'floating enable'
on a tiled window) would use the workspace's calloc'd 0x0+0x0 geometry.
2015-04-28 15:09:58 -04:00
Michael Stapelberg 37bee99538 Merge pull request #1680 from acrisci/bug/randr-disabled-outputs
Check if output is disabled in handle_output()
2015-04-26 23:44:03 +02:00
Michael Stapelberg a4f0ed62e5 Merge pull request #1684 from acrisci/bug/focus-without-input-hint
Ignore InputHint when not in WM_HINTS
2015-04-26 12:15:38 +02:00
Tony Crisci 6cbe349774 Ignore InputHint when not in WM_HINTS
When InputHint is not in WM_HINTS (i.e., the flag is not set), treat the window
as if the InputHint was set (the default behavior). This means that i3 will
focus the window when it becomes managed.

fixes #1676
2015-04-25 22:43:46 -04:00
Tony Crisci 5c32de43c0 Bugfix: serialize con_id with %p in run_binding()
%p is equivalent to either %x or %lx, depending on the pointer size of the
platform. Before this commit, we always used %d, which has the same behavior
on Linux, but is not automatically expanded to %ld on e.g. FreeBSD.

fixes #1661
2015-04-25 20:05:55 -04:00
Tony Crisci 14e95e765e Check if output is disabled in handle_output()
Check if the `connection` of the randr output is
XCB_RANDR_CONNECTION_DISONNECTED and disable the output if it is.

This fixes an issue where the output would not be disabled if the output was
physically unplugged from the machine.
2015-04-23 18:21:15 -04:00
Ingo Bürk ffe25d9e43 Set the _NET_WM_STATE_HIDDEN atom on windows that are currently not visible due to being in the non-focused tab of a stacked or tabbed container.
fixes #1648
2015-04-21 09:14:22 +02:00
Ingo Bürk d12482e5fd Added 'con_is_hidden' to check whether a given container is visible to the user assuming its workspace is visible.
This is useful for determining whether we want to set the _NET_WM_STATE_HIDDEN atom on the window.
2015-04-21 09:13:48 +02:00
Michael Stapelberg 67ec2333ee Merge pull request #1665 from Airblader/feature-1658
Added criterion 'window_type'
2015-04-21 08:42:16 +02:00
Michael Stapelberg b1974a469f Merge pull request #1636 from Deiz/update-notices
Update copyright notices and get rid of ranges
2015-04-21 08:31:40 +02:00
Kacper Kowalik (Xarthisius) 30b6584de1 Fix ‘FALSE’ undeclared (first use in this function) when i3 is built without PANGO support 2015-04-20 16:51:58 -05:00
Deiz 884214f14f Update copyright notices and get rid of ranges
The script used to make these changes can be found at:

   https://gist.github.com/Deiz/32322020f76d23e2bf8f
2015-04-20 17:50:21 -04:00
Ingo Bürk 1f472b454c Handle changes to _NET_WM_WINDOW_TYPE after the window has been managed. 2015-04-20 19:27:43 +02:00
Ingo Bürk 550c0ec318 Implement new criterion 'window_type = normal|dialog|utility|toolbar|splash|menu|dropdown_menu|popup_menu|tooltip'
fixes #1658
2015-04-20 19:27:39 +02:00
Ingo Bürk a59fe0d3d2 Added test case for transfer of urgency flag when moving a window to a mark. 2015-04-19 20:57:49 +02:00
Ingo Bürk 283b231290 Disallow moving a container to itself since this would crash i3. 2015-04-19 20:57:49 +02:00
Ingo Bürk 94bbdc9159 Implement the command 'move container to mark <mark>' using 'con_move_to_mark'. 2015-04-19 20:57:49 +02:00
Ingo Bürk 475671ae2a Added 'con_move_to_mark' to move a container to the container holding a certain mark. 2015-04-19 20:57:49 +02:00
Ingo Bürk 9ab4216787 Extract a function from con_move_to_workpsace that deals with moving a container to some other container rather than being restricted to moving to a specific workspace. 2015-04-19 20:57:49 +02:00
Ingo Bürk c4a84385d6 added function 'con_by_mark' to look up a con holding the given mark 2015-04-19 20:57:49 +02:00
Ingo Bürk 9613a0744d Added configuration directive for 'move [container|window] [to] mark <str>' 2015-04-19 20:57:44 +02:00
Michael Stapelberg 8a608ee63a Merge pull request #1632 from Deiz/binding-border
Add a --border flag to enable mouse binds to trigger on border click
2015-04-19 09:28:08 -07:00
Michael Stapelberg 7b68577901 Merge pull request #1651 from tanderson92/pkgconfig
Respect EXEC_PREFIX and a users' choice of PKG_CONFIG.
2015-04-16 00:34:01 -07:00
Thomas Anderson 196e1d0971 Respect EXEC_PREFIX and a users' choice of PKG_CONFIG.
The Makefiles should put binaries in $(EXEC_PREFIX) and
architecture-independent files in $(PREFIX). Also a user may have a
prefixed- pkg-config, as in the case of cross compiling on Exherbo
Linux, so respect the well-accepted $(PKG_CONFIG) variable for this
purpose.
2015-04-12 17:59:30 -07:00
Michael Stapelberg 5e7339d8f0 Merge pull request #1641 from Deiz/fix-1640
Store Git commit identifier in its own object
2015-04-12 10:08:43 -07:00
Deiz 5a987cfd6b Rebuild version.o when version.c or LAST_VERSION change
$(TOPDIR)/LAST_VERSION is a cached copy of common.mk's I3_VERSION var,
updated only if the two differ.
2015-04-12 12:31:58 -04:00
hwangcc 2c77d7ceed Add a timeout: delay_exit_on_zero_displays
Outputs may disappear momentarily and come back later.
To prevent i3 from exit when no output is available momentarily, add a timeout delay_exit_on_zero_displays.
2015-04-11 22:13:10 +08:00
Ingo Bürk edda9306ed Removed comment on removal of legacy "default" layout.
closes #1649
2015-04-11 10:27:42 +02:00
Deiz cd4bc2adf5 Store Git commit identifier in its own object
Fixes #1640
2015-04-06 18:28:40 -04:00
Michael Stapelberg 1546891e6a Bugfix: Remove windows from the save set when unmapping.
fixes #1617
2015-04-06 15:40:12 +02:00
Deiz ce48d5c5d7 Add a --border flag to enable mouse binds to trigger on border click 2015-04-02 16:24:05 -04:00
Michael Stapelberg 92ffc78e19 Merge pull request #1630 from Deiz/consistent-mouse-actions
Make floating window mouse handling consistent with tiled windows
2015-04-02 00:09:13 -07:00
Deiz bb95571516 Make floating window mouse handling consistent with tiled windows
It seems that this was the intended behaviour all along, according to
the comments.
2015-04-02 02:44:37 -04:00
Ingo Bürk b5f7c132fc Added config directive 'no_focus <criteria>' (#1416) 2015-04-01 20:46:56 +02:00
Ingo Bürk e155447932 Added assignment type 'A_NO_FOCUS' (#1416)
Any assignment with type 'A_NO_FOCUS' will cause the matched window to not be focused by i3 when it is managed.
2015-04-01 20:46:55 +02:00
Ingo Bürk 2e4fac61d2 Only mark a window if only one window is matched
We only support unique marks, so looping over all matched windows must be prevented.
If more than one window is matched, we reject it with an error message.

fixes #1614
2015-04-01 13:51:48 +02:00
Michael Stapelberg 3b81e40096 Merge pull request #1618 from Deiz/fix-1603
Allow single-child non-default layout cons to be moved between outputs
2015-04-01 09:08:22 +02:00
Deiz 4e88c10564 Allow single-child non-default layout cons to be moved between outputs
Includes a test case to verify the behaviour of 'move <direction>'.
Fixes #1603.
2015-03-31 13:58:29 -04:00
Ingo Bürk 6036d4e506 Changed the default for show_marks from "no" to "yes" 2015-03-30 23:11:50 +02:00
Ingo Bürk 245a29e233 Make show_marks configurable
Introduce a config directive "show_marks [yes|no]" to en- or disable drawing marks on window decorations.
To not change the look & feel of existing configurations, the default is "no".
2015-03-30 23:11:50 +02:00
Ingo Bürk 2af1a80028 Introduce a cached boolean for changes to the mark of a window.
This is necessary to correctly redraw window decorations when the mark of
a window is added or removed.
2015-03-30 23:08:25 +02:00
Ingo Bürk 1e89a301d5 Draw marks in window decoration
If a window has a mark set, e.g., "example", it will be printed on the right side of the window decorations.
The format is "[example]" and the name of the window is truncated if necessary.

Marks starting with an underscore ("_") will be ignored.
2015-03-30 23:08:25 +02:00
Michael Stapelberg 0ad097ee67 Merge pull request #1613 from Airblader/feature-1426
Added focus_on_window_activation directive
2015-03-30 22:58:16 +02:00
Ingo Bürk 9bf161710b Added 'focus_on_window_activation' directive
When a window receives a _NET_ACTIVE_WINDOW message, it can steal the focus. This may not be preferable to all users.
With this directive, the user can choose from one of the following:
1) 'smart' - focus the container if its workspace is visible, otherwise set the urgency flag (default)
2) 'urgent' - always set the urgency flag, do not steal focus
3) 'focus' - always switch focus, never set the urgency hint
4) 'none' - ignore the request entirely (do not switch focus, nor set the urgency hint)

fixes #1426
2015-03-30 22:09:36 +02:00
Deiz c6581a5fd6 Handle floating centering in one function and test for consistency 2015-03-30 16:03:35 -04:00
Michael Stapelberg 2759a308a2 Merge pull request #1608 from mh21/renaming-empty-ws-startup
Update old_name when renaming current workspace
2015-03-30 22:01:18 +02:00
Michael Hofmann eb84281f8c Cope with non-null-terminated x class properties.
- fixes #1605
2015-03-30 08:56:46 +02:00
Michael Stapelberg 9718640622 Merge pull request #1589 from Deiz/fix-center
Make center coordinates relative to current workspace
2015-03-30 08:47:04 +02:00
Michael Hofmann f76e6c2bb1 Get workspace name when renaming current workspace.
- fixes #1607
2015-03-30 08:28:36 +02:00
Deiz e622c42ef0 Move mkdirp into libi3 2015-03-29 17:18:00 -04:00
Michael Stapelberg b338e25317 Merge pull request #1595 from Deiz/fix-1484
Fix percents when attaching a window to a ws creates a new split con
2015-03-29 23:14:37 +02:00
Ingo Bürk 7a75cb7e0b Added test cases for 'mark --toggle' (#1463) 2015-03-29 21:21:50 +02:00
Ingo Bürk d51d6d730e Added a --toggle switch to "mark [--toggle] <mark>"
This option allows toggling marks on a window without knowing whether the mark is already set or not.
It behaves as follows:
1) If the matched window has no mark, the new mark is set.
2) If the matched window has another mark, the old mark is removed and the new mark is set.
3) If the matched window already has the mark, the mark is removed.

The behavior that all non-matched windows have this mark removed is kept.

fixes #1463
2015-03-29 21:21:50 +02:00
Michael Stapelberg 3191be366d Merge pull request #1600 from Deiz/libi3
Move resolve_tilde and get_config_path into libi3
2015-03-29 20:56:07 +02:00
Deiz 4daed31c3e Move resolve_tilde and get_config_path into libi3 2015-03-29 14:45:42 -04:00
Michael Stapelberg 700dc4bfde Merge pull request #1597 from Airblader/bug-1187
Move urgency hint when moving container to another workspace
2015-03-29 19:50:03 +02:00
Michael Stapelberg 6b04f28b48 fix remaining warnings 2015-03-29 17:12:20 +02:00
Michael Stapelberg 93adcf8bdc Merge pull request #1575 from hwangcc23/next
Fix warnings
2015-03-29 16:53:14 +02:00
hwangcc 42515308e7 Add a safe wrapper for write and fix some warnings
1. Add a function writeall and make swrite wrap that function. Use either writeall or swrite, depending on whether we want to exit on errors or not.
2. Fix warnings when compiling with a higher optimisation level.
(CFLAGS ?= -pipe -O3 -march=native -mtune=native -freorder-blocks-and-partition)

Signed-off-by: hwangcc <hwangcc@csie.nctu.edu.tw>
2015-03-29 10:22:34 +08:00
Ingo Bürk 6a5d561235 Move urgency hint when moving container
When an urgent container is moved to another workspace, the urgency hint
1) is unset on the source workspace and
2) set on the target workspace

fixes #1187
2015-03-28 18:29:34 +01:00
Deiz 48d2acd8f6 Fix percents when attaching a window to a ws creates a new split con
Fixes #1484 and includes a test case.
2015-03-27 22:20:28 -04:00
Michael Stapelberg fb0573e183 Merge pull request #1582 from shdown/allow-escaping-backslashes
Allow escaping backslashes
2015-03-27 09:40:09 +01:00
Deiz 24f0ea2f24 Make center coordinates relative to current workspace
Fixes #1211
2015-03-25 22:40:59 -04:00
Tony Crisci 49510427b9 Handle strut partial changes for dock clients
Handle changes to the property _NET_WM_STRUT_PARTIAL by reallocating
screen space in the dock area when the dock client requests a new
position.

This will allow changes to the bar config directive `position` to be
effective on the `reload` command.

fixes #1294
2015-03-25 19:45:42 -04:00
Michael Stapelberg 037cb317cb Merge pull request #1578 from Airblader/feature-custom-separator
Add support for a custom separator symbol
2015-03-25 22:49:09 +01:00
Michael Stapelberg fa93f275bb Don’t focus placeholder windows. 2015-03-25 22:47:23 +01:00
Ingo Bürk 80da100ac8 Add support for a custom separator symbol
This introduces a "separator_symbol" property for the i3bar configuration.
If set, the specified string will be used as a separator instead of a vertical line. Since it is an optional configuration, complete backwards compatibility is given.

fixes #1472
2015-03-25 21:38:55 +01:00
Michael Stapelberg 26237508ea Bugfix: skip restart_mode swallow specifications
Otherwise, placeholder windows would accumulate these over restarts. The
worst part is that they don’t get dumped properly, meaning an empty
swallows specification ends up in the state, which matches any window,
so other random windows would be matched into the placeholder (e.g.
i3bar).

fixes #1502
2015-03-25 20:50:25 +01:00
Michael Stapelberg f790fedce3 Restore placeholder windows after restarting (Thanks Airblader).
fixes #1502
2015-03-25 20:50:25 +01:00
shdown 6d8891894e Allow escaping backslashes
Fixes #1577.
2015-03-25 21:32:46 +03:00
Michael Stapelberg 822cd3bf1b Revert "Workspace command number selection"
This reverts commit cbd51ce664.

If you’ve started using this feature, I’m very sorry, but I think it’s
better to revert it entirely, as it will only cause more problems in the
future as more and more people upgrade and get bitten by this if we
didn’t revert it…

fixes #1536
2015-03-24 09:28:30 +01:00
Michael Stapelberg 2190bb9386 Don’t overwrite border width when already set (placeholders).
fixes #1501
2015-03-21 23:02:35 +01:00
Michael Stapelberg 09e4fb716c Merge pull request #1551 from acrisci/bug/rename-workspace-mismatch
bugfix: workspace rename focus mismatch
2015-03-16 22:49:38 +01:00
Michael Stapelberg d9c2ce0023 Merge pull request #1553 from Airblader/feature-remove-output-assignment
Remove the A_TO_OUTPUT option
2015-03-16 22:40:25 +01:00
Ingo Bürk 52f918309b Remove the A_TO_OUTPUT option as it is not needed anymore and will not be implemented in favor of normal assignments. 2015-03-16 20:18:03 +01:00
Tony Crisci 6b150b1ac2 bugfix: workspace rename focus mismatch
When renaming a workspace on another output that moves the workspace to
the current output, the renamed workspace would be shown even though it
does not contain the focused container.

Explicitly show the focused workspace after the move. This is necessary
because `workspace_move_to_output` will show the workspace that is
moved.
2015-03-15 23:30:00 -04:00
Michael Stapelberg 513510de69 clang-format src/commands.c 2015-03-14 22:32:23 +01:00
Michael Stapelberg 56f420c3dd Merge pull request #1539 from mh21/wsrename-1527
Rename workspaces in startup sequences
2015-03-14 04:56:19 -07:00
Michael Hofmann 44f748a663 Rename workspaces in startup sequences.
When renaming workspaces, any workspace names in pending startup
sequences also need to be renamed.
2015-03-13 10:35:20 +01:00
Michael Stapelberg c263bb3d2a Merge pull request #1521 from Airblader/feature-use-refactored-function
Use the already existing function to get rid of some code duplication
2015-03-13 00:54:52 -07:00
Michael Stapelberg a5939f3edc Merge pull request #1513 from Airblader/defect-1473
Move workspace to assigned output when renaming it
2015-03-13 00:52:52 -07:00
Michael Stapelberg fea21f8945 Merge pull request #1512 from mdtipton/unclutter_scroll
Fix scrolling in window decoration with hidden cursor.
2015-03-13 00:46:16 -07:00
Diana Thayer 94b1e76af4 degendered terms 2015-03-11 21:41:43 -07:00
Michael Stapelberg 0148dc6fd3 Merge branch 'master' into next
Conflicts:
	src/commands.c
2015-03-07 15:57:41 +01:00
Ingo Bürk 9ebf17c39d Properly error out when the layout file cannot be read.
This will result in an actual error message for the user.
fixes #1499
2015-03-07 15:57:05 +01:00
Ingo Bürk 6c675cc3f6 Glob filepath when calling append_layout
fixes #1500
2015-03-07 15:56:59 +01:00
Ingo Bürk 58df5aa6c4 Improve error messages on failing commands 2015-03-07 15:53:35 +01:00
Michael Stapelberg 6226400dfd Merge branch 'master' into next 2015-03-07 15:40:59 +01:00
Michael Stapelberg df1fcdafe8 Bugfix: insert id-based match at HEAD, not TAIL.
Before this commit, placeholder windows had any matches that were
defined in the JSON file, _followed_ by an i3-internal match that
ensures the placeholder X11 window gets swallowed into the placeholder
i3 container.

The problem was that the first successful match was deleted, and if
users specified a criterion (title=IPython) that matched the placeholder
window itself (name=IPython), then that match is deleted and the
i3-internal match is kept. This results in the actual window the user
wants to match not being swallowed, and the placeholder window not
displaying any criteria.

fixes #1526
2015-03-07 15:38:10 +01:00
Michael Stapelberg a2a32ab1ee Merge branch 'master' into next 2015-03-07 14:52:39 +01:00
Michael Stapelberg 7340a3e642 Fix bindings using Mode_switch
fixes #1518
2015-03-07 14:52:32 +01:00
Michael Stapelberg 61418f4dfb Merge branch 'master' into next 2015-03-07 11:47:59 +01:00
Michael Stapelberg d551618cf0 Revert "Handle WM_CHANGE_STATE requests for iconic state"
This reverts commit 136b3e345b.

fixes #1516
2015-03-07 11:47:01 +01:00
Ingo Bürk c572176429 Use the already existing function to get rid of some code duplication 2015-03-05 14:00:24 +01:00
Michael Stapelberg 1b69ddacbe Merge pull request #1515 from Airblader/feature-commands-error-messages
Improve error messages on failing commands
2015-03-04 10:20:21 -08:00
Ingo Bürk acb79bd02f Improve error messages on failing commands 2015-03-04 14:01:42 +01:00
Ingo Bürk eb73059c61 Refactor functions for easy reuse 2015-03-04 09:22:25 +01:00
Ingo Bürk bcc1314a2d When renaming a workspace, look for assignments and move the renamed workspace to the appropriate output. 2015-03-04 09:06:44 +01:00
Michael Stapelberg dcba0b46dd Fix keyboard layout change detection
…by listening to XKB_NEW_KEYBOARD events and re-allocating the keysym
map on both XKB_NEW_KEYBOARD and XKB_MAP_NOTIFY.

fixes #1302
2015-03-03 09:47:15 +01:00
Michael Stapelberg c7fd4b39c6 Fix keyboard layout change detection
…by listening to XKB_NEW_KEYBOARD events and re-allocating the keysym
map on both XKB_NEW_KEYBOARD and XKB_MAP_NOTIFY.

fixes #1302
2015-03-03 09:46:16 +01:00
Michael Tipton 73ecc56bd7 Fix scrolling in window decoration with hidden cursor.
If the mouse cursor is hidden (by unclutter, for example), then scrolling
in the window decoration creates an event with a child
(i.e. event->child != XCB_NONE). This causes route_click() to be called
with dest=CLICK_INSIDE, which prevents scrolling through a stacked layout.

To fix this, check if a click is in the window decoration _before_
checking if the event has a child.
2015-03-03 00:24:54 -08:00
Michael Stapelberg 487ccb536a Merge pull request #1503 from Airblader/defect-layout-globbing
Glob filepath when calling append_layout
2015-03-01 08:25:09 -08:00
Michael Stapelberg 091f1db39a run clang-format (3.5.0)
Not quite sure why there are so many differences. Perhaps we’ve gotten
out of the habit of running clang-format after every change.

I guess it’d be best to have a travis hook that runs clang-format for us
and reports any problems on pull requests.
2015-03-01 17:16:03 +01:00
Ingo Bürk 9e739de5d3 Glob filepath when calling append_layout
fixes #1500
2015-03-01 16:51:58 +01:00
Steven McDonald 1ab76fb05a Fix key bindings on big-endian platforms
input_code is a uint16_t, but xcb_keycode_t is uint8_t, meaning that
only the first byte of input_code is inspected by memmem. On
little-endian platforms, this code would have worked by accident, since
the first byte of input_code represents the 8 least significant bits.
However, on big-endian platforms the first byte is the 8 most
significant bits, which means memmem is scanning bind->translated_to
for the wrong keycode (probably 0).

In order to work correctly on big-endian and little-endian platforms,
simply typecast input_code to an xcb_keycode_t and pass that to memmem.

The observed behaviour associated with this bug is that key bindings
don't work at all. This patch has been tested on an iBook G4 running
OpenBSD -current, and key bindings work properly with this fix applied.
2015-03-01 21:07:03 +11:00
Michael Stapelberg fbe25297b7 Properly invalidate rendering cache when updating orientation (Thanks hercek)
fixes #1445
2015-02-11 21:13:55 +01:00
Michael Stapelberg 5cf1a0c43b Merge pull request #1462 from carrotIndustries/netwm_moveresize
Support _NET_WM_MOVERESIZE
2015-02-11 20:30:05 +01:00
Lukas K 1c5ab5fa36 Support _NET_WM_MOVERESIZE
Add support for the _NET_WM_MOVERESIZE client message. This message
enables clients to initiate window moving or resizing. Toolkits like
Gtk3 use this message when the user drags a client-side decorated window
by its title bar. When Gtk detects that the window manager does not
support this client message, it uses a slow fallback implementation.

fixes #1432
2015-02-11 00:07:28 +01:00
Tony Crisci c815fc798d Handle button release events
This enables the --release switch on mouse button bindings.
2015-02-10 17:46:02 -05:00
Michael Stapelberg 3f126c61c4 Merge branch 'master' into next 2015-01-31 22:56:08 +01:00
Michael Stapelberg 13220e75d8 Bugfix: actually parse client.placeholder (Thanks Ingo)
fixes #1400
2015-01-31 22:55:45 +01:00
Michael Stapelberg dd5be77d1d Merge branch 'master' into next 2015-01-31 22:42:54 +01:00
Michael Stapelberg 55b5f491a4 Bugfix: correctly restore workspaces regardless of where “type” is (Thanks dsargrad)
fixes #1395
2015-01-31 22:42:47 +01:00
Tony Crisci 74b69d6d02 Add mouse binding pointer position configuration
Add the `--whole-window` switch for mouse bindings. This switch controls
what part of the container the pointer must be over to trigger a mouse
binding. The default is to only trigger mouse bindings over the
titlebars. With this switch, a mouse binding will be triggered over the
main part of the window as well.

This is a breaking change to the previous behavior, which would trigger
a mouse binding with a modifier over any part of the window.

fixes #1429
2015-01-31 21:29:48 +01:00
Michael Stapelberg 073ecdd711 Revert "don’t fix coordinates/change focus/warp when source_output was scratchpad"
This reverts commit 9480801927.

This causes focus issues.
2015-01-23 17:11:05 +01:00
Michael Stapelberg 9480801927 don’t fix coordinates/change focus/warp when source_output was scratchpad 2015-01-23 17:07:31 +01:00
Michael Stapelberg 3b4ae812e3 Merge branch 'master' into next
Conflicts:
	src/render.c
2015-01-17 18:20:43 +01:00
Michael Stapelberg 8b96bb0298 Bugfix: render floating windows during global fullscreen (Thanks dmurph, Mats)
fixes #1393
2015-01-17 18:19:15 +01:00
Tony Crisci 69dd8ce398 Fix start_application() doc about which shell is used
Since this commit:

f691a55923

the shell that is used is the system's bourne shell (/bin/sh) and the
env variable SHELL is not considered.

No logic changes.
2014-12-22 09:48:03 +01:00
Tony Crisci 823b46a544 Include workspace con in workspace event
Send the affected workspace in the "current" property for each workspace
event for any type of workspace event that affects a particular
workspace.

fixes #1411
2014-12-22 09:47:31 +01:00
Mats e59a76e456 Extend the fullscreen command
Rather than just toggling the fullscreen modes, allow to set them
directly with:

    fullscreen enable|toggle [global]
    fullscreen disable

For compatibility, retain the previous command and its toggling behavior:

    fullscreen [global]

fixes #1120
2014-12-10 20:42:52 +01:00
Mats dc351fb291 Prevent workspace change during global fullscreen
While in global fullscreen, the workspace could be changed leaving the
fullscreen container still visible on top but losing its focus.
2014-12-10 20:24:32 +01:00
cornerman 58c65a64fe add deco_rect property to con in ipc response 2014-11-29 18:19:39 +01:00
Michael Stapelberg 105db325dc Revert "Bugfix: Set input focus with last timestamp"
This reverts commit 9cee8dac5e.

fixes #1383
2014-11-23 00:36:09 +01:00
Michael Stapelberg ef9b081a3e Bugfix: check if values are non-NULL before copying (Thanks xeen)
fixes #1397
2014-11-18 08:27:53 +01:00
Tony Crisci 8d031bfbf8 Handle _NET_CLOSE_WINDOW client message requests
> Pagers wanting to close a window MUST send a _NET_CLOSE_WINDOW client
> message request to the root window.

We interpret this message as a request to close the con for the given
window.

See: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472668896

fixes #1396
2014-11-17 09:08:42 +01:00
Tony Crisci bb1f857b00 bugfix: copy binding before run
Copy the binding struct before running it and use this copy to emit the
binding event.

This fixes a crash when the command `reload` is used in a binding when
the binding event is emitted.
2014-11-16 23:36:27 +01:00
Tony Crisci 6ba7728136 Bugfix: check symbol for NULL in binding json dump
When dumping a binding, as is done during the binding event, check
symbol for NULL. If it is, dump json null. This prevents a crash when
running a binding that was configured with bindcode.

fixes #1379
2014-10-05 21:06:11 +02:00
Tony Crisci fbaf084426 Implement the ipc 'binding' event
The binding event will be triggered when a binding is run as a result of
some a user action. The binding event has the following properties:

change: (str) Currently this will only be "run" but may be expanded in
the future. Included for consistency with other events.

binding: (map) the serialized binding

The "binding" member will have these properties:

input_type: (str) either "keyboard" or "mouse"

input_code: (int) the xcb keycode of the keyboard binding if it was
provided or the mouse button if it is a mouse binding.

symbol: (str) the string representation of the input code

command: (str) the bound command

mods: (list of str) a list of the modifiers that were pressed as string
symbols

fixes #1210
2014-10-03 09:35:37 +02:00
Michael Stapelberg ea2552e852 Bugfix: use the command parser to properly extract workspace names
fixes #1377
2014-10-01 22:50:48 +02:00
Mats 7fe55090ec Don't draw borders wider than actual width
Rectangles passed to function xcb_poly_fill_rectangle are of type
xcb_rectangle_t and defined as:

    struct xcb_rectangle_t {
        int16_t  x;
        int16_t  y;
        uint16_t width;
        uint16_t height;
    }

The rectangles for the right and lower border had a width and height,
respectively, greater than the actual border width.

Furthermore, offset the bottom border to not overlap with the right one
and, for the top border, use r->width instead of con->rect.width as with
the other borders.
2014-10-01 22:29:43 +02:00
Tony Crisci fd8a2b0e51 IPC: set ws reply "num" member to -1 when named
When a named workspace (i.e., a workspace that has a name that does not
begin with text that can be parsed as an integer greater than or equal
to zero) is represented by the ipc as a workspace json object such as
can be queried with `i3-msg -t get_workspaces`, set the num property to
-1 instead of json null.

This is for convenience of ipc consumers using type-constrained
languages such as C which have difficulty cleanly expressing nullable
integers.

fixes #1368
2014-09-29 09:33:02 +02:00
Tony Crisci 8870edc2ca Do not resend focus on click
Do not set focused_id to XCB_NONE in route click to force resend focus,
in some cases to an already focused window.

Sending focus again on click is not necessary and may cause problems
with certain wine or mono apps. Resending focus makes combo boxes not
work in Office 2010.

This effectively reverts commit 250577da, so in case this commit causes
any problems with Eclipse to resurface, we’ll revert this commit in
favor of 250577da (the Eclipse-related bug fix).
2014-09-21 02:55:11 +02:00
Michael Stapelberg 2fecf57699 Properly handle windows unsetting WM_TRANSIENT_FOR (Thanks Janus)
fixes #1351
2014-08-26 10:00:14 +02:00
aszlig 9058fc44e6 Allow to validate the config file without X.
We're going to call parse_configuration() very early if -C is given on
the command line. Instead of the previous "only_check_config", which has
been a global variable, we now simply pass use_nagbar as false if we're
just validating.

This causes the whole parsing to run without X and of course without
starting nagbar and displaying the errors to standard out/error instead.

The return code of parse_configuration() is now a boolean which
represents whether an error occured during parsing and the programs exit
code is returned accordingly.

Although the config parser still has a lot of side-effects, we now can
parse without the need to have an XCB connection. A nicer implementation
would be to just set the new font and load it just after we're done
parsing, but to ensure we don't break functionality we just load a dummy
FONT_TYPE_NONE if XCB isn't available. The main reason for going this
route is that it's a bit difficult to test fonts in a distribution
agnostic way without bundling fonts with i3 (or Xdummy to be more
exact).

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-08-25 19:34:26 +02:00
Mats 5762456d89 Align lower line of bar decoration to border width
In normal border style, two horizontal lines are drawn to outline the
bar decoration. The lower line leaves a gap to the left and right to
align with the border. This gap was hardcoded to 2 pixels. Now it
matches the current border width, if any.

In stacked layout, only the bottommost bar is aligned. In tabbed layout,
no gaps are left in order to close the outline and make the notion of a
tab more clear.
2014-08-11 09:49:49 +02:00
Michael Stapelberg 80db544e26 retina support: convert logical to physical pixels for default_border_width 2014-08-11 09:46:02 +02:00
Michael Stapelberg 89d3f93bec Merge branch 'master' into next 2014-08-08 20:16:40 +02:00
Michael Stapelberg fc88631534 Bugfix: don’t set focus in con_set_layout() on invisible workspaces
fixes #1338
2014-08-08 20:15:59 +02:00
Tony Crisci 034c82c0ac Raise floating windows on `focus [direction]`
Raise a window when cycling focus between floating windows with `focus
[direction]` command so that newly focused windows are rendered on top
of other windows.

This is done by placing the window last in the floating nodes of the
parent and reordering the stack so the relative order is preserved.

fixes #1322
2014-08-08 12:19:35 +02:00
Michael Stapelberg 67e00b3ab8 Merge branch 'master' into next 2014-07-23 09:48:26 +02:00
Tony Crisci 56c284af8e Bugfix: missed case for decoration rerender
Rerender the decoration when the container requires a pixmap and does
not have one.

fixes #1292
2014-07-23 09:48:20 +02:00
Michael Stapelberg 8e8afb2609 Remove TODO for cycling through the floating z-index.
I think this is not a good feature to have. It shouldn’t be necessary
for a tiling window manager that explicitly discourages the use of
floating windows.

fixes #1324
2014-07-20 23:49:08 +02:00
Michael Stapelberg 0d656dd05d don’t set names corresponding to debug colors, remove “sleep 1”.
The names were (mostly) internal to i3 anyway.

Hopefully this doesn’t break anything, but I really think this old
behavior needs to go now :).
2014-07-15 10:36:31 +02:00
Michael Stapelberg ee75821699 Merge branch 'master' into next 2014-07-15 10:28:51 +02:00
Michael Stapelberg 679a5de8cf Bugfix: properly restore workspace containers (Thanks vals)
fixes #1306
2014-07-15 10:27:42 +02:00
Tony Crisci 344f6be84a Handle WM_CLASS changes
http://tronche.com/gui/x/icccm/sec-4.html

> The WM_CLASS property (of type STRING without control characters)
> contains two consecutive null-terminated strings. These specify the
> Instance and Class names to be used by both the client and the window
> manager for looking up resources for the application or as identifying
> information.

i3 processes changes to WM_CLASS by updating the cached property and
running assignments. This allows the property to be used in criteria
selection.

fixes #1052
2014-07-15 09:18:40 +02:00
Tony Crisci 6bf7f8ef78 Always explicitly set border widths on manage
When a window becomes managed, explicitly set the current border width
to the default instead of relying on the default value of -1 to apply
the correct value.

Now that there are two different kinds of default borders, a border
width value of -1 is ambiguous. This can lead to different border widths
effectively being applied when the container changes from tiling to
floating, which is surprising behavior.

This commit extends behavior introduced in this commit to normal
borders:

7afe9cc78b

Explicitly set current border width when BS_PIXEL

fixes #1304
2014-07-11 00:33:20 +02:00
Tony Crisci 8e23dc881b i3bar: implement custom mouse wheel commands
Users can specify a command to run when a button was pressed on i3bar to
override the default behavior. Currently only the mouse wheel buttons
are supported. This is useful for disabling the scroll wheel action or
running scripts that implement custom behavior for these buttons.

Example:

bar {
    wheel_up_cmd nop
    wheel_down_cmd exec ~/.i3/scripts/custom_wheel_down
}

fixes #1104
2014-07-10 22:40:12 +02:00
Tony Crisci 0514be8d4b Handle EWMH requests to change current desktop
This request is used by pagers and bars to change the current
desktop likely as a result of some user action. We interpret this as
a request to focus the given workspace.

for more information see:

http://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368135008
2014-07-10 22:39:42 +02:00
Tony Crisci 196e748e94 bugfix: default floating border regression
Fixes a bug where a normal floating default border is not applied when
the default tiling border is set to a pixel value.

This bug was introduced in this commit:

43b447855d

Consider motif border for floating geometry

Fixes a comment that claimed default floating border could override
motif hints, which was never the case.

fixes #1305
2014-07-10 22:32:27 +02:00
Tony Crisci 7381b50587 Make absolute floating move work with criteria
Make commands of type `move [window|container] [to] [absolute] position
<px> [px] <px> [px]` work with command selection criteria.

fixes #1301
2014-07-02 19:07:08 +02:00
Tony Crisci bb24db1986 Bugfix: _NET_SUPPORTED property fixes
Fix a typing mistake that may cause _NET_SUPPORTED root property to
become corrupted.

This bug was introduced in:

Implement EWMH number of desktops property

http://code.stapelberg.de/git/i3/commit/?h=next&id=b47f480728a6d053c117e4b99ee4c78d99ba6a71

Additionally adds one missing atom to _NET_SUPPORTED.

fixes #1298
2014-07-01 23:43:14 +02:00
Michael Stapelberg 0279401528 Merge branch 'master' into next 2014-06-28 13:05:40 +02:00
Michael Stapelberg 1f9057bc4b Revert "Disable render-time pointer warps if asked"
This reverts commit b109b1b20d.

Turns out the change in behavior was unexpected by a number of users, so
let’s revert it and make those users that want this behavior configure
it explicitly.

Sorry for the back-and-forth here.
2014-06-28 13:04:52 +02:00
Michael Stapelberg 2d28273cac Merge branch 'master' into next 2014-06-28 13:01:48 +02:00
Tony Crisci 7afe9cc78b Explicitly set current border width when BS_PIXEL
When a window becomes managed, if the config specifies a pixel border
style, explicitly set the current border width so it does not change
when the container changes from tiling to floating.

fixes #1266
2014-06-28 13:00:59 +02:00
Michael Stapelberg 01a2c5a3f1 Merge branch 'master' into next 2014-06-27 09:05:32 +02:00
Michael Stapelberg c159fc4197 Bugfix: create the directory for storing the restart state (Thanks hjem)
fixes #1303
2014-06-27 09:04:51 +02:00
Michael Stapelberg 80007828c3 cleanup: src/i3.mk: add XKB_COMMON_CFLAGS when compiling i3 2014-06-25 17:58:16 +02:00
Michael Stapelberg b91cd347e4 Merge branch 'master' into next 2014-06-24 09:57:05 +02:00
Michael Stapelberg 5c30c6ca80 add log messages for the detected DPI
Currently, the DPI is only logged when pango fonts are used, which is
often not the case when people report problems with the DPI detection.
2014-06-24 09:56:31 +02:00
Tony Crisci 136b3e345b Handle WM_CHANGE_STATE requests for iconic state
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.4

 > IconicState - The client's top-level window is iconic (whatever that
 > means for this window manager). The client can assume that its
 > top-level window is not viewable, its icon_window (if any) will be
 > viewable and, failing that, its icon_pixmap (if any) or its
 > WM_ICON_NAME will be displayed.

For these requests, we just close the window.

fixes #1279
2014-06-24 09:39:12 +02:00
Tony Crisci ca5137eeba remove unneeded render on map request
manage_window() will call tree_render() when appropriate, so pushing
changes to X here is not needed.
2014-06-24 09:32:14 +02:00
Tony Crisci e77103012f remove unneeded render on unmap
tree_render() will call x_push_changes(), so calling it afterward is not
needed.
2014-06-24 09:32:04 +02:00
Tony Crisci 43b447855d Consider motif border for floating geometry
When calculating the geometry of a floating window with motif hints that
specify a border style, take into account that this window will have a
different border style when calculating its position with
floating_enable() when the window becomes managed.

A nice side effect of this is that users can override motif hints with
`new_float` config directives when they are specified other than
`normal`.

fixes #1270
2014-06-24 09:19:17 +02:00
Tony Crisci 14ec68526b Cross-output focus focus floating exception
Focusing across outputs with `focus [direction]` should focus an
existing floating con when no tiling con exists on the output in
[direction].
2014-06-24 09:05:39 +02:00
Tony Crisci 682fb0a291 Implement the window::urgent event
The window::urgent event is emitted when a container becomes urgent or
loses its urgent status.
2014-06-24 09:04:45 +02:00
Tony Crisci a9c094b731 Implement EWMH desktop names
Maintain the _NET_DESKTOP_NAMES property on the root window.

http://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368131760

> _NET_DESKTOP_NAMES
>
> _NET_DESKTOP_NAMES, UTF8_STRING[]
>
> The names of all virtual desktops. This is a list of NULL-terminated
> strings in UTF-8 encoding [UTF8]. This property MAY be changed by a
> Pager or the Window Manager at any time.
2014-06-24 09:04:05 +02:00
Michael Stapelberg a6c6e3e3a0 Merge branch 'master' into next 2014-06-24 09:01:59 +02:00
Tony Crisci 1d100d6e16 Bugfix: don't focus unmapped container on manage
A window may become unmapped on manage when an assignment command unmaps
the window, such as moving it to the scratchpad or killing it.

This can cause i3 focus to be an unmapped window and different than X
focus which can lead to complications

fixes #1283
2014-06-24 09:01:04 +02:00
Tony Crisci cbd51ce664 Workspace command number selection
If a `workspace {N}` or `move to workspace {N}` command is given with N
as a plain number, the workspace of this number is selected for the
context of the command if one exists and there is no workspace with a
name that exactly matches N.
2014-06-23 21:30:07 +02:00
Tony Crisci 4205973135 feature: implement ewmh desktop viewport property
Set and update the _NET_DESKTOP_VIEWPORT property

http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140146176862048

> _NET_DESKTOP_VIEWPORT x, y, CARDINAL[][2]/32
> Array of pairs of cardinals that define the top left corner of each
> desktop's viewport.
2014-06-23 21:29:57 +02:00
Michael Stapelberg d1e59a204e fix src/commands.c with clang-format 2014-06-23 21:29:42 +02:00
Tony Crisci babfb779d7 Implement the window::floating event
The window::floating event should be emitted when a window transitions
to or from the floating state.
2014-06-23 21:18:12 +02:00
Tony Crisci c2b6b06da7 Make command `move [direction]` work with criteria
A container selected with criteria should be moved with the `move
[direction]` command, instead of this command always acting on the
focused container.
2014-06-23 21:17:27 +02:00
Tony Crisci c936232545 Consistently parse workspace numbers
Use ws_name_to_number() to parse workspace numbers where this
transformation takes place.
2014-06-23 21:16:18 +02:00
Michael Stapelberg 3f5a0f0024 Switch to xcb-xkb and libxkbcommon
This removes our last dependency on Xlib! :)

(Okay, an Xlib dependency still comes in through other libraries that we
 link against, but it’s not us. Our code is simpler by this change and
 uses one less connection to X11.)
2014-06-21 19:10:37 +02:00
Tony Crisci cf6cc134b8 Implement the window::move event
The window::move event should be emitted when the window moves position
in the tree.
2014-06-19 13:00:17 +02:00
Tony Crisci 25ca78bbba Implement the window::close event
The window::close event should be emitted when a window closes.
2014-06-19 12:59:25 +02:00
Tony Crisci 0df172fd05 Feature: implement mouse bindings
A configured mouse binding (for example `bindsym button3 kill`) runs
its command when the mouse button is pressed over parts of a container.

If the binding has no modifer, it will only run when the button is
clicked on the window titlebar.

Otherwise if the binding has a modifier, it will run over the titlebar
or any part of the contained window.

fixes #558
2014-06-19 12:28:54 +02:00
Tony Crisci 8a618e4b00 bugfix: don't set input focus if not accepted
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7

> Clients using the Globally Active model can only use a SetInputFocus request
> to acquire the input focus when they do not already have it on receipt of one
> of the following events:
> * ButtonPress
> * ButtonRelease
> * Passive-grabbed KeyPress
> * Passive-grabbed KeyRelease

Since managing a window happens on a MapNotify (which is absent from this
list), the window cannot accept input focus, so we should not try to focus
the window at all.

Fixes an issue with xfce4-notifyd which (correctly) declines focus when
we send WM_TAKE_FOCUS, which puts i3 in a state where i3 focus and X
focus are different when a notification appears.
2014-06-19 11:55:28 +02:00