Compare commits

..

96 Commits

Author SHA1 Message Date
LemonBoy
35183ab81d
Merge pull request #210 from dmgk/master
Update VERSION
2018-01-15 13:56:51 +01:00
Dmitri Goutnik
09b5a9b8ba Update VERSION 2018-01-12 16:51:57 -05:00
LemonBoy
2f255b1756 Release version 1.3 2017-11-20 11:47:43 +01:00
LemonBoy
8cd84e8edf Merge pull request #202 from felixkiss/patch-1
Fix typo
2017-07-07 07:36:12 +02:00
Felix Kiss
b721a37ab0 Fix typo 2017-07-06 22:54:51 +02:00
LemonBoy
1411d260a4 Correctly handle escaped % symbols 2017-05-09 15:56:59 +02:00
LemonBoy
50fe7d2083 Merge pull request #193 from baskerville/fix-end-x
Fix {top,bottom}_end_x strut value
2016-11-16 12:25:06 +01:00
Bastien Dejean
84be3d8dbf Fix {top,bottom}_end_x strut value
The maximum x coordinate of a pixel inside the rectangle (x, y, w, h) is x+w-1.

The specs (https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#idm140130317564416)
provides an example that corroborates the fact that the range is inclusive: bottom_end_x is 2303.
This value can be interpreted as 1280+1024-1.
2016-11-16 10:14:27 +01:00
LemonBoy
d680ea4256 Set the WM_NAME for all the windows.
Don't set repeatedly the property for the first window only.
Thanks to @otommod for noticing this.
2016-05-22 20:09:26 +02:00
LemonBoy
44a708b7a4 Don't use optarg directly when parsing the -n switch argument. 2016-05-22 15:31:42 +02:00
LemonBoy
40f08d5245 Silence a warning about write() result being unused. 2016-04-23 09:06:00 +02:00
LemonBoy
3dbdf9d078 Update the .travis.yml to build all the features 2016-04-23 09:02:46 +02:00
LemonBoy
a3fb967ad9 Make it possible to build lemonbar w/o XINERAMA support 2016-04-23 08:59:38 +02:00
TheLemonMan
ae5a3a477a Merge pull request #170 from Stebalien/pixel-offset
Pixel Offset
2016-04-23 08:24:09 +02:00
Steven Allen
f2662d75c8 Add pixel offset
Add a formatting command to offset the text position by a pixel amount.
2016-02-19 11:35:22 -05:00
Giuseppe
3020df1923 Merge pull request #169 from vyp/literal-percent
Document literal percent sign under formatting
2016-02-19 11:57:35 +01:00
xd1le
13dcc66cae Document literal percent sign under formatting
`B<%{>` and `B<}>` on the same line have been changed to `C<%{>` and
`C<}>` for consistency.
2016-02-19 21:50:27 +11:00
Giuseppe
c788534107 Merge pull request #165 from JeromeBon/feature_issue161_default_underline_color
Implement [Issue #161 - Feature request]
2016-01-19 15:18:14 +01:00
Jérôme Bon
0f2cfbab28 Implement [Issue #161 - Feature request]
Feature: add a parametere to set the default underline color.
Usage: lemonbar -Ucolor

By the way this also fix a strange behavior whereas '%{+u}correct%{U-}strange'
made the second underline of the same color as the background instead of the foreground.
2016-01-19 14:41:00 +01:00
Giuseppe
61985278f2 Merge pull request #162 from baskerville/master
Commands in clickable areas aren't executed
2016-01-03 18:39:11 +01:00
Bastien Dejean
d3d7a87b66 Commands in clickable areas aren't executed 2015-12-23 12:03:08 +01:00
LemonBoy
7c8eb7495b Fix an off-by-one error in 'area_get'.
Fixes #160.
2015-12-15 19:05:39 +01:00
Giuseppe
f26b88272e Merge pull request #159 from AdamNiederer/patch-1
Fix Typo
2015-12-11 09:22:50 +01:00
Adam Niederer
214ad63925 Fix Typo
Siz -> Six in comment
2015-12-10 17:59:58 -05:00
Giuseppe
495ac4e546 Merge pull request #158 from sector-f/master
Added -a and -o to README.pod (and, therefore, the man page)
2015-11-16 18:43:23 +01:00
Adam
e4ea4071ab Added -a to README.pod (and, therefore, the man page) 2015-11-16 12:17:17 -05:00
Giuseppe
63ed303553 Merge pull request #157 from krypt-n/scroll-fix
Fix the missing scrolling wheel support.
2015-11-16 17:24:31 +01:00
krypt-n
e0aee14533 Saving 4 byte of memory on 32-Bit systems 2015-11-15 23:06:19 +01:00
krypt-n
da26209013 Fix LemonBoy/bar#154 and krypt-n/bar#18
Widening the bitfield by 1 would be a solution aswell.
Problem was that an int:3 has a range of -4 to 3, buttons 4 and 5 did not
fit into it
2015-11-15 13:24:36 +01:00
LemonBoy
2c0f57c584 Prevent load_font calls before connecting to X 2015-10-30 16:11:22 +01:00
Bastien Dejean
3b5baa93b1 The WM_NAME option takes an argument 2015-10-30 16:11:22 +01:00
LemonBoy
531c575575 Allow the user to set the WM_NAME atom value 2015-10-24 14:44:41 +02:00
LemonBoy
6580e2d4f7 Warn the user when the area geometry is invalid 2015-10-24 14:35:36 +02:00
LemonBoy
255c93dc7a Make the number of clickable areas configurable. 2015-10-24 14:28:51 +02:00
LemonBoy
38422c5014 Don't parse named colors. Expand #rgb format. 2015-10-24 14:04:37 +02:00
Giuseppe
1585d7257d Merge pull request #150 from neeasade/monitor_sort
Fix monitor sorting with mix of portrait and landscape layout.
2015-10-21 19:30:56 +02:00
Nathan Isom
7f8a79131b Account for height of monitors in sorting. 2015-10-21 12:24:04 -05:00
neeasade
177deb0860 bar -> lemonbar in .gitignore, remove config.h in .gitignore 2015-10-20 19:56:29 -05:00
Giuseppe
b331ee3927 Merge pull request #137 from chadvoegele/master
Keep percent signs if not followed by {} block.
2015-10-10 16:00:40 +02:00
chad
71ed0d3375 Rewrite *p, *(p+1) as p[0], p[1] for readability. 2015-09-27 15:21:49 -05:00
Chad Voegele
63a55dd06c Keep percent signs if not followed by {} block.
The before code would skip a percent sign even if it was not followed by a {}
block. The after code checks the same condition but only advances p if a {} block
is found and otherwise passes it through as text.
2015-09-27 15:16:56 -05:00
Giuseppe
a390ef6a5c Merge pull request #132 from krypt-n/font-count-fix
Don't exceed maximum number of fonts
2015-07-22 23:07:45 +02:00
Giuseppe
04d22b4ae5 Merge pull request #141 from DelusionalLogic/master
Fixed font selection
2015-07-22 23:04:30 +02:00
Jesper Jensen
73d8c58286 Conform to coding standard and errors
An error will not be printed if the parameter to `T` is not valid (- or
a number) and the token will be eaten (just like when an invalid
attribute is found)
2015-07-22 22:55:06 +02:00
Jesper Jensen
49fdc25f37 Fixed font selection
Font selection now correctly handles - as a special case.

This change is also reflected in the documentation.
2015-07-22 17:39:31 +02:00
krypt-n
a8fa2766fb Check force_count to be lower than MAX_FONT_COUNT 2015-06-02 09:27:53 +02:00
LemonBoy
a9f285fd28 Update the usage text
The -f option doesn't accept a comma separated list of font names anymore
2015-05-03 17:06:36 +02:00
LemonBoy
7880eac8c9 Minor change to -f handling
Remove the ability of the -f switch to accept a comma-separated list of fonts. The user is expected
to use multiple times -f whenever he wants to specify one or more fonts. This has the side effect of
enabling the user to use fonts whose name contains a comma.
2015-04-23 23:07:42 +02:00
LemonBoy
25c3441925 travis: Run a apt-get update before installing the needed packages 2015-04-15 11:04:53 +02:00
LemonBoy
b82d96a68e Use the maximum width reported by the font if the attributes table isn't found 2015-04-15 10:21:52 +02:00
LemonBoy
ebb625b529 Minor spelling errors 2015-03-15 21:35:54 +01:00
LemonBoy
72106b17b1 Change the project name to lemonbar 2015-03-14 13:51:29 +01:00
LemonBoy
19167c2e55 Remove the now useless palette.pl script 2015-03-08 19:45:47 +01:00
LemonBoy
fe4ff881dd Fix a silly error when redrawing the background. Fixes #108 and #82 2015-03-03 11:29:35 +01:00
Giuseppe
75dbf3397e Merge pull request #106 from otommod/click-fix
Fix #105
2015-02-27 15:53:19 +01:00
Otto Modinos
eeb88f8ae0 fix non left alignments causing wrong clicks 2015-02-27 15:57:19 +02:00
LemonBoy
d32cd8bce9 Prevent a NULL pointer deference if monitor_create fails 2015-02-18 12:52:24 +01:00
LemonBoy
5186f68658 Fix the 'T' command parsing 2015-02-16 14:22:34 +01:00
LemonBoy
4ee19586a3 Put the elements of rgba_t in the right order. Thanks to @mrshankly for noticing it 2015-02-15 23:54:04 +01:00
Giuseppe
1ef64eab99 Merge pull request #104 from andornaut/patch-1
Document #97 - Nested clickable areas
2015-02-14 00:47:02 +01:00
andornaut
ab3a49962f Document #97 - Nested clickable areas 2015-02-13 18:43:50 -05:00
LemonBoy
8351859593 Support colors in #rrggbb form 2015-02-14 00:32:16 +01:00
LemonBoy
2778c81699 Make bar compile with -Wall and no warning 2015-02-14 00:20:46 +01:00
LemonBoy
d8443785a8 Treat getopt return value as int instead of char. Avoids bar getting stuck in an endless loop on PPC platforms. (Thanks to @electro7) 2015-02-14 00:09:34 +01:00
LemonBoy
704ba652d9 Clean up the code doing color parsing and handling. Implement gradients as a bonus feature (not yet exposed) 2015-02-14 00:06:43 +01:00
LemonBoy
392f23ef36 Strip all the unnecessary stuff when parsing the font list 2015-02-13 14:23:05 +01:00
Giuseppe
7f1f722965 Merge pull request #102 from mrshankly/fix-typo
Fix typo in README.pod about the scroll up/down buttons
2015-02-11 21:15:26 +01:00
João Marques
927c05604c Fix typo in README.pod about the scroll up/down buttons 2015-02-11 20:03:31 +00:00
Giuseppe
0affee3d2f Merge pull request #97 from otommod/stacking-clicks
Allow having clickable areas one inside another
2015-02-11 15:05:33 +01:00
Otto Modinos
8492309a88 change comment style 2015-02-11 14:54:47 +02:00
Otto Modinos
a313800686 move a declaration to the top of the function 2015-02-11 14:53:13 +02:00
Otto Modinos
4ad9cbd823 remove duplicate test 2015-02-11 14:53:12 +02:00
Otto Modinos
bb466a8c16 area_add: Use str directly
I don't why p was used, if there was a reason, please don't merge.
2015-02-11 14:52:44 +02:00
Otto Modinos
3483f1b083 typo, whitin -> within 2015-02-11 14:51:32 +02:00
Otto Modinos
7d2c7ab438 Allow having clickable areas inside another
Previously, if you started several areas, one inside another, only the
inermost one would get registered and eventually triggered. This patch
fixes that, allowing you to use multiple areas around text to respond to
several different buttons, for example, both scroll-up and scroll-down.

If you define two areas that respond to the same button, only the
innermost one would get triggered. I think this makes sense.
2015-02-11 14:51:10 +02:00
LemonBoy
e197a15c3a Fix a silly bound-checking error. (#101)
Close a long-standing PR by configuring the window position after mapping it
Set the window title
2015-02-10 20:35:11 +01:00
LemonBoy
6959085f8d Fixed two memory leaks. Don't treat unicode sequences over two bytes long as latin1 codepoints (fixes #99). 2015-01-25 21:14:06 +01:00
Giuseppe
78dc0d0d21 Merge pull request #98 from flannelhead/font-selection
Font selection
2015-01-21 20:12:05 +01:00
Sakari Kapanen
3b8afc6b05 Allow explicitly specifying the font with %{Tindex} 2015-01-21 20:43:22 +02:00
Giuseppe
c39c4e4d8b Merge pull request #95 from jvvv/master
Add break from main loop when X conn has error
2015-01-07 11:32:03 +01:00
John Vogel
145c66b471 Add break from main loop when X conn has error 2015-01-06 18:44:19 -05:00
LemonBoy
5746d15cf8 Handle escaped : in clickable areas. Fixes #92 2014-12-13 12:12:34 +01:00
LemonBoy
3c2b9ff150 Fix alpha mixing as suggested in #75 2014-11-21 14:19:31 +01:00
LemonBoy
95c41381ac Fix a silly off-by-one in the font cache code. Thanks to @easysid for noticing it! 2014-11-18 23:37:43 +01:00
Giuseppe
e9cdee9701 Merge pull request #78 from rootcoma/fix_click_area
Fix the bounds checking for area_get.
2014-08-27 10:24:08 +02:00
LemonBoy
dbbdf373a3 Better alpha mixing, should produce correct results 2014-08-20 22:42:10 +02:00
rootcoma
c258d0a0fa Fix the bounds checking for area_get.
Mouse at far left (x=0) would not be able to click an area that starts at 0.
2014-08-08 08:06:33 -07:00
LemonBoy
8475ff4fdb Small documentation update 2014-08-08 13:49:45 +02:00
LemonBoy
28b0db1cfa Little documentation fix, closes #73 2014-08-08 11:15:57 +02:00
LemonBoy
69e8ac6f07 Fix #69. Thanks @matchew ! 2014-07-24 10:50:31 +02:00
Giuseppe
6df9a2dd68 Merge pull request #70 from graboy/master
Optional support for more than two fonts, fixed issue #68
2014-07-23 21:29:03 +02:00
Grayson MacKenzie
02627e7609 Minor syntax cleanup. Changed parameter of select_drawable_font() to const 2014-07-22 18:35:21 -04:00
Grayson MacKenzie
1c106dbfd0 Added font caching 2014-07-22 17:23:56 -04:00
Grayson MacKenzie
128e212c14 General style cleanups. 2014-07-22 16:14:48 -04:00
Grayson MacKenzie
d22cd1561b Fixed #68 2014-07-22 15:20:21 -04:00
Grayson MacKenzie
f3e9df4a97 Added support for greater than two fonts. 2014-07-22 14:47:41 -04:00
7 changed files with 1471 additions and 1129 deletions

3
.gitignore vendored
View File

@ -1,5 +1,4 @@
config.h
bar
lemonbar
*.o
*.swp
*~

View File

@ -3,5 +3,8 @@ compiler:
- clang
- gcc
before_install:
- sudo apt-get install -qq libx11-xcb-dev libxcb-randr0-dev libxcb-xinerama0-dev
- sudo apt-get update -qq
- sudo apt-get install -y libx11-xcb-dev libxcb-randr0-dev libxcb-xinerama0-dev
env:
- CFLAGS='-DWITH_XINERAMA=1'
script: make

View File

@ -1,12 +1,19 @@
# This snippet has been shmelessly stol^Hborrowed from thestinger's repose Makefile
VERSION = 1.3
GIT_DESC=$(shell test -d .git && git describe --always 2>/dev/null)
ifneq "$(GIT_DESC)" ""
VERSION=$(GIT_DESC)
endif
CC ?= gcc
STRIP ?= strip
CFLAGS = -std=c99 -Os
LDFLAGS = -lxcb -lcairo -lxcb-xinerama -lxcb-randr
CFLAGS += -Wall -std=c99 -Os -DVERSION="\"$(VERSION)\""
LDFLAGS += -lxcb -lxcb-xinerama -lxcb-randr
CFDEBUG = -g3 -pedantic -Wall -Wunused-parameter -Wlong-long \
-Wsign-conversion -Wconversion -Wimplicit-function-declaration
EXEC = bar
SRCS = bar.c
EXEC = lemonbar
SRCS = lemonbar.c
OBJS = ${SRCS:.c=.o}
PREFIX?=/usr
@ -15,14 +22,13 @@ BINDIR=${PREFIX}/bin
all: ${EXEC}
doc: README.pod
pod2man --section=1 --center="bar Manual" --name "bar" --release="bar $(shell git describe --always)" README.pod > bar.1
pod2man --section=1 --center="lemonbar Manual" --name "lemonbar" --release="lemonbar $(VERSION)" README.pod > lemonbar.1
.c.o:
${CC} ${CFLAGS} -o $@ -c $<
${EXEC}: ${OBJS}
${CC} -o ${EXEC} ${OBJS} ${LDFLAGS}
${STRIP} -s ${EXEC}
debug: ${EXEC}
debug: CC += ${CFDEBUG}
@ -31,12 +37,12 @@ clean:
rm -f ./*.o ./*.1
rm -f ./${EXEC}
install: bar doc
install -D -m 755 bar ${DESTDIR}${BINDIR}/bar
install -D -m 644 bar.1 ${DESTDIR}${PREFIX}/share/man/man1/bar.1
install: lemonbar doc
install -D -m 755 lemonbar ${DESTDIR}${BINDIR}/lemonbar
install -D -m 644 lemonbar.1 ${DESTDIR}${PREFIX}/share/man/man1/lemonbar.1
uninstall:
rm -f ${DESTDIR}${BINDIR}/bar
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/bar.1
rm -f ${DESTDIR}${BINDIR}/lemonbar
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/lemonbar.1
.PHONY: all debug clean install

View File

@ -1,16 +1,16 @@
=head1 NAME
bar - bar ain't recursive
lemonbar - Featherweight lemon-scented bar
=for HTML <a href="https://travis-ci.org/LemonBoy/bar"><img src="https://travis-ci.org/LemonBoy/bar.svg?branch=master"></a>
=head1 SYNOPSIS
I<bar> [-h | -g I<width>B<x>I<height>B<+>I<x>B<+>I<y> | -b | -d | -f I<font> | -p | -u I<pixel> | -B I<color> | -F I<color>]
I<lemonbar> [-h | -g I<width>B<x>I<height>B<+>I<x>B<+>I<y> | -b | -d | -f I<font> | -p | -n I<name> | -u I<pixel> | -B I<color> | -F I<color> | -U I<color>]
=head1 DESCRIPTION
B<bar> is a lightweight bar entirely based on XCB. Provides full UTF-8 support, basic formatting, RandR and Xinerama support and EWMH compliance without wasting your precious memory.
B<lemonbar> (formerly known as B<bar>) is a lightweight bar entirely based on XCB. Provides full UTF-8 support, basic formatting, RandR and Xinerama support and EWMH compliance without wasting your precious memory.
=head1 OPTIONS
@ -34,11 +34,20 @@ Force docking without asking the window manager. This is needed if the window ma
=item B<-f> I<font>
Comma separated list of fonts, bar supports a maximum of two fonts.
Define the font to load into one of the five slots (the number of slots is hardcoded and can be tweaked by
changing the MAX_FONT_COUNT parameter in the source code).
=item B<-a> I<number>
Set number of clickable areas (default is 10)
=item B<-p>
Make bar permanent, don't exit after the standard input is closed.
Make the bar permanent, don't exit after the standard input is closed.
=item B<-n> I<name>
Set the WM_NAME atom value for the bar.
=item B<-u> I<pixel>
@ -46,17 +55,21 @@ Sets the underline width in pixels. The default is 1.
=item B<-B> I<color>
Set the background color of the bar. I<color> might be either in hex format (#aarrggbb) or in the symbolic name format (eg. white, brightred, darkgray). If no compositor such as compton or xcompmgr is running the alpha channel is silently ignored.
Set the background color of the bar. I<color> must be specified in the hex format (#aarrggbb, #rrggbb, #rgb). If no compositor such as compton or xcompmgr is running the alpha channel is silently ignored.
=item B<-F> I<color>
Set the foreground color of the bar. Accepts the same color formats as B<-B>.
=item B<-U> I<color>
Set the underline color of the bar. Accepts the same color formats as B<-B>.
=back
=head1 FORMATTING
bar provides a screenrc-inspired formatting syntax to allow full customization at runtime. Every formatting block is opened with B<%{> and closed by B<}> and accepts the following commands, the parser tries it's best to handle malformed input.
lemonbar provides a screenrc-inspired formatting syntax to allow full customization at runtime. Every formatting block is opened with C<%{> and closed by C<}> and accepts the following commands, the parser tries its best to handle malformed input. Use C<%%> to get a literal percent sign (C<%>).
=over
@ -76,6 +89,10 @@ Aligns the following text to the center of the screen.
Aligns the following text to the right side of the screen.
=item B<O>I<width>
Offset the current position by I<width> pixels in the alignment direction.
=item B<B>I<color>
Set the text background color. The parameter I<color> can be I<-> or a color in one of the formats mentioned before. The special value I<-> resets the color to the default one.
@ -84,21 +101,29 @@ Set the text background color. The parameter I<color> can be I<-> or a color in
Set the text foreground color. The parameter I<color> can be I<-> or a color in one of the formats mentioned before. The special value I<-> resets the color to the default one.
=item B<T>I<index>
Set the font used to draw the following text. The parameter I<index> can either be I<-> or the 1-based index of the slot which contains the desired font. If the parameter is I<-> lemonbar resets to the normal behavior (matching the first font that can be used for the character). If the selected font can't be used to draw a character, lemonbar will fall back to normal behavior for that character
=item B<U>I<color>
Set the text underline color. The parameter I<color> can be I<-> or a color in one of the formats mentioned before. The special value I<-> resets the color to the default one.
=item B<A>I<button>:I<command>:
Create a clickable area starting from the current position, when the area is clicked I<command> is executed. The area is closed when a B<A> token, not followed by : is encountered.
Create a clickable area starting from the current position, when the area is clicked I<command> is printed on stdout. The area is closed when a B<A> token, not followed by : is encountered.
Eg. I<%{A:reboot:} Click here to reboot %{A}>
The I<button> field is optional, it defaults to the left button, and it's a number ranging from 1 to 5 which maps to the left, middle, right, scroll down and scroll up movements. Your mileage may vary.
The I<button> field is optional, it defaults to the left button, and it's a number ranging from 1 to 5 which maps to the left, middle, right, scroll up and scroll down movements. Your mileage may vary.
Nested clickable areas can trigger different commands.
Eg. I<%{A:reboot:}%{A3:halt:} Left click to reboot, right click to shutdown %{A}%{A}>
=item B<S>I<dir>
Change the monitor bar is rendering to. I<dir> can be either
Change the monitor the bar is rendered to. I<dir> can be either
=over
@ -152,7 +177,7 @@ Draw a line under the text.
=head1 OUTPUT
Clicking on an area makes bar output the command to stdout, followed by a newline, allowing the user to pipe it into a script, execute it or simply ignore it. Simple and powerful, that's it.
Clicking on an area makes lemonbar output the command to stdout, followed by a newline, allowing the user to pipe it into a script, execute it or simply ignore it. Simple and powerful, that's it.
=head1 WWW
@ -160,7 +185,7 @@ L<git repository|https://github.com/LemonBoy/bar>
=head1 AUTHOR
2012-2014 (C) The Lemon Man
2012-2017 (C) The Lemon Man
Xinerama support was kindly contributed by Stebalien

1062
bar.c

File diff suppressed because it is too large Load Diff

1407
lemonbar.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
#!/usr/bin/env perl
#
# palette.pl
#
# Converts your .Xdefault/.Xresources colors into a ready to paste palette
# for bar. It takes your foreground/background settings into account and if
# it cant find them it leaves COLOR0/COLOR1 undefined.
#
use strict;
use warnings;
open (F, "<".$ARGV[0]) || die "Can't open!";
our %vars = ();
while (<F>) {
# Don't match comments
if ($_ !~ m/^\s*!/) {
# It's a define!
if ($_ =~ m/^\s*#define\s+(\w+)\s+#([0-9A-Fa-f]{1,6})/) {
$vars{"$1"} = hex($2);
}
elsif ($_ =~ m/^\s*\w*\*(background|foreground|color\d)\s*:\s*([\w\d#]+)/) {
my ($name, $value) = (uc $1, $2);
# Check if it's a color
if (substr($value, 0, 1) eq '#') {
$value = hex(substr($value, 1));
} else {
$value = $vars{"$value"};
}
printf "#define $name 0x%06x\n", $value;
}
}
}