SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#26 2013-04-05 17:00:50

chameleon
UK #! Guy
From: Luxembourg
Registered: 2009-01-13
Posts: 718
Website

Re: Herbstluftwm thread? - Herbstluftwm thread!

@PinkPanther
Hi!
I have been interested in this one for a while now.
Does it have mouse/floating mode possible?
How easy is it to set up and configure?

Your feedback would be appreciated.

Offline

Help fund CrunchBang, donate to the project!

#27 2013-04-05 17:12:24

PinkPanther
Member
From: inferno
Registered: 2013-04-03
Posts: 29

Re: Herbstluftwm thread? - Herbstluftwm thread!

@chameleon

Hi!
Yes it has.Floating is enabled by pressing $Mod+s and you can use $Mod+mouse middle button to resize.With $Mod+left button you can move windows.By default $Mod1 is enabled but I switch it to $Mod4 becouse I use that in i3 and I got used to it.It's easy to configure,almost easy as i3.You can find all the info you need here  http://herbstluftwm.org/.
If you need any help I'll be glad to help if I can.

Last edited by PinkPanther (2013-04-05 17:13:25)

Offline

#28 2013-04-05 17:19:25

chameleon
UK #! Guy
From: Luxembourg
Registered: 2009-01-13
Posts: 718
Website

Re: Herbstluftwm thread? - Herbstluftwm thread!

^Cheers PinkPanther...might be an upcoming project for me...

Offline

#29 2013-04-05 17:25:08

PinkPanther
Member
From: inferno
Registered: 2013-04-03
Posts: 29

Re: Herbstluftwm thread? - Herbstluftwm thread!

What you must do is (when you install hlwm):cp /etc/xdg/herbstluftwm/autostart ~/.config/herbstluftwm/autostart and
cp /etc/xdg/herbstluftwm/panel.sh ~/.config/herbstluftwm/panel.sh.All configuration is in there.Enjoy it.

Offline

#30 2013-04-05 17:25:16

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Herbstluftwm thread? - Herbstluftwm thread!

It's nice; very intuitive and extensible. It seems it can pretty much become your own wm, with all .xinitrc stuff, conky, etc., running from one file. Still getting my head round things, but I really like just the defaults too. Floating, tiling, fullscreen, manual, grid, tile resizing, etc.,

Offline

#31 2013-04-05 17:32:20

PinkPanther
Member
From: inferno
Registered: 2013-04-03
Posts: 29

Re: Herbstluftwm thread? - Herbstluftwm thread!

@dura

Same here. smile

Offline

#32 2013-04-05 17:44:49

wuxmedia
wookiee madclaw
From: Back in Blighty
Registered: 2012-03-09
Posts: 1,478
Website

Re: Herbstluftwm thread? - Herbstluftwm thread!

I remember this from the linuxBBQ oyster.
lovely name (not that i speak german)

hmmm i have a spare partition *thinks*
and if all the cool kids are using it....

Offline

#33 2013-04-05 18:06:53

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Herbstluftwm thread? - Herbstluftwm thread!

^Why even a spare partition? I have 3 wm's installed.

Herbstluftwm is the new black.

Offline

#34 2013-04-05 18:12:50

wuxmedia
wookiee madclaw
From: Back in Blighty
Registered: 2012-03-09
Posts: 1,478
Website

Re: Herbstluftwm thread? - Herbstluftwm thread!

..... i just like my wm's on one place at a time, i installed MATE 1.6 on my I3 install - and was royally confused.

Last edited by wuxmedia (2013-04-06 11:59:35)

Offline

#35 2013-04-07 18:56:11

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Herbstluftwm thread? - Herbstluftwm thread!

I've been having some trouble getting conky, hlwm tags, and window titles to display simultaneously. I have successfully piped conky to dzen2 through the panel.sh file. Pretty messy, but here it is:

.conkyrc

out_to_console yes
out_to_x no
update_interval 1.0
total_run_times 0
use_spacer none

