Re-organizzing keybindings including some minor changes to some bindings.

This commit is contained in:
Derek Taylor 2022-06-26 20:59:59 -05:00
parent b5e7a08185
commit 8a74759a2e
2 changed files with 132 additions and 120 deletions

View File

@ -624,14 +624,21 @@ I am using the Xmonad.Util.EZConfig module which allows keybindings to be writte
showKeybindings :: [((KeyMask, KeySym), NamedAction)] -> NamedAction showKeybindings :: [((KeyMask, KeySym), NamedAction)] -> NamedAction
showKeybindings x = addName "Show Keybindings" $ io $ do showKeybindings x = addName "Show Keybindings" $ io $ do
h <- spawnPipe $ "yad --text-info --fontname=\"SauceCodePro Nerd Font Mono 12\" --fore=#46d9ff back=#282c36 --center --geometry=1200x800 --title \"XMonad keybindings\"" h <- spawnPipe $ "yad --text-info --fontname=\"SauceCodePro Nerd Font Mono 12\" --fore=#46d9ff back=#282c36 --center --geometry=1200x800 --title \"XMonad keybindings\""
hPutStr h (unlines $ showKm x) --hPutStr h (unlines $ showKm x) -- showKM adds ">>" before subtitles
hPutStr h (unlines $ showKmSimple x) -- showKmSimple doesn't add ">>" to subtitles
hClose h hClose h
return () return ()
subtitle' :: String -> ((KeyMask, KeySym), NamedAction)
subtitle' x = ((0,0), NamedAction $ map toUpper
$ sep ++ "\n-- " ++ x ++ " --\n" ++ sep)
where
sep = replicate (6 + length x) '-'
myKeys :: XConfig l0 -> [((KeyMask, KeySym), NamedAction)] myKeys :: XConfig l0 -> [((KeyMask, KeySym), NamedAction)]
myKeys c = myKeys c =
--(subtitle "Custom Keys":) $ mkNamedKeymap c $ --(subtitle "Custom Keys":) $ mkNamedKeymap c $
let subKeys str ks = subtitle str : mkNamedKeymap c ks in let subKeys str ks = subtitle' str : mkNamedKeymap c ks in
subKeys "Xmonad Essentials" subKeys "Xmonad Essentials"
[ ("M-C-r", addName "Recompile XMonad" $ spawn "xmonad --recompile") [ ("M-C-r", addName "Recompile XMonad" $ spawn "xmonad --recompile")
, ("M-S-r", addName "Restart XMonad" $ spawn "xmonad --restart") , ("M-S-r", addName "Restart XMonad" $ spawn "xmonad --restart")
@ -737,8 +744,8 @@ myKeys c =
^++^ subKeys "Increase/decrease windows in master pane or the stack" ^++^ subKeys "Increase/decrease windows in master pane or the stack"
[ ("M-S-<Up>", addName "Increase clients in master pane" $ sendMessage (IncMasterN 1)) [ ("M-S-<Up>", addName "Increase clients in master pane" $ sendMessage (IncMasterN 1))
, ("M-S-<Down>", addName "Decrease clients in master pane" $ sendMessage (IncMasterN (-1))) , ("M-S-<Down>", addName "Decrease clients in master pane" $ sendMessage (IncMasterN (-1)))
, ("M-=", addName "Increase # of windows" $ increaseLimit) , ("M-=", addName "Increase max # of windows for layout" $ increaseLimit)
, ("M--", addName "Decrease # of windows" $ decreaseLimit)] , ("M--", addName "Decrease max # of windows for layout" $ decreaseLimit)]
-- Sublayouts -- Sublayouts
-- This is used to push windows to tabbed sublayouts, or pull them out of it. -- This is used to push windows to tabbed sublayouts, or pull them out of it.
@ -769,7 +776,6 @@ myKeys c =
, ("M-u h", addName "mocp prev" $ spawn "mocp --previous") , ("M-u h", addName "mocp prev" $ spawn "mocp --previous")
, ("M-u <Space>", addName "mocp toggle pause" $ spawn "mocp --toggle-pause")] , ("M-u <Space>", addName "mocp toggle pause" $ spawn "mocp --toggle-pause")]
-- Grid Select (CTR-g followed by a key)
^++^ subKeys "GridSelect" ^++^ subKeys "GridSelect"
-- , ("C-g g", addName "Select favorite apps" $ runSelectedAction' defaultGSConfig gsCategories) -- , ("C-g g", addName "Select favorite apps" $ runSelectedAction' defaultGSConfig gsCategories)
[ ("M-M1-<Return>", addName "Select favorite apps" $ spawnSelected' [ ("M-M1-<Return>", addName "Select favorite apps" $ spawnSelected'

View File

@ -486,14 +486,21 @@ dmenuSound = soundDir ++ "menu-01.mp3"
showKeybindings :: [((KeyMask, KeySym), NamedAction)] -> NamedAction showKeybindings :: [((KeyMask, KeySym), NamedAction)] -> NamedAction
showKeybindings x = addName "Show Keybindings" $ io $ do showKeybindings x = addName "Show Keybindings" $ io $ do
h <- spawnPipe $ "yad --text-info --fontname=\"SauceCodePro Nerd Font Mono 12\" --fore=#46d9ff back=#282c36 --center --geometry=1200x800 --title \"XMonad keybindings\"" h <- spawnPipe $ "yad --text-info --fontname=\"SauceCodePro Nerd Font Mono 12\" --fore=#46d9ff back=#282c36 --center --geometry=1200x800 --title \"XMonad keybindings\""
hPutStr h (unlines $ showKm x) --hPutStr h (unlines $ showKm x) -- showKM adds ">>" before subtitles
hPutStr h (unlines $ showKmSimple x) -- showKmSimple doesn't add ">>" to subtitles
hClose h hClose h
return () return ()
subtitle' :: String -> ((KeyMask, KeySym), NamedAction)
subtitle' x = ((0,0), NamedAction $ map toUpper
$ sep ++ "\n-- " ++ x ++ " --\n" ++ sep)
where
sep = replicate (6 + length x) '-'
myKeys :: XConfig l0 -> [((KeyMask, KeySym), NamedAction)] myKeys :: XConfig l0 -> [((KeyMask, KeySym), NamedAction)]
myKeys c = myKeys c =
--(subtitle "Custom Keys":) $ mkNamedKeymap c $ --(subtitle "Custom Keys":) $ mkNamedKeymap c $
let subKeys str ks = subtitle str : mkNamedKeymap c ks in let subKeys str ks = subtitle' str : mkNamedKeymap c ks in
subKeys "Xmonad Essentials" subKeys "Xmonad Essentials"
[ ("M-C-r", addName "Recompile XMonad" $ spawn "xmonad --recompile") [ ("M-C-r", addName "Recompile XMonad" $ spawn "xmonad --recompile")
, ("M-S-r", addName "Restart XMonad" $ spawn "xmonad --restart") , ("M-S-r", addName "Restart XMonad" $ spawn "xmonad --restart")
@ -599,8 +606,8 @@ myKeys c =
^++^ subKeys "Increase/decrease windows in master pane or the stack" ^++^ subKeys "Increase/decrease windows in master pane or the stack"
[ ("M-S-<Up>", addName "Increase clients in master pane" $ sendMessage (IncMasterN 1)) [ ("M-S-<Up>", addName "Increase clients in master pane" $ sendMessage (IncMasterN 1))
, ("M-S-<Down>", addName "Decrease clients in master pane" $ sendMessage (IncMasterN (-1))) , ("M-S-<Down>", addName "Decrease clients in master pane" $ sendMessage (IncMasterN (-1)))
, ("M-=", addName "Increase # of windows" $ increaseLimit) , ("M-=", addName "Increase max # of windows for layout" $ increaseLimit)
, ("M--", addName "Decrease # of windows" $ decreaseLimit)] , ("M--", addName "Decrease max # of windows for layout" $ decreaseLimit)]
-- Sublayouts -- Sublayouts
-- This is used to push windows to tabbed sublayouts, or pull them out of it. -- This is used to push windows to tabbed sublayouts, or pull them out of it.
@ -631,7 +638,6 @@ myKeys c =
, ("M-u h", addName "mocp prev" $ spawn "mocp --previous") , ("M-u h", addName "mocp prev" $ spawn "mocp --previous")
, ("M-u <Space>", addName "mocp toggle pause" $ spawn "mocp --toggle-pause")] , ("M-u <Space>", addName "mocp toggle pause" $ spawn "mocp --toggle-pause")]
-- Grid Select (CTR-g followed by a key)
^++^ subKeys "GridSelect" ^++^ subKeys "GridSelect"
-- , ("C-g g", addName "Select favorite apps" $ runSelectedAction' defaultGSConfig gsCategories) -- , ("C-g g", addName "Select favorite apps" $ runSelectedAction' defaultGSConfig gsCategories)
[ ("M-M1-<Return>", addName "Select favorite apps" $ spawnSelected' [ ("M-M1-<Return>", addName "Select favorite apps" $ spawnSelected'