daily pastebin goal
10%
SHARE
TWEET

xmonad.hs aparaatti

a guest Apr 1st, 2012 240 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --
  2. -- xmonad example config file.
  3. --
  4. -- A template showing all available configuration hooks,
  5. -- and how to override the defaults in your own xmonad.hs conf file.
  6. --
  7. -- Normally, you'd only override those defaults you care about.
  8. --
  9. import XMonad
  10. import Data.Monoid
  11. import System.Exit
  12.  
  13. import XMonad.ManageHook
  14. import qualified XMonad.StackSet as W
  15. import qualified Data.Map        as M
  16. -- Niko add
  17. import XMonad.Layout.ResizableTile
  18. import XMonad.Layout.Circle
  19. import XMonad.Layout.NoBorders
  20. import XMonad.Layout.Tabbed
  21.  
  22. import XMonad.Hooks.DynamicLog
  23. import XMonad.Hooks.SetWMName -- java fix
  24.  
  25. -- The preferred terminal program, which is used in a binding below and by
  26. -- certain contrib modules.
  27. --
  28. myTerminal      = "xterm"
  29.  
  30. -- Whether focus follows the mouse pointer.
  31. myFocusFollowsMouse :: Bool
  32. myFocusFollowsMouse = False
  33.  
  34. -- Width of the window border in pixels.
  35. --
  36. myBorderWidth   = 2
  37.  
  38. -- modMask lets you specify which modkey you want to use. The default
  39. -- is mod1Mask ("left alt").  You may also consider using mod3Mask
  40. -- ("right alt"), which does not conflict with emacs keybindings. The
  41. -- "windows key" is usually mod4Mask.
  42. --
  43. myModMask       = mod4Mask
  44.  
  45. -- The default number of workspaces (virtual screens) and their names.
  46. -- By default we use numeric strings, but any string may be used as a
  47. -- workspace name. The number of workspaces is determined by the length
  48. -- of this list.
  49. --
  50. -- A tagging example:
  51. --
  52. -- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
  53. --
  54. myWorkspaces    = ["1:term","2:www","3:mail","4:stuff","5:Beat","6:Jack","7:Seq24", "8:Files"]
  55.  
  56. -- Border colors for unfocused and focused windows, respectively.
  57. --
  58. myNormalBorderColor  = "#203D83"
  59. myFocusedBorderColor = "#a343a9"  --"#2E54AF"
  60.  
  61. ------------------------------------------------------------------------
  62. -- Key bindings. Add, modify or remove key bindings here.
  63. --
  64. myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
  65.  
  66.     -- launch a terminal
  67.     [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
  68.  
  69.     -- launch dmenu
  70.     , ((modm,               xK_F2     ), spawn "dmenu_run -b -p \">\" -nb orange -nf black -fn -*-verdana-medium-r-*-*-17-*-*-*-*-*-*-*")
  71.  
  72.     -- launch gmrun
  73.     , ((modm .|. shiftMask, xK_p     ), spawn "gmrun")
  74.  
  75.     -- close focused window
  76.     , ((modm .|. shiftMask, xK_c     ), kill)
  77.  
  78.      -- Rotate through the available layout algorithms
  79.     , ((modm,               xK_space ), sendMessage NextLayout)
  80.  
  81.     --  Reset the layouts on the current workspace to default
  82.     , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
  83.  
  84.     -- Resize viewed windows to the correct size
  85.     , ((modm,               xK_n     ), refresh)
  86.  
  87.     -- Move focus to the next window
  88.     , ((modm,               xK_Tab   ), windows W.focusDown)
  89.  
  90.     -- Move focus to the next window
  91.     , ((modm,               xK_j     ), windows W.focusDown)
  92.  
  93.     -- Move focus to the previous window
  94.     , ((modm,               xK_k     ), windows W.focusUp  )
  95.  
  96.     -- Move focus to the master window
  97.     , ((modm,               xK_m     ), windows W.focusMaster  )
  98.  
  99.     -- Swap the focused window and the master window
  100.     , ((modm,               xK_Return), windows W.swapMaster)
  101.  
  102.     -- Swap the focused window with the next window
  103.     , ((modm .|. shiftMask, xK_j     ), windows W.swapDown  )
  104.  
  105.     -- Swap the focused window with the previous window
  106.     , ((modm .|. shiftMask, xK_k     ), windows W.swapUp    )
  107.  
  108.     -- Shrink the master area
  109.     , ((modm,               xK_h     ), sendMessage Shrink)
  110.  
  111.     -- Expand the master area
  112.     , ((modm,               xK_l     ), sendMessage Expand)
  113.     -- Muuta tiilien koko
  114.     , ((modm,               xK_a), sendMessage MirrorShrink)
  115.     , ((modm,               xK_z), sendMessage MirrorExpand)
  116.  
  117.  
  118.     -- Push window back into tiling
  119.     , ((modm,               xK_t     ), withFocused $ windows . W.sink)
  120.  
  121.     -- Increment the number of windows in the master area
  122.     , ((modm              , xK_comma ), sendMessage (IncMasterN 1))
  123.  
  124.     -- Deincrement the number of windows in the master area
  125.     , ((modm              , xK_period), sendMessage (IncMasterN (-1)))
  126.  
  127.     -- Toggle the status bar gap
  128.     -- Use this binding with avoidStruts from Hooks.ManageDocks.
  129.     -- See also the statusBar function from Hooks.DynamicLog.
  130.     --
  131.     -- , ((modm              , xK_b     ), sendMessage ToggleStruts)
  132.  
  133.     -- Quit xmonad
  134.     , ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
  135.  
  136.     -- Restart xmonad
  137.     , ((modm              , xK_q     ), spawn "xmonad --recompile; xmonad --restart")
  138.     -- volume
  139.     , ((0, 0x1008FF11), spawn "/home/aparaatti/Desktop/Dropbox/Skriptit/xmonad/volume-niko.sh -U")
  140.     , ((0, 0x1008FF13), spawn "/home/aparaatti/Desktop/Dropbox/Skriptit/xmonad/volume-niko.sh")
  141.     , ((0, 0x1008ff12), spawn "/home/aparaatti/bin/batt")
  142.     ]
  143.     ++
  144.  
  145.     --
  146.     -- mod-[1..9], Switch to workspace N
  147.     -- mod-shift-[1..9], Move client to workspace N
  148.     --
  149.     [((m .|. modm, k), windows $ f i)
  150.         | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
  151.         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  152.     ++
  153.  
  154.     --
  155.     -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
  156.     -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
  157.     --
  158.     [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
  159.         | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  160.         , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  161.  
  162.  
  163. ------------------------------------------------------------------------
  164. -- Mouse bindings: default actions bound to mouse events
  165. --
  166. myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
  167.  
  168.     -- mod-button1, Set the window to floating mode and move by dragging
  169.     [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
  170.                                        >> windows W.shiftMaster))
  171.  
  172.     -- mod-button2, Raise the window to the top of the stack
  173.     , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
  174.  
  175.     -- mod-button3, Set the window to floating mode and resize by dragging
  176.     , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
  177.                                        >> windows W.shiftMaster))
  178.  
  179.     -- you may also bind events to the mouse scroll wheel (button4 and button5)
  180.     ]
  181.  
  182. ------------------------------------------------------------------------
  183. -- Layouts:
  184.  
  185. -- You can specify and transform your layouts by modifying these values.
  186. -- If you change layout bindings be sure to use 'mod-shift-space' after
  187. -- restarting (with 'mod-q') to reset your layout state to the new
  188. -- defaults, as xmonad preserves your old layout settings by default.
  189. --
  190. -- The available layouts.  Note that each layout is separated by |||,
  191. -- which denotes layout choice.
  192. --
  193. myLayout = tiled||| Mirror tiled ||| noBorders simpleTabbedBottom
  194.   where
  195.     -- ResizableTall 1 (3/100) (1/2) []
  196.      -- default tiling algorithm partitions the screen into two panes
  197.      tiled   = Tall nmaster delta ratio
  198.  
  199.      -- The default number of windows in the master pane
  200.      nmaster = 1
  201.  
  202.      -- Default proportion of screen occupied by master pane
  203.      ratio   = 3/5
  204.  
  205.      -- Percent of screen to increment by when resizing panes
  206.      delta   = 5/100
  207.  
  208. --  multiCol 4 4 0.01 0.5
  209.  
  210. ------------------------------------------------------------------------
  211. -- Window rules:
  212.  
  213. -- Execute arbitrary actions and WindowSet manipulations when managing
  214. -- a new window. You can use this to, for example, always float a
  215. -- particular program, or have a client always appear on a particular
  216. -- workspace.
  217. --
  218. -- To find the property name associated with a program, use
  219. -- > xprop | grep WM_CLASS
  220. -- and click on the client you're interested in.
  221. --
  222. -- To match on the WM_NAME, you can use 'title' in the same way that
  223. -- 'className' and 'resource' are used below.
  224. --
  225. myManageHook = composeAll
  226.     [ className =? "MPlayer"        --> doFloat
  227.     , className =? "Gimp"           --> doFloat
  228.     , className =? "sun-awt-X11-XFramePeer" --> doFloat
  229.     , className =? "com-mathworks-util-PostVMInit" --> doFloat
  230.     , className =? "skype"          --> doFloat
  231.     , className =? "Skype"          --> doFloat
  232.     , className =? "Sonata" --> doFloat
  233.     , className =? "Thunderbird"    --> doF (W.shift "3:mail")
  234.     , className =? "Chromium"       --> doF (W.shift "2:www")
  235.     , className =? "Firefox" --> doF (W.shift "2:www")
  236.     , className =? "Qjackctl"       --> doF (W.shift "6:Jack")
  237.     , className =? "Zita-rev1"      --> doF (W.shift "6:Jack")
  238.     , className =? "Hydrogen"       --> doF (W.shift "5:Beat")
  239.     , className =? "Seq24"          --> doF (W.shift "7:Seq24")
  240.     , className =? "Banshee"        --> doF (W.shift "5:Beat")
  241.     , className =? "FLTK"           --> doF (W.shift "4:stuff")
  242.     , className =? "Qmidiroute"     --> doF (W.shift "6:Jack")
  243.     , className =? "Transmission-gtk" --> doF (W.shift "8:Files")
  244.     , className =? "Thunar"         --> doF (W.shift "8:Files")
  245.     , className =? "Nautilus"       --> doF (W.shift "8:Files")
  246.     , className =? "DTA"            --> doF (W.shift "8:Files")
  247.     , className =? "GUI-NiLogGUI"   --> doFloat
  248.     , className =? "Smplayer"       --> doFloat
  249.     , className =? "BasicWin"       --> doFloat
  250.     , className =? "Jack-keyboard"  --> doFloat
  251.     , className =? "wbGUI-LabNoter" --> doFloat
  252.     , resource  =? "desktop_window" --> doIgnore
  253.     , resource  =? "kdesktop"       --> doIgnore ]
  254.  
  255. ------------------------------------------------------------------------
  256. -- Event handling
  257.  
  258. -- * EwmhDesktops users should change this to ewmhDesktopsEventHook
  259. --
  260. -- Defines a custom handler function for X Events. The function should
  261. -- return (All True) if the default handler is to be run afterwards. To
  262. -- combine event hooks use mappend or mconcat from Data.Monoid.
  263. --
  264. myEventHook = mempty
  265.  
  266. ------------------------------------------------------------------------
  267. -- Status bars and logging
  268.  
  269. -- Perform an arbitrary action on each internal state change or X event.
  270. -- See the 'XMonad.Hooks.DynamicLog' extension for examples.
  271. --
  272. myLogHook = return ()
  273.  
  274. ------------------------------------------------------------------------
  275. -- Startup hook
  276.  
  277. -- Perform an arbitrary action each time xmonad starts or is restarted
  278. -- with mod-q.  Used by, e.g., XMonad.Layout.PerWorkspace to initialize
  279. -- per-workspace layout choices.
  280. --
  281. -- By default, do nothing.
  282. myStartupHook = setWMName "LG3D" -- java fix
  283.  
  284. ---- Xmobar by niko
  285. --
  286. --
  287. --
  288.  
  289. -- myBar = "mobar" -- käsky barille
  290. ---custom PP, säädetään mitä barissa näkyy
  291. -- myPP = xmobarPP { ppCurrent = xmobarColor "#429942" "" . wrap "<" ">" }
  292. --- pikanäppäin baring kokoon
  293. -- toggleStrutsKey XConfig { XMonad.modMask = modMask } = (modMask, xK_b)
  294.  
  295.  
  296. ------------------------------------------------------------------------
  297. -- Now run xmonad with all the defaults we set up.
  298.  
  299. -- Run xmonad with the settings you specify. No need to modify this.
  300. --
  301. main = xmonad =<<xmobar defaults
  302.  
  303. -- A structure containing your configuration settings, overriding
  304. -- fields in the default config. Any you don't override, will
  305. -- use the defaults defined in xmonad/XMonad/Config.hs
  306. --
  307. -- No need to modify this.
  308. --
  309. defaults = defaultConfig {
  310.       -- simple stuff
  311.         terminal           = myTerminal,
  312.         focusFollowsMouse  = myFocusFollowsMouse,
  313.         borderWidth        = myBorderWidth,
  314.         modMask            = myModMask,
  315.         workspaces         = myWorkspaces,
  316.         normalBorderColor  = myNormalBorderColor,
  317.         focusedBorderColor = myFocusedBorderColor,
  318.  
  319.       -- key bindings
  320.         keys               = myKeys,
  321.         mouseBindings      = myMouseBindings,
  322.  
  323.       -- hooks, layouts
  324.         layoutHook         = myLayout,
  325.         manageHook         = myManageHook,
  326.         handleEventHook    = myEventHook,
  327.         logHook            = myLogHook,
  328.         startupHook        = myStartupHook
  329.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top