TEXT
${texeci 1 ~/hlwm_tags.sh}    |    ^fg(\#f2f2f2)${loadavg 1 2 3}    |    ${mem}    |    ${battery_short BAT1}    |    ^fg()${time %a %b %d %I:%M%P}

hlwm_tags.sh

#!/bin/bash
herbstclient tag_status

panel.sh (section at bottom):

#My Dzen2 dzconky:
} 2> /dev/null | conky | dzen2 -w $panel_width -x $x -y $y -fn "$font" -h $panel_height \
    -ta r -bg "$bgcolor" -fg '#ffffff'

Looks like:

2013_04_07_201529_1366x768_scrot.jpg

Strange using Herbstluftwm: hardly anyone seems to use it, or those that do are pretty fluent setting it up as they like it. Only a few threads floating about. But a really, really nice window manager to use, some really lovely intuitive defaults, and very extensible.

Would be nice if others who use Herbstluftwm shared their config files. I really want window titles to be shown- they are with the default panel, but borrowing stuff from it does not seem to render the window title through conky, and there seems to be no explicit flag to show it with herbstclient.

(What I mean is I wish wookie madclaw, dkeg, pinkpanther, ninjaaron, and 2manydogs, and whoever else, would either give hlwm a shot and/or help a plebian noob such as myself out...).

Last edited by dura (2013-04-07 19:17:01)

Offline

#36 2013-04-08 06:28:24

PinkPanther
Member
From: inferno
Registered: 2013-04-03
Posts: 29

Re: Herbstluftwm thread? - Herbstluftwm thread!

@dura

If you're a noob then what am I? I'm using computer a little bit more than a year.First four months I used Windows7 and then completly switched to Linux.And I'm 37.  ops

Offline

#37 2013-04-08 11:46:03

servingwater
#! Junkie
Registered: 2009-02-28
Posts: 466

Re: Herbstluftwm thread? - Herbstluftwm thread!

@  dura
Could it have something to do with "hlwm_tags.sh" being a bash script and you seem to be running zsh?
Mind you however I am probably talking rubbish....

Offline

#38 2013-04-08 13:21:40

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Herbstluftwm thread? - Herbstluftwm thread!

^Nah, don't think so. The tags script is working fine, I just can't get window titles displayed. I'm on the train and trying to work it out.

So far, I've tried using xdotool, which can't seem to display actual application name, etc., just computer readable active window names. I'm also experimenting with xwininfo, which seems to be a no go, and xprop. If I knew awk better (or at all) I might be able to conjure something up.

But I do have meaningless computer readable active window titles shown in the panel via a bash script, as well as tags, and other conky stuff as battery, time, etc., so something is happening.

I'm thinking of making post about it on here and the Arch forums.

Offline

#39 2013-04-08 15:16:56

gutterslob
#! Resident Bum
Registered: 2009-11-03
Posts: 3,195

Re: Herbstluftwm thread? - Herbstluftwm thread!

I don't use HLWM, but I think EWMH would be the most logical route to take with regards to displaying the window titles. It didn't have EWMH support when I first flirted with it in its infancy, but it does now, if I'm not mistaken. Try searching for anything "tag" or "window" related in the documentation and apply some case/esac statements in your panel script.

Edit: Something like this, perhaps?
https://bbs.archlinux.org/viewtopic.php … 0#p1055390

Last edited by gutterslob (2013-04-08 16:23:31)


Point & Squirt

Offline

#40 2013-04-08 16:30:46

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Herbstluftwm thread? - Herbstluftwm thread!

Thank you gutterslob. I will look into it. Will hlwm always be an infant you think?

Offline

#41 2013-04-10 03:53:55

gutterslob
#! Resident Bum
Registered: 2009-11-03
Posts: 3,195

Re: Herbstluftwm thread? - Herbstluftwm thread!

It's already pretty mature right now, isn't it? I don't know about stability (since I don't use it) but hlwm does seem to have a lot of the basic/core tiling functionality in place already, plus it's very nature means that it's modular, so you could say the possibilities are endless (with some exceptions) as long as you've got the scripting skills.

Whether hlwm will reach the same following as dwm or xmonad remains to be seen. There's a very large, knowledgeable community behind xmonad, while dwm has that and a bit more (ie; Unia using his 'human movement science' to create patches on a daily basis).

Obscure doesn't make hlwm worse though. At the end of the day, it all depends on how much managing you need from a window manager.

