Commit Graph

2044 Commits

Author SHA1 Message Date
Michael Stapelberg f6ee035c61 fix killing placeholder windows
The only consequence of the previous situation was that there was a
misleading log message.
2014-01-04 22:24:47 +01:00
Michael Stapelberg 18e6184f1c run con_fix_percent unconditionally, not only on parsing errors 2014-01-04 21:59:41 +01:00
Michael Stapelberg 58b3c730e2 return parse errors via IPC for append_layout 2014-01-04 21:39:13 +01:00
Michael Stapelberg 1d969e6340 fix percentages when loading layouts
This is more forgiving for users who delete containers from their layout
file and don’t update the “percent” values.
2014-01-04 21:30:51 +01:00
Michael Stapelberg dfd9410ab7 Bugfix: set all parsing_* variables to false when starting parsing 2014-01-04 21:23:12 +01:00
Michael Stapelberg 4a9e283f05 Bugfix: fix crash when layout JSON file is partially invalid (Thanks xeen)
Fixes #1145
2014-01-04 21:22:12 +01:00
Tony Crisci b109b1b20d Disable render-time pointer warps if asked
When `focus_follows_mouse` configuration option is disabled, do not warp
the pointer when focus changes outputs after rendering.

Rationale: this option is meant to be disabled by users who have a setup
where the mouse is usually in the way. These users tend to move the
mouse to a corner or use a utility to hide the pointer when it is not
active. When this user switches focus between outputs, the mouse is
placed in the center of the screen.

This is clearly against the spirit of disabling `focus_follows_mouse`.
Disabling this option now implies disabling "mouse follows focus".
2014-01-04 20:52:12 +01:00
Alexander Kedrik 705b43294a use designated initializers for yajl_callbacks struct 2014-01-04 20:46:46 +01:00
Peter Boström f78c1ba053 Fix 'gcc -Wextra -Wno-unused-parameter'. 2014-01-04 20:43:30 +01:00
Michael Stapelberg 2314f10778 Merge branch 'master' into next 2014-01-04 12:23:06 +01:00
Michael Stapelberg 5e07885d95 install i3-with-shmlog.xsession.desktop, overwrite symlink if it exists 2014-01-04 12:22:53 +01:00
Michael Stapelberg a32b6da712 Merge branch 'master' into next 2014-01-04 12:20:12 +01:00
Michael Stapelberg 2326ebfd63 enable shmlog when invoked as i3-with-shmlog, install symlink + .desktop file 2014-01-04 12:18:45 +01:00
Peter Boström 9c15b9504e Fix clang -Wextra except -Wunused-parameter.
Cleared all warnings that occur when passing
CFLAGS="-Wall -Wextra -Wno-unused-parameter" to make using clang 3.3 on
Linux x86-64.
2014-01-02 22:15:33 +01:00
Peter Boström 38b6936c25 Size resizebar according to container size. 2014-01-01 15:21:33 +01:00
Tony Crisci 69ce33d06d Snap pointer to resize bar on drag resize
When the user initiates a drag resize, draw the resize bar on the border
of the two involved containers and snap the pointer.

This solution produces cleaner code than the former approach where the
caller obfuscated the click coordinates of the event. This may confuse
someone expecting a true button press event.

Fixes an issue where the resize cursor is not shown when the resize bar
is clicked until the user begins to drag the mouse.

