You are not logged in.

#51 2012-09-29 08:55:10

TheLemonMan
Member
From: Italy
Registered: 2011-09-04
Posts: 214
Website

Re: bar - Lightweight xcb-based bar

gholen wrote:

Speaking of that, how does one pipe DZEN in a good way?

The only good dzen is a dead one big_smile

Offline

#52 2012-09-29 08:56:54

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: bar - Lightweight xcb-based bar

+1

anyway, dzen should probably be invoked with '-e -p'
and probably in that order too


.:[ git me! ] :.

Offline

#53 2012-09-29 10:45:06

gholen
Member
From: Göteborg
Registered: 2011-07-26
Posts: 73
Website

Re: bar - Lightweight xcb-based bar

Okay, thanks smile

Offline

#54 2012-09-29 13:33:43

kalle97
Member
Registered: 2012-07-18
Posts: 80

Re: bar - Lightweight xcb-based bar

Shinryuu wrote:
kalle97 wrote:

Can someone help me making "One Two Three" appear as only "One" for desktop 0, "Two" for desktop 1, "Three" for desktop 2 if you understand what I mean?

Thanks.

Mhh, I don't really understand your question but I noticed that you have an extra space in desktop "One".

# desktop names                                                                       
ds=(" One" "Two" "Three") 

Well, my current code outputs like this:

One Two Three                    Tiling mode                                    Time

I want One Two Three to only display one at the time, you get what i mean?

Thanks.

Offline

#55 2012-10-07 22:28:58

gholen
Member
From: Göteborg
Registered: 2011-07-26
Posts: 73
Website

Re: bar - Lightweight xcb-based bar

I have a problem of with I ask for help here.
When using bar, I try to load icons using this method ;

tags=('\ue010 foo')

and by that call on stlarch_icons. However, this does not seem to work. I have of course installed all the neccisery fonts, and recompiled bar. My config.h for bar looks like this:

/* The height of the bar (in pixels) */
#define BAR_HEIGHT  18
/* The width of the bar. Set to -1 to fit screen */
#define BAR_WIDTH   -1
/* Offset from the left. Set to 0 to have no effect */
#define OFFSET 0
/* Choose between an underline or an overline */
#define BAR_UNDERLINE 1
/* The thickness of the underline (in pixels). Set to 0 to disable. */
#define BAR_UNDERLINE_HEIGHT 1
/* Default bar position, overwritten by '-b' switch */
#define BAR_BOTTOM 0
/* The fonts used for the bar, comma separated. Only the first 2 will be used. */
#define BAR_FONT       "-Misc-Stlarch-Medium-R-Normal--10-100-75-75-C-80-ISO10646-1","-*-termsyn-medium-r-*-*-11-*-*-*-*-*-*-*"
/* Color palette */
#define COLOR0  0x151515 /* Background */
#define COLOR1  0xddeedd /* Foreground */
#define COLOR2  0x282830 /* Black'n'Gray */
#define COLOR3  0xcc0f16 /* Red */
#define COLOR4  0x92b03e /* Green */
#define COLOR5  0xdc7802 /* Orange */
#define COLOR6  0x007799 /* Blue */
#define COLOR7  0x7d1b66 /* Magenta */
#define COLOR8  0x426870 /* Cyan */
#define COLOR9  0xeeeeee /* White */

Compiling goes just fine.


What, if anything, am I doing wrong? Thanks!

Offline

#56 2012-10-08 05:07:18

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: bar - Lightweight xcb-based bar

kalle97 wrote:
Shinryuu wrote:
kalle97 wrote:

Can someone help me making "One Two Three" appear as only "One" for desktop 0, "Two" for desktop 1, "Three" for desktop 2 if you understand what I mean?

Thanks.

Mhh, I don't really understand your question but I noticed that you have an extra space in desktop "One".

# desktop names                                                                       
ds=(" One" "Two" "Three") 

Well, my current code outputs like this:

