Commits

OJ Reeves committed 8cfb189

Added xmonad, xmobar and updated bash.

  • Participants
  • Parent commits 6b8a37f

Comments (0)

Files changed (4)

+# .bashrc
+
+# Source global definitions
+if [ -f /etc/bashrc ]; then
+	. /etc/bashrc
+fi
+
+# User specific aliases and functions
 # bash completion for rebar
 
 _rebar()
 # End:
 # ex: ts=4 sw=4 et filetype=sh
 
-hg_ps3() {
-  hg prompt " {root|basename}{/{branch}}{ at {bookmark}}{status}" 2> /dev/null
-}
-
-hg_ps2() {
-  hg prompt " {branch}{ at {bookmark}}{status}" 2> /dev/null
-}
-
 hg_ps1() {
     hg prompt "{hg: {branch}}{ {status}}" 2> /dev/null | sed -e "s/\(.*\)/\n\1/"
 }
 
-parse_git_dirty() {
-  [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
-}
-
-git_ps1() {
-  git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ (git) \1$(parse_git_dirty)/"
-}
-
-# GIT_PS1_SHOWDIRTYSTATE=true
-
-if [ -f /home/oj/.git-completion.bash ]; then
-  . /home/oj/.git-completion.bash
-fi
-
-# export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\]$(hg_ps2)$(__git_ps1)\n \w \$\[\033[00m\] '
-
-
-# if [ -d ~/bin ] ; then
-  # PATH=~/bin:"${PATH}"
-# fi
-
 function parse_git_dirty {
   [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " *"
 }
   git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\ngit: \1$(parse_git_dirty)/"
 }
 
-export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w$(parse_git_branch)$(hg_ps1) \$\[\033[00m\] '
+export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;37m\]\u@\h\[\033[00m\]\[\033[00;35m\] \w$(parse_git_branch)$(hg_ps1) \$\[\033[00m\] '
 
-alias untar='tar -xzf'
+# ALIASES
+
+source ~/bin/git-completion.bash
+source ~/.git-flow-completion.sh
+
+export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
+
+# path stuff
+PATH=~/bin:/var/lib/gems/1.8/bin:$PATH
+export PATH
+
+/usr/bin/keychain -Q -q $HOME/.ssh/id_rsa < /dev/null
+[ -f $HOME/.keychain/$HOSTNAME-sh ] && source $HOME/.keychain/$HOSTNAME-sh
+
+Config { font = "-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*"
+       , bgColor = "black"
+       , fgColor = "grey"
+       , position = TopW L 90
+       , lowerOnStart = True
+       , commands = [ Run Weather "YBBN" ["-t","<tempC>C","-L","20","-H","30","--normal","green","--high","red","--low","lightblue"] 36000
+                    , Run Network "wlan0" ["-L","0","-H","32","--normal","green","--high","red"] 10
+                    , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
+                    , Run Memory ["-t","Mem: <usedratio>%"] 10
+                    , Run Swap [] 10
+                    , Run StdinReader
+                    , Run Com "uname" ["-s","-r"] "" 36000
+                    , Run Date "%a %b %_d %H:%M:%S" "date" 10
+                    ]
+       , sepChar = "%"
+       , alignSep = "}{"
+       , template = "%StdinReader% } %cpu% | %memory% * %swap% | %wlan0% { <fc=#ee9a00>%date%</fc> | %YBBN% | %uname%"
+       }
+import Data.Monoid (All (All))
+import Monad
+import System.IO
+import XMonad
+--import XMonad.Actions.Volume
+import XMonad.Config.Desktop
+import XMonad.Hooks.DynamicLog
+import XMonad.Hooks.EwmhDesktops
+import XMonad.Hooks.ManageDocks
+import XMonad.Hooks.ManageHelpers
+import XMonad.Layout.Maximize
+import XMonad.Util.EZConfig (additionalKeys)
+import XMonad.Util.Run (spawnPipe)
+import qualified Data.Map as M
+import qualified XMonad.StackSet as W
+
+myTerminal = "exo-open --launch TerminalEmulator"
+
+myManageHook = composeAll
+    [ className =? "MPlayer" --> doFloat
+    , className =? "Gimp" --> doFloat
+    ]
+
+myFocusedBorderColour = "#FF6600"
+myBorderWidth = 3
+
+main = do
+      xmproc <- spawnPipe "xmobar"
+      xmonad $ defaultConfig
+                { modMask = mod4Mask
+                , terminal = myTerminal
+                , focusedBorderColor = myFocusedBorderColour
+                --, manageHook = manageDocks <+> myManageHook
+                , manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig
+                --, layoutHook = ewmhDesktopsLayout $ avoidStruts $ myLayout
+                , handleEventHook = fullscreenEventHook
+                , layoutHook = avoidStruts $ layoutHook defaultConfig
+                , logHook = dynamicLogWithPP xmobarPP
+                            { ppOutput = hPutStrLn xmproc
+                            , ppHiddenNoWindows = xmobarColor "grey" ""
+                            , ppTitle = xmobarColor "green" "" . shorten 85
+                            }
+                , borderWidth = myBorderWidth
+                } `additionalKeys`
+                [ ((mod4Mask, xK_r), spawn "exe=`dmenu_path | dmenu -b` && eval \"exec $exe\"")
+                , ((mod4Mask .|. shiftMask, xK_l), spawn "xscreensaver-command -lock")
+                , ((mod4Mask, xK_F11), spawn "sudo shutdown -r now")
+                , ((mod4Mask, xK_F12), spawn "sudo shutdown -h now")
+
+                --, ((mod4Mask, xK_Down), setMute False >> lowerVolume 4 >> return ())
+                --, ((mod4Mask, xK_Up), setMute False >> raiseVolume 4 >> return ())
+                --, ((mod4Mask, xK_m), toggleMute >> return ())
+
+
+                --, ((0, 0x1008ff11), spawn "amixer -q set Master unmute & amixer -q set LFE unmute & amixer -q set PCM 7%-")
+                --, ((0, 0x1008ff13), spawn "amixer -q set Master unmute & amixer -q set LFE unmute & amixer -q set PCM 7%+")
+                --, ((0, 0x1008ff12), spawn "amixer -q set Master toggle & amixer -q set LFE toggle")
+
+                -- ncmpcpp (mpd) controls
+                --, ((mod4Mask .|. controlMask, xK_o), spawn "ncmpcpp toggle")
+                --, ((mod4Mask .|. controlMask, xK_h), spawn "ncmpcpp stop; ncmpcpp play") -- "reset" current song to beginning
+                --, ((mod4Mask .|. controlMask, xK_j), spawn "ncmpcpp next")
+                --, ((mod4Mask .|. controlMask, xK_k), spawn "ncmpcpp prev")
+                --, ((mod4Mask .|. controlMask, xK_l), spawn "ncmpcpp stop")
+                --, ((mod4Mask .|. controlMask, xK_semicolon), spawn "ncmpcpp play")
+                -- volume controls
+                --, ((modm, xK_backslash), spawn "amixer -q set Master toggle")
+                --, ((modm, xK_minus), spawn "amixer -q set Master 3- unmute")
+                --, ((modm, xK_equal), spawn "amixer -q set Master 3+ unmute")
+                -- screen brightness (call the script “~/syscfg/shellscripts/sys/brightness.sh”, which is symlinked to /usr/bin/brightness to toggle screen brightness — entry for this in “sudo visudo” allows us to do it as sudo w/o password prompt)
+                --, ((modm     .|. shiftMask, xK_backslash ), spawn “sudo brightness”) — toggle brightness (100 or 0)
+
+                ]
+
+-- Helper functions to fullscreen the window
+fullFloat, tileWin :: Window -> X ()
+fullFloat w = windows $ W.float w r
+    where r = W.RationalRect 0 0 1 1
+
+tileWin w = windows $ W.sink w
+
+fullscreenEventHook :: Event -> X All
+fullscreenEventHook (ClientMessageEvent _ _ _ dpy win typ dat) = do
+  state <- getAtom "_NET_WM_STATE"
+  fullsc <- getAtom "_NET_WM_STATE_FULLSCREEN"
+  isFull <- runQuery isFullscreen win
+
+  -- Constants for the _NET_WM_STATE protocol
+  let remove = 0
+      add = 1
+      toggle = 2
+
+      -- The ATOM property type for changeProperty
+      ptype = 4 
+
+      action = head dat
+
+  when (typ == state && (fromIntegral fullsc) `elem` tail dat) $ do
+    when (action == add || (action == toggle && not isFull)) $ do
+         io $ changeProperty32 dpy win state ptype propModeReplace [fromIntegral fullsc]
+         fullFloat win
+    when (head dat == remove || (action == toggle && isFull)) $ do
+         io $ changeProperty32 dpy win state ptype propModeReplace []
+         tileWin win
+
+  -- It shouldn't be necessary for xmonad to do anything more with this event
+  return $ All False
+
+fullscreenEventHook _ = return $ All True
+
+#!/bin/bash
+
+trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --transparent true --tint 0x000000 --alpha 0 --width 10 --height 7 &
+
+#xscreensaver -no-splash &
+
+nm-applet --sm-disable &
+
+exec xmonad.start
+