packages feed

bluetile (empty) → 0.1

raw patch · 5 files changed

+327/−0 lines, 5 filesdep +basedep +containersdep +processsetup-changed

Dependencies added: base, containers, process, xmonad-bluetilebranch, xmonad-contrib-bluetilebranch

Files

+ Config.hs view
@@ -0,0 +1,190 @@+{-# OPTIONS -fno-warn-missing-signatures #-}+----------------------------------------------------------------------------+-- |+-- Module      :  Config+-- Copyright   :  (c) Jan Vornberger 2009+-- License     :  BSD3-style (see LICENSE)+--+-- Maintainer  :  jan.vornberger@informatik.uni-oldenburg.de+-- Stability   :  unstable+-- Portability :  not portable+--+-- The default configuration of bluetile+--+-----------------------------------------------------------------------------++module Config where++import XMonad hiding ( (|||) )++import XMonad.Layout hiding ( (|||) )+import XMonad.Layout.Maximize+import XMonad.Layout.Minimize+import XMonad.Layout.NoBorders+import XMonad.Layout.LayoutCombinators+import XMonad.Layout.Named+import XMonad.Layout.BoringWindows+import XMonad.Layout.Decoration+import XMonad.Layout.WindowSwitcherDecoration+import XMonad.Layout.DraggingVisualizer+import XMonad.Layout.PositionStoreFloat+import XMonad.Layout.BorderResize+import XMonad.Layout.MouseResizableTile+import XMonad.Layout.NoFrillsDecoration++import XMonad.Actions.CycleWS+import XMonad.Actions.BluetileCommands+import XMonad.Actions.WindowMenu++import XMonad.Hooks.ManageDocks+import XMonad.Hooks.EwmhDesktops+import XMonad.Hooks.CustomRestart+import XMonad.Hooks.RestoreMinimized+import XMonad.Hooks.WorkspaceByPos+import XMonad.Hooks.BluetileDock+import XMonad.Hooks.ServerMode++import XMonad.Config.Gnome++import qualified XMonad.StackSet as W+import qualified Data.Map as M++import System.Exit+import Data.Monoid+import Control.Monad(when)++blueTileWorkspaces :: [String]+blueTileWorkspaces = ["1","2","3","4","5","6","7","8","9","0"]++blueTileKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())+blueTileKeys conf@(XConfig {XMonad.modMask = modMask'}) = M.fromList $+    -- launching and killing programs+    [ ((modMask'              , xK_Return), spawn $ XMonad.terminal conf) -- %! Launch terminal+    , ((modMask',               xK_p     ), gnomeRun)    --  %! Launch Gnome "Run application" dialog+    , ((modMask' .|. shiftMask, xK_c     ), kill) -- %! Close the focused window++    , ((modMask',               xK_F5 ), refresh) -- %! Resize viewed windows to the correct size+    , ((modMask' .|. shiftMask, xK_F5 ), setLayout $ XMonad.layoutHook conf) -- %!  Reset the layouts on the current workspace to default++    , ((modMask',               xK_o ), windowMenu)++    -- move focus up or down the window stack+    , ((modMask',               xK_Tab   ), focusDown) -- %! Move focus to the next window+    , ((modMask' .|. shiftMask, xK_Tab   ), focusUp) -- %! Move focus to the previous window+    , ((modMask',               xK_j     ), focusDown) -- %! Move focus to the next window+    , ((modMask',               xK_k     ), focusUp) -- %! Move focus to the previous window++    -- modifying the window order+    , ((modMask' .|. shiftMask, xK_j     ), windows W.swapDown  ) -- %! Swap the focused window with the next window+    , ((modMask' .|. shiftMask, xK_k     ), windows W.swapUp    ) -- %! Swap the focused window with the previous window++    -- resizing the master/slave ratio+    , ((modMask',               xK_h     ), sendMessage Shrink) -- %! Shrink the master area+    , ((modMask',               xK_l     ), sendMessage Expand) -- %! Expand the master area+    , ((modMask',               xK_u     ), sendMessage ShrinkSlave) -- %! Shrink a slave area+    , ((modMask',               xK_i     ), sendMessage ExpandSlave) -- %! Expand a slave area++    -- floating layer support+    , ((modMask',               xK_t     ), withFocused $ windows . W.sink) -- %! Push window back into tiling+    , ((modMask' .|. shiftMask, xK_t     ), withFocused $ float ) -- %! Float window++    -- increase or decrease number of windows in the master area+    , ((modMask'              , xK_comma ), sendMessage (IncMasterN 1)) -- %! Increment the number of windows in the master area+    , ((modMask'              , xK_period), sendMessage (IncMasterN (-1))) -- %! Deincrement the number of windows in the master area++    -- quit, or restart+    , ((modMask' .|. shiftMask, xK_q     ), io (exitWith ExitSuccess)) -- %! Quit bluetile+    , ((modMask'              , xK_q     ), spawn "bluetile --restart") -- %! Restart bluetile++    -- Metacity-like workspace switching+    , ((mod1Mask .|. controlMask, xK_Left), prevWS)+    , ((mod1Mask .|. controlMask, xK_Right), nextWS)+    , ((mod1Mask .|. controlMask .|. shiftMask,   xK_Left), shiftToPrev >> prevWS)+    , ((mod1Mask .|. controlMask .|. shiftMask,   xK_Right), shiftToNext >> nextWS)++    -- more Metacity keys+    , ((mod1Mask             , xK_F2), gnomeRun)+    , ((mod1Mask             , xK_F4), kill)++    -- Switching to layouts+    , ((modMask'              , xK_a), sendMessage $ JumpToLayout "Floating")+    , ((modMask'              , xK_s), sendMessage $ JumpToLayout "Tiled1")+    , ((modMask'              , xK_d), sendMessage $ JumpToLayout "Tiled2")+    , ((modMask'              , xK_f), sendMessage $ JumpToLayout "Fullscreen")++    -- Maximizing+    , ((modMask'              , xK_z), withFocused (sendMessage . maximizeRestore))++    -- Minimizing+    , ((modMask',               xK_m     ), withFocused (\f -> sendMessage (MinimizeWin f)))+    , ((modMask' .|. shiftMask, xK_m     ), sendMessage RestoreNextMinimizedWin)+    ]+    +++    -- mod-[1..9] ++ [0] %! Switch to workspace N+    -- mod-shift-[1..9] ++ [0] %! Move client to workspace N+    [((m .|. modMask', k), windows $ f i)+        | (i, k) <- zip (XMonad.workspaces conf) ([xK_1 .. xK_9] ++ [xK_0])+        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]+    +++    -- mod-{w,e,r} %! Switch to physical/Xinerama screens 1, 2, or 3+    -- mod-shift-{w,e,r} %! Move client to screen 1, 2, or 3+    [((m .|. modMask', key), screenWorkspace sc >>= flip whenJust (windows . f))+        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]+        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]++blueTileMouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ())+blueTileMouseBindings (XConfig {XMonad.modMask = modMask'}) = M.fromList $+    -- mod-button1 %! Move a floated window by dragging+    [ ((modMask', button1), (\w -> isFloating w >>= \isF -> when (isF) $+                                focus w >> mouseMoveWindow w >> windows W.shiftMaster))+    -- mod-button2 %! Switch to next and first layout+    , ((modMask', button2), (\_ -> sendMessage NextLayout))+    , ((modMask' .|. shiftMask, button2), (\_ -> sendMessage $ JumpToLayout "Floating"))+    -- mod-button3 %! Resize a floated window by dragging+    , ((modMask', button3), (\w -> isFloating w >>= \isF -> when (isF) $+                                focus w >> mouseResizeWindow w >> windows W.shiftMaster))+    ]++isFloating :: Window -> X (Bool)+isFloating w = do+    ws <- gets windowset+    return $ M.member w (W.floating ws)++blueTileManageHook :: ManageHook+blueTileManageHook = composeAll+               [ workspaceByPos+                , className =? "MPlayer" --> doFloat+                , manageDocks]++blueTileLayoutHook = avoidStruts $ boringAuto $ minimize $ (+                        named "Floating" floating |||+                        named "Tiled1" tiled1 |||+                        named "Tiled2" tiled2 |||+                        named "Fullscreen" fullscreen+                        )+        where+            floating = floatingDeco $ maximize $ borderResize $ positionStoreFloat+            tiled1 = tilingDeco $ maximize $ mouseResizableTileMirrored+            tiled2 = tilingDeco $ maximize $ mouseResizableTile+            fullscreen = tilingDeco $ maximize $ smartBorders Full++            tilingDeco l = windowSwitcherDecoration shrinkText defaultTheme (draggingVisualizer l)+            floatingDeco l = noFrillsDeco shrinkText defaultTheme l++blueTileConfig dockHandle =+    defaultConfig+        { modMask = mod4Mask,   -- logo key+          manageHook = blueTileManageHook,+          layoutHook = blueTileLayoutHook,+          logHook = ewmhDesktopsLogHook >> bluetileDock dockHandle,+          handleEventHook = ewmhDesktopsEventHook+                                `mappend` customRestartEventHook "bluetile"+                                `mappend` restoreMinimizedEventHook+                                `mappend` serverModeEventHookCustom bluetileCommands,+          workspaces = blueTileWorkspaces,+          keys = blueTileKeys,+          mouseBindings = blueTileMouseBindings,+          focusFollowsMouse  = False,+          focusedBorderColor = "#ff5500",+          terminal = "gnome-terminal"+        }
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2009 Jan Vornberger++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:++1. Redistributions of source code must retain the above copyright+   notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright+   notice, this list of conditions and the following disclaimer in the+   documentation and/or other materials provided with the distribution.++3. Neither the name of the author nor the names of his contributors+   may be used to endorse or promote products derived from this software+   without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+POSSIBILITY OF SUCH DAMAGE.
+ Main.hs view
@@ -0,0 +1,79 @@+----------------------------------------------------------------------------+-- |+-- Module      :  Main+-- Copyright   :  (c) Jan Vornberger 2009+-- License     :  BSD3-style (see LICENSE)+--+-- Maintainer  :  jan.vornberger@informatik.uni-oldenburg.de+-- Stability   :  unstable+-- Portability :  not portable+--+-- bluetile - a modern tiling window manager with a gentle learning curve+--+-----------------------------------------------------------------------------++module Main (main) where++import XMonad+import XMonad.Util.Run (spawnPipe)++import Config++import System.IO+import System.Environment+import System.Cmd+import System.Exit++-- | The entry point into bluetile. Just launch with the default+-- configuration. Compiling a custom configuration is not supported for now.+main :: IO ()+main = do+    -- start docks and greeting screen+    dockHandle <- spawnPipe "bluetiledock"+    spawnPipe "bluetilegreet"++    -- check terminal+    uninstallSignalHandlers -- make sure we can receive SIGCHLD to check terminal+    blueTileConfig' <- checkTerminal $ blueTileConfig dockHandle+    installSignalHandlers -- important to ignore SIGCHLD from now on to avoid zombies++    -- process arguments+    let launch = xmonad blueTileConfig'+    args <- getArgs+    case args of+        []                    -> launch+        ["--resume", _]       -> launch+        ["--help"]            -> usage+        ["--restart"]         -> sendRestart >> return ()+        ["--version"]         -> putStrLn ("bluetile 0.1")+        _                     -> fail "unrecognized flags"++usage :: IO ()+usage = do+    self <- getProgName+    putStr . unlines $+        concat ["Usage: ", self, " [OPTION]"] :+        "Options:" :+        "  --help                       Print this message" :+        "  --version                    Print the version number" :+        "  --restart                    Request a running xmonad process to restart" :+        []++sendRestart :: IO ()+sendRestart = do+    dpy <- openDisplay ""+    rw <- rootWindow dpy $ defaultScreen dpy+    xmonad_restart <- internAtom dpy "XMONAD_CUSTOM_RESTART" False+    allocaXEvent $ \e -> do+        setEventType e clientMessage+        setClientMessageEvent e rw xmonad_restart 32 0 currentTime+        sendEvent dpy rw False structureNotifyMask e+    sync dpy False++checkTerminal :: XConfig l -> IO (XConfig l)+checkTerminal conf = do+    let term = XMonad.terminal conf+    status <- system $ "which " ++ term ++ " > /dev/null"+    if status == ExitSuccess+        then return conf+        else return conf { terminal = "xterm" }
+ Setup.lhs view
@@ -0,0 +1,3 @@+#!/usr/bin/env runhaskell+> import Distribution.Simple+> main = defaultMain
+ bluetile.cabal view
@@ -0,0 +1,25 @@+Name:                bluetile+Version:             0.1+synopsis:            A modern tiling window manager with a gentle learning curve+description:+  Bluetile is a tiling window manager for X based on xmonad. Windows are arranged+  automatically to tile the screen without gaps or overlap, maximising+  screen use. Bluetile's focus lies on making the tiling paradigm easily+  accessible for users coming from traditional window managers by drawing+  on known conventions and making all features available using the mouse.+  It also tries to be usable 'out of the box', making configuration unnecessary.+category:            System+License:             BSD3+License-file:        LICENSE+Author:              Jan Vornberger+Maintainer:          jan.vornberger@informatik.uni-oldenburg.de+extra-source-files:  Config.hs+Build-Type:          Simple+Cabal-Version:       >=1.2++Executable bluetile+  Main-is:           Main.hs+  Build-Depends:     base>=3, base<4, containers, process,+                     xmonad-bluetilebranch>=0.8, xmonad-bluetilebranch<0.9,+                     xmonad-contrib-bluetilebranch>=0.8, xmonad-contrib-bluetilebranch<0.9+  Ghc-Options:       -Wall