fix hc alias - add bapyrus

This commit is contained in:
Thomas Ruoff
2018-07-29 23:59:03 +02:00
parent ed3d2e04b9
commit ca57483a78
7 changed files with 83 additions and 250 deletions

View File

@@ -1,5 +1,4 @@
#!/bin/sh #!/usr/bin/env bash
hc=herbstclient
CFGDIR=$HOME/.config/herbstluftwm CFGDIR=$HOME/.config/herbstluftwm
@@ -11,22 +10,22 @@ pkill conky
pkill urxvtd pkill urxvtd
pkill udiskie pkill udiskie
hc emit_hook reload herbstclient emit_hook reload
${CFGDIR}/bindings.sh ${CFGDIR}/bindings.sh
${CFGDIR}/rules.sh ${CFGDIR}/rules.sh
${CFGDIR}/styling.sh ${CFGDIR}/styling.sh
$hc set tree_style '╾│ ├└╼─┐' herbstclient set tree_style '╾│ ├└╼─┐'
$hc unlock herbstclient unlock
$hc detect_monitors herbstclient detect_monitors
panel_height=20 panel_height=20
statusbar_height=20 statusbar_height=20
for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
# start it on each monitor # start it on each monitor
$hc pad $monitor $panel_height 0 $statusbar_height 0 herbstclient pad $monitor $panel_height 0 $statusbar_height 0
${CFGDIR}/panel.sh $monitor & ${CFGDIR}/panel.sh $monitor &
${CFGDIR}/statusbar.sh $monitor & ${CFGDIR}/statusbar.sh $monitor &
done done

View File

@@ -1,80 +1,77 @@
#!/bin/sh #!/bin/bash
herbstclient keyunbind --all
hc=herbstclient
$hc keyunbind --all
# keybindings # keybindings
Mod=Mod4 Mod=Mod4
$hc keybind $Mod-Control-q quit herbstclient keybind $Mod-Control-q quit
$hc keybind $Mod-Shift-q close herbstclient keybind $Mod-Shift-q close
$hc keybind $Mod-Shift-r reload herbstclient keybind $Mod-Shift-r reload
# tags # tags
TAG_NAMES=( {1..9} 0 ) TAG_NAMES=( {1..9} 0 )
TAG_KEYS=( {1..9} 0 ) TAG_KEYS=( {1..9} 0 )
$hc rename default "${TAG_NAMES[0]}" || true herbstclient rename default "${TAG_NAMES[0]}" || true
for i in ${!TAG_NAMES[@]} ; do for i in ${!TAG_NAMES[@]} ; do
$hc add "${TAG_NAMES[$i]}" herbstclient add "${TAG_NAMES[$i]}"
key="${TAG_KEYS[$i]}" key="${TAG_KEYS[$i]}"
if ! [ -z "$key" ] ; then if ! [ -z "$key" ] ; then
$hc keybind "$Mod-$key" use_index "$i" herbstclient keybind "$Mod-$key" use_index "$i"
$hc keybind "$Mod-Shift-$key" move_index "$i" herbstclient keybind "$Mod-Shift-$key" move_index "$i"
fi fi
done done
# cycle through tags # cycle through tags
$hc keybind $Mod-period use_index +1 --skip-visible herbstclient keybind $Mod-period use_index +1 --skip-visible
$hc keybind $Mod-comma use_index -1 --skip-visible herbstclient keybind $Mod-comma use_index -1 --skip-visible
$hc keybind $Mod-Right use_index +1 --skip-visible herbstclient keybind $Mod-Right use_index +1 --skip-visible
$hc keybind $Mod-Left use_index -1 --skip-visible herbstclient keybind $Mod-Left use_index -1 --skip-visible
$hc keybind $Mod-minus use_previous herbstclient keybind $Mod-minus use_previous
# layouting # layouting
$hc keybind $Mod-r remove herbstclient keybind $Mod-r remove
$hc keybind $Mod-space cycle_layout 1 herbstclient keybind $Mod-space cycle_layout 1
$hc keybind $Mod-e split explode herbstclient keybind $Mod-e split explode
$hc keybind $Mod-u split vertical 0.5 herbstclient keybind $Mod-u split vertical 0.5
$hc keybind $Mod-Shift-u split vertical 0.66 herbstclient keybind $Mod-Shift-u split vertical 0.66
$hc keybind $Mod-o split horizontal 0.5 herbstclient keybind $Mod-o split horizontal 0.5
$hc keybind $Mod-Shift-o split horizontal 0.666 herbstclient keybind $Mod-Shift-o split horizontal 0.666
$hc keybind $Mod-s floating toggle herbstclient keybind $Mod-s floating toggle
$hc keybind $Mod-f fullscreen toggle herbstclient keybind $Mod-f fullscreen toggle
$hc keybind $Mod-p pseudotile toggle herbstclient keybind $Mod-p pseudotile toggle
# resizing # resizing
RESIZESTEP=0.02 RESIZESTEP=0.02
$hc keybind $Mod-Control-h resize left +$RESIZESTEP herbstclient keybind $Mod-Control-h resize left +$RESIZESTEP
$hc keybind $Mod-Control-j resize down +$RESIZESTEP herbstclient keybind $Mod-Control-j resize down +$RESIZESTEP
$hc keybind $Mod-Control-k resize up +$RESIZESTEP herbstclient keybind $Mod-Control-k resize up +$RESIZESTEP
$hc keybind $Mod-Control-l resize right +$RESIZESTEP herbstclient keybind $Mod-Control-l resize right +$RESIZESTEP
# mouse in floating mode # mouse in floating mode
$hc mouseunbind --all herbstclient mouseunbind --all
$hc mousebind $Mod-Button1 move herbstclient mousebind $Mod-Button1 move
$hc mousebind $Mod-Button2 zoom herbstclient mousebind $Mod-Button2 zoom
$hc mousebind $Mod-Button3 resize herbstclient mousebind $Mod-Button3 resize
# focus # focus
$hc set focus_follows_mouse 1 herbstclient set focus_follows_mouse 1
$hc rule focus=on herbstclient rule focus=on
$hc keybind $Mod-BackSpace cycle_monitor herbstclient keybind $Mod-BackSpace cycle_monitor
$hc keybind $Mod-Tab cycle_all +1 herbstclient keybind $Mod-Tab cycle_all +1
$hc keybind $Mod-Shift-Tab cycle_all -1 herbstclient keybind $Mod-Shift-Tab cycle_all -1
$hc keybind $Mod-c cycle herbstclient keybind $Mod-c cycle
$hc keybind $Mod-h focus left herbstclient keybind $Mod-h focus left
$hc keybind $Mod-j focus down herbstclient keybind $Mod-j focus down
$hc keybind $Mod-k focus up herbstclient keybind $Mod-k focus up
$hc keybind $Mod-l focus right herbstclient keybind $Mod-l focus right
$hc keybind $Mod-i jumpto urgent herbstclient keybind $Mod-i jumpto urgent
$hc keybind $Mod-Shift-h shift left herbstclient keybind $Mod-Shift-h shift left
$hc keybind $Mod-Shift-j shift down herbstclient keybind $Mod-Shift-j shift down
$hc keybind $Mod-Shift-k shift up herbstclient keybind $Mod-Shift-k shift up
$hc keybind $Mod-Shift-l shift right herbstclient keybind $Mod-Shift-l shift right

