Commit Graph

151 Commits (e4629d678e512d1bc5089d95c47e8f23b39bd10f)

Author SHA1 Message Date
Tony Crisci 48ec79ca02 Move grab_all_keys to bindings.[ch]
Also add checks for binding input_type to filter bindings that are not
keyboard bindings.
2014-02-15 12:55:38 +01:00
Peter Boström 9c15b9504e Fix clang -Wextra except -Wunused-parameter.
Cleared all warnings that occur when passing
CFLAGS="-Wall -Wextra -Wno-unused-parameter" to make using clang 3.3 on
Linux x86-64.
2014-01-02 22:15:33 +01:00
Michael Stapelberg 35b70ca423 introduce client.placeholder color 2013-12-22 21:52:49 +01: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
Michael Stapelberg a5c9b0dedb Merge branch 'master' into next 2013-01-24 14:45:14 +01:00
Michael Stapelberg 2eb4ed95bc Bugfix: fix “overlapping” --release key bindings (Thanks phlux)
We eagerly marked all KeyRelease bindings as eligible to match without
checking modifiers, while this should only be allowed for the key
binding which actually was pressed.

fixes #915
2013-01-24 14:44:01 +01:00
Michael Stapelberg c127ac3855 remove all references to the old cfgparse 2012-12-24 15:57:02 +01:00
Deiz 7a280f5691 Grab keys with all permutations of lock and numlock
This should prevent all cases of caps lock (or shift lock, on some
keyboards) from interfering with i3 key bindings.
2012-10-09 21:15:06 +02:00
Yaroslav Molochko 04c58c7325 Implement variable border widths for pixel/normal
fixes #325
2012-09-24 22:20:29 +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
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 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 f44d4ce4b3 re-indent src/config.c 2012-09-06 15:55:38 +02:00
Fernando Tarlá Cardoso Lemos ec17a26b0e libi3: Rework font to support multiple backends 2012-08-13 11:39:29 +02:00
Michael Stapelberg 884627ef20 use I3__FILE__ for DLOG, leave __FILE__ as is
See also commit 0e752070ac, which broke
source code listings in gdb unless you cd into i3/src. This should give
us best of both :-).
2012-08-12 12:19:47 +02:00
Michael Stapelberg 0e752070ac explicitly set filenames to $(basename __FILE__)
This makes the debug log a bit more readable, especially since commit
48f1e383ca
2012-08-07 09:55:52 +02:00
Michael Stapelberg 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 e04628e581 Error message was missing a slash 2012-02-07 17:38:45 -05:00
Michael Stapelberg f9bc434e2a Implement highlighting right/bottom borders of splitted windows
Fixes #299
2012-01-22 11:22:15 +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 a2031a8894 Log the configfile name in verbose log, not only debug log (Thanks Han) 2011-12-29 00:04:48 +01:00
Michael Stapelberg 4412ccbe5a Merge branch 'master' into next 2011-12-17 22:35:13 +00:00
Michael Stapelberg 7a80d903a5 keygrabbing: only look in the appropriate columns when resolving keysyms
Fixes: #585

This commit fixes the problem of i3 wrongly grabbing/interpreting (!) some key
bindings. Basically, when you have, say, "bindsym Mod1+4 workspace 4", but you
also have "bindsym Mod1+semicolon focus right" (both are default), and your
keyboard layout has semicolon on Mode_switch + 4, the "workspace 4" keybinding
was shadowed by the "focus right" keybinding, because that also resolves to
semicolon.

