From fa5fc11530c873f726f57ce0d8d3f195855a321a Mon Sep 17 00:00:00 2001 From: Derek Taylor Date: Fri, 23 Apr 2021 08:26:54 -0500 Subject: [PATCH] Cleanup xmonad; fix broken path in xmobar configs. --- .config/xmobar/xmobarrc0 | 2 +- .config/xmobar/xmobarrc1 | 2 +- .config/xmobar/xmobarrc2 | 2 +- .xmonad/README.org | 72 ++++++++++++---------------------------- .xmonad/xmonad.hs | 46 ++++++++++--------------- 5 files changed, 42 insertions(+), 82 deletions(-) diff --git a/.config/xmobar/xmobarrc0 b/.config/xmobar/xmobarrc0 index ab23fc3..487e04c 100755 --- a/.config/xmobar/xmobarrc0 +++ b/.config/xmobar/xmobarrc0 @@ -27,7 +27,7 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t , Run DiskU [("/", "\xf0c7 hdd: free")] [] 60 -- Runs custom script to check for pacman updates. -- This script is in my dotfiles repo in .local/bin. - , Run Com "~/.local/bin/pacupdate" [] "pacupdate" 36000 + , Run Com "/home/dt/.local/bin/pacupdate" [] "pacupdate" 36000 -- Runs a standard shell command 'uname -r' to get kernel version , Run Com "uname" ["-r"] "" 3600 -- Prints out the left side items such as workspaces, layout, etc. diff --git a/.config/xmobar/xmobarrc1 b/.config/xmobar/xmobarrc1 index f70b531..62e53a1 100755 --- a/.config/xmobar/xmobarrc1 +++ b/.config/xmobar/xmobarrc1 @@ -27,7 +27,7 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t , Run DiskU [("/", "\xf0c7 hdd: free")] [] 60 -- Runs custom script to check for pacman updates. -- This script is in my dotfiles repo in .local/bin. - , Run Com "~/.local/bin/pacupdate" [] "pacupdate" 36000 + , Run Com "/home/dt/.local/bin/pacupdate" [] "pacupdate" 36000 -- Runs a standard shell command 'uname -r' to get kernel version , Run Com "uname" ["-r"] "" 3600 -- Prints out the left side items such as workspaces, layout, etc. diff --git a/.config/xmobar/xmobarrc2 b/.config/xmobar/xmobarrc2 index 2e552f5..b9bb55e 100755 --- a/.config/xmobar/xmobarrc2 +++ b/.config/xmobar/xmobarrc2 @@ -27,7 +27,7 @@ Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=t , Run DiskU [("/", "\xf0c7 hdd: free")] [] 60 -- Runs custom script to check for pacman updates. -- This script is in my dotfiles repo in .local/bin. - , Run Com "~/.local/bin/pacupdate" [] "pacupdate" 36000 + , Run Com "/home/dt/.local/bin/pacupdate" [] "pacupdate" 36000 -- Runs a standard shell command 'uname -r' to get kernel version , Run Com "uname" ["-r"] "" 3600 -- Script that dynamically adjusts xmobar padding depending on number of trayer icons. diff --git a/.xmonad/README.org b/.xmonad/README.org index 02401cd..4002f4a 100644 --- a/.xmonad/README.org +++ b/.xmonad/README.org @@ -133,32 +133,10 @@ myNormColor = "#282c34" -- Border color of normal windows myFocusColor :: String myFocusColor = "#46d9ff" -- Border color of focused windows -altMask :: KeyMask -altMask = mod1Mask -- Setting this for use in xprompts - windowCount :: X (Maybe String) windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset #+END_SRC -#+RESULTS: -#+begin_example -:37:45-56: error: - Not in scope: ‘W.integrate'’ - No module named ‘W’ is imported. - -:37:60-66: error: - Not in scope: ‘W.stack’ - No module named ‘W’ is imported. - -:37:70-80: error: - Not in scope: ‘W.workspace’ - No module named ‘W’ is imported. - -:37:84-92: error: - Not in scope: ‘W.current’ - No module named ‘W’ is imported. -#+end_example - * Autostart (The Startup Hook) These are commands we want XMonad to execute on startup, such as running a compositor, setting our wallpaper, starting the emacs daemon, and starting our system tray and the applications that belong in it. @@ -236,7 +214,10 @@ myAppGrid = [ ("Audacity", "audacity") #+END_SRC * Scratchpads -Allows to have several floating scratchpads running different applications. Import Util.NamedScratchpad and bind a key to namedScratchpadSpawnAction. In the example below, I create two named scratchpads: (1) a scratchpad for my terminal, and (2) a scratchpad for moc which is a terminal music player. +Allows to have several floating scratchpads running different applications. Import Util.NamedScratchpad and bind a key to namedScratchpadSpawnAction. In the example below, I have created named scratchpads for: ++ alacritty -- my terminal ++ mocp -- a terminal music player ++ qalculate-gtk -- a nice calculator #+BEGIN_SRC haskell myScratchPads :: [NamedScratchpad] @@ -424,7 +405,8 @@ myManageHook = composeAll , className =? "Gimp" --> doShift ( myWorkspaces !! 8 ) , className =? "VirtualBox Manager" --> doShift ( myWorkspaces !! 4 ) , (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog - ] <+> namedScratchpadManageHook myScratchPads + , isFullscreen --> doFullFloat + ] <+> namedScratchpadManageHook myScratchPads #+END_SRC * Keybindings @@ -464,13 +446,11 @@ myKeys = , ("M-S-q", io exitSuccess) -- Quits xmonad -- Run Prompt - -- M-p was the default keybinding. I've changed it to M-S-RET because I will use - -- M-p as part of the keychord for the other dmenu script bindings. , ("M-S-", spawn "dmenu_run -i -p \"Run: \"") -- Dmenu -- 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. + -- launch dmenu_run, so I've decided to use M-p plus KEY for these dmenu scripts. , ("M-p c", spawn "~/dmscripts/dcolors") -- pick color from our scheme , ("M-p e", spawn "~/dmscripts/dmconf") -- edit config files , ("M-p i", spawn "~/dmscripts/dmscrot") -- screenshots (images) @@ -503,10 +483,10 @@ myKeys = , ("M-S-t", sinkAll) -- Push ALL floating windows to tile -- Increase/decrease spacing (gaps) - , ("M-d", decWindowSpacing 4) -- Decrease window spacing - , ("M-i", incWindowSpacing 4) -- Increase window spacing - , ("M-S-d", decScreenSpacing 4) -- Decrease screen spacing - , ("M-S-i", incScreenSpacing 4) -- Increase screen spacing + , ("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) , ("C-g g", spawnSelected' myAppGrid) -- grid select favorite apps @@ -526,10 +506,6 @@ myKeys = -- Layouts , ("M-", sendMessage NextLayout) -- Switch to next layout - , ("M-C-M1-", sendMessage Arrange) - , ("M-C-M1-", sendMessage DeArrange) - , ("M-S-", sendMessage ToggleStruts) -- Toggles struts - , ("M-S-n", sendMessage $ MT.Toggle NOBORDERS) -- Toggles noborder , ("M-", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts) -- Toggles noborder/full -- Increase/decrease windows in the master pane or the stack @@ -597,15 +573,15 @@ myKeys = , ("", spawn (myTerminal ++ "mocp --play")) , ("", spawn (myTerminal ++ "mocp --previous")) , ("", spawn (myTerminal ++ "mocp --next")) - , ("", spawn "amixer set Master toggle") + , ("", spawn "amixer set Master toggle") , ("", spawn "amixer set Master 5%- unmute") , ("", spawn "amixer set Master 5%+ unmute") - , ("", spawn "firefox") - , ("", safeSpawn "firefox" ["https://www.duckduckgo.com/"]) + , ("", spawn "qutebrowser https://www.youtube.com/c/DistroTube") + , ("", spawn "dmsearch") , ("", runOrRaise "thunderbird" (resource =? "thunderbird")) , ("", runOrRaise "qalculate-gtk" (resource =? "qalculate-gtk")) , ("", spawn "toggleeject") - , ("", spawn "scrotd 0") + , ("", spawn "dmscrot") ] -- The following lines are needed for named scratchpads. where nonNSP = WSIs (return (\ws -> W.tag ws /= "NSP")) @@ -624,17 +600,13 @@ main = do xmproc2 <- spawnPipe "xmobar -x 2 $HOME/.config/xmobar/xmobarrc1" -- the xmonad, ya know...what the WM is named after! xmonad $ ewmh def - { manageHook = ( isFullscreen --> doFullFloat ) <+> myManageHook <+> manageDocks - -- Run xmonad commands from command line with "xmonadctl command". Commands include: - -- shrink, expand, next-layout, default-layout, restart-wm, xterm, kill, refresh, run, - -- focus-up, focus-down, swap-up, swap-down, swap-master, sink, quit-wm. You can run - -- "xmonadctl 0" to generate full list of commands written to ~/.xsession-errors. - -- To compile xmonadctl: ghc -dynamic xmonadctl.hs - , handleEventHook = serverModeEventHookCmd - <+> serverModeEventHook - <+> serverModeEventHookF "XMONAD_PRINT" (io . putStrLn) - <+> docksEventHook - <+> fullscreenEventHook -- this does NOT work right if using multi-monitors! + { manageHook = myManageHook <+> manageDocks + , handleEventHook = docksEventHook + -- Uncomment this line to enable fullscreen support on things like YouTube/Netflix. + -- This works perfect on SINGLE monitor systems. On multi-monitor systems, + -- it adds a border around the window if screen does not have focus. So, my solution + -- is to use a keybinding to toggle fullscreen noborders instead. (M-) + -- <+> fullscreenEventHook , modMask = myModMask , terminal = myTerminal , startupHook = myStartupHook diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index f17b372..598cc09 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -93,9 +93,6 @@ myNormColor = "#282c34" -- Border color of normal windows myFocusColor :: String myFocusColor = "#46d9ff" -- Border color of focused windows -altMask :: KeyMask -altMask = mod1Mask -- Setting this for use in xprompts - windowCount :: X (Maybe String) windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset @@ -332,6 +329,7 @@ myManageHook = composeAll , className =? "Gimp" --> doShift ( myWorkspaces !! 8 ) , className =? "VirtualBox Manager" --> doShift ( myWorkspaces !! 4 ) , (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog + , isFullscreen --> doFullFloat ] <+> namedScratchpadManageHook myScratchPads myKeys :: [(String, X ())] @@ -342,13 +340,11 @@ myKeys = , ("M-S-q", io exitSuccess) -- Quits xmonad -- Run Prompt - -- M-p was the default keybinding. I've changed it to M-S-RET because I will use - -- M-p as part of the keychord for the other dmenu script bindings. , ("M-S-", spawn "dmenu_run -i -p \"Run: \"") -- Dmenu -- 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. + -- launch dmenu_run, so I've decided to use M-p plus KEY for these dmenu scripts. , ("M-p c", spawn "~/dmscripts/dcolors") -- pick color from our scheme , ("M-p e", spawn "~/dmscripts/dmconf") -- edit config files , ("M-p i", spawn "~/dmscripts/dmscrot") -- screenshots (images) @@ -381,10 +377,10 @@ myKeys = , ("M-S-t", sinkAll) -- Push ALL floating windows to tile -- Increase/decrease spacing (gaps) - , ("M-d", decWindowSpacing 4) -- Decrease window spacing - , ("M-i", incWindowSpacing 4) -- Increase window spacing - , ("M-S-d", decScreenSpacing 4) -- Decrease screen spacing - , ("M-S-i", incScreenSpacing 4) -- Increase screen spacing + , ("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) , ("C-g g", spawnSelected' myAppGrid) -- grid select favorite apps @@ -404,10 +400,6 @@ myKeys = -- Layouts , ("M-", sendMessage NextLayout) -- Switch to next layout - , ("M-C-M1-", sendMessage Arrange) - , ("M-C-M1-", sendMessage DeArrange) - , ("M-S-", sendMessage ToggleStruts) -- Toggles struts - , ("M-S-n", sendMessage $ MT.Toggle NOBORDERS) -- Toggles noborder , ("M-", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts) -- Toggles noborder/full -- Increase/decrease windows in the master pane or the stack @@ -475,15 +467,15 @@ myKeys = , ("", spawn (myTerminal ++ "mocp --play")) , ("", spawn (myTerminal ++ "mocp --previous")) , ("", spawn (myTerminal ++ "mocp --next")) - , ("", spawn "amixer set Master toggle") + , ("", spawn "amixer set Master toggle") , ("", spawn "amixer set Master 5%- unmute") , ("", spawn "amixer set Master 5%+ unmute") - , ("", spawn "firefox") - , ("", safeSpawn "firefox" ["https://www.duckduckgo.com/"]) + , ("", spawn "qutebrowser https://www.youtube.com/c/DistroTube") + , ("", spawn "dmsearch") , ("", runOrRaise "thunderbird" (resource =? "thunderbird")) , ("", runOrRaise "qalculate-gtk" (resource =? "qalculate-gtk")) , ("", spawn "toggleeject") - , ("", spawn "scrotd 0") + , ("", spawn "dmscrot") ] -- The following lines are needed for named scratchpads. where nonNSP = WSIs (return (\ws -> W.tag ws /= "NSP")) @@ -497,17 +489,13 @@ main = do xmproc2 <- spawnPipe "xmobar -x 2 $HOME/.config/xmobar/xmobarrc1" -- the xmonad, ya know...what the WM is named after! xmonad $ ewmh def - { manageHook = ( isFullscreen --> doFullFloat ) <+> myManageHook <+> manageDocks - -- Run xmonad commands from command line with "xmonadctl command". Commands include: - -- shrink, expand, next-layout, default-layout, restart-wm, xterm, kill, refresh, run, - -- focus-up, focus-down, swap-up, swap-down, swap-master, sink, quit-wm. You can run - -- "xmonadctl 0" to generate full list of commands written to ~/.xsession-errors. - -- To compile xmonadctl: ghc -dynamic xmonadctl.hs - , handleEventHook = serverModeEventHookCmd - <+> serverModeEventHook - <+> serverModeEventHookF "XMONAD_PRINT" (io . putStrLn) - <+> docksEventHook - <+> fullscreenEventHook -- this does NOT work right if using multi-monitors! + { manageHook = myManageHook <+> manageDocks + , handleEventHook = docksEventHook + -- Uncomment this line to enable fullscreen support on things like YouTube/Netflix. + -- This works perfect on SINGLE monitor systems. On multi-monitor systems, + -- it adds a border around the window if screen does not have focus. So, my solution + -- is to use a keybinding to toggle fullscreen noborders instead. (M-) + -- <+> fullscreenEventHook , modMask = myModMask , terminal = myTerminal , startupHook = myStartupHook