Commit Graph

675 Commits (9571200baa387eb0b4b0e8afd9d540175a95adc5)

Author SHA1 Message Date
Alexander Kedrik e2ebe3e2ae Use #pragma once
#pragma once is safer and simpler. According to Wikipedia it's supported by all major compilers.
2014-01-01 15:06:57 +01:00
Michael Stapelberg 5cd7979e62 Merge branch 'master' into next 2013-12-24 10:37:14 +01:00
Michael Stapelberg 0883dfbe14 only LOG() the DPI when it changes, DLOG() it otherwise (Thanks lkraav)
This avoids flooding stdout every time some text (e.g. a window
decoration) is drawn, yet leaves the message in place when it’s actually
relevant (upon DPI changes).

fixes #1115
2013-12-24 10:35:56 +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 42e359ec60 kill placeholder windows when the actual window appears 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 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
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 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 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
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
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
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
Michael Stapelberg da20cd397c switch from libXcursor to xcb-util-cursor 2013-08-17 09:44:20 +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
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 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
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 d51173b2ba i3-nagbar: take our terminal execution kludge to the next level
Please read commit 2bf80528bd first.
Then read the comment within the code of this commit.
Then run in circles and cry loudly.

fixes #1002
fixes #1026
2013-06-10 22:55:39 +02:00
Michael Stapelberg a99fc537fc re-shuffle struct members to save a bit of memory
Analysis done with pahole(1).
2013-06-08 15:37:41 +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 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
Diego Ongaro 96575e14a0 Give layout enum a name: layout_t 2013-05-22 19:35:07 +02:00
Michael Stapelberg 0659a0d98c raise fullscreen windows on top of all other X11 windows
Note that this is ineffective for dunst’s notifications because dunst
re-raises them as soon as they get obscured. It does work for dzen2
however, which was the original use-case.

fixes #569
2013-04-07 15:38:00 +02:00
Yuxuan Shui 5adb09c5fc Use a saner sanity check for floating_reposition.
The function contained_by_output checks whether any output contains any
parts of a give rect. Rather than relying on the central point of the rect.
2013-03-21 23:41:07 +01:00
Yuxuan Shui 5b4ff1804d Fix restarting with 32bit depth windows (v5)
What I do in this patch is:

1. Split the con_new() function, so I can create a Con without actually
create a window.
2. Store the depth of Cons in the layout file when i3 is restarting.

Fix typos and mis-staged files in previous patch.
2013-03-21 23:38:09 +01:00
oblique 8a4a719093 Add support for _NET_WM_STATE_DEMANDS_ATTENTION.
_NET_WM_STATE_DEMANDS_ATTENTION indicates that some action in or with
the window happened. It's a weaker hint than urgency flag of WM_HINTS,
but some applications and almost all Qt applications use it instead of
WM_HINTS' urgency flag (one example is Skype).
2013-03-09 10:55:13 +01:00
Piotr S. Staszewski 3facbbca5c Add a new IPC event for changes on windows.
Added new event id (I3_IPC_EVENT_WINDOW) so that a an IPC client can
subscribe to events on windows. Added a basic window event that gets
triggered when a window gets successfully reparented. This new event
also dumps the container data, so that IPC clients can get the initial
window name. IPC clients wishing to see window events should subscribe
to 'window'.
2013-02-18 10:55:11 +01:00
Artem Shinkarov 5f05ca6b5d Separator color via config; separator width and on/off via ipc
This patch adds the following features:
1) Configure a color of the separator via config.  It is done like
   bar {
      colors {
         separator #000000
      }
   }
2) A block can have an integer entry "separator_block_width" which
   sets the width of the gap which would follow after the current block.

3) A block can have a boolean entry "separator" and if it is set
   to false, then the drawing of the separating line would be disabled.