One Two Three                    Tiling mode                                    Time

I want One Two Three to only display one at the time, you get what i mean?

Thanks.

Do you mean something like this?

If so here is my setup. If you don't use xinerama you will have to change it slightly.

#!/usr/bin/env bash

wm=monsterwm
ff="/tmp/monsterwm.fifo"

[[ -p $ff ]] || mkfifo -m 600 $ff

tags=('One' 'Two' 'Three' 'Four' 'Five')
#layouts=("" "" "" "" "" "")
layouts=("" "" "" "" "")

function statusbar {
    the_date=$(date +"%a, %b %d %R")
    music_status=$(mpc current)
    [[ -z "$music_status" ]] && music="" || music="\\b7\\f0  \\b0\\f7 $music_status "
    echo "$music\\b7\\f0  \\b0\\f7 $the_date \\b0\f7"
}

while read -t 1 -r wmout || true; do
    if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
        read -ra desktops <<< "$wmout"

        for desktop in "${desktops[@]}"; do
            if (( ${desktop%%:*} == 0 )); then
                lmon+=( $desktop )
            elif (( ${desktop%%:*} == 1 )); then
                rmon+=( $desktop )
            fi
        done

        for ldesktop in "${lmon[@]}"; do
            IFS=':' read -r x y d w m c u <<< "$ldesktop"
            ((c)) && label="${tags[$d]}" layout="\\b7\\f0 ${layouts[$m]} \\b0\\f7"
        done
    fi
    echo "\\l$layout $label\\r\\f7$(statusbar)"
done < "$ff" | ~/bin/lmonbar &

#$wm > $ff
while :; do "$wm" || break; done | tee -a "$ff"

Offline

#57 2012-10-09 03:39:55

nem
Member
Registered: 2009-12-15
Posts: 46

Re: bar - Lightweight xcb-based bar

works in herbstluftwm smile great stuff!

edit: why do you have those variable operators (?= and +=) in the makefile? i wanted to add the project to the AUR but the buildprocess fails because of them. makepkg predefines build variables.

Last edited by nem (2012-10-09 05:30:42)

Offline

#58 2012-10-13 13:40:23

Ypnose
Member
From: Jailed in the shell
Registered: 2011-04-21
Posts: 353
Website

Re: bar - Lightweight xcb-based bar

Actually, I modified the Makefile myself for a custom PKGBUILD. I don't know if I could do a pull request, about ?= and +=, as you said before.


Github -- My terminal font Envypn

Offline

#59 2012-10-13 16:16:16

Sirsurthur
Member
Registered: 2009-02-02
Posts: 124

Re: bar - Lightweight xcb-based bar

@nem and @Ypnose : I agree, would be great to add this in AUR.

Offline

#60 2012-10-14 12:25:37

Ypnose
Member
From: Jailed in the shell
Registered: 2011-04-21
Posts: 353
Website

Re: bar - Lightweight xcb-based bar

I did the pull request. Before it's accepted or not, I can build the package with my modifications: https://github.com/Ypnose/bar


Github -- My terminal font Envypn

Offline

#61 2012-10-16 11:32:46

nperry
Member
Registered: 2010-05-16
Posts: 86

Re: bar - Lightweight xcb-based bar

Forgive me if this is expected behaviour, I don't believe it is.

I have two monitors, VGA1 1440*900 & LVDS1 1366*768.

Currently at the moment I run at the moment.

xrandr  --output LVDS1 --auto --primary --output VGA1 --auto --left-of LVDS1

This means that the screens are not aligned when I move over using my cursor. Is my current arandr setup

However if I use

xrandr --output HDMI1 --off --output LVDS1 --mode 1366x768 --pos 1440x132 --rotate normal --output DP1 --off -    -output VGA1 --mode 1440x900 --pos 0x0 --rotate normal

which sets the screens to be aligned correctly. Bar doesn't show on LVDS1, it seems to think the top of is 132 pixels above the screen resolution. Is the arandr setup