So, from now on, i3 will only consider column 0 and 1 for normal bindings and
column 2 and 3 for bindings using Mode_switch (columns as seen in xmodmap
-pke).
2011-12-17 22:31:21 +00:00
Michael Stapelberg 76202a824d re-indent translate_keysyms() 2011-12-17 22:28:28 +00:00
Jan-Erik Rediger f23d675de9 Implement new "i3bar_command" option for bar.
This allows you to specify an alternate path to the i3bar binary.
The userguide docu is included.
2011-11-27 21:40:57 +00:00
Fernando Tarlá Cardoso Lemos 340592a532 Invalidate cached pixmaps on reload and redraw.
After a reload, the drawing parameters for the decorations might
have changed, so we need to invalidate the cache and force a redraw
of the currently visible decorations. Also, don't leak the previous
font when reloading by freeing it before parsing the config.
2011-11-26 21:51:49 +00:00
Fernando Tarlá Cardoso Lemos 5c2088c87e Enhance libi3 and use it in i3bar.
Abstracted draw_text and predict_text_width into libi3. Use
predict_text_width from libi3 in i3 too. This required tracking
xcb_connection in a xcb_connection_t *conn variable that libi3
expects to be available in i3bar.
2011-11-21 20:52:26 +00:00
Michael Stapelberg 9d15a00ba8 introduce sasprintf() in libi3, use it everywhere 2011-10-23 13:16:56 +01:00
Michael Stapelberg 42d355f2b7 normalize modelines/headers across src/*.c 2011-10-22 23:40:02 +01:00
Michael Stapelberg ad0f13a0a9 Clean bars before reloading the config (+test)
While the configuration gets updated in i3, the i3bar processes will not pick
up these changes. We have to think about a good way to do that.
2011-10-20 18:47:09 +01:00
Michael Stapelberg c2c6ca25d5 Make the barconfig list a TAILQ 2011-10-18 22:11:27 +01:00
Michael Stapelberg 4898f78e5e add a data structure for 'bar' configuration 2011-10-18 19:05:49 +01:00
Michael Stapelberg dc790cfa32 Bugfix: Correctly free old assignments when reloading
Fixes #516
2011-09-11 23:41:46 +01:00
Michael Stapelberg f3716e45cf re-indent load_configuration() 2011-09-11 23:31:06 +01:00
Mateusz Poszwa 42db9de7ec Add new_float config option.
This option sets the default border style for containers automatically put into floating mode.

Fixes #264
2011-08-09 09:29:53 +02:00
Peter Bui 5e06b1b21d Fix some potential memory leaks 2011-08-09 09:27:15 +02:00
Michael Stapelberg c9194b4297 Bugfix: Correctly bind on multiple keycodes if a symbol has more than one (Thanks ubitux) 2011-08-02 10:47:03 +02:00
Michael Stapelberg 3f7c7c2e38 remove left-over wordexp.h include 2011-07-23 22:37:41 +02:00
Michael Stapelberg 39b1c1bf75 Re-implement the 'mode' command 2011-06-10 02:38:07 +02:00
Michael Stapelberg b342d387a8 Handle saved_configpath in get_config_path, fix memleak in current_configpath handling, update atoms after reloading (Thanks fernandotcl) 2011-03-19 22:26:15 +01:00
Michael Stapelberg 626c65b0d8 Bugfix: correctly store the config path for using it for I3_CONFIG_PATH later 2011-03-19 21:50:13 +01:00
Michael Stapelberg 65a3259b3c Set the I3_SOCKET_PATH and I3_CONFIG_PATH atoms on the X11 root window 2011-03-19 21:20:38 +01:00
Simon Kampe 2f992f5c0e Added config key for default orientation of containers (new_container_orientation) and added support in randr.c for automatically changing the orientation when user does a xrandr rotate. 2011-03-17 17:43:35 +01:00
Fernando Tarlá Cardoso Lemos b8a716c370 Reload the same config file specified in the command line.
Fixes: #346
2011-03-14 16:48:45 +01:00
Michael Stapelberg f162e7efaa refactor font caching to just save the ID instead of mainting a cache with pattern→id-mapping 2011-03-10 23:20:17 +01:00
Fernando Tarlá Cardoso Lemos c88c3e3ab2 Default to a file in /tmp for the restart state.
The file is now created in /tmp using the process PID and the
username of the user running i3. The restart state file is only
loaded when restarting (the --restart option is appended to the
command line prior to the restart). That means that renaming the
old state file with the ".old" extension is no longer needed.

This "--restart" switch is supposed to be only used by i3. The
"-L" switch can be used to load a layout (and not delete it
afterwards). We unlink the state file after we load it so that
we don't keep cruft in /tmp or try to restart from an old config
file if restart_state is set.
2010-12-27 13:33:03 +01:00
Fernando Tarlá Cardoso Lemos 68f906f278 util.c is the proper place for those functions. 2010-12-27 13:28:17 +01:00
Fernando Tarlá Cardoso Lemos a1dd74da5a Implement default border styles (thanks litemotiv). 2010-12-27 13:10:45 +01:00
Fernando Tarlá Cardoso Lemos 0a17fe973c Make the restart path configurable. 2010-11-28 01:18:10 +01:00
Fernando Tarlá Cardoso Lemos bfa12a5819 Port the path resolution and config loading code from -next. 2010-11-15 14:00:46 +01:00
Michael Stapelberg 4cd6dd0303 port fernando’s custom background color patch 2010-11-13 20:07:49 +01:00
Michael Stapelberg 8e5a831e27 re-add focus follows mouse handling 2010-04-13 18:43:37 +02:00
Michael Stapelberg c145f7e529 first step of the big refactoring ("tree" branch).
From here on, we can track changes. It made no sense to put the
development up to this point into git.
2010-04-13 13:17:39 +02:00
Michael Stapelberg 1b8299002e Bugfix: Translate keysyms to keycodes before entering mode (Thanks fallen) 2010-03-25 21:18:46 +01:00
Michael Stapelberg 6699d54640 Fix rendering of workspace names after "reload" (Thanks fallen) 2010-03-25 19:08:37 +01:00
Michael Stapelberg 0bb1b718d1 Fix compilation with the old xcb keysyms api 2010-03-19 16:02:33 +01:00
Michael Stapelberg c738b2e454 Don’t use SYNC key bindings for Mode_switch but re-grab keys
Before this commit, i3 used key bindings in SYNC mode for bindings
like Mode_switch + <a> and replayed the key if the current state
did not include Mode_switch. This had some problems:

1) The WM needed to acknowledge much more key presses than you
   actually had bindings for, thus making the system a bit laggy
   sometimes.
2) Users of layouts who constantly type in the third level (like
   russian layouts) did not get their cyrillic symbols correctly
   (they were not replayed right), neither did the keybindings
   work in both modes.

So, the current implementation uses the following approach: XKB
provides an event which contains the current state (including
the current level). i3 signs up for this event and upon receival,
it re-maps the bindings using Mode_switch (enables them when the
level goes to the third level and disables them as soon as the
level goes back to normal). This fixes both problems.
2010-03-14 22:40:58 +01:00
Michael Stapelberg 7c130fb540 Obey the XDG Base Directory Specification for config file paths
This means you can now put your i3 config into
$XDG_CONFIG_HOME/i3/config, which probably is ~/.config/i3/config
if not set otherwise.
2010-01-03 16:58:41 +01:00
Michael Stapelberg 6ef0d1fa79 Touch each log message and classify it as DLOG (debug), ELOG (error) or LOG (verbose) 2009-12-19 22:40:23 +01:00
Michael Stapelberg 17082ef5b7 Bugfix: close file handle after parsing 2009-12-11 17:57:42 +01:00
Michael Stapelberg 4ace0d2138 config: delete old parser, new lexer/parser is the default by now 2009-11-22 20:25:33 +01:00
Michael Stapelberg d266474f97 Remove the terminal option from config.
The welcome message is displayed using xmessage(1), not using your
terminal. Thus, it makes no sense to have this option anymore. Also,
the new lex/yacc parser cannot correctly handle the situation:
normal variables are expanded before parsing the file. As a replacement,
you can use:
  set $terminal /usr/bin/urxvt
2009-11-13 20:36:59 +01:00
Michael Stapelberg 037605e34c Use nicer colors for focused_inactive by default 2009-11-06 18:41:17 +01:00
Michael Stapelberg 2a0b1adab9 Also support xcb-keysyms < 0.3.4 when using bindsym (Thanks ch3ka) 2009-11-02 23:15:08 +01:00
Michael Stapelberg 2b70e05ee9 Refactor workspaces to be stored in a TAILQ instead of an array
This fixes many problems we were having with a dynamically growing
array because of the realloc (pointers inside the area which was
allocated were no longer valid as soon as the realloc moved the
memory to another address).

Again, this is a rather big change, so expect problems and enable
core-dumps.
2009-09-29 19:45:41 +02:00
Michael Stapelberg 8f67eba044 Implement modes. Modes allow you to use different keybindings and switch between them.
For example, you can create a mode which will let you resize windows
with some easy to use keys. So, instead of binding a combination
of your homerow and modifiers to resize, like this:

	bind Mod4+44 resize right +10
	bind Mod4+45 resize right -10
	...

You can instead define a new mode:

	mode "resize" {
		bind 44 resize right +10
		bind 45 resize right -10
		...
		bind 36 mode default
	}

	bindsym Mod4+r mode resize

So, if you press Mod4+r now, your keybindings will be set to the ones
defined in your resize mode above. You can then use your homerow
(without any other modifier) to resize the current column/row and
press enter to go back to the default mode when you are done.

Note that using this option requires you to enable the new lexer/parser
by passing the -l flag to i3 when starting.
2009-09-27 18:45:39 +02:00
Michael Stapelberg 97d949d16c Bugfix: Correctly re-grab keys when using the new lexer 2009-09-27 18:45:17 +02:00
Michael Stapelberg f38809288a Make number of workspaces dynamic (no longer limited by 10)
Warning: This is not yet thoroughly tested, so be prepared to
encounter some segfaults. Please enable logging and coredumps,
so we can fix bugs quickly.
2009-09-27 14:00:54 +02:00
Michael Stapelberg b898058105 Fix some compilation warnings (Thanks mxf) 2009-09-26 13:30:32 +02:00
Michael Stapelberg ca472559b9 Finish configfile parsing with lexer, implement -l to use the lexer.
Every user is encouraged to use -l to switch to the new lexer and
see if there are any problems.
2009-09-19 19:05:15 +02:00
Michael Stapelberg 2ff2a6a315 Implement the urgency hint for windows/workspaces
Thanks to Mikael for bringing it to my mind. This change introduces
two new color classes, client.urgent and bar.urgent. By default,
urgent clients are drawn in red (colors by Atsutane).
2009-09-06 22:40:11 +02:00
Michael Stapelberg a8352a8988 Merge patches for OpenBSD compatibility 2009-09-02 22:25:50 +02:00
Michael Stapelberg 2b49c6086d Bugfix: Don’t display unnamed workspaces with %d: (Thanks Mirko) 2009-08-29 11:06:34 +02:00
Michael Stapelberg 0b7a27ea79 initialize last_keycode 2009-08-19 14:37:34 +02:00
Michael Stapelberg 44d9111d65 More log cleanups 2009-08-11 15:23:58 +02:00
Michael Stapelberg 47a798ac4a Implement assignments of workspaces to screens, big cleanup of workspace code
Please test this! Plug in screens, unplug them, use your video projector,
change resolutions, etc.

To use the assignments, use the following syntax:
workspace <number> [screen <screen>] [name]

Where screen can be one of:
<number> (It is not provided that these numbers stay constant, so use with care)
<x>x<y> (Coordinates where the screen starts, so 1280 will be fine to match the
	 screen right of the main screen if your main screen is 1280 pixels
	 width. However, 1281 will not match)
<x>
x<y>

Some examples follow:

 workspace 1 screen 0
 workspace 1 screen 1
 workspace 1 screen 1280x0
 workspace 2 screen 1280
 workspace 3 screen x0
 workspace 3 screen 1 www
 workspace 4 screen 0 mail
2009-08-08 19:51:51 +02:00
Michael Stapelberg 6192975a04 Bugfix: Don’t crash when the font is specified after the workspace names in configfile (Thanks xiaodong) 2009-08-07 15:48:13 +02:00
Michael Stapelberg 7cdaa1b277 Implement support for using key symbols in configuration file
Use "bindsym" instead of "bind". You have to use the names of keys
as in xmodmap. To get a list of currently bounud symbols, use
xmodmap -pke

Technical quirk: Xlib generated MappingNotify events upon
XkbMapNotify events (from XKB, as the name says). XCB does not yet
have support for XKB, thus we need to select and handle the event
by ourself. Hopefully, this will change in the future.
2009-08-07 15:35:12 +02:00
Michael Stapelberg e7bf93163d Make path configurable 2009-07-28 22:09:53 +02:00
Michael Stapelberg e6198ad6c8 Some little fixes for bapt’s patch, use predict_text_width, support UTF8, pre-render workspace names 2009-07-28 13:55:09 +02:00
Bapt ddcb11baba Implements configurable named workspaces 2009-07-28 13:08:03 +02:00
Michael Stapelberg ce501c9de9 Some fixes/reformatting for bapt’s patch 2009-07-23 20:36:48 +02:00
bapt 40750e227d Implements a reload command 2009-07-23 18:46:21 +02:00
Michael Stapelberg ffcc8bbc3a Implement putting clients into floating mode at a specific workspace
This changes syntax of the assign command a bit. Old configurations
will continue to work. See the userguide.
2009-07-21 16:43:20 +02:00
Michael Stapelberg 008a2665c1 Bugfix: Strip trailing whitespace when parsing assignments (Thanks bapt) 2009-07-21 16:05:43 +02:00
Michael Stapelberg 62c8d58d82 Implement the configuration option floating_modifier and document it 2009-06-24 20:31:00 +02:00
Michael Stapelberg 325d1b301f Implement the special workspace ~ for assignments, which will set clients floating automatically 2009-06-19 20:20:00 +02:00
Michael Stapelberg 70be57352c Fix memleak in config parsing (variables weren’t freed) 2009-06-11 03:30:42 +02:00
Michael Stapelberg e689be983b Implement variables in configfile.
This implements ticket #42.

Syntax is "set $key value". All further instances of $key will be
replaced with value before parsing each line of the configfile.
2009-06-01 16:19:06 +02:00
Michael Stapelberg 2a67630aa6 Optimization: Get the colorpixels when loading configuration, make use of the new config struct
Instead of building arrays of colorpixels we can simply use a pointer
to a struct Colortriple. Furthermore, by getting the colorpixels when
loading the configuration, we save a lot of function calls in the
main code.
2009-06-01 15:14:45 +02:00
Michael Stapelberg 517c47ca95 Don’t check twice for client.focused, change all places were colorcodes are used 2009-05-31 17:18:49 +02:00
Michael Stapelberg 706c44509e retab! src/config.c 2009-05-30 22:24:05 +02:00
Michael Stapelberg cbc3880007 Use a more efficient struct for storing colors, validate/parse them more easily 2009-05-30 22:20:32 +02:00
Atsutane 65bcf170ed Introduced color setting. 2009-05-30 17:59:04 +02:00
Michael Stapelberg b0cf3ec026 Document binding on Mode_switch in userguide, be more verbose in config 2009-05-26 17:37:56 +02:00
Michael Stapelberg e79cca8f72 Implement putting clients onto specific workspaces ("assign" in the configfile)
This closes ticket #39
2009-05-16 17:32:36 +02:00
Michael Rudolf 3400f0e6bd Implement autostart using "exec" in config
Syntax is "exec <application>", like when creating a binding.
Multiple entries are possible, applications are started in
the specified order.
2009-05-05 20:14:02 +02:00
Michael Stapelberg 96ac9f9066 Implement slog() and the LOG() macro, convert printf() to LOG() 2009-03-06 06:46:43 +01:00
Michael Stapelberg 415b5cc0e8 Load configuration file from ~/.i3/config or /etc/i3/config 2009-03-04 09:16:18 +01:00