2013-02-18 10:44:44 +01:00
Michael Stapelberg a52b1b4bb0 inline comments for enum values 2013-02-18 10:41:34 +01: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 b0e2be9a6b Add render_deco_height() 2013-02-14 19:37:52 +01:00
Francesco Mazzoli f13d8ed06f wrap when moving things to outputs with direction 2013-01-26 19:27:58 +01:00
Michael Stapelberg 62b0df0640 Make i3-nagbar use the same font as configured for i3 2013-01-26 09:55:38 +01:00
Michael Stapelberg dcb8ac84f8 ipc_recv_message: store message_type, don’t compare. add distinct EOF retval
Also use ELOG, which requires i3-msg to provide logging functions.
2013-01-23 18:51:39 +01:00
Michael Stapelberg 7d9c20734c include stdint.h in i3/ipc.h (Thanks Kai) 2013-01-11 22:28:43 +01:00
Michael Stapelberg 7b0d75ee0a ipc_send_message: use stack frame with fixed size 2013-01-11 19:09:41 +01:00
Michael Stapelberg d8e27dd5aa ignore MotionNotify events generated while warping the pointer 2012-12-27 17:04:13 +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 c127ac3855 remove all references to the old cfgparse 2012-12-24 15:57:02 +01:00
Michael Stapelberg 7658109309 Bugfix: remove superfluous #include <xcb/xcb_atom.h> (Thanks pnutzh4x0r)
This fixes the build on CentOS 6.

fixes #889
2012-12-14 21:49: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
Francesco Mazzoli b67eedf71a simplify yajl related code
Specifically, put the version dependent code in some macros, and put
that plus the `y' and `ystr' macros in a separate file, `yajl_utils.h'.
2012-11-13 09:32:55 +01:00
Michael Stapelberg 71ccb4bef2 Merge branch 'master' into next 2012-10-29 16:42:11 +01:00
Michael Stapelberg e7a4580c5f Bugfix: force rendering when the parent’s orientation changed
Otherwise, the split indicator might not be refreshed even though it
should be.

fixes #858
2012-10-29 16:41:16 +01:00
Michael Stapelberg 9b87b2c8ec Implement smart popup_during_fullscreen mode
With this commit, the default behavior is to display popups while there
is a fullscreen application only if the popup belongs to that
application (as determined by the WM_TRANSIENT_FOR hint which
applications have to set properly).

fixes #663
2012-10-24 20:54:28 +02: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
Michael Stapelberg 94d95f2b8c add missing include/config_parser.h (Thanks slowpoke) 2012-10-08 16:28:32 +02:00
Michael Stapelberg 20c0fa7cfb use the new parser by default
you can force the old parser with the command line flag
--force-old-config-parser-v4.4-only (which will be present in v4.4 only,
as the name suggests)
2012-10-08 13:26:42 +02:00
Michael Stapelberg 2738f13798 move owindow definition into the command parser 2012-10-08 13:26:24 +02:00
Michael Stapelberg 40c624e1c4 port the entire old config parser to the new one 2012-10-08 13:23:48 +02:00
Michael Stapelberg 00fca2dabd add first bits of a (custom) config parser 2012-10-08 13:17:46 +02:00
Deiz cae6fb627f Improve startup sequence termination conditions
If a window with _NET_STARTUP_ID set is moved to another workspace, it
will delete any associated startup sequence immediately. This will also
occur if a window has a leader with _NET_STARTUP_ID set, if the leader
has no container (never been mapped).

A startup sequence may also be deleted if it's matched by
startup_workspace_for_window() and its 30-second timeout has elapsed.
2012-10-04 17:48:51 +02:00
Deiz fdcba7b91a Replace the discrete 'split' Con property with a simple function. 2012-10-04 17:48:08 +02:00
Deiz e89a25f81f Implement moving workspaces as if they're regular containers 2012-09-29 00:17:36 +02:00
Yaroslav Molochko 04c58c7325 Implement variable border widths for pixel/normal
fixes #325
2012-09-24 22:20:29 +02:00
Deiz b235c469c1 Display appropriate cursors when resizing or moving floating windows. 2012-09-23 22:05:19 +02:00
Deiz a080794e59 Replace duplicate "__" workspace prefix checks with a single function. 2012-09-23 15:47:35 +02:00
Sascha Kruse 1806c9802e add descriptive titles to split containers 2012-09-22 20:09:39 +02:00
Sascha Kruse d8a036d776 mark parents of urgent container also as urgent 2012-09-22 19:31:34 +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
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
Pavel Löbl 7cffd79140 Add new subscribe event 'mode' for binding mode changes
Introducing a new event to subscribe called mode. It's fired up
when i3 changes binding mode (like switching from default to resize).
IPC guide adjusted also.
2012-09-22 12:52:49 +02:00
Michael Stapelberg d638e3029a don’t use reversed identifiers for include guards (Thanks Markus)
Done with:

    sed -in 's/\(ifndef\|define\) _\([0-9A-Z_]*\)$/\1 I3_\2/' include/**/*.h