Is there any way around this, as it annoys me that the screens aren't aligned when I move my cursor between them.

Offline

#62 2012-10-17 17:20:28

ma
Member
Registered: 2012-01-29
Posts: 54

Re: bar - Lightweight xcb-based bar

hellomynameisphil wrote:

I tested bar in openbox and I can't get it correctly positioned on the screen. I only tried it with BAR_BOTTOM set to 1.

I have the same problem with Openbox. The following patch seems to help:

diff --git a/bar.c b/bar.c
index 58698e7..44d3b56 100644
--- a/bar.c
+++ b/bar.c
@@ -360,6 +360,7 @@ init (void)
 
     /* Make the bar visible */
     xcb_map_window (c, win);
+    xcb_configure_window (c, win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, (const uint32_t []){ BAR_OFFSET, y });
     xcb_flush (c);
 }

Offline

#63 2012-10-17 19:09:28

TheLemonMan
Member
From: Italy
Registered: 2011-09-04
Posts: 214
Website

Re: bar - Lightweight xcb-based bar

ma wrote:
hellomynameisphil wrote:

I tested bar in openbox and I can't get it correctly positioned on the screen. I only tried it with BAR_BOTTOM set to 1.

I have the same problem with Openbox. The following patch seems to help:

diff --git a/bar.c b/bar.c
index 58698e7..44d3b56 100644
--- a/bar.c
+++ b/bar.c
@@ -360,6 +360,7 @@ init (void)
 
     /* Make the bar visible */
     xcb_map_window (c, win);
+    xcb_configure_window (c, win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, (const uint32_t []){ BAR_OFFSET, y });
     xcb_flush (c);
 }

Nice one smile Does it work fine under other non-tiling DE with this patch ?

Offline

#64 2012-10-17 19:25:27

ma
Member
Registered: 2012-01-29
Posts: 54

Re: bar - Lightweight xcb-based bar

@TheLemonMan: Sorry, I don't know. Openbox is the only one I have.

Offline

#65 2012-10-18 07:41:56

ma
Member
Registered: 2012-01-29
Posts: 54

Re: bar - Lightweight xcb-based bar

Hm, setting either the user-specified or the program-specified position (or both) helps too. This might actually be better than the previous solution.

diff --git a/Makefile b/Makefile
index 2ebf437..3f94e7a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 CC	?= gcc
 STRIP ?= strip
 CFLAGS ?= -std=c99 -fshort-wchar -Os
-LDFLAGS += -lxcb
+LDFLAGS += -lxcb -lxcb-icccm
 CFDEBUG = -g3 -pedantic -Wall -Wunused-parameter -Wlong-long\
 		  -Wsign-conversion -Wconversion -Wimplicit-function-declaration
 
diff --git a/bar.c b/bar.c
index 58698e7..5bcdf60 100644
--- a/bar.c
+++ b/bar.c
@@ -8,6 +8,7 @@
 #include <getopt.h>
 #include <unistd.h>
 #include <xcb/xcb.h>
+#include <xcb/xcb_icccm.h>
 
 #include "config.h"
 
@@ -341,6 +342,14 @@ init (void)
     /* Set EWMH hints */
     int ewmh_docking = set_ewmh_atoms (root);
 
+    /* Set position */
+    xcb_size_hints_t size_hints = {
+        .flags = XCB_ICCCM_SIZE_HINT_US_POSITION | XCB_ICCCM_SIZE_HINT_P_POSITION,
+        .x = BAR_OFFSET,
+        .y = y
+    };
+    xcb_icccm_set_wm_normal_hints (c, win, &size_hints);
+
     /* Quirk for wm not supporting the EWMH docking method */
     xcb_change_window_attributes (c, win, XCB_CW_OVERRIDE_REDIRECT, (const uint32_t []){ !ewmh_docking });
 

Offline