I just decided not to continue with hlwm because;
a) All I need is basic xmonad-esque behaviour and defaults, which scrot/spectr/ballsackwm provides out of the box.
b) I'm lazy and busy with work. If I do find time to script/hack, I prefer to play with zsh, ksh and tmux these days.
c) Ninjaaron uses it.

Last edited by gutterslob (2013-04-10 04:16:47)


Point & Squirt

Offline

#42 2013-04-10 09:54:28

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,596

Re: Herbstluftwm thread? - Herbstluftwm thread!

gutterslob wrote:

Unia using his 'human movement science' to create patches on a daily basis

big_smile

I don't study that just yet, though. And once I start, I'll probably have less time to hack DWM.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Offline

#43 2013-04-10 10:28:35

gutterslob
#! Resident Bum
Registered: 2009-11-03
Posts: 3,195

Re: Herbstluftwm thread? - Herbstluftwm thread!

^ Exotic dancing is a physically taxing profession, after all. I'm sure the dwm community understands. =P


Point & Squirt

Offline

#44 2013-04-10 11:21:12

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,596

Re: Herbstluftwm thread? - Herbstluftwm thread!

gutterslob wrote:

^ Exotic dancing is a physically taxing profession, after all. I'm sure the dwm community understands. =P

Just go ride your choppers...  roll


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Offline

#45 2013-04-14 10:10:45

The Compiler
Member
Registered: 2012-08-27
Posts: 10

Re: Herbstluftwm thread? - Herbstluftwm thread!

I think the approach of you guys is the wrong one. When doing then window title part in conky, you're essentially polling it, which means it will lag and use a lot of ressources.

Instead, do something like this in the dzen part, by piping both this and conky into it (it helps to understand the original panel.sh):

herbstclient --idle '(focus_changed|window_title_changed)' 2>/dev/null | while read hook y title; do echo "$title"; done

If you really want to poll and using the latest git, you can do this to get the title only:

herbstclient attr clients.focus.title

Flo

Offline

#46 2013-04-14 22:22:49

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Herbstluftwm thread? - Herbstluftwm thread!

Thank you, The Compiler. I do still need to understand the original panel.sh to know how to get this to work...

Offline

#47 2013-04-26 15:22:09

root
#! CrunchBanger
From: Capital of Culture
Registered: 2010-11-11
Posts: 170

Re: Herbstluftwm thread? - Herbstluftwm thread!

The weather today led to a testsession with herbstluft, and I am quite impressed.
The frame structure is very intuitive and those useless gaps between the frames look great.

I will have to use it some more, to see if it could become my tiler of choice.
For the moment i3 is still my favourite, but herbstluft clearly has the better name.  big_smile

One thing left me wondering...my programms, i.e. iceweasel and dmenu are not my customized versions I use with openbox, but look like freshly installed and unaltered.
Typically every desktop used the same config files on my machine.  hmm


/

Last edited by root (2013-04-26 15:23:10)

Offline

#48 2013-05-10 06:44:31

pucko
Member
From: ‽
Registered: 2012-03-11
Posts: 39

Re: Herbstluftwm thread? - Herbstluftwm thread!

@dura: Well off course I can share! I've stolen almost everything from others as you should....

In this digital age I decided to go binary on HLWM. Weather, cpu*2, memory and battery (from left) are nicely shown in binary  roll

Still haven't decided what to do with time and date, but it will be in binary soon. The colors are still stock and I don't care.....

2013-05-10-0829271280x800scrot.png

autostart:

#!/bin/bash
# this is a very stupid config for herbstluftwm
function hc() {
    cmds="$cmds , $@"
}
cmds=""

hc emit_hook reload

~/.scripts/keymapping
sh ~/.fehbg