fixes #804
2012-09-21 15:36:25 +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 548d74015c ignore modifiers for KeyRelease bindings
For the following binding:

    # Simulate ctrl+v upon pressing $mod+x
    bindsym --release $mod+x exec --no-startup-id xdotool key --clearmodifiers ctrl+v

you can now use either:
1. press $mod, press x, release x, release $mod
2. press $mod, press x, release $mod, release x

fixes #485
2012-09-06 17:24:30 +02:00
Michael Stapelberg c6c6d3a952 naive implementation of 'bindsym --release' (and bindcode)
The implementation is naive because the user has to generate exactly the
event he specified. That is, if you use this binding:

    bindsym --release $mod+x exec import /tmp/latest-screenshot.png

Then it will only be triggered if you hit $mod, hit x, release x,
release $mod. It will not be triggered if you hit $mod, hit x, release
$mod, release x. The reason is that the KeyRelease event in the latter
case will not have the modifier in its flags, so it doesn’t match the
configured binding.
2012-09-06 17:04:31 +02:00
Michael Stapelberg 32d4dbf70f startup-notifications: keep sequence around for 30s after completion
This changes the fact that Firefox would not be launched on the correct
workspace because it marked the startup sequence as completed *before*
actually mapping all of its windows.

To test this, go to workspace 3 and run this command in a terminal:
    i3-msg 'exec iceweasel; workspace 4'
That will make i3 start iceweasel (and create a proper startup
notification context for it), then immediately switch to workspace 4
(before iceweasel could possibly start).

The iceweasel window(s) should appear on workspace 3.
2012-09-05 21:02:52 +02:00
Michael Stapelberg 2896ae8057 logging: make libi3 use verboselog()/errorlog(), provide it in each caller
While this is a bit ugly, it makes the log messages end up where they
are supposed to: in the shmlog/stdout in case of i3 and on stdout in
case of utilities such as i3-input
2012-08-13 13:27:16 +02:00
Quentin Glidic 9f7247fd9c libi3: Introduce LOG 2012-08-13 11:39:30 +02:00
Fernando Tarlá Cardoso Lemos 6ff3f7abad libi3: Implement Pango rendering 2012-08-13 11:39:30 +02:00
Fernando Tarlá Cardoso Lemos ec17a26b0e libi3: Rework font to support multiple backends 2012-08-13 11:39:29 +02:00
Fernando Tarlá Cardoso Lemos 5d8ccc5912 libi3: Introduce get_visualtype 2012-08-13 11:37:34 +02:00
Quentin Glidic 210fc6dfed libi3: Rework predict_text_width
predict_text_width now takes an i3String as argument
2012-08-13 11:37:23 +02:00
Quentin Glidic 53365fa887 libi3: Rework draw_text
We now have two versions of draw_text
draw_text: Now takes an i3String
draw_text_ascii: Designed for static strings in plain ASCII
2012-08-13 11:37:21 +02:00
Quentin Glidic b6c705a1a4 i3/window: Port window names to i3String 2012-08-13 11:30:08 +02:00
Quentin Glidic bc5f33878a i3/log.h: Prepare for libi3.h inclusion 2012-08-13 11:30:08 +02:00
Fernando Tarlá Cardoso Lemos 7f22d4fe32 libi3: Implement i3String
New type designed to handle UCS-2/UTF-8 conversion nicely
2012-08-13 11:29:18 +02:00
Michael Stapelberg e68a8dd86c shm-logging: implement i3-dump-log -f (follow)
This changes the SHM log format, it doesn’t use 0-bytes to separate
entries anymore. Instead of using lots of printf() calls in i3-dump-log,
we now do precisely one big write().

So, to be clear: i3-dump-log and i3 both need to be upgraded.
Mismatching versions will lead to garbage output (no crashes of i3, just
garbage output).