#66 2012-11-09 14:33:04

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: bar - Lightweight xcb-based bar

One question! I have some weird problems with different fonts such as anorexia. Why the text is so close and shrinked?
sadbaby.png

/* The height of the bar (in pixels) */
#define BAR_HEIGHT  16
/* The width of the bar. Set to -1 to fit screen */
#define BAR_WIDTH   -1
/* Offset from the left. Set to 0 to have no effect */
#define BAR_OFFSET 0
/* Choose between an underline or an overline */
#define BAR_UNDERLINE 1
/* The thickness of the underline (in pixels). Set to 0 to disable. */
#define BAR_UNDERLINE_HEIGHT 2
/* Default bar position, overwritten by '-b' switch */
#define BAR_BOTTOM 0
/* The fonts used for the bar, comma separated. Only the first 2 will be used. */
#define BAR_FONT	"-Misc-Stlarch-Medium-R-Normal--10-100-75-75-C-80-ISO10646-1","-*-anorexia-medium-*-*-*-11-*-*-*-*-*-*-*"
/* Color palette */
#define COLOR0	0x202020 /* Background */
#define COLOR1	0xddeedd /* Foreground */
#define COLOR2	0x303032 /* Black'n'Gray */
#define COLOR3	0xf54844 /* Red */
#define COLOR4	0x92b03e /* Green */
#define COLOR5	0xec9d08 /* Orange */
#define COLOR6	0x007799 /* Blue */
#define COLOR7	0x6b0f38 /* Magenta */
#define COLOR8	0x426870 /* Cyan */
#define COLOR9	0xeeeeee /* White */

Last edited by Shinryuu (2012-11-09 14:38:53)

Offline

#67 2012-11-10 14:40:00

TheLemonMan
Member
From: Italy
Registered: 2011-09-04
Posts: 214
Website

Re: bar - Lightweight xcb-based bar

Retarded font is retarded. Fix commited smile

Offline

#68 2012-11-11 01:22:16

kuraku
Member
From: planet Earth
Registered: 2012-01-03
Posts: 202

Re: bar - Lightweight xcb-based bar

Can somebody explain to me why i cant use bar with my script?
Here are my:
- bar config.h: http://ix.io/3mo/c
- sys_monitor_plain.sh: http://ix.io/3mp/sh .

I can see last 3 characters of script output but only at the begining of the bar. I'm not sure what to do. Here is the shot:
T0ztbs.png

I need to see here whole line as displayed in terminal not just the 2 end digits from date yikes)
I start bar like this:

sys_monitor_plain.sh | bar -p

Help?

Offline

#69 2012-11-12 07:57:30

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: bar - Lightweight xcb-based bar

TheLemonMan wrote:

Retarded font is retarded. Fix commited smile

:'( thanks

kuraku wrote:

Can somebody explain to me why i cant use bar with my script?
Here are my:
- bar config.h: http://ix.io/3mo/c
- sys_monitor_plain.sh: http://ix.io/3mp/sh .

I can see last 3 characters of script output but only at the begining of the bar. I'm not sure what to do. Here is the shot:
http://i.imgur.com/T0ztbs.png

I need to see here whole line as displayed in terminal not just the 2 end digits from date yikes)
I start bar like this:

sys_monitor_plain.sh | bar -p

Help?

I think you have to modify your code a bit, it didn't work here either. I was able to make something to work when I changed things like this:

keyboard_indicator() {
if [ ! -z "$(setxkbmap -query | grep "layout" | awk '{print $2}' )" ]
   then
     echo -e "$(setxkbmap -query | grep "layout" | awk '{print $2}' )"
   else
     echo -e "??"
   fi
 }

time_and_date(){
   time_and_date="$(date "+%H:%M %d%m%Y")"
   echo -e "$time_and_date"
 }

to

# keyboard indicator
kbd="$(setxkbmap -query | grep "layout" | awk '{print $2}')" kbdstat="\ue14a"

