diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Internal/DMenu.hs | 14 | ||||
| -rw-r--r-- | src/Internal/Keys.hs | 33 | ||||
| -rw-r--r-- | src/Main.hs | 14 |
3 files changed, 55 insertions, 6 deletions
diff --git a/src/Internal/DMenu.hs b/src/Internal/DMenu.hs index f964544..0ec7927 100644 --- a/src/Internal/DMenu.hs +++ b/src/Internal/DMenu.hs @@ -16,9 +16,17 @@ data Colors = bg :: String } | DefaultColors +menuCommand :: [String] +menuCommand = ["rofi", "-monitor", "-4", "-dmenu", "-sort", "-levenshtein-sort"] + +menuCommandString :: String +menuCommandString = unwords menuCommand + runDMenu :: X () runDMenu = void $ - safeSpawn "rofi" ["-display-run", "Execute", "-show", "run"] + safeSpawn + "rofi" + ["-monitor", "-4", "-display-run", "Execute", "-show", "run"] runDMenuPrompt :: String -> Maybe String -> [String] -> X String runDMenuPrompt prompt color select = @@ -34,5 +42,5 @@ runDMenuPromptWithMap :: String -> Maybe String -> Map String a -> X (Maybe a) runDMenuPromptWithMap prompt color map = do let realColor = maybe [] ( \c -> ["-theme-str", printf "* {theme-color: %s;}" c]) color - menuMapArgs "rofi" - (["-p", prompt, "-dmenu"] ++ realColor) map + menuMapArgs (head menuCommand) + (tail menuCommand ++ ["-p", prompt] ++ realColor) map diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs index bf9b62c..27315cd 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -1,6 +1,7 @@ {-# LANGUAGE RankNTypes #-} module Internal.Keys (applyKeys) where +import Control.Monad.Fix (fix) import Graphics.X11.ExtraTypes.XF86; import Internal.KeysM import Internal.SwapMaster (swapMaster) @@ -171,7 +172,7 @@ keymap = runKeys $ do bind xK_minus $ do justMod $ sendMessage (IncMasterN (-1)) - shiftMod $ withFocused $ sendMessage . expandWindowAlt + shiftMod $ withFocused $ sendMessage . shrinkWindowAlt bind xK_m $ do justMod $ subkeys $ @@ -206,6 +207,23 @@ keymap = runKeys $ do shiftMod $ withFocused $ windows . W.sink altMod $ spawn (terminal config ++ " -t Floating\\ Term") + bind xK_v $ + -- Allows repeated strokes of M-h and M-l to reduce and increase volume + -- respectively. + justMod $ fix $ \recur -> subkeys $ do + bind xK_h $ do + justMod $ do + spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%" + recur + + bind xK_l $ do + justMod $ do + spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%" + recur + + bind xK_v $ do + justMod $ recur + bind xK_w $ do justMod windowJump @@ -228,6 +246,9 @@ keymap = runKeys $ do str (show (map ord str)) + bind xK_n $ do + (justMod -|- noMod) $ spawn (terminal config ++ " -t Notes -e notes new") + bind xK_c $ do shiftMod CopyWindow.killAllOtherCopies @@ -237,6 +258,16 @@ keymap = runKeys $ do bind xK_a $ (justMod -|- noMod) $ spawn "set-sink.sh" + + bind xK_w $ + (justMod -|- noMod) $ spawn "networkmanager_dmenu" + + bind xK_o $ + (justMod -|- noMod) $ spawn "library-view.sh" + + bind xK_v $ do + (justMod -|- noMod) $ spawn "set-volume.sh" + (shiftMod -|- rawMask shiftMask) $ spawn "set-volume.sh -a" -- Double-tap Z to toggle zoom. diff --git a/src/Main.hs b/src/Main.hs index da3b4f1..f70496c 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -13,9 +13,10 @@ import Data.Monoid import Internal.XMobarLog import Internal.Keys import Internal.Layout +import Internal.DMenu (menuCommandString) import qualified XMonad as X -import qualified XMonad.StackSet as S +import qualified XMonad.StackSet as W main = do @@ -24,6 +25,7 @@ main = do let fp = homeDir </> ".xmonad" </> "startup" setEnv "SUDO_ASKPASS" "/usr/bin/ssh-askpass" + setEnv "ROFI" menuCommandString xmobar <- spawnXMobar @@ -43,7 +45,8 @@ main = do , className =? "yakuake" --> doFloat , className =? "MPlayer" --> doFloat , title =? "Event Tester" --> doFloat - , title =? "Floating Term" --> doFloat + , title =? "Floating Term" --> doCenterFloat + , title =? "Notes" --> doCenterFloat , title =? "xmessage" --> doFloat , title =? "gxmessage" --> doFloat , className =? "mpv" --> doFloat @@ -55,3 +58,10 @@ main = do , clickJustFocuses = False , logHook = xMobarLogHook xmobar } + +doCenterFloat :: ManageHook +doCenterFloat = + ask >>= \w -> doF . W.float w . centerRect . snd =<< liftX (floatLocation w) + +centerRect :: W.RationalRect -> W.RationalRect +centerRect (W.RationalRect x y w h) = W.RationalRect ((1 - w) / 2) ((1 - h) / 2) w h |