aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2021-11-01 13:59:03 -0600
committerJosh Rahm <rahm@google.com>2021-11-01 13:59:03 -0600
commit1e38cda801d91f39ffe0eeb9808afb32f300098d (patch)
tree00164bc14e3af6eaadab2309b5e9918a578e0bae /src
parenta9b95646b8581e8b0afd4eec99f960d9f42b9c38 (diff)
downloadrde-1e38cda801d91f39ffe0eeb9808afb32f300098d.tar.gz
rde-1e38cda801d91f39ffe0eeb9808afb32f300098d.tar.bz2
rde-1e38cda801d91f39ffe0eeb9808afb32f300098d.zip
Add more DMenu integration & Add ability to change the spacing with Mod+Shift+[].
Diffstat (limited to 'src')
-rw-r--r--src/Internal/DMenu.hs29
-rw-r--r--src/Internal/Keys.hs11
-rw-r--r--src/Internal/Lib.hs31
3 files changed, 58 insertions, 13 deletions
diff --git a/src/Internal/DMenu.hs b/src/Internal/DMenu.hs
index c5cac49..d91c7ba 100644
--- a/src/Internal/DMenu.hs
+++ b/src/Internal/DMenu.hs
@@ -1,10 +1,39 @@
module Internal.DMenu where
+import XMonad.Util.Dmenu
import XMonad
import XMonad.Util.Run
import Control.Monad
+import Data.Map (Map)
+import qualified Data.Map as Map
+import XMonad.Util.Run
+import Data.List (intercalate)
+
+data Colors =
+ Colors {
+ fg :: String,
+ bg :: String
+ } | DefaultColors
runDMenu :: X ()
runDMenu = void $
safeSpawn "/usr/bin/dmenu_run" [
"-p", "Execute ", "-l", "12", "-dim", "0.4"]
+
+runDMenuPrompt :: String -> Maybe String -> [String] -> X String
+runDMenuPrompt prompt color select =
+ let realColor = maybe [] (\c -> ["-sb", c, "-nf", c]) color
+ in
+ runProcessWithInput "/home/rahm/.local/bin/dmenu_debug.sh" ([
+ "-p", prompt,
+ "-l", "12",
+ "-dim", "0.4" ] ++ realColor) (intercalate "\n" select)
+
+
+runDMenuPromptWithMap :: String -> Maybe String -> Map String a -> X (Maybe a)
+runDMenuPromptWithMap prompt color map = do
+ let realColor = maybe [] (\c -> ["-sb", c, "-nf", c]) color
+ menuMapArgs "dmenu"([
+ "-p", prompt,
+ "-l", "12",
+ "-dim", "0.4" ] ++ realColor) map
diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs
index 91d033d..c97736f 100644
--- a/src/Internal/Keys.hs
+++ b/src/Internal/Keys.hs
@@ -4,6 +4,7 @@ module Internal.Keys where
import Graphics.X11.ExtraTypes.XorgDefault
import System.Process
import XMonad.Util.Ungrab
+import XMonad.Layout.Spacing
import Internal.XPlus
import Data.Maybe (isJust)
import Debug.Trace
@@ -65,6 +66,10 @@ click = do
(_, _, window, _, _, _, _, _) <- io $ queryPointer dpy root
focus window
+modifyWindowBorder :: Integer -> SpacingModifier
+modifyWindowBorder i = ModifyWindowBorder $ \(Border a b c d) ->
+ (Border (a + i) (b + i) (c + i) (d + i))
+
newKeys :: MarkContext -> IO (KeyMap l)
newKeys markContext =
return $ \config@(XConfig {modMask = modm}) ->
@@ -102,8 +107,10 @@ newKeys markContext =
mapNumbersAndAlpha 0 (
runXPlus markContext config . swapWorkspace)))
- , ((modm .|. shiftMask, xK_bracketleft), sendMessage (IncMasterN (-1)))
- , ((modm .|. shiftMask, xK_bracketright), sendMessage (IncMasterN 1))
+ , ((modm, xK_minus), sendMessage (IncMasterN (-1)))
+ , ((modm, xK_plus), sendMessage (IncMasterN 1))
+ , ((modm .|. shiftMask, xK_bracketleft), sendMessage (modifyWindowBorder (-1)))
+ , ((modm .|. shiftMask, xK_bracketright), sendMessage (modifyWindowBorder 1))
, ((modm, xK_bracketleft), sendMessage ShrinkZoom)
, ((modm, xK_bracketright), sendMessage ExpandZoom)
diff --git a/src/Internal/Lib.hs b/src/Internal/Lib.hs
index e0b78c5..feb5f26 100644
--- a/src/Internal/Lib.hs
+++ b/src/Internal/Lib.hs
@@ -3,6 +3,7 @@ module Internal.Lib where
import Prelude hiding ((!!))
+import XMonad.Util.Run
import XMonad.Prompt
import XMonad.Prompt.Input
import XMonad.Prompt.Shell
@@ -19,6 +20,7 @@ import Text.Printf
import XMonad hiding (workspaces, Screen)
import XMonad.StackSet hiding (filter, focus)
import qualified Data.Map as Map
+import Internal.DMenu
type WorkspaceName = Char
newtype Selector = Selector (forall a. (Eq a) => a -> [a] -> a)
@@ -123,15 +125,22 @@ windowJump = do
windowTitlesToWinId <- withWindowSet $ \ss ->
Map.fromList <$> mapM (\wid -> (,) <$> getString wid <*> return wid) (allWindows ss)
- mkXPrompt
- WinPrompt
- xpConfig
- (\input -> return $ filter (fuzzyCompletion input) (Map.keys windowTitlesToWinId)) $
- \str -> do
+ windowId <- runDMenuPromptWithMap "Window" (Just "#f542f5") windowTitlesToWinId
+
+ case windowId of
+ Nothing -> return ()
+ Just wid -> do
saveLastMark markContext
- case Map.lookup str windowTitlesToWinId of
- Just w -> focus w
- Nothing ->
- case filter (fuzzyCompletion str) (Map.keys windowTitlesToWinId) of
- [s] -> mapM_ focus (Map.lookup s windowTitlesToWinId)
- _ -> return ()
+ focus wid
+ -- mkXPrompt
+ -- WinPrompt
+ -- xpConfig
+ -- (\input -> return $ filter (fuzzyCompletion input) (Map.keys windowTitlesToWinId)) $
+ -- \str -> do
+ -- saveLastMark markContext
+ -- case Map.lookup str windowTitlesToWinId of
+ -- Just w -> focus w
+ -- Nothing ->
+ -- case filter (fuzzyCompletion str) (Map.keys windowTitlesToWinId) of
+ -- [s] -> mapM_ focus (Map.lookup s windowTitlesToWinId)
+ -- _ -> return ()