General cleanup. New formatting syntax. More cleanup. Documentation. Did I say cleanup ?
This commit is contained in:
parent
3f4ed1600a
commit
b60e45ee08
20
Makefile
20
Makefile
|
@ -1,6 +1,6 @@
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
STRIP ?= strip
|
STRIP ?= strip
|
||||||
CFLAGS = -std=c99 -O2
|
CFLAGS = -std=c99 -Os
|
||||||
LDFLAGS = -lxcb -lxcb-xinerama -lxcb-randr
|
LDFLAGS = -lxcb -lxcb-xinerama -lxcb-randr
|
||||||
CFDEBUG = -g3 -pedantic -Wall -Wunused-parameter -Wlong-long\
|
CFDEBUG = -g3 -pedantic -Wall -Wunused-parameter -Wlong-long\
|
||||||
-Wsign-conversion -Wconversion -Wimplicit-function-declaration
|
-Wsign-conversion -Wconversion -Wimplicit-function-declaration
|
||||||
|
@ -14,15 +14,12 @@ BINDIR=${PREFIX}/bin
|
||||||
|
|
||||||
all: ${EXEC}
|
all: ${EXEC}
|
||||||
|
|
||||||
|
doc: README.pod
|
||||||
|
pod2man --section=1 --center="bar Manual" --name "bar" --release="bar $(shell git describe --always)" README.pod > bar.1
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
${CC} ${CFLAGS} -o $@ -c $<
|
${CC} ${CFLAGS} -o $@ -c $<
|
||||||
|
|
||||||
${OBJS}: config.h
|
|
||||||
|
|
||||||
config.h:
|
|
||||||
@echo creating $@ from config.def.h
|
|
||||||
@cp config.def.h $@
|
|
||||||
|
|
||||||
${EXEC}: ${OBJS}
|
${EXEC}: ${OBJS}
|
||||||
${CC} -o ${EXEC} ${OBJS} ${LDFLAGS}
|
${CC} -o ${EXEC} ${OBJS} ${LDFLAGS}
|
||||||
${STRIP} -s ${EXEC}
|
${STRIP} -s ${EXEC}
|
||||||
|
@ -31,14 +28,15 @@ debug: ${EXEC}
|
||||||
debug: CC += ${CFDEBUG}
|
debug: CC += ${CFDEBUG}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f ./*.o
|
rm -f ./*.o ./*.1
|
||||||
rm -f ./${EXEC}
|
rm -f ./${EXEC}
|
||||||
|
|
||||||
install: bar
|
install: bar doc
|
||||||
test -d ${DESTDIR}${BINDIR} || mkdir -p ${DESTDIR}${BINDIR}
|
install -D -m 755 bar ${DESTDIR}${BINDIR}/bar
|
||||||
install -m755 bar ${DESTDIR}${BINDIR}/bar
|
install -D -m 644 bar.1 ${DESTDIR}${PREFIX}/share/man/man1/bar.1
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f ${DESTDIR}${BINDIR}/bar
|
rm -f ${DESTDIR}${BINDIR}/bar
|
||||||
|
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/bar.1
|
||||||
|
|
||||||
.PHONY: all debug clean install
|
.PHONY: all debug clean install
|
||||||
|
|
70
README.md
70
README.md
|
@ -1,70 +0,0 @@
|
||||||
b(ar) a(in't) r(ecursive)
|
|
||||||
=========================
|
|
||||||
2012-2013 (C) The Lemon Man
|
|
||||||
|
|
||||||
A lightweight bar based on XCB (yay). Provides foreground/background color
|
|
||||||
switching along with text alignment (screw you dzen!), full utf8 support
|
|
||||||
and reduced memory footprint. It also supports transparency when using a
|
|
||||||
compositor such as compton. Nothing less and nothing more.
|
|
||||||
|
|
||||||
Xinerama support
|
|
||||||
----------------
|
|
||||||
Thanks to @Stebalien now bar is Xinerama compliant, just compile it with
|
|
||||||
XINERAMA=1 and you're good to go!
|
|
||||||
|
|
||||||
Options
|
|
||||||
-------
|
|
||||||
bar accepts a couple of command line switches.
|
|
||||||
|
|
||||||
```
|
|
||||||
-h Show the help and bail out.
|
|
||||||
-p Make the bar permanent.
|
|
||||||
-f Force docking (use this if your WM isn't EWMH compliant)
|
|
||||||
-b Show the bar at the bottom of the screen.
|
|
||||||
```
|
|
||||||
|
|
||||||
Configuration
|
|
||||||
-------------
|
|
||||||
Change the config.h file and you're good to go!
|
|
||||||
The text background and foreground are respectively the first and the second
|
|
||||||
entries in the palette (COLOR0 and COLOR1).
|
|
||||||
|
|
||||||
Colors
|
|
||||||
------
|
|
||||||
Attached there's palette.pl, an handy tool that extracts a palette from your
|
|
||||||
X colors and returns it ready to be pasted in the configuration file.
|
|
||||||
|
|
||||||
```
|
|
||||||
palette.pl <.Xresources / .Xdefaults path>
|
|
||||||
```
|
|
||||||
|
|
||||||
If you keep your colors in a separate file just feed that file and you're good
|
|
||||||
to go.
|
|
||||||
|
|
||||||
Text formatting
|
|
||||||
---------------
|
|
||||||
All the format commands are preceded by a backslash (\\).
|
|
||||||
To draw a backslash just backslash escape it (\\\\).
|
|
||||||
|
|
||||||
```
|
|
||||||
f<0-9> Selects the text foreground color from the palette.
|
|
||||||
b<0-9> Selects the text background color from the palette.
|
|
||||||
u<0-9> Selects the underline color from the palette.
|
|
||||||
To reset the bg/fg/underline color just pass 'r' as the color index.
|
|
||||||
|
|
||||||
l Aligns the text to the left.
|
|
||||||
c Aligns the text to the center.
|
|
||||||
r Aligns the text to the right.
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
The options below are valid only if compiled with Xinerama support.
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
s<0-9> Switches to screen 0-9
|
|
||||||
sn Switches to next screen
|
|
||||||
sp Switches to previous screen
|
|
||||||
sr Switches to the rightmost screen (the latest)
|
|
||||||
sl Switches to the leftmost screen (the first)
|
|
||||||
```
|
|
153
README.pod
Normal file
153
README.pod
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
bar - bar ain't recursive
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
I<bar> [-h | -g I<width>B<x>I<height> | -b | -d | -f I<font> | -a I<alpha>| -p | -B I<color> | -F 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.
|
||||||
|
|
||||||
|
=head1 OPTIONS
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<-h>
|
||||||
|
|
||||||
|
Display the help and exit.
|
||||||
|
|
||||||
|
=item B<-g> I<width>B<x>I<height>
|
||||||
|
|
||||||
|
Set the window geometry. Both the parameters can be omitted, bar defaults the former to the whole width and the height to the font height + 1 pixel.
|
||||||
|
|
||||||
|
=item B<-b>
|
||||||
|
|
||||||
|
Dock the bar at the bottom of the screen.
|
||||||
|
|
||||||
|
=item B<-d>
|
||||||
|
|
||||||
|
Force docking without asking the window manager. This is needed if the window manager isn't EWMH compliant.
|
||||||
|
|
||||||
|
=item B<-f> I<font>
|
||||||
|
|
||||||
|
Comma separated list of fonts, bar supports a maximum of two fonts.
|
||||||
|
|
||||||
|
=item B<-a> I<alpha>
|
||||||
|
|
||||||
|
Set the bar alpha in range 0.0 to 1.0. This requires a compositor manager such as Compton.
|
||||||
|
|
||||||
|
=item B<-p>
|
||||||
|
|
||||||
|
Make bar permanent, don't exit after the standard input is closed.
|
||||||
|
|
||||||
|
=item B<-B> I<color>
|
||||||
|
|
||||||
|
Set the background color of the bar. I<color> might be either in hex format (#rrggbb) or in the symbolic name format (eg. white, brightred, darkgray).
|
||||||
|
|
||||||
|
=item B<-F> I<color>
|
||||||
|
|
||||||
|
Set the foreground 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.
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<R>
|
||||||
|
|
||||||
|
Swap the current background and foreground colors.
|
||||||
|
|
||||||
|
=item B<l>
|
||||||
|
|
||||||
|
Aligns the following text to the left side of the screen.
|
||||||
|
|
||||||
|
=item B<c>
|
||||||
|
|
||||||
|
Aligns the following text to the center of the screen.
|
||||||
|
|
||||||
|
=item B<r>
|
||||||
|
|
||||||
|
Aligns the following text to the right side of the screen.
|
||||||
|
|
||||||
|
=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.
|
||||||
|
|
||||||
|
=item B<F>I<color>
|
||||||
|
|
||||||
|
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<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<S>I<dir>
|
||||||
|
|
||||||
|
Change the monitor bar is rendering to. I<dir> can be either
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<+>/B<->
|
||||||
|
|
||||||
|
Next/previous monitor.
|
||||||
|
|
||||||
|
=item B<f>/B<l>
|
||||||
|
|
||||||
|
First/last monitor.
|
||||||
|
|
||||||
|
=item I<0-9>
|
||||||
|
|
||||||
|
Nth monitor.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
B<Attribute modifiers>
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<+>I<attribute>
|
||||||
|
|
||||||
|
Set the attribute I<attribute> for the following text.
|
||||||
|
|
||||||
|
=item B<->I<attribute>
|
||||||
|
|
||||||
|
Unset the attribute I<attribute> for the following text.
|
||||||
|
|
||||||
|
=item B<!>I<attribute>
|
||||||
|
|
||||||
|
Toggle the attribute I<attribute> for the following text.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
Where I<attribute> is one of the following
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<o>
|
||||||
|
|
||||||
|
Draw a line over the text.
|
||||||
|
|
||||||
|
=item B<u>
|
||||||
|
|
||||||
|
Draw a line under the text.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 WWW
|
||||||
|
|
||||||
|
L<git repository|https://github.com/LemonBoy/bar>
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
2012-2014 (C) The Lemon Man
|
||||||
|
|
||||||
|
Xinerama support was kindly contributed by Stebalien
|
||||||
|
|
||||||
|
RandR support was kindly contributed by jvvv
|
15
config.def.h
15
config.def.h
|
@ -1,15 +0,0 @@
|
||||||
/* The thickness of the underline (in pixels). Set to 0 to disable. */
|
|
||||||
#define BAR_UNDERLINE_HEIGHT 2
|
|
||||||
/* Color palette */
|
|
||||||
#define BACKGROUND 0x232c31
|
|
||||||
#define COLOR0 0x2d3c46
|
|
||||||
#define COLOR1 0xac4142
|
|
||||||
#define COLOR2 0x90a959
|
|
||||||
#define COLOR3 0xde935f
|
|
||||||
#define COLOR4 0x6a9fb5
|
|
||||||
#define COLOR5 0xaa759f
|
|
||||||
#define COLOR6 0x75b5aa
|
|
||||||
#define COLOR7 0x6c7a80
|
|
||||||
#define COLOR8 0x425059
|
|
||||||
#define COLOR9 0xcc6666
|
|
||||||
#define FOREGROUND 0xc5c8c6
|
|
Loading…
Reference in New Issue
Block a user