Minor edits

This commit is contained in:
Derek Taylor
2020-10-23 20:39:58 -05:00
parent eac13c0169
commit d94dcaed8e
9 changed files with 814 additions and 498 deletions

View File

@@ -29,16 +29,14 @@
#+ATTR_HTML: :alt XMonad Scrot :title XMonad Scrot :align left
[[https://gitlab.com/dwt1/dotfiles/-/raw/master/.screenshots/dotfiles05-thumb.png]]
Xmonad is a dynamically tiling X11 window manager that is written and
configured in Haskell. Official documentation: [[https://xmonad.org][https://xmonad.org]]
Xmonad is a dynamically tiling X11 window manager that is written and configured in Haskell.
- XMonad Official Website: [[https://xmonad.org][https://xmonad.org]]
This is the xmonad configuration of Derek Taylor (DistroTube)
- My YouTube: [[http://www.youtube.com/c/DistroTube][http://www.youtube.com/c/DistroTube]]
- My GitLab: [[http://www.gitlab.com/dwt1/][http://www.gitlab.com/dwt1/]]
Keep in mind, that my configs are purposely bloated with examples of
what you can do with xmonad. It is written more as a study guide rather
than a config that you should download and use.
Keep in mind, that my configs are purposely bloated with examples of what you can do with xmonad. It is written more as a study guide rather than a config that you should download and use.
* Imports
These are Haskell modules that we must import so that we can use their functions later in the config.
@@ -112,7 +110,7 @@ import XMonad.Prompt.Ssh
import XMonad.Prompt.XMonad
import Control.Arrow (first)
-- Utilities
-- Utilities
import XMonad.Util.EZConfig (additionalKeysP)
import XMonad.Util.NamedScratchpad
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
@@ -120,9 +118,7 @@ import XMonad.Util.SpawnOnce
#+END_SRC
* Variables
It's nice to assign values to stuff that you will use more than once
in the config. Setting values for things like font, terminal and editor
means you only have to change the value here to make changes globally.
It's nice to assign values to stuff that you will use more than once in the config. Setting values for things like font, terminal and editor means you only have to change the value here to make changes globally.
#+BEGIN_SRC haskell
myFont :: String
@@ -175,8 +171,7 @@ myStartupHook = do
#+END_SRC
* Gridselect
GridSelect displays items (programs, open windows, etc.) in a 2D grid
and lets the user select from it with the cursor/hjkl keys or the mouse.
GridSelect displays items (programs, open windows, etc.) in a 2D grid and lets the user select from it with the cursor/hjkl keys or the mouse.
#+BEGIN_SRC haskell
myColorizer :: Window -> Bool -> X (String, String)
@@ -225,10 +220,7 @@ myAppGrid = [ ("Audacity", "audacity")
#+END_SRC
* Treeselect
TreeSelect displays your workspaces or actions in a Tree-like format.
You can select desired workspace/action with the cursor or hjkl keys.
My TreeSelect menu is rather large and includes a mixture of applications,
web bookmarks, configuration files and xmonad actions.
TreeSelect displays your workspaces or actions in a Tree-like format. You can select desired workspace/action with the cursor or hjkl keys. My TreeSelect menu is rather large and includes a mixture of applications, web bookmarks, configuration files and xmonad actions.
** Treeselect Menu Entries
#+BEGIN_SRC haskell
@@ -484,11 +476,7 @@ treeselectAction a = TS.treeselectAction a
#+END_SRC
** Treeselect Settings
Configuration options for the treeSelect menus.
Keybindings for treeSelect menus. Use h-j-k-l to navigate.
Use 'o' and 'i' to move forward/back in the workspace history.
Single KEY's are for top-level nodes. SUPER+KEY are for the
second-level nodes. SUPER+ALT+KEY are third-level nodes.
Configuration options for the treeSelect menus. Keybindings for treeSelect menus. Use h-j-k-l to navigate. Use 'o' and 'i' to move forward/back in the workspace history. Single KEY's are for top-level nodes. SUPER+KEY are for the second-level nodes. SUPER+ALT+KEY are third-level nodes.
#+BEGIN_SRC haskell
tsDefaultConfig :: TS.TSConfig a
@@ -521,6 +509,25 @@ myTreeNavigation = M.fromList
, ((0, xK_l), TS.moveChild)
, ((0, xK_o), TS.moveHistBack)
, ((0, xK_i), TS.moveHistForward)
, ((0, xK_a), TS.moveTo ["+ Accessories"])
, ((0, xK_e), TS.moveTo ["+ Games"])
, ((0, xK_g), TS.moveTo ["+ Graphics"])
, ((0, xK_i), TS.moveTo ["+ Internet"])
, ((0, xK_m), TS.moveTo ["+ Multimedia"])
, ((0, xK_o), TS.moveTo ["+ Office"])
, ((0, xK_p), TS.moveTo ["+ Programming"])
, ((0, xK_s), TS.moveTo ["+ System"])
, ((0, xK_b), TS.moveTo ["+ Bookmarks"])
, ((0, xK_c), TS.moveTo ["+ Config Files"])
, ((0, xK_r), TS.moveTo ["+ Screenshots"])
, ((mod4Mask, xK_l), TS.moveTo ["+ Bookmarks", "+ Linux"])
, ((mod4Mask, xK_e), TS.moveTo ["+ Bookmarks", "+ Emacs"])
, ((mod4Mask, xK_s), TS.moveTo ["+ Bookmarks", "+ Search and Reference"])
, ((mod4Mask, xK_p), TS.moveTo ["+ Bookmarks", "+ Programming"])
, ((mod4Mask, xK_v), TS.moveTo ["+ Bookmarks", "+ Vim"])
, ((mod4Mask .|. altMask, xK_a), TS.moveTo ["+ Bookmarks", "+ Linux", "+ Arch Linux"])
, ((mod4Mask .|. altMask, xK_n), TS.moveTo ["+ Bookmarks", "+ Linux", "+ Linux News"])
, ((mod4Mask .|. altMask, xK_w), TS.moveTo ["+ Bookmarks", "+ Linux", "+ Window Managers"])
]
#+END_SRC
@@ -577,8 +584,7 @@ promptList' = [ ("c", calcPrompt, "qalc") -- requires qalculate-gtk
#+END_SRC
** Custom Prompts
calcPrompt requires a cli calculator called qalcualte-gtk.
You could use this as a template for other custom prompts that
calcPrompt requires a cli calculator called qalcualte-gtk. You could use this as a template for other custom prompts that use command line programs that return a single line of output.
#+BEGIN_SRC haskell
calcPrompt c ans =
@@ -635,9 +641,7 @@ dtXPKeymap = M.fromList $
#+END_SRC
** Search Engines
Xmonad has several search engines available to use located in
XMonad.Actions.Search. Additionally, you can add other search engines
such as those listed below.
Xmonad has several search engines available to use located in XMonad.Actions.Search. Additionally, you can add other search engines such as those listed below.
#+BEGIN_SRC haskell
archwiki, ebay, news, reddit, urban :: S.SearchEngine
@@ -671,8 +675,7 @@ searchList = [ ("a", archwiki)
#+END_SRC
* Scratchpads
Allows to have several floating scratchpads running different applications.
Import Util.NamedScratchpad. Bind a key to namedScratchpadSpawnAction.
Allows to have several floating scratchpads running different applications. Import Util.NamedScratchpad. Bind a key to namedScratchpadSpawnAction.
#+BEGIN_SRC haskell
myScratchPads :: [NamedScratchpad]
@@ -699,8 +702,7 @@ myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
#+END_SRC
* Layouts
Makes setting the spacingRaw simpler to write. The spacingRaw
module adds a configurable amount of space around windows.
Makes setting the spacingRaw simpler to write. The spacingRaw module adds a configurable amount of space around windows.
#+BEGIN_SRC haskell
mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
@@ -784,11 +786,7 @@ myLayoutHook = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts float
#+END_SRC
* Workspaces
My workspaces are clickable meaning that the mouse can be used to switch
workspaces. This requires xdotool. You need to use UnsafeStdInReader instead
of simply StdInReader in xmobar config so you can pass actions to it. Also,
you will notice I add <fn> tags to the clickable workspaces to select from
the additionalFonts that I have set in my xmobar configs.
My workspaces are clickable meaning that the mouse can be used to switch workspaces. This requires xdotool. You need to use UnsafeStdInReader instead of simply StdInReader in xmobar config so you can pass actions to it. Also, you will notice I add <fn> tags to the clickable workspaces to select from the additionalFonts that I have set in my xmobar configs.
#+BEGIN_SRC haskell
xmobarEscape :: String -> String
@@ -808,11 +806,7 @@ myWorkspaces = clickable . (map xmobarEscape)
#+END_SRC
* Managehook
Sets some rules for certain programs. Examples include forcing certain
programs to always float, or to always appear on a certain workspace.
Forcing programs to a certain workspace with a doShift requires xdotool
if you are using clickable workspaces. You need the className or title
of the program. Use xprop to get this info.
Sets some rules for certain programs. Examples include forcing certain programs to always float, or to always appear on a certain workspace. Forcing programs to a certain workspace with a doShift requires xdotool if you are using clickable workspaces. You need the className or title of the program. Use xprop to get this info.
#+BEGIN_SRC haskell
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
@@ -820,7 +814,7 @@ myManageHook = composeAll
-- using 'doShift ( myWorkspaces !! 7)' sends program to workspace 8!
-- I'm doing it this way because otherwise I would have to write out
-- the full name of my workspaces.
[ className =? "htop" --> doShift ( myWorkspaces !! 7 )
[ className =? "htop" --> doShift ( myWorkspaces !! 7 )
, title =? "firefox" --> doShift ( myWorkspaces !! 1 )
, className =? "mpv" --> doShift ( myWorkspaces !! 7 )
-- , className =? "vlc" --> doShift ( myWorkspaces !! 7 )
@@ -833,9 +827,7 @@ myManageHook = composeAll
#+END_SRC
* Loghook
Sets opacity for inactive (unfocused) windows. I prefer to not use
this feature so I've set opacity to 1.0. If you want opacity, set
this to a value of less than 1 (such as 0.9 for 90% opacity).
Sets opacity for inactive (unfocused) windows. I prefer to not use this feature so I've set opacity to 1.0. If you want opacity, set this to a value of less than 1 (such as 0.9 for 90% opacity).
#+BEGIN_SRC haskell
myLogHook :: X ()
@@ -878,7 +870,7 @@ myKeys =
, ("M-S-q", io exitSuccess) -- Quits xmonad
-- Open my preferred terminal
, ("M-<Return>", spawn myTerminal)
, ("M-<Return>", spawn (myTerminal ++ " -e fish"))
-- Run Prompt
, ("M-S-<Return>", shellPrompt dtXPConfig) -- Shell Prompt
@@ -948,23 +940,23 @@ myKeys =
, ("M-u <Space>", spawn "mocp --toggle-pause")
-- Emacs (CTRL-e followed by a key)
, ("C-e e", spawn "emacsclient -c -a ''") -- start emacs
, ("C-e b", spawn "emacsclient -c -a '' --eval '(ibuffer)'") -- list emacs buffers
, ("C-e d", spawn "emacsclient -c -a '' --eval '(dired nil)'") -- dired emacs file manager
, ("C-e i", spawn "emacsclient -c -a '' --eval '(erc)'") -- erc emacs irc client
, ("C-e m", spawn "emacsclient -c -a '' --eval '(mu4e)'") -- mu4e emacs email client
, ("C-e n", spawn "emacsclient -c -a '' --eval '(elfeed)'") -- elfeed emacs rss client
, ("C-e s", spawn "emacsclient -c -a '' --eval '(eshell)'") -- eshell within emacs
, ("C-e t", spawn "emacsclient -c -a '' --eval '(mastodon)'") -- mastodon within emacs
, ("C-e v", spawn "emacsclient -c -a '' --eval '(+vterm/here nil)'") -- vterm within emacs
, ("C-e e", spawn "emacsclient -c -a 'emacs'") -- start emacs
, ("C-e b", spawn "emacsclient -c -a 'emacs' --eval '(ibuffer)'") -- list emacs buffers
, ("C-e d", spawn "emacsclient -c -a 'emacs' --eval '(dired nil)'") -- dired emacs file manager
, ("C-e i", spawn "emacsclient -c -a 'emacs' --eval '(erc)'") -- erc emacs irc client
, ("C-e m", spawn "emacsclient -c -a 'emacs' --eval '(mu4e)'") -- mu4e emacs email client
, ("C-e n", spawn "emacsclient -c -a 'emacs' --eval '(elfeed)'") -- elfeed emacs rss client
, ("C-e s", spawn "emacsclient -c -a 'emacs' --eval '(eshell)'") -- eshell within emacs
, ("C-e t", spawn "emacsclient -c -a 'emacs' --eval '(mastodon)'") -- mastodon within emacs
, ("C-e v", spawn "emacsclient -c -a 'emacs' --eval '(+vterm/here nil)'") -- vterm within emacs
-- emms is an emacs audio player. I set it to auto start playing in a specific directory.
, ("C-e a", spawn "emacsclient -c -a '' --eval '(emms)' --eval '(emms-play-directory-tree \"~/Music/Non-Classical/70s-80s/\")'")
, ("C-e a", spawn "emacsclient -c -a 'emacs' --eval '(emms)' --eval '(emms-play-directory-tree \"~/Music/Non-Classical/70s-80s/\")'")
--- My Applications (Super+Alt+Key)
, ("M-M1-a", spawn (myTerminal ++ " -e ncpamixer"))
, ("M-M1-b", spawn "surf www.youtube.com/c/DistroTube/")
, ("M-M1-e", spawn (myTerminal ++ " -e neomutt"))
, ("M-M1-f", spawn (myTerminal ++ " -e sh ./.config/vifm/scripts/vifmrun"))
, ("M-M1-f", spawn (myTerminal ++ " -e sh ./.config/vifm/scripts/vifmrun | bash"))
, ("M-M1-i", spawn (myTerminal ++ " -e irssi"))
, ("M-M1-j", spawn (myTerminal ++ " -e joplin"))
, ("M-M1-l", spawn (myTerminal ++ " -e lynx https://distrotube.com"))

View File

@@ -66,7 +66,7 @@ import XMonad.Prompt.Ssh
import XMonad.Prompt.XMonad
import Control.Arrow (first)
-- Utilities
-- Utilities
import XMonad.Util.EZConfig (additionalKeysP)
import XMonad.Util.NamedScratchpad
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
@@ -439,6 +439,25 @@ myTreeNavigation = M.fromList
, ((0, xK_l), TS.moveChild)
, ((0, xK_o), TS.moveHistBack)
, ((0, xK_i), TS.moveHistForward)
, ((0, xK_a), TS.moveTo ["+ Accessories"])
, ((0, xK_e), TS.moveTo ["+ Games"])
, ((0, xK_g), TS.moveTo ["+ Graphics"])
, ((0, xK_i), TS.moveTo ["+ Internet"])
, ((0, xK_m), TS.moveTo ["+ Multimedia"])
, ((0, xK_o), TS.moveTo ["+ Office"])
, ((0, xK_p), TS.moveTo ["+ Programming"])
, ((0, xK_s), TS.moveTo ["+ System"])
, ((0, xK_b), TS.moveTo ["+ Bookmarks"])
, ((0, xK_c), TS.moveTo ["+ Config Files"])
, ((0, xK_r), TS.moveTo ["+ Screenshots"])
, ((mod4Mask, xK_l), TS.moveTo ["+ Bookmarks", "+ Linux"])
, ((mod4Mask, xK_e), TS.moveTo ["+ Bookmarks", "+ Emacs"])
, ((mod4Mask, xK_s), TS.moveTo ["+ Bookmarks", "+ Search and Reference"])
, ((mod4Mask, xK_p), TS.moveTo ["+ Bookmarks", "+ Programming"])
, ((mod4Mask, xK_v), TS.moveTo ["+ Bookmarks", "+ Vim"])
, ((mod4Mask .|. altMask, xK_a), TS.moveTo ["+ Bookmarks", "+ Linux", "+ Arch Linux"])
, ((mod4Mask .|. altMask, xK_n), TS.moveTo ["+ Bookmarks", "+ Linux", "+ Linux News"])
, ((mod4Mask .|. altMask, xK_w), TS.moveTo ["+ Bookmarks", "+ Linux", "+ Window Managers"])
]
dtXPConfig :: XPConfig
@@ -684,7 +703,7 @@ myManageHook = composeAll
-- using 'doShift ( myWorkspaces !! 7)' sends program to workspace 8!
-- I'm doing it this way because otherwise I would have to write out
-- the full name of my workspaces.
[ className =? "htop" --> doShift ( myWorkspaces !! 7 )
[ className =? "htop" --> doShift ( myWorkspaces !! 7 )
, title =? "firefox" --> doShift ( myWorkspaces !! 1 )
, className =? "mpv" --> doShift ( myWorkspaces !! 7 )
-- , className =? "vlc" --> doShift ( myWorkspaces !! 7 )
@@ -707,7 +726,7 @@ myKeys =
, ("M-S-q", io exitSuccess) -- Quits xmonad
-- Open my preferred terminal
, ("M-<Return>", spawn myTerminal)
, ("M-<Return>", spawn (myTerminal ++ " -e fish"))
-- Run Prompt
, ("M-S-<Return>", shellPrompt dtXPConfig) -- Shell Prompt
@@ -777,23 +796,23 @@ myKeys =
, ("M-u <Space>", spawn "mocp --toggle-pause")
-- Emacs (CTRL-e followed by a key)
, ("C-e e", spawn "emacsclient -c -a ''") -- start emacs
, ("C-e b", spawn "emacsclient -c -a '' --eval '(ibuffer)'") -- list emacs buffers
, ("C-e d", spawn "emacsclient -c -a '' --eval '(dired nil)'") -- dired emacs file manager
, ("C-e i", spawn "emacsclient -c -a '' --eval '(erc)'") -- erc emacs irc client
, ("C-e m", spawn "emacsclient -c -a '' --eval '(mu4e)'") -- mu4e emacs email client
, ("C-e n", spawn "emacsclient -c -a '' --eval '(elfeed)'") -- elfeed emacs rss client
, ("C-e s", spawn "emacsclient -c -a '' --eval '(eshell)'") -- eshell within emacs
, ("C-e t", spawn "emacsclient -c -a '' --eval '(mastodon)'") -- mastodon within emacs
, ("C-e v", spawn "emacsclient -c -a '' --eval '(+vterm/here nil)'") -- vterm within emacs
, ("C-e e", spawn "emacsclient -c -a 'emacs'") -- start emacs
, ("C-e b", spawn "emacsclient -c -a 'emacs' --eval '(ibuffer)'") -- list emacs buffers
, ("C-e d", spawn "emacsclient -c -a 'emacs' --eval '(dired nil)'") -- dired emacs file manager
, ("C-e i", spawn "emacsclient -c -a 'emacs' --eval '(erc)'") -- erc emacs irc client
, ("C-e m", spawn "emacsclient -c -a 'emacs' --eval '(mu4e)'") -- mu4e emacs email client
, ("C-e n", spawn "emacsclient -c -a 'emacs' --eval '(elfeed)'") -- elfeed emacs rss client
, ("C-e s", spawn "emacsclient -c -a 'emacs' --eval '(eshell)'") -- eshell within emacs
, ("C-e t", spawn "emacsclient -c -a 'emacs' --eval '(mastodon)'") -- mastodon within emacs
, ("C-e v", spawn "emacsclient -c -a 'emacs' --eval '(+vterm/here nil)'") -- vterm within emacs
-- emms is an emacs audio player. I set it to auto start playing in a specific directory.
, ("C-e a", spawn "emacsclient -c -a '' --eval '(emms)' --eval '(emms-play-directory-tree \"~/Music/Non-Classical/70s-80s/\")'")
, ("C-e a", spawn "emacsclient -c -a 'emacs' --eval '(emms)' --eval '(emms-play-directory-tree \"~/Music/Non-Classical/70s-80s/\")'")
--- My Applications (Super+Alt+Key)
, ("M-M1-a", spawn (myTerminal ++ " -e ncpamixer"))
, ("M-M1-b", spawn "surf www.youtube.com/c/DistroTube/")
, ("M-M1-e", spawn (myTerminal ++ " -e neomutt"))
, ("M-M1-f", spawn (myTerminal ++ " -e sh ./.config/vifm/scripts/vifmrun"))
, ("M-M1-f", spawn (myTerminal ++ " -e sh ./.config/vifm/scripts/vifmrun | bash"))
, ("M-M1-i", spawn (myTerminal ++ " -e irssi"))
, ("M-M1-j", spawn (myTerminal ++ " -e joplin"))
, ("M-M1-l", spawn (myTerminal ++ " -e lynx https://distrotube.com"))