Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #27379 > unrolled thread

lemonbar, an x11 status / task bar type program

Started byEli the Bearded <*@eli.users.panix.com>
First post2019-06-21 23:07 +0000
Last post2019-06-21 23:07 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.os.linux.misc


Contents

  lemonbar, an x11 status / task bar type program Eli the Bearded <*@eli.users.panix.com> - 2019-06-21 23:07 +0000

#27379 — lemonbar, an x11 status / task bar type program

FromEli the Bearded <*@eli.users.panix.com>
Date2019-06-21 23:07 +0000
Subjectlemonbar, an x11 status / task bar type program
Message-ID<eli$1906211847@qaz.wtf>
I was looking around for simple taskbar type programs today and came
across lemonbar:

https://github.com/X11-good-tools/lemonbar
(which is just a easier-to-find fork from github.com/LemonBoy/bar )

It basically draws a bar, by default maybe 16 pixels tall full screen
width, at the top of the screen.

It then prints in that bar (subject to some formatting rules) everything
it gets on STDIN. And if you set up "action" areas, clicks on those will
cause it to spit out some stuff to standard out.

None of the examples I found seemed to use the action button thing.
I worked out a basic config for me that does have a button:

$ cat runlemonbar
#!/bin/sh

# barcolor, a medium blue
barbg='#4Af' 
# bar geometry: {default width}x{32 height}+{default x}+{default y}
bargeo="x32++"
# bar max buttons
barmax=16

# note that button commands should self-daemonize
barfiller | lemonbar -b -B "$barbg" -g "$bargeo" -a $barmax | perl -we '
        while(<STDIN>) { print "per lemonbar, running $_" ; system( $_
	); } '

# end runlemonbar

$ cat barfiller
#!/bin/sh
# modified example from https://wiki.archlinux.org/index.php/Lemonbar
#
# lemonbar uses the following commands to color the text, background or
# the
# under/overline. Colors can be specified via the formats #RRGGBB,
# #AARRGGBB
# (with an alpha channel; this requires a compositor to be running), or
# even
# #RGB.
#
# Command       Meaning
# %{Fcolor}     Use color as the foreground/font color
# %{Bcolor}     Use color as the background
# %{Ucolor}     Use color for under/overlining the text
# Text alignment
#
# lemonbar also supports alignment of text. It uses the following
# commands to align the text
# Command       Meaning
# %{l}  Aligns the text to the left
# %{c}  Aligns the text to the center
# %{r}  Aligns the text to the right
#
# %{Abutton:command:} Display text %{A}
#       when mouse button "button" (1 to 5, default 1) is clicked on
#       "Display text" print "command"


# Define the clock
Clock() {
    DATETIME=$(date "+%a %b %d %T")

    echo -n "$DATETIME"
}

Uptime() {
    UPTIME=$(uptime | sed 's/.*average: //')

    echo -n "$UPTIME"
}

# note all literal % doubled for printf
while true; do
    # Left align and set some colors
    printf "%%{l}%%{F#FFFF00}%%{B#0000FF} "

    # print an xterm action button
    printf "%%{A:$HOME/bin/runxterm:} new xterm %%{A}"

    # Right align and set different colors
    printf "%%{r}%%{F#F0F040}%%{B#4040FF} "

    Uptime
    # spacer
    printf "                "
    Clock

    # end FG/FB color changes
    printf "%%{F-}%%{B-}"

    # end of line, signals to lemonbar to print something
    echo
    sleep 5
done

# end barfiller

$ cat runxterm
#!/bin/sh

# put the xterm in it's own process group, so it survives the parent
# process dying (so, eg, I can restart lemonbar with a different 
# barfiller config)
set -m
exec xterm -geometry 100x24 &

# end runxterm

Anyone else use lemonbar? Suggestions?

Elijah
------
doesn't want fancy bells and whistles

[toc] | [standalone]


Back to top | Article view | comp.os.linux.misc


csiph-web