From b3345f64febd2faaebeb6e5b6a104f0b2ac34522 Mon Sep 17 00:00:00 2001 From: Max Hohlfeld Date: Wed, 17 May 2023 15:33:02 +0200 Subject: [PATCH] feat: add calculator and direct web search --- roles/xmonad/files/xmonad_t460p.hs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/roles/xmonad/files/xmonad_t460p.hs b/roles/xmonad/files/xmonad_t460p.hs index 51272f5..37e484f 100644 --- a/roles/xmonad/files/xmonad_t460p.hs +++ b/roles/xmonad/files/xmonad_t460p.hs @@ -42,6 +42,8 @@ import Text.Regex.Posix import XMonad.Util.WorkspaceCompare ( getSortByIndex, filterOutWs ) import Data.Maybe (fromMaybe) +import qualified XMonad.Actions.Search as S +import qualified XMonad.Prompt as P -- colours white :: String = "#dcdccc" @@ -67,6 +69,7 @@ myScratchpads = , NS "vimwiki" "alacritty -t vimwiki -e vwwrapper" (title =? "vimwiki") (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3)) , NS "pavucontrol" "pavucontrol" (title =? "Lautstärkeregler") (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3)) , NS "cmus" "alacritty -t 'cmus' -e cmus" (title =? "cmus") (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3)) + , NS "qalculate" "qalculate-gtk" (title =? "Qalculate!") (customFloating $ W.RationalRect (3/6) (1/6) (1/6) (1/6)) ] -- Topic Space @@ -137,6 +140,20 @@ topicPrompt = def , sorter = fuzzySort } +searx :: S.SearchEngine +searx = S.searchEngine "searx" "https://search.tfld.de/search?q=" + +wiktionary :: S.SearchEngine +wiktionary = S.searchEngine "wiktionary" "https://wiktionary.org/w/index.php?search=" + +searchList :: [(String, S.SearchEngine)] +searchList = [ ("o", S.openstreetmap) + , ("h", S.hackage) + , ("w", S.wikipedia) + , ("y", S.youtube) + , ("s", searx) + , ("t", wiktionary) + ] -- custom keybinds myAdditionalKeys :: [(String, X ())] @@ -165,6 +182,7 @@ myAdditionalKeys = , ("M-s v", namedScratchpadAction myScratchpads "vimwiki") , ("M-s a", namedScratchpadAction myScratchpads "pavucontrol") , ("M-s c", namedScratchpadAction myScratchpads "cmus") + , ("M-s q", namedScratchpadAction myScratchpads "qalculate") -- open terminal , ("M-S-", spawnShell) @@ -198,6 +216,10 @@ myAdditionalKeys = | (i, k) <- zip (topicNames topicItems) (map show [1 .. 5 :: Int]) , (f, m) <- [(switchTopic myTopicConfig, ""), (windows . W.shift, "S-")] ] + -- Search commands + ++ [("M-d " ++ k, S.promptSearch topicPrompt f) | (k,f) <- searchList ] + ++ [("M-S-d " ++ k, S.selectSearch f) | (k,f) <- searchList ] + -- Layouts mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a