# date and time
date="$(date +"%R")" dstat="\ue016"
...
...
# and in the end of the script
printf '\\b2\\u2 %s \\br\\ur %s' "$kbdstat" "$kbd" "$dstat" "$date"
printf '\n'

Last edited by Shinryuu (2012-11-12 08:05:20)

Offline

#70 2012-11-12 18:00:09

kuraku
Member
From: planet Earth
Registered: 2012-01-03
Posts: 202

Re: bar - Lightweight xcb-based bar

@Shinryuu
Thank you, i will try it out tonight.

p.s. Actually, your fix makes a lot of sense (as in bash scripting). I will try it out asap.

[Edit]
Nope, i cant do it. It does not make any sense to me to format code like that and it is not really intuitive. Also, i only see last 2 digits of clock whatever i try.

Last edited by kuraku (2012-11-14 14:38:12)

Offline

#71 2012-11-14 19:44:34

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: bar - Lightweight xcb-based bar

kuraku wrote:

@Shinryuu
Thank you, i will try it out tonight.

p.s. Actually, your fix makes a lot of sense (as in bash scripting). I will try it out asap.

[Edit]
Nope, i cant do it. It does not make any sense to me to format code like that and it is not really intuitive. Also, i only see last 2 digits of clock whatever i try.

Mhh, there's something in the code that messes something but I have no idea what it is.

Offline

#72 2013-02-18 03:10:24

gholen
Member
From: Göteborg
Registered: 2011-07-26
Posts: 73
Website

Re: bar - Lightweight xcb-based bar

New install. New system. Still arch. Bar? Nope, does not compute. I cant get the F-ing bar to show up.

My barcode:

#!/usr/bin/env bash

wm=monsterwm
ff="/tmp/$RANDOM.monsterwm.fifo"

tags=('null' 'irc' 'foo' 'pr0n')
layouts=('T' 'M' 'B' 'G' 'F') 

[[ -p $ff ]] || mkfifo -m 600 "$ff"