# remove all existing keybindings
hc keyunbind --all
# keybindings
Mod=Mod4
hc keybind $Mod-Shift-q quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-Shift-c close
hc keybind $Mod-Return spawn xterm
# other
hc keybind $Mod-d spawn dmenu_run
hc keybind $Mod-t spawn urxvt
hc keybind $Mod-f spawn urxvt -e mc
hc keybind $Mod-e spawn emacs
hc keybind $Mod-w spawn uzbl-tabbed
# own
hc keybind XF86MonBrightnessUp spawn applestuffing screen up
hc keybind XF86MonBrightnessDown spawn applestuffing screen down
hc keybind Mod1-XF86MonBrightnessUp spawn applestuffing screen max
hc keybind Mod1-XF86MonBrightnessDown spawn applestuffing screen min
hc keybind XF86KbdBrightnessUp spawn applestuffing kbd up
hc keybind XF86KbdBrightnessDown spawn applestuffing kbd down
hc keybind Mod1-XF86KbdBrightnessUp spawn applestuffing kbd max
hc keybind Mod1-XF86KbdBrightnessDown spawn applestuffing kbd min
hc keybind $Mod-Mod1-m spawn xdotool mousemove 1279 0
hc keybind $Mod-Mod1-at spawn $HOME/.scripts/toggletouchpad.sh rats
hc keybind XF86AudioRaiseVolume spawn amixer -q -c 0 sset Master 5+ unmute
hc keybind XF86AudioLowerVolume spawn amixer -q -c 0 sset Master 5- unmute
hc keybind XF86AudioMute spawn amixer -q -c 0 sset Master toggle
hc keybind XF86LaunchB spawn spotify
hc keybind Shift-XF86LaunchB spawn pkill spotify
hc keybind $Mod-Shift-Mod1-a wmexec awesome

# tags
TAG_KEYS=( {1..7} 0 )
TAG_NAMES=( "001" "010" "011" "100" "101" "110" "111" )

hc rename default "${TAG_NAMES[0]}" || true
for i in ${!TAG_NAMES[@]} ; do
    hc add "${TAG_NAMES[$i]}"
    key="F${TAG_KEYS[$i]}"
    if ! [ -z "$key" ] ; then
        hc keybind "$Mod-$key" use_index "$i"
        hc keybind "$Mod-Shift-$key" move_index "$i"
    fi
done

# cycle through tags
hc keybind $Mod-period use_index +1 --skip-visible
hc keybind $Mod-comma  use_index -1 --skip-visible
hc keybind $Mod-Right use_index +1 --skip-visible
hc keybind $Mod-Left  use_index -1 --skip-visible

# layouting
hc keybind $Mod-r remove
hc keybind $Mod-space cycle_layout 1
hc keybind $Mod-u split vertical 0.5
hc keybind $Mod-Shift-u split vertical 0.63
hc keybind $Mod-o split horizontal 0.5
hc keybind $Mod-Shift-o split horizontal 0.63
hc keybind $Mod-s floating toggle
hc keybind $Mod-g fullscreen toggle
hc keybind $Mod-p pseudotile toggle

# resizing
RESIZESTEP=0.05
hc keybind $Mod-Control-h resize left +$RESIZESTEP
hc keybind $Mod-Control-j resize down +$RESIZESTEP
hc keybind $Mod-Control-k resize up +$RESIZESTEP
hc keybind $Mod-Control-l resize right +$RESIZESTEP

# mouse
hc mouseunbind --all
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 resize
hc mousebind $Mod-Button3 zoom

# focus
hc keybind $Mod-BackSpace   cycle_monitor
hc keybind Mod1-Tab         cycle_all +1
hc keybind Mod1-Shift-Tab   cycle_all -1
hc keybind $Mod-c cycle
hc keybind $Mod-h focus left
hc keybind $Mod-j focus down
hc keybind $Mod-k focus up
hc keybind $Mod-l focus right
hc keybind $Mod-i jumpto urgent
hc keybind $Mod-Shift-h shift left
hc keybind $Mod-Shift-j shift down
hc keybind $Mod-Shift-k shift up
hc keybind $Mod-Shift-l shift right

# colors
hc set frame_border_active_color '#222222'
hc set frame_border_normal_color '#101010'
#hc set frame_bg_normal_color '#565656'
#hc set frame_bg_active_color '#345F0C'
hc set frame_border_width 1
hc set window_border_width 1
hc set window_border_inner_width 1
hc set window_border_normal_color '#454545'
hc set window_border_active_color '#9fbc00'
hc set always_show_frame 1
hc set frame_gap 2
# add overlapping window borders
hc set window_gap -2
hc set frame_padding 2
hc set smart_window_surroundings 0
hc set smart_frame_surroundings 1
hc set mouse_recenter_gap 0
hc set frame_bg_transparent 1

