Commit Graph

187 Commits (f397698d43e3dd4f4625e1fed1b1d0470d0acdf6)

Author SHA1 Message Date
Tony Crisci b47f480728 Implement EWMH number of desktops property
_NET_NUMBER_OF_DESKTOPS:

> This property SHOULD be set and updated by the Window Manager to
> indicate the number of virtual desktops.

We interpret this property as the number of noninternal workspaces.
2014-06-19 11:21:03 +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
Tony Crisci f41e81bd96 Feature: Workspace assignment by number
Workspace assignments with bare numbers assign all workspaces with that
number to the specified output.

Workspace assignment by number is overridden by workspace assignment by
name.
2014-05-20 20:15:55 +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 7639337716 Bugfix: `move <direction>` sends workspace focus
Make sure the command `move <direction>` properly sends the workspace
focus ipc event required for i3bar to be properly updated and redrawn.

Make `ipc_send_workspace_focus_event publicly available from ipc.h for
more flexible event sending.
2014-01-13 23:36:31 +01:00
Sebastian Ullrich 431e98dc35 Respect workspace numbers when looking for a free workspace name
This prevents a ws '1' appearing on a new output when there's
already a ws '1: www' on an existing output
2013-08-18 17:47:53 +02:00
Michael Stapelberg c4d4418745 Merge branch 'master' into next 2013-06-29 20:58:51 +02:00
Eika Enge 625d5bdba6 Bugfix: Ignore spaces in front of default workspace name 2013-06-29 20:58:15 +02:00
haptix@web.de 2926ddb69f ipc: use correct workspace in workspace change event
fixes #990
2013-04-02 22:27:04 +02:00
Michael Stapelberg 61a5b9ddd4 Revert "don't use con_is_internal"
This reverts commit c6948c59f5.

Given that master and next now both contain con_is_internal, we can use
it again.
2012-12-14 21:44:20 +01:00
Michael Stapelberg 2bf7793d4d Merge branch 'next' 2012-12-12 00:18:23 +01:00
Michael Stapelberg 305b6ddf2f set LC_NUMERIC=C when dumping nodes in the workspace event
Otherwise the resulting JSON might be invalid because it uses the
locale-specific comma separator, e.g. "16,666" instead of "16.666".
2012-11-13 09:49:08 +01:00
Francesco Mazzoli 1055973f66 refactor, name changes
We need to send the workspace event earlier, because otherwise 'old'
might already be destroyed (if it was empty).
2012-11-13 09:40:06 +01:00
Francesco Mazzoli 464d387044 take care of non-existant old workspaces 2012-11-13 09:33:03 +01:00
Francesco Mazzoli 74d596e0fc more informative `workspace' events
Add a `current' and `old' properties to the `focus' change type,
containing the current and old workspace respectively.  These additions
are not necessary anywhere else because `focus' is always triggered when
changing ws.
2012-11-13 09:33:00 +01:00
Simon Elsbrock c6948c59f5 bugfix: don't use con_is_internal
fixes #872
2012-11-12 19:49:01 +01:00
Michael Stapelberg dece12bf18 Merge branch 'master' into next 2012-11-10 09:01:24 +01:00
Michael Stapelberg 81393c93c2 bugfix: fix workspace back_and_forth after displaying a scratchpad window
fixes #868
2012-11-10 09:01:04 +01:00
Deiz fdcba7b91a Replace the discrete 'split' Con property with a simple function. 2012-10-04 17:48:08 +02:00
Michael Stapelberg 13147978c5 Merge branch 'master' into next 2012-10-03 15:08:31 +02:00
Sascha Kruse 507898484f set workspace_layout in create_workspace_on_output
fixes #835
2012-10-03 15:08:21 +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 c31b3b296a Bugfix: Correctly clear the urgency hint when the window is underneath a split-con (+test)
Previously, when you had an urgent container in a stack on some
invisible workspace (say urxvt) and you switched to it, the urgency hint
was not properly cleared.
2012-09-25 15:40:08 +02:00
Deiz a080794e59 Replace duplicate "__" workspace prefix checks with a single function. 2012-09-23 15:47:35 +02:00
Simon Elsbrock 28104a480c implement delayed urgency hint reset
If there is a client with an urgency hint on another workspace and
switching to this workspace would cause the urgency to be reset (by
moving the focusing to the client), delay the reset by some time. This
gives the user the chance to see it.

This commit adds the possibility to configure the urgency delay timer
duration using the 'force_display_urgency_hint' directive. Also,
documentation and a testcase was added to allow for automated checks of
the intended behavior.

fixes #482
2012-09-22 14:12:09 +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 cd4dd365e8 Allow changing the layout of workspaces by storing it (Thanks mhcerri)
Before commit 4976fa3350, setting the
layout of workspaces to something else than the default would just mess
up the parent container of the workspace (the content container).

After that commit, it would create an unnecessary split container when
you change the layout _before_ opening any containers. To avoid this, we
now store the layout (similar to how the 'workspace_layout'
configuration directive works) and apply it when the first container is
attached to the workspace.

Fixes #796
2012-09-16 22:53:41 +02:00
Michael Stapelberg d644dbff64 bugfix: forgot to mark split containers as split = true (+test) (Thanks szalik)
When the workspace layout (formerly orientation) was forced to change
due to a move command, the split container we created was not marked as
split = true, which caused tree_flatten() to errnously kill the contents
of it and thus one window ended up unmanaged.

Also, the logic in tree_flatten() was inverted due to commit de94f6da.

fixes #790
2012-09-05 22:26:52 +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 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 ecd238b65e ignore "current" when searching for named workspaces 2012-06-03 19:44:42 +02:00
Michael Stapelberg ec4e6d1cdf Fix stray workspaces "number 1" being created when having workspace number 1 in your config 2012-05-16 06:24:16 +02:00
Michael Stapelberg a9b57a44a9 Remove set but never read variable
This was due to the changes in commit d25e77ce75
2012-05-09 19:56:21 +02:00
Michael Stapelberg 1bb165a29a tests: warp the pointer to in multi-monitor tests to avoid flaky tests 2012-04-09 14:48:57 +02:00
Michael Stapelberg 373b4ad74a Implement 'rename workspace <old_name> to <new_name>' 2012-04-08 20:40:00 +02:00
Michael Stapelberg 206b96202c Use (void) instead of () for functions without args (Thanks fernandotcl)
See also:
http://article.gmane.org/gmane.linux.kernel/1268792

The C compiler will handle (void) as "no arguments" and () as "variadic
function" (equivalent to (...)) which might lead to subtle errors, such
as the one which was fixed with commit 0ea64ae4.
2012-03-31 10:53:04 +02:00
Fernando Tarlá Cardoso Lemos a22f161ab5 If moving the last ws, create a new one in its place.
This seems better than refusing to move the last workspace.
2012-02-15 17:59:33 +00:00
Max Alexander Busse fba2582b2e Switch and Move to next workspace on the same Output. As requested in \#554 2012-01-08 16:24:21 +00:00
Michael Stapelberg 08986a1798 Implement scratchpad functionality (see userguide) 2011-12-21 23:15:32 +00:00
Michael Stapelberg d25e77ce75 Don’t set the _NET_WM_WORKAREA hint at all (Thanks cg)
Fixes: #539
2011-11-30 20:33:07 +00:00
Michael Stapelberg 62f0a9e21d s/1/true 2011-11-10 18:38:29 +00:00
Michael Stapelberg 9d15a00ba8 introduce sasprintf() in libi3, use it everywhere 2011-10-23 13:16:56 +01:00
Michael Stapelberg 42d355f2b7 normalize modelines/headers across src/*.c 2011-10-22 23:40:02 +01:00
Michael Stapelberg a506e59b3c Bugfix: Fix segfault when starting i3 (Thanks pnutzh4x0r) 2011-10-18 18:47:07 +01:00
Michael Stapelberg 178be03fa6 Implement 'workspace back_and_forth' (Patch by Michael Walle) 2011-10-17 23:17:56 +01:00
Michael Stapelberg b2ad9a77c8 rename the internal function to _workspace_show, add a comment to workspace_show_by_name 2011-10-02 22:03:16 +01:00
Noe Rubinstein 92cc4494aa refactor workspace_show and friends 2011-10-02 21:57:00 +01:00
Michael Stapelberg 1717b88174 Merge branch 'master' into next 2011-09-22 20:11:44 +01:00
Michael Stapelberg 4dbda73114 Bugfix: Correctly revert focus to other floating windows when closing a floating window
Uncovered by the testsuite \o/
2011-09-22 20:10:51 +01:00
Michael Stapelberg 8928b5f55d Bugfix: Correctly handle workspace names which do not start with a zero 2011-09-05 22:21:10 +02:00
Michael Stapelberg dfda878272 Bugfix: Correctly assign a number to workspaces starting with '0: ' (Thanks SardemFF7) 2011-08-28 18:17:02 +02:00
Michael Stapelberg 7a22bd1cf3 Merge branch 'master' into next 2011-08-17 12:14:17 +02:00
Peter Bui 36224f86d1 Only warp pointer once during x_push_changes()
- Introduce warp_to static variable in x.c that stores the coordinates
  to warp to as a Rect.

- Add x_set_warp_to function to set this variable.  Use in _tree_next,
  workspace_show, and con_move_to_workspace.

- In x_push_chanages, if warp_to is set, then call xcb_warp_pointer_rect
  and then reset it to NULL.

This fixes all know bugs for pointer warping for me.
2011-08-17 12:12:40 +02:00
Michael Stapelberg d3efa73dd7 Merge branch 'master' into next 2011-08-11 22:22:44 +02:00
Valentin Voigt bf0c67b2af Warp cursor when changing workspace. 2011-08-11 22:13:50 +02:00
Simon Kampe 837bb50826 Parsing workspace name so if the first part is a number, the workspace will get this number. If no number is found it will default to -1. 2011-08-04 00:30:07 +02:00
Peter Bui 1750192f63 Modify workspace next/prev to account for workspaces on all outputs.
Generally, the traversal goes: numbered workspaces in order, and then
named workspaces in the order in which they appear in the tree.

Example:
    Output 1:       Output 2:
	1 3 D C         2 4 B A

Traversal: 1, 2, 3, 4, D, C, B, A, 1, ...

Note, after the numbered workspaces, we traverse the named workspaces
from output 1, and then output 2, etc.
2011-08-04 00:12:09 +02:00
Michael Stapelberg c883e7050a Include <limits.h> in all.h 2011-08-04 00:10:04 +02:00
Michael Stapelberg fb9d77305e Implement 'fullscreen global' 2011-06-10 18:27:20 +02:00
Michael Stapelberg 60ae26c19d Implement 'workspace next/prev' (+test) 2011-06-10 16:03:59 +02:00
Michael Stapelberg 1585d942ea Make workspace_layout handle all cons at workspace level, not only the first one (+test)
This makes opening new windows on workspace level and moving windows to the
right/left more like in the old i3.
2011-06-02 17:21:38 +02:00
Michael Stapelberg d3e458bc78 Remove old code from randr.c and workspace.c 2011-05-14 22:38:19 +02:00
Michael Stapelberg 3f45d3c447 re-implement assignments of workspace to specific outputs 2011-05-14 22:19:58 +02:00
Michael Stapelberg 167bdd26b7 Argument for 'kill' for killing a specific window (now default) or the whole client (+test)
Use 'kill window' to kill a specific window (for example only one specific
popup), use 'kill client' to kill the whole application (or X11 connection to
be specific).
2011-05-13 20:41:03 +02:00
Michael Stapelberg 67b37551d8 Bugfix: Fix switching workspaces on multi-monitor setups (Thanks mseed)
Fixes #356
2011-03-20 18:27:14 +01:00
Michael Stapelberg e9a9a46795 Bugfix: Don’t use the workspace where focus is for deleting workspaces when switching (Thanks mseed)
Fixes: #353
2011-03-19 23:19:42 +01:00
Simon Kampe 2f992f5c0e Added config key for default orientation of containers (new_container_orientation) and added support in randr.c for automatically changing the orientation when user does a xrandr rotate. 2011-03-17 17:43:35 +01:00
Fernando Tarlá Cardoso Lemos c0563af3e2 Bring back some more EWMH support. 2011-03-14 17:11:33 +01:00
Fernando Tarlá Cardoso Lemos b4e3dfd76b Add the "created" parameter to workspace_get.
If created is not NULL, *created is set to whether or not the
workspace has been just created.
2011-03-14 17:07:53 +01:00
Fernando Tarlá Cardoso Lemos 269d360f30 Some assertions to make the static analyzer happy.
Assertions give hints to the static analyzer about code paths
where we make assumptions. Used the Clang Static Analyzer.
2011-02-28 16:49:03 +01:00
Michael Stapelberg 9719b21243 refactor some places to use output_get_content() 2011-02-21 01:55:36 +01:00
Michael Stapelberg 7f89c71689 Implement dock mode, update testsuite
Currently, dock clients are only possible at the top.
2011-02-20 23:43:03 +01:00
Michael Stapelberg 834f4d7bc2 add missing function documentation 2011-02-14 23:17:30 +01:00
Michael Stapelberg 26a416e016 refactor tree_move() into src/move.c, change config (!), change testcase
Due to lots of cases which were added and added to tree_move(), the function
was not really easy to understand. For this refactoring, I wrote tree_move()
from scratch, thinking about (hopefully) all cases. The testsuite still passes.

The move command also has different parameters now. Instead of the hard to
understand 'before v' stuff, we use 'move [left|right|up|down]'.
2011-02-14 23:05:20 +01:00
Michael Stapelberg 3383437705 refactor some places to use con_descend_focused instead of duplicating code 2011-01-27 16:09:14 +01:00
Michael Stapelberg a6f0dcd250 Fix switching to a workspace on a different output 2011-01-08 12:03:03 +01:00
Michael Stapelberg 0ea15ed962 fix a problem with workspace switching when the focus got to the target workspace
This could explain some strange effects where workspaces would just stay blank.
We’ll see.
2011-01-08 00:38:10 +01:00
Michael Stapelberg 2312187439 RandR: use the next unused workspace instead of fixed counting 2011-01-05 00:26:23 +01:00
Michael Stapelberg 80ecd157f6 fix memleak: free con->name before overwriting it 2011-01-04 22:38:33 +01:00
Michael Stapelberg 1a40641462 workspace.{c,h}: remove obsolete code 2010-11-29 22:32:19 +01:00
Michael Stapelberg 3bab222aa7 Bugfix: Re-attach windows in correct order when switching layout (Thanks fernandotcl) 2010-11-28 01:51:16 +01:00
Michael Stapelberg 1de97a1f1f correctly sort numbered workspaces (+testcase)
Numbered workspaces (workspaces with a name containing only digits) will be
inserted in the correct order now. Named workspaces are always sorted after
numbered workspaces and in the order of creation.
2010-11-21 23:35:49 +01:00
Fernando Tarlá Cardoso Lemos ae22fe065f Send change:empty too. 2010-11-21 21:36:33 +01:00
Fernando Tarlá Cardoso Lemos 767dcea7ba Send the workspace focus change event. 2010-11-21 21:36:28 +01:00
Michael Stapelberg 39fa1d724a bugfix: don’t treat workspace as empty if they only have floating windows (+testcase) 2010-11-20 20:16:15 +01:00
Michael Stapelberg d760a1c7b2 Bugfix: don’t kill parent when currently in tree_close() for a child of this parent 2010-11-14 20:14:09 +01:00
Michael Stapelberg 945632ddcb Implement setting the WM_NAME of i3 container windows for debugging 2010-11-14 16:41:46 +01:00
Michael Stapelberg c6c084faa5 don’t close workspaces which are still visible (multi-monitor) 2010-11-12 17:34:13 +01:00
Michael Stapelberg 0925e8b7dc Implement sticky windows
The implementation works like this:
Containers can have a 'sticky-group' attribute. Imagine two different
containers (on two different workspaces) which have the same sticky-group.
Now you open a window in the first container. When you switch to the
other workspace, the window will be re-assigned to the other container.

An obvious problem which is not covered with the code at the moment is
having two containers with the same sticky-group visible at the same time.
2010-09-01 18:11:01 +02:00
Michael Stapelberg 32be3af109 Re-implement support for the urgency hint, extend t/13-urgent.t
The actual rendering will follow
2010-06-02 17:55:10 +02:00
Michael Stapelberg b467242d69 Make splitting a container which was already split a noop 2010-06-01 22:45:18 +02:00
Michael Stapelberg e67c712f31 cleanup: introduce CT_WORKSPACE as type to avoid having to check parent->type 2010-05-31 00:11:11 +02:00
Michael Stapelberg 2d52ecf071 Add parameter to reparent windows instead of killing them when closing a container
Necessary because when windows are unmapped, they are not necessary to
be killed (an application can unmap it temporarily).
2010-05-15 00:16:59 +02:00
Michael Stapelberg 65e9036837 bugfix: don’t clean up workspace when switching to the same workspace 2010-05-09 23:20:49 +02:00
Michael Stapelberg 138a790cd0 clean up old workspace when switching (makes test 2 of t/16-*.t pass) 2010-04-16 20:59:21 +02:00
Michael Stapelberg 4206db2839 workspace.c: update header, reformat 2010-04-13 16:43:08 +02:00