Skip to content

Commit

Permalink
adding bspwm and moar dotfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
bowoekren committed Nov 4, 2015
1 parent 5b79c63 commit 09f83ba
Show file tree
Hide file tree
Showing 18 changed files with 430 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .Xresources
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ URxvt.keysym.C-S-Down: perl:font-size:decglobal

! URxvt Extensions -----------------------------------------------------------

URxvt.perl-ext-common: ...,tabbed,default,matcher,clipboard
URxvt.perl-ext-common: ...,default,matcher,clipboard

! URxvt Tab ------------------------------------------------------------------
URxvt.tabbed.tabbar-fg: 8
Expand All @@ -16,7 +16,7 @@ URxvt.tabbed.tab-fg: 0
URxvt.tabbed.tab-bg: 3

! URxvt Font Family Locale ---------------------------------------------------
URxvt.font: xft:GohuFont:size=9:antialias=false
URxvt.font: xft:Source Code Pro:size=8:antialias=true
URxvt.imLocale: en_US.UTF-8
URxvt.url-launcher: /usr/bin/firefox
URxvt.matcher.button: 1
Expand All @@ -29,6 +29,8 @@ URxvt.clipboard.copycmd: xsel -ib
URxvt.clipboard.pastecmd: xsel -ob


! DZEN2 ------------------------
dzen2.font: -*-cure-*-*-9-*-*-*-*-*-*-*-*-*
! xscreensaver ---------------------------------------------------------------

!font settings
Expand Down
2 changes: 1 addition & 1 deletion .ls++.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use vars qw(@ignores
$symlink_color
);

$colorscheme = 'trapd00r';
$colorscheme = 'early';

@ignores = (
'\.un~$',
Expand Down
44 changes: 44 additions & 0 deletions bspwm/bspwmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#! /bin/sh
##+ decoration
bspc config border_width 0
bspc config window_gap 8
bspc config top_padding 50
bspc config left_padding 50
bspc config bottom_padding 50
bspc config right_padding 50

##+ colors
bspc config focused_border_color "#202020"
bspc config normal_border_color "#202020"
bspc config active_border_color "#3C788C"
bspc config focused_locked_border_color "#00C7D8"
bspc config normal_locked_border_color "#708D8F"
bspc config active_locked_border_color "#808C8D"
bspc config urgent_border_color "#93F388"
bspc config presel_border_color "#101010"

##+ Configuration
bspc config split_ratio 0.52
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config focus_by_distance true


##+ Monitor Number
bspc monitor -d I II III IV V

##+ Per-apps setup
bspc rule -a Gimp desktop=^8 follow=on floating=on
bspc rule -a Screenkey manage=off
bspc rule -a urxvt desktop=^2 follow=on
bspc rule -a sublime_text desktop=^2 follow=on
bspc rule -a firefox desktop=^1 follow=on floating=on
bspc rule -a thunar desktop=^1 follow=on floating=on
bspc rule -a pcmanfm desktop=^1 follow=on floating=on
bspc rule -a steam desktop=^3 floating=on
bspc rule -a vlc desktop=^3

feh --bg-fill ~/Pictures/wallhaven-13142.jpg &
firefox &
urxvt &
bar_panel &
44 changes: 44 additions & 0 deletions bspwm/panel/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Fonts defined in xfontsel (xft not yet supported)
FONT1="-*-stlarch-*-*-*-*-*-*-*-*-*-*-*"
FONT2="-xos4-terminus-*-r-normal-*-12-120-72-72-c-60-iso8859-1"

COLOR_BACKGROUND="#EE1b1b1b"
COLOR_FOREGROUND="#ffc0b18b"
#COLOR_ICON="#FF775759"
COLOR_ICON="#ffaf865a"
COLOR_ACTIVE="#FFaf865a"
COLOR_OCCUPIED="#FF4A3637"
COLOR_URGENT="#FFd17b49"
GREEN=8c9440
GRAY=404040

function F {
echo -n "%{F#ff$2}$1%{F-}"
}

DIV=$(F '|' $GRAY)

# Height of underlines / overlines
LINEHEIGHT="3"

# Panel geometry
PANEL_HEIGHT=22
PANEL_WIDTH=3430
PANEL_GEOMETRY="${PANEL_WIDTH}x${PANEL_HEIGHT}+5+5"

# Notification geometry
NOTIFY_HEIGHT=$PANEL_HEIGHT
NOTIFY_WIDTH=135
NOTIFY_GEOMETRY="${NOTIFY_WIDTH}x${NOTIFY_HEIGHT}+0+0"

# Duration of notifications
DURATION=2

# Monitor to display panel on
MONITOR="$(bspc query -M | tail -n1)"

# Volume change clip
CLIP="/usr/share/sounds/freedesktop/stereo/audio-volume-change.oga"
# Length of volume bar
BAR_LENGTH=20
BAR_CHAR='='
2 changes: 2 additions & 0 deletions bspwm/panel/cpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
top -bn1 | grep load | awk '{printf "%.2f\n", $(NF-2)}'
50 changes: 50 additions & 0 deletions bspwm/panel/execute_panel
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

FOCUS_DESKTOP=1
MOVE_DESKTOP=2

err() {
echo "$1"
exit 1
}

usage() {
echo "usage: execute_panel [command] [value]"
echo
echo "Options:"
echo " -f, --focus-desktop - switch to desktop name"
echo " -d, --move-desktop - move to desktop name"
echo " -h, --help - display this"
exit
}

case $1 in
'-f'|'--focus-desktop')
[ -z "$2" ] && err "No desktop name specified"
COMMAND=$FOCUS_DESKTOP
ARGN="${2}"
;;
'-d'|'--move-desktop')
[ -z "$2" ] && err "No desktop name specified"
COMMAND=$MOVE_DESKTOP
ARGN="${2}"
;;
''|'-h'|'--help'|*)
usage
exit
;;
esac