Fixes an issue where focus is not properly updated after the drag is
complete when `focus_follows_mouse' option is set, leaving the pointer
in an unfocused window in some cases.

Fixes an issue where the resize bar may jump a few pixels when the mouse
is first moved.

(Thanks to pbos for suggesting this fix and providing an example
implementation)
2014-01-01 15:18:54 +01:00
Michael Stapelberg c3ff365072 install i3-save-tree(1) (Thanks Marcin) 2013-12-24 16:15:43 +01:00
Michael Stapelberg c964c010f0 ipc: dump window properties when not restarting inplace 2013-12-22 21:52:49 +01:00
Michael Stapelberg e567cf436c dragging: instead of using a custom event loop, use libev
This is done by installing a new check watcher that replaces the main
X11 event handler and calling ev_run with EVRUN_ONCE until the dragging
loop left state DRAGGING.

With this commit, other handlers, most notably the redraw handler for
placeholder windows, get a chance to run when dragging (placeholder!)
windows around.
2013-12-22 21:52:49 +01:00
Michael Stapelberg f57f94c850 reconnect when the restore X11 connection dies
This could happen if a user uses xkill(1) on a placeholder window.
2013-12-22 21:52:49 +01:00
Michael Stapelberg 42e359ec60 kill placeholder windows when the actual window appears 2013-12-22 21:52:49 +01:00
Michael Stapelberg 28a993e656 replace never-true condition with a working one
state->initial is set to false before calling x_push_node() since we
began pushing the window stack before pushing changes. Therefore, the
condition could never be true.
2013-12-22 21:52:49 +01:00
Michael Stapelberg 35b70ca423 introduce client.placeholder color 2013-12-22 21:52:49 +01:00
Michael Stapelberg 639a1b182c set original window title on placeholder windows 2013-12-22 21:52:49 +01:00
Michael Stapelberg 16ea766765 use root window color depth instead of hard-coded 24 2013-12-22 21:52:49 +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
Michael Stapelberg 2ce43783f8 add debug message to trace match deletions 2013-12-22 21:52:49 +01:00
Michael Stapelberg fcf869439c load_layout.c: use *LOG instead of (f)printf 2013-12-22 21:52:49 +01:00
Michael Stapelberg ef7b3e5464 allow parsing multiple nodes from a json layout 2013-12-22 21:52:49 +01:00
Michael Stapelberg 6800524f2e GET_TREE: serialize container type into a string
So far, this was blessed for internal use only (by virtue of not being
in the documentation), but we want to expose it for the stored layouts.
2013-12-22 21:52:49 +01:00
Michael Stapelberg 58297f4ab5 layout restore: support more criteria, match only once (+test) 2013-12-22 21:52:49 +01:00
Michael Stapelberg 598498330a layout loading: allow comments in JSON files 2013-12-22 21:52:49 +01:00
Michael Stapelberg 0302912b64 swallows: value needs to be loaded as regular expression 2013-12-22 21:52:49 +01:00
Michael Stapelberg ce480dcc74 use splith as default when restoring a layout
This frees users from specifying layouts even when they don’t make any
difference, e.g. leaf nodes.
2013-12-22 21:52:49 +01:00
Michael Stapelberg b2c91f54ab Merge branch 'master' into next 2013-12-21 21:32:55 +01:00
Michael Stapelberg 85321bdf1d Bugfix: ignore _NET_ACTIVE_WINDOW for scratchpad windows (Thanks mistnim)
fixes: #1136
2013-12-21 21:32:23 +01:00
Jean-Philippe Ouellet 755188220f fix the build on OS X
OS X doesn't have posix_fallocate() yet, so put
bf760d0241 in
    #if defined(__APPLE__)

the cd fails with:
    /bin/sh: line 0: cd: include: No such file or directory
so give it a path relative to the top directory
2013-11-26 19:56:45 +01:00
Lancelot SIX f22995393a Remove references to PATH_MAX macro
Since the macro PATH_MAX is not defined on every system (GNU/Hurd being
one of those who do not define it), we remove all references to this
macro. Instead, we use a buffer of arbitraty size and grow it when
needed to contain paths.
2013-11-24 13:50:29 +01:00
Michael Stapelberg 4f5e0e794f persist root window’s background contents to a pixmap
The commit title is fairly technical, so I’ll try to explain.

Recently, users of GDM3 (I’m sure) and LightDM (I think) have reported
that when switching to a new workspace, the contents of the previous
workspace are still visible. i3bar updates, though, so it is the X11
root window which is not being updated here.

When using GDM3, X11 will be started with -background none, and no
background pixmap or pixel is set. Then, apparently,
gnome-settings-daemon will display a fade animation from whatever is
currently on the window to the destination contents. I think this is to
avoid flickering when logging in, which would occur when just setting a
specific background pixmap or pixel.

So, this commit will, when i3 starts first (not on restarts), copy the
contents of the X11 root window (typicall a grey background, at least on
my machine with GDM3) into a pixmap and set that pixmap as background
pixmap. That way, the content will be preserved and one has a
background, instead of what is perceived as a bug :).

This commit has some chance of breakage, so I’m prepared to revert it
unless we can figure out the issues and roll forward.
2013-11-24 13:44:30 +01:00
Michael Stapelberg 1dbdd4fece Merge branch 'master' into next 2013-11-22 17:09:28 +01:00
Tony Crisci 57822e3ed4 Remove-child callback skips output content cons
Every container 'above' (in the hierarchy) the workspace content should
not be closed when the last child was removed.

Add a check for output content containers and do not handle them. These
cons are at the root of the output container with dockarea siblings.
They may be run through this callback when an output is killed with
RandR.

Fixes an issue that caused content cons to become urgent when the output
is killed with RandR.

fixes: #1121
2013-11-22 17:09:23 +01:00
Michael Stapelberg d3beff2339 make i3bar use libi3’s root_atom_contents()
This removes code duplication, which will be useful for a subsequent
commit.

Furthermore, we now don’t open X11 connections unnecessarily in some
corner cases.
2013-11-22 15:48:45 +01:00
Tony Crisci 9f955a1e01 Command 'move <direction>' moves across outputs
When 'move <direction>' is issued in the context of a container that
borders a workspace, and there is no suitable place within this
workspace for which this container can move, move the container to the
closest output in this direction instead.
2013-11-19 20:26:52 +01:00
Tony Crisci f3bf314662 Add sensible discretion to UnmapNotify drag abort
Only abort a drag action on UnmapNotify when the unmapping window is
managed on the current workspace.

fixes #1108
2013-11-10 19:54:49 +01:00
Tony Crisci 9ee26a608e Return DRAG_ABORT on UnmapNotify from drag_pointer
Add DRAG_ABORT to enum drag_result_t. DRAG_ABORT will indicate the drag
operation cannot be completed.

Return DRAG_ABORT on UnmapNotify, or when the keyboard or pointer cannot
be grabbed.

Add DRAGGING to return value for drag_result_t. DRAGGING is used
internally by drag_pointer to indicate the drag is in progress.

Change DRAG_CANCEL to DRAG_REVERT to clarify the distinction between
"abort" and "revert/cancel" actions.

Fixes an issue that caused i3 to crash when a user is dragging or
resizing a floating window that becomes destroyed.
2013-11-09 13:27:42 +01:00
Baptiste Daroussin f691a55923 Use _PATH_BSHELL to ensure using a bourne shell
[Michael]
This commit should fix problems with people using a non-bourne shell as
login shell, e.g. fish or rc. AFAICT, $SHELL should only be used for
interactive shells, but we just want a bourne shell, not an interactive
shell.
2013-11-09 10:11:32 +01:00
jj 857fc0bf17 Update comment for the con_toggle_fullscreen method 2013-10-23 23:26:44 +02: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
Tony Crisci e99158e419 Assigned windows open urgent when not visible
When i3 begins to manage a window, if the window opens on a workspace
that is not visible, the urgency hint on the newly managed window will
be set.

fixes #1088
2013-10-19 10:07:24 +02:00
Michael Stapelberg 1c0554564a previous commit: extend test and code to also work with floating windows 2013-10-13 17:59:29 +02:00
jj eef9042713 Fix endless loop when trying to kill a visible workspace
This regression was introduced with commit
97b086efd9

fixes #1103
2013-10-13 17:58:38 +02:00
Michael Stapelberg a09a5c391e Merge branch 'master' into next 2013-10-09 19:49:48 +02:00
Tony Crisci 05e46848f0 Reply to _NET_REQUEST_FRAME_EXTENTS correctly
Reply to _NET_REQUEST_FRAME_EXTENTS by settings _NET_FRAME_EXTENTS
property of the window to widths of the respective borders added by i3.

fixes #1093
fixes #1069
2013-10-09 19:49:37 +02:00
Michael Stapelberg d661c1493c Only abort resizing on KeyPress, not KeyRelease (Thanks vandannen)
Otherwise, releasing a key that was used to trigger the resizing (e.g.
the modifier key) needs to be pressed all the time.
2013-10-01 07:21:40 +02:00
jj 98c4cc46e4 Do not resize/reposition floating containers when moving them to scratchpad 2013-09-30 22:54:35 +02:00
Tony Crisci 459490b67b Add ability to escape out of a mouse-resize operation
Implement #1074. drag_cancel grabs the keyboard and returns DRAG_CANCEL
when the user presses any key during the grab.
2013-09-30 22:54:11 +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
Michael Stapelberg 031de8f720 Merge branch 'master' into next 2013-09-24 07:48:09 +02:00
Michael Stapelberg 1a1d421534 Bugfix: correctly recognize assigned windows as urgent (Thanks jookia)
fixes #1086
2013-09-24 07:47:36 +02:00
syl20bnr 7098ef602b Add new bar.binding_mode_indicator configuration.
i3 current behavior hides the binding mode indicator when
workspace buttons are disabled.
This patch adds a new configuration for i3bar called
'binding_mode_indicator' which acts like the workspace_buttons.
It is now possible to configure i3bar to hide the
workspace buttons and keep showing the binding mode indicator.
This should make the hide workspace buttons configuration
more convenient for those who are heavily using binding
modes.
Default value for binding_mode_indicator is true.
2013-09-24 06:59:26 +02:00
jj 97b086efd9 Close all children when closing a workspace
fixes #591
2013-09-24 06:45:52 +02:00
jj ee04f8bfda Fix handling of new windows with WM_STATE_FULLSCREEN
If the currently focused window is in fullscreen mode, and a new window
is opened with WM_STATE_FULLSCREEN set, the new window now becomes the
new fullscreen window and gains focus.
2013-09-24 06:36:56 +02:00
Michael Stapelberg a52b5212ea Merge branch 'master' into next 2013-09-01 13:35:19 +02:00
Michael Stapelberg 2481b9dcd7 Bugfix: don’t flatten tabbed/stacked containers
fixes #1053
2013-09-01 13:35:04 +02:00
Michael Stapelberg 599a4d48e6 Merge branch 'master' into next 2013-08-30 20:01:04 +02:00
Michael Stapelberg 93463bc393 Bugfix: update root geometry on output changes for “fullscreen global” (Thanks kaersten)
fixes #1064
2013-08-30 19:59:57 +02:00
Michael Stapelberg 1a7fe4ee79 Merge branch 'master' into next 2013-08-27 20:23:00 +02:00
Michael Stapelberg 103ab83131 Revert "raise fullscreen windows on top of all other X11 windows"
This reverts commit 0659a0d98c.

It was a fix for dzen2 setups, but broke several other use cases.
Because dzen2 is not really important since most people use i3bar
nowadays, let’s revert this.

fixes #1062
fixes #1068
fixes #1070
2013-08-27 20:21:11 +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
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 da20cd397c switch from libXcursor to xcb-util-cursor 2013-08-17 09:44:20 +02:00
Franck Michea 69d7adcf49 Add missing return after error reporting. 2013-08-08 22:44:23 +02:00
Kacper Kowalik (Xarthisius) 0b168ee499 Include float.h for DBL_EPSILON
https://bugs.gentoo.org/show_bug.cgi?id=480272

Patch was written by Jeroen Roovers <jer@gentoo.org>
2013-08-08 22:37:27 +02:00
Michael Stapelberg bf760d0241 log.c: use posix_fallocate() instead of ftruncate() (Thanks don)
The effect is that the error handling is much better. posix_fallocate()
will allocate all the requested space, whereas ftruncate() does not.

Before this commit, in case the /dev/shm filesystem is too small to hold
the _contents_ of the log file, i3 will SIGBUS when writing to the shm
logfile. With this commit, it will print an error message on startup,
but continue to run without logging.
2013-08-01 00:42:24 +02:00
Michael Stapelberg 0c7a76c2f1 Handle the _NET_REQUEST_FRAME_EXTENTS ClientMessage (java compat)
This ClientMessage can be used to estimate how big the window will be
before opening it. Java always sends the ClientMessage and checks the
atom that should be set by the window manager, but it seems that the
fallback code path has a race condition.

Let’s see if the situation gets better with this change. I have been
running this patch for about two weeks and have not seen any issues with
it.

fixes #934
fixes #709
2013-07-27 15:06:08 +02:00
koebi 88671986f4 implement unmark command 2013-07-17 23:02:31 +02:00
Michael Stapelberg eec80838ab actively delete _NET_WORKAREA on startup
fixes #1038
2013-07-13 12:24:15 +02:00
Franck Michea 1f8a860744 bugfix: Resize and center a scratchpad even when a criteria is used. 2013-07-11 21:18:21 +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
Michael Stapelberg 6241419c86 Merge branch 'master' into next 2013-06-29 23:47:29 +02:00
Michael Stapelberg e8759691b8 Bugfix: call i3-nagbar correctly for configfiles without the font directive (Thanks xeen)
fixes #1030
2013-06-29 23:46:53 +02:00
Michael Stapelberg f55b7977e8 Store aspect_ratio instead of weird proportional_{width,height} (Thanks phillip)
This commit only goes to “next” because I am not sure whether it
actually makes things better in all cases and want to give it some
testing first.

There was no documented reason behind using the
proportional_{width,height} variables, so I suppose that code was just
stupidity on my part (it was written merely a month after I started this
project in 2009).

fixes #1032
2013-06-29 23:11:54 +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
Michael Stapelberg 78e99440f6 Merge branch 'master' into next 2013-06-29 20:28:07 +02:00
Michael Stapelberg b4f7142509 Bugfix: fix focus handling in 'floating disable' on non-visible windows (Thanks necoro)
fixes #1027
2013-06-29 20:27:33 +02:00
Alexander Berntsen 49bc20c934 Fix incorrect comment 2013-06-23 22:34:04 +02:00
oblique 78fad71894 Update parent urgency hint if a child is removed. 2013-06-23 22:27:30 +02:00
Michael Stapelberg 85cb313153 reset shmlogname when disabling the log
This makes the i3-dump-log error message more helpful.
2013-06-23 22:14:39 +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
Alexander Berntsen 684a77442e Make default shmlog_size a const int 2013-06-12 23:24:07 +02:00
Michael Stapelberg 8353a387c9 Merge branch 'master' into next 2013-05-28 19:56:57 +02:00
Michael Stapelberg 62ef7834b0 Bugfix: Unmap windows before reparenting them to the root window (fixes Mathematica) (Thanks psychon)
Some apps such as Mathematica send a synthetic UnmapNotify event without
properly unmapping their window first. This change makes sure that
happens and fixes an annoying bug with Mathematica where some unmanaged
windows would stay around, but you couldn’t do anything with them.

Thanks to psychon (current awesome maintainer) for helping with the
diagnosis!

fixes #787
2013-05-28 19:52:01 +02:00
Michael Stapelberg e979f16ddb manage.c: use xcb_discard_reply() instead of free()ing the reply (Thanks psychon) 2013-05-28 18:57:26 +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
haptix@web.de f0eba6d15c Fix problem when moving fullscreen window to scratchpad
When moving a fullscreen window to scratchpad with 'move scratchpad', the
focused window would stay fullscreen.

Also, when having a container in fullscreen mode and then focusing a child of
this container and moving it to scratchpad, it would enable fullscreen for
the child window.

This patch fixes both problems, so the scratchpad window is always floating.
2013-05-25 22:59:27 +02:00
Diego Ongaro 609496d13f Draw indicator border only for split layouts
In order to distinguish split layouts from tabbed/stacking layouts when
only one window is shown, do not draw the indicator border for tabbed or
stacking layouts.
2013-05-22 19:35:33 +02:00