Commit Graph

133 Commits (9c2b8f8b31dda06a0bd01cab1f12cce41b3d1c13)

Author SHA1 Message Date
Michael Stapelberg c2ccfc7e60 Merge branch 'master' into next 2014-07-11 00:33:13 +02:00
Michael Stapelberg 686a40e384 Bugfix: render bars after the first chunk of JSON (Thanks javier)
fixes #1315
2014-07-11 00:32:42 +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 9200094203 format **/*.c with clang-format-3.5
This has multiple effects:

1) The i3 codebase is now consistently formatted. clang-format uncovered
   plenty of places where inconsistent code made it into our code base.

2) When writing code, you don’t need to think or worry about our coding
   style. Write it in yours, then run clang-format-3.5

3) When submitting patches, we don’t need to argue about coding style.

The basic idea is that we don’t want to care about _how_ we write the
code, but _what_ it does :). The coding style that we use is defined in
the .clang-format config file and is based on the google style, but
adapted in such a way that the number of modifications to the i3 code
base is minimal.
2014-06-15 19:07:02 +02:00
Tony Crisci 13db562551 Remove yajl major version conditionals
Yajl version ≥ 2 is required.

fixes #1156
2014-05-04 22:52:37 +02:00
Michael Stapelberg 87110a87a8 i3bar: render separators retina-correctly 2014-04-26 17:20:21 +02:00
Quentin Glidic eb7537e53d i3bar: Send mouse wheel events to child too
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2014-03-21 19:30:17 +01:00
Tony Crisci 00909aa3b1 i3bar: Do not kill watcher on EOF
Wait for the child process to exit on its own before freeing
watcher-related resources.

i3bar shows the last received status line until the process exits.

Fixes a race condition where the termination signal was sometimes not
received to display a meaningful error message.
2014-02-15 12:55:30 +01:00
Michael Stapelberg cd0cd0c3d2 Merge branch 'master' into next 2014-01-13 23:35:22 +01:00
Tony Crisci 612d25c12c i3bar Bugfix: don't show "EOF" status line error
When the `status_command` sends EOF, it is terminated. Terminating this
process prints an error message to the status line (hence, a race
condition). This error message is always more useful than the former
"EOF" status line error because it shows the exit code.
2014-01-13 23:35:20 +01:00
Tony Crisci 7bddf9add5 i3bar: Amend status line error 127 message
Exit 127 can be returned by the shell when the command is not found or
when the `status_command` process returns 127 because of a missing C
library dependency.
2014-01-12 22:11:11 +01:00
Alexander Kedrik de3901bb29 use designated initializers for yajl_callbacks struct 2014-01-06 22:12:14 +01:00
Michael Stapelberg 2fea5ef82b Revert "use designated initializers for yajl_callbacks struct"
This reverts commit 705b43294a.

This commit broke i3bar for some users.
2014-01-05 13:05:31 +01:00
Alexander Kedrik 705b43294a use designated initializers for yajl_callbacks struct 2014-01-04 20:46:46 +01:00
Alexander Kedrik f1560e5eb6 remove unnecessary forward declaration of set_statusline_error
Attributes can be added to function definitions.
Tested with gcc 4.8.2 and clang 3.3
2014-01-04 20:44:54 +01:00
Peter Boström f78c1ba053 Fix 'gcc -Wextra -Wno-unused-parameter'. 2014-01-04 20:43:30 +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
Tony Crisci ac74a63662 i3bar: Don't start child unless status_command
If a command is passed to `start_child` which is NULL, such as in the
case when there is no `status_command` specified in the bar config, do
not start a child process to listen on stdin.

fixes #1140
2014-01-01 15:23:50 +01:00
Tony Crisci bfe32ad797 i3bar: Print error message when status_command fails
Add a function to i3bar to print an error message in the status line
when the child process invoked by status_command fails to provide
input that can be displayed as a statusline.

When the child provides JSON that cannot be parsed, alert the user and
convey a short message provided by yajl communicating the specific
problem.

When the child (or the shell executing the status command) exits
unexpectedly, alert the user and display the exit code. The cases where
the status command is not executable or not found in the user's PATH are
treated specially.

fixes #1130
2013-12-21 08:57:21 +01:00
Tony Crisci 39f15da82f i3bar: Group child processes for signalling
Set the process group id of the child process by calling `setpgid` after
forking and before calling `exec`.

The process group ID will be set to the process ID of the forked
process. Processes spawned by this child process will also have this
group ID.

Send signals to the process group with `killpg`. This will send the
signal to all of the process group.

fixes #1128
2013-12-04 19:45:19 +01:00
Baptiste Daroussin f691a55923 Use _PATH_BSHELL to ensure using a bourne shell
[Michael]
This commit should fix problems with people using a non-bourne shell as
login shell, e.g. fish or rc. AFAICT, $SHELL should only be used for
interactive shells, but we just want a bourne shell, not an interactive
shell.
2013-11-09 10:11:32 +01:00
haptix@web.de 402c3db7ac restore i3bar compatibility with libyajl version 1
fixes #1004
2013-04-07 15:54:20 +02:00
Yuxuan Shui 18148205b6 Don't dup2() the parent's stdout to child's stdin.
There're DLOG()s, seriously.
2013-03-24 09:55:46 +01:00
enkore 58e68940f6 Add click events to i3bar
If the statusline generator (i.e. i3status) specifies click_events:true
in the protocol header, i3bar will write a JSON array on it's stdin
notifying it if the user clicks on a block.

The exact protocol is documented in docs/i3bar-protocol.
2013-03-21 23:55:30 +01:00
András Mohari a0d5b744ab Allow min_width of a block in i3bar to be a string
With this change, min_width can either be an integer (as usual), or a
string. In the latter case, the width of the text given by min_width
determines the minimum width of the block. This way one does not have to
figure out a minimum width by trial and error, only to do it again every
time the font is changed.
2013-02-25 23:48:35 +01:00
Artem Shinkarov 5f05ca6b5d Separator color via config; separator width and on/off via ipc
This patch adds the following features:
1) Configure a color of the separator via config.  It is done like
   bar {
      colors {
         separator #000000
      }
   }
2) A block can have an integer entry "separator_block_width" which
   sets the width of the gap which would follow after the current block.

3) A block can have a boolean entry "separator" and if it is set
   to false, then the drawing of the separating line would be disabled.
2013-02-18 10:44:44 +01:00
Antoine Millet e8149c77b3 i3bar: add min_width and align keys to blocks 2012-12-06 09:48:27 +01:00
Quentin Glidic 89ca48be20 i3bar: Honor "urgent" protocol hint by unhiding 2012-09-22 15:15:57 +02:00
Quentin Glidic 830829922b i3bar: Allow to force unhide with draw_bars 2012-09-22 15:15:57 +02:00
Quentin Glidic 8210c6be79 i3bar: Allow child to specify signals to use
We now wait for the child process to send the first line before stopping
it to use the signal which might be specified in the i3bar protocol
header
Since clients might use the same signal for both stop and cont, we also
save the stopped state of the child to avoid stopping it while hidden!
2012-09-22 15:13:21 +02:00
Quentin Glidic 1e114d7ab5 i3bar: Fully parse the JSON header 2012-09-22 15:13:21 +02:00
Quentin Glidic 34dc6d4d64 i3bar: Introduce i3bar_child struct 2012-09-22 15:13:21 +02:00
Quentin Glidic 310ae2d0b5 i3bar: Handle the first line with another callback 2012-09-22 15:13:21 +02:00
Quentin Glidic f691927aa7 i3bar: Split JSON line logic to read_json_input 2012-09-22 15:13:21 +02:00
Quentin Glidic 103b1a3f3a i3bar: Split flat line logic to read_flat_input 2012-09-22 15:13:21 +02:00
Quentin Glidic 3732cef764 i3bar: Split stdin reading logic to get_buffer 2012-09-22 15:13:21 +02:00
Michael Stapelberg f18ab28f5c bugfix: memleak: use i3STRING_FREE() instead of FREE() 2012-09-03 00:42:17 +02:00
Michael Stapelberg 2d1ebc2b90 Bugfix: memleak: because we use i3string_from_utf8(), we need to free buffer()
Previously, buffer was directly used and thus not freed, but
i3string_from_utf8() makes a copy.
2012-09-03 00:42:14 +02:00
eeemsi b9255f51f8 Use (void) instead of () for functions without args 2012-08-23 19:34:37 +02:00
Quentin Glidic bbd1b16043 i3bar: Port to i3String 2012-08-13 11:30:05 +02:00
Michael Stapelberg e53405c216 i3bar: be less strict about the {"version":1} JSON header 2012-08-12 18:40:15 +02:00
Michael Stapelberg 8f2e225db9 i3bar: Fix warnings with libyajl1 (Thanks prg)
yajl1 has the status yajl_status_insufficient_data, which in our stream
parsing context basically means "ok". Therefore, in yajl1, we no longer
print an error in this case.
2012-07-16 19:23:37 +02:00
Michael Stapelberg 156a06e495 i3bar: Don’t crash when full_text is missing or null in the JSON input (Thanks fernandotcl) 2012-05-12 08:23:51 +02:00
Michael Stapelberg 24ac6e32aa Bugfix: Properly terminate lines not ending with a newline (Thanks xeen)
Previously, we didn’t check for a newline and thus could be corrupting
formerly valid UTF-8 input, such as
    echo -n '↓'

Fixes: #671
2012-04-07 19:15:41 +02:00
Michael Stapelberg d519659ea7 i3bar: kill child processes when exit()ing (they might be stopped) (Thanks darkraven) 2012-03-26 17:36:00 +02:00
Michael Stapelberg 607ba6fcde i3bar: Fix memory for old plain-text input (Thanks Han) 2012-03-19 22:30:20 +01:00
Michael Stapelberg a3ee8491fd i3bar: compile with yajl < 2 2012-02-16 23:41:58 +00:00
Michael Stapelberg 31b9d24c2b Implement the i3bar JSON protocol (with fallback to plain text)
If the first line of the input starts with {"version":, then the input is
considered to be JSON, otherwise it is interpreted as plain text.

Only the "full_text" and "color" parts of a block are currently understood by
i3bar.
2012-02-16 23:28:18 +00:00
Michael Stapelberg f0cc13f356 i3bar: fix indention in src/child.c 2011-11-07 21:34:50 +00:00
Michael Stapelberg 726f2a1e5a normalize file headers across **/*.{h,c} 2011-10-25 21:19:38 +01:00
Michael Stapelberg 96f67a53a5 i3bar: check exit code of pipe() 2011-10-23 14:31:43 +01:00
Michael Stapelberg d71db710dd i3bar: use safewrappers from libi3 2011-10-21 19:30:46 +01:00
Michael Stapelberg 64a7017c32 i3bar: add modelines to all files 2011-10-09 14:28:20 +01:00
Michael Stapelberg c7ac1f9077 Merge branch 'master' into next 2011-08-25 18:51:02 +02:00
Michael Stapelberg 39cff5c31f i3bar: Bugfix: When receiving EOF, immediately redraw and discard input 2011-08-25 18:46:08 +02:00
Michael Stapelberg 9c587a767c Bugfix: set statusline = NULL, print error messages about EOF/SIGCHLD to stderr (Thanks cls) 2011-08-25 17:10:45 +02:00
Axel Wagner 7cb7700b02 i3bar: Fixup indentions 2011-08-12 18:43:09 +02:00
Axel Wagner 8d09ed7bf5 Update changelog and copyright, bump version and more 2011-07-31 16:16:17 +02:00
Axel Wagner 3d05fe7a52 Use cleanup() in child.c 2011-07-10 04:34:18 +02:00
Michael Stapelberg 97827372af Bugfix: Correctly handle EOF on stdin (Thanks woddf2) 2011-07-10 04:31:53 +02:00
Axel Wagner dfd566511e Bugfix: Don't segfault, if child was killed 2011-03-14 09:17:06 +01:00
Axel Wagner 972be13dc5 Bugfix: _only_ stop child, if hide_on_modifier is set (thx cradle) 2011-02-04 10:05:48 +01:00
Fernando Tarlá Cardoso Lemos 29f153c634 Separate the lines received in a single read.
Fixes the case where multiple lines are read in a single read syscall
(it could be better optimized in the future). Also fixes a memory
corruption issue when rec == 0.
2011-01-08 14:57:00 +01:00
Axel Wagner 34dd4bc89e Bugfix: If hide-on-modifier is set, stop the child after starting 2011-01-06 17:35:23 +01:00
Axel Wagner 497a091fbb Use strerror() for more usefull errormessages 2011-01-01 16:55:13 +01:00
Axel Wagner 600c4ae95c Use "*buffer == '\0'" instead of "strlen(buffer) == 0" (thanks dothebart) 2011-01-01 15:08:43 +01:00
Axel Wagner ff0522fe95 Bugfix: Send child a SIGCONT, so it reacts to SIGTERM (no zombies \o/) 2010-12-26 14:48:39 +01:00
Axel Wagner cdf56f16bf Revert "Double-fork() to avoid zombies"
This reverts commit a4eafae108b63f5df76eea2958aee8cf95cb1ad6.
2010-12-26 14:48:14 +01:00
Axel Wagner 8301d3d9f3 Send a SIGTERM instead of a SIGQUIT to exit the child 2010-11-11 02:59:17 +01:00
Axel Wagner eada483765 Double-fork() to avoid zombies 2010-11-10 18:46:47 +01:00
Axel Wagner 920721bb93 Use DLOG/ELOG-macros, provide --verbose-option 2010-09-17 06:49:28 +02:00
Axel Wagner 93453c64f2 Add some more comments 2010-09-17 05:26:31 +02:00
Axel Wagner 0e4487e489 Move child_pid into child.c 2010-09-17 03:03:43 +02:00
Axel Wagner d245d14765 Use realloc instead of manually reallocating 2010-09-17 02:28:56 +02:00
Axel Wagner 4d38bf81ba Allocate the right amount of memory for ev_child 2010-09-07 17:28:56 +02:00
Axel Wagner 0963a0e5ac Merge branch 'hide' into next 2010-08-26 00:03:41 +02:00
Axel Wagner a83e7699e7 Send the child SIGSTOPs and SIGCONTs 2010-08-25 18:31:03 +02:00
Axel Wagner 6034eee647 Remove trailing newline from stdin 2010-08-25 04:58:28 +02:00
Axel Wagner bef80146e6 Don't manually strip dzen-formats.
Instead "output_format = none" should be used in the i3status-config
2010-08-24 14:01:48 +02:00
Axel Wagner 60da522e13 Add licensing information 2010-08-07 18:05:16 +02:00
Axel Wagner cee972280d Add comments 2010-08-07 02:10:05 +02:00
Axel Wagner 1daa395a77 Added Unicode-Support 2010-08-06 03:32:05 +02:00
Axel Wagner 7d7867acce Be more strict with encapsulation
I.e. move the xcb-event-handling into xcb.c and the
child-process-communications into newly created child.c.
Also change some includes.
2010-08-05 05:09:59 +02:00