Commit Graph

948 Commits (next)

Author SHA1 Message Date
Ingo Bürk d78fd8d91f Introduce --exclude-titlebar flag for mouse bindings. (#2703)
This introduces the flag --exclude-titlebar for mouse bindings which
allows bindings like

    bindsym --whole-window --border --exclude-titlebar button3 focus

fixes #2347
2017-05-02 09:08:42 +02:00
Ingo Bürk c474ddd782 Merge pull request #2649 from s3rb31/next
layout toggle: take any combination of layouts as arguments (continuation of #2476)
2017-02-24 00:58:19 +01:00
s3rb31 3410cb256d Implement mapping from string to layout as extra function 2017-02-23 21:49:48 +01:00
Ingo Bürk 432c4211ea Allow using left/right scrolling like up/down scrolling.
This commit makes left/right scrolling synonyms for up/down scrolling for
* scrolling on window decoration
* scrolling on i3bar workspaces

fixes #2677
2017-02-14 22:28:01 +01:00
Ingo Bürk 7732971ad8 Introduce named aliases for mouse buttons.
This increases readability and allows us to cover up the fact that
XCB doesn't define constants for left/right scrolling.
2017-02-12 20:44:45 +01:00
Tony Crisci 04dcf42397 Add the ipc shutdown event (#2652)
This event is triggered when the connection to the ipc is about to
shutdown because of a user action such as with a `restart` or `exit`
command. The `change` field indicates why the ipc is shutting down. It
can be either "restart" or "exit".

fixes #2318
2017-01-22 14:08:32 -08:00
Ingo Bürk e0582aa5eb Remove unused function arguments. (#2635)
The connection is no longer necessary since the non-cairo paths have
been removed.
2017-01-13 09:34:09 -08:00
Ingo Bürk 14eea7fce5 Added support for _NET_MOVERESIZE_WINDOW. (#2634)
fixes #2603
2017-01-13 09:30:50 -08:00
Ingo Bürk abf8300792 Rewrite the signal handler dialogs.
This commit is a rewrite of the popup dialogs used when i3 crashes. We now
use our draw_util suite and both properly react to EXPOSE events and clean
up the windows when the handler exits.

As a side-effect, this fixes #2422
2017-01-10 20:13:25 +01:00
Ingo Bürk a301396997 Respect minimum size hints for floating windows. (#2508)
This commit introduces proper support for the minimum size on floating
windows by ensuring that it is respected during mapping, later changes as
well as resizes.

Furthermore, this commit fixes minor issues with how the hints are handled
during calculations.

fixes #2436
2016-11-28 22:09:39 +01:00
Michael Stapelberg 633a9f7b14 Implement RandR 1.5 support (#2580)
This comes with the intentionally undocumented --disable-randr15 command
line flag and disable-randr15 configuration directive. We will add
documentation before the release if and only if it turns out that users
actually need to use this flag in their setups. Ideally, nobody would
need to use the flag and everything would just keep working, but it’s
better to be safe than sorry.

fixes #1799
2016-11-28 18:20:46 +01:00
Michael Stapelberg 90d68d7ea0 Remove some now-unused functions from xcb.[ch] (#2574)
xcb_draw_line is unused since commit
d7f9700ba4

xcb_draw_rect is unused since commit
a79d33fc7f

xcb_raise_window is unused since commit
7208d01048

xcb_warp_pointer is unused since commit
755c618cd4
2016-11-21 00:37:17 -08:00
Michael Stapelberg 70e7f0e39a Remove unused src/debug.c (#2575) 2016-11-21 00:37:10 -08:00
mihaicmn ad7dec31d5 Use the DPI setting within the i3bar (#2556) 2016-11-12 06:34:54 -08:00
Michael Stapelberg fff3f79da9 switch to clang-format-3.8 (#2547)
https://llvm.org/bugs/show_bug.cgi?id=30353 was filed for the unintended
line break between in e.g. “TAILQ_ENTRY(foo)\nbar;”.

Until that’s fixed or a workaround is known, we’ll live with line
breaks. To make it a bit easier for readers to see what’s going on, I
added extra line breaks around each such struct member/variable
definition, so that they at least visually are a single unit.

fixes #2174
2016-11-08 13:46:43 -08:00
Michael Stapelberg f354f53435 Ensure all *.[ch] files include config.h
Including config.h is necessary to get e.g. the _GNU_SOURCE define and
any other definitions that autoconf declares. Hence, config.h needs to
be included as the first header in each file.

This is done either via:
1. Including "common.h" (i3bar)
2. Including "libi3.h"
3. Including "all.h" (i3)
4. Including <config.h> directly

Also remove now-unused I3__FILE__, add copyright/license statement
where missing and switch include/all.h to #pragma once.
2016-10-23 21:09:24 +02:00
Michael Stapelberg 567897bec6 Switch from I3__FILE__ to STRIPPED__FILE__
…as we now use the m4/ax_extend_srcdir.m4 macro, which defines
STRIPPED__FILE__ (the macro is not i3-specific).
2016-10-23 21:09:24 +02:00
Michael Stapelberg 4e9925de73 rename config.h to configuration.h
This is a preparation step for the next commit.
2016-10-23 17:41:46 +02:00
Ingo Bürk c71f6f8f7c Implement special value 'current' for output. (#2483)
This commit introduces the special 'current' value for outputs in both of

* move con to output current
* move workspace to output current

fixes #2357
2016-09-30 08:28:02 -07:00
Ingo Bürk 6a8fb69eff Added new criteria 'tiling' / 'floating'. (#2481)
These criteria allow selecting only windows in a specific mode, i.e.,
tiling and floating, respectively.

fixes #2406
2016-09-27 19:04:00 -07:00
Michael Stapelberg 0e73a6e9e7 Remove conditional compilation for cairo/pangocairo (#2480)
We strive to avoid conditional compilation in i3 as much as possible.
cairo and pangocairo have been around long enough in the versions that
we need that it’s time to unconditionally depend on them.

Also update DEPENDS with the last-known-good-versions while at it.
2016-09-27 12:57:00 -07:00
Ingo Bürk cb1fcfed6a Use Xft.dpi for DPI if available.
fixes #2465
2016-09-26 20:29:53 +02:00
Michael Stapelberg 9bf346c7a0 Remove compatibility definitions for xcb-util < 0.3.8 (#2473)
Even Debian oldstable has xcb-util 0.3.8.
2016-09-24 09:48:32 -07:00
Michael Stapelberg 5594139676 Eliminate once-used check_error utility function 2016-09-14 09:19:25 +02:00
Ingo Bürk d48c9b1e33 Fix colormap handling for containers. (#2450)
This commit correctly handles colormaps by

* Using the static default colormap we determine on startup if the
  con has the corresponding depth. This avoids creating pointless
  colormaps.
* Not freeing the default colormap to not have stray colormaps on
  containers. This fixes an issue with certain programs such as xwd.
* Creating a custom colormap when necessary and freeing it when the
  container is killed.

fixes #2435
2016-09-14 09:13:17 +02:00
Michael Stapelberg 3bd5e6e5c8 refactoring: store modifiers alongside translated keycodes
This is a no-op refactoring in terms of functionality.

related to #2346
2016-08-02 20:10:49 +02:00
Ingo Bürk b1d70f25b3 Introduced a new GET_BINDING_MODES message type and reply. (#2376)
This type dumps all currently configured binding modes.

fixes #2375
2016-06-15 22:25:22 +02:00
Christopher Zimmermann 1322af1e4f Don't use pthread on OpenBSD
since OpenBSD pthread does not support pthread_condattr_setpshared().
This patch could also stay in the OpenBSD ports tree or depend on a
configure test macro rather than defined __OpenBSD__.
2016-06-11 14:47:26 +02:00
Julien Lequertier 4bec3b9d24 Smart option added to hide_edge_borders config param (#2191) (#2191)
Use case:

* When managing multiple terminals in a workspace, the borders makes it easier
to know where the focus is, but when there is only one it's obvious where the
focus is.

* When there's only a web browser for example, the borders are actually counter-
productive since it makes clicking a side scrollbar or a tab a bit harder (if I
smash my cursor to the side or the top of the workspace, I have to move it in
the other direction by just a few pixels to be able to grab it)

Behaviour:

* No borders when there's a single window in a workspace
* Borders when there are multiple windows in a workspace

fixes #2188
2016-05-10 20:27:20 +02:00
Ingo Bürk 47562b4143 Introduce support for specifying variables from X resources. (#2286)
This patch introduces a new 'set_from_resource' config directive which
allows defining a variable by retrieving its value from the X resource
database. This avoids having to configure a color scheme in multiple
files. The directive takes an additional fallback value which is used
in case the resource cannot be found or during config validation where
no X connection is available.

Furthermore, this patch includes the following changes:
- If the same variable is defined twice, we now properly overwrite the
  value of the assignment rather than inserting two variable definitions
  with the same key.
- We now depend on xcb-util-xrm to query the resource.
- Increase the buffer size for variable / resource assignments.

fixes #2130
2016-05-08 12:55:27 +02:00
Ingo Bürk dbafb3cf23 Properly close disabled outputs restored during a restart. (#2337)
If an output is disabled during a restart, for example because a binding
such as

    bindsym $mod+Shift+r exec "xrandr --auto", restart

is used, it can happen that we first write the layout to disk and only
then receive the RandR change events. This leads to a situation where
the restored tree will contain these outputs, but the restarted i3
process will not receive the RandR events, thus the internal output in i3
is marked disabled.

This patch finds these cases after a restart and force-disables the
affected outputs.

fixes #2326
2016-05-08 12:49:24 +02:00
Ingo Bürk b2397c9f01 Remove redundant depth argument from x_con_init(). (#2323) 2016-05-05 14:18:27 +02:00
Ingo Bürk 152318bccf Remove dead code guarded with "#if 0 … #endif" (#2338)
This code has been neutralized for many years now and served no purpose
other than cluttering up the code. We obviously don't need it and it's
out of date anyway.

If there's ever any reason to restore (parts of) it, we have git for
that. But we don't need to keep commented out code around.
2016-05-05 14:18:04 +02:00
Ingo Bürk 80dddd9961 Correctly count the number of windows for no_focus. (#2296)
Previously we counted the number of (direct) children of the workspace to
decide whether no_focus should be applied or not. However, this doesn't
work correctly if there's a single container with multiple windows on the
workspace.

This patch correctly counts all windows on the workspace.

fixes #2292
2016-04-15 00:26:42 -07:00
Ingo Bürk 83c8740bf1 Only grab the mouse buttons that need to be grabbed. (#2290)
This is a followup to #2049. While we had fixed that bug by only grabbing
buttons 4 and 5 if there is a whole-window binding for that button, this
did not consider buttons higher than 5 as found on many mice.

Therefore, we now ditch the special handling for scrollwheel buttons and
instead do the same for all buttons higher than 3.

fixes #2271
2016-04-13 10:45:57 -07:00
wentasah fec1a9511e Make fullscreen windows open on the output which is indicated by their geometry
With this change, multi-monitor presentations (e.g. as implemented by
LibreOffice Impress) work out of the box. Previously, one had to move
the presentation windows to the right outputs oneself.
2016-04-06 21:19:10 +02:00
Eric Engeström 66d9c983e4 Fix spelling mistakes 2016-04-04 09:33:59 +02:00
Kacper Kowalik (Xarthisius) eb0a0a166f Convert ifdef CAIRO_SUPPORT to if statements to keep consistency with common.mk 2016-03-23 10:58:10 -05:00
Ingo Bürk 712c6d65ff Introduce I3_FLOATING_WINDOW
This patch introduces a proprietary atom I3_FLOATING_WINDOW which will be
set and maintained for floating windows and removed on tiling containers.

This allows users to select on this atom, e.g., in their compositor
configuration or in utility scripts (without using the IPC).

fixes #2223
2016-02-25 18:36:22 +01:00
Michael Stapelberg fdbbae56b2 split atoms.xmacro into 2 files to obtain _NET_SUPPORTED count
Manually updating a magic number doesn’t work in the long run.
With this change, the number of atoms contained in
include/atoms_NET_SUPPORTED.xmacro is used.

fixes #2230
2016-02-23 21:48:18 +01:00
Ingo Bürk 6cbff6bfd4 Ensure that the "border" command uses logical pixels.
Until now, only the config directive for borders (new_window,
new_float) respected the DPI setting (using logical_px). This
patch makes sure we also do so for runtime "border" commands.

fixes #2202
2016-02-09 21:03:44 +01:00
Michael Stapelberg fbfbdb8e12 travis: check spelling of binaries and manpages, use docker
We now build a docker base container based on debian sid (where the very
latest packages are available). That base container is updated once a
month, or whenever travis-build.Dockerfile or debian/control change, but
re-used for subsequent travis runs. While the initial build might take
up to 15 minutes, subsequent builds typically run in a minute or two.

All the different steps that we run on travis are now factored into
separate scripts in the travis/ directory.

Switching to docker should also help with issue #2174.
2016-02-06 10:36:43 +01:00
Ingo Bürk 328035fb7e Handle the EWMH atom _NET_WM_DESKTOP.
We already claim _NET_WM_DESKTOP support in _NET_SUPPORTED since around 2009,
but haven't actually done anything with it. However, especially pagers like
gnome-panel rely on this property to be updated and many tools, like GTK, want
to use the corresponding client messages to make a window sticky, move it
around etc.

This patch implements full support according to the EWMH spec. This means:

* We set the property on all windows when managing it.
* We keep the property updated on all windows at all times.
* We read and respect the property upon managing a window if it was set before
  mapping the window.
* We react to client messages for it.
* We remove the property on withdrawn windows.

Note that the special value 0xFFFFFFFF, according to the spec, means that the
window shall be shown on all workspaces. We do this by making it sticky and
float it. This shows it on all workspaces at least on the output it is on.

Furthermore, the spec gives us the freedom to ignore _NET_WM_DESKTOP when
managing a window if we have good reason to. In our case, we give window
swallowing a higher priority since the user would likely expect that and we
want to keep placeholder windows only around for as long as we have to.
However, we do prioritize this property over, for example, startup
notifications.

fixes #2153
fixes #1507
fixes #938
2016-01-18 12:13:36 +01:00
Ingo Bürk 811ff07b8e Rename decoration_border to child_border.
fixes #2154
2016-01-09 16:47:33 -05:00
Michael Stapelberg f511cc61c1 fix memory leak when swallowing windows 2016-01-09 17:06:58 +01:00
Michael Stapelberg e7f1476180 reload: fix memory leak 2016-01-09 17:06:54 +01:00
Michael Stapelberg 54738f6ec8 bindings.h: mark DEFAULT_BINDING_MODE as external
This prevents the following linker warning (only when compiling with
-fsanitize=address):

/usr/bin/ld: Warning: size of symbol `DEFAULT_BINDING_MODE' changed
from 8 in src/resize.o to 64 in src/bindings.o
2016-01-08 19:56:32 +01:00
Michael Stapelberg 3853d1866b Merge pull request #2143 from Airblader/feature-2120
Allow title_format for all containers
2016-01-05 22:32:15 +01:00
Ingo Bürk 1f660a4cc4 Move title_format from window to container.
This patch moves the title_format information from windows to containers.
Furthermore, it allows correctly setting it on window-less containers and
displays the title accordingly for split containers.

We now also dump and read title_format in GET_TREE / during restarts.

fixes #2120
2016-01-05 12:22:27 -05:00
Lauri Tirkkonen 034a12acad add decoration_border color for the actual client borders
see https://github.com/i3/i3/pull/2136
2016-01-05 12:17:48 +02:00
Ingo Bürk 6fefe836d4 Fix memory leaks in title_format.
This fixes three memory leaks that were found during the implementation of #2120
so that they can be fixed in a bugfix release.

relates to #2143
2016-01-04 18:48:01 -05:00
Johannes Lange 8bfd06c3dd added "toggle" option to "split" command
as requested in #1814
2016-01-04 17:31:47 +01:00
Alex Auvolat c6a4e4519f Correct color management for pango fonts
Corrects the cases where the colorpixel is not 0xRRGGBB : we have to
use the full color_t struct to describe font colors, as Pango expects
RGB values and not an XCB colorpixel value.
2015-12-29 14:26:21 +01:00
Alex Auvolat 19fd6817af Refactor extern definition of conn and root_screen 2015-12-29 12:47:12 +01:00
Ingo Bürk 19c273a2ad Validate matched containers for "kill" command correctly.
We now execute the validations when "kill" is executed even if match
criteria are used. This prevents users from killing workspace containers,
which instead kills all clients (as before when not using criteria).

fixes #1761
2015-12-28 02:35:25 -05:00
Ingo Bürk 0dd71674de Rename tree_close() to tree_close_internal().
It should be clear for callers of this function that this is an internal
function that skips certain validations which might be important. Therefore
we make it clear that this is an internal function by renaming it.

relates to #1761
2015-12-27 20:58:35 -05:00
Florian Merkel 33f017daa9 Support matching _NET_WM_WINDOW_TYPE_NOTIFICATION
This commit fixes #1969 by adding support for matching a window's type
against _NET_WM_WINDOW_TYPE_NOTIFICATION. The userguide and tests were
updated to reflect this change.
2015-12-15 21:55:33 +01:00
Ingo Bürk 8d36f78b8e Reject invalid match criteria with an error.
Previously, using a command like

  [con_id=foo] kill

would kill the currently focused window because while an error for
not being able to parse the con_id was logged, no further action
was taken, which caused the criterion to be ignored. In this case,
the fallback behavior of using the focused window took over.

For con_id, id and window_type we now reject incorrect values with
an error and abort the command.

fixes #2091
2015-12-09 14:00:53 +01:00
Ingo Bürk 780cb8d15d Use 32-bit visual by default if available.
With this patch, we use 32-bit visuals per default whenever it is
available. Otherwise, we fall back to the actual root window's
depth, which will typically be 24-bit.

Before this patch, we already used 32-bit depth for containers with
a window that uses 32-bit. However, this means that we didn't use
32-bit for split parent containers on which decoration is drawn.
For 32-bit windows using transparency, this caused a graphical glitch
because the decoration pixmap behind it would show through. This
behavior is fixed with this change.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk a4afd1b642 Parse colors as color_t instead of colorpixel.
With this patch we remove the temporary draw_util_colorpixel_to_color
function we introduced previously by parsing the colors as color_t to
begin with.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk b665049883 Migrate i3 rendering to cairo.
This patch migrates all decoration rendering of i3 to cairo. Using the
compile switch CAIRO_SUPPORT, rendering can be switched back to the
previous XCB behavior, just like with the previous migration to cairo
in i3bar.

This patch also fixes a bug in draw_util.c where copying one surface
to another would use incorrect coordinates if the source coordinates
are not 0, 0.

Furthermore, this patch implicitly fixes some minor issues in the
decoration rendering which would be ignored previously due to the fact
that errors would only show up in the event queue, but not cause the
rendering code path to crash. One example is zero-height pixmaps which
are not allowed. Using cairo, these would cause i3 to instantly segfault,
so this patch avoids this.

Lastly, this patch annotates other issues found but not fixed in this patch
using TODO comments, e.g., the zero-height check not working correctly
and the comment that it should probably work the same way for zero-width
pixmaps.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk 90d94298fa Move draw_util.c to libi3.
In order to prepare for using cairo for rendering i3 decorations,
we need to make the draw_util.c from i3bar available via libi3 such
that both i3bar and i3 can use it.

relates to #1278
2015-11-23 22:18:02 +01:00
Michael Stapelberg 233a22cb10 Merge pull request #2074 from Airblader/feature-2064
Support _NET_WM_USER_TIME.
2015-11-21 23:04:49 +01:00
Ingo Bürk 00881bb156 Support _NET_WM_USER_TIME.
With this patch, we support the special value "0" for _NET_WM_USER_TIME
on a window upon managing it, which indicates that the window shall not
be focused.

fixes #2064
2015-11-21 22:48:48 +01:00
Ingo Bürk 8016cce447 Document rect, window_rect and deco_rect. 2015-11-21 21:52:43 +01:00
Ingo Bürk 029d78c0bf Only grab scrollwheel buttons if necessary.
With this patch, we only grab the scrollwheel buttons (4 and 5) when
managing a window if a whole window key binding exists for these buttons.

This allows both of these usecases:
  - Bindings to scrollwheel buttons using --whole-window (see #1701).
  - Scrolling in a window without focusing it if no such binding
    exists (see #2049).

Furthermore, we drop all button grabs and regrab them after a config
reload in order to reevaluate the new bindings correctly.

fixes #2049
2015-11-15 22:08:47 +01:00
Ingo Bürk 66882bf445 Extract function to grab buttons when managing a window.
We refactor the button grabbing into a function to allow the next patch
both to
  - conditionally grab different sets of buttons
  - grab the buttons again when reloading the config.

relates to #2049
2015-11-11 20:21:26 +01:00
Ingo Bürk bc250b26a0 Allow multiple tray_output directives.
This patch introduces the possibility to specify the tray_output directive
multiple times. All values will be used by i3bar, in the order they are
given.

This way, a single bar configuration can be used for several machines with
internal output names "eDP1" and "LVDS-0" by specifying tray_output for both.
Any external output (e.g., "DP-0") will still not receive the tray. The same
effect can be achieved by using "primary", but forces the user to couple the
tray display to the primary output which may not be desirable behavior.

relates to #555
2015-11-01 16:35:17 -05:00
David Simon dc05d905c1 Optionally change i3bar color on focused output, implements #2020 2015-10-27 09:12:57 -04:00
Michael Stapelberg 2451551f63 Merge pull request #2040 from Airblader/bug-2034
Fix crash when trying to split and float a dock container.
2015-10-27 10:07:25 +01:00
Ingo Bürk 57a7ff301f Add --no-auto-back-and-forth for moving windows.
This patch extends the previously introduced flag --no-auto-back-and-forth
to also apply to

    move window to workspace <name>
    move window to workspace number <number>

relates to #2028
2015-10-26 22:40:06 +01:00
Ingo Bürk 3d6c76eb93 Fix crash when trying to split and float a dock container.
Since splitting a docking container was allowed and successful, the check
to prevent floating it fails to work. This causes a crash because the
workspace of the container cannot be determined as the dockarea is higher
up in the tree than the workspace it belongs to.

This patch extends to sanity check to nested dock containers when trying to
float a container and also disallows manually splitting a docked container
or changing its layout.

fixes #2034
2015-10-26 22:14:14 +01:00
Ingo Bürk 7270206e24 Added --no-auto-back-and-forth to workspace commands.
This patch introduces the --no-auto-back-and-forth flag to both of

    workspace --no-auto-back-and-forth <name>
    workspace --no-auto-back-and-forth number <number>

This flag will only have an effect if the back_and_forth feature is
enabled. If passed, the feature will be ignored for this particular
call only.

fixes #2028
2015-10-24 00:12:03 +02:00
Ingo Bürk 9537ada5ad Make 'unmark' aware of matched windows.
This patch allows using 'unmark' on matched windows. The old behavior
of applying it to all windows if no criteria were specified is kept.

relates to #2014
2015-10-22 15:32:18 +02:00
Ingo Bürk 7a77c5f0bb Introduce "--add" for marking windows.
In order to keep compatibility to before allowing multiple marks on a window,
we introduce a flag "--add" that must be set to put more than one mark on a
window. The default, which is also available as "--replace", keeps the old
behavior of overwriting a mark when setting a new one.

fixes #2014
2015-10-22 15:32:15 +02:00
Ingo Bürk 9bb2f038ab Allow multiple marks on windows.
This patch allows multiple marks to be set on a single window. The restriction that a mark may
only be on one window at a time is still upheld as this is necessary for commands like
"move window to mark" to make sense.

relates to #2014
2015-10-22 15:29:42 +02:00
Ingo Bürk fec61791e1 Rename is_markup to pango_markup. 2015-10-13 09:59:26 +02:00
Ingo Bürk 82dc747396 Make pango markup in mode names optional with a flag.
This introduces the flag "--pango" on the mode config directive to
explicitly enable pango markup for mode names. Not setting this will
cause the mode name to be rendered as is.
This fixes a regression in 4.11 where mode names containing characters
such as '<' would break user's configs as they didn't escape these
characters.

fixes #1992
2015-10-13 09:23:30 +02:00
Ingo Bürk 1c4100ce5d Use 32-bit visuals for i3bar when possible and allow RGBA colors.
This patch creates all necessary windows for i3bar with 32-bit visuals if available.
It also introduces the possibility to define RGBA colors (next to RGB colors), which
allows the user to set the opacity of any color. This requires running a compositor.

With this patch we also start supporting _NET_SYSTEM_TRAY_VISUAL, which is necessary
for the tray icons so they create the tray window with the correct depth and visual.
2015-10-06 23:01:57 +02:00
Ingo Bürk b744c5e6c6 Refactor parsing of matches to avoid code duplication. 2015-10-04 17:40:25 +02:00
Michael Stapelberg 2248085c5c Merge pull request #1909 from Airblader/feature-refactor-1
Refactor rendering noodles a bit
2015-10-04 17:15:42 +02:00
Michael Stapelberg 77a7d625e1 Merge pull request #1965 from Airblader/feature-typed-commands-parser
Make the command parser stack typed
2015-10-04 17:05:27 +02:00
Michael Stapelberg 039494165a Merge pull request #1959 from hwangcc23/fix-1926
Check duplicated bindings after translating keysym
2015-10-02 19:51:42 +02:00
hwangcc23 fc48a297ed Check duplicated bindings after translating keysym
1). See the issue #1926. For example, the second keybinding is not detected as a duplicate:
        bindcode Mod4+24 sticky toggle
        bindsym Mod4+q focus parent
2). To fix it, check duplicated bindings when translating the keysym to keycodes.
2015-10-02 22:09:53 +08:00
Ingo Bürk 6cd6f43d09 Turn "char *" into "const char *" for all command parser functions. 2015-09-28 14:24:08 +02:00
Ingo Bürk c7ca6e1b41 Migrate the move command to use typed numbers. 2015-09-28 14:21:44 +02:00
Ingo Bürk 0ae9cddc98 Migrate the resize command to use typed numbers. 2015-09-28 14:21:44 +02:00
Michael Stapelberg 3830aa891e Merge pull request #1960 from Airblader/bug-restore-mark
Fix duplicated marks on append_layout
2015-09-28 08:19:04 +02:00
Ingo Bürk dd7a532160 When appending a layout containing a marked container, make sure that any other containers with the same mark
are unmarked during insertion of the new container.

fixes #1956
2015-09-25 19:26:41 +02:00
Michael Stapelberg c82e6a87dc Merge pull request #1931 from Airblader/bug-1924
Improvements for sticky windows
2015-09-24 22:34:29 +02:00
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
Michael Stapelberg 5775147d37 Merge pull request #1943 from tcatm/fix-no-randr-output
Don't create empty workspaces on restart
2015-09-21 13:56:43 +02:00
Nils Schneider f14efe85d1 Don't create empty workspaces on restart
This fixes a bug I introduced in #1921. When restarting i3 in place a
stray workspace was created on the root_output during restart. On first
start, this workspace would have been moved to the first real and empty
output.

However, this does not produce the desired result during restarts when
workspaces are alread present on all real outputs. The stray workspace would
still be added to the first real output which already contains some
workspaces. Thus, adding a new empty workspace to it.

Fix this by delaying creation of the root output's workspace until it is
known whether the output is active or not.

Fixes #1940
2015-09-21 13:26:58 +02:00
Michael Stapelberg 72b9909942 Merge pull request #1921 from tcatm/fix-no-randr-output
randr: use root window in case of no randr outputs
2015-09-21 10:17:21 +02:00
Nils Schneider 78decb565a randr: use root window in case of no randr outputs
This patch introduces a root output covering the root window. It is used
in two cases:

1. RandR is not available. In this case, the previous behaviour of
   creating a single output covering the root window is preserved.

2. RandR is available, but there is no active output. In this case,
   the root output is enabled and will be the only active output.
   If any RandR output becomes available, the root output will be
   disabled again. Existing mechanisms for migrating workspaces will
   just work without modification.

I've carefully slipped in a global variable `Output root_output` representing
that output.

Fixes #926 and #1489
2015-09-18 23:18:03 +02:00
Ingo Bürk 034815b8fd Set and unset individual atoms in _NET_WM_STATE instead of overwriting the entire list everytime. This allows independent management of multiple states.
fixes #1873
2015-09-17 09:13:12 +02:00
Nils Schneider c87b256200 Revert "Add a timeout: delay_exit_on_zero_displays"
This reverts commit 2c77d7ceed.
2015-09-14 22:34:05 +02:00
Michael Stapelberg 840ce51bfd Extract workspace names from bindings before reordering.
fixes #1889
2015-09-14 09:28:42 +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
Ingo Bürk 2c338b6ae2 Handle _NET_WM_STATE_STICKY, but only for floating containers. If this atom is set, the floating window will always be automatically moved to the currently active workspace of the output that it is on. This is the equivalent of a sticky note stuck to the monitor.
We will respect this atom upon managing a window as well as when we receive a request that changes the sticky state.

fixes #1455
2015-09-13 20:40:20 +02:00
Ingo Bürk 5dbfb05c85 Use the EWMH support window rather than the root window as an input focus fallback.
If no other window is available on the active workspace, we now select the EWMH support window (used to indicate that an EWMH-compliant window manager is preent) as the focus window rather than the root window. The NET_WM_ACTIVE window will still be set to XCB_WINDOW_NONE to pretend that no window is actually focused.
This fixes the issue that when using the root window, a fallback mechanism in X11 takes effect which routes keyboard input to the window under the cursor, independent of whether that window has the input focus. Using the EWMH window instead, we can avoid this behavior. We cannot simply set it to XCB_WINDOW_NONE as this would discard all keyboard events, breaking keybindings.

fixes #1378
2015-09-13 20:29:02 +02:00
rr- 23d16e1332 Support "resize set W H" 2015-09-11 23:12:07 +02:00
Ingo Bürk dd989fa87b Refactor out some individual functions in render_con() to make the code more readable. 2015-09-09 18:37:07 +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 80ce13e44e Move base_width and base_height from Con to Window
relates to #665
2015-08-30 22:48:37 +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 bf3cd41b5d Use libxkbcommon for translating keysyms, support all XKB groups.
fixes #1835

This commit improves the translation of keysyms to keycodes by loading
keymaps using libxkbcommon-x11 and using libxkbcommon for figuring out
the keymap, depending on each keybinding’s modifiers. This way, the
upper layers of complex layouts are now usable with i3’s bindsym
directive, such as de_neo’s layer 3 and higher.

Furthermore, the commit generalizes the handling of different XKB
groups. We formerly had support only for two separate groups, the
default group 1, and group 2. While Mode_switch is only one way to
switch to group 2, we called the binding option Mode_switch. With this
commit, the new names Group1, Group2 (an alias for Mode_switch), Group3
and Group4 are introduced for configuring bindings. This is only useful
for advanced keyboard layouts, such as people loading two keyboard
layouts and switching between them (us, ru seems to be a popular
combination).

When grabbing keys, one can only specify the modifier mask, but not an
XKB state mask (or value), so we still dynamically unbind and re-bind
keys whenever the XKB group changes.

The commit was manually tested using the following i3 config:

    bindsym Group4+n nop heya from group 4
    bindsym Group3+n nop heya from group 3
    bindsym Group2+n nop heya from group 2
    bindsym n nop heya
    bindsym shift+N nop explicit shift binding
    bindsym shift+r nop implicit shift binding
    bindcode Group2+38 nop fallback overwritten in group 2 only
    bindcode 38 nop fallback

…with the following layout:

    setxkbmap -layout "us,ua,ru,de" -variant ",winkeys,,neo" \
      -option "grp:shift_caps_toggle,grp_led:scroll" \
      -model pc104 -rules evdev

By default (xkb group 1, us layout), pressing “n” will result in the
“heya” message appearing. Pressing “a” will result in the “fallback”
message appearing. “j” is not triggered.

By pressing Shift+CapsLock you switch to the next group (xkb group 2, ua
layout). Pressing “a” will result in the “fallback overwritten in group
2 only” message, pressing “n” will still result in “heya”. “j” is not
triggered.

In the next group (xkb group 3, ru layout), pressing “a” will result in
the “fallback” message again, pressing “n” will result in “heya”,
“j” is not triggered.

In the last group (xkb group 4, de_neo layout), pressing “a” will still
result in “fallback”, pressing “n” will result in “heya”, pressing “j”
will result in “heya from group 4”.

Pressing shift+n results in “explicit shift binding”, pressing shift+r
results in “implicit shift binding”. This ensures that keysym
translation falls back to looking at non-shift keys (“r” can be used
instead of ”R”) and that the order of keybindings doesn’t play a role
(“bindsym n” does not override “bindsym shift+n”, even though it’s
specified earlier in the config).

The fallback behavior ensures use-cases such as ticket #1775 are still
covered.

Only binding keys when the X server is in the corresponding XKB group
ensures use-cases such as ticket #585 are still covered.
2015-08-26 09:56:42 +02:00
Michael Stapelberg 419b73be9e Merge pull request #1816 from tcreech/tcreech-for-illumos
Changes for compiling i3 on Illumos
2015-08-04 00:10:06 -07:00
shdown bc52fae15c libi3: change scalloc() signature to match calloc() 2015-08-03 12:50:13 +03:00
Tim Creech f41018b33e Changes for compiling on Illumos
* common.mk: use -lsocket -liconv -lgen on Illumos/Solaris
* mkdirp: return int and accept a mode argument
* use i3's mkdirp on everything except Illumos
2015-07-30 07:44:10 -04: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
Michael Stapelberg 8df7e4ecb9 Merge pull request #1747 from Airblader/feature-1723
Implement "title_format"
2015-06-29 00:24:59 -07: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
Michael Hofmann bad4203755 Configurable tray padding. 2015-06-28 00:14:37 +02:00
Michael Stapelberg 696d844ffa Merge pull request #1697 from Airblader/feature-1695
Extend mouse commands on i3bar
2015-06-18 20:50:56 +02:00
Ingo Bürk 9eb255d5fa Ensure format of dumped bindings for i3bar is compatible with i3 bindings.
fixes #1695
2015-06-18 19:28:24 +02:00
Ingo Bürk 9940571069 Fix documentation for border styles. 2015-06-12 17:54:54 +02:00
Ingo Bürk 2b6f76852c Implement i3's logic for maintaining a list of 'bindsym' directives and passing it to i3bar through the IPC. 2015-06-05 12:30:53 +02:00
Ingo Bürk ab12d3fc74 Add new command skeleton 'bindsym <button> <command>' for 'bar' block. 2015-06-05 12:30:53 +02:00
Ingo Bürk 9b691bcca2 Introduce a config directive 'binding_mode' in the 'bar' config, pass it through the IPC and parse it in i3bar. 2015-05-31 16:49:09 +02:00
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
Michael Stapelberg be2634c91f Merge pull request #1693 from mh21/wm-class-garbage-no-copy
Don't duplicate property value on class change.
2015-05-06 23:55:47 -07:00
Michael Hofmann 0319bda1d4 Introduce sstrndup wrapper. 2015-05-06 16:33:15 +02:00
Michael Stapelberg 66a1fa7d46 Merge pull request #1638 from hwangcc23/fix-1489
Add a timeout: delay_exit_on_zero_displays
2015-05-05 00:43:43 -07:00
Ingo Bürk ffe25d9e43 Set the _NET_WM_STATE_HIDDEN atom on windows that are currently not visible due to being in the non-focused tab of a stacked or tabbed container.
fixes #1648
2015-04-21 09:14:22 +02:00
Ingo Bürk d12482e5fd Added 'con_is_hidden' to check whether a given container is visible to the user assuming its workspace is visible.
This is useful for determining whether we want to set the _NET_WM_STATE_HIDDEN atom on the window.
2015-04-21 09:13:48 +02:00
Michael Stapelberg 67ec2333ee Merge pull request #1665 from Airblader/feature-1658
Added criterion 'window_type'
2015-04-21 08:42:16 +02:00
Deiz 884214f14f Update copyright notices and get rid of ranges
The script used to make these changes can be found at:

   https://gist.github.com/Deiz/32322020f76d23e2bf8f
2015-04-20 17:50:21 -04:00
Ingo Bürk 1f472b454c Handle changes to _NET_WM_WINDOW_TYPE after the window has been managed. 2015-04-20 19:27:43 +02:00
Ingo Bürk 550c0ec318 Implement new criterion 'window_type = normal|dialog|utility|toolbar|splash|menu|dropdown_menu|popup_menu|tooltip'
fixes #1658
2015-04-20 19:27:39 +02:00
Ingo Bürk 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 c4a84385d6 added function 'con_by_mark' to look up a con holding the given mark 2015-04-19 20:57:49 +02:00
Ingo Bürk 9613a0744d Added configuration directive for 'move [container|window] [to] mark <str>' 2015-04-19 20:57:44 +02:00
Michael Stapelberg 8a608ee63a Merge pull request #1632 from Deiz/binding-border
Add a --border flag to enable mouse binds to trigger on border click
2015-04-19 09:28:08 -07:00
hwangcc 2c77d7ceed Add a timeout: delay_exit_on_zero_displays
Outputs may disappear momentarily and come back later.
To prevent i3 from exit when no output is available momentarily, add a timeout delay_exit_on_zero_displays.
2015-04-11 22:13:10 +08:00
Deiz cd4bc2adf5 Store Git commit identifier in its own object
Fixes #1640
2015-04-06 18:28:40 -04:00
Deiz ce48d5c5d7 Add a --border flag to enable mouse binds to trigger on border click 2015-04-02 16:24:05 -04:00
Ingo Bürk b5f7c132fc Added config directive 'no_focus <criteria>' (#1416) 2015-04-01 20:46:56 +02:00
Ingo Bürk e155447932 Added assignment type 'A_NO_FOCUS' (#1416)
Any assignment with type 'A_NO_FOCUS' will cause the matched window to not be focused by i3 when it is managed.
2015-04-01 20:46:55 +02:00
Ingo Bürk 245a29e233 Make show_marks configurable
Introduce a config directive "show_marks [yes|no]" to en- or disable drawing marks on window decorations.
To not change the look & feel of existing configurations, the default is "no".
2015-03-30 23:11:50 +02:00
Ingo Bürk 2af1a80028 Introduce a cached boolean for changes to the mark of a window.
This is necessary to correctly redraw window decorations when the mark of
a window is added or removed.
2015-03-30 23:08:25 +02:00
Michael Stapelberg 0ad097ee67 Merge pull request #1613 from Airblader/feature-1426
Added focus_on_window_activation directive
2015-03-30 22:58:16 +02:00
Ingo Bürk 9bf161710b Added 'focus_on_window_activation' directive
When a window receives a _NET_ACTIVE_WINDOW message, it can steal the focus. This may not be preferable to all users.
With this directive, the user can choose from one of the following:
1) 'smart' - focus the container if its workspace is visible, otherwise set the urgency flag (default)
2) 'urgent' - always set the urgency flag, do not steal focus
3) 'focus' - always switch focus, never set the urgency hint
4) 'none' - ignore the request entirely (do not switch focus, nor set the urgency hint)

fixes #1426
2015-03-30 22:09:36 +02:00
Deiz c6581a5fd6 Handle floating centering in one function and test for consistency 2015-03-30 16:03:35 -04:00
Deiz e622c42ef0 Move mkdirp into libi3 2015-03-29 17:18:00 -04: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 4daed31c3e Move resolve_tilde and get_config_path into libi3 2015-03-29 14:45:42 -04:00
Michael Stapelberg 93adcf8bdc Merge pull request #1575 from hwangcc23/next
Fix warnings
2015-03-29 16:53:14 +02:00
hwangcc 42515308e7 Add a safe wrapper for write and fix some warnings
1. Add a function writeall and make swrite wrap that function. Use either writeall or swrite, depending on whether we want to exit on errors or not.
2. Fix warnings when compiling with a higher optimisation level.
(CFLAGS ?= -pipe -O3 -march=native -mtune=native -freorder-blocks-and-partition)

Signed-off-by: hwangcc <hwangcc@csie.nctu.edu.tw>
2015-03-29 10:22:34 +08:00
Ingo Bürk 80da100ac8 Add support for a custom separator symbol
This introduces a "separator_symbol" property for the i3bar configuration.
If set, the specified string will be used as a separator instead of a vertical line. Since it is an optional configuration, complete backwards compatibility is given.

fixes #1472
2015-03-25 21:38:55 +01:00
Tony Crisci e681f34ec1 i3bar: set markup per block
Add `markup` to the i3bar protocol as a block member.

This is a string that determines how the block should be parsed as
markup. "pango" indicates the block should be parsed as Pango markup.
"none" indicates the block should not be parsed as markup.
2015-03-24 02:27:38 -04:00
Ingo Bürk 8272924117 Introduce a function to copy i3strings 2015-03-23 11:03:45 +01:00
Michael Stapelberg d9c2ce0023 Merge pull request #1553 from Airblader/feature-remove-output-assignment
Remove the A_TO_OUTPUT option
2015-03-16 22:40:25 +01:00
Ingo Bürk 52f918309b Remove the A_TO_OUTPUT option as it is not needed anymore and will not be implemented in favor of normal assignments. 2015-03-16 20:18:03 +01:00
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 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
Diana Thayer 94b1e76af4 degendered terms 2015-03-11 21:41:43 -07:00
Michael Stapelberg d551618cf0 Revert "Handle WM_CHANGE_STATE requests for iconic state"
This reverts commit 136b3e345b.

fixes #1516
2015-03-07 11:47:01 +01:00
Ingo Bürk eb73059c61 Refactor functions for easy reuse 2015-03-04 09:22:25 +01:00
Tony Crisci e18e2b9f98 i3bar: use Pango markup
Parse text within workspace buttons and the i3bar statusline as Pango
markup. This lets people specify things like font weight, text color,
background color, font size, and font family in the text of i3bar.

fixes #1468
2015-02-12 14:45:34 -05:00
Michael Stapelberg fbe25297b7 Properly invalidate rendering cache when updating orientation (Thanks hercek)
fixes #1445
2015-02-11 21:13:55 +01:00
Michael Stapelberg 5cf1a0c43b Merge pull request #1462 from carrotIndustries/netwm_moveresize
Support _NET_WM_MOVERESIZE
2015-02-11 20:30:05 +01:00
Lukas K 1c5ab5fa36 Support _NET_WM_MOVERESIZE
Add support for the _NET_WM_MOVERESIZE client message. This message
enables clients to initiate window moving or resizing. Toolkits like
Gtk3 use this message when the user drags a client-side decorated window
by its title bar. When Gtk detects that the window manager does not
support this client message, it uses a slow fallback implementation.

fixes #1432
2015-02-11 00:07:28 +01:00
Tony Crisci e91a9174e2 libi3: free previous font on font load
When loading a new font with `load_font`, free the previously loaded
font with `free_font`.

If no font is loaded, `free_font` will simply return (instead of
crashing because of a double free).
2015-02-10 15:11:40 -05:00
Tony Crisci 74b69d6d02 Add mouse binding pointer position configuration
Add the `--whole-window` switch for mouse bindings. This switch controls
what part of the container the pointer must be over to trigger a mouse
binding. The default is to only trigger mouse bindings over the
titlebars. With this switch, a mouse binding will be triggered over the
main part of the window as well.

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

fixes #1429
2015-01-31 21:29:48 +01:00
Tony Crisci 69dd8ce398 Fix start_application() doc about which shell is used
Since this commit:

f691a55923

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

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

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

    fullscreen enable|toggle [global]
    fullscreen disable

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

    fullscreen [global]

fixes #1120
2014-12-10 20:42:52 +01:00
Tony Crisci 8d031bfbf8 Handle _NET_CLOSE_WINDOW client message requests
> Pagers wanting to close a window MUST send a _NET_CLOSE_WINDOW client
> message request to the root window.

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

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

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

This fixes a crash when the command `reload` is used in a binding when
the binding event is emitted.
2014-11-16 23:36:27 +01:00
Tony Crisci fbaf084426 Implement the ipc 'binding' event
The binding event will be triggered when a binding is run as a result of
some a user action. The binding event has the following properties:

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

binding: (map) the serialized binding

The "binding" member will have these properties:

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

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

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

command: (str) the bound command

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

fixes #1210
2014-10-03 09:35:37 +02:00
Michael Stapelberg ea2552e852 Bugfix: use the command parser to properly extract workspace names
fixes #1377
2014-10-01 22:50:48 +02:00
aszlig 9058fc44e6 Allow to validate the config file without X.
We're going to call parse_configuration() very early if -C is given on
the command line. Instead of the previous "only_check_config", which has
been a global variable, we now simply pass use_nagbar as false if we're
just validating.

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

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

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

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-08-25 19:34:26 +02:00
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 8e23dc881b i3bar: implement custom mouse wheel commands
Users can specify a command to run when a button was pressed on i3bar to
override the default behavior. Currently only the mouse wheel buttons
are supported. This is useful for disabling the scroll wheel action or
running scripts that implement custom behavior for these buttons.

Example:

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

fixes #1104
2014-07-10 22:40:12 +02:00
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 136b3e345b Handle WM_CHANGE_STATE requests for iconic state
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.4

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

For these requests, we just close the window.

fixes #1279
2014-06-24 09:39:12 +02:00
Tony Crisci 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 4205973135 feature: implement ewmh desktop viewport property
Set and update the _NET_DESKTOP_VIEWPORT property

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

> _NET_DESKTOP_VIEWPORT x, y, CARDINAL[][2]/32
> Array of pairs of cardinals that define the top left corner of each
> desktop's viewport.
2014-06-23 21:29:57 +02:00
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
Michael Stapelberg 3f5a0f0024 Switch to xcb-xkb and libxkbcommon
This removes our last dependency on Xlib! :)

(Okay, an Xlib dependency still comes in through other libraries that we
 link against, but it’s not us. Our code is simpler by this change and
 uses one less connection to X11.)
2014-06-21 19:10:37 +02:00
Tony Crisci 0df172fd05 Feature: implement mouse bindings
A configured mouse binding (for example `bindsym button3 kill`) runs
its command when the mouse button is pressed over parts of a container.

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

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

fixes #558
2014-06-19 12:28:54 +02:00
Tony Crisci 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 2e4a2d4f30 Bugfix: don’t overwrite the original size of floating windows when changing border style
fixes #1263
2014-06-13 22:19:23 +02:00
Tony Crisci 7482a0f642 Add abstraction for running a binding
Add run_binding function to bindings.h.

> Runs the given binding and handles parse errors. Returns a
> CommandResult for running the binding's command. Caller should render
> tree if needs_tree_render is true. Free with command_result_free().
2014-06-01 11:55:01 +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
Atte Peltomaki 62ea60ba42 Add configuration option for disabling mouse warping
This patch adds a new configuration option "mouse_warping [output|none]".

When mouse warping is disabled, mouse cursor does not jump to middle of current
screen when changing workspaces between multiple outputs. This introduces a
"special" cursor state, where focus is in one window and cursor on another.
Useful for eg. scrolling a web page with mouse wheel while typing into another
window on keyboard.
2014-05-31 14:55:29 +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
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
Aleksi Blinnikka 89dd868e82 Separate border width for floating windows
Floating windows already had their own border style, but the width was
the same for all windows.

The configuration directives 'new_window' and 'new_float' can now be
used simultaneously to have different border widths for floating and
tiled windows.

fixes #1244
2014-05-16 17:59:21 +02:00
Tony Crisci e707e0a5fa i3bar: implement custom workspace numbers config
Implement the configuration option within the bar config directive for
custom workspace numbers with the directive `strip_workspace_numbers
yes`.

This directive strips the workspace name of the number prefix and
delimiter. When the workspace name consists only of the number, it will
default to show the number.

For example:

* "2:5" -> "5"
* "4:$" -> "$"
* "8" -> "8"

This allows customization of i3bar for alternate ordering of workspaces
which has a legitimate use for alternate keyboard layouts such as
Dvorak.

fixes #1131
2014-05-16 17:55:30 +02:00