読者です 読者をやめる 読者になる 読者になる

or1ko's diary

日々を書きます

xmonad + kde4にしてみた.

xmonad

とりあえず,出来上がりのスクリーンショット
f:id:mono-hate:20090125183316p:image:w300

感想

  • 見た目がかっこよくなった
  • 起動がGnomeより速い気がする
  • ぶっちゃけ,xmonadのせいか,あまり感動できなかった.orz やっぱ,KWin使わないとだめだろぉ

不満点

  • やっぱりJavaGUIプログラムが動かない(これが原因らしい.一応,ここの対処は試したけれどダメだった)
  • Katapultがうまく動かない
  • Plagmaのダッシュボードが正常に動作してない

環境
Debian unstable

やったこと

  1. kde4のインストール
  2. xmonad + kde4にするための設定
  3. kd4を設定


以下,各項目の詳細

1.kde4のインストール

sudo aptitude install -t experimental kdebase-runtime kdebase-workspace kdebase kdeplasma-addons kdemultimedia
    1. 上記のパッケージを最新に保つために,APT Pinningの設定
      1. /etc/apt/preferencesに以下のコードを入力
Package: *
Pin: release a=experimental
Pin-Priority: 101

2.xmonad + kde4にするための設定

$ mkdir -p ~/.kde4/env
$ echo KDEWM=$(which xmonad) > ~/.kde4/env/set_window_manager.sh
import Data.Ratio
import System.Exit

import XMonad
import XMonad.Actions.CopyWindow
import XMonad.Actions.CycleWS
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
import XMonad.Layout.Circle
import XMonad.Layout.Grid
import XMonad.Layout.LayoutHints
import XMonad.Layout.Magnifier
import XMonad.Layout.ThreeColumns
import XMonad.Util.CustomKeys
import XMonad.Util.EZConfig
 
import qualified Data.Map        as M
import qualified XMonad.StackSet as W

myModMask       = mod1Mask -- left Alt-key
myNumlockMask   = mod2Mask

--myTerminal      = "gnome-terminal"
myTerminal      = "konsole"
myWorkspaces    = map show [1..8] ++ ["vm"]

myBorderWidth   = 2
myNormalBorderColor  = "#dddddd"
myFocusedBorderColor = "#ff0000"

myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
    , ((modMask .|. shiftMask, xK_c     ), kill)
    , ((modMask,               xK_space ), sendMessage NextLayout)
    , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
    , ((modMask,               xK_n     ), refresh)
    , ((modMask,               xK_Tab   ), windows W.focusDown)
    , ((modMask,               xK_j     ), windows W.focusDown)
    , ((modMask,               xK_k     ), windows W.focusUp  )
    , ((modMask,               xK_m     ), windows W.focusMaster  )
    , ((modMask,               xK_Return), windows W.swapMaster)
    , ((modMask .|. shiftMask, xK_j     ), windows W.swapDown  )
    , ((modMask .|. shiftMask, xK_k     ), windows W.swapUp    )
    , ((modMask,               xK_h     ), sendMessage Shrink)
    , ((modMask,               xK_l     ), sendMessage Expand)
    , ((modMask,               xK_t     ), withFocused $ windows . W.sink)
    , ((modMask              , xK_comma ), sendMessage (IncMasterN 1))
    , ((modMask              , xK_period), sendMessage (IncMasterN (-1)))
    , ((modMask .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
    , ((modMask              , xK_q     ), restart "xmonad" True)
    , ((0, xK_Print), spawn "xwd -root -silent -out ~/Desktop/screenshot-$(date +%Y-%m%d-%H%M).png")
    , ((shiftMask, xK_Print), spawn "xwd -silent -out ~/Desktop/windowshot-$(date +%Y-%m%d-%H%M).png")
    ]

--    [((m .|. modMask, k), windows $ f i)
--        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
--        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

myKeysP :: [([Char], X ())]
myKeysP = [("M-S-c", kill1)]
          ++ [("M" ++ m ++ ('-':k:[]) , windows $ f i)
              | (i, k) <- zip myWorkspaces ['1'..'9']
              , (f, m) <- [(W.view, ""), (W.shift, "-S"), (copy, "-C-S")]]
          ++ [
          ("M-<Left>",    prevWS )
          , ("M-<Right>",   nextWS )
          , ("M-S-<Left>",  shiftToPrev )
          , ("M-S-<Right>", shiftToNext )
--          , ("M-S-q", spawn "gnome-session-save --gui --kill") 
          , ("M-S-l", spawn "gnome-screensaver-command -l")
          ] 
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
    [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
    , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
    , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
    ]

myLayoutHook = ewmhDesktopsLayout $ avoidStruts
  ( tiled 
  ||| Mirror tiled
  ||| ThreeCol 1 (3/100) (1/2)
  ||| Grid 
  ||| Full
  )
  where
    tiled = Tall nmaster delta ratio
    nmaster = 1
    delta = 3/100
    ratio = 1/2
    magnify = magnifiercz (12%10)

myManageHook = composeAll . concat $ 
      [ [manageDocks]
      , [manageHook defaultConfig]
      , [ className =? c --> doFloat | c <- myFloats]
      , [ resource  =? c --> doIgnore | c <- myIgnores]
      , [className  =? "Vmware-server-console" --> doF (W.shift "vm")]
      ]
  where
    myFloats = ["Do", "MPlayer", "Gimp-2.4", "Inkscape", "クイック検索ボックス", "Plasma", "katapult"]
    myIgnores = ["desktop_window", "kdesktop"]

myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True

myLogHook = ewmhDesktopsLogHook

myStartupHook :: X ()
myStartupHook = setWMName "LG3D" -- do nothing ...

main = xmonad defaults

defaults = defaultConfig {
        terminal           = myTerminal,
        focusFollowsMouse  = myFocusFollowsMouse,
        borderWidth        = myBorderWidth,
        modMask            = myModMask,
        numlockMask        = myNumlockMask,
        workspaces         = myWorkspaces,
        normalBorderColor  = myNormalBorderColor,
        focusedBorderColor = myFocusedBorderColor,
        keys               = myKeys,
        mouseBindings      = myMouseBindings,
        layoutHook         = myLayoutHook,
        manageHook         = myManageHook,
        logHook            = myLogHook,
        startupHook        = myStartupHook
    } 
    `additionalKeysP` myKeysP

3.kd4を設定

    • GUIを適当に試した
    • StartUpプログラムの追加.GUIからの設定が分からなかったので,調べたところ,~/.kde4/Autostart以下にStartUpさせたいプログラムのシンボリックリンクを配置すれば良いとのこと

以上.