Slackware Setup and Customization Tips

Local packages

For packages that are compiled from source, I usually put them under /usr/local/packages/, and sym-links compiled results to upper-level /usr/local/ sub-directories. I use two scripts to do this.

MKLINK <name> makes all the links from /usr/local/packages/<name> to /usr/local/.

#!/bin/sh
if [ "$1" = "" ]
then
  name=`basename $PWD`
else
  name=$1
fi
echo $name
cd /usr/local/packages/$name
find bin sbin include lib man -type d -exec \
  mkdir -p "/usr/local/{}" \;
find bin sbin include lib man -not -type d -exec \
  ln -s "/usr/local/packages/$name/{}" "/usr/local/{}" \;
cd -

KMLINK <name> removes all links made by MKLINK. It needs /usr/local/packages/<name> to exists prior to such removal.

#!/bin/sh
cd /usr/local/packages/$1
find bin sbin include lib man -not -type d -exec \
  rm -f /usr/local/{} \;
cd -

Browser fonts

GNU Free Font is a set of nice fonts I use for browsers. Simply copy the TTF to the $HOME/.fonts/ directory, and run fc-cache -r will load them.

For Chinese font, I use a slightly shrinked version of Microsoft Yahei.

URxvt

I customize URxvt in ~/.Xdefaults with the following settings. It uses DejaVu Sans Mono for Latin, and Microsoft Yahei for Chinese. and allows 3 font sizes controlled by CTRL and -, 0, and +.

URxvt.font: xft:DejaVu Sans Mono:pixelsize=13,xft:Microsoft Yahei
URxvt.keysym.C-minus: command:\033]710;xft:DejaVu Sans Mono:pixelsize=10,xft:Microsoft Yahei\007
URxvt.keysym.C-0: command:\033]710;xft:DejaVu Sans Mono:pixelsize=13,xft:Microsoft Yahei\007
URxvt.keysym.C-equal: command:\033]710;xft:DejaVu Sans Mono:pixelsize=16,xft:Microsoft Yahei\007
Rxvt.color12: LightSkyBlue2
URxvt.color4: SkyBlue3
URxvt.background: Black
URxvt.foreground: light gray
URxvt.jumpScroll: True
URxvt.scrollBar: False

Xmonad and Xmobar

Here is a patch generated by diff ~/.cabal/share/xmonad-0.9/man/xmonad.hs ~/.xmonad/xmonad.hs.

16a17,24
> import XMonad.Hooks.DynamicLog
> import XMonad.Hooks.ManageDocks
> import XMonad.Layout.LayoutModifier
> import System.IO
> import XMonad.Util.Run
> import XMonad.Prompt
> import XMonad.Prompt.Shell
> 
20c28
< myTerminal      = "xterm"
---
> myTerminal      = "urxvt.sh"
65c73
< myNormalBorderColor  = "#dddddd"
---
> myNormalBorderColor  = "#222222"
77c85
<     , ((modm,               xK_p     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
---
>     , ((modm,               xK_p     ), shellPrompt myXPConfig)
116c124
<     , ((modm,               xK_h     ), sendMessage Shrink)
---
>     , ((modm,               xK_s     ), sendMessage Shrink)
119c127
<     , ((modm,               xK_l     ), sendMessage Expand)
---
>     , ((modm,               xK_g     ), sendMessage Expand)
134c142
<     -- , ((modm              , xK_b     ), sendMessage ToggleStruts)
---
>     , ((modm .|. shiftMask, xK_b     ), sendMessage ToggleStruts)
192c200
< myLayout = tiled ||| Mirror tiled ||| Full
---
> myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full)
220a229,233
> --myManageHook = composeAll
> --    [ className =? "MPlayer"        --> doFloat
> --    , className =? "Gimp"           --> doFloat
> --    , resource  =? "desktop_window" --> doIgnore
> --    , resource  =? "kdesktop"       --> doIgnore ]
224,225c237,245
<     , resource  =? "desktop_window" --> doIgnore
<     , resource  =? "kdesktop"       --> doIgnore ]
---
>     , className =? ""               --> doFloat
>     , className =? "sun-awt-X11-XFramePeer" --> doFloat
>     , title     =? "Lambda Animator" --> doFloat
>     , title     =? "Virtual Keyboard ver.1.9 [129:0]" --> doFloat
>     , resource  =? "xfdesktop2"     --> doFloat
>     , resource  =? "Desktop"        --> doFloat
>     , title     =? "KPowersave"     --> doIgnore
>     , resource  =? "kdesktop"       --> doIgnore ] <+> manageDocks
> 
248c268,269
< myLogHook = return ()
---
> myLogHook h = dynamicLogWithPP $ defaultPP { ppOutput = hPutStrLn h } 
> 
265c286
< main = xmonad defaults
---
> main = spawnPipe "xmobar" >>= xmonad . defaults
273c294
< defaults = defaultConfig {
---
> defaults h = defaultConfig {
292c313
<         logHook            = myLogHook,
---
>         logHook            = myLogHook h,
294a316,318
> 
> myXPConfig = defaultXPConfig
> 

I use Xmobar for the topbar. Here is my ~/.xmobarrc. Change the weather station ID KHVN (obtained from http://weather.noaa.gov) if you are in a different city than New Haven.

Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "grey"
       , position = Top
       , lowerOnStart = True
       , commands = [ Run StdinReader
                    , Run Weather "KHVN" ["-t","New Haven: <tempC>C/<tempF>F","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000
                    , Run BatteryP ["BAT1"] [] 20
                    , Run Network "wlan0" ["-L","0","-H","32","--normal","green","--high","red"] 10
                    , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
            , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%StdinReader% }{ %cpu% | %KHVN% | %battery% | %wlan0% | <fc=#ee9a00>%date%</fc>"
       }

Caps-Lock and Ctrl

The following maps Caps-Lock key to Ctrl key. Usually I put it in /etc/rc.d/rc.local.

/usr/bin/setkeycodes 3a 29

Custom .xsession

Here is my ~/.xsession. It starts SCIM for Chinese input, and autocutsel to sync clipboard and cutbuffer in X, although it doesn’t handle UTF–8 very well.

export XMODIFIERS=@im=SCIM 
export LC_CTYPE=zh_CN.utf8 
scim -d
autocutsel -selection PRIMARY -fork
autocutsel -s CLIPBOARD -fork
PATH=/usr/local/packages/ghc-6.10.4/bin:$PATH exec xmonad

Custom .vimrc

Here is my ~/.vimrc. The last line forces Vim to relinquish mouse selection back to X.

set shiftwidth=2
set shiftround
set softtabstop=2
set expandtab
set mouse=i

Google Chrome

For Slackware 13.1, Slackbuild supports latest Google Chrome, which in turn requires GConf and ORBit2 to be installed first.




Comments powered by Disqus