Commit Graph

519 Commits

Author SHA1 Message Date
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
Michael Stapelberg
966c654112 implement the GET_LOG_MARKERS IPC request/reply 2011-12-10 11:16:32 +00:00
Michael Stapelberg
aa82adb5c0 Introduce --shmlog-size flag, unlink SHM log when exiting 2011-12-10 10:51:55 +00:00
Michael Stapelberg
e65ee63763 Implement logging to a SHM ringbuffer
This feature is automatically enabled when running a debug version of i3.
The logfile will use 1% of your physical RAM size, but at max 25 MiB.
2011-12-10 10:50:33 +00:00
Michael Stapelberg
6c112f2a9a Merge branch 'master' into next 2011-11-30 20:34:54 +00:00
Michael Stapelberg
d25e77ce75 Don’t set the _NET_WM_WORKAREA hint at all (Thanks cg)
Fixes: #539
2011-11-30 20:33:07 +00:00
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
Michael Stapelberg
555dd48f09 Merge branch 'master' into next 2011-11-26 21:19:30 +00:00
Michael Stapelberg
970d11709e Bugfix: Retain absolute window position and size when changing floating borders (Thanks binzter)
Fixes: #561
2011-11-26 21:18:23 +00:00
Michael Stapelberg
f7f1ec5dab Merge branch 'master' into next 2011-11-22 22:08:43 +00:00
Michael Stapelberg
0ea64ae404 Fix prototype in include/xcursor.h (Thanks Greg Kroah-Hartman) 2011-11-22 22:08:22 +00:00
Michael Stapelberg
561cf3719f little style fixes 2011-11-21 21:48:24 +00:00
Fernando Tarlá Cardoso Lemos
344c04af12 Implement set_font_colors.
This paves the way for other font rendering backends. Fonts and
colors shouldn't be specified manually from now on.
2011-11-21 20:52:32 +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
Fernando Tarlá Cardoso Lemos
fb11cc2d14 Consolidate all convert_* functions into libi3.
Some minor fixes along the way as well. Very minor stuff, unlikely
to ever be visible to the user.
2011-11-16 20:54:30 +00:00
Michael Stapelberg
ed66a30410 mark parameters const 2011-11-10 19:17:36 +00:00
Michael Stapelberg
332dbfe9c1 Enable (unlimited) core dumps when running i3 development versions
Also prints out useful stuff:

    CORE DUMPS: You are running a development version of i3, so coredumps were
    automatically enabled (ulimit -c unlimited).
    CORE DUMPS: Your current working directory is "/home/michael/i3".
    CORE DUMPS: Your core_pattern is: /tmp/%e.core.%p
    i3 (tree) version 4.0.2-479-g26ab2ac (2011-11-08, branch "next") starting

This does not affect child processes of i3.

