Commit Graph

512 Commits

Author SHA1 Message Date
Michael Stapelberg 79e7e69939 Merge pull request #1700 from mh21/tray-icon-size-cleanup
Tray icon size cleanup.
2015-05-12 22:44:08 +02:00
Michael Hofmann 0319bda1d4 Introduce sstrndup wrapper. 2015-05-06 16:33:15 +02:00
Michael Hofmann 27c060b279 Tray icon size cleanup.
- icon_size instead of font.height
- consistent spacing with tray_spacing_px
2015-04-30 11:45:38 +02:00
Michael Stapelberg 5dda3bc2ae Merge pull request #1657 from Georgiy-Tugai/fix-flickering-shortened
i3bar: fix flickering shortened status bar on other output(s)
2015-04-26 23:38:27 +02:00
Ingo Bürk bbc66e45f7 Only detect clicks within the statusline width.
If the user clicks on the very top of i3bar above a tray icon, i3bar might
mistakenly trigger the click event for the last status block. This is due to
the fact that the click detection considers the separator width of the block
even though on the last block this is ignored, incorrectly spanning the block's
width partially (or entirely) across the tray area.
2015-04-26 00:32:18 +02:00
Georgiy Tugai de866c2fea
i3bar: fix flickering shortened status bar on other output(s) 2015-04-21 12:28:43 +09:30
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
Thomas Anderson 196e1d0971 Respect EXEC_PREFIX and a users' choice of PKG_CONFIG.
The Makefiles should put binaries in $(EXEC_PREFIX) and
architecture-independent files in $(PREFIX). Also a user may have a
prefixed- pkg-config, as in the case of cross compiling on Exherbo
Linux, so respect the well-accepted $(PKG_CONFIG) variable for this
purpose.
2015-04-12 17:59:30 -07:00
Ingo Bürk a952ae74f4 Use a reasonable default sep_block_width if a separator_symbol is given 2015-04-03 22:54:59 +02:00
Michael Stapelberg 6b04f28b48 fix remaining warnings 2015-03-29 17:12:20 +02: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
Michael Stapelberg af71d3a2f1 Merge pull request #1590 from acrisci/bug/i3bar-no-markup-default
i3bar: don't parse markup on statusline by default
2015-03-28 10:08:41 +01:00
Tony Crisci beaf904943 i3bar: don't parse markup on statusline by default
fixes #1565
2015-03-27 19:00:32 -04:00
Michael Stapelberg 856e1f9772 Merge pull request #1591 from Airblader/feature-child-cleanup
Return in child parsing as soon as the match was made.
2015-03-27 09:51:00 +01:00
Michael Stapelberg fb0573e183 Merge pull request #1582 from shdown/allow-escaping-backslashes
Allow escaping backslashes
2015-03-27 09:40:09 +01:00
Ingo Bürk 6adc7e8bfb Return in child parsing as soon as the match was made.
As soon as we found the current key for which the value should be handled we can return
from the function to save some string comparisons.
2015-03-27 09:26:29 +01:00
Tony Crisci 3f3b2d9a3f i3bar: reconfigure strut partial on reload
Strut partial tells i3 where to reserve space for i3bar. It is affected
by the `position` bar config directive.
2015-03-25 19:17:06 -04:00
Michael Stapelberg 037cb317cb Merge pull request #1578 from Airblader/feature-custom-separator
Add support for a custom separator symbol
2015-03-25 22:49:09 +01: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
Michael Stapelberg bbb035d975 Merge pull request #1583 from shdown/next
i3bar: spelling fixes (2)
2015-03-25 20:16:00 +01:00
shdown 6d8891894e Allow escaping backslashes
Fixes #1577.
2015-03-25 21:32:46 +03:00
shdown 6922a820a6 i3bar: spelling fixes (2) 2015-03-24 15:41:16 +03:00
Tony Crisci 177c03debd i3bar: check `short_text` for NULL on dump
Check `short_text` for NULL on statusline dump, since this value can be
NULL when not given. Fixes a segfault in that case.
2015-03-24 06:00:26 -04:00
Tony Crisci 0962c7f011 i3bar: check block text for NULL
Add a null check to `full_text` and `short_text` for a block before
setting the markup property to avoid a segfault.
2015-03-24 05:45:20 -04: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
Michael Stapelberg ff62a68c1e Merge pull request #1570 from shdown/next
i3bar: spelling fixes
2015-03-23 22:10:17 +01:00
shdown e8704bb33b i3bar: spelling fixes 2015-03-23 22:56:49 +03:00
Ingo Bürk c9019ada4e Add support for short_text
When the statusline is too long, try to use the short_text property of each status block before falling back to truncating it.
fixes #1092
2015-03-23 11:24:30 +01:00
Ingo Bürk dd488818a9 Introduce the short_text property on blocks and parse it according to the documentation. 2015-03-23 11:03:45 +01:00
Michael Stapelberg 8d0fb482d9 clang-format and rearrange comments in i3bar/src/xcb.c 2015-03-23 09:23:01 +01:00
Michael Stapelberg 33fa3284db Merge pull request #1560 from shdown/refactoring
i3bar: refactoring
2015-03-22 21:29:03 +01:00
shdown f19fa0e3c9 i3bar: introduce get_tray_width() function to reduce duplication 2015-03-22 13:28:00 +03:00
shdown 62e4caa06c i3bar: refactor magic numbers to *_px constants 2015-03-22 13:28:00 +03:00
Michael Stapelberg 9493b61bb4 i3bar: set correct initial position when reconfiguring
fixes #1542
2015-03-21 22:50:48 +01:00
shdown b2309b8681 i3bar: fix click events for workspace buttons with long statusline
This combines detecting of current and clicked workspaces into one cycle
and then checks if the x coordinate of the clicked point is greater than
the workspace buttons width.
2015-03-21 19:41:38 +03:00
shdown b1c7c7eea4 i3bar: fix spelling is messages 2015-03-21 19:22:31 +03:00
shdown 4d3867f178 i3bar: rename a variable
Give it a more meaningful name.
2015-03-21 19:17:05 +03:00
shdown b28bb20caa i3bar: add binding indicator width to workspace buttons width
Just to prevent the indicator from being overlapped by the statusline.
2015-03-21 19:12:29 +03:00
shdown ccd6ae8eaf i3bar: cut long statuslines from the left
This draws the statusline after drawing (and calculating width of) the
workspace buttons and fixes calculation of its maximum visible width.
This (hopefully) guarantees that these two will never overlap.
2015-03-21 19:08:40 +03:00
shdown 5efcfda2ed i3bar: fix clearing of the statusline pixmap
This fixes the bug when statusline pixmap wasn't entirely cleared that
caused random artifacts to appear when the statusline width is greater
than the screen width.
2015-03-21 19:00:11 +03:00
Michael Stapelberg 1124041648 clang-format 2015-03-01 17:19:42 +01:00
Michael Stapelberg 91476e2c11 Merge branch 'defect-1480' of https://github.com/Airblader/i3-original into Airblader-defect-1480 2015-03-01 17:19:22 +01:00
Michael Stapelberg 091f1db39a run clang-format (3.5.0)
Not quite sure why there are so many differences. Perhaps we’ve gotten
out of the habit of running clang-format after every change.