# rules
hc unrule -F

hc rule focus=off # normally do not focus new clients
# give focus to most common terminals
hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off

# unlock, just to be sure
hc unlock

herbstclient set tree_style '╾│ ├└╼─┐'

### Execute the chained commands ###
herbstclient chain , $cmds &

# find the panel
panel=~/.config/herbstluftwm/binpanel.sh
[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
    # start it on each monitor
    $panel $monitor &
done

panel.sh:

#!/bin/bash
# disable path name expansion or * will be expanded in the line
# cmd=( $line )
set -f

monitor=${1:-0}
geometry=( $(herbstclient monitor_rect "$monitor") )
if [ -z "$geometry" ] ;then
    echo "Invalid monitor $monitor"
    exit 1
fi
# geometry has the format: WxH+X+Y
x=${geometry[0]}
y=${geometry[1]}
panel_width=${geometry[2]}
panel_height=16
font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
bgcolor=$(herbstclient get frame_border_normal_color)
selbg=$(herbstclient get window_border_active_color)
selfg='#101010'

####
# Try to find textwidth binary.
if [ -e "$(which textwidth 2> /dev/null)" ] ; then
    textwidth="textwidth";
elif [ -e "$(which dzen2-textwidth 2> /dev/null)" ] ; then
    textwidth="dzen2-textwidth";
else
    echo "This script requires the textwidth tool of the dzen2 project."
    exit 1
fi
####
# true if we are using the svn version of dzen2
dzen2_version=$(dzen2 -v 2>&1 | head -n 1 | cut -d , -f 1|cut -d - -f 2)
if [ -z "$dzen2_version" ] ; then
    dzen2_svn="true"
else
    dzen2_svn=""
fi

memo() {
    local percent=$(free -m | awk '/cache:/ { printf("%d",$3/($3+$4)*100)}')
    if (($percent<30)); then
	mem_col="^fg(darkgreen)"
    elif (($percent<70)); then
	mem_col="^fg(#efefef)"
    else
	mem_col="^fg(darkred)"
    fi
    local bin=$(echo "obase=2; $percent"| bc| while read line; do for ((i=${#line};i<7;i++)); do echo -n 0; done; echo -n $mem_col$line;done)

    echo -n "^fg(#909090)$bin"
}
bat() {
  local status=$(acpi | awk '{print $3}' | sed 's/,//')
  
  case $status in
    Discharging) pow_col="^fg(#efefef)"; pwr_sign="-" ;;
    Charging) pow_col="^fg(darkred)"; pwr_sign="+";;
    Full) pow_col="^fg(#909090)"; pwr_sign=":";;
  esac

  local percent=$(acpi | awk '{print $4}' | sed 's/[,%]//g')
  local bin=$(echo "obase=2; $percent"| bc|  while read line; do for ((i=${#line};i<7;i++)); do echo -n '0'; done; echo $pow_col$line;done)
  echo -n "^fg(#909090)$pwr_sign$bin"
}

function uniq_linebuffered() {
    awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}

herbstclient pad $monitor $panel_height
{
    # events:
    while true ; do
	batshow="$(bat)"
	echo "bat $batshow"
        date +'date ^fg()%a ^fg(#909090)v%V ^fg()%H:%M^fg(#909090), %Y-%m-^fg()%d'
	mem="$(memo)"
	echo "memo $mem"
        sleep 60 || break
    done > >(uniq_linebuffered)  &
    childpid=$!
    $HOME/.scripts/binaryhlwmcpu.sh &
    $HOME/.scripts/binaryhlwmweather.sh &
    herbstclient --idle
    kill $childpid
} 2> /dev/null | {
    TAGS=( $(herbstclient tag_status $monitor) )
    visible=true
    date=""
    batshow=""
    cpu=""
    weather=""
    mem=""
    windowtitle=""
    while true ; do
        bordercolor="#26221C"
        separator="^bg()^fg($selbg)|"
        # draw tags
        for i in "${TAGS[@]}" ; do
            case ${i:0:1} in
                '#')
                    echo -n "^bg($selbg)^fg($selfg)"
                    ;;
                '+')
                    echo -n "^bg(#9CA668)^fg(#141414)"
                    ;;
                ':')
                    echo -n "^bg()^fg(#ffffff)"
                    ;;
                '!')
                    echo -n "^bg(#FF0675)^fg(#141414)"
                    ;;
                *)
                    echo -n "^bg()^fg(#ababab)"
                    ;;
            esac
            if [ ! -z "$dzen2_svn" ] ; then
                echo -n "^ca(1,herbstclient focus_monitor $monitor && "'herbstclient use "'${i:1}'") '"${i:1} ^ca()"
            else
                echo -n " ${i:1} "
            fi
        done
        echo -n "$separator $weather $separator"
        echo -n "^bg()^fg() ${windowtitle//^/^^}"
        right="$separator^bg() $cpu $separator $mem ^fg()$separator $batshow $separator $date $separator"
        right_text_only=$(echo -n "$right"|sed 's.\^[^(]*([^)]*)..g')
        # get width of right aligned text.. and add some space..
        width=$($textwidth "$font" "$right_text_only    ")
        echo -n "^pa($(($panel_width - $width)))$right"
        echo
        # wait for next event
        read line || break
        cmd=( $line )
        # find out event origin
        case "${cmd[0]}" in
            tag*)
                TAGS=( $(herbstclient tag_status $monitor) )
                ;;
            date)
                date="${cmd[@]:1}"
                ;;
	    bat*)
		batshow="${cmd[@]:1}"
		;;
	    cpu*)
		cpu="${cmd[@]:1}"
		;;
	    mem*)
		mem="${cmd[@]:1}"
		;;
	    weath*)
		weather="${cmd[@]:1}"
		;;
            quit_panel)
                exit
                ;;
            togglehidepanel)
                currentmonidx=$(herbstclient list_monitors |grep ' \[FOCUS\]$'|cut -d: -f1)
                if [ -n "${cmd[1]}" ] && [ "${cmd[1]}" -ne "$monitor" ] ; then
                    continue
                fi
                if [ "${cmd[1]}" = "current" ] && [ "$currentmonidx" -ne "$monitor" ] ; then
                    continue
                fi
                echo "^togglehide()"
                if $visible ; then
                    visible=false
                    herbstclient pad $monitor 0
                else
                    visible=true
                    herbstclient pad $monitor $panel_height
                fi
                ;;
            reload)
                exit
                ;;
            focus_changed|window_title_changed)
                windowtitle="${cmd[@]:2}"
                ;;
        esac
    done
} 2> /dev/null | \
    dzen2 -w $panel_width -x $x -y $y -fn "$font" -h $panel_height -ta l \
    -bg "$bgcolor" -fg '#efefef'

