Commit Graph

511 Commits

Author SHA1 Message Date
koebi 655ed0ba27 fix i3bar crashing when I3SOCK present (#2471)
When I3SOCK is present, socket_path might be a pointer to an
environment variable, which cannot be free'd in line 157. This
commit duplicates the string if I3SOCK is present, thus making
socket_path a free-able pointer again.
2016-09-26 08:01:30 -07:00
Michael Stapelberg 9bf346c7a0 Remove compatibility definitions for xcb-util < 0.3.8 (#2473)
Even Debian oldstable has xcb-util 0.3.8.
2016-09-24 09:48:32 -07:00
Ingo Bürk b3fb3cbfea Update i3bar LICENSE to conform to other LICENSE files. (#2284)
This change of the LICENSE has been approved by Axel Wagner in #2281.
2016-04-10 04:15:49 -07:00
Ingo Bürk ea55729cf2 Remove unmaintained CHANGELOG file from i3bar 2016-04-07 08:35:29 +02:00
Eric Engeström 66d9c983e4 Fix spelling mistakes 2016-04-04 09:33:59 +02:00
Ingo Bürk b8109c3a59 Document tray initialization better.
This commit removes an unnecessary fallback to the first output's name as
this name ("first") will only be used to see whether "tray_output none"
has been specified, anyway.

We also add documentation that clearly states when we want to initialize
the tray and when we don't want to do the same.

relates to #2220
2016-02-21 14:26:13 +01:00
Ingo Bürk 320591ac19 Remove unreachable fallback code for tray_output primary.
This commit removes the code for falling back to the first available
output for the system tray if 'tray_output primary' has been specified
but there is no primary output (managed by this bar).

This fallback behavior was broken/unreachable because the tray
will never be initialized in this situation in the first place. Having
this dead code lead to a wrong assumption in #1855 and hence to
commit e2e7b70d00, which makes the
system tray not show up for many users when first installing i3.

Thanks to @rtlanceroad for reporting this issue.

fixes #2220
2016-02-21 14:17:23 +01:00
Ingo Bürk 018922dcc4 Allow "modifier none" in i3bar to disable the modifier.
This allows "modifier none" (and "modifier off") for the bar config
in order to disable the modifier key altogether. This is useful
for users who use a different approach to hiding / showing the bar,
e.g., a custom keybind that involved multiple keys or scripts.

fixes #2208
2016-02-11 20:51:05 +01:00
Nick Lanham 8f2d066dc6 Fix issue #2184. don't send atom, but raw code
XEMBED messages aren't atoms, but just codes, so i3bar should just send
XEMBED_EMBEDDED_NOTIFY rather than indexing the atom array.
2016-01-31 12:21:47 -08:00
Michael Stapelberg cb3cdb602a ASAN: trigger leak before exiting
This disables the default leak-check-on-exit behavior which reports a
bunch of leaks that are only leaks while exiting, at which point they
don’t matter, because the operating system will clean up the memory our
process used.
2016-01-09 17:18:05 +01:00
Michael Stapelberg 8bfc651dd1 i3bar: free font when exiting 2016-01-09 17:06:58 +01:00
Michael Stapelberg 5ca659853a i3bar: fix memory leak 2016-01-09 17:06:58 +01:00
Michael Stapelberg 9dde0b9b18 i3bar: fix memory leak in socket path 2016-01-09 12:30:15 +01:00
Ingo Bürk 1f660a4cc4 Move title_format from window to container.
This patch moves the title_format information from windows to containers.
Furthermore, it allows correctly setting it on window-less containers and
displays the title accordingly for split containers.

We now also dump and read title_format in GET_TREE / during restarts.

fixes #2120
2016-01-05 12:22:27 -05:00
Alex Auvolat 19fd6817af Refactor extern definition of conn and root_screen 2015-12-29 12:47:12 +01:00
Michael Stapelberg b1f1da432d i3bar: explicitly set cursor using libxcursor if available
Even if the X11 root window cursor is not set up correctly for some
reason, with this fix, users should at least see the correct cursor when
the pointer is over i3bar.

see issue #2114
2015-12-25 16:38:11 +01:00
Ingo Bürk b665049883 Migrate i3 rendering to cairo.
This patch migrates all decoration rendering of i3 to cairo. Using the
compile switch CAIRO_SUPPORT, rendering can be switched back to the
previous XCB behavior, just like with the previous migration to cairo
in i3bar.

This patch also fixes a bug in draw_util.c where copying one surface
to another would use incorrect coordinates if the source coordinates
are not 0, 0.

Furthermore, this patch implicitly fixes some minor issues in the
decoration rendering which would be ignored previously due to the fact
that errors would only show up in the event queue, but not cause the
rendering code path to crash. One example is zero-height pixmaps which
are not allowed. Using cairo, these would cause i3 to instantly segfault,
so this patch avoids this.

Lastly, this patch annotates other issues found but not fixed in this patch
using TODO comments, e.g., the zero-height check not working correctly
and the comment that it should probably work the same way for zero-width
pixmaps.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk 90d94298fa Move draw_util.c to libi3.
In order to prepare for using cairo for rendering i3 decorations,
we need to make the draw_util.c from i3bar available via libi3 such
that both i3bar and i3 can use it.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk 38fcaf3fa8 Rename I3BAR_CAIRO to CAIRO_SUPPORT. 2015-11-07 14:28:45 -05:00
Ingo Bürk bc250b26a0 Allow multiple tray_output directives.
This patch introduces the possibility to specify the tray_output directive
multiple times. All values will be used by i3bar, in the order they are
given.

This way, a single bar configuration can be used for several machines with
internal output names "eDP1" and "LVDS-0" by specifying tray_output for both.
Any external output (e.g., "DP-0") will still not receive the tray. The same
effect can be achieved by using "primary", but forces the user to couple the
tray display to the primary output which may not be desirable behavior.

relates to #555
2015-11-01 16:35:17 -05:00
David Simon dc05d905c1 Optionally change i3bar color on focused output, implements #2020 2015-10-27 09:12:57 -04:00
David Simon 071f11f9b9 Use separate buffers for i3bar statusline for each workspace, track short and long renders separately, fixes #1824 2015-10-26 16:15:01 -04:00
Ingo Bürk a0add1ba73 Added background and border keys to the i3bar protocol.
This patch adds two new status block keys, background and border, which
define the respective colors for the status block. If not specified, the
current behavior is kept, e.g., no background / border will be drawn.

If the status block is marked urgent, the urgent color is prioritized.

fixes #2022
2015-10-22 16:11:08 +02:00
Ingo Bürk 0750b450b2 Use sasprintf() instead of alloc'ing and strncpy() in i3bar.
resolves #1995
2015-10-17 22:14:48 +02:00
Ingo Bürk 19a16f3ce7 Log X11 errors in i3bar.
This commit introduces X11 error logging similar to the way we already do in i3.

fixes #1998
2015-10-16 21:18:23 +02:00
Michael Stapelberg d622df70ad Merge pull request #1990 from Airblader/bug-1989
Flush cairo surface after drawing text.
2015-10-14 13:32:31 -07:00
Ingo Bürk 02468296c4 Introduce switch for the drawing backend
This commit restores the old XCB drawing code paths while keeping the
cairo drawing available via a compile-time switch (I3BAR_CAIRO). This
is necessary as cairo currently has a bug that breaks i3bar for users
without the RENDER extension, which might be the case, e.g., for VNC
users.

For more context, see #1989 and the discussions about its fix. Once the
cairo fix is available in a stable release, i3 can depend on that version
and remove the XCB drawing code paths.

fixes #1989
2015-10-14 21:12:33 +02:00
Ingo Bürk 46bcc55f6f Extract cairo_clear_surface.
This commit refactors the i3bar drawing code to also define an abstraction
function for clearing a surface. This is needed to fully abstract i3bar/xcb.c's
drawing code so that we can introduce a switch to easily exchange the
underlying drawing mechanism.
2015-10-14 19:03:05 +02:00
Ingo Bürk 8178910f16 Introduce a macro to flush a cairo surface twice.
Flushing the surface twice is necessary due to a cairo bug. For context,
refer to #1989 and https://bugs.freedesktop.org/show_bug.cgi?id=92455.
2015-10-14 18:57:16 +02:00
Ingo Bürk 54dbbe2f06 Flush cairo surface after drawing text.
This is necessary to avoid a bug where a cairo assertion fails because no snapshot is available.

fixes #1989
2015-10-13 11:08:10 +02:00
Ingo Bürk fec61791e1 Rename is_markup to pango_markup. 2015-10-13 09:59:26 +02:00
Ingo Bürk 82dc747396 Make pango markup in mode names optional with a flag.
This introduces the flag "--pango" on the mode config directive to
explicitly enable pango markup for mode names. Not setting this will
cause the mode name to be rendered as is.
This fixes a regression in 4.11 where mode names containing characters
such as '<' would break user's configs as they didn't escape these
characters.

fixes #1992
2015-10-13 09:23:30 +02:00
Ingo Bürk 21c0c20843 Remove support for 32-bit visuals and RGBA colors.
fixes #1984
2015-10-11 00:33:14 +02:00
Ingo Bürk d300a07660 Refactor cairo drawing of rectangles into utility functions. 2015-10-08 12:31:56 +02:00
Ingo Bürk ff0aeddede When drawing text, mark the surface as dirty.
Since libi3 currently creates its own cairo surface for drawing text, we
need to mark our own surface as dirty to force cairo to invalidate its
cache. Otherwise, this will result in graphical glitches such as the text
not showing up at all.

This wrapper can be removed in the future when libi3 is adapted to reuse
the same cairo surface as we do for all other drawing operations.
2015-10-08 12:16:25 +02:00
Ingo Bürk 1c4100ce5d Use 32-bit visuals for i3bar when possible and allow RGBA colors.
This patch creates all necessary windows for i3bar with 32-bit visuals if available.
It also introduces the possibility to define RGBA colors (next to RGB colors), which
allows the user to set the opacity of any color. This requires running a compositor.

With this patch we also start supporting _NET_SYSTEM_TRAY_VISUAL, which is necessary
for the tray icons so they create the tray window with the correct depth and visual.
2015-10-06 23:01:57 +02:00
Ingo Bürk 410c5da7cf Use cairo for all drawing operations in i3bar.
fixes #1878
2015-10-05 09:29:17 +02:00
shdown c85d16faa4 Use safe wrappers wherever possible 2015-08-03 12:50:50 +03:00
shdown bc52fae15c libi3: change scalloc() signature to match calloc() 2015-08-03 12:50:13 +03:00
Ingo Bürk b9bacdf464 Send custom-defined command upon click on the non-statusline part of i3bar even if workspace_buttons is set to 'no'.
fixes #1777
2015-07-01 14:48:06 +02:00
Michael Hofmann bad4203755 Configurable tray padding. 2015-06-28 00:14:37 +02:00
Michael Stapelberg 696d844ffa Merge pull request #1697 from Airblader/feature-1695
Extend mouse commands on i3bar
2015-06-18 20:50:56 +02:00
Ingo Bürk 9eb255d5fa Ensure format of dumped bindings for i3bar is compatible with i3 bindings.
fixes #1695
2015-06-18 19:28:24 +02:00
Ingo Bürk 715fbf2d80 Read 'bindsym' rather than the old 'wheel_up_cmd' and 'wheel_down_cmd' directives in i3bar and call the command if specified.
The old directives are still read for transitional support which can be removed in a future version.
2015-06-18 19:28:20 +02:00
Michael Stapelberg 560d9a25d8 Merge pull request #1731 from Airblader/feature-indicator-pango
Allow pango markup for the binding indicator.
2015-06-07 20:46:16 +02:00
shdown fe006f0f6a i3bar: fix freeing static strings
name and color fields of blocks are freed in clear_statusline, so they
need to be strdup'ed.
2015-06-02 23:29:24 +03:00
Ingo Bürk 0a0f59038a Use the introduced binding_mode_* colors to draw the binding mode.
fixes #1732
2015-06-01 16:57:17 +02:00
Ingo Bürk 9b691bcca2 Introduce a config directive 'binding_mode' in the 'bar' config, pass it through the IPC and parse it in i3bar. 2015-05-31 16:49:09 +02:00
Ingo Bürk 36f5a37777 Allow pango markup for the binding indicator. 2015-05-31 12:35:47 +02:00
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