"initial" commit :D

This commit is contained in:
Thomas Ruoff
2018-04-03 23:17:34 +02:00
commit ed3d2e04b9
15 changed files with 484 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

41
autostart Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
hc=herbstclient
CFGDIR=$HOME/.config/herbstluftwm
# kill old instances, perhaps I should do this with pids?
pkill dzen2
pkill lemonbar
pkill stalonetray
pkill conky
pkill urxvtd
pkill udiskie
hc emit_hook reload
${CFGDIR}/bindings.sh
${CFGDIR}/rules.sh
${CFGDIR}/styling.sh
$hc set tree_style '╾│ ├└╼─┐'
$hc unlock
$hc detect_monitors
panel_height=20
statusbar_height=20
for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
# start it on each monitor
$hc pad $monitor $panel_height 0 $statusbar_height 0
${CFGDIR}/panel.sh $monitor &
${CFGDIR}/statusbar.sh $monitor &
done
${CFGDIR}/tray.sh &
urxvtd &
udiskie --tray &
systemctl --user restart sxhkd
systemctl --user restart xautolock
wmname LG3D

80
bindings.sh Executable file
View File

@@ -0,0 +1,80 @@
#!/bin/sh
hc=herbstclient
$hc keyunbind --all
# keybindings
Mod=Mod4
$hc keybind $Mod-Control-q quit
$hc keybind $Mod-Shift-q close
$hc keybind $Mod-Shift-r reload
# tags
TAG_NAMES=( {1..9} 0 )
TAG_KEYS=( {1..9} 0 )
$hc rename default "${TAG_NAMES[0]}" || true
for i in ${!TAG_NAMES[@]} ; do
$hc add "${TAG_NAMES[$i]}"
key="${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
$hc keybind $Mod-minus use_previous
# layouting
$hc keybind $Mod-r remove
$hc keybind $Mod-space cycle_layout 1
$hc keybind $Mod-e split explode
$hc keybind $Mod-u split vertical 0.5
$hc keybind $Mod-Shift-u split vertical 0.66
$hc keybind $Mod-o split horizontal 0.5
$hc keybind $Mod-Shift-o split horizontal 0.666
$hc keybind $Mod-s floating toggle
$hc keybind $Mod-f fullscreen toggle
$hc keybind $Mod-p pseudotile toggle
# resizing
RESIZESTEP=0.02
$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 in floating mode
$hc mouseunbind --all
$hc mousebind $Mod-Button1 move
$hc mousebind $Mod-Button2 zoom
$hc mousebind $Mod-Button3 resize
# focus
$hc set focus_follows_mouse 1
$hc rule focus=on
$hc keybind $Mod-BackSpace cycle_monitor
$hc keybind $Mod-Tab cycle_all +1
$hc keybind $Mod-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

15
conky-bat/index.js Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env node
'use strict';
var linuxBattery = require('linux-battery');
linuxBattery().then(batteries => {
batteries.forEach(battery => {
var color = battery.warningLevel !== 'none' ? '#ff0000' : '#eee8d5';
var stateSymbol = battery.state === 'charging' ? '↑' : '↓';
var timeLeft = battery.timeToFull || battery.timeToEmpty || '';
var text = `%{F${color}}${battery.percentage} ${stateSymbol} ${timeLeft}%{F-}`;
console.log(text);
});
});

15
conky-bat/package.json Normal file
View File

@@ -0,0 +1,15 @@
{
"name": "conky-bat",
"version": "0.0.0",
"description": "battery status for conky",
"main": "index.js",
"dependencies": {
"linux-battery": "^3.0.1"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Thomas Ruoff",
"license": "MIT"
}

36
conkyrc Normal file
View File

@@ -0,0 +1,36 @@
## output to X <yes/no>
out_to_x no
## Create own window to draw <yes/no>
own_window no
## Print everything to console?
out_to_console yes
## Use double buffering (reduces flicker, not needed for console output)
double_buffer no
## Set to yes if you want Conky to be forked in the background
background no
## Update interval in seconds
update_interval 1.0
## This is the number of times Conky will update before quitting.
## Set to zero to run forever.
total_run_times 0
## How strict should if_up be when testing an interface for being up?
## The value is one of up, link or address, to check for the interface
## being solely up, being up and having link or being up, having link
## and an assigned IP address.
if_up_strictness address
## Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes
use_spacer left
TEXT
%{c} load: ${loadavg 1} ${loadavg 2} ${loadavg 3} | ram: ${memperc}% | swap: ${swapperc} | processes: ${processes} | ${if_up wlp3s0} wlan:${wireless_link_qual_perc wlp3s0}% ${wireless_essid wlp3s0} ↓${downspeed wlp3s0} ↑${upspeed wlp3s0} |$endif ${if_up enp0s25:} lan: ↓${downspeed wlp3s0} ↑${upspeed wlp3s0} |$endif bat ${exec $HOME/.config/herbstluftwm/conky-bat/index.js}

162
panel.sh Executable file
View File

@@ -0,0 +1,162 @@
#!/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

13
rules.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
alias hc=herbstclient
# rules
hc unrule -F
#hc rule class=XTerm tag=3 # move all xterms to tag 3
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

19
settings.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
#font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
font="DejaVu Sans Mono for Powerline:pixelsize=11"
# default
fgcolor="#eee8d5"
bgcolor="#002b36"
active="#b58900"
activeOnMontior="2aa198"
notempty="#fdf6e3"
notused="#657b83"
urgent="#dc322f"
function uniq_linebuffered() {
awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}

51
statusbar.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/bash
source ~/.config/herbstluftwm/settings.sh
# disable path name expansion or * will be expanded in the line
# cmd=( $line )
set -f
statusbar_height=20
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[3]} - $statusbar_height))
screen_width=${geometry[2]}
panelGeometry=${geometry[2]}x${statusbar_height}+${x}+${y}
{
conky -c /home/idon/.config/herbstluftwm/conkyrc | while read -r; do
echo -e "$REPLY";
done > >(uniq_linebuffered) &
childpid=$!
herbstclient --idle
kill $childpid
} 2> /dev/null | {
while true ; do
read line || break
cmd=( $line )
# find out event origin
case "${cmd[0]}" in
focus_changed|window_title_changed|tag_changed|tag_flags)
;;
quit_panel)
exit
;;
reload)
exit
;;
*)
echo $line
;;
esac
done
} 2> /dev/null \
| lemonbar \
-g $panelGeometry \
-f "$font" \
-B $bgcolor -F $fgcolor \
-u 2

30
styling.sh Executable file
View File

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

13
tray.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
source ~/.config/herbstluftwm/settings.sh
set $(herbstclient monitor_rect 0)
TRAY_GEOMETRY=5x1+$(($3 - 100))+0
stalonetray \
--background "#002b36" \
--geometry $TRAY_GEOMETRY \
--icon-size 20 \
--kludges force_icons_size \
2>&1 > /dev/null &

8
wallpaper.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# xsetroot -solid '#eee8d5'
# random wallpaper
WALLPAPERDIR=$(dirname "$0")/wallpapers
WALLPAPER=`find $WALLPAPERDIR -type f | sort -R | head -n 1`
feh --bg-scale $WALLPAPER

BIN
wallpapers/nerves.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
wallpapers/solarized.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 KiB