Compare commits

..

No commits in common. "master" and "searching" have entirely different histories.

8 changed files with 59 additions and 87 deletions

View File

@ -10,10 +10,12 @@ before_script:
matrix: matrix:
include: include:
- env: - env:
- VERSION=19.09 - NIXPKGS=https://github.com/NixOS/nixpkgs-channels/archive/nixos-18.09.tar.gz
- env: - env:
- VERSION=unstable - NIXPKGS=https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.03.tar.gz
- env:
- NIXPKGS=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz
script: script:
- nix run nixpkgs.haskellPackages.hlint -c hlint src - nix run nixpkgs.haskellPackages.hlint -c hlint src
- nix build -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-$VERSION.tar.gz -f ./release.nix xmonad-masser - nix build -I nixpkgs=$NIXPKGS -f ./release.nix xmonad-masser

View File

@ -1,13 +1,3 @@
{ lib, haskellPackages }: { haskellPackages }:
let haskellPackages.callCabal2nix "xmonad-masser" ./. {}
filtered = src: lib.sourceByRegex src [
"^src.*"
"Setup.hs"
".*cabal"
"LICENSE"
];
in
haskellPackages.callCabal2nix "xmonad-masser" (filtered ./.) {}

View File

@ -1,16 +1,14 @@
{-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
module XMonad.Config.MasseR where module XMonad.Config.MasseR where
import Control.Lens ((^.)) import XMonad.Password
import Data.Generics.Product (field) import XMonad.CustomPrompt
import XMonad.TopicSpace
import qualified Data.List as List import qualified Data.List as List
import XMonad import XMonad
-- import XMonad.Actions.CycleWS (swapNextScreen) import XMonad.Actions.CycleWS (swapNextScreen)
import XMonad.Actions.Search import XMonad.Actions.Search
import XMonad.Hooks.EwmhDesktops (ewmh, ewmhDesktopsStartup) import XMonad.Hooks.EwmhDesktops (ewmh, ewmhDesktopsStartup)
import XMonad.Hooks.SetWMName (setWMName) import XMonad.Hooks.SetWMName (setWMName)
@ -23,7 +21,7 @@ import XMonad.Layout.Decoration (Decoration,
import XMonad.Layout.DwmStyle import XMonad.Layout.DwmStyle
import XMonad.Layout.LayoutModifier (ModifiedLayout) import XMonad.Layout.LayoutModifier (ModifiedLayout)
import XMonad.Layout.Master import XMonad.Layout.Master
import XMonad.Layout.NoBorders (noBorders, smartBorders) import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.PerWorkspace (onWorkspace) import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Renamed import XMonad.Layout.Renamed
import XMonad.Layout.Simplest (Simplest) import XMonad.Layout.Simplest (Simplest)
@ -31,16 +29,12 @@ import XMonad.Layout.Spiral
import XMonad.Layout.Tabbed (TabbedDecoration, import XMonad.Layout.Tabbed (TabbedDecoration,
Theme (..), shrinkText, Theme (..), shrinkText,
tabbed) tabbed)
import XMonad.Layout.ToggleLayouts (ToggleLayout (..), import XMonad.Layout.ToggleLayouts (ToggleLayout (..))
toggleLayouts)
import XMonad.Password
import XMonad.Prompt.RunOrRaise (runOrRaisePrompt) import XMonad.Prompt.RunOrRaise (runOrRaisePrompt)
import XMonad.Prompt.Shell (shellPrompt)
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import XMonad.TopicSpace
import XMonad.Util.EZConfig import XMonad.Util.EZConfig
import XMonad.XMobar (zenburnPP) import XMonad.XMobar (zenburnPP)
import Data.Monoid (Endo, (<>)) import Data.Monoid (Endo, (<>))
@ -49,7 +43,6 @@ import XMonad.Util.SpawnOnce
import System.IO (hClose, hPutStr) import System.IO (hClose, hPutStr)
import XMonad.Actions.Navigation2D import XMonad.Actions.Navigation2D
import XMonad.Actions.UpdatePointer (updatePointer)
import XMonad.Util.NamedActions import XMonad.Util.NamedActions
import XMonad.Util.Run (spawnPipe) import XMonad.Util.Run (spawnPipe)
@ -62,9 +55,9 @@ import XMonad.Hooks.DynamicLog (statusBar)
import qualified Data.Set as S import qualified Data.Set as S
spotify :: ExtraConfig -> XConfig l -> NamedAction spotify :: XConfig l -> NamedAction
spotify extraConf conf = submapName . mkNamedKeymap conf $ spotify conf = submapName . mkNamedKeymap conf $
[ ("M-p", addName "Play" $ spawn (musicToggle . applications $ extraConf)) ] [ ("M-p", addName "Play" $ spawn "sp play") ]
scratchpads :: [NamedScratchpad] scratchpads :: [NamedScratchpad]
scratchpads = [ scratchpads = [
@ -80,20 +73,18 @@ scratchSubmaps conf = submapName . mkNamedKeymap conf $ [
-- Search engines inside submaps -- Search engines inside submaps
searchSubmaps :: ExtraConfig -> XConfig l -> NamedAction searchSubmaps :: ExtraConfig -> XConfig l -> NamedAction
searchSubmaps extraConfig conf = searchSubmaps extraConfig conf =
let mkBrowser = promptSearchBrowser def (extraConfig ^. field @"applications" . field @"browser") let mkBrowser = promptSearchBrowser def "qutebrowser"
googleP = addName "Search google" $ mkBrowser google _googleP = addName "Search google" $ mkBrowser google
ddgP = addName "Search duckduckgo" $ mkBrowser (searchEngine "duckduckgo" "http://duckduckgo.com/?q=")
extras = [(key, addName name $ mkBrowser (searchEngine name url)) | Search{..} <- searchEndpoints extraConfig] extras = [(key, addName name $ mkBrowser (searchEngine name url)) | Search{..} <- searchEndpoints extraConfig]
in submapName . mkNamedKeymap conf $ in submapName . mkNamedKeymap conf $
("g", googleP) : extras [ ("d", ddgP) -- Training to use ddg again
, ("g", ddgP) -- training to use ddg again
] ++ extras
myNav2d :: Navigation2DConfig myNav2d :: Navigation2DConfig
myNav2d = myNav2d = def { defaultTiledNavigation = lineNavigation }
def { defaultTiledNavigation = nav
, screenNavigation = nav
}
where
nav = hybridOf lineNavigation sideNavigation
showKeybindings :: [((KeyMask, KeySym), NamedAction)] -> NamedAction showKeybindings :: [((KeyMask, KeySym), NamedAction)] -> NamedAction
showKeybindings x = addName "Show keybindings" $ io $ do showKeybindings x = addName "Show keybindings" $ io $ do
@ -128,10 +119,14 @@ myManageHook = composeAll $ concat [
, documentHooks , documentHooks
, floatHooks , floatHooks
, debuggerHooks , debuggerHooks
, ideHooks
, flowHook , flowHook
] ]
where where
classHook y = map (\x -> className =? x --> y) classHook y = map (\x -> className =? x --> y)
ideHooks = classHook (doShift "eclipse") [
"Anypoint Studio"
]
webHooks = classHook (doShift "web") [ webHooks = classHook (doShift "web") [
"Firefox" "Firefox"
, "qutebrowser" , "qutebrowser"
@ -151,7 +146,7 @@ myManageHook = composeAll $ concat [
"libreoffice" "libreoffice"
, "libreoffice-calc" , "libreoffice-calc"
, "Assistant" , "Assistant"
, "Bouml" -- Oh wow, didn't even remember this existed , "Bouml"
] ]
floatHooks = classHook doFloat [ floatHooks = classHook doFloat [
"SMplayer" "SMplayer"
@ -159,11 +154,11 @@ myManageHook = composeAll $ concat [
, "MPlayer" , "MPlayer"
, "Kaffeine" , "Kaffeine"
, "Xmessage" , "Xmessage"
, "Wfica_Seamless" -- I think this is citrix , "Wfica_Seamless"
, "mpv" , "mpv"
] ]
debuggerHooks = classHook (doShift "debugger") [ debuggerHooks = classHook (doShift "debugger") [
"JSwat Debugger", -- Haven't used this in years. A good thing? "JSwat Debugger",
"DBeaver" "DBeaver"
] ]
dynamicsHook = [title =~? "Dynamics" --> doShift "dynamics"] dynamicsHook = [title =~? "Dynamics" --> doShift "dynamics"]
@ -179,40 +174,38 @@ myKeys extraConfig conf =
, ("<XF86AudioLowerVolume>", addName "Decrease volume" $ spawn "amixer set Master 2%-") , ("<XF86AudioLowerVolume>", addName "Decrease volume" $ spawn "amixer set Master 2%-")
, ("M-<plus>", addName "Increase volume" $ spawn "amixer set Master 2+") , ("M-<plus>", addName "Increase volume" $ spawn "amixer set Master 2+")
, ("M-<minus>", addName "Decrease volume" $ spawn "amixer set Master 2-") , ("M-<minus>", addName "Decrease volume" $ spawn "amixer set Master 2-")
, ("<XF86AudioPlay>", addName "Play/pause music" $ spawn "mpc toggle") -- , ("<XF86AudioPlay>", addName "Play/pause spotify" $ spawn "/home/masse/.local/bin/sp play")
, ("M-m", spotify extraConfig conf) , ("<XF86AudioPlay>", addName "Play/pause mopidy" $ spawn "mpc toggle")
-- , ("M-S-<Space>", addName "Swap screens" swapNextScreen) , ("M-m", spotify conf)
, ("M-S-<Space>", addName "Swap screens" swapNextScreen)
, ("M-<Backspace>", addName "Kill window" kill) , ("M-<Backspace>", addName "Kill window" kill)
-- scrot requires `unGrab` -- scrot requires `unGrab`
, ("M-<Print>", addName "Take screenshot" $ spawn (screenshot . applications $ extraConfig))] ^++^ , ("M-<Print>", addName "Take screenshot" $ spawn (screenshot . applications $ extraConfig))] ^++^
subKeys "Launchers" [ ("M-S-<Return>", addName "Open terminal" $ spawn $ XMonad.terminal conf) subKeys "Launchers" [ ("M-S-y", addName "Open youtube" $ spawn "mpv $(clip -o)")
, ("M-S-<Return>", addName "Open terminal" $ spawn $ XMonad.terminal conf)
, ("M-n", scratchSubmaps conf) , ("M-n", scratchSubmaps conf)
, ("M-s", searchSubmaps extraConfig conf) , ("M-s", searchSubmaps extraConfig conf)
, ("M-p", addName "Retrieve password" $ passPrompt def) , ("M-p", addName "Retrieve password" $ passPrompt def)
, ("M-e", addName "Run app" $ runOrRaisePrompt def) , ("M-S-e", addName "Open with app" xdgOpen)
, ("M-S-e", addName "Run shell command" $ shellPrompt def)] ^++^ , ("M-e", addName "Run app" $ runOrRaisePrompt def)] ^++^
subKeys "Windows" [ ("M-j", addName "Go down" $ windowGo D False) subKeys "Windows" [ ("M-j", addName "Go down" $ windowGo D False)
, ("M-k", addName "Go up" $ windowGo U False) , ("M-k", addName "Go up" $ windowGo U False)
, ("M-h", addName "Go left" $ windowGo L False) , ("M-h", addName "Go left" $ windowGo L False)
, ("M-l", addName "Go right" $ windowGo R False) , ("M-l", addName "Go right" $ windowGo R False)
-- Swap screen left or right, don't wrap , ("M-S-j", addName "Shift window down" $ windowSwap D False)
, ("M-S-h", addName "Shift window up" $ screenSwap L True) , ("M-S-k", addName "Shift window up" $ windowSwap U False)
, ("M-S-l", addName "Shift window right" $ screenSwap R True) , ("M-S-h", addName "Shift window left" $ windowSwap L False)
-- , ("M-S-j", addName "Shift window down" $ windowSwap D False) , ("M-S-l", addName "Shift window right" $ windowSwap R False)
-- , ("M-S-k", addName "Shift window up" $ windowSwap U False)
-- , ("M-S-h", addName "Shift window left" $ windowSwap L False)
-- , ("M-S-l", addName "Shift window right" $ windowSwap R False)
, ("M-.", addName "Go to previous window" $ windows W.focusDown) , ("M-.", addName "Go to previous window" $ windows W.focusDown)
, ("M-,", addName "Go to next window" $ windows W.focusUp) , ("M-,", addName "Go to next window" $ windows W.focusUp)
, ("M-S-m", addName "Swap master" $ windows W.swapMaster) , ("M-S-m", addName "Swap master" $ windows W.swapMaster)
] ^++^ ] ^++^
subKeys "Projects & Workspaces" (topicKeys' extraConfig conf) ^++^ subKeys "Projects & Workspaces" (topicKeys' extraConfig conf) ^++^
subKeys "Layout management" [ ("M-C-<Space>", addName "Toggle layout" $ sendMessage ToggleLayout) subKeys "Layout management" [ ("M-C-<Space>", addName "Toggle layout" $ sendMessage ToggleLayout)
, ("M-z", addName "Toggle zoom" $ sendMessage (Toggle "Zoom"))
, ("M-<Space>", addName "Next layout" $ sendMessage NextLayout)] ^++^ , ("M-<Space>", addName "Next layout" $ sendMessage NextLayout)] ^++^
subKeys "Resize" [] subKeys "Resize" []
where where
locker = "xset s activate" locker = "sh ~/scripts/lock.sh"
@ -242,22 +235,15 @@ masser extraConfig = xmonad =<< statusBar (bar extraConfig) zenburnPP toggleStru
, normalBorderColor = "#262626" , normalBorderColor = "#262626"
, focusedBorderColor = "#7F9F7F" , focusedBorderColor = "#7F9F7F"
, manageHook = myManageHook , manageHook = myManageHook
-- The focus follows mouse is a bad idea for me because
-- it misbehaves with accordion. If I accidentally hover
-- my mouse at the lower edge of the accordion, it will
-- just cycle through to the last accordion
, focusFollowsMouse = False , focusFollowsMouse = False
, logHook = updatePointer (0.25, 0.25) (0.25, 0.25)
} }
myLayout = toggleLayouts zoom workspaceLayouts myLayout = onWorkspace "web" webLayout $
onWorkspace "dynamics" webLayout $
onWorkspace "pdf" pdfLayout $
onWorkspace "documents" documentLayout $
onWorkspace "mail" mailLayout
defLayout
where where
zoom = renamed [Replace "Zoom"] (noBorders Full)
workspaceLayouts = onWorkspace "web" webLayout $
onWorkspace "dynamics" webLayout $
onWorkspace "pdf" pdfLayout $
onWorkspace "documents" documentLayout $
onWorkspace "mail" mailLayout
defLayout
-- Default layout -- Default layout
defLayout = tiled ||| tabLayout ||| readLayout ||| bspLayout ||| vimLayout ||| spiral (6/7) ||| Full defLayout = tiled ||| tabLayout ||| readLayout ||| bspLayout ||| vimLayout ||| spiral (6/7) ||| Full
-- Pdfs are restricted to tabs -- Pdfs are restricted to tabs

View File

@ -10,7 +10,6 @@ data Applications =
, prompt :: FilePath , prompt :: FilePath
, screenshot :: FilePath , screenshot :: FilePath
, urxvt :: FilePath , urxvt :: FilePath
, musicToggle :: FilePath
} deriving (Show, Generic) } deriving (Show, Generic)
data TopicRule = data TopicRule =

