Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
avdv committed Dec 2, 2020
1 parent eda15ac commit 71697b3
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 50 deletions.
11 changes: 11 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ package(default_visibility = ["//visibility:public"])

# MARK: CUT END

# config_setting(
# name = "out",
# )

genrule(
name = "cp_xmonad",
srcs = ["//xmonad:xmonad"],
outs = ["xmonad_new"],
cmd = "cp $< $@",
)

# Pasted from https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md
#
# Run using
Expand Down
103 changes: 53 additions & 50 deletions xmonad/xmonad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import Control.Exception
import Control.Monad
import qualified Data.Map as M
--import qualified Data.Map as M
import Debug.Trace
import System.Directory (XdgDirectory (XdgCache),
getXdgDirectory)
Expand All @@ -13,8 +13,8 @@ import System.IO
--import XMonad (ManageHook, XConfig, X(), Window, Layout, WindowAttributes, Rectangle, startupHook, handleEventHook, logHook, workspaces, terminal)
import XMonad hiding (display, config)
--import XMonad.Actions.CycleRecentWS
import XMonad.Actions.CycleWS (shiftNextScreen, swapNextScreen)
import XMonad.Actions.GridSelect
--import XMonad.Actions.CycleWS (shiftNextScreen, swapNextScreen)
--import XMonad.Actions.GridSelect
import XMonad.Actions.SpawnOn
--import XMonad.Actions.UpdatePointer
import XMonad.Actions.Warp (warpToWindow)
Expand All @@ -23,19 +23,22 @@ import XMonad.Config.Desktop
import XMonad.Hooks.DynamicBars
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
--import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
--import XMonad.Hooks.UrgencyHook
import XMonad.Layout.LayoutModifier --(ModifiedLayout)
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.NoBorders (smartBorders, SmartBorder)
import XMonad.Layout.Tabbed
import XMonad.Layout.Decoration
import XMonad.Layout.Simplest
--import XMonad.Layout.NoBorders
import qualified XMonad.StackSet as W
import XMonad.Util.Dmenu
import XMonad.Util.EZConfig
--import XMonad.Util.NamedWindows (NamedWindow, getName)
import XMonad.Util.Run (spawnPipe)
--import XMonad.Util.Themes
import XMonad.Util.XUtils (fi)
--import XMonad.Util.XUtils (fi)

myNormalBorderColor :: String
myNormalBorderColor = "#7a7a7a"
Expand Down Expand Up @@ -207,7 +210,7 @@ myConfig :: [String] -> XConfig (XMonad.Layout.LayoutModifier.ModifiedLayout
(XMonad.Layout.LayoutModifier.ModifiedLayout
XMonad.Layout.NoBorders.SmartBorder Full)))
myConfig args =
myStatusBars $ initialConfig `additionalKeysP` prettyKeys `plusKeys` keys'
myStatusBars $ initialConfig `additionalKeysP` prettyKeys `plusKeys` keys''
where
initialConfig = desktopConfig {
terminal = "termite"
Expand Down Expand Up @@ -241,8 +244,8 @@ myConfig args =
, ("<XF86AudioRaiseVolume>", spawn "pactl -- set-sink-volume @DEFAULT_SINK@ +5%")
, ("<XF86AudioLowerVolume>", spawn "pactl -- set-sink-volume @DEFAULT_SINK@ -5%")
]
keys' XConfig { modMask = modMask } =
[((m .|. modMask, k), windows $ f i)
keys'' XConfig { modMask = currModMask } =
[((m .|. currModMask, k), windows $ f i)
| (i, k) <- zip myWorkspaces [xK_1 .. xK_9]
, (f, m) <- [(W.view, 0), (\ws -> (W.view ws) . (W.shift ws), shiftMask)]]

Expand All @@ -268,47 +271,47 @@ manageHook' = composeAll
, title =? "Open" --> doFloat
]

keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[
-- https://hackage.haskell.org/package/X11-1.6.1.1/docs/Graphics-X11-Types.html
-- https://hackage.haskell.org/package/X11-1.6.1.1/docs/Graphics-X11-ExtraTypes.html
-- some defaults copied from http://code.haskell.org/xmonad/XMonad/Config.hs
((modMask, xK_Return), spawnHere $ XMonad.terminal conf) -- %! Launch terminal
, ((modMask, xK_p ), spawn "dmenu_run") -- %! Launch dmenu
, ((modMask, xK_c ), kill) -- %! Close the focused window
, ((modMask, xK_space ), windows W.swapMaster) -- %! Set the focused window as master
--, ((modMask, xK_Tab ), windows W.focusDown) -- %! Move focus to the next window
--, ((modMask .|. shiftMask, xK_Tab), windows W.focusUp) -- %! Move focus to the next window
--, ((modMask, xK_Left ), windows W.focusLeft) -- %! Move focus to the next window
--, ((modMask, xK_Right ), windows W.focusRight) -- %! Move focus to the next window
, ((modMask, xK_Up ), windows W.focusUp) -- %! Move focus to the next window
, ((modMask, xK_Down ), windows W.focusDown) -- %! Move focus to the next window
, ((modMask, xK_minus ), sendMessage Shrink) -- %! Shrink the master area
, ((modMask, xK_equal ), sendMessage Expand) -- %! Expand the master area
, ((modMask, xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling
, ((modMask, xK_g ), goToSelected def)
, ((modMask .|. shiftMask, xK_q), io (exitWith ExitSuccess)) -- %! Quit xmonad
, ((modMask .|. shiftMask, xK_o), shiftNextScreen)
, ((modMask .|. mod1Mask, xK_o), swapNextScreen)
]
++
-- workspaces
[((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
-- mod-[',.] %! Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-[',.] %! Move client to screen 1, 2, or 3
[((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_quoteright, xK_comma, xK_period] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
-- keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
-- keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
-- [
-- -- https://hackage.haskell.org/package/X11-1.6.1.1/docs/Graphics-X11-Types.html
-- -- https://hackage.haskell.org/package/X11-1.6.1.1/docs/Graphics-X11-ExtraTypes.html
-- -- some defaults copied from http://code.haskell.org/xmonad/XMonad/Config.hs
-- ((modMask, xK_Return), spawnHere $ XMonad.terminal conf) -- %! Launch terminal
-- , ((modMask, xK_p ), spawn "dmenu_run") -- %! Launch dmenu
-- , ((modMask, xK_c ), kill) -- %! Close the focused window
-- , ((modMask, xK_space ), windows W.swapMaster) -- %! Set the focused window as master
-- --, ((modMask, xK_Tab ), windows W.focusDown) -- %! Move focus to the next window
-- --, ((modMask .|. shiftMask, xK_Tab), windows W.focusUp) -- %! Move focus to the next window
-- --, ((modMask, xK_Left ), windows W.focusLeft) -- %! Move focus to the next window
-- --, ((modMask, xK_Right ), windows W.focusRight) -- %! Move focus to the next window
-- , ((modMask, xK_Up ), windows W.focusUp) -- %! Move focus to the next window
-- , ((modMask, xK_Down ), windows W.focusDown) -- %! Move focus to the next window
-- , ((modMask, xK_minus ), sendMessage Shrink) -- %! Shrink the master area
-- , ((modMask, xK_equal ), sendMessage Expand) -- %! Expand the master area
-- , ((modMask, xK_t ), withFocused $ windows . W.sink) -- %! Push window back into tiling
-- , ((modMask, xK_g ), goToSelected def)
-- , ((modMask .|. shiftMask, xK_q), io (exitWith ExitSuccess)) -- %! Quit xmonad
-- , ((modMask .|. shiftMask, xK_o), shiftNextScreen)
-- , ((modMask .|. mod1Mask, xK_o), swapNextScreen)
-- ]
-- ++
-- -- workspaces
-- [((m .|. modMask, k), windows $ f i)
-- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
-- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
-- ++
-- -- mod-[',.] %! Switch to physical/Xinerama screens 1, 2, or 3
-- -- mod-shift-[',.] %! Move client to screen 1, 2, or 3
-- [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
-- | (key, sc) <- zip [xK_quoteright, xK_comma, xK_period] [0..]
-- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]

++
-- my custom additions
[
((modMask, xK_l), spawn "i3lock -c000000")
]
-- ++
-- -- my custom additions
-- [
-- ((modMask, xK_l), spawn "i3lock -c000000")
-- ]

myWorkspaces :: [String]
myWorkspaces = ["1:term","2:web","3:code","4:vm","5:media"] ++ map show [6..9]
myWorkspaces = ["1:term","2:web","3:code","4:vm","5:media"] ++ map show ['6'..'9']

0 comments on commit 71697b3

Please sign in to comment.