summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorThanosApollo <[email protected]>2022-10-12 12:58:00 +0300
committerThanosApollo <[email protected]>2022-10-12 12:58:00 +0300
commit6476ac80e8959bb8034a0a2860023d8eb2ac8375 (patch)
treec5b5eaaad7e66e913f65f1bd19c45d70963a72a6 /.config
parent65a2b283f6b5c51809ed2fd257532f7fe55075ec (diff)
Update xmonad system and zsh
Diffstat (limited to '.config')
-rw-r--r--.config/alacritty/alacritty.yml10
-rw-r--r--.config/qutebrowser/config.py201
-rw-r--r--.config/xmonad/README.org875
-rw-r--r--.config/xmonad/lib/Colors/DoomOne.hs28
-rw-r--r--.config/xmonad/lib/Colors/Dracula.hs28
-rw-r--r--.config/xmonad/lib/Colors/GruvboxDark.hs28
-rw-r--r--.config/xmonad/lib/Colors/MonokaiPro.hs28
-rw-r--r--.config/xmonad/lib/Colors/Nord.hs28
-rw-r--r--.config/xmonad/lib/Colors/OceanicNext.hs28
-rw-r--r--.config/xmonad/lib/Colors/Palenight.hs28
-rw-r--r--.config/xmonad/lib/Colors/SolarizedDark.hs28
-rw-r--r--.config/xmonad/lib/Colors/SolarizedLight.hs28
-rw-r--r--.config/xmonad/lib/Colors/TomorrowNight.hs28
-rw-r--r--.config/xmonad/pacman-hooks/recompile-xmonad.hook10
-rw-r--r--.config/xmonad/pacman-hooks/recompile-xmonadh.hook10
-rw-r--r--.config/xmonad/xmonad-example-configs/xmonad-example-polybar-treeselect-workspaces.hs851
-rw-r--r--.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-clickable-workspaces.hs795
-rw-r--r--.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-non-clickable.hs780
-rw-r--r--.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-treeselect-workspaces.hs867
-rw-r--r--.config/xmonad/xmonad.hs326
-rwxr-xr-x.config/xmonad/xmonad_keys.sh15
-rw-r--r--.config/xmonad/xmonadctl.hs51
22 files changed, 4539 insertions, 532 deletions
diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml
index 38b5b81..a2fb161 100644
--- a/.config/alacritty/alacritty.yml
+++ b/.config/alacritty/alacritty.yml
@@ -115,9 +115,9 @@ font:
#
# Default:
# - (macOS) Menlo
- # - (Linux/BSD) hackspace
+ # - (Linux/BSD) monospace
# - (Windows) Consolas
- family: hack
+ family: mono
# The `style` can be specified to pick a specific face.
style: Regular
@@ -128,7 +128,7 @@ font:
#
# If the bold family is not specified, it will fall back to the
# value specified for the normal font.
- family: hack
+ family: mono
# The `style` can be specified to pick a specific face.
style: Bold
@@ -139,7 +139,7 @@ font:
#
# If the italic family is not specified, it will fall back to the
# value specified for the normal font.
- family: hack
+ family: mono
# The `style` can be specified to pick a specific face.
style: Italic
@@ -150,7 +150,7 @@ font:
#
# If the bold italic family is not specified, it will fall back to the
# value specified for the normal font.
- family: hack
+ family: monospace
# The `style` can be specified to pick a specific face.
style: Bold Italic
diff --git a/.config/qutebrowser/config.py b/.config/qutebrowser/config.py
deleted file mode 100644
index c3f31ff..0000000
--- a/.config/qutebrowser/config.py
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
-# My config
-
-
-
-# Dark mode
-config.set("colors.webpage.darkmode.enabled", True),
-
-
-# start page
-c.url.start_pages = ["https://thanosapollo.github.io/startpage/"]
-
-
-
-# aliases
-config.bind('W', 'hint links spawn vlc {hint-url}')
-config.bind('Z', 'hint links spawn alacritty -e youtube-dl {hint-url}')
-config.bind('t', 'set-cmd-text -s :open -t')
-config.bind('xb', 'config-cycle statusbar.show always never')
-config.bind('xt', 'config-cycle tabs.show always never')
-config.bind('xx', 'config-cycle statusbar.show always never;; config-cycle tabs.show always never')
-
-# make sure rofi is installed
-config.bind('phu', 'spawn --userscript qute-pass --username-only')
-config.bind('php', 'spawn --userscript qute-pass --password-only')
-
-
-
-# Theme
-config.source('themes/tokyo-city-terminal-dark.py')
-
-# Search engines
-c.url.searchengines = {'DEFAULT': 'https://duckduckgo.com/?q={}',
- # searx linl : 'https://searx.be/?preferences=eJxtVsty6zYM_Zpqo4mn7V105VVnum1n7t1rIBKWEJEEw4dl5esLWrJFxVnEEQ9JEAQODqgg4cCBMJ4HdBjANAbckGHAMxgZsAKDZ3QN5MSKrTeY8DwwDwYbsrKu84Fvy_lXyNhYTCPr83___vzVRLhgRAhqPP_epBEtniOV_U3AmE2KHbvO4dwl6M__gInYaKZOJtlcMZwZZHjiMDQcFYS3mBbxxPBAijVem9VYt8LFu0ahSxg6MDRY-dyMgr6CU6i7zZkV_cgYlo5clyjJ_rv35C7kKIlNFdiYFdQUoTeyHd1ATuIEfmothcCh6y5kMP7259_FMF2xpdh1WxzvaCLVdfcolVU9OK3A-q6zOZIqCLmh3lHG7bq-3ldQiZRg5feBXEkjC7b-v6Opz2rCJHtTGSdNw7B7qZR6S9dqA3t0EuqI1WEL-tojlYMh_IIEdGqpMY34KZF_3kvyQ-CSBKCyrPXQaryHmNgdIqVZ3A7tmPvNdQw8k-46FuIEGc80kYYEh01y1_I38PfoayDR8jt51AS75SRJXQ4X_ONWbbnowMWRRwwvhtQU6gUBsY18STMEbDUFVImFWus9LoHcRFCzYKBBCAUx1WcOwkJ4XL7wu8cwbMO12F7TveHewNKC93F3sp6xfCU8bPOsdZ2sEfoA5Wc7b7zv3gZkdb8HixxUlsjJJ3GO32MP--8UR95tTBJAiJW3huT8sLR8aRW7QQSgzpkRql8PeTfcx4SnEDcX4dMsgVR1oqWbMpz1jjhvt9VuAdjPtiDpwcfNSz0E9Fw550G8HSg-asrn_iTsfowWT9vnxyyEr928A8eyXaEXWq7wS34jeoJVtGqUs6jI8XYxiZcslXwxPD-iEqfcZ5fyNo7ZY8jxedfVcKFaW36efAULJSH4XCYhEhlroxrZgOyOiqT8cT02JF9aQHXtxNPCiSXlE7g9jiLqpKUwRDpSFd7sorA0jrUAgRCwtngHjoFcOKfcYyU4QGaxXISlitWVLHI1nqk_yJa0tptocqADv4rW9MxT_AoeXCjAR-aEX1dJgoJ6QYvMUlpeYF6-xE-TSp_sjor048dftz1oOmt0e0FF_HRg6_Uic4hTjTi4lszvQMj9MqB91JBHDGtEn8GyRSfliEn0Y56xr6ZCtr2p1858o4mdVEYbF8dusVj59-5PfnZHMbfSBg6dL4iHNeAxlUa9sv9b-LWQ6sk9WQ26Lx28zIuu5FtbXHkUTLjRtaZ3mduaRdX9AscY8FIvxCTUc2KwurTsoFoEZZwKrVdFp7S3umGT26oZrPL9cr0NP9Bww76pzoesFruRqpr7fNumdqgIH0jrKi02YinQ3c5jTpRPeh9svfs4H5N0wWShPG3Al0zowqV9kR9FE9xzloK8O3uoPBDrQrh6i3ijSRQ1siIw7Z2OdelXVT0Vp-4XelKMzSplfqx6vRVeWmnObQrgohEf6icGB-1o2oD93edNFtrEc-HV7bSNTgzd-lqdg7wYNz3dp0XpOjWiml5mRJM6CcaEy07M748Yiy6ugxcrI8ckRY_igOinenVgqxyJuVqf-Iu8f428Tb5ZaS7yEL7w6yUClGdZJ09AOceWBtOIvEu6z_8DjbSgWg==&q={}',
- 'aw': 'https://wiki.archlinux.org/?search={}',
- 'go': 'https://www.google.com/search?q={}',
- 're': 'https://www.reddit.com/r/{}',
- 'ub': 'https://www.urbandictionary.com/define.php?term={}',
- 'yt': 'https://www.youtube.com/results?search_query={}',
- 'wiki': 'https://en.wikipedia.org/w/index.php?search={}',
- 'pdf': 'https://www.pdfdrive.com/{}-books.html',
- 'gh': "https://github.com/search?q={}",
- "au": "https://aur.archlinux.org/packages?O=0&K={}",
- "skroutz": "https://www.skroutz.gr/search?keyphrase={}"
- }
-
-
-
-
-
-# Autogenerated config.py
-#
-# NOTE: config.py is intended for advanced users who are comfortable
-# with manually migrating the config file on qutebrowser upgrades. If
-# you prefer, you can also configure qutebrowser using the
-# :set/:bind/:config-* commands without having to write a config.py
-# file.
-#
-# Documentation:
-# qute://help/configuring.html
-# qute://help/settings.html
-
-# Change the argument to True to still load settings configured via autoconfig.yml
-config.load_autoconfig(False)
-
-# Which cookies to accept. With QtWebEngine, this setting also controls
-# other features with tracking capabilities similar to those of cookies;
-# including IndexedDB, DOM storage, filesystem API, service workers, and
-# AppCache. Note that with QtWebKit, only `all` and `never` are
-# supported as per-domain values. Setting `no-3rdparty` or `no-
-# unknown-3rdparty` per-domain on QtWebKit will have the same effect as
-# `all`. If this setting is used with URL patterns, the pattern gets
-# applied to the origin/first party URL of the page making the request,
-# not the request URL. With QtWebEngine 5.15.0+, paths will be stripped
-# from URLs, so URL patterns using paths will not match. With
-# QtWebEngine 5.15.2+, subdomains are additionally stripped as well, so
-# you will typically need to set this setting for `example.com` when the
-# cookie is set on `somesubdomain.example.com` for it to work properly.
-# To debug issues with this setting, start qutebrowser with `--debug
-# --logfilter network --debug-flag log-cookies` which will show all
-# cookies being set.
-# Type: String
-# Valid values:
-# - all: Accept all cookies.
-# - no-3rdparty: Accept cookies from the same origin only. This is known to break some sites, such as GMail.
-# - no-unknown-3rdparty: Accept cookies from the same origin only, unless a cookie is already set for the domain. On QtWebEngine, this is the same as no-3rdparty.
-# - never: Don't accept cookies at all.
-config.set('content.cookies.accept', 'all', 'chrome-devtools://*')
-
-# Which cookies to accept. With QtWebEngine, this setting also controls
-# other features with tracking capabilities similar to those of cookies;
-# including IndexedDB, DOM storage, filesystem API, service workers, and
-# AppCache. Note that with QtWebKit, only `all` and `never` are
-# supported as per-domain values. Setting `no-3rdparty` or `no-
-# unknown-3rdparty` per-domain on QtWebKit will have the same effect as
-# `all`. If this setting is used with URL patterns, the pattern gets
-# applied to the origin/first party URL of the page making the request,
-# not the request URL. With QtWebEngine 5.15.0+, paths will be stripped
-# from URLs, so URL patterns using paths will not match. With
-# QtWebEngine 5.15.2+, subdomains are additionally stripped as well, so
-# you will typically need to set this setting for `example.com` when the
-# cookie is set on `somesubdomain.example.com` for it to work properly.
-# To debug issues with this setting, start qutebrowser with `--debug
-# --logfilter network --debug-flag log-cookies` which will show all
-# cookies being set.
-# Type: String
-# Valid values:
-# - all: Accept all cookies.
-# - no-3rdparty: Accept cookies from the same origin only. This is known to break some sites, such as GMail.
-# - no-unknown-3rdparty: Accept cookies from the same origin only, unless a cookie is already set for the domain. On QtWebEngine, this is the same as no-3rdparty.
-# - never: Don't accept cookies at all.
-config.set('content.cookies.accept', 'all', 'devtools://*')
-
-# Value to send in the `Accept-Language` header. Note that the value
-# read from JavaScript is always the global value.
-# Type: String
-config.set('content.headers.accept_language', '', 'https://matchmaker.krunker.io/*')
-
-# User agent to send. The following placeholders are defined: *
-# `{os_info}`: Something like "X11; Linux x86_64". * `{webkit_version}`:
-# The underlying WebKit version (set to a fixed value with
-# QtWebEngine). * `{qt_key}`: "Qt" for QtWebKit, "QtWebEngine" for
-# QtWebEngine. * `{qt_version}`: The underlying Qt version. *
-# `{upstream_browser_key}`: "Version" for QtWebKit, "Chrome" for
-# QtWebEngine. * `{upstream_browser_version}`: The corresponding
-# Safari/Chrome version. * `{qutebrowser_version}`: The currently
-# running qutebrowser version. The default value is equal to the
-# unchanged user agent of QtWebKit/QtWebEngine. Note that the value
-# read from JavaScript is always the global value. With QtWebEngine
-# between 5.12 and 5.14 (inclusive), changing the value exposed to
-# JavaScript requires a restart.
-# Type: FormatString
-config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}) AppleWebKit/{webkit_version} (KHTML, like Gecko) {upstream_browser_key}/{upstream_browser_version} Safari/{webkit_version}', 'https://web.whatsapp.com/')
-
-# User agent to send. The following placeholders are defined: *
-# `{os_info}`: Something like "X11; Linux x86_64". * `{webkit_version}`:
-# The underlying WebKit version (set to a fixed value with
-# QtWebEngine). * `{qt_key}`: "Qt" for QtWebKit, "QtWebEngine" for
-# QtWebEngine. * `{qt_version}`: The underlying Qt version. *
-# `{upstream_browser_key}`: "Version" for QtWebKit, "Chrome" for
-# QtWebEngine. * `{upstream_browser_version}`: The corresponding
-# Safari/Chrome version. * `{qutebrowser_version}`: The currently
-# running qutebrowser version. The default value is equal to the
-# unchanged user agent of QtWebKit/QtWebEngine. Note that the value
-# read from JavaScript is always the global value. With QtWebEngine
-# between 5.12 and 5.14 (inclusive), changing the value exposed to
-# JavaScript requires a restart.
-# Type: FormatString
-config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}; rv:90.0) Gecko/20100101 Firefox/90.0', 'https://accounts.google.com/*')
-
-# User agent to send. The following placeholders are defined: *
-# `{os_info}`: Something like "X11; Linux x86_64". * `{webkit_version}`:
-# The underlying WebKit version (set to a fixed value with
-# QtWebEngine). * `{qt_key}`: "Qt" for QtWebKit, "QtWebEngine" for
-# QtWebEngine. * `{qt_version}`: The underlying Qt version. *
-# `{upstream_browser_key}`: "Version" for QtWebKit, "Chrome" for
-# QtWebEngine. * `{upstream_browser_version}`: The corresponding
-# Safari/Chrome version. * `{qutebrowser_version}`: The currently
-# running qutebrowser version. The default value is equal to the
-# unchanged user agent of QtWebKit/QtWebEngine. Note that the value
-# read from JavaScript is always the global value. With QtWebEngine
-# between 5.12 and 5.14 (inclusive), changing the value exposed to
-# JavaScript requires a restart.
-# Type: FormatString
-config.set('content.headers.user_agent', 'Mozilla/5.0 ({os_info}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99 Safari/537.36', 'https://*.slack.com/*')
-
-# Load images automatically in web pages.
-# Type: Bool
-config.set('content.images', True, 'chrome-devtools://*')
-
-# Load images automatically in web pages.
-# Type: Bool
-config.set('content.images', True, 'devtools://*')
-
-# Enable JavaScript.
-# Type: Bool
-config.set('content.javascript.enabled', True, 'chrome-devtools://*')
-
-# Enable JavaScript.
-# Type: Bool
-config.set('content.javascript.enabled', True, 'devtools://*')
-
-# Enable JavaScript.
-# Type: Bool
-config.set('content.javascript.enabled', True, 'chrome://*/*')
-
-# Enable JavaScript.
-# Type: Bool
-config.set('content.javascript.enabled', True, 'qute://*/*')
-
-# Render all web contents using a dark theme. Example configurations
-# from Chromium's `chrome://flags`: - "With simple HSL/CIELAB/RGB-based
-# inversion": Set `colors.webpage.darkmode.algorithm` accordingly. -
-# "With selective image inversion": Set
-# `colors.webpage.darkmode.policy.images` to `smart`. - "With selective
-# inversion of non-image elements": Set
-# `colors.webpage.darkmode.threshold.text` to 150 and
-# `colors.webpage.darkmode.threshold.background` to 205. - "With
-# selective inversion of everything": Combines the two variants above.
-# Type: Bool
diff --git a/.config/xmonad/README.org b/.config/xmonad/README.org
new file mode 100644
index 0000000..8089a6c
--- /dev/null
+++ b/.config/xmonad/README.org
@@ -0,0 +1,875 @@
+#+TITLE: XMonad Config
+#+AUTHOR: Derek Taylor
+#+PROPERTY: header-args :tangle xmonad.hs
+#+auto_tangle: t
+#+STARTUP: showeverything
+
+* Table Of Contents :toc:
+- [[#about-this-config][About This Config]]
+- [[#imports][Imports]]
+- [[#variables][Variables]]
+- [[#autostart-the-startup-hook][Autostart (The Startup Hook)]]
+- [[#gridselect][Gridselect]]
+ - [[#gridselect-configuration][GridSelect Configuration]]
+ - [[#gridselect-menus][Gridselect Menus]]
+- [[#scratchpads][Scratchpads]]
+- [[#layouts][Layouts]]
+- [[#workspaces][Workspaces]]
+- [[#managehook][Managehook]]
+- [[#system-sounds][System Sounds]]
+- [[#namedactions][NamedActions]]
+- [[#keybindings][Keybindings]]
+- [[#main][Main]]
+
+* About This Config
+#+CAPTION: XMonad Scrot
+#+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.
+- XMonad Official Website: [[https://xmonad.org][https://xmonad.org]]
+- Haskell Official Website: [[https://haskell.org][https://haskell.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.
+
+NOTE: You will also need my xmobar config, which is located here: https://gitlab.com/dwt1/dotfiles/-/tree/master/.config/xmobar
+
+* Imports
+These are Haskell modules that we must import so that we can use their functions later in the config.
+
+#+BEGIN_SRC haskell
+ -- Base
+import XMonad
+import System.Directory
+import System.IO (hClose, hPutStr, hPutStrLn)
+import System.Exit (exitSuccess)
+import qualified XMonad.StackSet as W
+
+ -- Actions
+import XMonad.Actions.CopyWindow (kill1)
+import XMonad.Actions.CycleWS (Direction1D(..), moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
+import XMonad.Actions.GridSelect
+import XMonad.Actions.MouseResize
+import XMonad.Actions.Promote
+import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
+import XMonad.Actions.WindowGo (runOrRaise)
+import XMonad.Actions.WithAll (sinkAll, killAll)
+import qualified XMonad.Actions.Search as S
+
+ -- Data
+import Data.Char (isSpace, toUpper)
+import Data.Maybe (fromJust)
+import Data.Monoid
+import Data.Maybe (isJust)
+import Data.Tree
+import qualified Data.Map as M
+
+ -- Hooks
+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, docks, manageDocks, ToggleStruts(..))
+import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat, doCenterFloat)
+import XMonad.Hooks.ServerMode
+import XMonad.Hooks.SetWMName
+import XMonad.Hooks.StatusBar
+import XMonad.Hooks.StatusBar.PP
+import XMonad.Hooks.WindowSwallowing
+import XMonad.Hooks.WorkspaceHistory
+
+ -- Layouts
+import XMonad.Layout.Accordion
+import XMonad.Layout.GridVariants (Grid(Grid))
+import XMonad.Layout.SimplestFloat
+import XMonad.Layout.Spiral
+import XMonad.Layout.ResizableTile
+import XMonad.Layout.Tabbed
+import XMonad.Layout.ThreeColumns
+
+ -- Layouts modifiers
+import XMonad.Layout.LayoutModifier
+import XMonad.Layout.LimitWindows (limitWindows, increaseLimit, decreaseLimit)
+import XMonad.Layout.MultiToggle (mkToggle, single, EOT(EOT), (??))
+import XMonad.Layout.MultiToggle.Instances (StdTransformers(NBFULL, MIRROR, NOBORDERS))
+import XMonad.Layout.NoBorders
+import XMonad.Layout.Renamed
+import XMonad.Layout.ShowWName
+import XMonad.Layout.Simplest
+import XMonad.Layout.Spacing
+import XMonad.Layout.SubLayouts
+import XMonad.Layout.WindowArranger (windowArrange, WindowArrangerMsg(..))
+import XMonad.Layout.WindowNavigation
+import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
+import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
+
+ -- Utilities
+import XMonad.Util.Dmenu
+import XMonad.Util.EZConfig (additionalKeysP, mkNamedKeymap)
+import XMonad.Util.NamedActions
+import XMonad.Util.NamedScratchpad
+import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
+import XMonad.Util.SpawnOnce
+
+ -- ColorScheme module (SET ONLY ONE!)
+ -- Possible choice are:
+ -- DoomOne
+ -- Dracula
+ -- GruvboxDark
+ -- MonokaiPro
+ -- Nord
+ -- OceanicNext
+ -- Palenight
+ -- SolarizedDark
+ -- SolarizedLight
+ -- TomorrowNight
+import Colors.DoomOne
+#+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.
+
+#+BEGIN_SRC haskell
+myFont :: String
+myFont = "xft:SauceCodePro Nerd Font Mono:regular:size=9:antialias=true:hinting=true"
+
+myModMask :: KeyMask
+myModMask = mod4Mask -- Sets modkey to super/windows key
+
+myTerminal :: String
+myTerminal = "alacritty" -- Sets default terminal
+
+myBrowser :: String
+myBrowser = "qutebrowser " -- Sets qutebrowser as browser
+
+myEmacs :: String
+myEmacs = "emacsclient -c -a 'emacs' " -- Makes emacs keybindings easier to type
+
+myEditor :: String
+myEditor = "emacsclient -c -a 'emacs' " -- Sets emacs as editor
+-- myEditor = myTerminal ++ " -e vim " -- Sets vim as editor
+
+myBorderWidth :: Dimension
+myBorderWidth = 2 -- Sets border width for windows
+
+myNormColor :: String -- Border color of normal windows
+myNormColor = colorBack -- This variable is imported from Colors.THEME
+
+myFocusColor :: String -- Border color of focused windows
+myFocusColor = color15 -- This variable is imported from Colors.THEME
+
+mySoundPlayer :: String
+mySoundPlayer = "ffplay -nodisp -autoexit " -- The program that will play system sounds
+
+windowCount :: X (Maybe String)
+windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
+
+#+END_SRC
+
+* 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.
+
+#+BEGIN_SRC haskell
+myStartupHook :: X ()
+myStartupHook = do
+ spawnOnce (mySoundPlayer ++ startupSound)
+ spawn "killall conky" -- kill current conky on each restart
+ spawn "killall trayer" -- kill current trayer on each restart
+#+END_SRC
+
+#+BEGIN_SRC haskell
+ spawnOnce "lxsession"
+ spawnOnce "picom"
+ spawnOnce "nm-applet"
+ spawnOnce "volumeicon"
+ spawn "/usr/bin/emacs --daemon" -- emacs daemon for the emacsclient
+#+END_SRC
+
+We killed any running conky and trayer processes earlier in the autostart, so now we sleep for 2 seconds and then restart conky and trayer.
+#+BEGIN_SRC haskell
+ spawn ("sleep 2 && conky -c $HOME/.config/conky/xmonad/" ++ colorScheme ++ "-01.conkyrc")
+ spawn ("sleep 2 && trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 " ++ colorTrayer ++ " --height 22")
+#+END_SRC
+
+Select only =ONE= of the following four ways to set the wallpaper.
+
+#+BEGIN_SRC haskell
+ spawnOnce "xargs xwallpaper --stretch < ~/.cache/wall"
+ -- spawnOnce "~/.fehbg &" -- set last saved feh wallpaper
+ -- spawnOnce "feh --randomize --bg-fill /usr/share/backgrounds/dtos-backgrounds/*" -- feh set random wallpaper
+ -- spawnOnce "nitrogen --restore &" -- if you prefer nitrogen to feh
+ setWMName "LG3D"
+#+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 Configuration
+#+BEGIN_SRC haskell
+myNavigation :: TwoD a (Maybe a)
+myNavigation = makeXEventhandler $ shadowWithKeymap navKeyMap navDefaultHandler
+ where navKeyMap = M.fromList [
+ ((0,xK_Escape), cancel)
+ ,((0,xK_Return), select)
+ ,((0,xK_slash) , substringSearch myNavigation)
+ ,((0,xK_Left) , move (-1,0) >> myNavigation)
+ ,((0,xK_h) , move (-1,0) >> myNavigation)
+ ,((0,xK_Right) , move (1,0) >> myNavigation)
+ ,((0,xK_l) , move (1,0) >> myNavigation)
+ ,((0,xK_Down) , move (0,1) >> myNavigation)
+ ,((0,xK_j) , move (0,1) >> myNavigation)
+ ,((0,xK_Up) , move (0,-1) >> myNavigation)
+ ,((0,xK_k) , move (0,-1) >> myNavigation)
+ ,((0,xK_y) , move (-1,-1) >> myNavigation)
+ ,((0,xK_i) , move (1,-1) >> myNavigation)
+ ,((0,xK_n) , move (-1,1) >> myNavigation)
+ ,((0,xK_m) , move (1,-1) >> myNavigation)
+ ,((0,xK_space) , setPos (0,0) >> myNavigation)
+ ]
+ navDefaultHandler = const myNavigation
+
+myColorizer :: Window -> Bool -> X (String, String)
+myColorizer = colorRangeFromClassName
+ (0x28,0x2c,0x34) -- lowest inactive bg
+ (0x28,0x2c,0x34) -- highest inactive bg
+ (0xc7,0x92,0xea) -- active bg
+ (0xc0,0xa7,0x9a) -- inactive fg
+ (0x28,0x2c,0x34) -- active fg
+
+-- gridSelect menu layout
+mygridConfig :: p -> GSConfig Window
+mygridConfig colorizer = (buildDefaultGSConfig myColorizer)
+ { gs_cellheight = 40
+ , gs_cellwidth = 200
+ , gs_cellpadding = 6
+ , gs_navigate = myNavigation
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+spawnSelected' :: [(String, String)] -> X ()
+spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
+ where conf = def
+ { gs_cellheight = 40
+ , gs_cellwidth = 180
+ , gs_cellpadding = 6
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+runSelectedAction' :: GSConfig (X ()) -> [(String, X ())] -> X ()
+runSelectedAction' conf actions = do
+ selectedActionM <- gridselect conf actions
+ case selectedActionM of
+ Just selectedAction -> selectedAction
+ Nothing -> return ()
+#+end_src
+
+** Gridselect Menus
+#+begin_src haskell
+-- gsCategories =
+-- [ ("Games", spawnSelected' gsGames)
+-- --, ("Education", spawnSelected' gsEducation)
+-- , ("Internet", spawnSelected' gsInternet)
+-- , ("Multimedia", spawnSelected' gsMultimedia)
+-- , ("Office", spawnSelected' gsOffice)
+-- , ("Settings", spawnSelected' gsSettings)
+-- , ("System", spawnSelected' gsSystem)
+-- , ("Utilities", spawnSelected' gsUtilities)
+-- ]
+
+gsCategories =
+ [ ("Games", "xdotool key super+alt+1")
+ , ("Education", "xdotool key super+alt+2")
+ , ("Internet", "xdotool key super+alt+3")
+ , ("Multimedia", "xdotool key super+alt+4")
+ , ("Office", "xdotool key super+alt+5")
+ , ("Settings", "xdotool key super+alt+6")
+ , ("System", "xdotool key super+alt+7")
+ , ("Utilities", "xdotool key super+alt+8")
+ ]
+
+gsGames =
+ [ ("0 A.D.", "0ad")
+ , ("Battle For Wesnoth", "wesnoth")
+ , ("OpenArena", "openarena")
+ , ("Sauerbraten", "sauerbraten")
+ , ("Steam", "steam")
+ , ("Unvanquished", "unvanquished")
+ , ("Xonotic", "xonotic-glx")
+ ]
+
+gsEducation =
+ [ ("GCompris", "gcompris-qt")
+ , ("Kstars", "kstars")
+ , ("Minuet", "minuet")
+ , ("Scratch", "scratch")
+ ]
+
+gsInternet =
+ [ ("Brave", "brave")
+ , ("Discord", "discord")
+ , ("Element", "element-desktop")
+ , ("Firefox", "firefox")
+ , ("LBRY App", "lbry")
+ , ("Mailspring", "mailspring")
+ , ("Nextcloud", "nextcloud")
+ , ("Qutebrowser", "qutebrowser")
+ , ("Transmission", "transmission-gtk")
+ , ("Zoom", "zoom")
+ ]
+
+gsMultimedia =
+ [ ("Audacity", "audacity")
+ , ("Blender", "blender")
+ , ("Deadbeef", "deadbeef")
+ , ("Kdenlive", "kdenlive")
+ , ("OBS Studio", "obs")
+ , ("VLC", "vlc")
+ ]
+
+gsOffice =
+ [ ("Document Viewer", "evince")
+ , ("LibreOffice", "libreoffice")
+ , ("LO Base", "lobase")
+ , ("LO Calc", "localc")
+ , ("LO Draw", "lodraw")
+ , ("LO Impress", "loimpress")
+ , ("LO Math", "lomath")
+ , ("LO Writer", "lowriter")
+ ]
+
+gsSettings =
+ [ ("ARandR", "arandr")
+ , ("ArchLinux Tweak Tool", "archlinux-tweak-tool")
+ , ("Customize Look and Feel", "lxappearance")
+ , ("Firewall Configuration", "sudo gufw")
+ ]
+
+gsSystem =
+ [ ("Alacritty", "alacritty")
+ , ("Bash", (myTerminal ++ " -e bash"))
+ , ("Htop", (myTerminal ++ " -e htop"))
+ , ("Fish", (myTerminal ++ " -e fish"))
+ , ("PCManFM", "pcmanfm")
+ , ("VirtualBox", "virtualbox")
+ , ("Virt-Manager", "virt-manager")
+ , ("Zsh", (myTerminal ++ " -e zsh"))
+ ]
+
+gsUtilities =
+ [ ("Emacs", "emacs")
+ , ("Emacsclient", "emacsclient -c -a 'emacs'")
+ , ("Nitrogen", "nitrogen")
+ , ("Vim", (myTerminal ++ " -e vim"))
+ ]
+
+#+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 have created named scratchpads for:
++ alacritty -- my terminal
++ mocp -- a terminal music player
++ qalculate-gtk -- a nice calculator
+
+#+BEGIN_SRC haskell
+myScratchPads :: [NamedScratchpad]
+myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
+ , NS "mocp" spawnMocp findMocp manageMocp
+ , NS "calculator" spawnCalc findCalc manageCalc
+ ]
+ where
+ spawnTerm = myTerminal ++ " -t scratchpad"
+ findTerm = title =? "scratchpad"
+ manageTerm = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+ spawnMocp = myTerminal ++ " -t mocp -e mocp"
+ findMocp = title =? "mocp"
+ manageMocp = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+ spawnCalc = "qalculate-gtk"
+ findCalc = className =? "Qalculate-gtk"
+ manageCalc = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.5
+ w = 0.4
+ t = 0.75 -h
+ l = 0.70 -w
+#+END_SRC
+
+* Layouts
+Defining the layouts that I want to have available.
+
+#+BEGIN_SRC haskell
+--Makes setting the spacingRaw simpler to write. The spacingRaw module adds a configurable amount of space around windows.
+mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing i = spacingRaw False (Border i i i i) True (Border i i i i) True
+
+-- Below is a variation of the above except no borders are applied
+-- if fewer than two windows. So a single window has no gaps.
+mySpacing' :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing' i = spacingRaw True (Border i i i i) True (Border i i i i) True
+
+-- Defining a bunch of layouts, many that I don't use.
+-- limitWindows n sets maximum number of windows displayed for layout.
+-- mySpacing n sets the gap size around the windows.
+tall = renamed [Replace "tall"]
+ $ limitWindows 5
+ $ smartBorders
+ $ windowNavigation
+ $ addTabs shrinkText myTabTheme
+ $ subLayout [] (smartBorders Simplest)
+ $ mySpacing 8
+ $ ResizableTall 1 (3/100) (1/2) []
+monocle = renamed [Replace "monocle"]
+ $ smartBorders
+ $ windowNavigation
+ $ addTabs shrinkText myTabTheme
+ $ subLayout [] (smartBorders Simplest)
+ $ Full
+floats = renamed [Replace "floats"]
+ $ smartBorders
+ $ simplestFloat
+grid = renamed [Replace "grid"]
+ $ limitWindows 9
+ $ smartBorders
+ $ windowNavigation
+ $ addTabs shrinkText myTabTheme
+ $ subLayout [] (smartBorders Simplest)
+ $ mySpacing 8
+ $ mkToggle (single MIRROR)
+ $ Grid (16/10)
+spirals = renamed [Replace "spirals"]
+ $ limitWindows 9
+ $ smartBorders
+ $ windowNavigation
+ $ addTabs shrinkText myTabTheme
+ $ subLayout [] (smartBorders Simplest)
+ $ mySpacing' 8
+ $ spiral (6/7)
+threeCol = renamed [Replace "threeCol"]
+ $ limitWindows 7
+ $ smartBorders
+ $ windowNavigation
+ $ addTabs shrinkText myTabTheme
+ $ subLayout [] (smartBorders Simplest)
+ $ ThreeCol 1 (3/100) (1/2)
+threeRow = renamed [Replace "threeRow"]
+ $ limitWindows 7
+ $ smartBorders
+ $ windowNavigation
+ $ addTabs shrinkText myTabTheme
+ $ subLayout [] (smartBorders Simplest)
+ -- Mirror takes a layout and rotates it by 90 degrees.
+ -- So we are applying Mirror to the ThreeCol layout.
+ $ Mirror
+ $ ThreeCol 1 (3/100) (1/2)
+tabs = renamed [Replace "tabs"]
+ -- I cannot add spacing to this layout because it will
+ -- add spacing between window and tabs which looks bad.
+ $ tabbed shrinkText myTabTheme
+tallAccordion = renamed [Replace "tallAccordion"]
+ $ Accordion
+wideAccordion = renamed [Replace "wideAccordion"]
+ $ Mirror Accordion
+
+-- setting colors for tabs layout and tabs sublayout.
+myTabTheme = def { fontName = myFont
+ , activeColor = color15
+ , inactiveColor = color08
+ , activeBorderColor = color15
+ , inactiveBorderColor = colorBack
+ , activeTextColor = colorBack
+ , inactiveTextColor = color16
+ }
+
+-- Theme for showWName which prints current workspace when you change workspaces.
+myShowWNameTheme :: SWNConfig
+myShowWNameTheme = def
+ { swn_font = "xft:Ubuntu:bold:size=60"
+ , swn_fade = 1.0
+ , swn_bgcolor = "#1c1f24"
+ , swn_color = "#ffffff"
+ }
+
+-- The layout hook
+myLayoutHook = avoidStruts
+ $ mouseResize
+ $ windowArrange
+ $ T.toggleLayouts floats
+ $ mkToggle (NBFULL ?? NOBORDERS ?? EOT) myDefaultLayout
+ where
+ myDefaultLayout = withBorder myBorderWidth tall
+ ||| noBorders monocle
+ ||| floats
+ ||| noBorders tabs
+ ||| grid
+ ||| spirals
+ ||| threeCol
+ ||| threeRow
+ ||| tallAccordion
+ ||| wideAccordion
+#+END_SRC
+
+* Workspaces
+I have made my workspaces in xmobar "clickable." Clickable workspaces means the mouse can be used to switch workspaces. This requires /xdotool/ to be installed. You need to use UnsafeStdInReader instead of simply StdInReader in your xmobar config so you can pass actions to it.
+
+#+begin_src haskell
+-- myWorkspaces = [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "]
+myWorkspaces = [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "]
+myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y)
+
+clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
+ where i = fromJust $ M.lookup ws myWorkspaceIndices
+#+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.
+
+#+BEGIN_SRC haskell
+myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
+myManageHook = composeAll
+ -- 'doFloat' forces a window to float. Useful for dialog boxes and such.
+ -- 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 and the names would be very long if using clickable workspaces.
+ [ className =? "confirm" --> doFloat
+ , className =? "file_progress" --> doFloat
+ , className =? "dialog" --> doFloat
+ , className =? "download" --> doFloat
+ , className =? "error" --> doFloat
+ , className =? "Gimp" --> doFloat
+ , className =? "notification" --> doFloat
+ , 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 )
+ , className =? "mpv" --> doShift ( myWorkspaces !! 7 )
+ , className =? "Gimp" --> doShift ( myWorkspaces !! 8 )
+ , className =? "VirtualBox Manager" --> doShift ( myWorkspaces !! 4 )
+ , (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog
+ , isFullscreen --> doFullFloat
+ ] <+> namedScratchpadManageHook myScratchPads
+#+END_SRC
+
+* System Sounds
+Available sounds that are part of the default =dtos-sounds= package include:
++ menu-01.mp3
++ menu-02.mp3
++ menu-03.mp3
++ shutdown-01.mp3
++ shutdown-02.mp3
++ shutdown-03.mp3
++ startup-01.mp3
++ startup-02.mp3
++ startup-03.mp3
+
+#+begin_src haskell
+soundDir = "/opt/dtos-sounds/" -- The directory that has the sound files
+
+startupSound = soundDir ++ "startup-01.mp3"
+shutdownSound = soundDir ++ "shutdown-01.mp3"
+dmenuSound = soundDir ++ "menu-01.mp3"
+#+end_src
+
+* NamedActions
+=NamedActions= is a wrapper for keybinding configuration that can list the available keybindings. The following custom functions are used to add =NamedActions= to our keybindings in the format that I desired. =subTitle'= allows me to format the subtitle (=subKeys=) so that I can prepend and/or append text to them. =showKeybindings= is a function that pipes the output of our =NamedActions= into a GUI display program, such as 'yad' or 'zenity'.
+
+#+begin_src haskell
+subtitle' :: String -> ((KeyMask, KeySym), NamedAction)
+subtitle' x = ((0,0), NamedAction $ map toUpper
+ $ sep ++ "\n-- " ++ x ++ " --\n" ++ sep)
+ where
+ sep = replicate (6 + length x) '-'
+
+showKeybindings :: [((KeyMask, KeySym), NamedAction)] -> NamedAction
+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\""
+ --hPutStr h (unlines $ showKm x) -- showKM adds ">>" before subtitles
+ hPutStr h (unlines $ showKmSimple x) -- showKmSimple doesn't add ">>" to subtitles
+ hClose h
+ return ()
+
+#+end_src
+
+* Keybindings
+I am using the Xmonad.Util.EZConfig module which allows keybindings to be written in simpler, emacs-like format. The Super/Windows key is 'M' (the modkey). The ALT key is 'M1'. SHIFT is 'S' and CTRL is 'C'. Pay close attention to the way the keybindings list is formatted. Each group of keybindings must have a =subKeys= heading, and each individual keybinding must use =addName= to add a description. These headings and descriptions are needed for the keybindings list that can be launched with 'MOD-F1'.
+
+| A FEW KEYBINDINGS | ASSOCIATED ACTION |
+|-------------------------+--------------------------------------------------------------|
+| MODKEY + RETURN | opens terminal (alacritty) |
+| MODKEY + SHIFT + RETURN | opens run launcher (dmenu) |
+| MODKEY + TAB | rotates through the available layouts |
+| MODKEY + SPACE | toggles fullscreen on/off (useful for watching videos) |
+| MODKEY + SHIFT + c | closes window with focus |
+| MODKEY + SHIFT + r | restarts xmonad |
+| MODKEY + SHIFT + q | quits xmonad |
+| MODKEY + 1-9 | switch focus to workspace (1-9) |
+| MODKEY + SHIFT + 1-9 | send focused window to workspace (1-9) |
+| MODKEY + j | windows focus down (switches focus between windows in stack) |
+| MODKEY + k | windows focus up (switches focus between windows in stack) |
+| MODKEY + SHIFT + j | windows swap down (swap windows in the stack) |
+| MODKEY + SHIFT + k | windows swap up (swap the windows in the stack) |
+| MODKEY + period | switches focus to next monitor |
+| MODKEY + comma | switches focus to prev monitor |
+| MODKEY + r | switches focus to monitor 3 |
+| MODKEY + period | switch focus to next monitor |
+| MODKEY + comma | switch focus to prev monitor |
+| MODKEY + SPACE | toggles fullscreen on/off (useful for watching videos) |
+| MODKEY + t | force floating window back into tiling |
+| MODKEY + F1 | show a list of all keybindings in our xmonad config |
+
+#+BEGIN_SRC haskell
+myKeys :: XConfig l0 -> [((KeyMask, KeySym), NamedAction)]
+myKeys c =
+ --(subtitle "Custom Keys":) $ mkNamedKeymap c $
+ let subKeys str ks = subtitle' str : mkNamedKeymap c ks in
+ subKeys "Xmonad Essentials"
+ [ ("M-C-r", addName "Recompile XMonad" $ spawn "xmonad --recompile")
+ , ("M-S-r", addName "Restart XMonad" $ spawn "xmonad --restart")
+ , ("M-S-q", addName "Quit XMonad" $ sequence_ [spawn (mySoundPlayer ++ shutdownSound), io exitSuccess])
+ , ("M-S-c", addName "Kill focused window" $ kill1)
+ , ("M-S-a", addName "Kill all windows on WS" $ killAll)
+ , ("M-S-<Return>", addName "Run prompt" $ sequence_ [spawn (mySoundPlayer ++ dmenuSound), spawn "~/.local/bin/dm-run"])
+ , ("M-/", addName "DTOS Help" $ spawn "~/.local/bin/dtos-help")]
+
+ ^++^ subKeys "Switch to workspace"
+ [ ("M-1", addName "Switch to workspace 1" $ (windows $ W.greedyView $ myWorkspaces !! 0))
+ , ("M-2", addName "Switch to workspace 2" $ (windows $ W.greedyView $ myWorkspaces !! 1))
+ , ("M-3", addName "Switch to workspace 3" $ (windows $ W.greedyView $ myWorkspaces !! 2))
+ , ("M-4", addName "Switch to workspace 4" $ (windows $ W.greedyView $ myWorkspaces !! 3))
+ , ("M-5", addName "Switch to workspace 5" $ (windows $ W.greedyView $ myWorkspaces !! 4))
+ , ("M-6", addName "Switch to workspace 6" $ (windows $ W.greedyView $ myWorkspaces !! 5))
+ , ("M-7", addName "Switch to workspace 7" $ (windows $ W.greedyView $ myWorkspaces !! 6))
+ , ("M-8", addName "Switch to workspace 8" $ (windows $ W.greedyView $ myWorkspaces !! 7))
+ , ("M-9", addName "Switch to workspace 9" $ (windows $ W.greedyView $ myWorkspaces !! 8))]
+
+ ^++^ subKeys "Send window to workspace"
+ [ ("M-S-1", addName "Send to workspace 1" $ (windows $ W.shift $ myWorkspaces !! 0))
+ , ("M-S-2", addName "Send to workspace 2" $ (windows $ W.shift $ myWorkspaces !! 1))
+ , ("M-S-3", addName "Send to workspace 3" $ (windows $ W.shift $ myWorkspaces !! 2))
+ , ("M-S-4", addName "Send to workspace 4" $ (windows $ W.shift $ myWorkspaces !! 3))
+ , ("M-S-5", addName "Send to workspace 5" $ (windows $ W.shift $ myWorkspaces !! 4))
+ , ("M-S-6", addName "Send to workspace 6" $ (windows $ W.shift $ myWorkspaces !! 5))
+ , ("M-S-7", addName "Send to workspace 7" $ (windows $ W.shift $ myWorkspaces !! 6))
+ , ("M-S-8", addName "Send to workspace 8" $ (windows $ W.shift $ myWorkspaces !! 7))
+ , ("M-S-9", addName "Send to workspace 9" $ (windows $ W.shift $ myWorkspaces !! 8))]
+
+ ^++^ subKeys "Move window to WS and go there"
+ [ ("M-S-<Page_Up>", addName "Move window to next WS" $ shiftTo Next nonNSP >> moveTo Next nonNSP)
+ , ("M-S-<Page_Down>", addName "Move window to prev WS" $ shiftTo Prev nonNSP >> moveTo Prev nonNSP)]
+
+ ^++^ subKeys "Window navigation"
+ [ ("M-j", addName "Move focus to next window" $ windows W.focusDown)
+ , ("M-k", addName "Move focus to prev window" $ windows W.focusUp)
+ , ("M-m", addName "Move focus to master window" $ windows W.focusMaster)
+ , ("M-S-j", addName "Swap focused window with next window" $ windows W.swapDown)
+ , ("M-S-k", addName "Swap focused window with prev window" $ windows W.swapUp)
+ , ("M-S-m", addName "Swap focused window with master window" $ windows W.swapMaster)
+ , ("M-<Backspace>", addName "Move focused window to master" $ promote)
+ , ("M-S-,", addName "Rotate all windows except master" $ rotSlavesDown)
+ , ("M-S-.", addName "Rotate all windows current stack" $ rotAllDown)]
+
+ -- Dmenu scripts (dmscripts)
+ -- 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.
+ ^++^ subKeys "Dmenu scripts"
+ [ ("M-p h", addName "List all dmscripts" $ spawn "dm-hub")
+ , ("M-p a", addName "Choose ambient sound" $ spawn "dm-sounds")
+ , ("M-p b", addName "Set background" $ spawn "dm-setbg")
+ , ("M-p c", addName "Choose color scheme" $ spawn "~/.local/bin/dtos-colorscheme")
+ , ("M-p C", addName "Pick color from scheme" $ spawn "dm-colpick")
+ , ("M-p e", addName "Edit config files" $ spawn "dm-confedit")
+ , ("M-p i", addName "Take a screenshot" $ spawn "dm-maim")
+ , ("M-p k", addName "Kill processes" $ spawn "dm-kill")
+ , ("M-p m", addName "View manpages" $ spawn "dm-man")
+ , ("M-p n", addName "Store and copy notes" $ spawn "dm-note")
+ , ("M-p o", addName "Browser bookmarks" $ spawn "dm-bookman")
+ , ("M-p p", addName "Passmenu" $ spawn "passmenu -p \"Pass: \"")
+ , ("M-p q", addName "Logout Menu" $ spawn "dm-logout")
+ , ("M-p r", addName "Listen to online radio" $ spawn "dm-radio")
+ , ("M-p s", addName "Search various engines" $ spawn "dm-websearch")
+ , ("M-p t", addName "Translate text" $ spawn "dm-translate")]
+
+ ^++^ subKeys "Favorite programs"
+ [ ("M-<Return>", addName "Launch terminal" $ spawn (myTerminal))
+ , ("M-b", addName "Launch web browser" $ spawn (myBrowser))
+ , ("M-M1-h", addName "Launch htop" $ spawn (myTerminal ++ " -e htop"))]
+
+ ^++^ subKeys "Monitors"
+ [ ("M-.", addName "Switch focus to next monitor" $ nextScreen)
+ , ("M-,", addName "Switch focus to prev monitor" $ prevScreen)]
+
+ -- Switch layouts
+ ^++^ subKeys "Switch layouts"
+ [ ("M-<Tab>", addName "Switch to next layout" $ sendMessage NextLayout)
+ , ("M-<Space>", addName "Toggle noborders/full" $ sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts)]
+
+ -- Window resizing
+ ^++^ subKeys "Window resizing"
+ [ ("M-h", addName "Shrink window" $ sendMessage Shrink)
+ , ("M-l", addName "Expand window" $ sendMessage Expand)
+ , ("M-M1-j", addName "Shrink window vertically" $ sendMessage MirrorShrink)
+ , ("M-M1-k", addName "Expand window vertically" $ sendMessage MirrorExpand)]
+
+ -- Floating windows
+ ^++^ subKeys "Floating windows"
+ [ ("M-f", addName "Toggle float layout" $ sendMessage (T.Toggle "floats"))
+ , ("M-t", addName "Sink a floating window" $ withFocused $ windows . W.sink)
+ , ("M-S-t", addName "Sink all floated windows" $ sinkAll)]
+
+ -- Increase/decrease spacing (gaps)
+ ^++^ subKeys "Window spacing (gaps)"
+ [ ("C-M1-j", addName "Decrease window spacing" $ decWindowSpacing 4)
+ , ("C-M1-k", addName "Increase window spacing" $ incWindowSpacing 4)
+ , ("C-M1-h", addName "Decrease screen spacing" $ decScreenSpacing 4)
+ , ("C-M1-l", addName "Increase screen spacing" $ incScreenSpacing 4)]
+
+ -- Increase/decrease windows in the 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-<Down>", addName "Decrease clients in master pane" $ sendMessage (IncMasterN (-1)))
+ , ("M-=", addName "Increase max # of windows for layout" $ increaseLimit)
+ , ("M--", addName "Decrease max # of windows for layout" $ decreaseLimit)]
+
+ -- Sublayouts
+ -- This is used to push windows to tabbed sublayouts, or pull them out of it.
+ ^++^ subKeys "Sublayouts"
+ [ ("M-C-h", addName "pullGroup L" $ sendMessage $ pullGroup L)
+ , ("M-C-l", addName "pullGroup R" $ sendMessage $ pullGroup R)
+ , ("M-C-k", addName "pullGroup U" $ sendMessage $ pullGroup U)
+ , ("M-C-j", addName "pullGroup D" $ sendMessage $ pullGroup D)
+ , ("M-C-m", addName "MergeAll" $ withFocused (sendMessage . MergeAll))
+ -- , ("M-C-u", addName "UnMerge" $ withFocused (sendMessage . UnMerge))
+ , ("M-C-/", addName "UnMergeAll" $ withFocused (sendMessage . UnMergeAll))
+ , ("M-C-.", addName "Switch focus next tab" $ onGroup W.focusUp')
+ , ("M-C-,", addName "Switch focus prev tab" $ onGroup W.focusDown')]
+
+ -- Scratchpads
+ -- Toggle show/hide these programs. They run on a hidden workspace.
+ -- When you toggle them to show, it brings them to current workspace.
+ -- Toggle them to hide and it sends them back to hidden workspace (NSP).
+ ^++^ subKeys "Scratchpads"
+ [ ("M-s t", addName "Toggle scratchpad terminal" $ namedScratchpadAction myScratchPads "terminal")
+ , ("M-s m", addName "Toggle scratchpad mocp" $ namedScratchpadAction myScratchPads "mocp")
+ , ("M-s c", addName "Toggle scratchpad calculator" $ namedScratchpadAction myScratchPads "calculator")]
+
+ -- Controls for mocp music player (SUPER-u followed by a key)
+ ^++^ subKeys "Mocp music player"
+ [ ("M-u p", addName "mocp play" $ spawn "mocp --play")
+ , ("M-u l", addName "mocp next" $ spawn "mocp --next")
+ , ("M-u h", addName "mocp prev" $ spawn "mocp --previous")
+ , ("M-u <Space>", addName "mocp toggle pause" $ spawn "mocp --toggle-pause")]
+
+ ^++^ subKeys "GridSelect"
+ -- , ("C-g g", addName "Select favorite apps" $ runSelectedAction' defaultGSConfig gsCategories)
+ [ ("M-M1-<Return>", addName "Select favorite apps" $ spawnSelected'
+ $ gsGames ++ gsEducation ++ gsInternet ++ gsMultimedia ++ gsOffice ++ gsSettings ++ gsSystem ++ gsUtilities)
+ , ("M-M1-c", addName "Select favorite apps" $ spawnSelected' gsCategories)
+ , ("M-M1-t", addName "Goto selected window" $ goToSelected $ mygridConfig myColorizer)
+ , ("M-M1-b", addName "Bring selected window" $ bringSelected $ mygridConfig myColorizer)
+ , ("M-M1-1", addName "Menu of games" $ spawnSelected' gsGames)
+ , ("M-M1-2", addName "Menu of education apps" $ spawnSelected' gsEducation)
+ , ("M-M1-3", addName "Menu of Internet apps" $ spawnSelected' gsInternet)
+ , ("M-M1-4", addName "Menu of multimedia apps" $ spawnSelected' gsMultimedia)
+ , ("M-M1-5", addName "Menu of office apps" $ spawnSelected' gsOffice)
+ , ("M-M1-6", addName "Menu of settings apps" $ spawnSelected' gsSettings)
+ , ("M-M1-7", addName "Menu of system apps" $ spawnSelected' gsSystem)
+ , ("M-M1-8", addName "Menu of utilities apps" $ spawnSelected' gsUtilities)]
+
+ -- Emacs (SUPER-e followed by a key)
+ ^++^ subKeys "Emacs"
+ [ ("M-e e", addName "Emacsclient Dashboard" $ spawn (myEmacs ++ ("--eval '(dashboard-refresh-buffer)'")))
+ , ("M-e a", addName "Emacsclient EMMS (music)" $ spawn (myEmacs ++ ("--eval '(emms)' --eval '(emms-play-directory-tree \"~/Music/\")'")))
+ , ("M-e b", addName "Emacsclient Ibuffer" $ spawn (myEmacs ++ ("--eval '(ibuffer)'")))
+ , ("M-e d", addName "Emacsclient Dired" $ spawn (myEmacs ++ ("--eval '(dired nil)'")))
+ , ("M-e i", addName "Emacsclient ERC (IRC)" $ spawn (myEmacs ++ ("--eval '(erc)'")))
+ , ("M-e n", addName "Emacsclient Elfeed (RSS)" $ spawn (myEmacs ++ ("--eval '(elfeed)'")))
+ , ("M-e s", addName "Emacsclient Eshell" $ spawn (myEmacs ++ ("--eval '(eshell)'")))
+ , ("M-e v", addName "Emacsclient Vterm" $ spawn (myEmacs ++ ("--eval '(+vterm/here nil)'")))
+ , ("M-e w", addName "Emacsclient EWW Browser" $ spawn (myEmacs ++ ("--eval '(doom/window-maximize-buffer(eww \"distro.tube\"))'")))]
+
+ -- Multimedia Keys
+ ^++^ subKeys "Multimedia keys"
+ [ ("<XF86AudioPlay>", addName "mocp play" $ spawn "mocp --play")
+ , ("<XF86AudioPrev>", addName "mocp next" $ spawn "mocp --previous")
+ , ("<XF86AudioNext>", addName "mocp prev" $ spawn "mocp --next")
+ , ("<XF86AudioMute>", addName "Toggle audio mute" $ spawn "amixer set Master toggle")
+ , ("<XF86AudioLowerVolume>", addName "Lower vol" $ spawn "amixer set Master 5%- unmute")
+ , ("<XF86AudioRaiseVolume>", addName "Raise vol" $ spawn "amixer set Master 5%+ unmute")
+ , ("<XF86HomePage>", addName "Open home page" $ spawn (myBrowser ++ " https://www.youtube.com/c/DistroTube"))
+ , ("<XF86Search>", addName "Web search (dmscripts)" $ spawn "dm-websearch")
+ , ("<XF86Mail>", addName "Email client" $ runOrRaise "thunderbird" (resource =? "thunderbird"))
+ , ("<XF86Calculator>", addName "Calculator" $ runOrRaise "qalculate-gtk" (resource =? "qalculate-gtk"))
+ , ("<XF86Eject>", addName "Eject /dev/cdrom" $ spawn "eject /dev/cdrom")
+ , ("<Print>", addName "Take screenshot (dmscripts)" $ spawn "dm-maim")
+ ]
+ -- 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_SRC
+
+* Main
+This is the "main" of XMonad. This where everything in our configs comes together and works.
+
+#+BEGIN_SRC haskell
+main :: IO ()
+main = do
+ -- Launching three instances of xmobar on their monitors.
+ xmproc0 <- spawnPipe ("xmobar -x 0 $HOME/.config/xmobar/" ++ colorScheme ++ "-xmobarrc")
+ xmproc1 <- spawnPipe ("xmobar -x 1 $HOME/.config/xmobar/" ++ colorScheme ++ "-xmobarrc")
+ xmproc2 <- spawnPipe ("xmobar -x 2 $HOME/.config/xmobar/" ++ colorScheme ++ "-xmobarrc")
+ -- the xmonad, ya know...what the WM is named after!
+ xmonad $ addDescrKeys' ((mod4Mask, xK_F1), showKeybindings) myKeys $ ewmh $ docks $ def
+ { manageHook = myManageHook <+> manageDocks
+ , handleEventHook = swallowEventHook (className =? "Alacritty" <||> className =? "st-256color" <||> className =? "XTerm") (return True)
+ , modMask = myModMask
+ , terminal = myTerminal
+ , startupHook = myStartupHook
+ , layoutHook = showWName' myShowWNameTheme $ myLayoutHook
+ , workspaces = myWorkspaces
+ , borderWidth = myBorderWidth
+ , normalBorderColor = myNormColor
+ , focusedBorderColor = myFocusColor
+ , logHook = dynamicLogWithPP $ filterOutWsPP [scratchpadWorkspaceTag] $ xmobarPP
+ { ppOutput = \x -> hPutStrLn xmproc0 x -- xmobar on monitor 1
+ >> hPutStrLn xmproc1 x -- xmobar on monitor 2
+ >> hPutStrLn xmproc2 x -- xmobar on monitor 3
+ , ppCurrent = xmobarColor color06 "" . wrap
+ ("<box type=Bottom width=2 mb=2 color=" ++ color06 ++ ">") "</box>"
+ -- Visible but not current workspace
+ , ppVisible = xmobarColor color06 "" . clickable
+ -- Hidden workspace
+ , ppHidden = xmobarColor color05 "" . wrap
+ ("<box type=Top width=2 mt=2 color=" ++ color05 ++ ">") "</box>" . clickable
+ -- Hidden workspaces (no windows)
+ , ppHiddenNoWindows = xmobarColor color05 "" . clickable
+ -- Title of active window
+ , ppTitle = xmobarColor color16 "" . shorten 60
+ -- Separator character
+ , ppSep = "<fc=" ++ color09 ++ "> <fn=1>|</fn> </fc>"
+ -- Urgent workspace
+ , ppUrgent = xmobarColor color02 "" . wrap "!" "!"
+ -- Adding # of windows on current workspace to the bar
+ , ppExtras = [windowCount]
+ -- order of things in xmobar
+ , ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
+ }
+ }
+#+END_SRC
diff --git a/.config/xmonad/lib/Colors/DoomOne.hs b/.config/xmonad/lib/Colors/DoomOne.hs
new file mode 100644
index 0000000..a4fdb0f
--- /dev/null
+++ b/.config/xmonad/lib/Colors/DoomOne.hs
@@ -0,0 +1,28 @@
+module Colors.DoomOne where
+
+import XMonad
+
+colorScheme = "doom-one"
+
+colorBack = "#282c34"
+colorFore = "#bbc2cf"
+
+color01 = "#1c1f24"
+color02 = "#ff6c6b"
+color03 = "#98be65"
+color04 = "#da8548"
+color05 = "#51afef"
+color06 = "#c678dd"
+color07 = "#5699af"
+color08 = "#202328"
+color09 = "#5b6268"
+color10 = "#da8548"
+color11 = "#4db5bd"
+color12 = "#ecbe7b"
+color13 = "#3071db"
+color14 = "#a9a1e1"
+color15 = "#46d9ff"
+color16 = "#dfdfdf"
+
+colorTrayer :: String
+colorTrayer = "--tint 0x282c34"
diff --git a/.config/xmonad/lib/Colors/Dracula.hs b/.config/xmonad/lib/Colors/Dracula.hs
new file mode 100644
index 0000000..b7da3f1
--- /dev/null
+++ b/.config/xmonad/lib/Colors/Dracula.hs
@@ -0,0 +1,28 @@
+module Colors.Dracula where
+
+import XMonad
+
+colorScheme = "dracula"
+
+colorBack = "#282a36"
+colorFore = "#f8f8f2"
+
+color01="#000000"
+color02="#ff5555"
+color03="#50fa7b"
+color04="#f1fa8c"
+color05="#bd93f9"
+color06="#ff79c6"
+color07="#8be9fd"
+color08="#bfbfbf"
+color09="#4d4d4d"
+color10="#ff6e67"
+color11="#5af78e"
+color12="#f4f99d"
+color13="#caa9fa"
+color14="#ff92d0"
+color15="#9aedfe"
+color16="#e6e6e6"
+
+colorTrayer :: String
+colorTrayer = "--tint 0x282a36"
diff --git a/.config/xmonad/lib/Colors/GruvboxDark.hs b/.config/xmonad/lib/Colors/GruvboxDark.hs
new file mode 100644
index 0000000..ae472eb
--- /dev/null
+++ b/.config/xmonad/lib/Colors/GruvboxDark.hs
@@ -0,0 +1,28 @@
+module Colors.GruvboxDark where
+
+import XMonad
+
+colorScheme = "gruvbox-dark"
+
+colorBack = "#282828"
+colorFore = "#ebdbb2"
+
+color01 = "#282828"
+color02 = "#cc241d"
+color03 = "#98971a"
+color04 = "#d79921"
+color05 = "#458588"
+color06 = "#b16286"
+color07 = "#689d6a"
+color08 = "#a89984"
+color09 = "#928374"
+color10 = "#fb4934"
+color11 = "#b8bb26"
+color12 = "#fabd2f"
+color13 = "#83a598"
+color14 = "#d3869b"
+color15 = "#8ec07c"
+color16 = "#ebdbb2"
+
+colorTrayer :: String
+colorTrayer = "--tint 0x282828"
diff --git a/.config/xmonad/lib/Colors/MonokaiPro.hs b/.config/xmonad/lib/Colors/MonokaiPro.hs
new file mode 100644
index 0000000..c61f0ca
--- /dev/null
+++ b/.config/xmonad/lib/Colors/MonokaiPro.hs
@@ -0,0 +1,28 @@
+module Colors.MonokaiPro where
+
+import XMonad
+
+colorScheme = "monokai-pro"
+
+colorBack = "#2D2A2E"
+colorFore = "#FCFCFA"
+
+color01 = "#403E41"
+color02 = "#FF6188"
+color03 = "#A9DC76"
+color04 = "#FFD866"
+color05 = "#FC9867"
+color06 = "#AB9DF2"
+color07 = "#78DCE8"
+color08 = "#FCFCFA"
+color09 = "#727072"
+color10 = "#FF6188"
+color11 = "#A9DC76"
+color12 = "#FFD866"
+color13 = "#FC9867"
+color14 = "#AB9DF2"
+color15 = "#78DCE8"
+color16 = "#FCFCFA"
+
+colorTrayer :: String
+colorTrayer = "--tint 0x2D2A2E"
diff --git a/.config/xmonad/lib/Colors/Nord.hs b/.config/xmonad/lib/Colors/Nord.hs
new file mode 100644
index 0000000..01f07b9
--- /dev/null
+++ b/.config/xmonad/lib/Colors/Nord.hs
@@ -0,0 +1,28 @@
+module Colors.Nord where
+
+import XMonad
+
+colorScheme = "nord"
+
+colorBack = "#2E3440"
+colorFore = "#D8DEE9"
+
+color01 = "#3B4252"
+color02 = "#BF616A"
+color03 = "#A3BE8C"
+color04 = "#EBCB8B"
+color05 = "#81A1C1"
+color06 = "#B48EAD"
+color07 = "#88C0D0"
+color08 = "#E5E9F0"
+color09 = "#4C566A"
+color10 = "#BF616A"
+color11 = "#A3BE8C"
+color12 = "#EBCB8B"
+color13 = "#81A1C1"
+color14 = "#B48EAD"
+color15 = "#8FBCBB"
+color16 = "#ECEFF4"
+
+colorTrayer :: String
+colorTrayer = "--tint 0x2E3440"
diff --git a/.config/xmonad/lib/Colors/OceanicNext.hs b/.config/xmonad/lib/Colors/OceanicNext.hs
new file mode 100644
index 0000000..dd34476
--- /dev/null
+++ b/.config/xmonad/lib/Colors/OceanicNext.hs
@@ -0,0 +1,28 @@
+module Colors.OceanicNext where
+
+import XMonad
+
+colorScheme = "oceanic-next"
+
+colorBack = "#1b2b34"
+colorFore = "#d8dee9"
+
+color01 = "#29414f"
+color02 = "#ec5f67"
+color03 = "#99c794"
+color04 = "#fac863"
+color05 = "#6699cc"
+color06 = "#c594c5"
+color07 = "#5fb3b3"
+color08 = "#65737e"
+color09 = "#405860"
+color10 = "#ec5f67"
+color11 = "#99c794"
+color12 = "#fac863"
+color13 = "#6699cc"
+color14 = "#c594c5"
+color15 = "#5fb3b3"
+color16 = "#adb5c0"
+
+colorTrayer :: String
+colorTrayer = "--tint 0x1b2b34"
diff --git a/.config/xmonad/lib/Colors/Palenight.hs b/.config/xmonad/lib/Colors/Palenight.hs
new file mode 100644
index 0000000..c4dedbb
--- /dev/null
+++ b/.config/xmonad/lib/Colors/Palenight.hs
@@ -0,0 +1,28 @@
+module Colors.Palenight where
+
+import XMonad
+
+colorScheme = "palenight"
+
+colorBack = "#292d3e"
+colorFore = "#d0d0d0"
+
+color01 = "#292d3e"
+color02 = "#f07178"
+color03 = "#c3e88d"
+color04 = "#ffcb6b"
+color05 = "#82aaff"
+color06 = "#c792ea"
+color07 = "#89ddff"
+color08 = "#d0d0d0"
+color09 = "#434758"
+color10 = "#ff8b92"
+color11 = "#ddffa7"
+color12 = "#ffe585"
+color13 = "#9cc4ff"
+color14 = "#e1acff"
+color15 = "#a3f7ff"
+color16 = "#ffffff"
+
+colorTrayer :: String
+colorTrayer = "--tint 0x292d3e"
diff --git a/.config/xmonad/lib/Colors/SolarizedDark.hs b/.config/xmonad/lib/Colors/SolarizedDark.hs
new file mode 100644
index 0000000..e6455d6
--- /dev/null
+++ b/.config/xmonad/lib/Colors/SolarizedDark.hs
@@ -0,0 +1,28 @@
+module Colors.SolarizedDark where
+
+import XMonad
+
+colorScheme = "solarized-dark"
+
+colorBack = "#002b36"
+colorFore = "#839496"
+
+color01 = "#073642"
+color02 = "#dc322f"
+color03 = "#859900"
+color04 = "#b58900"
+color05 = "#268bd2"
+color06 = "#d33682"
+color07 = "#2aa198"
+color08 = "#eee8d5"
+color09 = "#002b36"
+color10 = "#cb4b16"
+color11 = "#586e75"
+color12 = "#657b83"
+color13 = "#839496"
+color14 = "#6c71c4"
+color15 = "#93a1a1"
+color16 = "#fdf6e3"
+
+colorTrayer :: String
+colorTrayer = "--tint 0x002b36"
diff --git a/.config/xmonad/lib/Colors/SolarizedLight.hs b/.config/xmonad/lib/Colors/SolarizedLight.hs
new file mode 100644
index 0000000..3049a7a
--- /dev/null
+++ b/.config/xmonad/lib/Colors/SolarizedLight.hs
@@ -0,0 +1,28 @@
+module Colors.SolarizedLight where
+
+import XMonad
+
+colorScheme = "solarized-light"
+
+colorBack = "#fdf6e3"
+colorFore = "#657b83"
+
+color01 = "#073642"
+color02 = "#dc322f"
+color03 = "#859900"
+color04 = "#b58900"
+color05 = "#268bd2"
+color06 = "#d33682"
+color07 = "#2aa198"
+color08 = "#eee8d5"
+color09 = "#002b36"
+color10 = "#cb4b16"
+color11 = "#586e75"
+color12 = "#657b83"
+color13 = "#839496"
+color14 = "#fdf6e3" -- Was color16 but too light for use in panel.
+color15 = "#93a1a1"
+color16 = "#6c71c4" -- Was color14 but needed a dark color in this spot.
+
+colorTrayer :: String
+colorTrayer = "--tint 0xfdf6e3"
diff --git a/.config/xmonad/lib/Colors/TomorrowNight.hs b/.config/xmonad/lib/Colors/TomorrowNight.hs
new file mode 100644
index 0000000..a2dbc98
--- /dev/null
+++ b/.config/xmonad/lib/Colors/TomorrowNight.hs
@@ -0,0 +1,28 @@
+module Colors.TomorrowNight where
+
+import XMonad
+
+colorScheme = "tomorrow-night"
+
+colorBack = "#1d1f21"
+colorFore = "#c5c8c6"
+
+color01 = "#1d1f21"
+color02 = "#cc6666"
+color03 = "#b5bd68"
+color04 = "#e6c547"
+color05 = "#81a2be"
+color06 = "#b294bb"
+color07 = "#70c0ba"
+color08 = "#373b41"
+color09 = "#666666"
+color10 = "#ff3334"
+color11 = "#9ec400"
+color12 = "#f0c674"
+color13 = "#81a2be"
+color14 = "#b77ee0"
+color15 = "#54ced6"
+color16 = "#282a2e"
+
+colorTrayer :: String
+colorTrayer = "--tint 0x1d1f21"
diff --git a/.config/xmonad/pacman-hooks/recompile-xmonad.hook b/.config/xmonad/pacman-hooks/recompile-xmonad.hook
new file mode 100644
index 0000000..5ef068c
--- /dev/null
+++ b/.config/xmonad/pacman-hooks/recompile-xmonad.hook
@@ -0,0 +1,10 @@
+[Trigger]
+Operation = Upgrade
+Type = Package
+Target = xmonad*
+
+[Action]
+Description = Recompiling Xmonad now because of Xmonad updates...
+When = PostTransaction
+Depends = xmonad
+Exec = /bin/sh -c "runuser -l $( who | cut -d ' ' -f1 | uniq) -c 'xmonad --recompile'"
diff --git a/.config/xmonad/pacman-hooks/recompile-xmonadh.hook b/.config/xmonad/pacman-hooks/recompile-xmonadh.hook
new file mode 100644
index 0000000..c014cbb
--- /dev/null
+++ b/.config/xmonad/pacman-hooks/recompile-xmonadh.hook
@@ -0,0 +1,10 @@
+[Trigger]
+Operation = Upgrade
+Type = Package
+Target = haskell*
+
+[Action]
+Description = Recompiling Xmonad now because of Haskell updates ...
+When = PostTransaction
+Depends = xmonad
+Exec = /bin/sh -c "runuser -l $( who | cut -d ' ' -f1 | uniq) -c 'xmonad --recompile'"
diff --git a/.config/xmonad/xmonad-example-configs/xmonad-example-polybar-treeselect-workspaces.hs b/.config/xmonad/xmonad-example-configs/xmonad-example-polybar-treeselect-workspaces.hs
new file mode 100644
index 0000000..663d1bd
--- /dev/null
+++ b/.config/xmonad/xmonad-example-configs/xmonad-example-polybar-treeselect-workspaces.hs
@@ -0,0 +1,851 @@
+-- Xmonad is a dynamically tiling X11 window manager that is written and
+-- configured in Haskell. Official documentation: https://xmonad.org
+
+-- This is the xmonad configuration of Derek Taylor (DistroTube)
+-- My YouTube: http://www.youtube.com/c/DistroTube
+-- My GitLab: http://www.gitlab.com/dwt1/
+
+-- This config is massively long. It is purposely bloated with a ton of
+-- 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
+------------------------------------------------------------------------
+ -- Base
+import XMonad
+import System.Exit (exitSuccess)
+import qualified XMonad.StackSet as W
+
+ -- Actions
+import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies)
+import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
+import XMonad.Actions.GridSelect
+import XMonad.Actions.MouseResize
+import XMonad.Actions.Promote
+import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
+import qualified XMonad.Actions.TreeSelect as TS
+import XMonad.Actions.WindowGo (runOrRaise)
+import XMonad.Actions.WithAll (sinkAll, killAll)
+import qualified XMonad.Actions.Search as S
+
+ -- Data
+import Data.Char (isSpace)
+import Data.Monoid
+import Data.Maybe (isJust)
+import Data.Tree
+import qualified Data.Tuple.Extra as TE
+import qualified Data.Map as M
+
+ -- Hooks
+import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, PP(..))
+import XMonad.Hooks.EwmhDesktops -- for some fullscreen events, also for xcomposite in obs.
+import XMonad.Hooks.FadeInactive
+import XMonad.Hooks.ManageDocks (avoidStruts, docks, docksEventHook, ToggleStruts(..))
+import XMonad.Hooks.ServerMode
+import XMonad.Hooks.SetWMName
+
+ -- Layouts
+import XMonad.Layout.GridVariants (Grid(Grid))
+import XMonad.Layout.SimplestFloat
+import XMonad.Layout.Spiral
+import XMonad.Layout.ResizableTile
+import XMonad.Layout.Tabbed
+import XMonad.Layout.ThreeColumns
+
+ -- Layouts modifiers
+import XMonad.Layout.LayoutModifier
+import XMonad.Layout.LimitWindows (limitWindows, increaseLimit, decreaseLimit)
+import XMonad.Layout.Magnifier
+import XMonad.Layout.MultiToggle (mkToggle, single, EOT(EOT), (??))
+import XMonad.Layout.MultiToggle.Instances (StdTransformers(NBFULL, MIRROR, NOBORDERS))
+import XMonad.Layout.NoBorders
+import XMonad.Layout.Renamed (renamed, Rename(Replace))
+import XMonad.Layout.ShowWName
+import XMonad.Layout.Spacing
+import XMonad.Layout.WindowArranger (windowArrange, WindowArrangerMsg(..))
+import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
+import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
+
+ -- Prompt
+import XMonad.Prompt
+import XMonad.Prompt.Input
+import XMonad.Prompt.FuzzyMatch
+import XMonad.Prompt.Man
+import XMonad.Prompt.Pass
+import XMonad.Prompt.Shell (shellPrompt)
+import XMonad.Prompt.Ssh
+import XMonad.Prompt.XMonad
+import Control.Arrow (first)
+
+ -- Utilities
+import XMonad.Util.EZConfig (additionalKeysP)
+import XMonad.Util.NamedScratchpad
+import XMonad.Util.Run (runProcessWithInput, safeSpawn)
+import XMonad.Util.SpawnOnce
+
+ -- For polybar
+import qualified DBus as D
+import qualified DBus.Client as D
+import qualified Codec.Binary.UTF8.String as UTF8
+
+------------------------------------------------------------------------
+-- 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.
+myFont :: String
+myFont = "xft:Mononoki Nerd Font:bold:size=9"
+
+myModMask :: KeyMask
+myModMask = mod4Mask -- Sets modkey to super/windows key
+
+myTerminal :: String
+myTerminal = "alacritty" -- Sets default terminal
+
+myBrowser :: String
+myBrowser = myTerminal ++ " -e lynx " -- Sets lynx as browser for tree select
+-- myBrowser = "firefox " -- Sets firefox as browser for tree select
+
+myEditor :: String
+myEditor = "emacsclient -c -a emacs " -- Sets emacs as editor for tree select
+-- myEditor = myTerminal ++ " -e vim " -- Sets vim as editor for tree select
+
+myBorderWidth :: Dimension
+myBorderWidth = 2 -- Sets border width for windows
+
+myNormColor :: String
+myNormColor = "#292d3e" -- Border color of normal windows
+
+myFocusColor :: String
+myFocusColor = "#bbc5ff" -- Border color of focused windows
+
+altMask :: KeyMask
+altMask = mod1Mask -- Setting this for use in xprompts
+
+-- Colors for polybar
+color1, color2, color3, color4 :: String
+color1 = "#7F7F7F"
+color2 = "#c792ea"
+color3 = "#900000"
+color4 = "#2E9AFE"
+
+------------------------------------------------------------------------
+-- AUTOSTART
+------------------------------------------------------------------------
+myStartupHook :: X ()
+myStartupHook = do
+ spawnOnce "nitrogen --restore &"
+ spawnOnce "picom &"
+ spawnOnce "/usr/bin/emacs --daemon &"
+ spawnOnce "~/.config/polybar/launch-xmonad.sh &"
+ setWMName "LG3D"
+
+------------------------------------------------------------------------
+-- GRID SELECT
+------------------------------------------------------------------------
+-- 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.
+myColorizer :: Window -> Bool -> X (String, String)
+myColorizer = colorRangeFromClassName
+ (0x29,0x2d,0x3e) -- lowest inactive bg
+ (0x29,0x2d,0x3e) -- highest inactive bg
+ (0xc7,0x92,0xea) -- active bg
+ (0xc0,0xa7,0x9a) -- inactive fg
+ (0x29,0x2d,0x3e) -- active fg
+
+-- gridSelect menu layout
+mygridConfig :: p -> GSConfig Window
+mygridConfig colorizer = (buildDefaultGSConfig myColorizer)
+ { gs_cellheight = 40
+ , gs_cellwidth = 200
+ , gs_cellpadding = 6
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+spawnSelected' :: [(String, String)] -> X ()
+spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
+ where conf = def
+ { gs_cellheight = 40
+ , gs_cellwidth = 200
+ , gs_cellpadding = 6
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+-- The lists below are actually 3-tuples for use with gridSelect and treeSelect.
+-- TreeSelect uses all three values in the 3-tuples but GridSelect only needs first
+-- two values in each list (see myAppGrid, myBookmarkGrid and myConfigGrid below).
+myApplications :: [(String, String, String)]
+myApplications = [ ("Audacity", "audacity", "Graphical cross-platform audio eidtor")
+ , ("Deadbeef", "deadbeef", "Lightweight GUI audio player")
+ , ("Emacs", "emacs", "Much more than a text editor")
+ , ("Firefox", "firefox", "The famous open source web browser")
+ , ("Geany", "geany", "A nice text editor")
+ , ("Geary", "geary", "Email client that is attractive")
+ , ("Gimp", "gimp", "Open source alternative to Photoshop")
+ , ("Kdenlive", "kdenlive", "A great open source video editor")
+ , ("LibreOffice Impress", "loimpress", "For making presentations")
+ , ("LibreOffice Writer", "lowriter", "A fully featured word processor")
+ , ("OBS", "obs", "Open broadcaster software")
+ , ("PCManFM", "pcmanfm", "Lightweight graphical file manager")
+ , ("Simple Terminal", "st", "Suckless simple terminal")
+ , ("Steam", "steam", "Proprietary gaming platform")
+ , ("Surf Browser", "surf suckless.org", "Suckless surf web browser")
+ , ("Xonotic", "xonotic-glx", "A fast-paced first person shooter")
+ ]
+
+myBookmarks :: [(String, String, String)]
+myBookmarks = [ ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ ]
+
+myConfigs :: [(String, String, String)]
+myConfigs = [ ("bashrc", myEditor ++ "~/.bashrc", "the bourne again shell")
+ , ("doom emacs config.el", myEditor ++ "~/.doom.d/config.el", "doom emacs config")
+ , ("doom emacs init.el", myEditor ++ "~/.doom.d/init.el", "doom emacs init")
+ , ("dwm", myEditor ++ "~/dwm-distrotube/config.h", "dwm config file")
+ , ("qtile", myEditor ++ "~/.config/qtile/config.py", "qtile config")
+ , ("xmonad.hs", myEditor ++ "~/.xmonad/xmonad.hs", "xmonad config")
+ , ("zshrc", myEditor ++ "~/.zshrc", "config for the z shell")
+ ]
+
+-- Let's take myApplications, myBookmarks and myConfigs and take only
+-- the first two values from those 3-tuples (for GridSelect).
+myAppGrid :: [(String, String)]
+myAppGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myApplications
+
+myBookmarkGrid :: [(String, String)]
+myBookmarkGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myBookmarks
+
+myConfigGrid :: [(String, String)]
+myConfigGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myConfigs
+
+------------------------------------------------------------------------
+-- TREE SELECT
+------------------------------------------------------------------------
+-- TreeSelect displays your workspaces or actions in a Tree-like format.
+-- You can select desired workspace/action with the cursor or hjkl keys.
+
+treeselectAction :: TS.TSConfig (X ()) -> X ()
+treeselectAction a = TS.treeselectAction a
+ [ Node (TS.TSNode "applications" "a list of programs I use often" (return ()))
+ [Node (TS.TSNode (TE.fst3 $ myApplications !! n)
+ (TE.thd3 $ myApplications !! n)
+ (spawn $ TE.snd3 $ myApplications !! n)
+ ) [] | n <- [0..(length myApplications - 1)]
+ ]
+ , Node (TS.TSNode "bookmarks" "a list of web bookmarks" (return ()))
+ [Node (TS.TSNode(TE.fst3 $ myBookmarks !! n)
+ (TE.thd3 $ myBookmarks !! n)
+ (spawn $ TE.snd3 $ myBookmarks !! n)
+ ) [] | n <- [0..(length myBookmarks - 1)]
+ ]
+ , Node (TS.TSNode "config files" "config files that edit often" (return ()))
+ [Node (TS.TSNode (TE.fst3 $ myConfigs !! n)
+ (TE.thd3 $ myConfigs !! n)
+ (spawn $ TE.snd3 $ myConfigs !! n)
+ ) [] | n <- [0..(length myConfigs - 1)]
+ ]
+ ]
+
+-- Configuration options for treeSelect
+tsDefaultConfig :: TS.TSConfig a
+tsDefaultConfig = TS.TSConfig { TS.ts_hidechildren = True
+ , TS.ts_background = 0xdd292d3e
+ , TS.ts_font = myFont
+ , TS.ts_node = (0xffd0d0d0, 0xff202331)
+ , TS.ts_nodealt = (0xffd0d0d0, 0xff292d3e)
+ , TS.ts_highlight = (0xffffffff, 0xff755999)
+ , TS.ts_extra = 0xffd0d0d0
+ , TS.ts_node_width = 200
+ , TS.ts_node_height = 20
+ , TS.ts_originX = 0
+ , TS.ts_originY = 0
+ , TS.ts_indent = 80
+ , TS.ts_navigate = myTreeNavigation
+ }
+
+-- 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.
+myTreeNavigation = M.fromList
+ [ ((0, xK_Escape), TS.cancel)
+ , ((0, xK_Return), TS.select)
+ , ((0, xK_space), TS.select)
+ , ((0, xK_Up), TS.movePrev)
+ , ((0, xK_Down), TS.moveNext)
+ , ((0, xK_Left), TS.moveParent)
+ , ((0, xK_Right), TS.moveChild)
+ , ((0, xK_k), TS.movePrev)
+ , ((0, xK_j), TS.moveNext)
+ , ((0, xK_h), TS.moveParent)
+ , ((0, xK_l), TS.moveChild)
+ , ((0, xK_o), TS.moveHistBack)
+ , ((0, xK_i), TS.moveHistForward)
+ , ((0, xK_d), TS.moveTo ["dev"])
+ , ((0, xK_g), TS.moveTo ["graphics"])
+ , ((0, xK_m), TS.moveTo ["music"])
+ , ((0, xK_v), TS.moveTo ["video"])
+ , ((0, xK_w), TS.moveTo ["web"])
+ , ((mod4Mask, xK_b), TS.moveTo ["web", "browser"])
+ , ((mod4Mask, xK_c), TS.moveTo ["web", "chat"])
+ , ((mod4Mask, xK_m), TS.moveTo ["web", "email"])
+ , ((mod4Mask, xK_r), TS.moveTo ["web", "rss"])
+ , ((mod4Mask, xK_w), TS.moveTo ["web", "web conference"])
+ , ((mod4Mask, xK_d), TS.moveTo ["dev", "docs"])
+ , ((mod4Mask, xK_e), TS.moveTo ["dev", "emacs"])
+ , ((mod4Mask, xK_f), TS.moveTo ["dev", "files"])
+ , ((mod4Mask, xK_p), TS.moveTo ["dev", "programming"])
+ , ((mod4Mask, xK_t), TS.moveTo ["dev", "terminal"])
+ , ((mod4Mask, xK_z), TS.moveTo ["dev", "virtualization"])
+ , ((mod4Mask, xK_g), TS.moveTo ["graphics", "gimp"])
+ , ((mod4Mask, xK_i), TS.moveTo ["graphics", "image viewer"])
+ , ((mod4Mask, xK_a), TS.moveTo ["music", "audio editor"])
+ , ((mod4Mask, xK_u), TS.moveTo ["music", "music player"])
+ , ((mod4Mask, xK_o), TS.moveTo ["video", "obs"])
+ , ((mod4Mask, xK_v), TS.moveTo ["video", "video player"])
+ , ((mod4Mask, xK_k), TS.moveTo ["video", "kdenlive"])
+ , ((mod4Mask .|. altMask, xK_h), TS.moveTo ["dev", "programming", "haskell"])
+ , ((mod4Mask .|. altMask, xK_p), TS.moveTo ["dev", "programming", "python"])
+ , ((mod4Mask .|. altMask, xK_s), TS.moveTo ["dev", "programming", "shell"])
+ ]
+
+------------------------------------------------------------------------
+-- XPROMPT SETTINGS
+------------------------------------------------------------------------
+dtXPConfig :: XPConfig
+dtXPConfig = def
+ { font = myFont
+ , bgColor = "#292d3e"
+ , fgColor = "#d0d0d0"
+ , bgHLight = "#c792ea"
+ , fgHLight = "#000000"
+ , borderColor = "#535974"
+ , promptBorderWidth = 0
+ , promptKeymap = dtXPKeymap
+ , position = Top
+-- , position = CenteredAt { xpCenterY = 0.3, xpWidth = 0.3 }
+ , height = 20
+ , historySize = 256
+ , historyFilter = id
+ , defaultText = []
+ , autoComplete = Just 100000 -- set Just 100000 for .1 sec
+ , showCompletionOnTab = False
+ -- , searchPredicate = isPrefixOf
+ , searchPredicate = fuzzyMatch
+ , alwaysHighlight = True
+ , maxComplRows = Nothing -- set to Just 5 for 5 rows
+ }
+
+-- The same config above minus the autocomplete feature which is annoying
+-- on certain Xprompts, like the search engine prompts.
+dtXPConfig' :: XPConfig
+dtXPConfig' = dtXPConfig
+ { autoComplete = Nothing
+ }
+
+-- A list of all of the standard Xmonad prompts and a key press assigned to them.
+-- These are used in conjunction with keybinding I set later in the config.
+promptList :: [(String, XPConfig -> X ())]
+promptList = [ ("m", manPrompt) -- manpages prompt
+ , ("p", passPrompt) -- get passwords (requires 'pass')
+ , ("g", passGeneratePrompt) -- generate passwords (requires 'pass')
+ , ("r", passRemovePrompt) -- remove passwords (requires 'pass')
+ , ("s", sshPrompt) -- ssh prompt
+ , ("x", xmonadPrompt) -- xmonad prompt
+ ]
+
+-- Same as the above list except this is for my custom prompts.
+promptList' :: [(String, XPConfig -> String -> X (), String)]
+promptList' = [ ("c", calcPrompt, "qalc") -- requires qalculate-gtk
+ ]
+
+------------------------------------------------------------------------
+-- CUSTOM PROMPTS
+------------------------------------------------------------------------
+-- 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.
+calcPrompt :: XPConfig -> String -> X ()
+calcPrompt c ans =
+ inputPrompt c (trim ans) ?+ \input ->
+ liftIO(runProcessWithInput "qalc" [input] "") >>= calcPrompt c
+ where
+ trim = f . f
+ where f = reverse . dropWhile isSpace
+
+------------------------------------------------------------------------
+-- XPROMPT KEYMAP (emacs-like key bindings for xprompts)
+------------------------------------------------------------------------
+dtXPKeymap :: M.Map (KeyMask,KeySym) (XP ())
+dtXPKeymap = M.fromList $
+ map (first $ (,) controlMask) -- control + <key>
+ [ (xK_z, killBefore) -- kill line backwards
+ , (xK_k, killAfter) -- kill line forwards
+ , (xK_a, startOfLine) -- move to the beginning of the line
+ , (xK_e, endOfLine) -- move to the end of the line
+ , (xK_m, deleteString Next) -- delete a character foward
+ , (xK_b, moveCursor Prev) -- move cursor forward
+ , (xK_f, moveCursor Next) -- move cursor backward
+ , (xK_BackSpace, killWord Prev) -- kill the previous word
+ , (xK_y, pasteString) -- paste a string
+ , (xK_g, quit) -- quit out of prompt
+ , (xK_bracketleft, quit)
+ ]
+ ++
+ map (first $ (,) altMask) -- meta key + <key>
+ [ (xK_BackSpace, killWord Prev) -- kill the prev word
+ , (xK_f, moveWord Next) -- move a word forward
+ , (xK_b, moveWord Prev) -- move a word backward
+ , (xK_d, killWord Next) -- kill the next word
+ , (xK_n, moveHistory W.focusUp') -- move up thru history
+ , (xK_p, moveHistory W.focusDown') -- move down thru history
+ ]
+ ++
+ map (first $ (,) 0) -- <key>
+ [ (xK_Return, setSuccess True >> setDone True)
+ , (xK_KP_Enter, setSuccess True >> setDone True)
+ , (xK_BackSpace, deleteString Prev)
+ , (xK_Delete, deleteString Next)
+ , (xK_Left, moveCursor Prev)
+ , (xK_Right, moveCursor Next)
+ , (xK_Home, startOfLine)
+ , (xK_End, endOfLine)
+ , (xK_Down, moveHistory W.focusUp')
+ , (xK_Up, moveHistory W.focusDown')
+ , (xK_Escape, quit)
+ ]
+
+------------------------------------------------------------------------
+-- 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.
+archwiki, ebay, news, reddit, urban :: S.SearchEngine
+
+archwiki = S.searchEngine "archwiki" "https://wiki.archlinux.org/index.php?search="
+ebay = S.searchEngine "ebay" "https://www.ebay.com/sch/i.html?_nkw="
+news = S.searchEngine "news" "https://news.google.com/search?q="
+reddit = S.searchEngine "reddit" "https://www.reddit.com/search/?q="
+urban = S.searchEngine "urban" "https://www.urbandictionary.com/define.php?term="
+
+-- This is the list of search engines that I want to use. Some are from
+-- XMonad.Actions.Search, and some are the ones that I added above.
+searchList :: [(String, S.SearchEngine)]
+searchList = [ ("a", archwiki)
+ , ("d", S.duckduckgo)
+ , ("e", ebay)
+ , ("g", S.google)
+ , ("h", S.hoogle)
+ , ("i", S.images)
+ , ("n", news)
+ , ("r", reddit)
+ , ("s", S.stackage)
+ , ("t", S.thesaurus)
+ , ("v", S.vocabulary)
+ , ("b", S.wayback)
+ , ("u", urban)
+ , ("w", S.wikipedia)
+ , ("y", S.youtube)
+ , ("z", S.amazon)
+ ]
+
+
+------------------------------------------------------------------------
+-- WORKSPACES
+------------------------------------------------------------------------
+-- TreeSelect workspaces
+myWorkspaces :: Forest String
+myWorkspaces = [ Node "dev"
+ [ Node "terminal" []
+ , Node "emacs" []
+ , Node "docs" []
+ , Node "files" []
+ , Node "programming"
+ [ Node "haskell" []
+ , Node "python" []
+ , Node "shell" []
+ ]
+ , Node "virtualization" []
+ ]
+ , Node "web"
+ [ Node "browser" []
+ , Node "chat" []
+ , Node "email" []
+ , Node "rss" []
+ , Node "web conference" []
+ ]
+ , Node "graphics"
+ [ Node "gimp" []
+ , Node "image viewer" []
+ ]
+ , Node "music"
+ [ Node "audio editor" []
+ , Node "music player" []
+ ]
+ , Node "video"
+ [ Node "obs" []
+ , Node "kdenlive" []
+ , Node "video player" []
+ ]
+ ]
+
+------------------------------------------------------------------------
+-- 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.
+
+myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
+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 clickable workspaces, which would look like:
+ -- doShift "<action xdotool super+8>gfx</action>"
+ [ className =? "obs" --> doShift ( "video.obs" )
+ , title =? "firefox" --> doShift ( "web.browser" )
+ , title =? "qutebrowser" --> doShift ( "web.browser" )
+ , className =? "mpv" --> doShift ( "video.movie player" )
+ , className =? "vlc" --> doShift ( "video.movie player" )
+ , className =? "Gimp" --> doShift ( "graphics.gimp")
+ , className =? "Gimp" --> doFloat
+ , title =? "Oracle VM VirtualBox Manager" --> doFloat
+ , className =? "VirtualBox Manager" --> doShift ( "dev.virtualization" )
+ , (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog
+ ] <+> namedScratchpadManageHook myScratchPads
+
+------------------------------------------------------------------------
+-- LOGHOOK
+------------------------------------------------------------------------
+-- Override the PP values as you would otherwise, adding colors etc depending
+-- on the statusbar used
+myLogHook :: D.Client -> PP
+myLogHook dbus = def
+ { ppOutput = dbusOutput dbus
+ , ppCurrent = wrap ("%{F" ++ color4 ++ "} ") "%{F-}"
+ , ppVisible = wrap ("%{F" ++ color1 ++ "} ") "%{F-}"
+ , ppUrgent = wrap ("%{F" ++ color3 ++ "} ") "%{F-}"
+ , ppHidden = wrap ("%{F" ++ color1 ++ "} ") "%{F-}"
+ , ppTitle = wrap ("%{F" ++ color2 ++ "}")"%{F-}"
+ , ppSep = " | "
+ }
+
+------------------------------------------------------------------------
+-- LAYOUTS
+------------------------------------------------------------------------
+-- Makes setting the spacingRaw simpler to write. The spacingRaw
+-- module adds a configurable amount of space around windows.
+mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing i = spacingRaw False (Border i i i i) True (Border i i i i) True
+
+-- Below is a variation of the above except no borders are applied
+-- if fewer than two windows. So a single window has no gaps.
+mySpacing' :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing' i = spacingRaw True (Border i i i i) True (Border i i i i) True
+
+-- Defining a bunch of layouts, many that I don't use.
+tall = renamed [Replace "tall"]
+ $ limitWindows 12
+ $ mySpacing 8
+ $ ResizableTall 1 (3/100) (1/2) []
+magnify = renamed [Replace "magnify"]
+ $ magnifier
+ $ limitWindows 12
+ $ mySpacing 8
+ $ ResizableTall 1 (3/100) (1/2) []
+monocle = renamed [Replace "monocle"]
+ $ limitWindows 20 Full
+floats = renamed [Replace "floats"]
+ $ limitWindows 20 simplestFloat
+grid = renamed [Replace "grid"]
+ $ limitWindows 12
+ $ mySpacing 8
+ $ mkToggle (single MIRROR)
+ $ Grid (16/10)
+spirals = renamed [Replace "spirals"]
+ $ mySpacing' 8
+ $ spiral (6/7)
+threeCol = renamed [Replace "threeCol"]
+ $ limitWindows 7
+ $ mySpacing' 4
+ $ ThreeCol 1 (3/100) (1/2)
+threeRow = renamed [Replace "threeRow"]
+ $ limitWindows 7
+ $ mySpacing' 4
+ -- Mirror takes a layout and rotates it by 90 degrees.
+ -- So we are applying Mirror to the ThreeCol layout.
+ $ Mirror
+ $ ThreeCol 1 (3/100) (1/2)
+tabs = renamed [Replace "tabs"]
+ -- I cannot add spacing to this layout because it will
+ -- add spacing between window and tabs which looks bad.
+ $ tabbed shrinkText myTabConfig
+ where
+ myTabConfig = def { fontName = "xft:Mononoki Nerd Font:regular:pixelsize=11"
+ , activeColor = "#292d3e"
+ , inactiveColor = "#3e445e"
+ , activeBorderColor = "#292d3e"
+ , inactiveBorderColor = "#292d3e"
+ , activeTextColor = "#ffffff"
+ , inactiveTextColor = "#d0d0d0"
+ }
+
+-- Theme for showWName which prints current workspace when you change workspaces.
+myShowWNameTheme :: SWNConfig
+myShowWNameTheme = def
+ { swn_font = "xft:Sans:bold:size=60"
+ , swn_fade = 1.0
+ , swn_bgcolor = "#000000"
+ , swn_color = "#FFFFFF"
+ }
+
+-- The layout hook
+myLayoutHook = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats $
+ mkToggle (NBFULL ?? NOBORDERS ?? EOT) myDefaultLayout
+ where
+ -- I've commented out the layouts I don't use.
+ myDefaultLayout = tall
+ ||| magnify
+ ||| noBorders monocle
+ ||| floats
+ -- ||| grid
+ ||| noBorders tabs
+ -- ||| spirals
+ -- ||| threeCol
+ -- ||| threeRow
+
+------------------------------------------------------------------------
+-- SCRATCHPADS
+------------------------------------------------------------------------
+-- Allows to have several floating scratchpads running different applications.
+-- Import Util.NamedScratchpad. Bind a key to namedScratchpadSpawnAction.
+myScratchPads :: [NamedScratchpad]
+myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
+ , NS "mocp" spawnMocp findMocp manageMocp
+ ]
+ where
+ spawnTerm = myTerminal ++ " -n scratchpad"
+ findTerm = resource =? "scratchpad"
+ manageTerm = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+ spawnMocp = myTerminal ++ " -n mocp 'mocp'"
+ findMocp = resource =? "mocp"
+ manageMocp = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+
+------------------------------------------------------------------------
+-- KEYBINDINGS
+------------------------------------------------------------------------
+-- I am using the Xmonad.Util.EZConfig module which allows keybindings
+-- to be written in simpler, emacs-like format.
+myKeys :: [(String, X ())]
+myKeys =
+ -- Xmonad
+ [ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
+ , ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
+ , ("M-S-q", io exitSuccess) -- Quits xmonad
+
+ -- Open my preferred terminal
+ , ("M-<Return>", spawn myTerminal)
+
+ -- Run Prompt
+ , ("M-S-<Return>", shellPrompt dtXPConfig) -- Shell Prompt
+
+ -- Windows
+ , ("M-S-c", kill1) -- Kill the currently focused client
+ , ("M-S-a", killAll) -- Kill all windows on current workspace
+
+ -- Floating windows
+ , ("M-f", sendMessage (T.Toggle "floats")) -- Toggles my 'floats' layout
+ , ("M-<Delete>", withFocused $ windows . W.sink) -- Push floating window back to tile
+ , ("M-S-<Delete>", sinkAll) -- Push ALL floating windows to tile
+
+ -- Grid Select (CTRL-g followed by a key)
+ , ("C-g g", spawnSelected' myAppGrid) -- grid select favorite apps
+ , ("C-g m", spawnSelected' myBookmarkGrid) -- grid select some bookmarks
+ , ("C-g c", spawnSelected' myConfigGrid) -- grid select useful config files
+ , ("C-g t", goToSelected $ mygridConfig myColorizer) -- goto selected window
+ , ("C-g b", bringSelected $ mygridConfig myColorizer) -- bring selected window
+
+ -- Tree Select/
+ -- tree select actions menu
+ , ("C-t a", treeselectAction tsDefaultConfig)
+ -- tree select workspaces menu
+ , ("C-t t", TS.treeselectWorkspace tsDefaultConfig myWorkspaces W.greedyView)
+ -- tree select choose workspace to send window
+ , ("C-t g", TS.treeselectWorkspace tsDefaultConfig myWorkspaces W.shift)
+
+ -- 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
+ --, ("M-S-m", windows W.swapMaster) -- Swap the focused window and the master window
+ , ("M-S-j", windows W.swapDown) -- Swap focused window with next window
+ , ("M-S-k", windows W.swapUp) -- Swap focused window with prev window
+ , ("M-<Backspace>", promote) -- Moves focused window to master, others maintain order
+ , ("M1-S-<Tab>", rotSlavesDown) -- Rotate all windows except master and keep focus in place
+ , ("M1-C-<Tab>", rotAllDown) -- Rotate all the windows in the current stack
+ --, ("M-S-s", windows copyToAll)
+ , ("M-C-s", killAllOtherCopies)
+
+ -- Layouts
+ , ("M-<Tab>", sendMessage NextLayout) -- Switch to next layout
+ , ("M-C-M1-<Up>", sendMessage Arrange)
+ , ("M-C-M1-<Down>", sendMessage DeArrange)
+ , ("M-<Space>", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts) -- Toggles noborder/full
+ , ("M-S-<Space>", sendMessage ToggleStruts) -- Toggles struts
+ , ("M-S-n", sendMessage $ MT.Toggle NOBORDERS) -- Toggles noborder
+ , ("M-<KP_Multiply>", sendMessage (IncMasterN 1)) -- Increase number of clients in master pane
+ , ("M-<KP_Divide>", sendMessage (IncMasterN (-1))) -- Decrease number of clients in master pane
+ , ("M-S-<KP_Multiply>", increaseLimit) -- Increase number of windows
+ , ("M-S-<KP_Divide>", decreaseLimit) -- Decrease number of windows
+
+ , ("M-h", sendMessage Shrink) -- Shrink horiz window width
+ , ("M-l", sendMessage Expand) -- Expand horiz window width
+ , ("M-C-j", sendMessage MirrorShrink) -- Shrink vert window width
+ , ("M-C-k", sendMessage MirrorExpand) -- Exoand vert window width
+
+ -- Workspaces
+ , ("M-.", nextScreen) -- Switch focus to next monitor
+ , ("M-,", prevScreen) -- Switch focus to prev monitor
+ , ("M-S-<KP_Add>", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws
+ , ("M-S-<KP_Subtract>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws
+
+ -- Scratchpads
+ , ("M-C-<Return>", namedScratchpadAction myScratchPads "terminal")
+ , ("M-C-c", namedScratchpadAction myScratchPads "mocp")
+
+ -- Controls for mocp music player.
+ , ("M-u p", spawn "mocp --play")
+ , ("M-u l", spawn "mocp --next")
+ , ("M-u h", spawn "mocp --previous")
+ , ("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 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 '(+vterm/here nil)'") -- eshell 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/\")'")
+
+ --- 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-i", spawn (myTerminal ++ " -e irssi"))
+ , ("M-M1-j", spawn (myTerminal ++ " -e joplin"))
+ , ("M-M1-l", spawn (myTerminal ++ " -e lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss gopher://distro.tube"))
+ , ("M-M1-m", spawn (myTerminal ++ " -e mocp"))
+ , ("M-M1-n", spawn (myTerminal ++ " -e newsboat"))
+ , ("M-M1-p", spawn (myTerminal ++ " -e pianobar"))
+ , ("M-M1-r", spawn (myTerminal ++ " -e rtv"))
+ , ("M-M1-t", spawn (myTerminal ++ " -e toot curses"))
+ , ("M-M1-w", spawn (myTerminal ++ " -e wopr report.xml"))
+ , ("M-M1-y", spawn (myTerminal ++ " -e youtube-viewer"))
+
+ -- Multimedia Keys
+ , ("<XF86AudioPlay>", spawn "cmus toggle")
+ , ("<XF86AudioPrev>", spawn "cmus prev")
+ , ("<XF86AudioNext>", spawn "cmus next")
+ -- , ("<XF86AudioMute>", spawn "amixer set Master toggle") -- Bug prevents it from toggling correctly in 12.04.
+ , ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%- unmute")
+ , ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+ unmute")
+ , ("<XF86HomePage>", spawn "firefox")
+ , ("<XF86Search>", safeSpawn "firefox" ["https://www.google.com/"])
+ , ("<XF86Mail>", runOrRaise "geary" (resource =? "thunderbird"))
+ , ("<XF86Calculator>", runOrRaise "gcalctool" (resource =? "gcalctool"))
+ , ("<XF86Eject>", spawn "toggleeject")
+ , ("<Print>", spawn "scrotd 0")
+ ]
+ -- Appending search engine prompts to keybindings list.
+ -- Look at "search engines" section of this config for values for "k".
+ ++ [("M-s " ++ k, S.promptSearch dtXPConfig' f) | (k,f) <- searchList ]
+ ++ [("M-S-s " ++ k, S.selectSearch f) | (k,f) <- searchList ]
+ -- Appending some extra xprompts to keybindings list.
+ -- Look at "xprompt settings" section this of config for values for "k".
+ ++ [("M-p " ++ k, f dtXPConfig') | (k,f) <- promptList ]
+ ++ [("M-p " ++ k, f dtXPConfig' g) | (k,f,g) <- promptList' ]
+ -- 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"))
+
+------------------------------------------------------------------------
+-- MAIN
+------------------------------------------------------------------------
+main :: IO ()
+main = do
+ dbus <- D.connectSession
+ -- Request access to the DBus name
+ D.requestName dbus (D.busName_ "org.xmonad.Log")
+ [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]
+ -- The xmonad, ya know...what the window manager is named after.
+ xmonad $ ewmh $ docks $ defaults { logHook = dynamicLogWithPP (myLogHook dbus) }
+
+-- Emit a DBus signal on log updates
+dbusOutput :: D.Client -> String -> IO ()
+dbusOutput dbus str = do
+ let signal = (D.signal objectPath interfaceName memberName) {
+ D.signalBody = [D.toVariant $ UTF8.decodeString str]
+ }
+ D.emit dbus signal
+ where
+ objectPath = D.objectPath_ "/org/xmonad/Log"
+ interfaceName = D.interfaceName_ "org.xmonad.Log"
+ memberName = D.memberName_ "Update"
+
+defaults = def
+ { handleEventHook = serverModeEventHookCmd
+ <+> serverModeEventHook
+ <+> serverModeEventHookF "XMONAD_PRINT" (io . putStrLn)
+ <+> docksEventHook
+ , modMask = myModMask
+ , terminal = myTerminal
+ , workspaces = TS.toWorkspaces myWorkspaces
+ , layoutHook = showWName' myShowWNameTheme $ smartBorders $ myLayoutHook
+ , normalBorderColor = myNormColor
+ , focusedBorderColor = myFocusColor
+ , manageHook = myManageHook <+> manageHook def
+ , borderWidth = myBorderWidth
+ , startupHook = myStartupHook
+ } `additionalKeysP` myKeys
diff --git a/.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-clickable-workspaces.hs b/.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-clickable-workspaces.hs
new file mode 100644
index 0000000..439f099
--- /dev/null
+++ b/.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-clickable-workspaces.hs
@@ -0,0 +1,795 @@
+-- Xmonad is a dynamically tiling X11 window manager that is written and
+-- configured in Haskell. Official documentation: https://xmonad.org
+
+-- This is the xmonad configuration of Derek Taylor (DistroTube)
+-- My YouTube: http://www.youtube.com/c/DistroTube
+-- My GitLab: http://www.gitlab.com/dwt1/
+
+-- This config is massively long. It is purposely bloated with a ton of
+-- 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
+------------------------------------------------------------------------
+ -- Base
+import XMonad
+import System.IO (hPutStrLn)
+import System.Exit (exitSuccess)
+import qualified XMonad.StackSet as W
+
+ -- Actions
+import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies)
+import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
+import XMonad.Actions.GridSelect
+import XMonad.Actions.MouseResize
+import XMonad.Actions.Promote
+import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
+import qualified XMonad.Actions.TreeSelect as TS
+import XMonad.Actions.WindowGo (runOrRaise)
+import XMonad.Actions.WithAll (sinkAll, killAll)
+import qualified XMonad.Actions.Search as S
+
+ -- Data
+import Data.Char (isSpace)
+import Data.Monoid
+import Data.Maybe (isJust)
+import Data.Tree
+import qualified Data.Tuple.Extra as TE
+import qualified Data.Map as M
+
+ -- Hooks
+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.FadeInactive
+import XMonad.Hooks.ManageDocks (avoidStruts, docksEventHook, manageDocks, ToggleStruts(..))
+import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
+import XMonad.Hooks.ServerMode
+import XMonad.Hooks.SetWMName
+import XMonad.Hooks.WorkspaceHistory
+
+ -- Layouts
+import XMonad.Layout.GridVariants (Grid(Grid))
+import XMonad.Layout.SimplestFloat
+import XMonad.Layout.Spiral
+import XMonad.Layout.ResizableTile
+import XMonad.Layout.Tabbed
+import XMonad.Layout.ThreeColumns
+
+ -- Layouts modifiers
+import XMonad.Layout.LayoutModifier
+import XMonad.Layout.LimitWindows (limitWindows, increaseLimit, decreaseLimit)
+import XMonad.Layout.Magnifier
+import XMonad.Layout.MultiToggle (mkToggle, single, EOT(EOT), (??))
+import XMonad.Layout.MultiToggle.Instances (StdTransformers(NBFULL, MIRROR, NOBORDERS))
+import XMonad.Layout.NoBorders
+import XMonad.Layout.Renamed (renamed, Rename(Replace))
+import XMonad.Layout.ShowWName
+import XMonad.Layout.Spacing
+import XMonad.Layout.WindowArranger (windowArrange, WindowArrangerMsg(..))
+import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
+import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
+
+ -- Prompt
+import XMonad.Prompt
+import XMonad.Prompt.Input
+import XMonad.Prompt.FuzzyMatch
+import XMonad.Prompt.Man
+import XMonad.Prompt.Pass
+import XMonad.Prompt.Shell (shellPrompt)
+import XMonad.Prompt.Ssh
+import XMonad.Prompt.XMonad
+import Control.Arrow (first)
+
+ -- Utilities
+import XMonad.Util.EZConfig (additionalKeysP)
+import XMonad.Util.NamedScratchpad
+import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
+import XMonad.Util.SpawnOnce
+
+------------------------------------------------------------------------
+-- 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.
+myFont :: String
+myFont = "xft:Mononoki Nerd Font:bold:size=9"
+
+myModMask :: KeyMask
+myModMask = mod4Mask -- Sets modkey to super/windows key
+
+myTerminal :: String
+myTerminal = "alacritty" -- Sets default terminal
+
+myBrowser :: String
+myBrowser = myTerminal ++ " -e lynx " -- Sets lynx as browser for tree select
+-- myBrowser = "firefox " -- Sets firefox as browser for tree select
+
+myEditor :: String
+myEditor = "emacsclient -c -a emacs " -- Sets emacs as editor for tree select
+-- myEditor = myTerminal ++ " -e vim " -- Sets vim as editor for tree select
+
+myBorderWidth :: Dimension
+myBorderWidth = 2 -- Sets border width for windows
+
+myNormColor :: String
+myNormColor = "#292d3e" -- Border color of normal windows
+
+myFocusColor :: String
+myFocusColor = "#bbc5ff" -- 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
+
+------------------------------------------------------------------------
+-- AUTOSTART
+------------------------------------------------------------------------
+myStartupHook :: X ()
+myStartupHook = do
+ spawnOnce "nitrogen --restore &"
+ spawnOnce "picom &"
+ spawnOnce "nm-applet &"
+ spawnOnce "volumeicon &"
+ spawnOnce "trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x292d3e --height 18 &"
+ spawnOnce "/usr/bin/emacs --daemon &"
+ -- spawnOnce "kak -d -s mysession &"
+ setWMName "LG3D"
+
+------------------------------------------------------------------------
+-- GRID SELECT
+------------------------------------------------------------------------
+-- 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.
+myColorizer :: Window -> Bool -> X (String, String)
+myColorizer = colorRangeFromClassName
+ (0x29,0x2d,0x3e) -- lowest inactive bg
+ (0x29,0x2d,0x3e) -- highest inactive bg
+ (0xc7,0x92,0xea) -- active bg
+ (0xc0,0xa7,0x9a) -- inactive fg
+ (0x29,0x2d,0x3e) -- active fg
+
+-- gridSelect menu layout
+mygridConfig :: p -> GSConfig Window
+mygridConfig colorizer = (buildDefaultGSConfig myColorizer)
+ { gs_cellheight = 40
+ , gs_cellwidth = 200
+ , gs_cellpadding = 6
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+spawnSelected' :: [(String, String)] -> X ()
+spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
+ where conf = def
+ { gs_cellheight = 40
+ , gs_cellwidth = 200
+ , gs_cellpadding = 6
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+-- The lists below are actually 3-tuples for use with gridSelect and treeSelect.
+-- TreeSelect uses all three values in the 3-tuples but GridSelect only needs first
+-- two values in each list (see myAppGrid, myBookmarkGrid and myConfigGrid below).
+myApplications :: [(String, String, String)]
+myApplications = [ ("Audacity", "audacity", "Graphical cross-platform audio eidtor")
+ , ("Deadbeef", "deadbeef", "Lightweight GUI audio player")
+ , ("Emacs", "emacs", "Much more than a text editor")
+ , ("Firefox", "firefox", "The famous open source web browser")
+ , ("Geany", "geany", "A nice text editor")
+ , ("Geary", "geary", "Email client that is attractive")
+ , ("Gimp", "gimp", "Open source alternative to Photoshop")
+ , ("Kdenlive", "kdenlive", "A great open source video editor")
+ , ("LibreOffice Impress", "loimpress", "For making presentations")
+ , ("LibreOffice Writer", "lowriter", "A fully featured word processor")
+ , ("OBS", "obs", "Open broadcaster software")
+ , ("PCManFM", "pcmanfm", "Lightweight graphical file manager")
+ , ("Simple Terminal", "st", "Suckless simple terminal")
+ , ("Steam", "steam", "Proprietary gaming platform")
+ , ("Surf Browser", "surf suckless.org", "Suckless surf web browser")
+ , ("Xonotic", "xonotic-glx", "A fast-paced first person shooter")
+ ]
+
+myBookmarks :: [(String, String, String)]
+myBookmarks = [ ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ ]
+
+myConfigs :: [(String, String, String)]
+myConfigs = [ ("bashrc", myEditor ++ "~/.bashrc", "the bourne again shell")
+ , ("doom emacs config.el", myEditor ++ "~/.doom.d/config.el", "doom emacs config")
+ , ("doom emacs init.el", myEditor ++ "~/.doom.d/init.el", "doom emacs init")
+ , ("dwm", myEditor ++ "~/dwm-distrotube/config.h", "dwm config file")
+ , ("qtile", myEditor ++ "~/.config/qtile/config.py", "qtile config")
+ , ("xmonad.hs", myEditor ++ "~/.xmonad/xmonad.hs", "xmonad config")
+ , ("zshrc", myEditor ++ "~/.zshrc", "config for the z shell")
+ ]
+
+-- Let's take myApplications, myBookmarks and myConfigs and take only
+-- the first two values from those 3-tuples (for GridSelect).
+myAppGrid :: [(String, String)]
+myAppGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myApplications
+
+myBookmarkGrid :: [(String, String)]
+myBookmarkGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myBookmarks
+
+myConfigGrid :: [(String, String)]
+myConfigGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myConfigs
+
+------------------------------------------------------------------------
+-- TREE SELECT
+------------------------------------------------------------------------
+-- TreeSelect displays your workspaces or actions in a Tree-like format.
+-- You can select desired workspace/action with the cursor or hjkl keys.
+
+treeselectAction :: TS.TSConfig (X ()) -> X ()
+treeselectAction a = TS.treeselectAction a
+ [ Node (TS.TSNode "applications" "a list of programs I use often" (return ()))
+ [Node (TS.TSNode (TE.fst3 $ myApplications !! n)
+ (TE.thd3 $ myApplications !! n)
+ (spawn $ TE.snd3 $ myApplications !! n)
+ ) [] | n <- [0..(length myApplications - 1)]
+ ]
+ , Node (TS.TSNode "bookmarks" "a list of web bookmarks" (return ()))
+ [Node (TS.TSNode(TE.fst3 $ myBookmarks !! n)
+ (TE.thd3 $ myBookmarks !! n)
+ (spawn $ TE.snd3 $ myBookmarks !! n)
+ ) [] | n <- [0..(length myBookmarks - 1)]
+ ]
+ , Node (TS.TSNode "config files" "config files that edit often" (return ()))
+ [Node (TS.TSNode (TE.fst3 $ myConfigs !! n)
+ (TE.thd3 $ myConfigs !! n)
+ (spawn $ TE.snd3 $ myConfigs !! n)
+ ) [] | n <- [0..(length myConfigs - 1)]
+ ]
+ ]
+
+-- Configuration options for treeSelect
+tsDefaultConfig :: TS.TSConfig a
+tsDefaultConfig = TS.TSConfig { TS.ts_hidechildren = True
+ , TS.ts_background = 0xdd292d3e
+ , TS.ts_font = myFont
+ , TS.ts_node = (0xffd0d0d0, 0xff202331)
+ , TS.ts_nodealt = (0xffd0d0d0, 0xff292d3e)
+ , TS.ts_highlight = (0xffffffff, 0xff755999)
+ , TS.ts_extra = 0xffd0d0d0
+ , TS.ts_node_width = 200
+ , TS.ts_node_height = 20
+ , TS.ts_originX = 0
+ , TS.ts_originY = 0
+ , TS.ts_indent = 80
+ , TS.ts_navigate = myTreeNavigation
+ }
+
+-- 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.
+myTreeNavigation = M.fromList
+ [ ((0, xK_Escape), TS.cancel)
+ , ((0, xK_Return), TS.select)
+ , ((0, xK_space), TS.select)
+ , ((0, xK_Up), TS.movePrev)
+ , ((0, xK_Down), TS.moveNext)
+ , ((0, xK_Left), TS.moveParent)
+ , ((0, xK_Right), TS.moveChild)
+ , ((0, xK_k), TS.movePrev)
+ , ((0, xK_j), TS.moveNext)
+ , ((0, xK_h), TS.moveParent)
+ , ((0, xK_l), TS.moveChild)
+ , ((0, xK_o), TS.moveHistBack)
+ , ((0, xK_i), TS.moveHistForward)
+ ]
+
+------------------------------------------------------------------------
+-- XPROMPT SETTINGS
+------------------------------------------------------------------------
+dtXPConfig :: XPConfig
+dtXPConfig = def
+ { font = myFont
+ , bgColor = "#292d3e"
+ , fgColor = "#d0d0d0"
+ , bgHLight = "#c792ea"
+ , fgHLight = "#000000"
+ , borderColor = "#535974"
+ , promptBorderWidth = 0
+ , promptKeymap = dtXPKeymap
+ , position = Top
+-- , position = CenteredAt { xpCenterY = 0.3, xpWidth = 0.3 }
+ , height = 20
+ , historySize = 256
+ , historyFilter = id
+ , defaultText = []
+ , autoComplete = Just 100000 -- set Just 100000 for .1 sec
+ , showCompletionOnTab = False
+ -- , searchPredicate = isPrefixOf
+ , searchPredicate = fuzzyMatch
+ , alwaysHighlight = True
+ , maxComplRows = Nothing -- set to Just 5 for 5 rows
+ }
+
+-- The same config above minus the autocomplete feature which is annoying
+-- on certain Xprompts, like the search engine prompts.
+dtXPConfig' :: XPConfig
+dtXPConfig' = dtXPConfig
+ { autoComplete = Nothing
+ }
+
+-- A list of all of the standard Xmonad prompts and a key press assigned to them.
+-- These are used in conjunction with keybinding I set later in the config.
+promptList :: [(String, XPConfig -> X ())]
+promptList = [ ("m", manPrompt) -- manpages prompt
+ , ("p", passPrompt) -- get passwords (requires 'pass')
+ , ("g", passGeneratePrompt) -- generate passwords (requires 'pass')
+ , ("r", passRemovePrompt) -- remove passwords (requires 'pass')
+ , ("s", sshPrompt) -- ssh prompt
+ , ("x", xmonadPrompt) -- xmonad prompt
+ ]
+
+-- Same as the above list except this is for my custom prompts.
+promptList' :: [(String, XPConfig -> String -> X (), String)]
+promptList' = [ ("c", calcPrompt, "qalc") -- requires qalculate-gtk
+ ]
+
+------------------------------------------------------------------------
+-- CUSTOM PROMPTS
+------------------------------------------------------------------------
+-- 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.
+calcPrompt :: XPConfig -> String -> X ()
+calcPrompt c ans =
+ inputPrompt c (trim ans) ?+ \input ->
+ liftIO(runProcessWithInput "qalc" [input] "") >>= calcPrompt c
+ where
+ trim = f . f
+ where f = reverse . dropWhile isSpace
+
+------------------------------------------------------------------------
+-- XPROMPT KEYMAP (emacs-like key bindings for xprompts)
+------------------------------------------------------------------------
+dtXPKeymap :: M.Map (KeyMask,KeySym) (XP ())
+dtXPKeymap = M.fromList $
+ map (first $ (,) controlMask) -- control + <key>
+ [ (xK_z, killBefore) -- kill line backwards
+ , (xK_k, killAfter) -- kill line forwards
+ , (xK_a, startOfLine) -- move to the beginning of the line
+ , (xK_e, endOfLine) -- move to the end of the line
+ , (xK_m, deleteString Next) -- delete a character foward
+ , (xK_b, moveCursor Prev) -- move cursor forward
+ , (xK_f, moveCursor Next) -- move cursor backward
+ , (xK_BackSpace, killWord Prev) -- kill the previous word
+ , (xK_y, pasteString) -- paste a string
+ , (xK_g, quit) -- quit out of prompt
+ , (xK_bracketleft, quit)
+ ]
+ ++
+ map (first $ (,) altMask) -- meta key + <key>
+ [ (xK_BackSpace, killWord Prev) -- kill the prev word
+ , (xK_f, moveWord Next) -- move a word forward
+ , (xK_b, moveWord Prev) -- move a word backward
+ , (xK_d, killWord Next) -- kill the next word
+ , (xK_n, moveHistory W.focusUp') -- move up thru history
+ , (xK_p, moveHistory W.focusDown') -- move down thru history
+ ]
+ ++
+ map (first $ (,) 0) -- <key>
+ [ (xK_Return, setSuccess True >> setDone True)
+ , (xK_KP_Enter, setSuccess True >> setDone True)
+ , (xK_BackSpace, deleteString Prev)
+ , (xK_Delete, deleteString Next)
+ , (xK_Left, moveCursor Prev)
+ , (xK_Right, moveCursor Next)
+ , (xK_Home, startOfLine)
+ , (xK_End, endOfLine)
+ , (xK_Down, moveHistory W.focusUp')
+ , (xK_Up, moveHistory W.focusDown')
+ , (xK_Escape, quit)
+ ]
+
+------------------------------------------------------------------------
+-- 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.
+archwiki, ebay, news, reddit, urban :: S.SearchEngine
+
+archwiki = S.searchEngine "archwiki" "https://wiki.archlinux.org/index.php?search="
+ebay = S.searchEngine "ebay" "https://www.ebay.com/sch/i.html?_nkw="
+news = S.searchEngine "news" "https://news.google.com/search?q="
+reddit = S.searchEngine "reddit" "https://www.reddit.com/search/?q="
+urban = S.searchEngine "urban" "https://www.urbandictionary.com/define.php?term="
+
+-- This is the list of search engines that I want to use. Some are from
+-- XMonad.Actions.Search, and some are the ones that I added above.
+searchList :: [(String, S.SearchEngine)]
+searchList = [ ("a", archwiki)
+ , ("d", S.duckduckgo)
+ , ("e", ebay)
+ , ("g", S.google)
+ , ("h", S.hoogle)
+ , ("i", S.images)
+ , ("n", news)
+ , ("r", reddit)
+ , ("s", S.stackage)
+ , ("t", S.thesaurus)
+ , ("v", S.vocabulary)
+ , ("b", S.wayback)
+ , ("u", urban)
+ , ("w", S.wikipedia)
+ , ("y", S.youtube)
+ , ("z", S.amazon)
+ ]
+
+------------------------------------------------------------------------
+-- 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.
+
+xmobarEscape :: String -> String
+xmobarEscape = concatMap doubleLts
+ where
+ doubleLts '<' = "<<"
+ doubleLts x = [x]
+
+myWorkspaces :: [String]
+myWorkspaces = clickable . map xmobarEscape
+ $ ["dev", "www", "sys", "doc", "vbox", "chat", "mus", "vid", "gfx"]
+ where
+ clickable l = [ "<action=xdotool key super+" ++ show n ++ ">" ++ ws ++ "</action>" |
+ (i,ws) <- zip [1..9] l,
+ let n = i ]
+
+------------------------------------------------------------------------
+-- 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.
+
+myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
+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 clickable workspaces, which would look like:
+ -- doShift "<action xdotool super+8>gfx</action>"
+ [ className =? "obs" --> doShift ( "video.obs" )
+ , title =? "firefox" --> doShift ( "web.browser" )
+ , title =? "qutebrowser" --> doShift ( "web.browser" )
+ , className =? "mpv" --> doShift ( "video.movie player" )
+ , className =? "vlc" --> doShift ( "video.movie player" )
+ , className =? "Gimp" --> doShift ( "graphics.gimp")
+ , className =? "Gimp" --> doFloat
+ , title =? "Oracle VM VirtualBox Manager" --> doFloat
+ , className =? "VirtualBox Manager" --> doShift ( "dev.virtualization" )
+ , (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog
+ ] <+> namedScratchpadManageHook myScratchPads
+
+------------------------------------------------------------------------
+-- 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).
+myLogHook :: X ()
+myLogHook = fadeInactiveLogHook fadeAmount
+ where fadeAmount = 1.0
+
+------------------------------------------------------------------------
+-- LAYOUTS
+------------------------------------------------------------------------
+-- Makes setting the spacingRaw simpler to write. The spacingRaw
+-- module adds a configurable amount of space around windows.
+mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing i = spacingRaw False (Border i i i i) True (Border i i i i) True
+
+-- Below is a variation of the above except no borders are applied
+-- if fewer than two windows. So a single window has no gaps.
+mySpacing' :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing' i = spacingRaw True (Border i i i i) True (Border i i i i) True
+
+-- Defining a bunch of layouts, many that I don't use.
+tall = renamed [Replace "tall"]
+ $ limitWindows 12
+ $ mySpacing 8
+ $ ResizableTall 1 (3/100) (1/2) []
+magnify = renamed [Replace "magnify"]
+ $ magnifier
+ $ limitWindows 12
+ $ mySpacing 8
+ $ ResizableTall 1 (3/100) (1/2) []
+monocle = renamed [Replace "monocle"]
+ $ limitWindows 20 Full
+floats = renamed [Replace "floats"]
+ $ limitWindows 20 simplestFloat
+grid = renamed [Replace "grid"]
+ $ limitWindows 12
+ $ mySpacing 8
+ $ mkToggle (single MIRROR)
+ $ Grid (16/10)
+spirals = renamed [Replace "spirals"]
+ $ mySpacing' 8
+ $ spiral (6/7)
+threeCol = renamed [Replace "threeCol"]
+ $ limitWindows 7
+ $ mySpacing' 4
+ $ ThreeCol 1 (3/100) (1/2)
+threeRow = renamed [Replace "threeRow"]
+ $ limitWindows 7
+ $ mySpacing' 4
+ -- Mirror takes a layout and rotates it by 90 degrees.
+ -- So we are applying Mirror to the ThreeCol layout.
+ $ Mirror
+ $ ThreeCol 1 (3/100) (1/2)
+tabs = renamed [Replace "tabs"]
+ -- I cannot add spacing to this layout because it will
+ -- add spacing between window and tabs which looks bad.
+ $ tabbed shrinkText myTabConfig
+ where
+ myTabConfig = def { fontName = "xft:Mononoki Nerd Font:regular:pixelsize=11"
+ , activeColor = "#292d3e"
+ , inactiveColor = "#3e445e"
+ , activeBorderColor = "#292d3e"
+ , inactiveBorderColor = "#292d3e"
+ , activeTextColor = "#ffffff"
+ , inactiveTextColor = "#d0d0d0"
+ }
+
+-- Theme for showWName which prints current workspace when you change workspaces.
+myShowWNameTheme :: SWNConfig
+myShowWNameTheme = def
+ { swn_font = "xft:Sans:bold:size=60"
+ , swn_fade = 1.0
+ , swn_bgcolor = "#000000"
+ , swn_color = "#FFFFFF"
+ }
+
+-- The layout hook
+myLayoutHook = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats $
+ mkToggle (NBFULL ?? NOBORDERS ?? EOT) myDefaultLayout
+ where
+ -- I've commented out the layouts I don't use.
+ myDefaultLayout = tall
+ ||| magnify
+ ||| noBorders monocle
+ ||| floats
+ -- ||| grid
+ ||| noBorders tabs
+ -- ||| spirals
+ -- ||| threeCol
+ -- ||| threeRow
+
+------------------------------------------------------------------------
+-- SCRATCHPADS
+------------------------------------------------------------------------
+-- Allows to have several floating scratchpads running different applications.
+-- Import Util.NamedScratchpad. Bind a key to namedScratchpadSpawnAction.
+myScratchPads :: [NamedScratchpad]
+myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
+ , NS "mocp" spawnMocp findMocp manageMocp
+ ]
+ where
+ spawnTerm = myTerminal ++ " -n scratchpad"
+ findTerm = resource =? "scratchpad"
+ manageTerm = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+ spawnMocp = myTerminal ++ " -n mocp 'mocp'"
+ findMocp = resource =? "mocp"
+ manageMocp = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+
+------------------------------------------------------------------------
+-- KEYBINDINGS
+------------------------------------------------------------------------
+-- I am using the Xmonad.Util.EZConfig module which allows keybindings
+-- to be written in simpler, emacs-like format.
+myKeys :: [(String, X ())]
+myKeys =
+ -- Xmonad
+ [ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
+ , ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
+ , ("M-S-q", io exitSuccess) -- Quits xmonad
+
+ -- Open my preferred terminal
+ , ("M-<Return>", spawn myTerminal)
+
+ -- Run Prompt
+ , ("M-S-<Return>", shellPrompt dtXPConfig) -- Shell Prompt
+
+ -- Windows
+ , ("M-S-c", kill1) -- Kill the currently focused client
+ , ("M-S-a", killAll) -- Kill all windows on current workspace
+
+ -- Floating windows
+ , ("M-f", sendMessage (T.Toggle "floats")) -- Toggles my 'floats' layout
+ , ("M-<Delete>", withFocused $ windows . W.sink) -- Push floating window back to tile
+ , ("M-S-<Delete>", sinkAll) -- Push ALL floating windows to tile
+
+ -- Grid Select (CTRL-g followed by a key)
+ , ("C-g g", spawnSelected' myAppGrid) -- grid select favorite apps
+ , ("C-g m", spawnSelected' myBookmarkGrid) -- grid select some bookmarks
+ , ("C-g c", spawnSelected' myConfigGrid) -- grid select useful config files
+ , ("C-g t", goToSelected $ mygridConfig myColorizer) -- goto selected window
+ , ("C-g b", bringSelected $ mygridConfig myColorizer) -- bring selected window
+
+ -- Tree Select/
+ -- tree select actions menu
+ , ("C-t a", treeselectAction tsDefaultConfig)
+
+ -- 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
+ --, ("M-S-m", windows W.swapMaster) -- Swap the focused window and the master window
+ , ("M-S-j", windows W.swapDown) -- Swap focused window with next window
+ , ("M-S-k", windows W.swapUp) -- Swap focused window with prev window
+ , ("M-<Backspace>", promote) -- Moves focused window to master, others maintain order
+ , ("M1-S-<Tab>", rotSlavesDown) -- Rotate all windows except master and keep focus in place
+ , ("M1-C-<Tab>", rotAllDown) -- Rotate all the windows in the current stack
+ --, ("M-S-s", windows copyToAll)
+ , ("M-C-s", killAllOtherCopies)
+
+ -- Layouts
+ , ("M-<Tab>", sendMessage NextLayout) -- Switch to next layout
+ , ("M-C-M1-<Up>", sendMessage Arrange)
+ , ("M-C-M1-<Down>", sendMessage DeArrange)
+ , ("M-<Space>", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts) -- Toggles noborder/full
+ , ("M-S-<Space>", sendMessage ToggleStruts) -- Toggles struts
+ , ("M-S-n", sendMessage $ MT.Toggle NOBORDERS) -- Toggles noborder
+ , ("M-<KP_Multiply>", sendMessage (IncMasterN 1)) -- Increase number of clients in master pane
+ , ("M-<KP_Divide>", sendMessage (IncMasterN (-1))) -- Decrease number of clients in master pane
+ , ("M-S-<KP_Multiply>", increaseLimit) -- Increase number of windows
+ , ("M-S-<KP_Divide>", decreaseLimit) -- Decrease number of windows
+
+ , ("M-h", sendMessage Shrink) -- Shrink horiz window width
+ , ("M-l", sendMessage Expand) -- Expand horiz window width
+ , ("M-C-j", sendMessage MirrorShrink) -- Shrink vert window width
+ , ("M-C-k", sendMessage MirrorExpand) -- Exoand vert window width
+
+ -- Workspaces
+ , ("M-.", nextScreen) -- Switch focus to next monitor
+ , ("M-,", prevScreen) -- Switch focus to prev monitor
+ , ("M-S-<KP_Add>", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws
+ , ("M-S-<KP_Subtract>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws
+
+ -- Scratchpads
+ , ("M-C-<Return>", namedScratchpadAction myScratchPads "terminal")
+ , ("M-C-c", namedScratchpadAction myScratchPads "mocp")
+
+ -- Controls for mocp music player.
+ , ("M-u p", spawn "mocp --play")
+ , ("M-u l", spawn "mocp --next")
+ , ("M-u h", spawn "mocp --previous")
+ , ("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 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 '(+vterm/here nil)'") -- eshell 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/\")'")
+
+ --- 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-i", spawn (myTerminal ++ " -e irssi"))
+ , ("M-M1-j", spawn (myTerminal ++ " -e joplin"))
+ , ("M-M1-l", spawn (myTerminal ++ " -e lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss gopher://distro.tube"))
+ , ("M-M1-m", spawn (myTerminal ++ " -e mocp"))
+ , ("M-M1-n", spawn (myTerminal ++ " -e newsboat"))
+ , ("M-M1-p", spawn (myTerminal ++ " -e pianobar"))
+ , ("M-M1-r", spawn (myTerminal ++ " -e rtv"))
+ , ("M-M1-t", spawn (myTerminal ++ " -e toot curses"))
+ , ("M-M1-w", spawn (myTerminal ++ " -e wopr report.xml"))
+ , ("M-M1-y", spawn (myTerminal ++ " -e youtube-viewer"))
+
+ -- Multimedia Keys
+ , ("<XF86AudioPlay>", spawn "cmus toggle")
+ , ("<XF86AudioPrev>", spawn "cmus prev")
+ , ("<XF86AudioNext>", spawn "cmus next")
+ -- , ("<XF86AudioMute>", spawn "amixer set Master toggle") -- Bug prevents it from toggling correctly in 12.04.
+ , ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%- unmute")
+ , ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+ unmute")
+ , ("<XF86HomePage>", spawn "firefox")
+ , ("<XF86Search>", safeSpawn "firefox" ["https://www.google.com/"])
+ , ("<XF86Mail>", runOrRaise "geary" (resource =? "thunderbird"))
+ , ("<XF86Calculator>", runOrRaise "gcalctool" (resource =? "gcalctool"))
+ , ("<XF86Eject>", spawn "toggleeject")
+ , ("<Print>", spawn "scrotd 0")
+ ]
+ -- Appending search engine prompts to keybindings list.
+ -- Look at "search engines" section of this config for values for "k".
+ ++ [("M-s " ++ k, S.promptSearch dtXPConfig' f) | (k,f) <- searchList ]
+ ++ [("M-S-s " ++ k, S.selectSearch f) | (k,f) <- searchList ]
+ -- Appending some extra xprompts to keybindings list.
+ -- Look at "xprompt settings" section this of config for values for "k".
+ ++ [("M-p " ++ k, f dtXPConfig') | (k,f) <- promptList ]
+ ++ [("M-p " ++ k, f dtXPConfig' g) | (k,f,g) <- promptList' ]
+ -- 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"))
+
+------------------------------------------------------------------------
+-- MAIN
+------------------------------------------------------------------------
+main :: IO ()
+main = do
+ -- Launching three instances of xmobar on their monitors.
+ xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc0"
+ xmproc1 <- spawnPipe "xmobar -x 1 ~/.config/xmobar/xmobarrc2"
+ xmproc2 <- spawnPipe "xmobar -x 2 ~/.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.
+ , handleEventHook = serverModeEventHookCmd
+ <+> serverModeEventHook
+ <+> serverModeEventHookF "XMONAD_PRINT" (io . putStrLn)
+ <+> docksEventHook
+ , modMask = myModMask
+ , terminal = myTerminal
+ , startupHook = myStartupHook
+ , layoutHook = showWName' myShowWNameTheme myLayoutHook
+ , workspaces = myWorkspaces
+ , borderWidth = myBorderWidth
+ , normalBorderColor = myNormColor
+ , focusedBorderColor = myFocusColor
+ , logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP
+ { ppOutput = \x -> hPutStrLn xmproc0 x >> hPutStrLn xmproc1 x >> hPutStrLn xmproc2 x
+ , ppCurrent = xmobarColor "#c3e88d" "" . wrap "[" "]" -- Current workspace in xmobar
+ , ppVisible = xmobarColor "#c3e88d" "" -- Visible but not current workspace
+ , ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" -- Hidden workspaces in xmobar
+ , ppHiddenNoWindows = xmobarColor "#F07178" "" -- Hidden workspaces (no windows)
+ , ppTitle = xmobarColor "#d0d0d0" "" . shorten 60 -- Title of active window in xmobar
+ , ppSep = "<fc=#666666> | </fc>" -- Separators in xmobar
+ , ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!" -- Urgent workspace
+ , ppExtras = [windowCount] -- # of windows current workspace
+ , ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
+ }
+ } `additionalKeysP` myKeys
diff --git a/.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-non-clickable.hs b/.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-non-clickable.hs
new file mode 100644
index 0000000..917cd79
--- /dev/null
+++ b/.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-non-clickable.hs
@@ -0,0 +1,780 @@
+-- Xmonad is a dynamically tiling X11 window manager that is written and
+-- configured in Haskell. Official documentation: https://xmonad.org
+
+-- This is the xmonad configuration of Derek Taylor (DistroTube)
+-- My YouTube: http://www.youtube.com/c/DistroTube
+-- My GitLab: http://www.gitlab.com/dwt1/
+
+-- This config is massively long. It is purposely bloated with a ton of
+-- 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
+------------------------------------------------------------------------
+ -- Base
+import XMonad
+import System.IO (hPutStrLn)
+import System.Exit (exitSuccess)
+import qualified XMonad.StackSet as W
+
+ -- Actions
+import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies)
+import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
+import XMonad.Actions.GridSelect
+import XMonad.Actions.MouseResize
+import XMonad.Actions.Promote
+import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
+import qualified XMonad.Actions.TreeSelect as TS
+import XMonad.Actions.WindowGo (runOrRaise)
+import XMonad.Actions.WithAll (sinkAll, killAll)
+import qualified XMonad.Actions.Search as S
+
+ -- Data
+import Data.Char (isSpace)
+import Data.Monoid
+import Data.Maybe (isJust)
+import Data.Tree
+import qualified Data.Tuple.Extra as TE
+import qualified Data.Map as M
+
+ -- Hooks
+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.FadeInactive
+import XMonad.Hooks.ManageDocks (avoidStruts, docksEventHook, manageDocks, ToggleStruts(..))
+import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
+import XMonad.Hooks.ServerMode
+import XMonad.Hooks.SetWMName
+import XMonad.Hooks.WorkspaceHistory
+
+ -- Layouts
+import XMonad.Layout.GridVariants (Grid(Grid))
+import XMonad.Layout.SimplestFloat
+import XMonad.Layout.Spiral
+import XMonad.Layout.ResizableTile
+import XMonad.Layout.Tabbed
+import XMonad.Layout.ThreeColumns
+
+ -- Layouts modifiers
+import XMonad.Layout.LayoutModifier
+import XMonad.Layout.LimitWindows (limitWindows, increaseLimit, decreaseLimit)
+import XMonad.Layout.Magnifier
+import XMonad.Layout.MultiToggle (mkToggle, single, EOT(EOT), (??))
+import XMonad.Layout.MultiToggle.Instances (StdTransformers(NBFULL, MIRROR, NOBORDERS))
+import XMonad.Layout.NoBorders
+import XMonad.Layout.Renamed (renamed, Rename(Replace))
+import XMonad.Layout.ShowWName
+import XMonad.Layout.Spacing
+import XMonad.Layout.WindowArranger (windowArrange, WindowArrangerMsg(..))
+import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
+import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
+
+ -- Prompt
+import XMonad.Prompt
+import XMonad.Prompt.Input
+import XMonad.Prompt.FuzzyMatch
+import XMonad.Prompt.Man
+import XMonad.Prompt.Pass
+import XMonad.Prompt.Shell (shellPrompt)
+import XMonad.Prompt.Ssh
+import XMonad.Prompt.XMonad
+import Control.Arrow (first)
+
+ -- Utilities
+import XMonad.Util.EZConfig (additionalKeysP)
+import XMonad.Util.NamedScratchpad
+import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
+import XMonad.Util.SpawnOnce
+
+------------------------------------------------------------------------
+-- 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.
+myFont :: String
+myFont = "xft:Mononoki Nerd Font:bold:size=9"
+
+myModMask :: KeyMask
+myModMask = mod4Mask -- Sets modkey to super/windows key
+
+myTerminal :: String
+myTerminal = "alacritty" -- Sets default terminal
+
+myBrowser :: String
+myBrowser = myTerminal ++ " -e lynx " -- Sets lynx as browser for tree select
+-- myBrowser = "firefox " -- Sets firefox as browser for tree select
+
+myEditor :: String
+myEditor = "emacsclient -c -a emacs " -- Sets emacs as editor for tree select
+-- myEditor = myTerminal ++ " -e vim " -- Sets vim as editor for tree select
+
+myBorderWidth :: Dimension
+myBorderWidth = 2 -- Sets border width for windows
+
+myNormColor :: String
+myNormColor = "#292d3e" -- Border color of normal windows
+
+myFocusColor :: String
+myFocusColor = "#bbc5ff" -- 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
+
+------------------------------------------------------------------------
+-- AUTOSTART
+------------------------------------------------------------------------
+myStartupHook :: X ()
+myStartupHook = do
+ spawnOnce "nitrogen --restore &"
+ spawnOnce "picom &"
+ spawnOnce "nm-applet &"
+ spawnOnce "volumeicon &"
+ spawnOnce "trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x292d3e --height 18 &"
+ spawnOnce "/usr/bin/emacs --daemon &"
+ -- spawnOnce "kak -d -s mysession &"
+ setWMName "LG3D"
+
+------------------------------------------------------------------------
+-- GRID SELECT
+------------------------------------------------------------------------
+-- 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.
+myColorizer :: Window -> Bool -> X (String, String)
+myColorizer = colorRangeFromClassName
+ (0x29,0x2d,0x3e) -- lowest inactive bg
+ (0x29,0x2d,0x3e) -- highest inactive bg
+ (0xc7,0x92,0xea) -- active bg
+ (0xc0,0xa7,0x9a) -- inactive fg
+ (0x29,0x2d,0x3e) -- active fg
+
+-- gridSelect menu layout
+mygridConfig :: p -> GSConfig Window
+mygridConfig colorizer = (buildDefaultGSConfig myColorizer)
+ { gs_cellheight = 40
+ , gs_cellwidth = 200
+ , gs_cellpadding = 6
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+spawnSelected' :: [(String, String)] -> X ()
+spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
+ where conf = def
+ { gs_cellheight = 40
+ , gs_cellwidth = 200
+ , gs_cellpadding = 6
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+-- The lists below are actually 3-tuples for use with gridSelect and treeSelect.
+-- TreeSelect uses all three values in the 3-tuples but GridSelect only needs first
+-- two values in each list (see myAppGrid, myBookmarkGrid and myConfigGrid below).
+myApplications :: [(String, String, String)]
+myApplications = [ ("Audacity", "audacity", "Graphical cross-platform audio eidtor")
+ , ("Deadbeef", "deadbeef", "Lightweight GUI audio player")
+ , ("Emacs", "emacs", "Much more than a text editor")
+ , ("Firefox", "firefox", "The famous open source web browser")
+ , ("Geany", "geany", "A nice text editor")
+ , ("Geary", "geary", "Email client that is attractive")
+ , ("Gimp", "gimp", "Open source alternative to Photoshop")
+ , ("Kdenlive", "kdenlive", "A great open source video editor")
+ , ("LibreOffice Impress", "loimpress", "For making presentations")
+ , ("LibreOffice Writer", "lowriter", "A fully featured word processor")
+ , ("OBS", "obs", "Open broadcaster software")
+ , ("PCManFM", "pcmanfm", "Lightweight graphical file manager")
+ , ("Simple Terminal", "st", "Suckless simple terminal")
+ , ("Steam", "steam", "Proprietary gaming platform")
+ , ("Surf Browser", "surf suckless.org", "Suckless surf web browser")
+ , ("Xonotic", "xonotic-glx", "A fast-paced first person shooter")
+ ]
+
+myBookmarks :: [(String, String, String)]
+myBookmarks = [ ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ ]
+
+myConfigs :: [(String, String, String)]
+myConfigs = [ ("bashrc", myEditor ++ "~/.bashrc", "the bourne again shell")
+ , ("doom emacs config.el", myEditor ++ "~/.doom.d/config.el", "doom emacs config")
+ , ("doom emacs init.el", myEditor ++ "~/.doom.d/init.el", "doom emacs init")
+ , ("dwm", myEditor ++ "~/dwm-distrotube/config.h", "dwm config file")
+ , ("qtile", myEditor ++ "~/.config/qtile/config.py", "qtile config")
+ , ("xmonad.hs", myEditor ++ "~/.xmonad/xmonad.hs", "xmonad config")
+ , ("zshrc", myEditor ++ "~/.zshrc", "config for the z shell")
+ ]
+
+-- Let's take myApplications, myBookmarks and myConfigs and take only
+-- the first two values from those 3-tuples (for GridSelect).
+myAppGrid :: [(String, String)]
+myAppGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myApplications
+
+myBookmarkGrid :: [(String, String)]
+myBookmarkGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myBookmarks
+
+myConfigGrid :: [(String, String)]
+myConfigGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myConfigs
+
+------------------------------------------------------------------------
+-- TREE SELECT
+------------------------------------------------------------------------
+-- TreeSelect displays your workspaces or actions in a Tree-like format.
+-- You can select desired workspace/action with the cursor or hjkl keys.
+
+treeselectAction :: TS.TSConfig (X ()) -> X ()
+treeselectAction a = TS.treeselectAction a
+ [ Node (TS.TSNode "applications" "a list of programs I use often" (return ()))
+ [Node (TS.TSNode (TE.fst3 $ myApplications !! n)
+ (TE.thd3 $ myApplications !! n)
+ (spawn $ TE.snd3 $ myApplications !! n)
+ ) [] | n <- [0..(length myApplications - 1)]
+ ]
+ , Node (TS.TSNode "bookmarks" "a list of web bookmarks" (return ()))
+ [Node (TS.TSNode(TE.fst3 $ myBookmarks !! n)
+ (TE.thd3 $ myBookmarks !! n)
+ (spawn $ TE.snd3 $ myBookmarks !! n)
+ ) [] | n <- [0..(length myBookmarks - 1)]
+ ]
+ , Node (TS.TSNode "config files" "config files that edit often" (return ()))
+ [Node (TS.TSNode (TE.fst3 $ myConfigs !! n)
+ (TE.thd3 $ myConfigs !! n)
+ (spawn $ TE.snd3 $ myConfigs !! n)
+ ) [] | n <- [0..(length myConfigs - 1)]
+ ]
+ ]
+
+-- Configuration options for treeSelect
+tsDefaultConfig :: TS.TSConfig a
+tsDefaultConfig = TS.TSConfig { TS.ts_hidechildren = True
+ , TS.ts_background = 0xdd292d3e
+ , TS.ts_font = myFont
+ , TS.ts_node = (0xffd0d0d0, 0xff202331)
+ , TS.ts_nodealt = (0xffd0d0d0, 0xff292d3e)
+ , TS.ts_highlight = (0xffffffff, 0xff755999)
+ , TS.ts_extra = 0xffd0d0d0
+ , TS.ts_node_width = 200
+ , TS.ts_node_height = 20
+ , TS.ts_originX = 0
+ , TS.ts_originY = 0
+ , TS.ts_indent = 80
+ , TS.ts_navigate = myTreeNavigation
+ }
+
+-- 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.
+myTreeNavigation = M.fromList
+ [ ((0, xK_Escape), TS.cancel)
+ , ((0, xK_Return), TS.select)
+ , ((0, xK_space), TS.select)
+ , ((0, xK_Up), TS.movePrev)
+ , ((0, xK_Down), TS.moveNext)
+ , ((0, xK_Left), TS.moveParent)
+ , ((0, xK_Right), TS.moveChild)
+ , ((0, xK_k), TS.movePrev)
+ , ((0, xK_j), TS.moveNext)
+ , ((0, xK_h), TS.moveParent)
+ , ((0, xK_l), TS.moveChild)
+ , ((0, xK_o), TS.moveHistBack)
+ , ((0, xK_i), TS.moveHistForward)
+ ]
+
+------------------------------------------------------------------------
+-- XPROMPT SETTINGS
+------------------------------------------------------------------------
+dtXPConfig :: XPConfig
+dtXPConfig = def
+ { font = myFont
+ , bgColor = "#292d3e"
+ , fgColor = "#d0d0d0"
+ , bgHLight = "#c792ea"
+ , fgHLight = "#000000"
+ , borderColor = "#535974"
+ , promptBorderWidth = 0
+ , promptKeymap = dtXPKeymap
+ , position = Top
+-- , position = CenteredAt { xpCenterY = 0.3, xpWidth = 0.3 }
+ , height = 20
+ , historySize = 256
+ , historyFilter = id
+ , defaultText = []
+ , autoComplete = Just 100000 -- set Just 100000 for .1 sec
+ , showCompletionOnTab = False
+ -- , searchPredicate = isPrefixOf
+ , searchPredicate = fuzzyMatch
+ , alwaysHighlight = True
+ , maxComplRows = Nothing -- set to Just 5 for 5 rows
+ }
+
+-- The same config above minus the autocomplete feature which is annoying
+-- on certain Xprompts, like the search engine prompts.
+dtXPConfig' :: XPConfig
+dtXPConfig' = dtXPConfig
+ { autoComplete = Nothing
+ }
+
+-- A list of all of the standard Xmonad prompts and a key press assigned to them.
+-- These are used in conjunction with keybinding I set later in the config.
+promptList :: [(String, XPConfig -> X ())]
+promptList = [ ("m", manPrompt) -- manpages prompt
+ , ("p", passPrompt) -- get passwords (requires 'pass')
+ , ("g", passGeneratePrompt) -- generate passwords (requires 'pass')
+ , ("r", passRemovePrompt) -- remove passwords (requires 'pass')
+ , ("s", sshPrompt) -- ssh prompt
+ , ("x", xmonadPrompt) -- xmonad prompt
+ ]
+
+-- Same as the above list except this is for my custom prompts.
+promptList' :: [(String, XPConfig -> String -> X (), String)]
+promptList' = [ ("c", calcPrompt, "qalc") -- requires qalculate-gtk
+ ]
+
+------------------------------------------------------------------------
+-- CUSTOM PROMPTS
+------------------------------------------------------------------------
+-- 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.
+calcPrompt :: XPConfig -> String -> X ()
+calcPrompt c ans =
+ inputPrompt c (trim ans) ?+ \input ->
+ liftIO(runProcessWithInput "qalc" [input] "") >>= calcPrompt c
+ where
+ trim = f . f
+ where f = reverse . dropWhile isSpace
+
+------------------------------------------------------------------------
+-- XPROMPT KEYMAP (emacs-like key bindings for xprompts)
+------------------------------------------------------------------------
+dtXPKeymap :: M.Map (KeyMask,KeySym) (XP ())
+dtXPKeymap = M.fromList $
+ map (first $ (,) controlMask) -- control + <key>
+ [ (xK_z, killBefore) -- kill line backwards
+ , (xK_k, killAfter) -- kill line forwards
+ , (xK_a, startOfLine) -- move to the beginning of the line
+ , (xK_e, endOfLine) -- move to the end of the line
+ , (xK_m, deleteString Next) -- delete a character foward
+ , (xK_b, moveCursor Prev) -- move cursor forward
+ , (xK_f, moveCursor Next) -- move cursor backward
+ , (xK_BackSpace, killWord Prev) -- kill the previous word
+ , (xK_y, pasteString) -- paste a string
+ , (xK_g, quit) -- quit out of prompt
+ , (xK_bracketleft, quit)
+ ]
+ ++
+ map (first $ (,) altMask) -- meta key + <key>
+ [ (xK_BackSpace, killWord Prev) -- kill the prev word
+ , (xK_f, moveWord Next) -- move a word forward
+ , (xK_b, moveWord Prev) -- move a word backward
+ , (xK_d, killWord Next) -- kill the next word
+ , (xK_n, moveHistory W.focusUp') -- move up thru history
+ , (xK_p, moveHistory W.focusDown') -- move down thru history
+ ]
+ ++
+ map (first $ (,) 0) -- <key>
+ [ (xK_Return, setSuccess True >> setDone True)
+ , (xK_KP_Enter, setSuccess True >> setDone True)
+ , (xK_BackSpace, deleteString Prev)
+ , (xK_Delete, deleteString Next)
+ , (xK_Left, moveCursor Prev)
+ , (xK_Right, moveCursor Next)
+ , (xK_Home, startOfLine)
+ , (xK_End, endOfLine)
+ , (xK_Down, moveHistory W.focusUp')
+ , (xK_Up, moveHistory W.focusDown')
+ , (xK_Escape, quit)
+ ]
+
+------------------------------------------------------------------------
+-- 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.
+archwiki, ebay, news, reddit, urban :: S.SearchEngine
+
+archwiki = S.searchEngine "archwiki" "https://wiki.archlinux.org/index.php?search="
+ebay = S.searchEngine "ebay" "https://www.ebay.com/sch/i.html?_nkw="
+news = S.searchEngine "news" "https://news.google.com/search?q="
+reddit = S.searchEngine "reddit" "https://www.reddit.com/search/?q="
+urban = S.searchEngine "urban" "https://www.urbandictionary.com/define.php?term="
+
+-- This is the list of search engines that I want to use. Some are from
+-- XMonad.Actions.Search, and some are the ones that I added above.
+searchList :: [(String, S.SearchEngine)]
+searchList = [ ("a", archwiki)
+ , ("d", S.duckduckgo)
+ , ("e", ebay)
+ , ("g", S.google)
+ , ("h", S.hoogle)
+ , ("i", S.images)
+ , ("n", news)
+ , ("r", reddit)
+ , ("s", S.stackage)
+ , ("t", S.thesaurus)
+ , ("v", S.vocabulary)
+ , ("b", S.wayback)
+ , ("u", urban)
+ , ("w", S.wikipedia)
+ , ("y", S.youtube)
+ , ("z", S.amazon)
+ ]
+
+------------------------------------------------------------------------
+-- WORKSPACES
+------------------------------------------------------------------------
+
+myWorkspaces :: [String]
+myWorkspaces = ["dev", "www", "sys", "doc", "vbox", "chat", "mus", "vid", "gfx"]
+
+------------------------------------------------------------------------
+-- 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.
+
+myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
+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 clickable workspaces, which would look like:
+ -- doShift "<action xdotool super+8>gfx</action>"
+ [ className =? "obs" --> doShift ( myWorkspaces !! 7 )
+ , title =? "firefox" --> doShift ( myWorkspaces !! 1 )
+ , className =? "mpv" --> doShift ( myWorkspaces !! 7 )
+ , className =? "vlc" --> doShift ( myWorkspaces !! 7 )
+ , className =? "Gimp" --> doShift ( myWorkspaces !! 8 )
+ , className =? "Gimp" --> doFloat
+ , title =? "Oracle VM VirtualBox Manager" --> doFloat
+ , className =? "VirtualBox Manager" --> doShift ( myWorkspaces !! 4 )
+ , (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog
+ ] <+> namedScratchpadManageHook myScratchPads
+
+------------------------------------------------------------------------
+-- 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).
+myLogHook :: X ()
+myLogHook = fadeInactiveLogHook fadeAmount
+ where fadeAmount = 1.0
+
+------------------------------------------------------------------------
+-- LAYOUTS
+------------------------------------------------------------------------
+-- Makes setting the spacingRaw simpler to write. The spacingRaw
+-- module adds a configurable amount of space around windows.
+mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing i = spacingRaw False (Border i i i i) True (Border i i i i) True
+
+-- Below is a variation of the above except no borders are applied
+-- if fewer than two windows. So a single window has no gaps.
+mySpacing' :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing' i = spacingRaw True (Border i i i i) True (Border i i i i) True
+
+-- Defining a bunch of layouts, many that I don't use.
+tall = renamed [Replace "tall"]
+ $ limitWindows 12
+ $ mySpacing 8
+ $ ResizableTall 1 (3/100) (1/2) []
+magnify = renamed [Replace "magnify"]
+ $ magnifier
+ $ limitWindows 12
+ $ mySpacing 8
+ $ ResizableTall 1 (3/100) (1/2) []
+monocle = renamed [Replace "monocle"]
+ $ limitWindows 20 Full
+floats = renamed [Replace "floats"]
+ $ limitWindows 20 simplestFloat
+grid = renamed [Replace "grid"]
+ $ limitWindows 12
+ $ mySpacing 8
+ $ mkToggle (single MIRROR)
+ $ Grid (16/10)
+spirals = renamed [Replace "spirals"]
+ $ mySpacing' 8
+ $ spiral (6/7)
+threeCol = renamed [Replace "threeCol"]
+ $ limitWindows 7
+ $ mySpacing' 4
+ $ ThreeCol 1 (3/100) (1/2)
+threeRow = renamed [Replace "threeRow"]
+ $ limitWindows 7
+ $ mySpacing' 4
+ -- Mirror takes a layout and rotates it by 90 degrees.
+ -- So we are applying Mirror to the ThreeCol layout.
+ $ Mirror
+ $ ThreeCol 1 (3/100) (1/2)
+tabs = renamed [Replace "tabs"]
+ -- I cannot add spacing to this layout because it will
+ -- add spacing between window and tabs which looks bad.
+ $ tabbed shrinkText myTabConfig
+ where
+ myTabConfig = def { fontName = "xft:Mononoki Nerd Font:regular:pixelsize=11"
+ , activeColor = "#292d3e"
+ , inactiveColor = "#3e445e"
+ , activeBorderColor = "#292d3e"
+ , inactiveBorderColor = "#292d3e"
+ , activeTextColor = "#ffffff"
+ , inactiveTextColor = "#d0d0d0"
+ }
+
+-- Theme for showWName which prints current workspace when you change workspaces.
+myShowWNameTheme :: SWNConfig
+myShowWNameTheme = def
+ { swn_font = "xft:Sans:bold:size=60"
+ , swn_fade = 1.0
+ , swn_bgcolor = "#000000"
+ , swn_color = "#FFFFFF"
+ }
+
+-- The layout hook
+myLayoutHook = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats $
+ mkToggle (NBFULL ?? NOBORDERS ?? EOT) myDefaultLayout
+ where
+ -- I've commented out the layouts I don't use.
+ myDefaultLayout = tall
+ ||| magnify
+ ||| noBorders monocle
+ ||| floats
+ -- ||| grid
+ ||| noBorders tabs
+ -- ||| spirals
+ -- ||| threeCol
+ -- ||| threeRow
+
+------------------------------------------------------------------------
+-- SCRATCHPADS
+------------------------------------------------------------------------
+-- Allows to have several floating scratchpads running different applications.
+-- Import Util.NamedScratchpad. Bind a key to namedScratchpadSpawnAction.
+myScratchPads :: [NamedScratchpad]
+myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
+ , NS "mocp" spawnMocp findMocp manageMocp
+ ]
+ where
+ spawnTerm = myTerminal ++ " -n scratchpad"
+ findTerm = resource =? "scratchpad"
+ manageTerm = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+ spawnMocp = myTerminal ++ " -n mocp 'mocp'"
+ findMocp = resource =? "mocp"
+ manageMocp = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+
+------------------------------------------------------------------------
+-- KEYBINDINGS
+------------------------------------------------------------------------
+-- I am using the Xmonad.Util.EZConfig module which allows keybindings
+-- to be written in simpler, emacs-like format.
+myKeys :: [(String, X ())]
+myKeys =
+ -- Xmonad
+ [ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
+ , ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
+ , ("M-S-q", io exitSuccess) -- Quits xmonad
+
+ -- Open my preferred terminal
+ , ("M-<Return>", spawn myTerminal)
+
+ -- Run Prompt
+ , ("M-S-<Return>", shellPrompt dtXPConfig) -- Shell Prompt
+
+ -- Windows
+ , ("M-S-c", kill1) -- Kill the currently focused client
+ , ("M-S-a", killAll) -- Kill all windows on current workspace
+
+ -- Floating windows
+ , ("M-f", sendMessage (T.Toggle "floats")) -- Toggles my 'floats' layout
+ , ("M-<Delete>", withFocused $ windows . W.sink) -- Push floating window back to tile
+ , ("M-S-<Delete>", sinkAll) -- Push ALL floating windows to tile
+
+ -- Grid Select (CTRL-g followed by a key)
+ , ("C-g g", spawnSelected' myAppGrid) -- grid select favorite apps
+ , ("C-g m", spawnSelected' myBookmarkGrid) -- grid select some bookmarks
+ , ("C-g c", spawnSelected' myConfigGrid) -- grid select useful config files
+ , ("C-g t", goToSelected $ mygridConfig myColorizer) -- goto selected window
+ , ("C-g b", bringSelected $ mygridConfig myColorizer) -- bring selected window
+
+ -- Tree Select/
+ -- tree select actions menu
+ , ("C-t a", treeselectAction tsDefaultConfig)
+
+ -- 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
+ --, ("M-S-m", windows W.swapMaster) -- Swap the focused window and the master window
+ , ("M-S-j", windows W.swapDown) -- Swap focused window with next window
+ , ("M-S-k", windows W.swapUp) -- Swap focused window with prev window
+ , ("M-<Backspace>", promote) -- Moves focused window to master, others maintain order
+ , ("M1-S-<Tab>", rotSlavesDown) -- Rotate all windows except master and keep focus in place
+ , ("M1-C-<Tab>", rotAllDown) -- Rotate all the windows in the current stack
+ --, ("M-S-s", windows copyToAll)
+ , ("M-C-s", killAllOtherCopies)
+
+ -- Layouts
+ , ("M-<Tab>", sendMessage NextLayout) -- Switch to next layout
+ , ("M-C-M1-<Up>", sendMessage Arrange)
+ , ("M-C-M1-<Down>", sendMessage DeArrange)
+ , ("M-<Space>", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts) -- Toggles noborder/full
+ , ("M-S-<Space>", sendMessage ToggleStruts) -- Toggles struts
+ , ("M-S-n", sendMessage $ MT.Toggle NOBORDERS) -- Toggles noborder
+ , ("M-<KP_Multiply>", sendMessage (IncMasterN 1)) -- Increase number of clients in master pane
+ , ("M-<KP_Divide>", sendMessage (IncMasterN (-1))) -- Decrease number of clients in master pane
+ , ("M-S-<KP_Multiply>", increaseLimit) -- Increase number of windows
+ , ("M-S-<KP_Divide>", decreaseLimit) -- Decrease number of windows
+
+ , ("M-h", sendMessage Shrink) -- Shrink horiz window width
+ , ("M-l", sendMessage Expand) -- Expand horiz window width
+ , ("M-C-j", sendMessage MirrorShrink) -- Shrink vert window width
+ , ("M-C-k", sendMessage MirrorExpand) -- Exoand vert window width
+
+ -- Workspaces
+ , ("M-.", nextScreen) -- Switch focus to next monitor
+ , ("M-,", prevScreen) -- Switch focus to prev monitor
+ , ("M-S-<KP_Add>", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws
+ , ("M-S-<KP_Subtract>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws
+
+ -- Scratchpads
+ , ("M-C-<Return>", namedScratchpadAction myScratchPads "terminal")
+ , ("M-C-c", namedScratchpadAction myScratchPads "mocp")
+
+ -- Controls for mocp music player.
+ , ("M-u p", spawn "mocp --play")
+ , ("M-u l", spawn "mocp --next")
+ , ("M-u h", spawn "mocp --previous")
+ , ("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 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 '(+vterm/here nil)'") -- eshell 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/\")'")
+
+ --- 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-i", spawn (myTerminal ++ " -e irssi"))
+ , ("M-M1-j", spawn (myTerminal ++ " -e joplin"))
+ , ("M-M1-l", spawn (myTerminal ++ " -e lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss gopher://distro.tube"))
+ , ("M-M1-m", spawn (myTerminal ++ " -e mocp"))
+ , ("M-M1-n", spawn (myTerminal ++ " -e newsboat"))
+ , ("M-M1-p", spawn (myTerminal ++ " -e pianobar"))
+ , ("M-M1-r", spawn (myTerminal ++ " -e rtv"))
+ , ("M-M1-t", spawn (myTerminal ++ " -e toot curses"))
+ , ("M-M1-w", spawn (myTerminal ++ " -e wopr report.xml"))
+ , ("M-M1-y", spawn (myTerminal ++ " -e youtube-viewer"))
+
+ -- Multimedia Keys
+ , ("<XF86AudioPlay>", spawn "cmus toggle")
+ , ("<XF86AudioPrev>", spawn "cmus prev")
+ , ("<XF86AudioNext>", spawn "cmus next")
+ -- , ("<XF86AudioMute>", spawn "amixer set Master toggle") -- Bug prevents it from toggling correctly in 12.04.
+ , ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%- unmute")
+ , ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+ unmute")
+ , ("<XF86HomePage>", spawn "firefox")
+ , ("<XF86Search>", safeSpawn "firefox" ["https://www.google.com/"])
+ , ("<XF86Mail>", runOrRaise "geary" (resource =? "thunderbird"))
+ , ("<XF86Calculator>", runOrRaise "gcalctool" (resource =? "gcalctool"))
+ , ("<XF86Eject>", spawn "toggleeject")
+ , ("<Print>", spawn "scrotd 0")
+ ]
+ -- Appending search engine prompts to keybindings list.
+ -- Look at "search engines" section of this config for values for "k".
+ ++ [("M-s " ++ k, S.promptSearch dtXPConfig' f) | (k,f) <- searchList ]
+ ++ [("M-S-s " ++ k, S.selectSearch f) | (k,f) <- searchList ]
+ -- Appending some extra xprompts to keybindings list.
+ -- Look at "xprompt settings" section this of config for values for "k".
+ ++ [("M-p " ++ k, f dtXPConfig') | (k,f) <- promptList ]
+ ++ [("M-p " ++ k, f dtXPConfig' g) | (k,f,g) <- promptList' ]
+ -- 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"))
+
+------------------------------------------------------------------------
+-- MAIN
+------------------------------------------------------------------------
+main :: IO ()
+main = do
+ -- Launching three instances of xmobar on their monitors.
+ xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc0"
+ xmproc1 <- spawnPipe "xmobar -x 1 ~/.config/xmobar/xmobarrc2"
+ xmproc2 <- spawnPipe "xmobar -x 2 ~/.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.
+ , handleEventHook = serverModeEventHookCmd
+ <+> serverModeEventHook
+ <+> serverModeEventHookF "XMONAD_PRINT" (io . putStrLn)
+ <+> docksEventHook
+ , modMask = myModMask
+ , terminal = myTerminal
+ , startupHook = myStartupHook
+ , layoutHook = showWName' myShowWNameTheme myLayoutHook
+ , workspaces = myWorkspaces
+ , borderWidth = myBorderWidth
+ , normalBorderColor = myNormColor
+ , focusedBorderColor = myFocusColor
+ , logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP
+ { ppOutput = \x -> hPutStrLn xmproc0 x >> hPutStrLn xmproc1 x >> hPutStrLn xmproc2 x
+ , ppCurrent = xmobarColor "#c3e88d" "" . wrap "[" "]" -- Current workspace in xmobar
+ , ppVisible = xmobarColor "#c3e88d" "" -- Visible but not current workspace
+ , ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" -- Hidden workspaces in xmobar
+ , ppHiddenNoWindows = xmobarColor "#F07178" "" -- Hidden workspaces (no windows)
+ , ppTitle = xmobarColor "#d0d0d0" "" . shorten 60 -- Title of active window in xmobar
+ , ppSep = "<fc=#666666> | </fc>" -- Separators in xmobar
+ , ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!" -- Urgent workspace
+ , ppExtras = [windowCount] -- # of windows current workspace
+ , ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
+ }
+ } `additionalKeysP` myKeys
diff --git a/.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-treeselect-workspaces.hs b/.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-treeselect-workspaces.hs
new file mode 100644
index 0000000..26dd83f
--- /dev/null
+++ b/.config/xmonad/xmonad-example-configs/xmonad-example-xmobar-treeselect-workspaces.hs
@@ -0,0 +1,867 @@
+-- Xmonad is a dynamically tiling X11 window manager that is written and
+-- configured in Haskell. Official documentation: https://xmonad.org
+
+-- This is the xmonad configuration of Derek Taylor (DistroTube)
+-- My YouTube: http://www.youtube.com/c/DistroTube
+-- My GitLab: http://www.gitlab.com/dwt1/
+
+-- This config is massively long. It is purposely bloated with a ton of
+-- 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
+------------------------------------------------------------------------
+ -- Base
+import XMonad
+import System.IO (hPutStrLn)
+import System.Exit (exitSuccess)
+import qualified XMonad.StackSet as W
+
+ -- Actions
+import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies)
+import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
+import XMonad.Actions.GridSelect
+import XMonad.Actions.MouseResize
+import XMonad.Actions.Promote
+import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
+import qualified XMonad.Actions.TreeSelect as TS
+import XMonad.Actions.WindowGo (runOrRaise)
+import XMonad.Actions.WithAll (sinkAll, killAll)
+import qualified XMonad.Actions.Search as S
+
+ -- Data
+import Data.Char (isSpace)
+import Data.Monoid
+import Data.Maybe (isJust)
+import Data.Tree
+import qualified Data.Tuple.Extra as TE
+import qualified Data.Map as M
+
+ -- Hooks
+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.FadeInactive
+import XMonad.Hooks.ManageDocks (avoidStruts, docksEventHook, manageDocks, ToggleStruts(..))
+import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
+import XMonad.Hooks.ServerMode
+import XMonad.Hooks.SetWMName
+import XMonad.Hooks.WorkspaceHistory
+
+ -- Layouts
+import XMonad.Layout.GridVariants (Grid(Grid))
+import XMonad.Layout.SimplestFloat
+import XMonad.Layout.Spiral
+import XMonad.Layout.ResizableTile
+import XMonad.Layout.Tabbed
+import XMonad.Layout.ThreeColumns
+
+ -- Layouts modifiers
+import XMonad.Layout.LayoutModifier
+import XMonad.Layout.LimitWindows (limitWindows, increaseLimit, decreaseLimit)
+import XMonad.Layout.Magnifier
+import XMonad.Layout.MultiToggle (mkToggle, single, EOT(EOT), (??))
+import XMonad.Layout.MultiToggle.Instances (StdTransformers(NBFULL, MIRROR, NOBORDERS))
+import XMonad.Layout.NoBorders
+import XMonad.Layout.Renamed (renamed, Rename(Replace))
+import XMonad.Layout.ShowWName
+import XMonad.Layout.Spacing
+import XMonad.Layout.WindowArranger (windowArrange, WindowArrangerMsg(..))
+import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
+import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
+
+ -- Prompt
+import XMonad.Prompt
+import XMonad.Prompt.Input
+import XMonad.Prompt.FuzzyMatch
+import XMonad.Prompt.Man
+import XMonad.Prompt.Pass
+import XMonad.Prompt.Shell (shellPrompt)
+import XMonad.Prompt.Ssh
+import XMonad.Prompt.XMonad
+import Control.Arrow (first)
+
+ -- Utilities
+import XMonad.Util.EZConfig (additionalKeysP)
+import XMonad.Util.NamedScratchpad
+import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
+import XMonad.Util.SpawnOnce
+
+------------------------------------------------------------------------
+-- 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.
+myFont :: String
+myFont = "xft:Mononoki Nerd Font:bold:size=9"
+
+myModMask :: KeyMask
+myModMask = mod4Mask -- Sets modkey to super/windows key
+
+myTerminal :: String
+myTerminal = "alacritty" -- Sets default terminal
+
+myBrowser :: String
+myBrowser = myTerminal ++ " -e lynx " -- Sets lynx as browser for tree select
+-- myBrowser = "firefox " -- Sets firefox as browser for tree select
+
+myEditor :: String
+myEditor = "emacsclient -c -a emacs " -- Sets emacs as editor for tree select
+-- myEditor = myTerminal ++ " -e vim " -- Sets vim as editor for tree select
+
+myBorderWidth :: Dimension
+myBorderWidth = 2 -- Sets border width for windows
+
+myNormColor :: String
+myNormColor = "#292d3e" -- Border color of normal windows
+
+myFocusColor :: String
+myFocusColor = "#bbc5ff" -- 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
+
+------------------------------------------------------------------------
+-- AUTOSTART
+------------------------------------------------------------------------
+myStartupHook :: X ()
+myStartupHook = do
+ spawnOnce "nitrogen --restore &"
+ spawnOnce "picom &"
+ spawnOnce "nm-applet &"
+ spawnOnce "volumeicon &"
+ spawnOnce "trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x292d3e --height 18 &"
+ spawnOnce "/usr/bin/emacs --daemon &"
+ -- spawnOnce "kak -d -s mysession &"
+ setWMName "LG3D"
+
+------------------------------------------------------------------------
+-- GRID SELECT
+------------------------------------------------------------------------
+-- 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.
+myColorizer :: Window -> Bool -> X (String, String)
+myColorizer = colorRangeFromClassName
+ (0x29,0x2d,0x3e) -- lowest inactive bg
+ (0x29,0x2d,0x3e) -- highest inactive bg
+ (0xc7,0x92,0xea) -- active bg
+ (0xc0,0xa7,0x9a) -- inactive fg
+ (0x29,0x2d,0x3e) -- active fg
+
+-- gridSelect menu layout
+mygridConfig :: p -> GSConfig Window
+mygridConfig colorizer = (buildDefaultGSConfig myColorizer)
+ { gs_cellheight = 40
+ , gs_cellwidth = 200
+ , gs_cellpadding = 6
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+spawnSelected' :: [(String, String)] -> X ()
+spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
+ where conf = def
+ { gs_cellheight = 40
+ , gs_cellwidth = 200
+ , gs_cellpadding = 6
+ , gs_originFractX = 0.5
+ , gs_originFractY = 0.5
+ , gs_font = myFont
+ }
+
+-- The lists below are actually 3-tuples for use with gridSelect and treeSelect.
+-- TreeSelect uses all three values in the 3-tuples but GridSelect only needs first
+-- two values in each list (see myAppGrid, myBookmarkGrid and myConfigGrid below).
+myApplications :: [(String, String, String)]
+myApplications = [ ("Audacity", "audacity", "Graphical cross-platform audio eidtor")
+ , ("Deadbeef", "deadbeef", "Lightweight GUI audio player")
+ , ("Emacs", "emacs", "Much more than a text editor")
+ , ("Firefox", "firefox", "The famous open source web browser")
+ , ("Geany", "geany", "A nice text editor")
+ , ("Geary", "geary", "Email client that is attractive")
+ , ("Gimp", "gimp", "Open source alternative to Photoshop")
+ , ("Kdenlive", "kdenlive", "A great open source video editor")
+ , ("LibreOffice Impress", "loimpress", "For making presentations")
+ , ("LibreOffice Writer", "lowriter", "A fully featured word processor")
+ , ("OBS", "obs", "Open broadcaster software")
+ , ("PCManFM", "pcmanfm", "Lightweight graphical file manager")
+ , ("Simple Terminal", "st", "Suckless simple terminal")
+ , ("Steam", "steam", "Proprietary gaming platform")
+ , ("Surf Browser", "surf suckless.org", "Suckless surf web browser")
+ , ("Xonotic", "xonotic-glx", "A fast-paced first person shooter")
+ ]
+
+myBookmarks :: [(String, String, String)]
+myBookmarks = [ ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ , ("Site Name", myBrowser ++ "https://www.distrotube.com", "Official website for DistroTube")
+ ]
+
+myConfigs :: [(String, String, String)]
+myConfigs = [ ("bashrc", myEditor ++ "~/.bashrc", "the bourne again shell")
+ , ("doom emacs config.el", myEditor ++ "~/.doom.d/config.el", "doom emacs config")
+ , ("doom emacs init.el", myEditor ++ "~/.doom.d/init.el", "doom emacs init")
+ , ("dwm", myEditor ++ "~/dwm-distrotube/config.h", "dwm config file")
+ , ("qtile", myEditor ++ "~/.config/qtile/config.py", "qtile config")
+ , ("xmonad.hs", myEditor ++ "~/.xmonad/xmonad.hs", "xmonad config")
+ , ("zshrc", myEditor ++ "~/.zshrc", "config for the z shell")
+ ]
+
+-- Let's take myApplications, myBookmarks and myConfigs and take only
+-- the first two values from those 3-tuples (for GridSelect).
+myAppGrid :: [(String, String)]
+myAppGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myApplications
+
+myBookmarkGrid :: [(String, String)]
+myBookmarkGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myBookmarks
+
+myConfigGrid :: [(String, String)]
+myConfigGrid = [ (a,b) | (a,b,c) <- xs]
+ where xs = myConfigs
+
+------------------------------------------------------------------------
+-- TREE SELECT
+------------------------------------------------------------------------
+-- TreeSelect displays your workspaces or actions in a Tree-like format.
+-- You can select desired workspace/action with the cursor or hjkl keys.
+
+treeselectAction :: TS.TSConfig (X ()) -> X ()
+treeselectAction a = TS.treeselectAction a
+ [ Node (TS.TSNode "applications" "a list of programs I use often" (return ()))
+ [Node (TS.TSNode (TE.fst3 $ myApplications !! n)
+ (TE.thd3 $ myApplications !! n)
+ (spawn $ TE.snd3 $ myApplications !! n)
+ ) [] | n <- [0..(length myApplications - 1)]
+ ]
+ , Node (TS.TSNode "bookmarks" "a list of web bookmarks" (return ()))
+ [Node (TS.TSNode(TE.fst3 $ myBookmarks !! n)
+ (TE.thd3 $ myBookmarks !! n)
+ (spawn $ TE.snd3 $ myBookmarks !! n)
+ ) [] | n <- [0..(length myBookmarks - 1)]
+ ]
+ , Node (TS.TSNode "config files" "config files that edit often" (return ()))
+ [Node (TS.TSNode (TE.fst3 $ myConfigs !! n)
+ (TE.thd3 $ myConfigs !! n)
+ (spawn $ TE.snd3 $ myConfigs !! n)
+ ) [] | n <- [0..(length myConfigs - 1)]
+ ]
+ ]
+
+-- Configuration options for treeSelect
+tsDefaultConfig :: TS.TSConfig a
+tsDefaultConfig = TS.TSConfig { TS.ts_hidechildren = True
+ , TS.ts_background = 0xdd292d3e
+ , TS.ts_font = myFont
+ , TS.ts_node = (0xffd0d0d0, 0xff202331)
+ , TS.ts_nodealt = (0xffd0d0d0, 0xff292d3e)
+ , TS.ts_highlight = (0xffffffff, 0xff755999)
+ , TS.ts_extra = 0xffd0d0d0
+ , TS.ts_node_width = 200
+ , TS.ts_node_height = 20
+ , TS.ts_originX = 0
+ , TS.ts_originY = 0
+ , TS.ts_indent = 80
+ , TS.ts_navigate = myTreeNavigation
+ }
+
+-- 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.
+myTreeNavigation = M.fromList
+ [ ((0, xK_Escape), TS.cancel)
+ , ((0, xK_Return), TS.select)
+ , ((0, xK_space), TS.select)
+ , ((0, xK_Up), TS.movePrev)
+ , ((0, xK_Down), TS.moveNext)
+ , ((0, xK_Left), TS.moveParent)
+ , ((0, xK_Right), TS.moveChild)
+ , ((0, xK_k), TS.movePrev)
+ , ((0, xK_j), TS.moveNext)
+ , ((0, xK_h), TS.moveParent)
+ , ((0, xK_l), TS.moveChild)
+ , ((0, xK_o), TS.moveHistBack)
+ , ((0, xK_i), TS.moveHistForward)
+ , ((0, xK_d), TS.moveTo ["dev"])
+ , ((0, xK_g), TS.moveTo ["graphics"])
+ , ((0, xK_m), TS.moveTo ["music"])
+ , ((0, xK_v), TS.moveTo ["video"])
+ , ((0, xK_w), TS.moveTo ["web"])
+ , ((mod4Mask, xK_b), TS.moveTo ["web", "browser"])
+ , ((mod4Mask, xK_c), TS.moveTo ["web", "chat"])
+ , ((mod4Mask, xK_m), TS.moveTo ["web", "email"])
+ , ((mod4Mask, xK_r), TS.moveTo ["web", "rss"])
+ , ((mod4Mask, xK_w), TS.moveTo ["web", "web conference"])
+ , ((mod4Mask, xK_d), TS.moveTo ["dev", "docs"])
+ , ((mod4Mask, xK_e), TS.moveTo ["dev", "emacs"])
+ , ((mod4Mask, xK_f), TS.moveTo ["dev", "files"])
+ , ((mod4Mask, xK_p), TS.moveTo ["dev", "programming"])
+ , ((mod4Mask, xK_t), TS.moveTo ["dev", "terminal"])
+ , ((mod4Mask, xK_z), TS.moveTo ["dev", "virtualization"])
+ , ((mod4Mask, xK_g), TS.moveTo ["graphics", "gimp"])
+ , ((mod4Mask, xK_i), TS.moveTo ["graphics", "image viewer"])
+ , ((mod4Mask, xK_a), TS.moveTo ["music", "audio editor"])
+ , ((mod4Mask, xK_u), TS.moveTo ["music", "music player"])
+ , ((mod4Mask, xK_o), TS.moveTo ["video", "obs"])
+ , ((mod4Mask, xK_v), TS.moveTo ["video", "video player"])
+ , ((mod4Mask, xK_k), TS.moveTo ["video", "kdenlive"])
+ , ((mod4Mask .|. altMask, xK_h), TS.moveTo ["dev", "programming", "haskell"])
+ , ((mod4Mask .|. altMask, xK_p), TS.moveTo ["dev", "programming", "python"])
+ , ((mod4Mask .|. altMask, xK_s), TS.moveTo ["dev", "programming", "shell"])
+ ]
+
+------------------------------------------------------------------------
+-- XPROMPT SETTINGS
+------------------------------------------------------------------------
+dtXPConfig :: XPConfig
+dtXPConfig = def
+ { font = myFont
+ , bgColor = "#292d3e"
+ , fgColor = "#d0d0d0"
+ , bgHLight = "#c792ea"
+ , fgHLight = "#000000"
+ , borderColor = "#535974"
+ , promptBorderWidth = 0
+ , promptKeymap = dtXPKeymap
+ , position = Top
+-- , position = CenteredAt { xpCenterY = 0.3, xpWidth = 0.3 }
+ , height = 20
+ , historySize = 256
+ , historyFilter = id
+ , defaultText = []
+ , autoComplete = Just 100000 -- set Just 100000 for .1 sec
+ , showCompletionOnTab = False
+ -- , searchPredicate = isPrefixOf
+ , searchPredicate = fuzzyMatch
+ , alwaysHighlight = True
+ , maxComplRows = Nothing -- set to Just 5 for 5 rows
+ }
+
+-- The same config above minus the autocomplete feature which is annoying
+-- on certain Xprompts, like the search engine prompts.
+dtXPConfig' :: XPConfig
+dtXPConfig' = dtXPConfig
+ { autoComplete = Nothing
+ }
+
+-- A list of all of the standard Xmonad prompts and a key press assigned to them.
+-- These are used in conjunction with keybinding I set later in the config.
+promptList :: [(String, XPConfig -> X ())]
+promptList = [ ("m", manPrompt) -- manpages prompt
+ , ("p", passPrompt) -- get passwords (requires 'pass')
+ , ("g", passGeneratePrompt) -- generate passwords (requires 'pass')
+ , ("r", passRemovePrompt) -- remove passwords (requires 'pass')
+ , ("s", sshPrompt) -- ssh prompt
+ , ("x", xmonadPrompt) -- xmonad prompt
+ ]
+
+-- Same as the above list except this is for my custom prompts.
+promptList' :: [(String, XPConfig -> String -> X (), String)]
+promptList' = [ ("c", calcPrompt, "qalc") -- requires qalculate-gtk
+ ]
+
+------------------------------------------------------------------------
+-- CUSTOM PROMPTS
+------------------------------------------------------------------------
+-- 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.
+calcPrompt :: XPConfig -> String -> X ()
+calcPrompt c ans =
+ inputPrompt c (trim ans) ?+ \input ->
+ liftIO(runProcessWithInput "qalc" [input] "") >>= calcPrompt c
+ where
+ trim = f . f
+ where f = reverse . dropWhile isSpace
+
+------------------------------------------------------------------------
+-- XPROMPT KEYMAP (emacs-like key bindings for xprompts)
+------------------------------------------------------------------------
+dtXPKeymap :: M.Map (KeyMask,KeySym) (XP ())
+dtXPKeymap = M.fromList $
+ map (first $ (,) controlMask) -- control + <key>
+ [ (xK_z, killBefore) -- kill line backwards
+ , (xK_k, killAfter) -- kill line forwards
+ , (xK_a, startOfLine) -- move to the beginning of the line
+ , (xK_e, endOfLine) -- move to the end of the line
+ , (xK_m, deleteString Next) -- delete a character foward
+ , (xK_b, moveCursor Prev) -- move cursor forward
+ , (xK_f, moveCursor Next) -- move cursor backward
+ , (xK_BackSpace, killWord Prev) -- kill the previous word
+ , (xK_y, pasteString) -- paste a string
+ , (xK_g, quit) -- quit out of prompt
+ , (xK_bracketleft, quit)
+ ]
+ ++
+ map (first $ (,) altMask) -- meta key + <key>
+ [ (xK_BackSpace, killWord Prev) -- kill the prev word
+ , (xK_f, moveWord Next) -- move a word forward
+ , (xK_b, moveWord Prev) -- move a word backward
+ , (xK_d, killWord Next) -- kill the next word
+ , (xK_n, moveHistory W.focusUp') -- move up thru history
+ , (xK_p, moveHistory W.focusDown') -- move down thru history
+ ]
+ ++
+ map (first $ (,) 0) -- <key>
+ [ (xK_Return, setSuccess True >> setDone True)
+ , (xK_KP_Enter, setSuccess True >> setDone True)
+ , (xK_BackSpace, deleteString Prev)
+ , (xK_Delete, deleteString Next)
+ , (xK_Left, moveCursor Prev)
+ , (xK_Right, moveCursor Next)
+ , (xK_Home, startOfLine)
+ , (xK_End, endOfLine)
+ , (xK_Down, moveHistory W.focusUp')
+ , (xK_Up, moveHistory W.focusDown')
+ , (xK_Escape, quit)
+ ]
+
+------------------------------------------------------------------------
+-- 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.
+archwiki, ebay, news, reddit, urban :: S.SearchEngine
+
+archwiki = S.searchEngine "archwiki" "https://wiki.archlinux.org/index.php?search="
+ebay = S.searchEngine "ebay" "https://www.ebay.com/sch/i.html?_nkw="
+news = S.searchEngine "news" "https://news.google.com/search?q="
+reddit = S.searchEngine "reddit" "https://www.reddit.com/search/?q="
+urban = S.searchEngine "urban" "https://www.urbandictionary.com/define.php?term="
+
+-- This is the list of search engines that I want to use. Some are from
+-- XMonad.Actions.Search, and some are the ones that I added above.
+searchList :: [(String, S.SearchEngine)]
+searchList = [ ("a", archwiki)
+ , ("d", S.duckduckgo)
+ , ("e", ebay)
+ , ("g", S.google)
+ , ("h", S.hoogle)
+ , ("i", S.images)
+ , ("n", news)
+ , ("r", reddit)
+ , ("s", S.stackage)
+ , ("t", S.thesaurus)
+ , ("v", S.vocabulary)
+ , ("b", S.wayback)
+ , ("u", urban)
+ , ("w", S.wikipedia)
+ , ("y", S.youtube)
+ , ("z", S.amazon)
+ ]
+
+
+------------------------------------------------------------------------
+-- 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.
+
+{- Commented out clickable xmobar workspaces to use TreeSelect workspaces.
+
+xmobarEscape :: String -> String
+xmobarEscape = concatMap doubleLts
+ where
+ doubleLts '<' = "<<"
+ doubleLts x = [x]
+
+myWorkspaces :: [String]
+myWorkspaces = clickable . map xmobarEscape
+ $ ["dev", "www", "sys", "doc", "vbox", "chat", "mus", "vid", "gfx"]
+ where
+ clickable l = [ "<action=xdotool key super+" ++ show n ++ ">" ++ ws ++ "</action>" |
+ (i,ws) <- zip [1..9] l,
+ let n = i ]
+
+End of comment -}
+
+-- TreeSelect workspaces
+myWorkspaces :: Forest String
+myWorkspaces = [ Node "dev"
+ [ Node "terminal" []
+ , Node "emacs" []
+ , Node "docs" []
+ , Node "files" []
+ , Node "programming"
+ [ Node "haskell" []
+ , Node "python" []
+ , Node "shell" []
+ ]
+ , Node "virtualization" []
+ ]
+ , Node "web"
+ [ Node "browser" []
+ , Node "chat" []
+ , Node "email" []
+ , Node "rss" []
+ , Node "web conference" []
+ ]
+ , Node "graphics"
+ [ Node "gimp" []
+ , Node "image viewer" []
+ ]
+ , Node "music"
+ [ Node "audio editor" []
+ , Node "music player" []
+ ]
+ , Node "video"
+ [ Node "obs" []
+ , Node "kdenlive" []
+ , Node "video player" []
+ ]
+ ]
+
+------------------------------------------------------------------------
+-- 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.
+
+myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
+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 clickable workspaces, which would look like:
+ -- doShift "<action xdotool super+8>gfx</action>"
+ [ className =? "obs" --> doShift ( "video.obs" )
+ , title =? "firefox" --> doShift ( "web.browser" )
+ , title =? "qutebrowser" --> doShift ( "web.browser" )
+ , className =? "mpv" --> doShift ( "video.movie player" )
+ , className =? "vlc" --> doShift ( "video.movie player" )
+ , className =? "Gimp" --> doShift ( "graphics.gimp")
+ , className =? "Gimp" --> doFloat
+ , title =? "Oracle VM VirtualBox Manager" --> doFloat
+ , className =? "VirtualBox Manager" --> doShift ( "dev.virtualization" )
+ , (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog
+ ] <+> namedScratchpadManageHook myScratchPads
+
+------------------------------------------------------------------------
+-- 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).
+myLogHook :: X ()
+myLogHook = fadeInactiveLogHook fadeAmount
+ where fadeAmount = 1.0
+
+------------------------------------------------------------------------
+-- LAYOUTS
+------------------------------------------------------------------------
+-- Makes setting the spacingRaw simpler to write. The spacingRaw
+-- module adds a configurable amount of space around windows.
+mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing i = spacingRaw False (Border i i i i) True (Border i i i i) True
+
+-- Below is a variation of the above except no borders are applied
+-- if fewer than two windows. So a single window has no gaps.
+mySpacing' :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
+mySpacing' i = spacingRaw True (Border i i i i) True (Border i i i i) True
+
+-- Defining a bunch of layouts, many that I don't use.
+tall = renamed [Replace "tall"]
+ $ limitWindows 12
+ $ mySpacing 8
+ $ ResizableTall 1 (3/100) (1/2) []
+magnify = renamed [Replace "magnify"]
+ $ magnifier
+ $ limitWindows 12
+ $ mySpacing 8
+ $ ResizableTall 1 (3/100) (1/2) []
+monocle = renamed [Replace "monocle"]
+ $ limitWindows 20 Full
+floats = renamed [Replace "floats"]
+ $ limitWindows 20 simplestFloat
+grid = renamed [Replace "grid"]
+ $ limitWindows 12
+ $ mySpacing 8
+ $ mkToggle (single MIRROR)
+ $ Grid (16/10)
+spirals = renamed [Replace "spirals"]
+ $ mySpacing' 8
+ $ spiral (6/7)
+threeCol = renamed [Replace "threeCol"]
+ $ limitWindows 7
+ $ mySpacing' 4
+ $ ThreeCol 1 (3/100) (1/2)
+threeRow = renamed [Replace "threeRow"]
+ $ limitWindows 7
+ $ mySpacing' 4
+ -- Mirror takes a layout and rotates it by 90 degrees.
+ -- So we are applying Mirror to the ThreeCol layout.
+ $ Mirror
+ $ ThreeCol 1 (3/100) (1/2)
+tabs = renamed [Replace "tabs"]
+ -- I cannot add spacing to this layout because it will
+ -- add spacing between window and tabs which looks bad.
+ $ tabbed shrinkText myTabConfig
+ where
+ myTabConfig = def { fontName = "xft:Mononoki Nerd Font:regular:pixelsize=11"
+ , activeColor = "#292d3e"
+ , inactiveColor = "#3e445e"
+ , activeBorderColor = "#292d3e"
+ , inactiveBorderColor = "#292d3e"
+ , activeTextColor = "#ffffff"
+ , inactiveTextColor = "#d0d0d0"
+ }
+
+-- Theme for showWName which prints current workspace when you change workspaces.
+myShowWNameTheme :: SWNConfig
+myShowWNameTheme = def
+ { swn_font = "xft:Sans:bold:size=60"
+ , swn_fade = 1.0
+ , swn_bgcolor = "#000000"
+ , swn_color = "#FFFFFF"
+ }
+
+-- The layout hook
+myLayoutHook = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats $
+ mkToggle (NBFULL ?? NOBORDERS ?? EOT) myDefaultLayout
+ where
+ -- I've commented out the layouts I don't use.
+ myDefaultLayout = tall
+ ||| magnify
+ ||| noBorders monocle
+ ||| floats
+ -- ||| grid
+ ||| noBorders tabs
+ -- ||| spirals
+ -- ||| threeCol
+ -- ||| threeRow
+
+------------------------------------------------------------------------
+-- SCRATCHPADS
+------------------------------------------------------------------------
+-- Allows to have several floating scratchpads running different applications.
+-- Import Util.NamedScratchpad. Bind a key to namedScratchpadSpawnAction.
+myScratchPads :: [NamedScratchpad]
+myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
+ , NS "mocp" spawnMocp findMocp manageMocp
+ ]
+ where
+ spawnTerm = myTerminal ++ " -n scratchpad"
+ findTerm = resource =? "scratchpad"
+ manageTerm = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+ spawnMocp = myTerminal ++ " -n mocp 'mocp'"
+ findMocp = resource =? "mocp"
+ manageMocp = customFloating $ W.RationalRect l t w h
+ where
+ h = 0.9
+ w = 0.9
+ t = 0.95 -h
+ l = 0.95 -w
+
+------------------------------------------------------------------------
+-- KEYBINDINGS
+------------------------------------------------------------------------
+-- I am using the Xmonad.Util.EZConfig module which allows keybindings
+-- to be written in simpler, emacs-like format.
+myKeys :: [(String, X ())]
+myKeys =
+ -- Xmonad
+ [ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
+ , ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
+ , ("M-S-q", io exitSuccess) -- Quits xmonad
+
+ -- Open my preferred terminal
+ , ("M-<Return>", spawn myTerminal)
+
+ -- Run Prompt
+ , ("M-S-<Return>", shellPrompt dtXPConfig) -- Shell Prompt
+
+ -- Windows
+ , ("M-S-c", kill1) -- Kill the currently focused client
+ , ("M-S-a", killAll) -- Kill all windows on current workspace
+
+ -- Floating windows
+ , ("M-f", sendMessage (T.Toggle "floats")) -- Toggles my 'floats' layout
+ , ("M-<Delete>", withFocused $ windows . W.sink) -- Push floating window back to tile
+ , ("M-S-<Delete>", sinkAll) -- Push ALL floating windows to tile
+
+ -- Grid Select (CTRL-g followed by a key)
+ , ("C-g g", spawnSelected' myAppGrid) -- grid select favorite apps
+ , ("C-g m", spawnSelected' myBookmarkGrid) -- grid select some bookmarks
+ , ("C-g c", spawnSelected' myConfigGrid) -- grid select useful config files
+ , ("C-g t", goToSelected $ mygridConfig myColorizer) -- goto selected window
+ , ("C-g b", bringSelected $ mygridConfig myColorizer) -- bring selected window
+
+ -- Tree Select/
+ -- tree select actions menu
+ , ("C-t a", treeselectAction tsDefaultConfig)
+ -- tree select workspaces menu
+ , ("C-t t", TS.treeselectWorkspace tsDefaultConfig myWorkspaces W.greedyView)
+ -- tree select choose workspace to send window
+ , ("C-t g", TS.treeselectWorkspace tsDefaultConfig myWorkspaces W.shift)
+
+ -- 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
+ --, ("M-S-m", windows W.swapMaster) -- Swap the focused window and the master window
+ , ("M-S-j", windows W.swapDown) -- Swap focused window with next window
+ , ("M-S-k", windows W.swapUp) -- Swap focused window with prev window
+ , ("M-<Backspace>", promote) -- Moves focused window to master, others maintain order
+ , ("M1-S-<Tab>", rotSlavesDown) -- Rotate all windows except master and keep focus in place
+ , ("M1-C-<Tab>", rotAllDown) -- Rotate all the windows in the current stack
+ --, ("M-S-s", windows copyToAll)
+ , ("M-C-s", killAllOtherCopies)
+
+ -- Layouts
+ , ("M-<Tab>", sendMessage NextLayout) -- Switch to next layout
+ , ("M-C-M1-<Up>", sendMessage Arrange)
+ , ("M-C-M1-<Down>", sendMessage DeArrange)
+ , ("M-<Space>", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts) -- Toggles noborder/full
+ , ("M-S-<Space>", sendMessage ToggleStruts) -- Toggles struts
+ , ("M-S-n", sendMessage $ MT.Toggle NOBORDERS) -- Toggles noborder
+ , ("M-<KP_Multiply>", sendMessage (IncMasterN 1)) -- Increase number of clients in master pane
+ , ("M-<KP_Divide>", sendMessage (IncMasterN (-1))) -- Decrease number of clients in master pane
+ , ("M-S-<KP_Multiply>", increaseLimit) -- Increase number of windows
+ , ("M-S-<KP_Divide>", decreaseLimit) -- Decrease number of windows
+
+ , ("M-h", sendMessage Shrink) -- Shrink horiz window width
+ , ("M-l", sendMessage Expand) -- Expand horiz window width
+ , ("M-C-j", sendMessage MirrorShrink) -- Shrink vert window width
+ , ("M-C-k", sendMessage MirrorExpand) -- Exoand vert window width
+
+ -- Workspaces
+ , ("M-.", nextScreen) -- Switch focus to next monitor
+ , ("M-,", prevScreen) -- Switch focus to prev monitor
+ , ("M-S-<KP_Add>", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws
+ , ("M-S-<KP_Subtract>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws
+
+ -- Scratchpads
+ , ("M-C-<Return>", namedScratchpadAction myScratchPads "terminal")
+ , ("M-C-c", namedScratchpadAction myScratchPads "mocp")
+
+ -- Controls for mocp music player.
+ , ("M-u p", spawn "mocp --play")
+ , ("M-u l", spawn "mocp --next")
+ , ("M-u h", spawn "mocp --previous")
+ , ("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 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 '(+vterm/here nil)'") -- eshell 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/\")'")
+
+ --- 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-i", spawn (myTerminal ++ " -e irssi"))
+ , ("M-M1-j", spawn (myTerminal ++ " -e joplin"))
+ , ("M-M1-l", spawn (myTerminal ++ " -e lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss gopher://distro.tube"))
+ , ("M-M1-m", spawn (myTerminal ++ " -e mocp"))
+ , ("M-M1-n", spawn (myTerminal ++ " -e newsboat"))
+ , ("M-M1-p", spawn (myTerminal ++ " -e pianobar"))
+ , ("M-M1-r", spawn (myTerminal ++ " -e rtv"))
+ , ("M-M1-t", spawn (myTerminal ++ " -e toot curses"))
+ , ("M-M1-w", spawn (myTerminal ++ " -e wopr report.xml"))
+ , ("M-M1-y", spawn (myTerminal ++ " -e youtube-viewer"))
+
+ -- Multimedia Keys
+ , ("<XF86AudioPlay>", spawn "cmus toggle")
+ , ("<XF86AudioPrev>", spawn "cmus prev")
+ , ("<XF86AudioNext>", spawn "cmus next")
+ -- , ("<XF86AudioMute>", spawn "amixer set Master toggle") -- Bug prevents it from toggling correctly in 12.04.
+ , ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%- unmute")
+ , ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+ unmute")
+ , ("<XF86HomePage>", spawn "firefox")
+ , ("<XF86Search>", safeSpawn "firefox" ["https://www.google.com/"])
+ , ("<XF86Mail>", runOrRaise "geary" (resource =? "thunderbird"))
+ , ("<XF86Calculator>", runOrRaise "gcalctool" (resource =? "gcalctool"))
+ , ("<XF86Eject>", spawn "toggleeject")
+ , ("<Print>", spawn "scrotd 0")
+ ]
+ -- Appending search engine prompts to keybindings list.
+ -- Look at "search engines" section of this config for values for "k".
+ ++ [("M-s " ++ k, S.promptSearch dtXPConfig' f) | (k,f) <- searchList ]
+ ++ [("M-S-s " ++ k, S.selectSearch f) | (k,f) <- searchList ]
+ -- Appending some extra xprompts to keybindings list.
+ -- Look at "xprompt settings" section this of config for values for "k".
+ ++ [("M-p " ++ k, f dtXPConfig') | (k,f) <- promptList ]
+ ++ [("M-p " ++ k, f dtXPConfig' g) | (k,f,g) <- promptList' ]
+ -- 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"))
+
+------------------------------------------------------------------------
+-- MAIN
+------------------------------------------------------------------------
+main :: IO ()
+main = do
+ -- Launching three instances of xmobar on their monitors.
+ xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc0"
+ xmproc1 <- spawnPipe "xmobar -x 1 ~/.config/xmobar/xmobarrc2"
+ xmproc2 <- spawnPipe "xmobar -x 2 ~/.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.
+ , handleEventHook = serverModeEventHookCmd
+ <+> serverModeEventHook
+ <+> serverModeEventHookF "XMONAD_PRINT" (io . putStrLn)
+ <+> docksEventHook
+ , modMask = myModMask
+ , terminal = myTerminal
+ , startupHook = myStartupHook
+ , layoutHook = showWName' myShowWNameTheme myLayoutHook
+ , workspaces = TS.toWorkspaces myWorkspaces
+ , borderWidth = myBorderWidth
+ , normalBorderColor = myNormColor
+ , focusedBorderColor = myFocusColor
+ , logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP
+ { ppOutput = \x -> hPutStrLn xmproc0 x >> hPutStrLn xmproc1 x >> hPutStrLn xmproc2 x
+ , ppCurrent = xmobarColor "#c3e88d" "" . wrap "[" "]" -- Current workspace in xmobar
+ , ppVisible = xmobarColor "#c3e88d" "" -- Visible but not current workspace
+ , ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" -- Hidden workspaces in xmobar
+ -- , ppHiddenNoWindows = xmobarColor "#F07178" "" -- Hidden workspaces (no windows)
+ , ppHiddenNoWindows= \( _ ) -> "" -- Only shows visible workspaces. Useful for TreeSelect.
+ , ppTitle = xmobarColor "#d0d0d0" "" . shorten 60 -- Title of active window in xmobar
+ , ppSep = "<fc=#666666> | </fc>" -- Separators in xmobar
+ , ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!" -- Urgent workspace
+ , ppExtras = [windowCount] -- # of windows current workspace
+ , ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
+ }
+ } `additionalKeysP` myKeys
diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs
deleted file mode 100644
index 8456017..0000000
--- a/.config/xmonad/xmonad.hs
+++ /dev/null
@@ -1,326 +0,0 @@
--- IMPORTS
-
-import XMonad
-import Data.Monoid
-import System.Exit
-
-import qualified XMonad.StackSet as W
-import qualified Data.Map as M
-
--- The preferred terminal program, which is used in a binding below and by
--- certain contrib modules.
---
-myTerminal = "alacritty"
-
--- Whether focus follows the mouse pointer.
-myFocusFollowsMouse :: Bool
-myFocusFollowsMouse = True
-
--- Whether clicking on a window to focus also passes the click to the window
-myClickJustFocuses :: Bool
-myClickJustFocuses = False
-
--- Width of the window border in pixels.
---
-myBorderWidth = 1
-
--- modMask lets you specify which modkey you want to use. The default
--- is mod1Mask ("left alt"). You may also consider using mod3Mask
--- ("right alt"), which does not conflict with emacs keybindings. The
--- "windows key" is usually mod4Mask.
---
-myModMask = mod4Mask
-
--- The default number of workspaces (virtual screens) and their names.
--- By default we use numeric strings, but any string may be used as a
--- workspace name. The number of workspaces is determined by the length
--- of this list.
---
--- A tagging example:
---
--- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
---
-myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
-
--- Border colors for unfocused and focused windows, respectively.
---
-myNormalBorderColor = "#dddddd"
-myFocusedBorderColor = "#ff0000"
-
-------------------------------------------------------------------------
--- Key bindings. Add, modify or remove key bindings here.
---
-myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-
- -- launch a terminal
- [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
-
- -- launch dmenu
- , ((modm, xK_p ), spawn "dmenu_run")
-
- -- launch gmrun
- , ((modm .|. shiftMask, xK_p ), spawn "gmrun")
-
- -- close focused window
- , ((modm .|. shiftMask, xK_c ), kill)
-
- -- Rotate through the available layout algorithms
- , ((modm, xK_space ), sendMessage NextLayout)
-
- -- Reset the layouts on the current workspace to default
- , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
-
- -- Resize viewed windows to the correct size
- , ((modm, xK_n ), refresh)
-
- -- Move focus to the next window
- , ((modm, xK_Tab ), windows W.focusDown)
-
- -- Move focus to the next window
- , ((modm, xK_j ), windows W.focusDown)
-
- -- Move focus to the previous window
- , ((modm, xK_k ), windows W.focusUp )
-
- -- Move focus to the master window
- , ((modm, xK_m ), windows W.focusMaster )
-
- -- Swap the focused window and the master window
- , ((modm, xK_Return), windows W.swapMaster)
-
- -- Swap the focused window with the next window
- , ((modm .|. shiftMask, xK_j ), windows W.swapDown )
-
- -- Swap the focused window with the previous window
- , ((modm .|. shiftMask, xK_k ), windows W.swapUp )
-
- -- Shrink the master area
- , ((modm, xK_h ), sendMessage Shrink)
-
- -- Expand the master area
- , ((modm, xK_l ), sendMessage Expand)
-
- -- Push window back into tiling
- , ((modm, xK_t ), withFocused $ windows . W.sink)
-
- -- Increment the number of windows in the master area
- , ((modm , xK_comma ), sendMessage (IncMasterN 1))
-
- -- Deincrement the number of windows in the master area
- , ((modm , xK_period), sendMessage (IncMasterN (-1)))
-
- -- Toggle the status bar gap
- -- Use this binding with avoidStruts from Hooks.ManageDocks.
- -- See also the statusBar function from Hooks.DynamicLog.
- --
- -- , ((modm , xK_b ), sendMessage ToggleStruts)
-
- -- Quit xmonad
- , ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
-
- -- Restart xmonad
- , ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
-
- -- Run xmessage with a summary of the default keybindings (useful for beginners)
- , ((modm .|. shiftMask, xK_slash ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -"))
- ]
- ++
-
- --
- -- mod-[1..9], Switch to workspace N
- -- mod-shift-[1..9], Move client to workspace N
- --
- [((m .|. modm, k), windows $ f i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
- ++
-
- --
- -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
- -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
- --
- [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
- | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
-
-
-------------------------------------------------------------------------
--- Mouse bindings: default actions bound to mouse events
---
-myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
-
- -- mod-button1, Set the window to floating mode and move by dragging
- [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
- >> windows W.shiftMaster))
-
- -- mod-button2, Raise the window to the top of the stack
- , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
-
- -- mod-button3, Set the window to floating mode and resize by dragging
- , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
- >> windows W.shiftMaster))
-
- -- you may also bind events to the mouse scroll wheel (button4 and button5)
- ]
-
-------------------------------------------------------------------------
--- Layouts:
-
--- You can specify and transform your layouts by modifying these values.
--- If you change layout bindings be sure to use 'mod-shift-space' after
--- restarting (with 'mod-q') to reset your layout state to the new
--- defaults, as xmonad preserves your old layout settings by default.
---
--- The available layouts. Note that each layout is separated by |||,
--- which denotes layout choice.
---
-myLayout = tiled ||| Mirror tiled ||| Full
- where
- -- default tiling algorithm partitions the screen into two panes
- tiled = Tall nmaster delta ratio
-
- -- The default number of windows in the master pane
- nmaster = 1
-
- -- Default proportion of screen occupied by master pane
- ratio = 1/2
-
- -- Percent of screen to increment by when resizing panes
- delta = 3/100
-
-------------------------------------------------------------------------
--- Window rules:
-
--- Execute arbitrary actions and WindowSet manipulations when managing
--- a new window. You can use this to, for example, always float a
--- particular program, or have a client always appear on a particular
--- workspace.
---
--- To find the property name associated with a program, use
--- > xprop | grep WM_CLASS
--- and click on the client you're interested in.
---
--- To match on the WM_NAME, you can use 'title' in the same way that
--- 'className' and 'resource' are used below.
---
-myManageHook = composeAll
- [ className =? "MPlayer" --> doFloat
- , className =? "Gimp" --> doFloat
- , resource =? "desktop_window" --> doIgnore
- , resource =? "kdesktop" --> doIgnore ]
-
-------------------------------------------------------------------------
--- Event handling
-
--- * EwmhDesktops users should change this to ewmhDesktopsEventHook
---
--- Defines a custom handler function for X Events. The function should
--- return (All True) if the default handler is to be run afterwards. To
--- combine event hooks use mappend or mconcat from Data.Monoid.
---
-myEventHook = mempty
-
-------------------------------------------------------------------------
--- Status bars and logging
-
--- Perform an arbitrary action on each internal state change or X event.
--- See the 'XMonad.Hooks.DynamicLog' extension for examples.
---
-myLogHook = return ()
-
-------------------------------------------------------------------------
--- Startup hook
-
--- Perform an arbitrary action each time xmonad starts or is restarted
--- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize
--- per-workspace layout choices.
---
--- By default, do nothing.
-myStartupHook = return ()
-
-------------------------------------------------------------------------
--- Now run xmonad with all the defaults we set up.
-
--- Run xmonad with the settings you specify. No need to modify this.
---
-main = xmonad defaults
-
--- A structure containing your configuration settings, overriding
--- fields in the default config. Any you don't override, will
--- use the defaults defined in xmonad/XMonad/Config.hs
---
--- No need to modify this.
---
-defaults = def {
- -- simple stuff
- terminal = myTerminal,
- focusFollowsMouse = myFocusFollowsMouse,
- clickJustFocuses = myClickJustFocuses,
- borderWidth = myBorderWidth,
- modMask = myModMask,
- workspaces = myWorkspaces,
- normalBorderColor = myNormalBorderColor,
- focusedBorderColor = myFocusedBorderColor,
-
- -- key bindings
- keys = myKeys,
- mouseBindings = myMouseBindings,
-
- -- hooks, layouts
- layoutHook = myLayout,
- manageHook = myManageHook,
- handleEventHook = myEventHook,
- logHook = myLogHook,
- startupHook = myStartupHook
- }
-
--- | Finally, a copy of the default bindings in simple textual tabular format.
-help :: String
-help = unlines ["The default modifier key is 'alt'. Default keybindings:",
- "",
- "-- launching and killing programs",
- "mod-Shift-Enter Launch xterminal",
- "mod-p Launch dmenu",
- "mod-Shift-p Launch gmrun",
- "mod-Shift-c Close/kill the focused window",
- "mod-Space Rotate through the available layout algorithms",
- "mod-Shift-Space Reset the layouts on the current workSpace to default",
- "mod-n Resize/refresh viewed windows to the correct size",
- "",
- "-- move focus up or down the window stack",
- "mod-Tab Move focus to the next window",
- "mod-Shift-Tab Move focus to the previous window",
- "mod-j Move focus to the next window",
- "mod-k Move focus to the previous window",
- "mod-m Move focus to the master window",
- "",
- "-- modifying the window order",
- "mod-Return Swap the focused window and the master window",
- "mod-Shift-j Swap the focused window with the next window",
- "mod-Shift-k Swap the focused window with the previous window",
- "",
- "-- resizing the master/slave ratio",
- "mod-h Shrink the master area",
- "mod-l Expand the master area",
- "",
- "-- floating layer support",
- "mod-t Push window back into tiling; unfloat and re-tile it",
- "",
- "-- increase or decrease number of windows in the master area",
- "mod-comma (mod-,) Increment the number of windows in the master area",
- "mod-period (mod-.) Deincrement the number of windows in the master area",
- "",
- "-- quit, or restart",
- "mod-Shift-q Quit xmonad",
- "mod-q Restart xmonad",
- "mod-[1..9] Switch to workSpace N",
- "",
- "-- Workspaces & screens",
- "mod-Shift-[1..9] Move client to workspace N",
- "mod-{w,e,r} Switch to physical/Xinerama screens 1, 2, or 3",
- "mod-Shift-{w,e,r} Move client to screen 1, 2, or 3",
- "",
- "-- Mouse bindings: default actions bound to mouse events",
- "mod-button1 Set the window to floating mode and move by dragging",
- "mod-button2 Raise the window to the top of the stack",
- "mod-button3 Set the window to floating mode and resize by dragging"]
diff --git a/.config/xmonad/xmonad_keys.sh b/.config/xmonad/xmonad_keys.sh
new file mode 100755
index 0000000..f9d9b3a
--- /dev/null
+++ b/.config/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
diff --git a/.config/xmonad/xmonadctl.hs b/.config/xmonad/xmonadctl.hs
new file mode 100644
index 0000000..d6180d5
--- /dev/null
+++ b/.config/xmonad/xmonadctl.hs
@@ -0,0 +1,51 @@
+import Graphics.X11.Xlib
+import Graphics.X11.Xlib.Extras
+import System.Environment
+import System.IO
+import Data.Char
+
+main :: IO ()
+main = parse True "XMONAD_COMMAND" =<< getArgs
+
+parse :: Bool -> String -> [String] -> IO ()
+parse input addr args = case args of
+ ["--"] | input -> repl addr
+ | otherwise -> return ()
+ ("--":xs) -> sendAll addr xs
+ ("-a":a:xs) -> parse input a xs
+ ("-h":_) -> showHelp
+ ("--help":_) -> showHelp
+ ("-?":_) -> showHelp
+ (a@('-':_):_) -> hPutStrLn stderr ("Unknown option " ++ a)
+
+ (x:xs) -> sendCommand addr x >> parse False addr xs
+ [] | input -> repl addr
+ | otherwise -> return ()
+
+
+repl :: String -> IO ()
+repl addr = do e <- isEOF
+ case e of
+ True -> return ()
+ False -> do l <- getLine
+ sendCommand addr l
+ repl addr
+
+sendAll :: String -> [String] -> IO ()
+sendAll addr ss = foldr (\a b -> sendCommand addr a >> b) (return ()) ss
+
+sendCommand :: String -> String -> IO ()
+sendCommand addr s = do
+ d <- openDisplay ""
+ rw <- rootWindow d $ defaultScreen d
+ a <- internAtom d addr False
+ m <- internAtom d s False
+ allocaXEvent $ \e -> do
+ setEventType e clientMessage
+ setClientMessageEvent e rw a 32 m currentTime
+ sendEvent d rw False structureNotifyMask e
+ sync d False
+
+showHelp :: IO ()
+showHelp = do pn <- getProgName
+ putStrLn ("Send commands to a running instance of xmonad. xmonad.hs must be configured with XMonad.Hooks.ServerMode to work.\n-a atomname can be used at any point in the command line arguments to change which atom it is sending on.\nIf sent with no arguments or only -a atom arguments, it will read commands from stdin.\nEx:\n" ++ pn ++ " cmd1 cmd2\n" ++ pn ++ " -a XMONAD_COMMAND cmd1 cmd2 cmd3 -a XMONAD_PRINT hello world\n" ++ pn ++ " -a XMONAD_PRINT # will read data from stdin.\nThe atom defaults to XMONAD_COMMAND.")