Commit Graph

400 Commits (7754de900aa41eeedf6d3ce4d661b550b7a60177)

Author SHA1 Message Date
Ingo Bürk 922afe1919 Keep a sticky window focused if it was the focused window on the source workspace.
fixes #1924
2015-09-24 22:10:17 +02:00
Ingo Bürk b490f67925 Use the focused container to determine the target window_mode when using floating mode_toggle.
This fixes mode_toggle in case the workspace is focused and only a floating sticky window is open.

fixes #1927
2015-09-16 19:52:08 +02:00
Ingo Bürk 1c4c3f06fa Make sure sticky windows pop to the front if they get sticky while not being on a visible workspace.
This commit also reworks the way focusing sticky windows is prevented by not focusing them temporarily at all, but preventing the focus in the first place.
2015-09-13 20:40:20 +02:00
Ingo Bürk 9866b00802 Implement new 'sticky' command to manually set, remove or toggle the sticky state on a window. 2015-09-13 20:40:20 +02:00
Michael Stapelberg ef6f2f4365 Merge pull request #1893 from rr-/resize
Added cmd_size
2015-09-11 14:31:33 -07:00
rr- 23d16e1332 Support "resize set W H" 2015-09-11 23:12:07 +02:00
Ingo Bürk f31e476b28 Let "focus" report success depending on whether a window was matched.
fixes #1809
2015-09-11 08:26:33 +02:00
Michael Stapelberg ee2983c791 Merge pull request #1880 from Airblader/feature-665
Move data from Con to Window
2015-09-03 20:35:43 +02:00
Ingo Bürk 344514bca5 Move aspect_ratio from Con to Window.
relates to #665
2015-08-31 21:27:13 +02:00
Ingo Bürk f43a15acde Move width_increment and height_increment from Con to Window.
relates to #665
2015-08-31 21:27:10 +02:00
Ingo Bürk f44c87685b Support _NET_WM_VISIBLE_NAME. As per specification this is necessary since we can display custom titles with title_format.
fixes #1872
2015-08-30 22:42:14 +02: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
Ingo Bürk 5a8d66a1d5 Parse the title_format and display the customized window title if a format was set.
The format string set with "title_format" can contain the placeholder "%title" which will be replaced with the actual window title.

By not overwriting window->name itself, we make sure that assignment matching still works as expected.

