-- default desktop configuration for Fedora
import System.Posix.Env (getEnv)
import Data.Maybe (maybe)
import XMonad
import XMonad.Config.Desktop
import XMonad.Config.Gnome
import XMonad.Config.Kde
import XMonad.Config.Xfce
main = do
session <- getEnv "DESKTOP_SESSION"
-- xmonad $ maybe desktopConfig desktop session
--{
--terminal = "gnome-terminal"
--, modMask = mod4Mask
--, borderWidth = 3
--}
-- 是的,这些也都是函数,只不过是简单函数
-- 它们不接受输入变量,返回静态值
let config = maybe desktopConfig desktop session
xmonad $ config { modMask = mod4Mask,terminal = "gnome-terminal" }
myTerminal = "gnome-terminal"
myModMask = mod4Mask -- Windows键或Super_L键
myBorderWidth = 3
desktop "gnome" = gnomeConfig
desktop "kde" = kde4Config
desktop "xfce" = xfceConfig
desktop "xmonad-mate" = gnomeConfig
desktop _ = desktopConfig
ps. xmonad中禁用touchpad
Run the following command in a terminal:
xinput list
You will get an output that looks like this:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Laptop_Integrated_Webcam_1.3M id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ Dell WMI hotkeys id=13 [slave keyboard (3)]
It displays all the input devices connected. Note that they all have an id. Since 12 is the id for my touchpad, running the following command will disable it.
xinput set-prop 12 "Device Enabled" 0
In Ubuntu versions >12.04
you can also directly disable via
xinput --disable 12
(and enable via a similar command)
禁用快捷键
let config = maybe desktopConfig desktop session
27 xmonad $ config { modMask = mod4Mask,terminal = "gnome-terminal" }
28 `removeKeys` [(mod4Mask, xK_space)]
1 http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-EZConfig.html
2 removeKeys :: XConfig a -> [(ButtonMask, KeySym)] -> XConfig aSource
3
4 Remove standard keybindings you're not using. Example use:
5
6 main = xmonad $ defaultConfig { terminal = "urxvt" }
7 `removeKeys` [(mod1Mask .|. shiftMask, n) | n <- [xK_1 .. xK_9]]
8
9
10 http://xmonad.org/xmonad-docs/xmonad/src/XMonad-Config.html