Commit Graph

72 Commits (de3901bb291b6c9ed2691bcc81febbfbeffa2957)

Author SHA1 Message Date
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