fixes #1723
2015-06-29 09:13:31 +02:00
Ingo Bürk 55e8d06ee4 Added command directive 'title_format'.
This directive will be used to customize the window title.
2015-06-29 09:13:31 +02:00
Ingo Bürk 9940571069 Fix documentation for border styles. 2015-06-12 17:54:54 +02: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 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 67ec2333ee Merge pull request #1665 from Airblader/feature-1658
Added criterion 'window_type'
2015-04-21 08:42:16 +02: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 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 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 9613a0744d Added configuration directive for 'move [container|window] [to] mark <str>' 2015-04-19 20:57:44 +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
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 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
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 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
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
Deiz 24f0ea2f24 Make center coordinates relative to current workspace
Fixes #1211
2015-03-25 22:40:59 -04: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
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
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
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
Ingo Bürk 9e739de5d3 Glob filepath when calling append_layout
fixes #1500
2015-03-01 16:51:58 +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
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 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
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
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
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
Michael Stapelberg d1e59a204e fix src/commands.c with clang-format 2014-06-23 21:29:42 +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 4c06e7a573 clang-format-3.5 **/*.h **/*.c
This should be the last commit that formats a big bunch of files. From
here on, whenever I merge patches, I’ll run clang-format like described
in the title.
2014-06-19 11:20:32 +02:00
Michael Stapelberg 9200094203 format **/*.c with clang-format-3.5
This has multiple effects:

1) The i3 codebase is now consistently formatted. clang-format uncovered
   plenty of places where inconsistent code made it into our code base.

2) When writing code, you don’t need to think or worry about our coding
   style. Write it in yours, then run clang-format-3.5

3) When submitting patches, we don’t need to argue about coding style.

The basic idea is that we don’t want to care about _how_ we write the
code, but _what_ it does :). The coding style that we use is defined in
the .clang-format config file and is based on the google style, but
adapted in such a way that the number of modifications to the i3 code
base is minimal.
2014-06-15 19:07:02 +02:00
Michael Stapelberg 94574db6f6 cleanup temporary directory when restarting and not using XDG_RUNTIME_DIR
fixes #1253
2014-06-11 09:17:43 +02:00
Michael Stapelberg 26460c091a delete ipc socket when exiting, cleanup tmpdir
fixes #1253
2014-06-08 22:13:43 +02:00
Michael Stapelberg 617afc67a2 replace remaining printf()s with D?LOG
fixes #1252
2014-06-08 21:56:14 +02:00
Tony Crisci c7aae56030 Refactor parse_command
parse_command returns a struct that contains useful information about
the result of a command as a whole (instead of the intermediate
representation used during parsing).

parse_command now requires the caller to allocate the yajl_gen used for
generating a json reply. This is passed as the second parameter to
parse_command. If NULL is passed, no json reply will be generated.
2014-05-31 14:59:35 +02:00
Tony Crisci 45fa4b7d23 Change the names of parser result structs
Change the name of structs CommandResult and ConfigResult to
CommandResultIR and ConfigResultIR to show they are an intermediate
representation used during parsing.
2014-05-20 19:59:01 +02:00
Michael Stapelberg ff94d28b85 improve error messages for i3-internal workspace names 2014-05-03 15:02:51 +02:00
Alexander Berntsen bc79884a9e Make all workspaces starting with "__" internal
Workspaces won't work properly if they start with "__", so reserve that
namespace altogether. Disallow renaming workspaces to reserved namespace
and using reserved namespace in configuration.

Fixes #1209.
2014-05-03 15:00:15 +02:00
Tony Crisci ea551e4d99 Bugfix: resize window check should check for null
When checking the window type for a resize command, first check to see
if the window property is null before checking whether or not it is a
dock window. The window may be null in the case it is a branch
container.

fixes #1220
2014-04-26 12:10:05 +02:00
Michael Stapelberg 524f20b8a0 layout restoring: append at the nearest split container (or workspace) (Thanks chris)
Before this commit, leaf containers (such as terminal emulators) would
get children appended, which is not intended.

fixes #1223
2014-04-18 20:30:27 +02:00
Tony Crisci 0c3735fc23 Free owindow when no con_id match or window
This memory leak is related to matching on con_id or matching when the
container has a null window. In that case, windows that do not match
would leak the owindow struct.
2014-03-21 19:26:13 +01:00
Tony Crisci 587273505c Free match after criteria initialization
This memory leak is associated with matching by a criteria that uses a
regular expression. Without freeing a regex before calling match_init,
it will definitely be lost.
2014-03-21 19:23:05 +01:00
Michael Stapelberg c23db20cb5 Merge branch 'master' into next 2014-03-15 18:05:45 +01:00
Tony Crisci a6a6c9b6d9 Bugfix: don't try to resize docks by command
cmd_resize does not implement a method to resize dock clients.

A command like `[instance=".*"] resize grow width 160 px or 16 ppt`
when a dock client matched would crash i3.

fixes #1201
2014-03-15 18:05:42 +01:00
Michael Stapelberg 58b3c730e2 return parse errors via IPC for append_layout 2014-01-04 21:39:13 +01:00
Michael Stapelberg 076636a835 display swallows criteria in placeholder windows 2013-12-22 21:52:49 +01:00
Michael Stapelberg 3a4ad9b330 layout restore: create and render placeholder windows
This is not entirely done yet, but TODO entries are placed in the code
where appropriate.
2013-12-22 21:52:49 +01:00
jj b6100dd727 Fix output retrieval for floating cons
When focusing/moving to outputs, the method of getting the correct
output for a given container fails if the container in question is
floating and only partially mapped on an output screen. This patch
introduces a fail-safe retrieval of the output for any container.
2013-10-23 23:26:06 +02:00
jj dbec5eb905 Fix keyboard and mouse resize in nested containers
fixes #1084
fixes #1085
2013-09-26 19:30:07 +02:00
Vivien Didelot 5baada6532 reduce some yajl boilerplate
This patch introduces a yerror() macro in src/commands.c and also
removes some unused yajl helper macros from src/config_directives.c.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
2013-09-26 19:09:39 +02:00
Leo Gaspard c9611b320b Remove debug message when debugging is disabled
More precisely, switch from printf to DLOG a "matching: * / *" message, like all
the other "matching: * / *" messages.
2013-08-20 19:06:03 +02:00
Bas Pape a5ee699d36 Initialize variables to prevent (false) warnings. 2013-08-20 19:05:48 +02:00
Franck Michea 69d7adcf49 Add missing return after error reporting. 2013-08-08 22:44:23 +02:00
koebi 88671986f4 implement unmark command 2013-07-17 23:02:31 +02:00
Alexander Berntsen 023594909e Implement debuglog command
Add debuglog command that takes toggle|on|off. Add get_debug_logging()
to be able to toggle. Make t/187-commands-parser.t expect 'debuglog'.
Document the debuglog command in userguide.
2013-07-07 15:33:42 +02:00
Alexander Berntsen f9d93d75b3 Implement shmlog command
Add shmlog command that takes <size>|toggle|on|off. Separate logbuffer
management into open_logbuffer() and close_logbuffer(). Make
t/187-commands-parser.t expect 'shmlog'. Add update_shmlog_atom() to
update the SHMLOG_PATH. Document the shmlog command in userguide.
2013-06-23 21:48:02 +02:00
haptix@web.de e3913093b6 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 23:00:36 +02:00
Diego Ongaro 96575e14a0 Give layout enum a name: layout_t 2013-05-22 19:35:07 +02:00
oblique a93e1e5c59 Ensure that resize will take place even if pixel is smaller than size increments.
fixes #1011
2013-04-15 20:59:51 +02:00
Sebastian Ullrich 49979c9d15 Always auto center on 'scratchpad show' if window hasn't been repositioned by the user
This change ensures a scratchpad window is still centered on the screen
if it has first been shown on another screen of a different
resolution. Moving or resizing the scratchpad manually disables this
behavior.
2013-02-18 10:38:28 +01:00
oblique e92dd1acc6 Obey WM_SIZE_HINTS's resize increments in floating 2013-02-14 19:38:26 +01:00
Francesco Mazzoli f13d8ed06f wrap when moving things to outputs with direction 2013-01-26 19:27:58 +01:00
Michael Stapelberg 74558bb33d Call scratchpad_show() when focusing scratchpad windows via criteria
fixes #931
2013-01-25 16:11:20 +01:00
Michael Stapelberg b3d7531947 refactor both i3-nagbar starts into src/util.c
With this change, libev >= 4 is a hard dependency. It should be present
in all major linux distributions (even the latest ubuntu LTS).
2012-12-24 16:53:20 +01:00
Michael Stapelberg 1ae08b196a Bugfix: Don’t move floating windows when their size constraints forbid resizing (Thanks aksr)
fixes #883
2012-11-27 09:26:31 +01:00
Michael Stapelberg 19cbd3cbec code style fixes for the previous commit
• our function names use underscores
• rewrote the function’s comment
• function comments must be in the source _and_ in the header
• no blank lines after function signatures
2012-11-25 20:55:49 +01:00
Adrien \"schischi\" Schildknecht f41fa1baa1 The command to resize a floating window now checks the minimum and maximum size. 2012-11-25 20:52:56 +01:00
Michael Walle ae14fe9141 introduce new command to rename focused workspace
The corresponding command is 'rename workspace to <name>'. As a side-effect
this fixes the command 'rename workspace 1 to to'.

Signed-off-by: Michael Walle <michael@walle.cc>
2012-10-31 09:09:56 +01:00
Michael Stapelberg 29b19a7468 spelling error: s/implementaiton/implementation/g 2012-10-24 07:58:03 +02:00
Deiz ca77c12dde Allow workspace contents to be moved if there are only floating children 2012-10-09 21:25:13 +02:00
Deiz e07803999f Fix fullscreen focus bug and corresponding test flaw
As the workspace might be reached via recursion (e.g. moving from the edge
of a fullscreen split container), it's necessary to check for a fullscreen
container whenever a workspace is reached.
2012-10-09 21:24:04 +02:00
Michael Stapelberg 2738f13798 move owindow definition into the command parser 2012-10-08 13:26:24 +02:00
Deiz e89a25f81f Implement moving workspaces as if they're regular containers 2012-09-29 00:17:36 +02:00
Michael Stapelberg 43d486441d Bugfix: with one ws per output, don’t crash on cross-output moves (Thanks moju)
fixes #827
2012-09-28 23:04:37 +02:00
Michael Stapelberg 66b389cba1 Make the resize command honor criteria (Thanks Tblue)
fixes #816
2012-09-28 20:36:25 +02:00
Michael Stapelberg 5d8e3f58f6 Fix 'border toggle' (it "skipped" 1px border) (Thanks joepd)
fixes #818
2012-09-28 19:29:14 +02:00
Yaroslav Molochko 04c58c7325 Implement variable border widths for pixel/normal
fixes #325
2012-09-24 22:20:29 +02:00
Michael Stapelberg 1e143feab1 Close empty workspaces after cross-output move (+test) (Thanks chrysn)
fixes #795
2012-09-22 19:03:19 +02:00
Michael Stapelberg 19883108a9 Make get_output_next() work with non-aligned RandR setups (+test) (Thanks Feh, swh, Moritz)
A good visualization of the new algorithm is this:

           +--------+
           |        |
+--------+=|   S1   |========================
|        | |        |
|   S0   | +--------+
|        |         +--------+
+--------+=========|        |================
                   |   S2   | +--------+
                   |        | |        |
                   +--------+ |   S3   |
                              |        |
                              +--------+

When focus is on S0, 'focus output right' will first match S1 (the
closest output which overlaps in the highlighted area), then S2, but not
S3 (since S3 does not overlap into the highlighted area).

fixes #669
fixes #771
2012-09-22 16:54:59 +02:00
Sebastian Ullrich 236f9f45e3 Make "[move] workspace number" accept a default ws name after the ws number 2012-09-22 14:34:05 +02:00
chrysn e15e37f922 fixes #776
this implements both the "move container to workspace back_and_forth" command
and movements to the same workspace when auto_back_and_forth is set.

it includes documentation and test suite additions by michael.

it also simplifies the workspace_show_by_name function (making use of
workspace_get accepting NULL pointers).
2012-09-22 13:35:31 +02:00
Michael Stapelberg 4976fa3350 con_set_layout: always use the parent container, handle workspaces properly
Previously, in case 'layout stacked' (for example) had been called
interactively, con_set_layout would be called with focused->parent,
while with for_window, it’d be called on the actual matching container.

This difference in behavior was the cause for the inability to use
'for_window [class="XTerm"] layout tabbed', which now works \o/, but
more on that below.

The change also allows us to handle the case of the user selecting a
CT_WORKSPACE container properly, that is, by using the special case and
creating a new split container on the workspace which gets all the
contents, but a new layout.

Now, before you are enthusiastic about the change and try to use
for_window magic in your config file, keep in mind: The 'layout' command
acts on the parent split container. That is, when using a line such as
this one:

    for_window [class="XTerm"] layout tabbed

…and opening an XTerm when on a workspace with one single other window,
the whole workspace will be set tabbed (just as previously when you
opened an XTerm and sent 'layout tabbed' manually).

Therefore, to open XTerm in its own tabbed split container, you need to
split before:

    for_window [class="XTerm"] split v, layout tabbed

The comma here is important! It says that the second command should not
be treated as an entirely unrelated command, but it should also relate
the matching window (while it does work with a ';', that is prone to
race-conditions and should be avoided).

fixes #358
2012-09-05 00:22:38 +02:00
Sebastian Ullrich d29b62f24f Remove dead code in cmd_workspace_number
If a ws doesn't exist, maybe_back_and_forth
will never return true for it.
2012-08-22 17:58:08 +02:00
Sebastian Ullrich eadf1e306f Fix 'back and forth' in 'workspace number' for named ws 2012-08-22 17:57:32 +02:00
Sebastian Ullrich bb853660cf Create ws in "move workspace number n" if not existing
fixes #729
2012-08-22 17:08:02 +02:00
Michael Stapelberg 4622cde7b7 Merge branch 'master' into next 2012-08-22 16:02:02 +02:00
Joel Stemmer 1089b0b201 fix resizing floating windows by height
When resizing floating windows, changing the height was not correctly
handled. This commit fixes that and adds testcases for shrinking and
growing the width and height of floating windows.
2012-08-22 16:01:40 +02:00
Michael Stapelberg a7569e6a98 implement error messages when moving to another ws fails (Thanks eeemsi)
fixes #769
2012-08-13 01:57:39 +02:00
Michael Stapelberg 884627ef20 use I3__FILE__ for DLOG, leave __FILE__ as is
See also commit 0e752070ac, which broke
source code listings in gdb unless you cd into i3/src. This should give
us best of both :-).
2012-08-12 12:19:47 +02:00
Michael Stapelberg 0e752070ac explicitly set filenames to $(basename __FILE__)
This makes the debug log a bit more readable, especially since commit
48f1e383ca
2012-08-07 09:55:52 +02:00
Michael Stapelberg 1b2d222449 Properly report errors in 'focus parent' (Thanks eeemsi)
Also, make X11 errors debug log level only. They are harmless usually.

fixes #762
2012-08-05 20:57:20 +02:00
Michael Stapelberg 8a1c8115ca fix a few warnings/places where the clang static analyzer complains 2012-08-05 16:34:38 +02:00
Michael Stapelberg fb4ee17b05 Merge branch 'master' into next 2012-08-04 16:10:37 +02:00
Michael Stapelberg e36674c5b8 Fix a crash when the current output cannot be determined (Thanks Tucos)
This is only a cosmetical change though, the fix for the root cause can
be found in the commits following this one.
2012-08-04 15:19:11 +02:00
Michael Stapelberg de94f6da1a Introduce splith/splitv layouts, remove orientation
With this commit, the "default" layout is replaced by the splith and
splitv layouts. splith is equivalent to default with orientation
horizontal and splitv is equivalent to default with orientation
vertical.

The "split h" and "split v" commands continue to work as before, they
split the current container and you will end up in a split container
with layout splith (after "split h") or splitv (after "split v").

To change a splith container into a splitv container, use either "layout
splitv" or "layout toggle split". The latter command is used in the
default config as mod+l (previously "layout default"). In case you have
"layout default" in your config file, it is recommended to just replace
it by "layout toggle split", which will work as "layout default" did
before when pressing it once, but toggle between horizontal/vertical
when pressing it repeatedly.

The rationale behind this commit is that it’s cleaner to have all
parameters that influence how windows are rendered in the layout itself
rather than having a special parameter in combination with only one
layout. This enables us to change existing split containers in all cases
without breaking existing features (see ticket #464). Also, users should
feel more confident about whether they are actually splitting or just
changing an existing split container now.

As a nice side-effect, this commit brings back the "layout toggle"
feature we once had in i3 version 3 (see the userguide).

AFAIK, it is safe to use in-place restart to upgrade into versions
after this commit (switching to an older version will break your layout,
though).

Fixes #464
2012-08-04 03:13:24 +02:00
Michael Stapelberg cc7f16007a Display i3-nagbar when commands lead to an error
e.g. pressing Mod1+x when having the following in your configfile:

    bindsym Mod1+x some invalid command

will lead to an i3-nagbar instance popping up, offering you to view the
error log (which will contain parser errors from this commit on).
2012-08-02 17:45:09 +02:00
Michael Stapelberg ac7278eb1a resizing: traverse containers up properly (+test) (Thanks oblique)
In certain situations (when you have a h-split within a h-split) you
couldn’t properly resize previously. This commit makes the resize
command properly traverse up the containers.

fixes #754
2012-07-22 21:37:26 +02:00
Michael Stapelberg a97e70d483 Merge branch 'master' into next 2012-07-22 21:26:00 +02:00
Michael Stapelberg 83dc5d5cb6 Bugfix: Fix duplicate return value for 'resize' command 2012-07-22 21:25:38 +02:00
Michael Stapelberg c5d0472158 Explicitly disconnect in the 'exit' command
This fixes a race condition when running the tests. I think that the X11
server has more time to clean up the resources when we do an explicit
disconnect. The symptom I was seeing was that sometimes, i3 couldn’t
become the window manager on one of the Xdummy instances.
2012-06-29 23:13:25 +02:00
Pavel Löbl 2afecaf355 Add a new command 'move to workspace current'
Added a new command 'move to workspace current' which can be used
with criteria to move a window to the current workspace.
2012-06-03 19:42:56 +02:00
Pavel Löbl 51173baf28 Fix 'move to workspace' when used with criteria
When moving window from other (not current) workspace to another
workspace with criteria we should stay on current workspace.

And we should exit early when criteria was specified but didn't
match any window.
2012-06-03 19:41:45 +02:00
Pavel Löbl 4611f875ff Fix a mistake in comment 2012-06-03 19:38:43 +02:00
Fernando Tarlá Cardoso Lemos 250c260eaa Allow focus child/parent when in fullscreen.
This is now restricted according to the already defined fullscreen
focus constraints. Test case 157 was removed, as we don't prevent
level up/down in fullscreen anymore. Those commands are properly
tested in fullscreen by test case 156.

Fixes: #612
2012-06-03 16:24:53 +02:00
Fernando Tarlá Cardoso Lemos da1e232757 Refined the fullscreen focus constraints.
Basically, a focus change can't escape a fullscreen container. The
only exception is per-output fullscreen containers, as you should
be able to focus a container in a different workspace in this case.

This is an improvement on 4eab046e, now considering the difference
between global and per-output fullscreen and taking the tree
structure into account to determine what escaping the fullscreen
container means. It only affects targeted focus commands in the
form "for_window [...] focus", but it lays the foundation for
forthcoming fixes to all other focus commands.
2012-06-03 16:24:53 +02:00
Fernando Tarlá Cardoso Lemos 4eab046e8f Allow focus w/ target when in fs in some cases.
If the target is in a different workspace, there's no reason why
we wouldn't allow the user to focus it. We already allow this when
focusing a workspace, for example.
2012-05-09 21:08:19 +02:00
Ondrej Grover edae08a4d9 maybe_back_and_forth now sets render_tree 2012-05-09 20:38:41 +02:00
Michael Stapelberg 42dcb4e8c4 make maybe_back_and_forth static 2012-05-09 20:34:40 +02:00
Ondrej Grover b88ab981fd bugfix: less differentiation between named and numbered workspaces
calling workspace by number now also checks for switching back and forth
and creates a new workspace if no workspace starting with that number is
found

also removed the obsolete tree_render() in favor of setting
cmd_output->needs_tree_render to true
2012-05-09 20:33:59 +02:00
Michael Stapelberg bbe607899c Send proper error messages upon parser failures, use yajl for generating command replies
Fixes: #693
2012-05-02 22:01:50 +02:00
Michael Stapelberg 5a29eb20e0 Fix spelling of success
Fixes: #695
2012-05-02 20:20:45 +02:00
Michael Stapelberg eec41d1276 Fix warning: properly initialize 'workspace' variable 2012-04-08 20:45:49 +02:00
Michael Stapelberg 373b4ad74a Implement 'rename workspace <old_name> to <new_name>' 2012-04-08 20:40:00 +02:00
Michael Stapelberg ad513b4799 Implement 'move [container|window] to workspace number <number>' 2012-04-08 20:33:46 +02:00