[herbstluftwm] configuration | dzen2 - conky - panel.sh |

Xorg, Compiz, KDE / Gnome / Xfce / Fluxbox / e17 / fvwm ... GDM/KDM/XDM...
Avatar de l’utilisateur
rom1_31
Hankyu
Messages : 32
Inscription : ven. 29 août 2014, 08:33
Localisation : Toulouse

[herbstluftwm] configuration | dzen2 - conky - panel.sh |

Message par rom1_31 »

Bonjour, je suis actuellement sur la reconfiguration du windows manager Herbstluftwm.
Merci à OxHak pour son aide et ses exemples:
https://github.com/oxhak/archlinux-desktop-config-files

Voilà, je recherche à ajouter les infos du conky suivant dans la barre (panel.sh)
les premiers essais ont été un échec total, plantage complet !
Depuis j'ai repris l'abroresence à la source, mais je ne comprends toujours pas comment bien placer ma config conky dans le "panel.sh"
pour que cela fonctionne bien.

J'ai le conky suivant ".conkyrc_dzen" récupéré ici:
http://arpinux.org/x/doku.php/user_tools/dzen2

Code : Tout sélectionner

out_to_x no
out_to_console yes
update_interval 1.0
total_run_times 0
use_spacer none

TEXT
 ^i(/home/arp/.arp_setups/dzicons/cal.xbm) ^fg(\#ccc)${time %d/%m}^fg() ^i(/home/arp/.arp_setups/dzicons/clock.xbm) ${time %I:%M}\
  ^fg(\#ff4500)^i(/home/arp/.arp_setups/dzicons/cpu.xbm) ^fg(\#ccc)${cpu}%\
 ^fg(\#ee2c2c)^i(/home/arp/.arp_setups/dzicons/temp.xbm) ^fg(\#ccc)${ibm_temps 0}°C\
 ^fg(\#87ceeb)^i(/home/arp/.arp_setups/dzicons/monitor.xbm) ^fg(\#ccc)${loadavg}\
  ^fg(\#00bfff)^i(/home/arp/.arp_setups/dzicons/mem.xbm) ^fg(\#ccc)$memperc% > $mem\
  ^fg(\#ffd700)^i(/home/arp/.arp_setups/dzicons/home.xbm) ^fg(\#ccc)${fs_used_perc /}%\
${if_mounted /media/arp500} ^fg(\#000)^i(/home/arp/.arp_setups/dzicons/usb.xbm) ^fg(\#ccc)${fs_used_perc /media/arp500/}%${endif}${if_mounted /media/lacie300} ^fg(\#1e90ff)^i(/home/arp/.arp_setups/dzicons/usb.xbm) ^fg(\#ccc)${fs_used_perc /media/lacie300/}%${endif}\
 ^fg()${if_match ${battery_percent BAT0} >=26}^fg(\#7cfc00)^i(/home/arp/.arp_setups/dzicons/bat_full_01.xbm)${endif}\
${if_match ${battery_percent BAT0} <=25}  ^fg(\#CC0000)^i(/home/arp/.arp_setups/dzicons/bat_low_01.xbm)^fg()${endif} ^fg(\#ccc)${battery_percent}%\
 ^fg()${if_up eth0}  ^i(/home/arp/.arp_setups/dzicons/net_wired.xbm)\
 ^fg(\#00cd00)^i(/home/arp/.arp_setups/dzicons/net_up_02.xbm) ^fg(\#ccc)${upspeedf eth0}\
 ^fg(\#ffa500)^i(/home/arp/.arp_setups/dzicons/net_down_02.xbm) ^fg(\#ccc)${downspeedf eth0}\
^fg() ${endif}\
${if_match "$ibm_volume" == "mute" }^fg(\#000000) ^i(/home/arp/.arp_setups/dzicons/spkr_04.xbm)^fg(\#ccc) mute ${else}^fg(\#FFDF1D) ^i(/home/arp/.arp_setups/dzicons/spkr_01.xbm)^fg(\#ccc) ${ibm_volume}/14${endif}
J'ai copier le script suivant dzen_conky, que j'ai ajouté dans /usr/bin/ avec un chmod +x
toujours récupéré ici:
http://arpinux.org/x/doku.php/user_tools/dzen2

Code : Tout sélectionner

#!/bin/sh
RC="$HOME/.conkyrc_dzen"
FG="white"
BG="#404240"
ALIGN="left"
WIDTH="744"
HEIGHT="12"
FONT="-*-terminus-medium-*-*-*-12-*-*-*-*-*-*-*"
XPOS="30"
YPOS="756"
 
conky -d -c $RC | dzen2 -fg $FG -bg $BG -ta $ALIGN -w $WIDTH -h $HEIGHT -x $XPOS -y $YPOS -fn $FONT -dock &
exit 0
Voici le panel.sh original de herbstluftwm:

Code : Tout sélectionner

#!/bin/bash

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

####
# Try to find textwidth binary.
# In e.g. Ubuntu, this is named dzen2-textwidth.
if which textwidth &> /dev/null ; then
    textwidth="textwidth";
elif which dzen2-textwidth &> /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
# depending on version/distribution, this seems to have version strings like
# "dzen-" or "dzen-x.x.x-svn"
if dzen2 -v 2>&1 | head -n 1 | grep -q '^dzen-\([^,]*-svn\|\),'; then
    dzen2_svn="true"
else
    dzen2_svn=""
fi

if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
    # mawk needs "-W interactive" to line-buffer stdout correctly
    # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504
    uniq_linebuffered() {
      awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
    }
else
    # other awk versions (e.g. gawk) issue a warning with "-W interactive", so
    # we don't want to use it there.
    uniq_linebuffered() {
      awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
    }
fi

hc pad $monitor $panel_height

{
    ### Event generator ###
    # based on different input data (mpc, date, hlwm hooks, ...) this generates events, formed like this:
    #   <eventname>\t<data> [...]
    # e.g.
    #   date    ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29

    #mpc idleloop player &
    while true ; do
        # "date" output is checked once a second, but an event is only
        # generated if the output changed compared to the previous run.
        date +$'date\t^fg(#efefef)%H:%M^fg(#909090), %Y-%m-^fg(#efefef)%d'
        sleep 1 || break
    done > >(uniq_linebuffered) &
    childpid=$!
    hc --idle
    kill $childpid
} 2> /dev/null | {
    IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
    visible=true
    date=""
    windowtitle=""
    while true ; do

        ### Output ###
        # This part prints dzen data based on the _previous_ data handling run,
        # and then waits for the next event to happen.

        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
                # clickable tags if using SVN dzen
                echo -n "^ca(1,\"${herbstclient_command[@]:-herbstclient}\" "
                echo -n "focus_monitor \"$monitor\" && "
                echo -n "\"${herbstclient_command[@]:-herbstclient}\" "
                echo -n "use \"${i:1}\") ${i:1} ^ca()"
            else
                # non-clickable tags if using older dzen
                echo -n " ${i:1} "
            fi
        done
        echo -n "$separator"
        echo -n "^bg()^fg() ${windowtitle//^/^^}"
        # small adjustments
        right="$separator^bg() $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

        ### Data handling ###
        # This part handles the events generated in the event loop, and sets
        # internal variables based on them. The event and its arguments are
        # read into the array cmd, then action is taken depending on the event
        # name.
        # "Special" events (quit_panel/togglehidepanel/reload) are also handled
        # here.

        # wait for next event
        IFS=$'\t' read -ra cmd || break
        # find out event origin
        case "${cmd[0]}" in
            tag*)
                #echo "resetting tags" >&2
                IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
                ;;
            date)
                #echo "resetting date" >&2
                date="${cmd[@]:1}"
                ;;
            quit_panel)
                exit
                ;;
            togglehidepanel)
                currentmonidx=$(hc list_monitors | sed -n '/\[FOCUS\]$/s/:.*//p')
                if [ "${cmd[1]}" -ne "$monitor" ] ; then
                    continue
                fi
                if [ "${cmd[1]}" = "current" ] && [ "$currentmonidx" -ne "$monitor" ] ; then
                    continue
                fi
                echo "^togglehide()"
                if $visible ; then
                    visible=false
                    hc pad $monitor 0
                else
                    visible=true
                    hc pad $monitor $panel_height
                fi
                ;;
            reload)
                exit
                ;;
            focus_changed|window_title_changed)
                windowtitle="${cmd[@]:2}"
                ;;
            #player)
            #    ;;
        esac
    done

    ### dzen2 ###
    # After the data is gathered and processed, the output of the previous block
    # gets piped to dzen2.

} 2> /dev/null | dzen2 -w $panel_width -x $x -y $y -fn "$font" -h $panel_height \
    -e 'button3=;button4=exec:herbstclient use_index -1;button5=exec:herbstclient use_index +1' \
    -ta l -bg "$bgcolor" -fg '#efefef'
Voilà je ne sais pas où casser mon conky la dedans sans tout détruire !

Pour info, le panel.sh qu'utilise OxHak, mais il ne fait apparaitre que le conky:

Code : Tout sélectionner

#!/bin/bash
## dzen stuff
FG='#FFFFFF'
BG='#1f1f1f'
FONT="-*-terminus-normal-*-*-*-13-*-*-*-*-*-*-*"
function uniq_linebuffered() {
awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}
{
conky -c ~/.conky/statusbar | while read -r; do
echo -e "conky $REPLY";
#break
done > >(uniq_linebuffered) &
childpid=$!
herbstclient --idle
kill $childpid
} | {
TAGS=( $(herbstclient tag_status $monitor) )
conky=""
while true; do
for i in "${TAGS[@]}" ; do
case ${i:0:1} in
'#')
esac
echo -n "^ca()"
done
conky_text_only=$(echo -n "$conky "|sed 's.\^[^(]*([^)]*)..g')
width=$(textwidth "$FONT" "$conky_text_only ")
echo -n " ^bg(#2b2b2b) ^bg(#1f1f1f)^fg(#ececec) $conky ^bg(#2b2b2b) ^bg(#1f1f1f)"
echo
read line || break
cmd=( $line )
case "$cmd[0]" in
conky*)
conky="${cmd[@]:1}"
;;
esac
done
} 2> /dev/null | dzen2 -ta c -y 0 -x 0 -h 25 -w 1920 -fg $FG -bg $BG -fn $FONT -title-name dzentop -e 'button2=;' &
Voilà à quoi ça devrai ressembler
Image
PC : AMD FX(tm)-8320 Eight-Core Processor × 8 - Motherbord ASUS H81-Plus ATX - 8Go Ram DDR3 - GeForce GTX 750 Ti/PCIe/SSE2
Notebook : Asus F6V-3P145CS 13,3", 3072 Mo, ATI Mobility™ Radeon™ HD3470 HyperMemory™
Serveur: FUJITSU PRIMERGY TX150 S6 sous Ubuntu 12.04 LTS
Avatar de l’utilisateur
rom1_31
Hankyu
Messages : 32
Inscription : ven. 29 août 2014, 08:33
Localisation : Toulouse

Re: [herbstluftwm] configuration | dzen2 - conky - panel.sh |

Message par rom1_31 »

Je reviens avec quelques nouveautés sur mon WM

J'ai bien avancé, mais encore quelques soucis avec les informations "conky|dzen" à ajouter dans la barre supérieure.

Si certains d'entre vous ont des idées, merci d'avance

Image
PC : AMD FX(tm)-8320 Eight-Core Processor × 8 - Motherbord ASUS H81-Plus ATX - 8Go Ram DDR3 - GeForce GTX 750 Ti/PCIe/SSE2
Notebook : Asus F6V-3P145CS 13,3", 3072 Mo, ATI Mobility™ Radeon™ HD3470 HyperMemory™
Serveur: FUJITSU PRIMERGY TX150 S6 sous Ubuntu 12.04 LTS
Avatar de l’utilisateur
rom1_31
Hankyu
Messages : 32
Inscription : ven. 29 août 2014, 08:33
Localisation : Toulouse

Re: [herbstluftwm] configuration | dzen2 - conky - panel.sh |

Message par rom1_31 »

Voilà ma config est enfin terminé, c'était pas simple, bref pas mal de bidouilles, surtout pour comprendre le code des différentes applis, d'autant plus quand on vient pas trop de ce milieu.

Retrouvez l'ensemble de ma config sur https://github.com/Rom1Linux

Image
PC : AMD FX(tm)-8320 Eight-Core Processor × 8 - Motherbord ASUS H81-Plus ATX - 8Go Ram DDR3 - GeForce GTX 750 Ti/PCIe/SSE2
Notebook : Asus F6V-3P145CS 13,3", 3072 Mo, ATI Mobility™ Radeon™ HD3470 HyperMemory™
Serveur: FUJITSU PRIMERGY TX150 S6 sous Ubuntu 12.04 LTS
Avatar de l’utilisateur
Xorg
Maître du Kyudo
Messages : 1933
Inscription : dim. 22 janv. 2012, 19:25
Localisation : Entre le clavier et la chaise.

Re: [herbstluftwm] configuration | dzen2 - conky - panel.sh |

Message par Xorg »

C'est sympa terminator, hein. :P
J'aime bien ton thème, c'est les couleurs d'Arch en plus.
Arch Linux x86_64 - Sway
AMD Ryzen 5 3600X - 32 Go de DDR4 - SSD NVMe 1 To + SSD SATA 250 Go - Sapphire NITRO+ Radeon RX 580
Image AUR___Image Wiki___Image GitHub
Avatar de l’utilisateur
Stdrome1209
yeomen
Messages : 266
Inscription : sam. 29 nov. 2014, 19:39

Re: [herbstluftwm] configuration | dzen2 - conky - panel.sh |

Message par Stdrome1209 »

Magnifique !!! :D

Sinon comment fais tu pour avoir le logo Arch Linux dans ton terminal ?

Par ailleurs Herbstluftwm est capable de gérer des fenêtres en floating ? D'après mes souvenir je ne pense pas, mais je ne suis pas sûr.

Ensuite question assez étrange, mais pourquoi avoir choisi Herbstluftwm parmi tout les tilling WM existants ?

Enfin je voudrais juste savoir si Dzen2 disparait bien sagement en arrière plan quand tu regarde une vidéo en plein écran (ou que tu joue à un jeu), car chez moi il restais toujours au dessus, je n'ai jamais compris pourquoi ?
Gaming desktop : Corsair Obsidian 350D, Intel Core I5 4690, Nvidia GTX 770, Asus H97M-E, 8 Go de DDR3, SSD 120 Go, HDD 500 Go, Powered by Arch Linux.

Notebook : Asus PU500CA, Intel Core i5-3317U, 4 Go de DDR3, SSD 240 Go, Powered by Arch Linux.

Netbook : LDLC Mercure MA1-2-S Slim, Intel Celeron N2830, 2 Go de DDR3, SSD 60 Go, Powered by Arch Linux.
Avatar de l’utilisateur
Loubrix
Daikyu
Messages : 84
Inscription : mer. 10 juin 2015, 01:41

Re: [herbstluftwm] configuration | dzen2 - conky - panel.sh |

Message par Loubrix »

le logo Arch dans le terminal s'obtient avec le logiciel Screenfetch (on le voit d'ailleurs dans le terminal).
ArchLinux 64 sur Asus AIO ET2012 et Asus X50VL, avec Xfce
Avatar de l’utilisateur
Xorg
Maître du Kyudo
Messages : 1933
Inscription : dim. 22 janv. 2012, 19:25
Localisation : Entre le clavier et la chaise.

Re: [herbstluftwm] configuration | dzen2 - conky - panel.sh |

Message par Xorg »

Pour le logo, il existe aussi archey3 et alsi (aussi disponible dans [archlinuxfr]).
Les trois se ressemblent énormément. :)
Arch Linux x86_64 - Sway
AMD Ryzen 5 3600X - 32 Go de DDR4 - SSD NVMe 1 To + SSD SATA 250 Go - Sapphire NITRO+ Radeon RX 580
Image AUR___Image Wiki___Image GitHub
Avatar de l’utilisateur
Stdrome1209
yeomen
Messages : 266
Inscription : sam. 29 nov. 2014, 19:39

Re: [herbstluftwm] configuration | dzen2 - conky - panel.sh |

Message par Stdrome1209 »

Merci !!! Ça m'a toujours fais envie ce genre de screen au lancement du terminal, dès que j'ai du temps je test ça.
Gaming desktop : Corsair Obsidian 350D, Intel Core I5 4690, Nvidia GTX 770, Asus H97M-E, 8 Go de DDR3, SSD 120 Go, HDD 500 Go, Powered by Arch Linux.

Notebook : Asus PU500CA, Intel Core i5-3317U, 4 Go de DDR3, SSD 240 Go, Powered by Arch Linux.

Netbook : LDLC Mercure MA1-2-S Slim, Intel Celeron N2830, 2 Go de DDR3, SSD 60 Go, Powered by Arch Linux.
Avatar de l’utilisateur
rom1_31
Hankyu
Messages : 32
Inscription : ven. 29 août 2014, 08:33
Localisation : Toulouse

Re: [herbstluftwm] configuration | dzen2 - conky - panel.sh |

Message par rom1_31 »

@Stdrome1209
Pour le logo dans le terminal, j'utilise screenfetch, c'est lui qui gère effectivement
Oui tu peux faire du floating, j'ai testé, mais pas super.
Pourquoi Herbstluftwm, j'ai vraiment aimé la démo qu'avait faite OxHak
Pour le plein écran, je n'ai aucun soucis.
PC : AMD FX(tm)-8320 Eight-Core Processor × 8 - Motherbord ASUS H81-Plus ATX - 8Go Ram DDR3 - GeForce GTX 750 Ti/PCIe/SSE2
Notebook : Asus F6V-3P145CS 13,3", 3072 Mo, ATI Mobility™ Radeon™ HD3470 HyperMemory™
Serveur: FUJITSU PRIMERGY TX150 S6 sous Ubuntu 12.04 LTS
Répondre