162
panel.sh
View File

@@ -1,162 +0,0 @@
#!/bin/bash
source ~/.config/herbstluftwm/settings.sh
# disable path name expansion or * will be expanded in the line
# cmd=( $line )
set -f
monitor=${1:-0}
monGeomitry=( $(herbstclient monitor_rect "$monitor") )
if [ -z "$monGeomitry" ] ;then
echo "Invalid monitor $monitor"
exit 1
fi
# monGeomitry has the format: WxH+X+Y
x=${monGeomitry[0]}
y=${monGeomitry[1]}
panel_width=$((${monGeomitry[2]}))
panel_height=20
# reserve space for tray on first monitor
if [ $monitor -eq 0 ] ; then
panel_width=$(($panel_width - 100))
fi
panelGeometry=${panel_width}x${panel_height}+${x}+${y}
textellipsis() {
awk -v len=100 '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }'
}
volume() {
LEVEL=$(amixer get Master | tail -1 | sed 's/.*\[\([0-9]*\)%\].*/\1/')
if [ "$LEVEL" -gt "49" ] ; then
echo -en '\uf028';
elif [ "$LEVEL" -gt "0" ] ; then
echo -en '\uf027';
else
echo -en '\uf026';
fi
echo " ${LEVEL}%"
}
# events
{
# now playing
mpc idleloop player | cat &
mpc_pid=$!
# volume
while true ; do
echo -e "vol " $(volume)
sleep 1 || break
done > >(uniq_linebuffered) &
vol_pid=$!
# date
while true ; do
date +'date_min %Y-%m-%d %H:%M'
sleep 1 || break
done > >(uniq_linebuffered) &
date_pid=$!
# herbstluftwm
herbstclient --idle
# exiting; kill stray event-emitting processes
kill $mpc_pid $vol_pid $date_pid
} 2> /dev/null | {
TAGS=( $(herbstclient tag_status $monitor) )
unset TAGS[${#TAGS[@]}]
time=""
song=""
windowtitle=""
visible=true
while true ; do
echo -n "%{l}%{F-}"
for i in "${TAGS[@]}" ; do
case ${i:0:1} in
'#') # current tag
echo -n "%{U$active}%{+u}"
;;
'+') # active on other monitor
echo -n "%{U$activeOnMontior}%{+u}"
;;
':')
echo -n "%{F$notempty}"
;;
'!') # urgent tag
echo -n "%{U$urgent}%{+u}"
;;
*)
echo -n "%{F$notused}"
;;
esac
echo -n "%{A:select_tag ${i:1}:}"
echo -n " ${i:1} "
echo -n "%{A}"
echo -n "%{-u}%{F-}%{B-}"
done
# center window title
echo -n "%{c}$(echo ${windowtitle//^/^^} | textellipsis) "
# align right
echo -n "%{r}"
if [ -n "$song" ] ; then
echo -n "$song" "$song2"
fi
echo -en " $volume "
echo -en "\uf133 $date"
echo " "
# wait for next event
read line || break
cmd=( $line )
# find out event origin
case "${cmd[0]}" in
tag*)
TAGS=( $(herbstclient tag_status $monitor) )
unset TAGS[${#TAGS[@]}]
;;
mpd_player|player)
song="$(mpc -f %artist% current)"
song2="$(mpc -f %title% current)"
;;
vol)
volume="${cmd[@]:1}"
;;
date_min)
date="${cmd[@]:1}"
;;
focus_changed|window_title_changed)
windowtitle="${cmd[@]:2}"
;;
quit_panel)
exit
;;
reload)
exit
;;
esac
done
} 2> /dev/null \
| lemonbar \
-g $panelGeometry \
-f "$font" \
-B "$bgcolor" -F "$fgcolor" \
-u 2 \
| while read line; do
set $line
case "$1" in
select_tag )
# make sure the current monitor is focused
herbstclient focus_monitor $monitor
herbstclient use $2
;;
esac
done

1
panel.sh Symbolic link
View File

@@ -0,0 +1 @@
/usr/bin/barpyrus

View File

@@ -1,13 +1,13 @@
#!/bin/sh #!/usr/bin/env bash
alias hc=herbstclient set -e
# rules # rules
hc unrule -F herbstclient unrule -F
#hc rule class=XTerm tag=3 # move all xterms to tag 3 #herbstclient rule class=XTerm tag=3 # move all xterms to tag 3
hc rule focus=off # normally do not focus new clients herbstclient rule focus=off # normally do not focus new clients
# give focus to most common terminals # give focus to most common terminals
hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on herbstclient rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on herbstclient rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on herbstclient rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off herbstclient rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
source ~/.config/herbstluftwm/settings.sh source ~/.config/herbstluftwm/settings.sh
# disable path name expansion or * will be expanded in the line # disable path name expansion or * will be expanded in the line

View File

@@ -1,30 +1,28 @@
#!/bin/sh #!/bin/bash -x
hc=herbstclient
CFGDIR=$HOME/.config/herbstluftwm CFGDIR=$HOME/.config/herbstluftwm
$CFGDIR/wallpaper.sh $CFGDIR/wallpaper.sh
# frame/window styling # frame/window styling
$hc set frame_border_active_color '#eee8d5' herbstclient set frame_border_active_color '#eee8d5'
$hc set frame_border_normal_color '#475152' herbstclient set frame_border_normal_color '#475152'
$hc set frame_bg_transparent 1 herbstclient set frame_bg_transparent 1
$hc set frame_border_width 1 herbstclient set frame_border_width 1
$hc set frame_active_opacity 80 herbstclient set frame_active_opacity 80
$hc set frame_normal_opacity 80 herbstclient set frame_normal_opacity 80
$hc set frame_gap 4 herbstclient set frame_gap 4
$hc set frame_padding 0 herbstclient set frame_padding 0
$hc set always_show_frame 1 herbstclient set always_show_frame 1
$hc set smart_frame_surroundings 1 herbstclient set smart_frame_surroundings 1
$hc set window_border_width 2 herbstclient set window_border_width 2
$hc set window_border_inner_width 0 herbstclient set window_border_inner_width 0
$hc set window_border_normal_color '#0a1b22' herbstclient set window_border_normal_color '#0a1b22'
$hc set window_border_active_color '#d9e5e7' herbstclient set window_border_active_color '#d9e5e7'
$hc set window_gap 0 herbstclient set window_gap 0
$hc set smart_window_surroundings 1 herbstclient set smart_window_surroundings 1
$hc set mouse_recenter_gap 0 herbstclient set mouse_recenter_gap 0

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
source ~/.config/herbstluftwm/settings.sh source ~/.config/herbstluftwm/settings.sh