# Ensure the command is something we want to run
case $COMMAND in
$FOCUS_DESKTOP)
bspc config auto_alternate false
bspc desktop -f $ARGN
bspc config auto_alternate true
;;
$MOVE_DESKTOP)
bspc desktop -d $ARGN
;;
*)
;;
esac
11 changes: 11 additions & 0 deletions bspwm/panel/notify
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

source $(dirname $0)/config

(echo " $@"; sleep $DURATION)\
| bar \
-f "$FONT1","$FONT2"\
-F "$COLOR_FOREGROUND"\
-B "$COLOR_BACKGROUND"\
-g "$NOTIFY_GEOMETRY"\
-u $LINEHEIGHT
66 changes: 66 additions & 0 deletions bspwm/panel/notify_mpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

source $(dirname $0)/config

# Only run if mpd is running
if [ $(pgrep -cx mpd) -eq 0 ] ; then
exit 1
fi

err() {
echo "$1"
exit 1
}

usage() {
echo "usage: notify_mpd [option]"
echo
echo "Options:"
echo " -n, --next - next track"
echo " -p, --prev - previous track"
echo " -t, --toggle - toggle pause"
echo " -d, --daemon - listen for track changes through mpd frontends"
echo " -h, --help - display this"
exit
}


notify() {
$(dirname $0)/notify "$@" &
}

state() {
mpc | sed -n 's/^.*\[\([^\[].*\)\] .*$/\1/p' | uniq
}

case $1 in
'-p'|'--prev')
mpc prev
icon=
;;
'-n'|'--next')
mpc next
icon=
;;
'-t'|'--toggle')
mpc toggle
if [[ `state` == 'paused' ]]; then
icon=
elif [[ `state` == 'playing' ]]; then
icon=
fi
;;
'-d'|'--daemon')
while true; do
infos=$(mpc current --wait)
notify  $infos
done
;;
''|'-h'|'--help')
usage
;;
*)
err "Unrecognized option \`$1', see notify_mpd --help"
esac

notify $icon $(mpc current)
77 changes: 77 additions & 0 deletions bspwm/panel/notify_volume
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/sh
#
# Inspired by :
# z3bra - http://blog.z3bra.org/2014/04/pop-it-up.html
# bruenig - https://bbs.archlinux.org/viewtopic.php?id=46608

source $(dirname $0)/config

err() {
echo "$1"
exit 1
}

usage() {
echo "usage: notify_volume [option] [argument]"
echo
echo "Options:"
echo " +, -i, --increase - increase volume by \`argument'"
echo " -, -d, --decrease - decrease volume by \`argument'"
echo " +, -i, --toggle - mute/unmute"
echo " -h, --help - display this"
exit
}


level() {
amixer get Master | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq
}

state() {
amixer get Master | sed -n 's/^.*\[\(o[nf]\+\)]$/\1/p' | uniq
}

case $1 in
'+'|'-i'|'--increase')
[ -z "$2" ] && err "No argument specified for increase"
AMIXARG="${2}%+"
;;
'-'|'-d'|'--decrease')
[ -z "$2" ] && err "No argument specified for decrease."
AMIXARG="${2}%-"
;;
'!'|'-t'|'--toggle')
AMIXARG="toggle"
;;
''|'-h'|'--help')
usage
;;
*)
err "Unrecognized option \`$1', see notify_volume --help"
esac

amixer set Master $AMIXARG >/dev/null

if [[ `state` != "on" ]]; then
icon=""
elif [[ `level` -lt 30 ]]; then
icon=""
else
icon=""
fi

steps=$(echo "100/$BAR_LENGTH" | bc)
current=$(echo "`level`/$steps" | bc)
for i in `seq 1 $BAR_LENGTH`;
do
if [[ `state` != "on" ]]; then
bar+=" "
elif [ $i -lt $current ]; then
bar+="%{F$COLOR_ACTIVE}${BAR_CHAR}%{F-}"
else
bar+="%{F$COLOR_OCCUPIED}${BAR_CHAR}%{F-}"
fi
done

$(dirname $0)/notify "%{F$COLOR_ICON}$icon%{F-} [$bar]"&
mplayer "$CLIP" >/dev/null&
30 changes: 30 additions & 0 deletions bspwm/panel/panel
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /bin/sh

cd $(dirname $0)
source $(dirname $0)/config

if [ $(pgrep -cx panel) -gt 1 ] ; then
printf "%s\n" "The panel is already running." >&2
exit 1
fi

trap 'trap - TERM; kill 0' INT TERM QUIT EXIT

[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"

bspc control --subscribe > "$PANEL_FIFO" &
echo "T" > "$PANEL_FIFO" &
conky -c ./panel_conky > "$PANEL_FIFO" &
./notify_mpd -d &

cat "$PANEL_FIFO" \
| ./panel_bar \
| lemonbar \
-f "$FONT1"\
-f "$FONT2"\
-F "$COLOR_FOREGROUND"\
-B "$COLOR_BACKGROUND"\
-g "$PANEL_GEOMETRY"\
-u $LINEHEIGHT &
wait
Loading

0 comments on commit 09f83ba

Please sign in to comment.