The -f flag uses an inter-process pthread_cond_t in the shared memory
header to broadcast the arrival of new messages to all i3-dump-log
processes. This internally uses futexes and thus doesn’t even mean a
kernel call in most cases. inter-process pthread_cond_ts require NPTL
(the Native Posix Thread Library, introduce in Linux 2.6).
2012-08-13 01:06:09 +02:00
Michael Stapelberg 1e49f1b08a Implement i3 --moreversion
From the code:

    Connects to i3 to find out the currently running version. Useful since it
    might be different from the version compiled into this binary (maybe the
    user didn’t correctly install i3 or forgot te restart it).

Here is an example output:

    $ ./i3 --moreversion
    Binary i3 version:  4.2-202-gb8e782c (2012-08-12, branch "next") © 2009-2012 Michael Stapelberg and contributors
    Running i3 version: 4.2-202-gb8e782c (2012-08-12, branch "next") (pid 14804)

    The i3 binary you just called: /home/michael/i3/i3
    RUNNING BINARY DIFFERENT FROM BINARY ON DISK!
    The i3 binary you are running: /home/michael/i3/i3

    $ i3 restart
    2012-08-12 15:05:28 - Additional arguments passed. Sending them as a command to i3.
    IPC: received EOF instead of reply

    $ ./i3 --moreversion
    Binary i3 version:  4.2-202-gb8e782c (2012-08-12, branch "next") © 2009-2012 Michael Stapelberg and contributors
    Running i3 version: 4.2-202-gb8e782c (2012-08-12, branch "next") (pid 14804)

    The i3 binary you just called: /home/michael/i3/i3
    The i3 binary you are running: /home/michael/i3/i3
2012-08-12 15:10:13 +02:00
Michael Stapelberg 394b395455 set I3_PID atom on the root window 2012-08-12 13:51:47 +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
Julius Plenz 70ec3867fe clean up zero-byte logfile on immediate exit
Otherwise, a zero-byte log file stays behind after every call to `i3
--get-socketpath`. Also, replace "return" calls with more explicit "exit"
calls.

Before:

$ ls -ld /tmp/i3* | wc -l; \
  repeat 10 i3 --get-socketpath >/dev/null; \
  ls -ld /tmp/i3* | wc -l
1
11

Now:

$ ls -ld /tmp/i3* | wc -l; \
  repeat 10 i3 --get-socketpath >/dev/null; \
  ls -ld /tmp/i3* | wc -l
1
1

Signed-off-by: Julius Plenz <julius@plenz.com>
2012-08-11 02:23:03 +02:00
Michael Stapelberg 6ba0944430 scratchpad: fix moving scratchpad window
From the source:

    When starting i3 initially (and after each change to the connected
    outputs), this function fixes the resolution of the __i3
    pseudo-output. When that resolution is not set to a function which
    shares a common divisor with every active output’s resolution,
    floating point calculation errors will lead to the scratchpad window
    moving when shown repeatedly.

fixes #632
2012-08-08 18:45:40 +02:00
Axel Wagner 57effd65b2 Make horizontal edge-borders hidable too 2012-08-06 03:03:00 +02:00
Iakov Davydov f27735f620 create hide_edge_borders option 2012-08-05 20:26:15 +02:00
Michael Stapelberg cab8e3c46f log.h: include left-over slog() prototype 2012-08-05 15:59:45 +02:00
Michael Stapelberg 991a9de0d7 log.h: tell the compiler these logging functions use printf-like formats
This gives us additional warnings and is supported in gcc and clang.
2012-08-05 15:59:08 +02:00
Michael Stapelberg 78f5f2204d ipc: implement GET_VERSION to find out the i3 version
This is useful for third-party scripts which require certain features
and want to error out cleanly when they are run with an old i3 version.