I guess it’d be best to have a travis hook that runs clang-format for us
and reports any problems on pull requests.
2015-03-01 17:16:03 +01:00
Ingo Bürk 801dd06c6d free block->instance when cleaning up statusline 2015-02-18 20:29:11 +01:00
Ingo Bürk 1fde82d584 removed forgotten declaration of unused variable 2015-02-18 20:23:26 +01:00
Ingo Bürk 296fbdde12 Introduce a statusline buffer.
A buffer is introduced for the statusline which will only be copied to the actual statusline
once an entire statusline is parsed. This avoids a race condition where incompletely parsed
statuslines were rendered, causing only some status blocks to be rendered which is visible to
the user as a flickering.

fixes #1480
2015-02-18 20:11:42 +01:00
Ingo Bürk 9ff230c375 remove unused statusline_buffer 2015-02-18 20:01:52 +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 db62b5a4df Merge branch 'master' into next 2015-02-11 21:08:00 +01:00
Ingo Bürk 594b29f83d Make click events on status blocks work if 'workspace_buttons no' is set.
1. Always subscribe to click events for i3bar.
2. Exit the click event handler if no current workspace was found only after clicks on status blocks have been handled.

fixes #1430
2015-02-11 20:34:43 +01:00
Ingo Bürk bf0e8c2862 Remove one level of indentation #1465 2015-02-11 20:34:19 +01:00
Michael Stapelberg 83f369a91e Merge pull request #1460 from Airblader/bugfix-1458
Correctly calculate clicks on i3bar status blocks
2015-02-11 20:18:53 +01:00
Tony Crisci d38d2dc3e3 Update bar font config on reload
Dynamically update the font when the `reload` command is called by
reloading the font with `xcb_init_late` and adjusting the size of the
bar by updating the output dimensions with a call to the ipc.
2015-02-10 14:26:22 -05:00
Ingo Bürk d75f80402a Correctly calculate clicks on i3bar status blocks
fixes #1458
2015-02-10 14:52:53 +01:00
Alexander Monakov f28ce227e3 i3bar: suspend the child when bars are fully obscured 2015-01-25 20:31:38 +01:00
Ingo Bürk 13850a55b0 Inset the urgent background of a status block for consistency with workspace buttons.
fixes #1423
2015-01-17 18:28:14 +01:00
Ingo Bürk 8ea67d0488 i3bar: Respect the urgency flag on status blocks
…by drawing urgent blocks with the same settings as an urgent workspace.

