dotfiles

My configuration files
git clone git://git.finwo.net/misc/dotfiles
Log | Files | Refs

.xinitrc (1658B)


      1 #!/bin/sh
      2 [ -z "$BASH_VERSION" ] && exec bash $0
      3 
      4 # Make the cursor disappear when typing
      5 if command -v xbanish &>/dev/null; then
      6   xbanish &
      7 fi
      8 
      9 # Add compositing support
     10 if command -v xcompmgr &>/dev/null; then
     11   xcompmgr &
     12 fi
     13 
     14 # Custom key bindings
     15 if command -v xbindkeys &>/dev/null; then
     16   xbindkeys
     17 fi
     18 
     19 # Xresources
     20 if command -v xrdb &>/dev/null && [ -f ~/.Xresources ]; then
     21   xrdb ~/.Xresources
     22 fi
     23 
     24 # Wallpaper
     25 if command -v feh &>/dev/null; then
     26   [ -f ~/pictures/wallpaper.png ] && feh --bg-fill ~/pictures/wallpaper.png
     27   while sleep 10; do
     28     [ -f ~/pictures/wallpaper.png ] && feh --bg-fill ~/pictures/wallpaper.png
     29   done &
     30 fi
     31 
     32 # Make repeating keys faster
     33 if command -v xset &>/dev/null; then
     34   while sleep 10; do
     35     xset r rate 200 40
     36   done &
     37 fi
     38 
     39 while sleep 1; do
     40   XROOT=$(date +"%Y-%m-%d %H:%M")
     41 
     42   # Battery status
     43   if [ -d /sys/class/power_supply/BAT0 ]; then
     44     case "$(cat /sys/class/power_supply/AC0/online)" in
     45       0)
     46         for cpu in `seq 0 11`; do
     47           echo "powersave" | tee /sys/devices/system/cpu/cpu$cpu/cpufreq/scaling_governor
     48         done &
     49         BATICO=""
     50         BATLEN="${#BATICO}"
     51         INDEX=$(( $(cat /sys/class/power_supply/BAT0/energy_now) * ${BATLEN} / $(cat /sys/class/power_supply/BAT0/energy_full) ))
     52         XROOT="${XROOT} ${BATICO:${INDEX}:1}"
     53         ;;
     54       1)
     55         for cpu in `seq 0 11`; do
     56           echo "performance" | tee /sys/devices/system/cpu/cpu$cpu/cpufreq/scaling_governor
     57         done &
     58         XROOT="${XROOT} "
     59         ;;
     60     esac
     61   fi
     62 
     63   # Set title
     64   xsetroot -name "${XROOT}"
     65 
     66 done &
     67 
     68 # window manager
     69 while sleep 1; do dwm; done