Additionally, i3 --version might be different from what’s actually
running (an old version of the binary), so i3-msg -t get_version will be
the best way to figure out the i3 version you are actually running from
this commit on.
2012-08-05 14:30:05 +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
Quentin Glidic bdc078914b i3: Replace loglevels by a global debug logging
File-limited were not used nor really useful
Besides, they are painful to maintain in Makefile rules compared to the
benefit
2012-07-22 18:41:12 +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
Michael Stapelberg eeb6ff9237 Move is_debug_build() to libi3/ 2012-05-09 19:12:20 +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 0f10ccdf12 Implement fake-outputs option (cmdline, cfg) for multi-monitor testing
This kills the dependency on xdmx and makes the testsuite simpler
and more flexible (in the output sizes / configurations).
2012-04-09 14:28:36 +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
Michael Stapelberg 72078c704e Implement 'workspace number <number>' to switch to named workspaces 2012-04-08 19:17:46 +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
Michael Stapelberg e19c7b7bae A few style fixes for the previous commit 2012-03-26 17:00:35 +02:00
darkraven 9d68d780e2 Use 32bit visual only when needed. Thus we could drop the --enable-32bit-visual option. 2012-03-26 16:50:44 +02:00
Fernando Tarlá Cardoso Lemos 484c2a697b Document text_len in the draw_text description. 2012-03-26 16:47:23 +02:00
Pavel Löbl f78f137ed0 Extends move command for floating windows 2012-03-25 11:06:49 +02:00
Michael Stapelberg ab9ba6fcf9 Use gettimeofday() and struct timevals instead of time()
Initially I thought using the second precision time() function is good enough,
but to make t/113-urgent.t considerably faster (>2s vs. 0.08s), we put in a
little more effort and use gettimeofday. Otherwise, this test blocks the whole
testsuite from completing much faster on modern machines :).
2012-02-21 13:38:49 +01:00
Michael Stapelberg 62a1ee7c45 use signed integer types for the floating size constraints 2012-02-16 18:41:54 +00:00
D Thompson 82146fcebf Implement support for user configuration of constraints on floating window dimensions. 2012-02-16 18:31:28 +00:00
Michael Stapelberg e114b3dba2 Refactor the interface of commands.c
This change has two implications:

1) tree_render() will now be called precisely once for input which consists of
   multiple commands (like "focus left; focus right"). Also, the caller of
   parse_command() has to call it. This makes us able to fix tickets such as
   ticket #608 (where multiple tree_render() calls are noticable).

2) The output of a command is now a JSON array of return values of the
   individual subcommands. In the case of "focus left; focus right", this is:

   [{"success":true}, {"success":true}]

   While this is incompatible with what i3 returned before, the return value of
   commands was undocumented and therefore not subject to our API stability.
2012-02-15 20:57:25 +00:00
Michael Stapelberg 58ecd14900 Implement support for chosing a 32 bit visual (necessary for pseudo-transparency) (Thanks darkraven)
You need to specify the --enable-32bit-visual flag when starting i3. This is
done because everything feels sluggish on my system when using a 32 bit visual
instead of a 24 bit visual. Fast > fancy.
2012-02-15 18:56:07 +00: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
Jeremy O'Brien 53541817ef Implement urgency flag matcher
Currently it supports the following options:
"oldest": match the first window that triggered an urgent event
"latest": match the last window that triggered an urgent event
2012-02-14 22:47:10 +00:00
Michael Stapelberg 7cdddc6524 add comments to src/commands.c 2012-01-27 22:32:40 +00:00
Michael Stapelberg 3229f7677f Rip out the old command parser, remove migration code 2012-01-27 22:11:03 +00:00
Michael Stapelberg f9bc434e2a Implement highlighting right/bottom borders of splitted windows
Fixes #299
2012-01-22 11:22:15 +00:00
Michael Stapelberg 318d4fdeef make in-place restarts use socket activation, too (for faster/less flaky tests) 2012-01-21 23:03:09 +00:00
Michael Stapelberg 3b7f4d428e Correctly restore focus after in-place restarts
Note: This change requires two in-place restarts when you are upgrading
in-place from an old version.

Fixes #611
2012-01-21 18:35:15 +00:00
Michael Stapelberg fabcd7d911 Merge branch 'master' into next 2012-01-21 15:08:36 +00:00
Michael Stapelberg 077d2433a7 Bugfix: Fix coordinates when the rect of an output changes (Thanks Paul)
Fixes #623
2012-01-21 15:07:53 +00:00
Michael Stapelberg 31b7ec29fd Re-implement bar borders (by Angelo Haller)
This re-introduces borders around the workspace buttons in i3bar.
No additional pixels will be consumed (you will not lose any space for your
windows).
2012-01-20 21:36:50 +00:00
Michael Stapelberg 57bf93ebaf Merge branch 'master' into next 2012-01-20 18:14:34 +00:00
Michael Stapelberg 07e495d2d0 Fix xcb_compat.h to make i3 compile with older xcb versions (Thanks David Coppa) 2012-01-20 18:13:52 +00:00
Michael Stapelberg 759ed0b6e3 Merge branch 'master' into next 2012-01-20 18:10:52 +00:00
Michael Stapelberg 4f26d6f2a1 Bugfix: Setup the _NET_SUPPORTING_WM_CHECK atom in a standards-compliant way
This makes chrome (and probably other apps, too) receive changes of the
_NET_ACTIVE_WINDOW and thus show its bookmark dialog properly.

Fixes: #544
2012-01-20 18:09:53 +00:00
Michael Stapelberg fd8e1c98c9 Merge branch 'master' into next
Conflicts:
	src/handlers.c
2012-01-18 19:18:22 +00:00
Michael Stapelberg 2d14ced024 Bugfix: Respect WM_HINTS.input for WM_TAKE_FOCUS clients
This fixes problems with Qt apps (like Quassel) and apparently Eclipse since
the last commit.
2012-01-18 19:16:57 +00:00
Michael Stapelberg a532f5ac39 Implement a new parser for commands. (+test)
On the rationale of using a custom parser instead of a lex/yacc one, see this
quote from src/commands_parser.c:
     We use a hand-written parser instead of lex/yacc because our commands are
     easy for humans, not for computers. Thus, it’s quite hard to specify a
     context-free grammar for the commands. A PEG grammar would be easier, but
     there’s downsides to every PEG parser generator I have come accross so far.

     This parser is basically a state machine which looks for literals or strings
     and can push either on a stack. After identifying a literal or string, it
     will either transition to the current state, to a different state, or call a
     function (like cmd_move()).

     Special care has been taken that error messages are useful and the code is
     well testable (when compiled with -DTEST_PARSER it will output to stdout
     instead of actually calling any function).

During the migration phase (I plan to completely switch to this parser before
4.2 will be released), the new parser will parse every command you send to
i3 and save the resulting call stack. Then, the old parser will parse your
input and actually execute the commands. Afterwards, both call stacks will be
compared and any differences will be logged.

The new parser works with 100% of the test suite and produces identical call
stacks.
2012-01-14 21:29:57 +00:00
Michael Stapelberg f81c89ac28 Refactor the code out of src/cmdparse.y to src/commands.c
This is the first step towards our new parser.
2012-01-14 16:59:52 +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
dbp a3081c488a Allow different modifier keys for showing hidden i3bar. 2012-01-08 12:47:41 +00:00
Michael Stapelberg 89dded044b forgot include/shmlog.h 2012-01-07 14:59:58 +00:00
Michael Stapelberg dee7c07ad2 shmlog: store meta information in the buffer itself, store path as X11 atom
This makes i3-dump-log completely independent of a running i3 instance.
2012-01-06 23:40:07 +00:00
Michael Stapelberg 019347b14c update comment in include/data.h 2011-12-30 11:23:15 +01:00
Michael Stapelberg 8a67f15ef4 add missing scratchpad.{c,h} 2011-12-21 23:17:52 +00:00
Michael Stapelberg 08986a1798 Implement scratchpad functionality (see userguide) 2011-12-21 23:15:32 +00:00
Michael Stapelberg c4298b9311 Merge branch 'master' into next 2011-12-18 17:25:15 +00:00
Michael Stapelberg 4fba2d5f91 Bugfix: Correctly check boundaries and reassign floating windows when moving (Thanks xpt)
Fixes: #592
2011-12-18 17:24:27 +00:00
Michael Stapelberg 6f8b284586 Merge branch 'master' into next 2011-12-17 18:48:14 +00:00
Michael Stapelberg 664e30903c Bugfix: Don’t change focus after (graphical) resizing 2011-12-17 18:47:29 +00:00