View File

@ -54,4 +54,4 @@ mkPassPrompt label f conf = do
selectPassword :: String -> X () selectPassword :: String -> X ()
selectPassword pass = spawn $ "PASSWORD_STORE_CLIP_TIME=10 pass --clip " ++ pass selectPassword pass = spawn $ "pass --clip " ++ pass

View File

@ -4,6 +4,7 @@ module XMonad.TopicSpace (topicKeys', addTopic, TopicAction(..)) where
import XMonad.Actions.TopicSpace import XMonad.Actions.TopicSpace
import XMonad import XMonad
import qualified Data.Map as M import qualified Data.Map as M
import XMonad.Actions.GridSelect
import XMonad.Actions.DynamicWorkspaces import XMonad.Actions.DynamicWorkspaces
import XMonad.TopicUtils import XMonad.TopicUtils
import XMonad.Util.EZConfig (mkNamedKeymap) import XMonad.Util.EZConfig (mkNamedKeymap)
@ -41,6 +42,7 @@ myTopicConfig extraConfig =
topicKeys' :: ExtraConfig -> XConfig l -> [(String, NamedAction)] topicKeys' :: ExtraConfig -> XConfig l -> [(String, NamedAction)]
topicKeys' extraConfig conf = [ ("M-y", addName "Change topic" $ visualSelect (myTopicConfig extraConfig)) topicKeys' extraConfig conf = [ ("M-y", addName "Change topic" $ visualSelect (myTopicConfig extraConfig))
, ("M-S-g", addName "Move window to topic" $ gridselectMove def) , ("M-S-g", addName "Move window to topic" $ gridselectMove def)
, ("M-u", addName "Select window" $ gotoSelected' def{gs_colorizer = fromClassName})
, ("M-<Return>", addName "Open project action" $ currentTopicAction' (myTopicConfig extraConfig)) , ("M-<Return>", addName "Open project action" $ currentTopicAction' (myTopicConfig extraConfig))
, ("M-w", modificationSubmaps' conf)] , ("M-w", modificationSubmaps' conf)]

View File

@ -26,11 +26,9 @@ safeRunInTerm dir Nothing = safeSpawn "urxvt" ["-cd", dir]
safeRunInTerm dir (Just command) = safeSpawn "urxvt" ["-cd", dir, "-e", command] safeRunInTerm dir (Just command) = safeSpawn "urxvt" ["-cd", dir, "-e", command]
inactiveTags :: X [WorkspaceId] inactiveTags :: X [WorkspaceId]
inactiveTags = inactive' <$> gets windowset inactiveTags = map W.tag . inactive' <$> gets windowset
where where
inactive' s = inactive' s = W.hidden s ++ map W.workspace (filter (\w -> (W.tag . W.workspace . W.current) s /= (W.tag . W.workspace) w) (W.visible s))
let current = W.currentTag s
in filter (current /=) . map W.tag $ W.hidden s <> map W.workspace (W.visible s)
gridselectMove :: GSConfig WorkspaceId -> X () gridselectMove :: GSConfig WorkspaceId -> X ()
gridselectMove conf = do gridselectMove conf = do
@ -50,10 +48,7 @@ gsConfig = def{gs_navigate = navNSearch, gs_colorizer = fromClassName}
-- - Takes a topicspace viewfunc -- - Takes a topicspace viewfunc
gridselectWorkspace :: GSConfig WorkspaceId -> (WorkspaceId -> X ()) -> X () gridselectWorkspace :: GSConfig WorkspaceId -> (WorkspaceId -> X ()) -> X ()
gridselectWorkspace conf viewFunc = withWindowSet $ \ws -> do gridselectWorkspace conf viewFunc = withWindowSet $ \ws -> do
let wss = filter (/= current) . map W.tag $ invisible <> visible let wss = map W.tag . W.hidden $ ws
visible = fmap W.workspace (W.visible ws)
invisible = W.hidden ws
current = W.currentTag ws
gridselect conf (zip wss wss) >>= flip whenJust viewFunc gridselect conf (zip wss wss) >>= flip whenJust viewFunc
gotoSelected' :: GSConfig Window -> X () gotoSelected' :: GSConfig Window -> X ()

View File

@ -25,7 +25,7 @@ library
, XMonad.TopicSpace , XMonad.TopicSpace
, XMonad.XMobar , XMonad.XMobar
-- other-extensions: -- other-extensions:
build-depends: base >=4.11 && <4.14 build-depends: base >=4.11 && <4.13
, xmonad , xmonad
, xmonad-contrib , xmonad-contrib
, mtl , mtl
@ -34,7 +34,5 @@ library
, unix , unix
, containers , containers
, text , text
, lens
, generic-lens
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010