(Also use logical_px() and bar_height.)

fixes #682
2014-12-09 11:23:46 +01:00
Ingo Bürk bfd60ec619 Improve error message when a full_text property is missing 2014-12-07 19:56:51 +01:00
Ingo Bürk bf1d0c9335 ensure align = left is the default and update documentation accordingly
fixes #1403
2014-12-03 08:12:04 +01:00
Michael Stapelberg cc09348414 Merge branch 'master' into next 2014-07-24 10:11:34 +02:00
Michael Stapelberg 4699c714b3 Bugfix: add a sync call to i3bar to confirm reparents before exiting
Without this call, sometimes the tray icon windows are reparented into
i3’s container around the i3bar window, i.e. into the next remaining
window in the window hierarchy. Since i3 then closes that container
(since the i3bar window itself was closed), the tray window will also
get closed. In general, this weird interaction (getting reparented and
then closed) is not well received by tray icon providers :).

closes: #1296
2014-07-24 10:09:53 +02:00
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
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 5cbe2d63c0 Merge branch 'master' into next 2014-07-02 19:06:23 +02:00
Tony Crisci 0095ca8770 Use FREE macro for freeing colors
This macro will set the colors to NULL which avoids a double free on
reload when colors that were unconfigured become configured.

fixes #1299
2014-07-02 19:01:59 +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
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
Michael Stapelberg e41b11fa0a use size_t for strspn() return value 2014-05-16 18:03:31 +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
Tony Crisci 13db562551 Remove yajl major version conditionals
Yajl version ≥ 2 is required.

fixes #1156
2014-05-04 22:52:37 +02:00
Tony Crisci c3d46c9145 i3bar: reinit colors on barconfig update
Allows bar colors to be updated on barconfig update events, such as with
the ipc command `reload`.
2014-05-03 15:09:02 +02:00
Tony Crisci ab0fae400b Delegate click handling to dock clients
Do not handle click events on dock clients because they are not managed
windows. Dock clients are responsible for sending the message to i3 to
focus a workspace if that is appropriate. i3bar now sends the message to
focus the correct workspace when that is appropriate.

Otherwise, it could interfere with the dock clients own click handling,
which could be an action to focus a different workspace than i3 had
assumed, such as would be the case with a workspace widget.
2014-04-30 09:31:42 +02:00
Michael Stapelberg 350e2c5f55 do click handling and tray padding retina-correctly 2014-04-26 17:30:27 +02:00
Michael Stapelberg 9686dd4943 draw workspace buttons and padded text blocks retina-correctly 2014-04-26 17:27:57 +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 f891a8a9af i3bar: fix resource leak: statusline_ctx needs to be freed first
In practice this is rarely noticeable, unless you very often switch
screen resolutions, I think.

fixes #1172
2014-02-02 11:24:17 +01:00
Marco Hunsicker 92868cf6d3 update year in copyright notices to 2014
This patch updates the copyright year information the i3 and
i3bar binaries show to the user.
2014-01-26 16:10:57 +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
Alexander Kedrik e2ebe3e2ae Use #pragma once
#pragma once is safer and simpler. According to Wikipedia it's supported by all major compilers.
2014-01-01 15:06:57 +01:00
Tony Crisci 23b1da598e i3bar: Set `mapped` flag on trayclient creation
When a trayclient is first created as a structure in memory, explicitly
set the `mapped` flag to false. Otherwise it may initialize to `true` in
some circumstances without actually being mapped, causing a request to
be mapped from the client to be ignored.

Create the trayclient in memory before handling a request to be mapped
immediately.

