Skip to content

Instantly share code, notes, and snippets.

@maman
Created August 18, 2011 06:44
Show Gist options
  • Save maman/1153512 to your computer and use it in GitHub Desktop.
Save maman/1153512 to your computer and use it in GitHub Desktop.
subkorporate dzen2
#just a portion of my .xinitrc that runs dzens
#baars
(
sleep 5
left & #adjust to point the 'left' file
tail -f /home/kitty/.config/dzen/pager | dzen2 -ta l -bg '#151515' -x 0 -y 0 -h 17 -w 400 & #adjust the pager to point to the FIFO that made by 'left' file
bar #adjust to point to the 'bar' file
)&
#!/bin/bash
#chmod +x this file.
# Source settings file
. $HOME/.config/dzen/settings #adjust this, so it's pointing to the settings file.
# Get mailcount Gmail
gmail() {
count=0
if [[ ! -n `ls ${MAILDIR}` ]]; then
echo -n "0"
else
count=`ls -1 ${MAILDIR} | wc -l`
echo -n "${count}"
fi
}
# Get mailcount SPBU17
cmail() {
count=0
if [[ ! -n `ls ${MAILDIR2}` ]]; then
echo -n "0"
else
count=`ls -1 ${MAILDIR2} | wc -l`
echo -n "${count}"
fi
}
# Get pacman packages
pacman() {
echo -n $(grep testing ~/.pacmanupdates | wc -l)
echo -n "/"
echo -n $(grep core ~/.pacmanupdates | wc -l)
echo -n "/"
echo -n $(grep community ~/.pacmanupdates | wc -l)
}
while :; do
echo " ^fg($LGREEN)^ca(1,mpc toggle)^ca(3,urxvtc -geometry -50+50 -e ncmpcpp)^ca(4,mpc next)^ca(5,mpc prev) \
$(mpc -f %artist% current | tr '[:lower:]' '[:upper:]') \
^fg($FG) - \
^fg($YELLOW) \
$(mpc -f %title% current | tr '[:lower:]' '[:upper:]')^ca()^ca()^ca()^ca() \
^fg($FG) | \
^fg($RED)^ca(4,amixer set Master 5%+)^ca(5,amixer set Master 5%-) \
$(amixer sget Master | grep -m1 "%]" | cut -d "[" -f2 | cut -d "]" -f1)^ca()^ca()^fg($FG) | \
^fg($LYELLOW) TODO: $(tail -1 ~/Dropbox/todo/todo.txt | tr '[:lower:]' '[:upper:]')^fg($FG) | \
^fg($RED) ^ca(1,urxvtc -geometry 110x30-50+50 -e mutt)\
MAIL: $(gmail)/$(cmail) ^ca()\
^fg($FG) | ^ca(1,urxvtc -geometry -50+50 -e sudo packer -Syu)\
^fg($CYAN) PAC: $(pacman)^ca()^fg($FG) | \
^fg($BLUE) $(date +%H:%M) \
"
sleep $SLEEP
done | dzen2 -ta r -w 880 -bg $BG -x 400 -y 0 -h 17 -fn $FONT
# S U B K O R P O R A T E - D Z E N 2
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# some packages are archlinux-specific only. please refer to your distro or install from source.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dzen2-xft-xpm-xinerama-svn [AUR] - the main dzen2 package
zsh - needed for 'left'
wmctrl - needed for 'left'
mpd - needed for the music notification
mpc - needed for the music notification
todo.txt cli - needed for the task management
urxvt-unicode-patched [AUR] - optional
gmrun - optional
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Fonts needed for full functionality
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Helvetica Fonts
#!/bin/zsh
#chmod +x this file.
#
# usage: ./bar.sh [<desktop_number>]
#
# Creates a clickable dzen bar that allows switching between desktops,
# optionally switching to the given desktop.
# Source settings file
. $HOME/.config/dzen/settings #adjust this, so it's pointing to the settings file.
FG_FOCUS=$MAGENTA
BG_FOCUS=$BG
FG_NOFOCUS=$FG
BG_NOFOCUS=$BG
FG_ICON=$FG
BG_ICON=$BG
#Launch dzen2 and establish the pipe
if [[ ! -e $FILE ]]
then
# socat PIPE:/tmp/dzen2.pipe EXEC:"dzen2 -p -ta l -fn $FONT2" &
mkfifo $FILE
fi
#Switch to the given desktop
if [[ ! -z $1 ]]
then
wmctrl -s $1
fi
#Get all desktop numbers
DESKTOPS=(`wmctrl -d | cut -b1`)
#Create the dzen input
#The click action calls the script with argument the clicked desktop, and
#thus both swithes to this desktop and updates the dzen bar.
#
#The wm mappings to switch between desktop should call this script as well
line="^ca(1,gmrun)^bg($LMAGENTA)^fn($FONT2) ^fg($BG)^i($ICONPATH/arch2.xbm) ^bg($BG_NOFOCUS)^fg($LMAGENTA)^i($ICONPATH/arrow.xbm)^fg($FG_NOFOCUS)^bg($BG_NOFOCUS) ^bg()^ca()"
for d in $DESKTOPS
do
#case $d in
# 0) t=" ^i($ICONPATH/terminal.xbm) TERM ";;
# 1) t=" ^i($ICONPATH/fox.xbm) INET ";;
# 2) t=" ^i($ICONPATH/quote.xbm) EDIT ";;
# 3) t=" ^i($ICONPATH/paint.xbm) GFX ";;
# 4) t=" ^i($ICONPATH/shelf.xbm) FMAN ";;
# esac
case $d in
0) t=" TERM";;
1) t=" NET";;
2) t=" EDIT";;
3) t=" GFX";;
4) t=" FMAN";;
esac
if [[ -z "`wmctrl -d | cut -c-4 | grep $d | grep '*'`" ]]
then
line+="^ca(1,left $d)^fg($BG_NOFOCUS)^i($ICONPATH/arrow.xbm)^fg($FG_NOFOCUS)$t^fg($BG_NOFOCUS)^i($ICONPATH/arrow.xbm)^ca()"
else
line+="^ca(1,left $d)^bg($BG_FOCUS)^fg($BG_NOFOCUS)^i($ICONPATH/arrow.xbm)^fg($FG_FOCUS)$t^fg($BG_FOCUS)^bg($BG_NOFOCUS)^i($ICONPATH/arrow.xbm)^fg($FG_NOFOCUS)^bg($BG_NOFOCUS)^ca()"
fi
done
#Forward the dzen input to dzen through the pipe
echo $line > $FILE
#!/bin/bash
SLEEP=1
# Font
FONT="Helvetica:pixelsize=9"
FONT2="Helvetica:Bold:pixelsize=9"
# Colors
BG="#151515"
FG="#656565"
RED="#8C4665"
LRED="#BF4D80"
GREEN="#28737"
LGREEN="#53A6A6"
YELLOW="#8B769F"
LYELLOW="#C4A1E6"
BLUE="#395573"
LBLUE="#477AB3"
MAGENTA="#5E468C"
LMAGENTA="#7E62B3"
CYAN="#31658C"
LCYAN="#6096BF"
WHITE="#E6E7E8"
LWHITE="#F2F2F3"
# Mail
MAILDIR='/home/kitty/mail/gmail/inbox/new/' #mailbox 1 - adjust it.
MAILDIR2='/home/kitty/mail/gmail/SPBU17/new/' #mailbox 2 - adjust it.
# Iconpath & FIFO
ICONPATH="/home/kitty/.config/subtle/icons" #adjust to your icon path - icon format is *.xbm
FILE="/home/kitty/.config/dzen/pager" #the pager file produced by left
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment