spring refactor

no more Bar bullshit, introducing dynamic projects
This commit is contained in:
eeva 2018-05-26 18:08:13 +03:00
parent 7b6a65f290
commit 088f52a316
4 changed files with 43 additions and 30 deletions

6
.gitignore vendored
View File

@ -1,2 +1,8 @@
.*.swp
artwork/
*.hi *.hi
*.o *.o
prompt-history
xmonad-x86_64-linux
xmonad.errors
xmonad.state

View File

@ -9,6 +9,7 @@ import System.Exit
import Text.EditDistance import Text.EditDistance
import XMonad import XMonad
import XMonad.Actions.CycleWS import XMonad.Actions.CycleWS
import XMonad.Actions.DynamicProjects
import XMonad.Actions.GridSelect import XMonad.Actions.GridSelect
import XMonad.Core import XMonad.Core
import XMonad.Layout.ToggleLayouts import XMonad.Layout.ToggleLayouts
@ -42,18 +43,15 @@ modify conf = conf
, ("M-S-<Delete>", spawn "/run/current-system/sw/bin/i3lock-fancy -g -p") , ("M-S-<Delete>", spawn "/run/current-system/sw/bin/i3lock-fancy -g -p")
, ("M-S-<Left>", shiftToPrev >> prevWS) , ("M-S-<Left>", shiftToPrev >> prevWS)
, ("M-S-<Right>", shiftToNext >> nextWS) , ("M-S-<Right>", shiftToNext >> nextWS)
, ("M-S-p", shellPrompt promptConfig)
, ("M-S-s", spawn "sleep 0.2 ; /run/current-system/sw/bin/scrot -s /tmp/screenSel.png") , ("M-S-s", spawn "sleep 0.2 ; /run/current-system/sw/bin/scrot -s /tmp/screenSel.png")
--, ("M-p", fuzzyPrompt promptConfig)
, ("M-p", goToSelected defaultGSConfig)
, ("M-s", spawn "/run/current-system/sw/bin/scrot /tmp/screen.png") , ("M-s", spawn "/run/current-system/sw/bin/scrot /tmp/screen.png")
-- Workspace and tasks
, ("M-p v", gridselectWorkspace defaultGSConfig W.view)
, ("M-p n", switchProjectPrompt promptConfig)
, ("M-p m", shiftToProjectPrompt promptConfig)
, ("M-p s", shellPrompt promptConfig)
] ]
`additionalKeys`-- Add some more (automatic) key bindings:
[ ((mod4Mask .|. mask, key), windows $ actionWith tag)
| (tag, key) <- zip (workspaces conf) [ xK_F1 .. ]
, (mask, actionWith) <- zip [ 0, shiftMask ] [ W.view, W.shift ] ]
promptConfig = def promptConfig = def
{ position = Top { position = Top
, alwaysHighlight = True , alwaysHighlight = True

22
lib/Projects.hs Normal file
View File

@ -0,0 +1,22 @@
module Projects (
Projects.modify
) where
import XMonad
import XMonad.Actions.DynamicProjects
projects :: [Project]
projects = [ Project { projectName = "games"
, projectDirectory = "~/"
, projectStartHook = Nothing
}
, Project { projectName = "web"
, projectDirectory = "~/"
, projectStartHook = Nothing
}
]
modify :: XConfig l -> XConfig l
modify conf = dynamicProjects projects conf
{ workspaces = ["games", "web"] }

View File

@ -5,6 +5,7 @@
module Main (main) where module Main (main) where
import XMonad import XMonad
import XMonad.Actions.DynamicProjects
import XMonad.Config.Desktop import XMonad.Config.Desktop
import XMonad.Hooks.DynamicLog import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers import XMonad.Hooks.ManageHelpers
@ -16,22 +17,9 @@ import XMonad.Util.EZConfig
import qualified Solarized as S import qualified Solarized as S
-- Tidy modules -- Tidy modules
import StatusBar as Bar (modify)
import KeyBindings as Keys (modify) import KeyBindings as Keys (modify)
import MouseBindings as Mouse (modify) import MouseBindings as Mouse (modify)
import Projects as Projects (modify)
-------- A list of my usual workspaces (with some FontAwesome & xmobar format)
wkspcs = [ wrap "<fn=1>" "</fn>" "\xF0E0" --  email
, wrap "<fn=1>" "</fn>" "\xF086" --  chat
, wrap "<fn=1>" "</fn>" "\xF120" --  work
, wrap "<fn=1>" "</fn>" "\xF1B6" --  game
, wrap "<fn=1>" "</fn>" "\xF11B" --  game
, wrap "<fn=1>" "</fn>" "\xF09C" --  password
, wrap "<fn=1>" "</fn>" "\xF16C" --  web work
, wrap "<fn=1>" "</fn>" "\xF025" --  sound
, wrap "<fn=1>" "</fn>" "\xF269" --  web perso
, wrap "<fn=1>" "</fn>" "\xF03D" --  movie
]
--------- toggle btw vvvvvvvvvv or vvvvv --------- toggle btw vvvvvvvvvv or vvvvv
layouts = toggleLayouts fullscreen tiled layouts = toggleLayouts fullscreen tiled
@ -45,12 +33,12 @@ layouts = toggleLayouts fullscreen tiled
-- For className, use the second value that xprop gives you. -- For className, use the second value that xprop gives you.
-------------- Here be the law of windows -------------- Here be the law of windows
myManageHook = composeOne myManageHook = composeOne
[ className =? "mpv" -?> doFullFloat <+> (doShift $ last wkspcs) [ className =? "Pinentry" -?> doFloat
, className =? "Pinentry" -?> doFloat , className =? "mpv" -?> doFullFloat <+> (doShift "Flims")
, className =? "Steam" -?> doShift $ wkspcs !! 3 , className =? "Steam" -?> doShift "Steam"
, className =? "csgo_linux64" -?> doFullFloat , className =? "csgo_linux64" -?> doFullFloat <+> (doShift "CSGO")
, className =? "Pavucontrol" -?> doShift $ wkspcs !! 7 , className =? "Pavucontrol" -?> doShift "Music"
, className =? "qutebrowser" -?> doShift $ wkspcs !! 5 , className =? "qutebrowser" -?> doShift "Web Perso"
, isDialog -?> doCenterFloat , isDialog -?> doCenterFloat
-- Move transient windows to their parent: -- Move transient windows to their parent:
@ -59,14 +47,13 @@ myManageHook = composeOne
------------ build the full config ------------ build the full config
withConfig = withConfig =
Bar.modify -- Apply statusBar config Projects.modify -- Apply projects config
$ Keys.modify -- Apply keybindings config $ Keys.modify -- Apply keybindings config
$ Mouse.modify -- Apply mouse bindings config $ Mouse.modify -- Apply mouse bindings config
$ desktopConfig -- on a default desktop config $ desktopConfig -- on a default desktop config
{ manageHook = myManageHook <+> manageHook desktopConfig { manageHook = myManageHook <+> manageHook desktopConfig
, layoutHook = desktopLayoutModifiers layouts , layoutHook = desktopLayoutModifiers layouts
, terminal = "/run/current-system/sw/bin/alacritty" , terminal = "/run/current-system/sw/bin/alacritty"
, workspaces = wkspcs
, normalBorderColor = S.base03 , normalBorderColor = S.base03
, focusedBorderColor = S.violet , focusedBorderColor = S.violet
, borderWidth = 5 , borderWidth = 5