From 24c6a4c3f81beb0c50edf459bd2b0443de142f50 Mon Sep 17 00:00:00 2001 From: Derek Taylor Date: Fri, 6 Aug 2021 16:49:44 -0500 Subject: [PATCH] Adding xmonad_keys script to display bindings. --- .config/nitrogen/bg-saved.cfg | 6 ++--- .config/nitrogen/nitrogen.cfg | 8 +++---- .xmonad/README.org | 45 +++++++++++++++++++---------------- .xmonad/xmonad.hs | 45 +++++++++++++++++++---------------- .xmonad/xmonad_keys.sh | 15 ++++++++++++ 5 files changed, 72 insertions(+), 47 deletions(-) create mode 100755 .xmonad/xmonad_keys.sh diff --git a/.config/nitrogen/bg-saved.cfg b/.config/nitrogen/bg-saved.cfg index c72faf9..c94f977 100644 --- a/.config/nitrogen/bg-saved.cfg +++ b/.config/nitrogen/bg-saved.cfg @@ -1,14 +1,14 @@ [xin_1] -file=/home/dt/wallpapers/0277.jpg +file=/home/dt/wallpapers/wp4470198.jpg mode=0 bgcolor=#000000 [xin_0] -file=/home/dt/wallpapers/0277.jpg +file=/home/dt/wallpapers/wp4470198.jpg mode=0 bgcolor=#000000 [xin_2] -file=/home/dt/wallpapers/0277.jpg +file=/home/dt/wallpapers/wp4470198.jpg mode=0 bgcolor=#000000 diff --git a/.config/nitrogen/nitrogen.cfg b/.config/nitrogen/nitrogen.cfg index b0192ec..119ed4b 100644 --- a/.config/nitrogen/nitrogen.cfg +++ b/.config/nitrogen/nitrogen.cfg @@ -1,8 +1,8 @@ [geometry] -posx=8 -posy=28 -sizex=944 -sizey=1040 +posx=16 +posy=40 +sizex=1884 +sizey=1020 [nitrogen] view=icon diff --git a/.xmonad/README.org b/.xmonad/README.org index 9f961f0..889a3af 100644 --- a/.xmonad/README.org +++ b/.xmonad/README.org @@ -67,7 +67,7 @@ import qualified Data.Map as M import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..)) import XMonad.Hooks.EwmhDesktops -- for some fullscreen events, also for xcomposite in obs. import XMonad.Hooks.ManageDocks (avoidStruts, docksEventHook, manageDocks, ToggleStruts(..)) -import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat) +import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat, doCenterFloat) import XMonad.Hooks.ServerMode import XMonad.Hooks.SetWMName import XMonad.Hooks.WorkspaceHistory @@ -409,6 +409,7 @@ myManageHook = composeAll , className =? "pinentry-gtk-2" --> doFloat , className =? "splash" --> doFloat , className =? "toolbar" --> doFloat + , className =? "Yad" --> doCenterFloat , title =? "Oracle VM VirtualBox Manager" --> doFloat , title =? "Mozilla Firefox" --> doShift ( myWorkspaces !! 1 ) , className =? "brave-browser" --> doShift ( myWorkspaces !! 1 ) @@ -450,17 +451,19 @@ I am using the Xmonad.Util.EZConfig module which allows keybindings to be writte | MODKEY + t | force floating window back into tiling | #+BEGIN_SRC haskell +-- START_KEYS myKeys :: [(String, X ())] myKeys = - -- Xmonad + -- KB_GROUP Xmonad [ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad , ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad , ("M-S-q", io exitSuccess) -- Quits xmonad + , ("M-S-/", spawn "~/.xmonad/xmonad_keys.sh") - -- Run Prompt + -- KB_GROUP Run Prompt , ("M-S-", spawn "dmenu_run -i -p \"Run: \"") -- Dmenu - -- Other Dmenu Prompts + -- KB_GROUP Other Dmenu Prompts -- In Xmonad and many tiling window managers, M-p is the default keybinding to -- launch dmenu_run, so I've decided to use M-p plus KEY for these dmenu scripts. , ("M-p a", spawn "dm-sounds") -- choose an ambient background @@ -476,38 +479,38 @@ myKeys = , ("M-p r", spawn "dm-reddit") -- reddio (a reddit viewer) , ("M-p s", spawn "dm-websearch") -- search various search engines - -- Useful programs to have a keybinding for launch + -- KB_GROUP Useful programs to have a keybinding for launch , ("M-", spawn (myTerminal)) , ("M-b", spawn (myBrowser ++ " www.youtube.com/c/DistroTube/")) , ("M-M1-h", spawn (myTerminal ++ " -e htop")) - -- Kill windows + -- KB_GROUP Kill windows , ("M-S-c", kill1) -- Kill the currently focused client , ("M-S-a", killAll) -- Kill all windows on current workspace - -- Workspaces + -- KB_GROUP Workspaces , ("M-.", nextScreen) -- Switch focus to next monitor , ("M-,", prevScreen) -- Switch focus to prev monitor , ("M-S-", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws , ("M-S-", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws - -- Floating windows + -- KB_GROUP Floating windows , ("M-f", sendMessage (T.Toggle "floats")) -- Toggles my 'floats' layout , ("M-t", withFocused $ windows . W.sink) -- Push floating window back to tile , ("M-S-t", sinkAll) -- Push ALL floating windows to tile - -- Increase/decrease spacing (gaps) + -- KB_GROUP Increase/decrease spacing (gaps) , ("C-M1-j", decWindowSpacing 4) -- Decrease window spacing , ("C-M1-k", incWindowSpacing 4) -- Increase window spacing , ("C-M1-h", decScreenSpacing 4) -- Decrease screen spacing , ("C-M1-l", incScreenSpacing 4) -- Increase screen spacing - -- Grid Select (CTR-g followed by a key) + -- KB_GROUP Grid Select (CTR-g followed by a key) , ("C-g g", spawnSelected' myAppGrid) -- grid select favorite apps , ("C-g t", goToSelected $ mygridConfig myColorizer) -- goto selected window , ("C-g b", bringSelected $ mygridConfig myColorizer) -- bring selected window - -- Windows navigation + -- KB_GROUP Windows navigation , ("M-m", windows W.focusMaster) -- Move focus to the master window , ("M-j", windows W.focusDown) -- Move focus to the next window , ("M-k", windows W.focusUp) -- Move focus to the prev window @@ -518,23 +521,23 @@ myKeys = , ("M-S-", rotSlavesDown) -- Rotate all windows except master and keep focus in place , ("M-C-", rotAllDown) -- Rotate all the windows in the current stack - -- Layouts + -- KB_GROUP Layouts , ("M-", sendMessage NextLayout) -- Switch to next layout , ("M-", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts) -- Toggles noborder/full - -- Increase/decrease windows in the master pane or the stack + -- KB_GROUP Increase/decrease windows in the master pane or the stack , ("M-S-", sendMessage (IncMasterN 1)) -- Increase # of clients master pane , ("M-S-", sendMessage (IncMasterN (-1))) -- Decrease # of clients master pane , ("M-C-", increaseLimit) -- Increase # of windows , ("M-C-", decreaseLimit) -- Decrease # of windows - -- Window resizing + -- KB_GROUP Window resizing , ("M-h", sendMessage Shrink) -- Shrink horiz window width , ("M-l", sendMessage Expand) -- Expand horiz window width , ("M-M1-j", sendMessage MirrorShrink) -- Shrink vert window width , ("M-M1-k", sendMessage MirrorExpand) -- Expand vert window width - -- Sublayouts + -- KB_GROUP Sublayouts -- This is used to push windows to tabbed sublayouts, or pull them out of it. , ("M-C-h", sendMessage $ pullGroup L) , ("M-C-l", sendMessage $ pullGroup R) @@ -546,7 +549,7 @@ myKeys = , ("M-C-.", onGroup W.focusUp') -- Switch focus to next tab , ("M-C-,", onGroup W.focusDown') -- Switch focus to prev tab - -- Scratchpads + -- KB_GROUP Scratchpads -- Toggle show/hide these programs. They run on a hidden workspace. -- When you toggle them to show, it brings them to your current workspace. -- Toggle them to hide and it sends them back to hidden workspace (NSP). @@ -554,19 +557,20 @@ myKeys = , ("C-s m", namedScratchpadAction myScratchPads "mocp") , ("C-s c", namedScratchpadAction myScratchPads "calculator") + -- KB_GROUP Set wallpaper -- Set wallpaper with 'feh'. Type 'SUPER+F1' to launch sxiv in the wallpapers directory. -- Then in sxiv, type 'C-x w' to set the wallpaper that you choose. , ("M-", spawn "sxiv -r -q -t -o ~/wallpapers/*") , ("M-", spawn "find ~/wallpapers/ -type f | shuf -n 1 | xargs xwallpaper --stretch") - --, ("M-", spawn "feh --randomize --bg-fill ~/wallpapers/*") + -- , ("M-", spawn "feh --randomize --bg-fill ~/wallpapers/*") - -- Controls for mocp music player (SUPER-u followed by a key) + -- KB_GROUP Controls for mocp music player (SUPER-u followed by a key) , ("M-u p", spawn "mocp --play") , ("M-u l", spawn "mocp --next") , ("M-u h", spawn "mocp --previous") , ("M-u ", spawn "mocp --toggle-pause") - -- Emacs (CTRL-e followed by a key) + -- KB_GROUP Emacs (CTRL-e followed by a key) -- , ("C-e e", spawn myEmacs) -- start emacs , ("C-e e", spawn (myEmacs ++ ("--eval '(dashboard-refresh-buffer)'"))) -- emacs dashboard , ("C-e b", spawn (myEmacs ++ ("--eval '(ibuffer)'"))) -- list buffers @@ -583,7 +587,7 @@ myKeys = -- emms is an emacs audio player. I set it to auto start playing in a specific directory. , ("C-e a", spawn (myEmacs ++ ("--eval '(emms)' --eval '(emms-play-directory-tree \"~/Music/Non-Classical/70s-80s/\")'"))) - -- Multimedia Keys + -- KB_GROUP Multimedia Keys , ("", spawn (myTerminal ++ "mocp --play")) , ("", spawn (myTerminal ++ "mocp --previous")) , ("", spawn (myTerminal ++ "mocp --next")) @@ -600,6 +604,7 @@ myKeys = -- The following lines are needed for named scratchpads. where nonNSP = WSIs (return (\ws -> W.tag ws /= "NSP")) nonEmptyNonNSP = WSIs (return (\ws -> isJust (W.stack ws) && W.tag ws /= "NSP")) +-- END_KEYS #+END_SRC * Main diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index fcb3367..8e3104c 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -28,7 +28,7 @@ import qualified Data.Map as M import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..)) import XMonad.Hooks.EwmhDesktops -- for some fullscreen events, also for xcomposite in obs. import XMonad.Hooks.ManageDocks (avoidStruts, docksEventHook, manageDocks, ToggleStruts(..)) -import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat) +import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat, doCenterFloat) import XMonad.Hooks.ServerMode import XMonad.Hooks.SetWMName import XMonad.Hooks.WorkspaceHistory @@ -329,6 +329,7 @@ myManageHook = composeAll , className =? "pinentry-gtk-2" --> doFloat , className =? "splash" --> doFloat , className =? "toolbar" --> doFloat + , className =? "Yad" --> doCenterFloat , title =? "Oracle VM VirtualBox Manager" --> doFloat , title =? "Mozilla Firefox" --> doShift ( myWorkspaces !! 1 ) , className =? "brave-browser" --> doShift ( myWorkspaces !! 1 ) @@ -340,17 +341,19 @@ myManageHook = composeAll , isFullscreen --> doFullFloat ] <+> namedScratchpadManageHook myScratchPads +-- START_KEYS myKeys :: [(String, X ())] myKeys = - -- Xmonad + -- KB_GROUP Xmonad [ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad , ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad , ("M-S-q", io exitSuccess) -- Quits xmonad + , ("M-S-/", spawn "~/.xmonad/xmonad_keys.sh") - -- Run Prompt + -- KB_GROUP Run Prompt , ("M-S-", spawn "dmenu_run -i -p \"Run: \"") -- Dmenu - -- Other Dmenu Prompts + -- KB_GROUP Other Dmenu Prompts -- In Xmonad and many tiling window managers, M-p is the default keybinding to -- launch dmenu_run, so I've decided to use M-p plus KEY for these dmenu scripts. , ("M-p a", spawn "dm-sounds") -- choose an ambient background @@ -366,38 +369,38 @@ myKeys = , ("M-p r", spawn "dm-reddit") -- reddio (a reddit viewer) , ("M-p s", spawn "dm-websearch") -- search various search engines - -- Useful programs to have a keybinding for launch + -- KB_GROUP Useful programs to have a keybinding for launch , ("M-", spawn (myTerminal)) , ("M-b", spawn (myBrowser ++ " www.youtube.com/c/DistroTube/")) , ("M-M1-h", spawn (myTerminal ++ " -e htop")) - -- Kill windows + -- KB_GROUP Kill windows , ("M-S-c", kill1) -- Kill the currently focused client , ("M-S-a", killAll) -- Kill all windows on current workspace - -- Workspaces + -- KB_GROUP Workspaces , ("M-.", nextScreen) -- Switch focus to next monitor , ("M-,", prevScreen) -- Switch focus to prev monitor , ("M-S-", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws , ("M-S-", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws - -- Floating windows + -- KB_GROUP Floating windows , ("M-f", sendMessage (T.Toggle "floats")) -- Toggles my 'floats' layout , ("M-t", withFocused $ windows . W.sink) -- Push floating window back to tile , ("M-S-t", sinkAll) -- Push ALL floating windows to tile - -- Increase/decrease spacing (gaps) + -- KB_GROUP Increase/decrease spacing (gaps) , ("C-M1-j", decWindowSpacing 4) -- Decrease window spacing , ("C-M1-k", incWindowSpacing 4) -- Increase window spacing , ("C-M1-h", decScreenSpacing 4) -- Decrease screen spacing , ("C-M1-l", incScreenSpacing 4) -- Increase screen spacing - -- Grid Select (CTR-g followed by a key) + -- KB_GROUP Grid Select (CTR-g followed by a key) , ("C-g g", spawnSelected' myAppGrid) -- grid select favorite apps , ("C-g t", goToSelected $ mygridConfig myColorizer) -- goto selected window , ("C-g b", bringSelected $ mygridConfig myColorizer) -- bring selected window - -- Windows navigation + -- KB_GROUP Windows navigation , ("M-m", windows W.focusMaster) -- Move focus to the master window , ("M-j", windows W.focusDown) -- Move focus to the next window , ("M-k", windows W.focusUp) -- Move focus to the prev window @@ -408,23 +411,23 @@ myKeys = , ("M-S-", rotSlavesDown) -- Rotate all windows except master and keep focus in place , ("M-C-", rotAllDown) -- Rotate all the windows in the current stack - -- Layouts + -- KB_GROUP Layouts , ("M-", sendMessage NextLayout) -- Switch to next layout , ("M-", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts) -- Toggles noborder/full - -- Increase/decrease windows in the master pane or the stack + -- KB_GROUP Increase/decrease windows in the master pane or the stack , ("M-S-", sendMessage (IncMasterN 1)) -- Increase # of clients master pane , ("M-S-", sendMessage (IncMasterN (-1))) -- Decrease # of clients master pane , ("M-C-", increaseLimit) -- Increase # of windows , ("M-C-", decreaseLimit) -- Decrease # of windows - -- Window resizing + -- KB_GROUP Window resizing , ("M-h", sendMessage Shrink) -- Shrink horiz window width , ("M-l", sendMessage Expand) -- Expand horiz window width , ("M-M1-j", sendMessage MirrorShrink) -- Shrink vert window width , ("M-M1-k", sendMessage MirrorExpand) -- Expand vert window width - -- Sublayouts + -- KB_GROUP Sublayouts -- This is used to push windows to tabbed sublayouts, or pull them out of it. , ("M-C-h", sendMessage $ pullGroup L) , ("M-C-l", sendMessage $ pullGroup R) @@ -436,7 +439,7 @@ myKeys = , ("M-C-.", onGroup W.focusUp') -- Switch focus to next tab , ("M-C-,", onGroup W.focusDown') -- Switch focus to prev tab - -- Scratchpads + -- KB_GROUP Scratchpads -- Toggle show/hide these programs. They run on a hidden workspace. -- When you toggle them to show, it brings them to your current workspace. -- Toggle them to hide and it sends them back to hidden workspace (NSP). @@ -444,19 +447,20 @@ myKeys = , ("C-s m", namedScratchpadAction myScratchPads "mocp") , ("C-s c", namedScratchpadAction myScratchPads "calculator") + -- KB_GROUP Set wallpaper -- Set wallpaper with 'feh'. Type 'SUPER+F1' to launch sxiv in the wallpapers directory. -- Then in sxiv, type 'C-x w' to set the wallpaper that you choose. , ("M-", spawn "sxiv -r -q -t -o ~/wallpapers/*") , ("M-", spawn "find ~/wallpapers/ -type f | shuf -n 1 | xargs xwallpaper --stretch") - --, ("M-", spawn "feh --randomize --bg-fill ~/wallpapers/*") + -- , ("M-", spawn "feh --randomize --bg-fill ~/wallpapers/*") - -- Controls for mocp music player (SUPER-u followed by a key) + -- KB_GROUP Controls for mocp music player (SUPER-u followed by a key) , ("M-u p", spawn "mocp --play") , ("M-u l", spawn "mocp --next") , ("M-u h", spawn "mocp --previous") , ("M-u ", spawn "mocp --toggle-pause") - -- Emacs (CTRL-e followed by a key) + -- KB_GROUP Emacs (CTRL-e followed by a key) -- , ("C-e e", spawn myEmacs) -- start emacs , ("C-e e", spawn (myEmacs ++ ("--eval '(dashboard-refresh-buffer)'"))) -- emacs dashboard , ("C-e b", spawn (myEmacs ++ ("--eval '(ibuffer)'"))) -- list buffers @@ -473,7 +477,7 @@ myKeys = -- emms is an emacs audio player. I set it to auto start playing in a specific directory. , ("C-e a", spawn (myEmacs ++ ("--eval '(emms)' --eval '(emms-play-directory-tree \"~/Music/Non-Classical/70s-80s/\")'"))) - -- Multimedia Keys + -- KB_GROUP Multimedia Keys , ("", spawn (myTerminal ++ "mocp --play")) , ("", spawn (myTerminal ++ "mocp --previous")) , ("", spawn (myTerminal ++ "mocp --next")) @@ -490,6 +494,7 @@ myKeys = -- The following lines are needed for named scratchpads. where nonNSP = WSIs (return (\ws -> W.tag ws /= "NSP")) nonEmptyNonNSP = WSIs (return (\ws -> isJust (W.stack ws) && W.tag ws /= "NSP")) +-- END_KEYS main :: IO () main = do diff --git a/.xmonad/xmonad_keys.sh b/.xmonad/xmonad_keys.sh new file mode 100755 index 0000000..f9d9b3a --- /dev/null +++ b/.xmonad/xmonad_keys.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + + +sed -n '/START_KEYS/,/END_KEYS/p' ~/.xmonad/xmonad.hs | \ + grep -e ', ("' \ + -e '\[ (' \ + -e 'KB_GROUP' | \ + grep -v '\-\- , ("' | \ + sed -e 's/^[ \t]*//' \ + -e 's/, (/(/' \ + -e 's/\[ (/(/' \ + -e 's/-- KB_GROUP /\n/' \ + -e 's/", /"\t: /' | \ + yad --text-info --back=#282c34 --fore=#46d9ff --geometry=1200x800