fixes #1138
2014-01-01 11:10:21 +01:00
Michael Stapelberg 0883dfbe14 only LOG() the DPI when it changes, DLOG() it otherwise (Thanks lkraav)
This avoids flooding stdout every time some text (e.g. a window
decoration) is drawn, yet leaves the message in place when it’s actually
relevant (upon DPI changes).

fixes #1115
2013-12-24 10:35:56 +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
Tony Crisci 80df764e55 i3bar: Realign tray clients on map/unmap notify
UnmapNotify events are interpreted by i3bar as an action taken by an
application to hide its tray window. Likewise, MapNotify events are
interpreted as an action taken by by an application to show its tray
window.

The actual cause of these events may be the application itself, or the
result of some action taken by i3bar itself at the request of the
application in the course of the XEmbed protocol.

We respond by adjusting the size of the tray window and realigning any
tray clients that remain. This will make room for the mapping window or
close the gap left by the unmapping window when the bar is redrawn.

fixes #1110
2013-11-30 14:01:25 +01:00
Tony Crisci a1e7ce20f0 i3bar: Handle DestroyNotify events
Handle DestroyNotify events by removing the tray client from the tray
client list held in memory.

This change is intended to be part of the i3bar's implementation of the
XEmbed protocol. For more information, see:

<http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html>

According to the XEmbed protocol specification, this is one way for a
tray client to finish the protocol. After this event is received, i3bar
should have no more interaction with the tray client.
2013-11-24 12:40:03 +01:00
Michael Stapelberg d3beff2339 make i3bar use libi3’s root_atom_contents()
This removes code duplication, which will be useful for a subsequent
commit.

Furthermore, we now don’t open X11 connections unnecessarily in some
corner cases.
2013-11-22 15:48:45 +01:00
Tony Crisci e08215896e i3bar: Simplify hide mode logic
When determining whether to hide or unhide the bar on redraw in hide
mode, use simpler rules. When the config specifies the 'show' state or a
workspace is urgent, or if the caller requests it, or the modifier is
pressed, show the bar. Otherwise, hide the bar.
2013-11-09 14:34:00 +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
Tony Crisci cce3c8066a i3bar: Only configure tray on own outputs
If the config specifies a `tray_output` not in the list of outputs over
which this bar will span, do not initialize a tray for the bar.

Fixes former behavior, which was to initialize the tray without showing
the icons, causing disapearing tray icons in multi-monitor environments
when `tray_output` isnt `output`.
2013-10-23 23:23:45 +02:00
syl20bnr 7098ef602b Add new bar.binding_mode_indicator configuration.
i3 current behavior hides the binding mode indicator when
workspace buttons are disabled.
This patch adds a new configuration for i3bar called
'binding_mode_indicator' which acts like the workspace_buttons.
It is now possible to configure i3bar to hide the
workspace buttons and keep showing the binding mode indicator.
This should make the hide workspace buttons configuration
more convenient for those who are heavily using binding
modes.
Default value for binding_mode_indicator is true.
2013-09-24 06:59:26 +02:00
Deiz a7c005848a Create pixmaps using the real bar height, rather than screen height. 2013-09-09 04:36:10 +02:00
Michael Stapelberg 3eea370db2 i3bar: draw workspace buttons at x=0 instead of x=1
This makes the workspace buttons align with the window borders, which is
particularly visible with color configurations like the one in this
screenshot: http://i.imgur.com/CH8srF5.png

fixes #687
2013-07-29 21:50:59 +02:00
haptix@web.de 4937788e8d Fix wrong placement of i3bar when connecting/disconnecting outputs
When connecting or disconnecting an output, i3bar reconfigures its
windows. This also included an unmapping of the bars, and a remapping of
all docked bars. Thus, the bars were misplaced when a monitor was
disconnected.

This commit assures that the remapping of the bars only takes place,
when the mode has actually changed. This patch also takes care of an
inconsistency when pressing the bar_modifier while switching the mode.
Also, the xkbDisplay is now closed correctly, when deregestering the xkb
keyevents.
2013-05-30 12:18:27 +02: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
Thomas Adam ed1d13b0a1 i3bar: Fix pixel offset calculation in dual-head
When running i3bar on a dual-head display with workspaces enabled in i3bar's
config, the second monitor wouldn't use a correct x position offset and
would draw its label too close to the screen's edge.  In comparison to the
first monitor, this is inconsistent because that starts with a pixel offset
of 1.
2013-05-20 15:09:15 +02:00
Michael Stapelberg 8247f44e95 Merge branch 'master' into next 2013-04-14 22:54:36 +02:00
Michael Stapelberg 72c279bc39 Bugfix: fix crash when not having tray_output configured (Thanks Layus) 2013-04-14 22:54:15 +02:00
haptix@web.de 90bfbac107 fix font display height in i3bar
Increase the drawing area height, in order to prevent the font from being cut off.