function statusbar {
    # Date
    date=$(date +"%a %d/%m %R")
    #cpu=$(sh /home/paul/bin/cpu.sh)
    cpu=$(awk 'BEGIN{i=0}
    {sum[i]=$2+$3+$4+$5; idle[i++]=$5}
    END {printf "%d\n", 100*( (sum[1]-sum[0]) - (idle[1]-idle[0]) ) / (sum[1]-sum[0])}
    ' <( head -n 1 /proc/stat; sleep 0.5; head -n 1 /proc/stat))
    # Battery
    #bat=$(sh /home/paul/bin/battery.sh)
    bat=$(acpi -b|awk 'sub(/,/,"") {print $3, $5}')
    # Volume
    vol=$(amixer get PCM | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')
    # Music status
    #music="$(mpc current -f "%artist% - %title%")"
    #if [ -z "$music" ]; then music="stopped" mstat="\ue0ae"
    #else
    #mstat="$(mpc | sed -rn '2s/\[([[:alpha:]]+)].*/\1/p')"
    #[ "$mstat" == "paused" ] && mstat="\ue059" || mstat="\ue0aa"
    #fi

    echo "\r  \f4\▒\fr $cpu%  \f4\\\fr $bat  \f4\\fr   \f4\\fr $date "
}

while read -t 1 -r wmout || true; do
    if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
        read -ra desktops <<< "$wmout"

        tmp=
        for desktop in "${desktops[@]}"; do
            IFS=':' read -r d w m c u <<< "$desktop"
            # Tags labels
            label=${tags[$d]}
            # Current desktop color and enclosing char (yes/no)
            ((c)) && fg="9" bg="2" lc="\u4 " rc=" \ur" && layout=${layouts[$m]} || fg="1" bg="0" lc=" " rc=" "
            # Has windows ?
            ((w)) && ((! c)) && fg="6" lc="\u6 " rc=" \ur"
            # Urgent windows ?
            ((u)) && fg="9" bg="3" lc="\u4 " rc=" \ur"

            tmp+="\f$fg\b$bg$lc$label$rc\fr\br"
        done
        # Merge the clients indications and the tile mode
        tmp+=" $layout"
    fi
    echo "$tmp $(statusbar)"
done < "$ff" | bar &
#while :; do "$wm" || break; done | tee -a "$ff"
$wm > "$ff"

rm $ff

I cant get it to show.

other conf's.

.xinitrc

setxkbmap se &
/home/gholen/monster1.sh &
monsterwm

bar's config.h

/* The height of the bar (in pixels) */
#define BAR_HEIGHT  18
/* The width of the bar. Set to -1 to fit screen */
#define BAR_WIDTH   -1
/* Offset from the left. Set to 0 to have no effect */
#define BAR_OFFSET 0
/* Choose between an underline or an overline */
#define BAR_UNDERLINE 1
/* The thickness of the underline (in pixels). Set to 0 to disable. */
#define BAR_UNDERLINE_HEIGHT 2
/* Default bar position, overwritten by '-b' switch */
#define BAR_BOTTOM 0
/* The fonts used for the bar, comma separated. Only the first 2 will be used. */
#define BAR_FONT       "-Misc-Stlarch-Medium-R-Normal--10-100-75-75-C-80-ISO10646-1","-*-termsyn-medium-r-*-*-14-*-*-*-*-*-*-*"
#define BAR_FONT_FALLBACK_WIDTH 6
/* Color palette */
#define COLOR0  0x151515 /* Background */
#define COLOR1  0xddeedd /* Foreground */
#define COLOR2  0x282830 /* Black'n'Gray */
#define COLOR3  0xcc0f16 /* Red */
#define COLOR4  0x92b03e /* Green */
#define COLOR5  0xdc7802 /* Orange */
#define COLOR6  0x007799 /* Blue */
#define COLOR7  0x7d1b66 /* Magenta */
#define COLOR8  0x426870 /* Cyan */
#define COLOR9  0xeeeeee /* White */

All i get is a whole lot of nothing. What am I doing wrong?

Offline

#73 2013-02-18 20:16:14

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: bar - Lightweight xcb-based bar

You don't seem to launch bar anywhere and your script runs just fine and I think you have to use a script to launch monsterwm and bar. Below you can see how I start my window manager.

.xinitrc

...
exec wmrun.sh

wmrun.sh -- remember to replace "statusinfo.sh" with your own script. I have bin in my path so you might need to use full path.

#!/usr/bin/env sh

: "${wm:=monsterwm}"
: "${ff:="/tmp/${wm}.fifo"}"
[ -p "$ff" ] || mkfifo -m 600 "$ff"

# spawn a statusbar
while read -t 60 -r line || true; do
    echo "$line" | grep -qEx "(([[:digit:]]+:){4,6}[[:digit:]]+ ?)+" && prev="$line" || line=
    statusinfo.sh ${line:-$prev}
done < "$ff" | bar &

"$wm" > "$ff"

Offline

#74 2013-07-09 18:33:29

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: bar - Lightweight xcb-based bar

while true ; do
    sleep 2; 
    echo -n "\l\f3\u3$(mpc current) \c\f5\u5$(date)" | $HOME/bin/bar-bottom/./bar -p &
done

I have this simple code, which works fine. but bar flickers on each redraw. anything i can do there?


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#75 2013-07-09 18:45:43

c00kiemon5ter
Member
From: Greece
Registered: 2010-06-01
Posts: 562
Website

Re: bar - Lightweight xcb-based bar

while sleep 2
do echo -n "\l\f3\u3$(mpc current) \c\f5\u5$(date)" 
done | $HOME/bin/bar-bottom/bar -p &

Last edited by c00kiemon5ter (2013-07-09 18:46:18)


.:[ git me! ] :.

Offline

Board footer

Powered by FluxBB