Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh -f
- # wmii configuration file.
- # REQUIREMENTS: # # ## # # #
- # [*] feh (for the wallpaper)#
- # [*] alsa-utils, and alsa #
- # [*] firefox web browser #
- # [*] rxvt-unicode terminal #
- # [*] thunar file browser #
- # [*] gedit text browser #
- # [*] transset-df for transp.#
- # [*] xcompmgr for composite #
- # [&] laptops: acpi #
- # # # # # # # # # # # # # # #
- # Configuration Variables
- MODKEY=Mod1
- UP=k
- DOWN=j
- LEFT=h
- RIGHT=l
- #----------- THEMES AND TRANSPARENCY ------------ #
- WMII_TRANSPARENT_BAR="yes"
- WMII_BAR_OPACITY=".70"
- #This is my favorite font, you can comment-it out if you'd like to.
- WMII_FONT='-*-mgopen canonica-medium-r-*-*-*-*-*-*-*-*-iso8859-1'
- # Colors tuples: "<text> <background> <border>"
- #WMII_NORMCOLORS='#4d7994 #162438 #162438'
- #WMII_FOCUSCOLORS='#ffffff #285577 #285577'
- #WMII_URGENTCOLORS='#000000 #FF4400 #FF4400'
- #WMII_BACKGROUND='#333333'
- #WMII_FONT='-*-fixed-*-*-*-*-*-*-*-*-*-*-*-*'
- # GREEN THEME #
- #WMII_FOCUSCOLORS='#66FF00 #101010 #66FF00'
- #WMII_BACKGROUND='#888888'
- #WMII_NORMCOLORS='#EEEEEE #000000 #111111'
- #WMII_FONT='-artwiz-snap-normal-*-*-*-*-*-*-*-*-*-*-*'
- # Xterm Style Theme #
- WMII_FOCUSCOLORS='#54FF54 #000000 #73A5FF'
- WMII_BACKGROUND='#000000'
- WMII_NORMCOLORS='#A8A8A8 #000000 #A07040'
- #WMII_FONT='-*-fixed-*-*-*-*-*-*-*-*-*-*-iso8859-7'
- #BLUE AND SMOKE THEME --UNCOMMENT TO USE, COMMENT-OUT ANY OTHER THEMES #
- #WMII_FOCUSCOLORS='#FFFFFF #285577 #4C7899'
- #WMII_BACKGROUND='#333333'
- #WMII_NORMCOLORS='#888888 #222222 #333333'
- # sleepless night Theme[MODIFIED]--UNCOMMENT TO USE, COMMENT-OUT ANY OTHER THEMES#
- #WMII_NORMCOLORS='#EE6600 #111111 #FF7700'
- #WMII_FOCUSCOLORS='#ffffff #330000 #000066'
- #WMII_BACKGROUND='#333333'
- #WMII_FOCUSCOLORS='#000000 #FFFFFF #666666'
- #WMII_FONT='-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*'
- set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
- WMII_MENU="dmenu -b -fn '$WMII_FONT' -nf '$1' -nb '$2' -sf '$4' -sb '$5'"
- WMII_9MENU="wmii9menu -font '$WMII_FONT' -nf '$1' -nb '$2' -sf '$4' -sb '$5' -br '$6'"
- ########################## PROGRAMS TO USE ##########################
- ###### Set what program should wmii open as a terminal ######
- WMII_TERM="urxvt"
- ###### Set what argument could you pass to the terminal so it runs a specific command ######
- WMII_TERM_EXECARGS="-e" # most terminals use -e command;
- ###### Set what program should wmii open as a web browser ######
- WMII_WBROWSER="firefox"
- ###### Set what program should wmii open as a file browser ######
- WMII_FBROWSER="thunar"
- ###### Set what program should wmii open as a text editor ######
- WMII_TXTEDITOR="gedit"
- # Path to your favorite wallpaper.
- WMII_WALLPAPER="/home/thetrojan01/Pictures/Wallpapers/GoldenSun.jpg"
- xsetroot -solid "$WMII_BACKGROUND" &
- feh --bg-scale $WMII_WALLPAPER &
- xcompmgr &
- #xcompmgr -cCfF -D7 -t -9 -l -9 -r7 -O 0.02 -I 0.040 &
- #xcompmgr -cC -t -9 -l -9 -r7 &
- #xcompmgr -fF -D7 -I 0.040 -O 0.1 &
- # Column Rules
- wmiir write /colrules <<!
- /.*/ -> 100
- !
- # Tagging Rules
- wmiir write /tagrules <<!
- /.feh*/ -> ~
- /.Gimp*/ -> ~
- /.Eog*/ -> ~
- /.alsamixer*/ -> ~
- /.Calculator*/ -> ~
- /.Xfce4*/ -> ~
- /.xawtv*/ -> ~
- /.aMSN*/ -> ~
- /.tvtime*/-> ~
- /.*/ -> sel
- /.*/ -> 1
- !
- #BEGIN ArchGh0ul status
- #MAXVOLUME=`amixer -c0 get Master | awk '/^ Limits/ { print $5 }'`
- #GETVOLUME="`(amixer -c0 get Master | grep 'Mono: Playback') | awk '/^ / {print $3}'; echo " $MAXVOLUME"`"
- #STATUSFILE="~/.wmii-3.5/status"
- status(){
- #------------- FOR LAPTOPS------------#
- #REM=`grep 'remaining capacity' /proc/acpi/battery/BAT0/state | awk '{print $3}'`
- #LAST=`grep 'last full' /proc/acpi/battery/BAT0/info |awk '{print $4}'`
- #ADAPTERSTATUS=`cat /proc/acpi/ac_adapter/AC0/state | grep 'state' | awk '{ print $2 }'`
- #if [ $ADAPTERSTATUS = "on-line" ]
- #then
- # BATCURRENT=$(echo $REM $LAST | awk '{printf "%d%%", ($1/$2)*100'})
- # POWERLINE=$(echo "AC: $BATCURRENT")
- #else
- # PRESENT=`grep 'present rate' /proc/acpi/battery/BAT0/state | awk '{print $3}'`
- # BATCURRENT=$(echo $REM $LAST $PRESENT | awk '{printf "%d", ($1/$2)*100}')
- # BATLEFT=$(echo $REM $LAST $PRESENT | awk '{printf "%d", ($1/$3)*60}')
- # if [ $BATCURRENT -ge 40 ]
- # then
- # POWERLINE=$(echo "Battery: $BATCURRENT%")
- # fi
- # if [ $BATCURRENT -le 39 ]
- # then
- # if [ $BATCURRENT -ge 20 ]
- # then
- # POWERLINE=$(echo "Battery: $BATCURRENT%")
- # fi
- # fi
- # if [ $BATCURRENT -le 19 ]
- # then
- # POWERLINE=$(echo "Battery: $BATCURRENT%")
- # fi
- #fi
- #-----------------------CPU TEMPERATURE--------------------#
- #TEMPERATURE=`cat /proc/acpi/thermal_zone/THRM/temperature | grep 'temperature' | awk '{ printf "%d", $2 }'`
- #if [ $TEMPERATURE -le 64 ]
- #then
- # TEMPERATURELINE=$(echo "Cpu0 Temp: $TEMPERATURE C")
- #fi
- #
- #if [ $TEMPERATURE -ge 65 ]
- #then
- # if [ $TEMPERATURE -le 74 ]
- # then
- # TEMPERATURELINE=$(echo "Cpu0 Temp: $TEMPERATURE C")
- # fi
- #fi
- #
- #if [ $TEMPERATURE -ge 75 ]
- #then
- # TEMPERATURELINE=$(echo "Cpu0 Temp: $TEMPERATURE C")
- #fi
- #-------------------VOLUME-------------#
- #VOLUMELINE=$(echo "Volume: "`eval "$GETVOLUME" | awk '{ printf "%d", ($1 / $2) * 100 }'` "%"; )
- MAXVOLUME=`amixer -c0 get Master | awk '/^ Limits/ { print $5 }'`
- GETVOLUME="`(amixer -c0 get Master | grep 'Mono: Playback') | awk '/^ / {print $3}'; echo " $MAXVOLUME"`"
- VOLUMELINE=$(echo "Volume: " $GETVOLUME | awk '{ printf("%s %d %c"), $1, $2 / $3 * 100,"%" }')
- DATELINE=$(echo "`date +%d-%B-%Y` `date +%H:%M:%S` ")
- #-------------WIFI LINE----------#
- # Change wlan0 to your wifi interface.
- WIFILINE=`echo -n ' wlan0:' $(iwconfig wlan0 | sed 's/ /\n/g' | grep Quality)`
- #--------------------STATUS----------------------#
- #STATUSLINE=`eval $STATUSFILE`
- echo -n " $WIFILINE | $VOLUMELINE | $DATELINE "
- }
- #END ArchGh0ul status
- mytags=("nop" "main" "terminal" "web" "IM" "dev" "media" "7" "8" "9")
- # beginners: don't touch anything but keys press events.
- # Event processing
- # Processed later by `wmiiloop' and evaled.
- # Duplicate the eval line and replace 'eval' with 'echo' for details.
- eventstuff() {
- cat <<'!'
- # Events
- Event Start
- case "$1" in
- wmiirc)
- exit;
- esac
- Event Key
- fn=$(echo "$@" | sed 's/[^a-zA-Z_0-9]/_/g')
- Key_$fn "$@"
- Event CreateTag
- echo "$WMII_NORMCOLORS" ${mytags[$@]} | wmiir create "/lbar/$@"
- #Event DestroyTag
- #wmiir remove "/lbar/$@"
- Event FocusTag
- wmiir xwrite "/lbar/$@" "$WMII_FOCUSCOLORS" ${mytags[$@]}
- Event UnfocusTag
- wmiir xwrite "/lbar/$@" "$WMII_NORMCOLORS" ${mytags[$@]}
- Event UrgentTag
- shift
- echo "$WMII_URGENTCOLORS" ${mytags[$@]} | wmiir create "/lbar/$@"
- urgtag=$@
- Event NotUrgentTag
- shift
- #wmiir xwrite "/lbar/$@" "$@"
- wmiir xwrite "/lbar/$@" ${mytags[$@]}
- echo "$WMII_NORMCOLORS" " " | wmiir create "/lbar/notification"
- urgtag="0"
- Event LeftBarClick
- shift
- wmiir xwrite /ctl view "$@"
- # Actions
- Action quit
- wmiir xwrite /ctl quit
- Action exec
- wmiir xwrite /ctl exec "$@"
- Action rehash
- proglist $PATH >$progsfile
- Action status
- set +xv
- if wmiir remove /rbar/status 2>/dev/null; then
- sleep 2
- fi
- echo "$WMII_NORMCOLORS" | wmiir create /rbar/status
- while status | wmiir write /rbar/status; do
- sleep 1
- done
- Event ClientMouseDown
- client=$1; button=$2
- case "$button" in
- 3)
- do=$(eval $WMII_9MENU -initial "${menulast:-SomeRandomName}" Nop Delete Fullscreen)
- case "$do" in
- Delete)
- wmiir xwrite /client/$client/ctl kill;;
- Fullscreen)
- wmiir xwrite /client/$client/ctl Fullscreen on;;
- esac
- menulast=${do:-"$menulast"}
- esac
- ################ Key Bindings ################
- Key $MODKEY-Control-t
- case $(wmiir read /keys | wc -l | tr -d ' \t\n') in
- 0|1)
- echo -n $Keys | tr ' ' '\012' | wmiir write /keys
- wmiir xwrite /ctl grabmod $MODKEY;;
- *)
- wmiir xwrite /keys $MODKEY-Control-t
- wmiir xwrite /ctl grabmod Mod3;;
- esac
- Key $MODKEY-space
- wmiir xwrite /tag/sel/ctl select toggle
- Key $MODKEY-d
- wmiir xwrite /tag/sel/ctl colmode sel default
- Key $MODKEY-s
- wmiir xwrite /tag/sel/ctl colmode sel stack
- Key $MODKEY-m
- wmiir xwrite /tag/sel/ctl colmode sel max
- Key $MODKEY-a
- Action $(actionlist | eval $WMII_MENU) &
- Key $MODKEY-p
- sh -c $(eval "dmenu_path | $WMII_MENU") &
- #Key $MODKEY-t
- #wmiir xwrite /ctl "view $(tagsmenu)" &
- Key $MODKEY-Shift-Return
- eval $WMII_TERM &
- Key $MODKEY-Shift-space
- wmiir xwrite /tag/sel/ctl send sel toggle
- Key $MODKEY-f
- wmiir xwrite /client/sel/ctl Fullscreen toggle
- Key $MODKEY-Shift-c
- wmiir xwrite /client/sel/ctl kill
- Key $MODKEY-Shift-t
- wmiir xwrite "/client/$(wmiir read /client/sel/ctl)/tags" "$(tagsmenu)" &
- Key $MODKEY-$LEFT
- wmiir xwrite /tag/sel/ctl select left
- Key $MODKEY-$RIGHT
- wmiir xwrite /tag/sel/ctl select right
- Key $MODKEY-$DOWN
- wmiir xwrite /tag/sel/ctl select down
- Key $MODKEY-$UP
- wmiir xwrite /tag/sel/ctl select up
- Key $MODKEY-Shift-$LEFT
- wmiir xwrite /tag/sel/ctl send sel left
- Key $MODKEY-Shift-$RIGHT
- wmiir xwrite /tag/sel/ctl send sel right
- Key $MODKEY-Shift-$DOWN
- wmiir xwrite /tag/sel/ctl send sel down
- Key $MODKEY-Shift-$UP
- wmiir xwrite /tag/sel/ctl send sel up
- Key $MODKEY-Shift-v
- eval "$WMII_TERM $WMII_TERM_EXECARGS alsamixer" &
- Key $MODKEY-Shift-e
- eval "$WMII_FBROWSER ~/" &
- Key $MODKEY-Shift-w
- eval "$WMII_WBROWSER ~/" &
- Key $MODKEY-Shift-Control-c
- eval "$WMII_TXTEDITOR ~/.wmii-3.5/wmiirc" &
- !
- for i in 1 2 3 4 5 6 7 8 9; do
- cat <<!
- Key $MODKEY-$i
- wmiir xwrite /ctl view "$i"
- Key $MODKEY-Shift-$i
- wmiir xwrite /client/sel/tags "$i"
- !
- done
- }
- # WM Configuration
- wmiir write /ctl << EOF
- font $WMII_FONT
- focuscolors $WMII_FOCUSCOLORS
- normcolors $WMII_NORMCOLORS
- grabmod $MODKEY
- border 1
- EOF
- export WMII_MENU WMII_9MENU WMII_FONT WMII_TERM
- export WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS
- # Feed events to `wmiiloop' for processing
- eval "$(eventstuff | sed 's/^[ ]//' | { . wmiiloop; })"
- echo "$Keys" | tr ' ' '\n' | wmiir write /keys
- # Functions
- Action() {
- action=$1; shift
- if [ -n "$action" ]; then
- Action_$action "$@" \
- || conf_which $action "$@"
- fi
- }
- proglist() {
- paths=$(echo "$@" | sed 'y/:/ /')
- ls -lL $paths 2>/dev/null \
- | awk '$1 ~ /^[^d].*x/ && NF > 2 { print $NF }' \
- | sort | uniq
- }
- # Misc
- progsfile="$WMII_NS_DIR/.proglist"
- Action status &
- proglist $PATH >$progsfile &
- # Setup Tag Bar
- #seltag="$(wmiir read /tag/sel/ctl 2>/dev/null)"
- wmiir ls /lbar |
- while read bar; do
- wmiir remove "/lbar/$bar"
- done
- for i in 1 2 3 4 5 6 7 8 9; do
- echo "$WMII_NORMCOLORS" ${mytags[$i]} | wmiir create "/lbar/$i"
- done
- #Autoselect first tag
- echo "$WMII_FOCUSCOLORS ${mytags[1]}" | wmiir create "/lbar/1"
- seltag="$(wmiir read /tag/sel/ctl 2>/dev/null)"
- wmiir ls /tag | sed -e 's|/||; /^sel$/d' |
- while read tag; do
- if [ "X$tag" = "X$seltag" ]; then
- echo "$WMII_FOCUSCOLORS ${mytags[$tag]} | wmiir create "/lbar/$tag"
- else
- echo "$WMII_NORMCOLORS ${mytags[$tag]} | wmiir create "/lbar/$tag"
- fi
- done
- # More functions
- tagsmenu() {
- wmiir ls /tag | sed 's|/||; /^sel$/d' | eval $WMII_MENU
- }
- actionlist() {
- { proglist $WMII_CONFPATH
- echo -n $Actions | tr ' ' '\012'
- } | sort | uniq
- }
- conf_which() {
- which=$(which which)
- prog=$(PATH="$WMII_CONFPATH" $which $1); shift
- [ -n "$prog" ] && $prog "$@"
- }
- # Stop any running instances of wmiirc
- echo Start wmiirc | wmiir write /event || exit 1
- #ArchGh0ul transparent bar hack
- if [ $WMII_TRANSPARENT_BAR = "yes" ]
- then
- # What to put after grep? Just run xwininfo and click on the wmii bar. Then after the + character put the dimension of left (?) corner #
- BARLINE=`xwininfo -root -all | grep 1360x15+0+753`
- BARID=`echo $BARLINE | awk '{print $1}' `
- transset-df --id $BARID $WMII_BAR_OPACITY
- else
- BARLINE=`xwininfo -root -all | grep 1360x15+0+753`
- BARID=`echo $BARLINE | awk '{print $1}' `
- transset-df --id $BARID 1
- fi
- #Hack done
- wmiir read /event |
- while read event; do
- set -- $event
- event=$1; shift
- Event_$event $@
- done 2>/dev/null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement