aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2021-11-01 13:59:03 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:45 -0600
commit8475c103767344bd9c6a47052794cc14675d24cd (patch)
tree00164bc14e3af6eaadab2309b5e9918a578e0bae
parent3cd8f412028b78a8a2624e0d184213781cb2218e (diff)
downloadrde-8475c103767344bd9c6a47052794cc14675d24cd.tar.gz
rde-8475c103767344bd9c6a47052794cc14675d24cd.tar.bz2
rde-8475c103767344bd9c6a47052794cc14675d24cd.zip
Add more DMenu integration & Add ability to change the spacing with Mod+Shift+[].
-rw-r--r--.gitignore3
-rw-r--r--src/Internal/DMenu.hs29
-rw-r--r--src/Internal/Keys.hs11
-rw-r--r--src/Internal/Lib.hs31
-rwxr-xr-xstartup2
5 files changed, 62 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f5570ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.stack-work/*
+*.cabal
+*.lock
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 ()
diff --git a/startup b/startup
index a7cd604..bb43beb 100755
--- a/startup
+++ b/startup
@@ -18,7 +18,7 @@ hostname_photon() {
# Startup commands specific to my desktop.
if [ ! -z "$(ps aux | grep compton | grep -v grep)" ] ; then
- nohup compton --backend glx & > /dev/null
+ nohup compton --backend xrender & > /dev/null
fi
xrandr --output DVI-I-1 --right-of DP-5 --mode 2560x1440
feh --bg-scale "/home/rahm/.xmonad/wallpaper.jpg"