fixes #992
2013-04-13 19:49:06 +02:00
haptix@web.de a9aad872ee unhide hidden i3bar when mode is active
This patch also handles unhiding of i3bar in case the i3bar modifier key is
pressed for activating a new binding mode.
2013-04-13 10:16:34 +02:00
haptix@web.de 921967c729 unhide hidden i3bar when mode is active
fixes #961
2013-04-11 22:35:54 +02:00
haptix@web.de 402c3db7ac restore i3bar compatibility with libyajl version 1
fixes #1004
2013-04-07 15:54:20 +02:00
Simon Elsbrock 6b0efac483 i3bar: fix usage description, make -b happen 2013-03-29 09:55:03 +01: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 ae0842532e Bugfix: Set separator color properly when drawing
Set the colors in the GC directly since set_font_colors() does not do it
when using a Pango font, resulting in i3bar drawing separators in the
wrong color.
2013-02-25 23:49:15 +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
Michael Stapelberg fc3b0db7a5 i3bar: fix rendering positions 2013-01-24 17:21:34 +01:00
Michael Stapelberg 990a1ca4c2 i3bar: don’t use X11 borders to avoid overlapping in hide mode
fixes #923
2013-01-24 16:09:51 +01:00
Michael Stapelberg f2ca568202 i3bar: set _NET_SYSTEM_TRAY_COLORS for symbolic icons (gtk3+) 2013-01-02 23:14:30 +01:00
Michael Stapelberg e9503a1fa3 i3bar: fake DestroyNotify and send MANAGER ClientMessages to fix tray restarts
fixes #745
2013-01-02 23:14:27 +01:00
Michael Stapelberg 2043076518 i3bar: add missing \n to debug messages 2013-01-02 11:38:03 +01:00
Michael Stapelberg 7658109309 Bugfix: remove superfluous #include <xcb/xcb_atom.h> (Thanks pnutzh4x0r)
This fixes the build on CentOS 6.

fixes #889
2012-12-14 21:49:31 +01:00
Antoine Millet e8149c77b3 i3bar: add min_width and align keys to blocks 2012-12-06 09:48:27 +01:00
Pavel Löbl 6148136e7c i3bar: Add current binding mode indicator 2012-11-16 13:44:29 +01:00
Michael Stapelberg b9885ff21e bugfix: don’t send workspace command when at beginning/end of workspaces (Thanks whitequark)
fixes #843
2012-10-14 21:05:44 +02: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
Quentin Glidic 13ecc79fcc i3bar: Rename determine_json_version to parse_json_header 2012-09-22 15:13:21 +02:00
Quentin Glidic 2e5838fb49 i3bar: Rework unhide/hide on workspace urgency
We now check globally for workspace urgency instead of per-output since
the result is the same but we call unhide_bars/hide_bars only once this
way
2012-09-22 15:13:21 +02:00
Michael Stapelberg 4636eb840d fix compilation with older xcb-util with -DXCB_COMPAT (Thanks okraits) 2012-09-03 14:55:27 +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
Michael Stapelberg 2896ae8057 logging: make libi3 use verboselog()/errorlog(), provide it in each caller
While this is a bit ugly, it makes the log messages end up where they
are supposed to: in the shmlog/stdout in case of i3 and on stdout in
case of utilities such as i3-input
2012-08-13 13:27:16 +02:00
Fernando Tarlá Cardoso Lemos 6ff3f7abad libi3: Implement Pango rendering 2012-08-13 11:39:30 +02:00
Fernando Tarlá Cardoso Lemos edd9007ebf i3bar: Rename xcb_screen to root_screen for consistency 2012-08-13 11:37:34 +02:00
Quentin Glidic 210fc6dfed libi3: Rework predict_text_width
predict_text_width now takes an i3String as argument
2012-08-13 11:37:23 +02:00
Quentin Glidic 53365fa887 libi3: Rework draw_text
We now have two versions of draw_text
draw_text: Now takes an i3String
draw_text_ascii: Designed for static strings in plain ASCII
2012-08-13 11:37:21 +02:00