The intention of this change is to make debugging easier – it’s one less thing
users of the development version have to worry about when trying to help with
debugging.
2011-11-08 22:49:25 +00:00
Michael Stapelberg
bbfbd28dfa Add a --no-startup-id flag for exec (command), exec (config), exec_always (config) 2011-10-25 22:18:17 +01:00
Michael Stapelberg
726f2a1e5a normalize file headers across **/*.{h,c} 2011-10-25 21:19:38 +01:00
Michael Stapelberg
a58018cf66 Add libi3/load_font, use it everywhere
…except for i3bar, which needs slightly more information about the font
2011-10-23 22:37:11 +01:00
Michael Stapelberg
91134f75c0 Move get_mod_mask to libi3, use it in i3 and i3-config-wizard
Also, the API changed a bit. There are two functions now, both assume you
already got the keysyms (which is the case for i3 and i3-config-wizard),
one gets the modifier mapping for you (aio_get_mod_mask_for) while the other
assumes you also got that. No roundtrips are required for the latter.
2011-10-23 21:26:15 +01:00
Michael Stapelberg
6dc6ba11fc Eliminate xcb_change_gc_single everywhere with C99 2011-10-23 18:06:25 +01:00
Michael Stapelberg
9eda7fb6fb move strndup to libi3 2011-10-23 18:02:01 +01:00
Michael Stapelberg
cb9bbcfccf Move get_colorpixel to libi3, use it everywhere else 2011-10-23 17:38:21 +01:00
Michael Stapelberg
4f57d49318 add libi3/ipc_connect, use it in i3-config-wizard, i3-input, i3bar 2011-10-23 17:18:14 +01:00
Michael Stapelberg
9d15a00ba8 introduce sasprintf() in libi3, use it everywhere 2011-10-23 13:16:56 +01:00
Michael Stapelberg
753d67fb64 migration from exec i3bar to bar config: i3 substitutes exec with a bar block, shows nagbar 2011-10-22 16:33:00 +01:00
Michael Stapelberg
2647f47ec5 bar config: make dock mode the default 2011-10-20 23:38:55 +01:00
Michael Stapelberg
12d866e4f6 Don’t start i3-nagbar when using -C to validate the config 2011-10-20 22:25:59 +01:00
Michael Stapelberg
c2c6ca25d5 Make the barconfig list a TAILQ 2011-10-18 22:11:27 +01:00
Michael Stapelberg
24ede1c834 add an IPC request to get the bar configuration (by ID) 2011-10-18 19:05:49 +01:00
Michael Stapelberg
4898f78e5e add a data structure for 'bar' configuration 2011-10-18 19:05:49 +01:00
Michael Stapelberg
f26a344dfa reformat include/config.h 2011-10-18 19:05:49 +01:00
Michael Stapelberg
178be03fa6 Implement 'workspace back_and_forth' (Patch by Michael Walle) 2011-10-17 23:17:56 +01:00
Michael Stapelberg
5f52c78aa0 Change the root window cursor to 'watch' during startups 2011-10-10 15:54:18 +01:00
Michael Stapelberg
2ad4fbb34a startup: delete the startup sequence upon completion, make the timeout complete it 2011-10-10 15:54:18 +01:00
Michael Stapelberg
ae7dec2774 Move the includes after the include guard, no need to include these files more than once 2011-10-10 15:54:17 +01:00
Michael Stapelberg
4204b8e2b0 Get the _NET_STARTUP_ID in manage_window, get the corresponding workspace 2011-10-10 15:54:17 +01:00
Michael Stapelberg
499d89bdb0 Keep track of startup notifications in a TAILQ, save workspace 2011-10-10 15:54:17 +01:00
Michael Stapelberg
f4f4d782bb implement a startup monitor, move code to src/startup.c 2011-10-10 15:54:17 +01:00
Michael Stapelberg
b9db72dc8a Implement support for startup notifications
This only sets up startup notifications for the 'exec' commands and directives.

Monitoring startups follows later.
2011-10-10 15:54:17 +01:00
Michael Stapelberg
2a29d9c2c1 Make conn_screen available outside of main()
Will be used in other parts of the code for startup notification
2011-10-10 15:54:17 +01:00
Michael Stapelberg
29c185dd0b Move fake_configure_notify to libi3 2011-10-09 13:40:15 +01:00
Michael Stapelberg
b2ad9a77c8 rename the internal function to _workspace_show, add a comment to workspace_show_by_name 2011-10-02 22:03:16 +01:00
Noe Rubinstein
92cc4494aa refactor workspace_show and friends 2011-10-02 21:57:00 +01:00
Michael Stapelberg
046cf99585 Move ipc_send_message and ipc_recv_message to libi3
Make i3-msg and src/ipc.c use it
2011-10-02 18:33:36 +01:00
Michael Stapelberg
501dc36b98 move sstrdup, scalloc, smalloc, srealloc to libi3, improve error messages 2011-10-02 18:09:30 +01:00
Michael Stapelberg
8f5dd749c3 Include libi3.h (Thanks fernandotcl) 2011-10-02 16:41:26 +01:00
Michael Stapelberg
23796ea900 Implement i3 --get-socketpath, useful for IPC scripts
In order to not depend on X11 just for getting the socket paths, scripts or
other programs can now use i3 --get-socketpath. Since i3 must be present on the
computer anyways, this saves one dependency :).
2011-10-02 16:12:10 +01:00
Michael Stapelberg
1481cd95c9 Implement the I3_SYNC client protocol
This is mainly useful for the testsuite. The tests can wait until i3 processed
all X11 events and then continue. This eliminates sleep() calls which leads to
a more robust and faster testsuite.
2011-09-22 23:13:12 +01:00
Michael Stapelberg
1717b88174 Merge branch 'master' into next 2011-09-22 20:11:44 +01:00
Michael Stapelberg
4dbda73114 Bugfix: Correctly revert focus to other floating windows when closing a floating window
Uncovered by the testsuite \o/
2011-09-22 20:10:51 +01:00
Michael Walle
5aa43d61f8 Add force_xinerama configuration option
The configuration option does the same as the commandline parameter, except
it can be easily set by the user (e.g. you are using KDM and can't start a
session through ~/.xsession).

Signed-off-by: Michael Walle <michael@walle.cc>
2011-09-19 23:10:38 +01:00
Michael Stapelberg
b3adaa2983 Implement the window_role criterion (checks WM_WINDOW_ROLE)
Closes: #446

This is handy for matching specific windows of a multi-window application, for
example only Pidgin’s buddy list window.
2011-09-18 16:05:10 +01:00
Michael Stapelberg
7a38d8ac56 Merge branch 'master' into next 2011-09-17 14:13:05 +01:00
Michael Stapelberg
deab3ac338 Send the correct X11 border_width in faked ConfigureNotifys 2011-09-17 14:11:55 +01:00