binaryhlwmcpu.sh:

#!/bin/bash
{
    mpstat -P ALL 3 &
} 2> /dev/null | {
    cpu1=""
    cpu2=""
    col1="^fg(#efefef)"
    while true; do
	read line || break
	case $line in
	    *' 0 '*)
		percent1=$(echo $line | awk '{printf("%.0f", 100-$11)}')
		cpu1=$(echo "obase=2; $percent1"| bc|  while read line; do for ((i=${#line};i<7;i++)); do echo -n '0'; done; echo $col1$line;done)
		;;
	    *' 1 '*) 
		percent2=$(echo $line | awk '{printf("%3.0f", 100-$11)}')
		cpu2=$(echo "obase=2; $percent2"| bc|  while read line; do for ((i=${#line};i<7;i++)); do echo -n '0'; done; echo $col1$line;done)
		;;
	esac
	herbstclient emit_hook "cpu ^fg(#909090)${cpu1}^fg(#909090) ${cpu2}"
    done
}

binaryhlwmweather.sh

#!/bin/bash
{
    while true ; do
    # ENTC is TOS/Langenæs
	weather -m entc;
	sleep 30m;
    done;

} 2> /dev/null | {
    temp=""
    wind=""
    while true ; do
	read line || break
	col="^fg()"
	case $line in
	    Temper*)
		temp=$(echo $line | awk '{printf( "%.0f", $2)}')
		bintemp=$(echo "obase=2; $temp"| bc|  while read line; do for ((i=${#line};i<6;i++)); do echo -n '0'; done; echo $col$line;done)
		;;
	    "Wind: fro"*)
		wind=$(echo $line | awk '{printf("%.0f", $8/3.6)}')
		dir=$(echo $line | awk '{printf("% 4s", $4)}')
		binwind=$(echo "obase=2; $wind"| bc|  while read line; do for ((i=${#line};i<6;i++)); do echo -n '0'; done; echo $col$line;done)
		;;
	    "Wind: Var"*)
		wind=$(echo $line | awk '{printf("%.0f", $4/3.6)}')
		binwind=$(echo "obase=2; $wind"| bc|  while read line; do for ((i=${#line};i<6;i++)); do echo -n '0'; done; echo $col$line;done)
		dir=" var"
		;;
	esac
	herbstclient emit_hook "weather ^fg(#909090)${bintemp}^fg(#909090)°C ${binwind}^fg(#909090)m/s ^fg(#efefef)${dir}"
    done
}

Hope someone gets a laugh out of it.....

Offline

#49 2013-05-10 07:24:18

pucko
Member
From: ‽
Registered: 2012-03-11
Posts: 39

Re: Herbstluftwm thread? - Herbstluftwm thread!

Looking at it forced me to make the clock and date binary to, and clean up the ugly code some.
....so for anyone interested, the updated part of my panel.sh.

panel.sh:

bini() {
    # make binary: 1what, 2how long, 3color of significant
    local bin=$(echo "obase=2; $1"| bc| while read line; do for ((i=${#line};i<$2;i++)); do echo -n 0; done; echo -n $3$line;done)
    echo -n $bin 
}
memo() {
    local percent=$(free -m | awk '/cache:/ { printf("%d",$3/($3+$4)*100)}')
    if (($percent<30)); then
	mem_col="^fg(darkgreen)"
    elif (($percent<70)); then
	mem_col="^fg(#efefef)"
    else
	mem_col="^fg(red)"
    fi
    local bin="$(bini $percent 7 $mem_col)"
    echo -n "^fg(#909090)$bin"
}
bat() {
  local status=$(acpi | awk '{print $3}' | sed 's/,//')
  
  case $status in
    Discharging) pow_col="^fg(#efefef)"; pwr_sign="-" ;;
    Charging) pow_col="^fg(darkred)"; pwr_sign="+";;
    Full) pow_col="^fg(#909090)"; pwr_sign="";;
  esac

  local percent=$(acpi | awk '{print $4}' | sed 's/[,%]//g')
  local bin="$(bini $percent 7 $pow_col)"
  echo -n "^fg(#909090)$pwr_sign$bin"
}

bindate() {
    local bin_col="^fg()"
    local sep_col="^fg(#909090)"
    local day="$bin_col$(date +%a)"
    local week="$sep_col v$(bini $(date +%V) 6 $bin_col)"
    local year="$sep_col, $(bini $(date +%y) 6 $bin_col)"
    local month="$sep_col-$(bini $(date +%m) 4 $bin_col)"
    local dday="$sep_col-$(bini $(date +%d) 5 $bin_col)"
    local hour="$sep_col, $(bini $(date +%H) 5 $bin_col)"
    local min="$sep_col:$(bini $(date +%M) 6 $bin_col)"

    echo -n "$day$week$year$month$dday$hour$min"
}

function uniq_linebuffered() {
    awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}

herbstclient pad $monitor $panel_height
{
    # events:
    while true ; do
	batshow="$(bat)"
	echo "bat $batshow"
	dato="$(bindate)"
	echo "date $dato"
	mem="$(memo)"
	echo "memo $mem"
        sleep 60 || break
    done > >(uniq_linebuffered)  &

Offline

Help fund CrunchBang, donate to the project!

#50 2013-05-10 13:35:47

pucko
Member
From: ‽
Registered: 2012-03-11
Posts: 39

Re: Herbstluftwm thread? - Herbstluftwm thread!

Another boring scrot with all numbers in the panel converted to binary rep. I'm happy with it.....

2013-05-10-1529471280x800scrot.png

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo