mostly changes to xmonad

This commit is contained in:
Tyler Starr 2021-02-08 09:04:06 -08:00
parent 4847647bd8
commit d38f7b377e
14 changed files with 255 additions and 567 deletions

View File

@ -1,7 +1,7 @@
#
# ~/.bashrc
#
export PATH=$PATH:~/.cabal/bin
#export PATH=$PATH:~/.local/bin
alias lol="sudo sh -c 'sysctl -w abi.vsyscall32=0'"
alias dired="emacsclient -c -nw -a '' --eval '(dired nil)'"
@ -24,3 +24,4 @@ dot config --local status.showUntrackedFiles no
#export PATH="$PATH:$(ruby -e 'print Gem.user_dir')/bin"
#export GEM_HOME=$(ruby -e 'print Gem.user_dir')
[ -f "/home/tstarr/.ghcup/env" ] && source "/home/tstarr/.ghcup/env" # ghcup-env

View File

@ -1,6 +1,6 @@
from os.path import expanduser
from json import load
from yaml import load
# Get color config from pywal
wal_loc = expanduser('~/.cache/wal/colors.json')
wal_loc = expanduser("~/.config/qtile/themes/dracula.yml")
wal = load(open(wal_loc))

View File

@ -0,0 +1,19 @@
wallpaper: ""
special:
background: "#282A36"
foreground: "#F8F8F2"
cursor: "#44475A"
colors:
color0: "#282A36"
color1: "#44475A"
color2: "#F8F8F2"
color3: "#6272A4"
color4: "#8BE9FD"
color5: "#50FA7B"
color6: "#FFB86C"
color7: "#FF79C6"
color8: "#BD93F9"
color9: "#FF5555"
color10: "#F1FA8C"

6
.config/xmobar/xmobarrc1 → .config/xmobar/\ Executable file → Normal file
View File

@ -9,11 +9,11 @@ Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true
, Run Network "enp4s0" [ "-t", "<fc=#fb4934><tx></fc>kb/<fc=#fb4934><rx></fc>kb" ] 10
, Run Com "/home/tstarr/.config/xmobar/volume" [] "volume" 10
, Run Com "/home/tstarr/.config/xmobar/gamemode" [] "gamemode" 10
, Run Com "/home/tstarr/.config/xmobar/mouse_battery" [] "mouse_battery" 1
, Run Date " %a %d/%m/%y  %H:%M:%S" "date" 10
, Run MPD ["-M","15","-t", "<artist> (<fc=#fb4934><lapsed></fc>/<length>)"] 10
, Run StdinReader
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = " <fc=#fb4934>%StdinReader%</fc>}%date%{%enp4s0% | %mpd% | %volume% | 閭%cpu% |  %memory% |%gamemode% "
, template = " <fc=#fb4934>%StdinReader%</fc>}%date%{%enp4s0% |  %mouse_battery% | %volume% | 閭%cpu% |  %memory% |%gamemode% "
}

10
.config/xmobar/mouse_battery Executable file
View File

@ -0,0 +1,10 @@
status=$(cat /sys/class/power_supply/hidpp_battery_*/uevent | grep POWER_SUPPLY_VOLTAGE)
voltage=$(echo $status | cut -c26-29)
if [ "$voltage" -ge 3200 ]; then
color="#b8bb26"
else
color="#fb4934"
fi
echo "<fc=$color>${voltage}mV</fc>"

View File

@ -4,17 +4,16 @@ Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true
, position = Static {xpos = 0, ypos = 0, width = 2560, height = 20}
, iconRoot = "X"
, allDesktops = False
, overrideRedirect = False
, commands = [ Run Cpu ["-t", " <fc=#fb4934><total></fc>%","-H", "2"] 10
, Run Memory ["-t", "<fc=#fb4934><usedratio></fc>%"] 10
, Run Network "enp4s0" [ "-t", "<fc=#fb4934><tx></fc>kb/<fc=#fb4934><rx></fc>kb" ] 10
, Run Com "/home/tstarr/.config/xmobar/volume" [] "volume" 10
, Run Com "/home/tstarr/.config/xmobar/gamemode" [] "gamemode" 10
, Run Com "/home/tstarr/.config/xmobar/mouse_battery" [] "mouse_battery" 30
, Run Date " %a %d/%m/%y  %H:%M:%S" "date" 10
, Run MPD ["-M","15","-t", "<artist> (<fc=#fb4934><lapsed></fc>/<length>)"] 10
, Run StdinReader
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = " <fc=#fb4934>%StdinReader%</fc>}%date%{%enp4s0% | %mpd% | %volume% | 閭%cpu% |  %memory% |%gamemode% "
, template = " <fc=#fb4934>%StdinReader%</fc>}%date%{%enp4s0% |  %mouse_battery% | %volume% | 閭%cpu% |  %memory% |%gamemode% "
}

View File

@ -85,6 +85,15 @@
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type 'relative)
(map! :leader
; Add to the "open" menu in Doom
(:prefix-map ("o" . "open")
(:prefix-map ("o" . "org-ql")
:desc "views" "v" #'org-ql-view
:desc "Weekly Agenda" "w" (cmd! (org-ql-view "Weekly Agenda"))
:desc "Tasks to Refile" "r" (cmd! (org-ql-view "Tasks to Refile"))
:desc "This Weeks Progress" "p" (cmd! (org-ql-view "This Weeks Progress")))))
(setq org-directory "~/documents/org/")
(setq org-capture (directory-files-recursively
(concat org-directory "gtd/capture/") "\.org$"))
@ -112,71 +121,45 @@
("DONE" :foreground "forest green" :weight bold))))
(setq org-use-tag-inheritance t)
(setq org-tags-exclude-from-inheritance '("prj" "prg" "subprj"))
(setq org-tag-alist
'((:startgroup)
; Put mutually exclusive tags here
(:endgroup)
("@home" . ?H)
("@work" . ?W)
("note" . ?n)
("@home" . ?h)
("@work" . ?w)
("question" . ?q)
("prj" . ?p)
("subprj" . ?s)
("prg" . ?P)
("habit" . ?h)
("recurring" . ?r)))
("me" . ?m)
("Aaron" . ?a)
("Landon" . ?l)
("Valerie" . ?v)
("David" . ?d)))
(setq org-capture-todo (concat org-directory "gtd/capture/inbox.org"))
(setq org-capture-templates
(doct '(("personal" :keys "p"
:children (("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %? :@home:" "%a" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@home:"
"%a"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit:@home:" "%U"
"SCHEDULED: %(format-time-string
(doct '(("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %?" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@home:"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit" "%U"
"SCHEDULED: %(format-time-string
\"%<<%Y-%m-%d %a .+1d/3d>>\")"
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:children (("reoccuring" :keys "r"
:file org-capture-todo
:template ("* NEXT %? :meeting:@home:"
"%U" "SCHEDULED:
%(format-time-string
\"%<<%Y-%m-%d %a +7d>>\")"
":PROPERTIES:"
":REPEAT_TO_STATE: NEXT"
":END:"))))))
("work" :keys "w"
:children (("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %? :@work:" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@work:"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit:@work:" "%U"
"SCHEDULED: %(format-time-string
\"%<<%Y-%m-%d %a .+1d/3d>>\")"
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:children (("reoccuring" :keys "r"
:file org-capture-todo
:template ("* NEXT %? :meeting:@work:"
"%U" "SCHEDULED:
%(format-time-string
\"%<<%Y-%m-%d %a +7d>>\")"
":PROPERTIES:"
":REPEAT_TO_STATE: NEXT"
":END:")))))))))
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:file org-capture-todo
:template ("* NEXT %? :meeting:"
"%U")))))
(setq org-refile-targets (quote ((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 3))))
@ -235,14 +218,33 @@
:scheduled future
:deadline future)))))))
(defun open-org-ql-project (program)
(org-ql-search (list program)
'(and (todo)
(ancestors (todo))))
:super-groups '((:auto-outline-path t)))
(setq org-ql-project-view
(cons "Project View"
(lambda ()
"launch a project view for a given program."
(interactive)
(ivy-read "Project: "
(org-agenda-files)
:require-match t
:action #'open-org-ql-project))))
(setq org-super-agenda-header-map (make-sparse-keymap))
(setq org-ql-views
(list org-ql-weekly-agenda
org-ql-refile-tasks
org-ql-weeks-progress))
org-ql-weeks-progress
org-ql-project-view))
(after! org-agenda
(org-super-agenda-mode))
(setq org-startup-folded t)
(setq org-src-preserve-indentation t)) ; Close the after! org expression from
; Org File Paths
(add-hook 'haskell-mode-hook #'hindent-mode)

1
.doom.d/custom.el Normal file
View File

@ -0,0 +1 @@
(put 'upcase-region 'disabled nil)

View File

@ -363,6 +363,9 @@ We start by simply defining the standard headers used by the three files. These
(:host github
:repo "starr-dusT/burly.el"
:branch "master"))
(package! hindent)
#+end_src
* General Configuration
** This System
@ -400,6 +403,23 @@ We start by simply defining the standard headers used by the three files. These
(setq display-line-numbers-type 'relative)
#+end_src
** Keybindings
Add all my additional keybinds to Doom's standard SPC lead keymapping system.
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "config.el" "no")
(map! :leader
; Add to the "open" menu in Doom
(:prefix-map ("o" . "open")
(:prefix-map ("o" . "org-ql")
:desc "views" "v" #'org-ql-view
:desc "Weekly Agenda" "w" (cmd! (org-ql-view "Weekly Agenda"))
:desc "Tasks to Refile" "r" (cmd! (org-ql-view "Tasks to Refile"))
:desc "This Weeks Progress" "p" (cmd! (org-ql-view "This Weeks Progress")))))
#+end_src
#+RESULTS:
| lambda | (&rest _) | (interactive) | (org-ql-view This Weeks Progress) |
* Org mode
** Org directories
@ -449,16 +469,23 @@ Define the A tier tags.
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "config.el" "no")
(setq org-use-tag-inheritance t)
(setq org-tags-exclude-from-inheritance '("prj" "prg" "subprj"))
(setq org-tag-alist
'((:startgroup)
; Put mutually exclusive tags here
(:endgroup)
("@home" . ?H)
("@work" . ?W)
("note" . ?n)
("@home" . ?h)
("@work" . ?w)
("question" . ?q)
("prj" . ?p)
("subprj" . ?s)
("prg" . ?P)
("habit" . ?h)
("recurring" . ?r)))
("me" . ?m)
("Aaron" . ?a)
("Landon" . ?l)
("Valerie" . ?v)
("David" . ?d)))
#+end_src
*** Capture
@ -478,57 +505,24 @@ Allowable tags: @work, @home, note, question, habit
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "config.el" "no")
(setq org-capture-templates
(doct '(("personal" :keys "p"
:children (("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %? :@home:" "%a" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@home:"
"%a"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit:@home:" "%U"
"SCHEDULED: %(format-time-string
(doct '(("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %?" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@home:"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit" "%U"
"SCHEDULED: %(format-time-string
\"%<<%Y-%m-%d %a .+1d/3d>>\")"
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:children (("reoccuring" :keys "r"
:file org-capture-todo
:template ("* NEXT %? :meeting:@home:"
"%U" "SCHEDULED:
%(format-time-string
\"%<<%Y-%m-%d %a +7d>>\")"
":PROPERTIES:"
":REPEAT_TO_STATE: NEXT"
":END:"))))))
("work" :keys "w"
:children (("todo" :keys "t"
:file org-capture-todo
:template ("* TODO %? :@work:" "%U"))
("question" :keys "q"
:file org-capture-todo
:template ("* TODO Find out %? :question:@work:"
"%U"))
("habit" :keys "h"
:file org-capture-todo
:template ("* NEXT %? :habit:@work:" "%U"
"SCHEDULED: %(format-time-string
\"%<<%Y-%m-%d %a .+1d/3d>>\")"
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:children (("reoccuring" :keys "r"
:file org-capture-todo
:template ("* NEXT %? :meeting:@work:"
"%U" "SCHEDULED:
%(format-time-string
\"%<<%Y-%m-%d %a +7d>>\")"
":PROPERTIES:"
":REPEAT_TO_STATE: NEXT"
":END:")))))))))
":PROPERTIES:" ":STYLE: habit"
":REPEAT_TO_STATE: NEXT" ":END:"))
("meeting" :keys "m"
:file org-capture-todo
:template ("* NEXT %? :meeting:"
"%U")))))
#+end_src
*** Refile
@ -609,13 +603,32 @@ Following config items will utilizes the awesome [[https://github.com/alphapapa/
:scheduled future
:deadline future)))))))
#+end_src
***** Project View
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "config.el" "no")
(defun open-org-ql-project (program)
(org-ql-search (list program)
'(and (todo)
(not (children)))
:super-groups '((:auto-outline-path t))))
(setq org-ql-project-view
(cons "Project View"
(lambda ()
"launch a project view for a given program."
(interactive)
(ivy-read "Project: "
(org-agenda-files)
:require-match t
:action #'open-org-ql-project))))
#+end_src
***** Final
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "config.el" "no")
(setq org-super-agenda-header-map (make-sparse-keymap))
(setq org-ql-views
(list org-ql-weekly-agenda
org-ql-refile-tasks
org-ql-weeks-progress))
org-ql-weeks-progress
org-ql-project-view))
(after! org-agenda
(org-super-agenda-mode))
#+end_src
@ -625,3 +638,11 @@ Following config items will utilizes the awesome [[https://github.com/alphapapa/
(setq org-src-preserve-indentation t)) ; Close the after! org expression from
; Org File Paths
#+end_src
* Devel
** Haskell
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "config.el" "no")
(add-hook 'haskell-mode-hook #'hindent-mode)
#+end_src

View File

@ -68,3 +68,5 @@
(:host github
:repo "starr-dusT/burly.el"
:branch "master"))
(package! hindent)

View File

@ -1,8 +1,8 @@
# Speed up scrolling for the document viewer
"^brave-browser$"
None, Up, Button4, 4
None, Down, Button5, 4
None, Up, Button4, 6
None, Down, Button5, 6
"^Steam$"
None, Up, Button4, 4
None, Down, Button5, 4
None, Up, Button4, 6
None, Down, Button5, 6

View File

@ -1 +1 @@
exec dbus-launch qtile
exec dbus-launch xmonad

View File

@ -2,7 +2,7 @@
import XMonad
import Data.Monoid
import System.Exit
import System.IO (hPutStrLn)
import System.IO
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Directory (getHomeDirectory)
@ -19,17 +19,28 @@ import XMonad.Layout.NoBorders
import XMonad.Layout.Gaps
import XMonad.Layout.Spacing
import XMonad.Layout.ThreeColumns
import XMonad.Layout.Tabbed
import XMonad.Layout.Renamed
import XMonad.Layout.LayoutModifier
import XMonad.Layout.Combo
import XMonad.Layout.TwoPane
import XMonad.Layout.WindowNavigation
-- Utilities
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
import XMonad.Util.SpawnOnce
import XMonad.Util.NamedScratchpad
import XMonad.Util.EZConfig (additionalKeysP, removeKeys)
import XMonad.Util.NamedActions
import XMonad.Util.NamedScratchpad
import XMonad.Util.NamedWindows (getName)
-- Actions
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
import XMonad.Actions.DynamicProjects
import XMonad.Actions.DynamicWorkspaces
import XMonad.Actions.CopyWindow
import XMonad.Actions.Commands
-- Prompt
import XMonad.Prompt
@ -85,14 +96,21 @@ myPromptTheme = def
, height = prompt
, position = Top
}
myStartupHook = do
spawnOnce "nitrogen --restore &"
spawnOnce "lxsession &"
spawnOnce "xsetroot -cursor_name left_ptr"
spawnOnce "imwheel -b 45"
spawnOnce "imwheel -b 45 &"
spawnOnce "play-with-mpv &"
------------------------------------------------------------------------}}}
-- Layouts {{{
--
-- Alot stolen from https://github.com/altercation/dotfiles-tilingwm
---------------------------------------------------------------------------
myLayout = spacing 2 $ smartBorders (tiled ||| Mirror tiled ||| Full ||| ThreeCol 1 (3/100) (1/2))
myLayout = windowNavigation $ spacing 2 $ smartBorders (tiled ||| Mirror tiled ||| Full ||| ThreeColMid 1 (3/100) (1/2) ||| tabTwoPane)
where
-- default tiling algorithm partitions the screen into two panes
tiled = Tall nmaster delta ratio
@ -102,6 +120,19 @@ myLayout = spacing 2 $ smartBorders (tiled ||| Mirror tiled ||| Full ||| ThreeCo
ratio = 1/2
-- Percent of screen to increment by when resizing panes
delta = 2/100
tabTwoPane = renamed [Replace "TwoPane Tabs"] $ combineTwo (TwoPane 0.03 0.5) (tabs) (tabs)
tabs = tabbed shrinkText myTabTheme
myTabTheme = def { fontName = myFont
, activeColor = "#46d9ff"
, inactiveColor = "#313846"
, activeBorderColor = "#46d9ff"
, inactiveBorderColor = "#282c34"
, activeTextColor = "#282c34"
, inactiveTextColor = "#d0d0d0"
}
myScratchPads :: [NamedScratchpad]
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
@ -153,49 +184,51 @@ myLogHook = return ()
myKeys :: String -> [([Char], X ())]
myKeys home =
[
-- close focused window
("M-q", kill)
--------------------------------------------------
-- Window/Focus Manipulation
--------------------------------------------------
-- Rotate through the available layout algorithms
, ("M-<Space>", sendMessage NextLayout)
-- Resize viewed windows to the correct size
, ("M-z", refresh)
("M-<Tab>", sendMessage NextLayout)
-- Move focus to the next window
, ("M-j", windows W.focusDown)
-- Move focus to the previous window
, ("M-k", windows W.focusUp)
-- Switch focus to next monitor
, ("M-.", nextScreen)
-- Switch focus to prev monitor
, ("M-,", prevScreen)
-- Swap the focused window with the next window/tabs
, ("M-S-j", sequence_ [windows W.swapDown, sendMessage $ Move R])
-- Swap the focused window with the previous window/tabs
, ("M-S-k", sequence_ [windows W.swapUp, sendMessage $ Move L])
-- Move focus to the master window
, ("M-m", windows W.focusMaster)
-- Swap the focused window and the master window
, ("M-c", windows W.swapMaster)
-- Swap the focused window with the next window
, ("M-S-j", windows W.swapDown)
-- Swap the focused window with the previous window
, ("M-S-k", windows W.swapUp)
-- Shrink the master area
, ("M-h", sendMessage Shrink)
-- Expand the master area
, ("M-l", sendMessage Expand)
-- Copy window to all workspaces
, ("M-x c", toggleCopyToAll)
-- Push window back into tiling
, ("M-t", withFocused $ windows . W.sink)
, ("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
-- close focused window
, ("M-q", kill)
--------------------------------------------------
-- Basic Utils
--------------------------------------------------
-- Spawn terminal
, ("M-<Return>" , spawn "alacritty")
-- Spawn rofi drun
, ("M-w" , spawn "rofi -show drun")
-- Spawn rofi window
, ("M-S-w", spawn "rofi -show window")
-- mute overall volume
, ("<XF86AudioMute>", spawn muteVolumeCmd)
-- raise overall volume
, ("<XF86AudioRaiseVolume>", spawn raiseVolumeCmd)
-- lower overall volume
, ("<XF86AudioLowerVolume>", spawn lowerVolumeCmd)
--------------------------------------------------
-- Scratchpads
--------------------------------------------------
-- Spawn rofi window
, ("M-S-<Return>", namedScratchpadAction myScratchPads "terminal")
-- Spawn rofi window
@ -203,6 +236,9 @@ myKeys home =
-- Spawn rofi window
, ("M-v", namedScratchpadAction myScratchPads "scr-mpv")
--------------------------------------------------
-- Open Applications
--------------------------------------------------
-- Spawn firefox
, ("M-o b" , spawn "brave")
-- Spawn lutris
@ -214,6 +250,9 @@ myKeys home =
-- Spawn emacs
, ("M-o e" , spawn "emacs")
--------------------------------------------------
-- System Utils
--------------------------------------------------
-- Recompile and restart xmonad
, ("M-x r", spawn "xmonad --recompile; xmonad --restart")
-- Quit xmonad
@ -222,9 +261,17 @@ myKeys home =
, ("M-x g", spawn "gamemoded -r")
-- Stop gamemode
, ("M-x S-g", spawn "killall gamemoded")
-- mute overall volume
, ("<XF86AudioMute>", spawn muteVolumeCmd)
-- raise overall volume
, ("<XF86AudioRaiseVolume>", spawn raiseVolumeCmd)
-- lower overall volume
, ("<XF86AudioLowerVolume>", spawn lowerVolumeCmd)
]
where nonNSP = WSIs (return (\ws -> W.tag ws /= "nsp"))
nonEmptyNonNSP = WSIs (return (\ws -> isJust (W.stack ws) && W.tag ws /= "nsp"))
where
toggleCopyToAll = wsContainingCopies >>= \ws -> case ws of
[] -> windows copyToAll
_ -> killAllOtherCopies
rmKeys :: String -> [(KeyMask, KeySym)]
rmKeys keys =
@ -236,7 +283,7 @@ rmKeys keys =
main = do
home <- getHomeDirectory
xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc"
--
--
xmonad $ docks $ ewmh $ ewmhFullscreen def
{
-- Simple items

View File

@ -1,414 +0,0 @@
+TITLE: Custom Xmonad Config
#+PROPERTY: header-args :tangle xmonad.hs
* Table of Contents
:PROPERTIES:
:TOC: :include all :depth 3
:END:
:CONTENTS:
- [[#table-of-contents][Table of Contents]]
- [[#imports][Imports]]
- [[#variables][Variables]]
- [[#start-up][Start Up]]
- [[#layout][Layout]]
- [[#scrathpads][Scrathpads]]
- [[#hooks][Hooks]]
- [[#events][Events]]
- [[#logging][Logging]]
- [[#keybinds][Keybinds]]
- [[#add-normal-binds][Add "Normal" Binds]]
- [[#window-management][Window Management]]
- [[#basics][Basics]]
- [[#media-control][Media Control]]
- [[#scratchpads][Scratchpads]]
- [[#add-open-binds][Add Open Binds]]
- [[#add-system-utils-binds][Add System Utils Binds]]
- [[#remove-unneeded-default-binds][Remove Unneeded Default Binds]]
- [[#main][Main]]
:END:
* Imports
Import Haskel modules that are used later in the config.
#+begin_src haskell
-- Base
import XMonad
import Data.Monoid
import System.Exit
import System.IO (hPutStrLn)
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Directory (getHomeDirectory)
-- Hooks
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.WorkspaceHistory
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..))
-- Layouts
import XMonad.Layout.NoBorders
import XMonad.Layout.Gaps
import XMonad.Layout.Spacing
import XMonad.Layout.ThreeColumns
-- Utilities
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
import XMonad.Util.SpawnOnce
import XMonad.Util.NamedScratchpad
import XMonad.Util.EZConfig (additionalKeysP, removeKeys)
-- Actions
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
import XMonad.Actions.DynamicProjects
import XMonad.Actions.DynamicWorkspaces
-- Prompt
import XMonad.Prompt
-- Data
import Data.Maybe (isJust)
#+end_src
* Variables
Set variable used later in the config, often a handful of times.
#+begin_src haskell
-- Terminal to use
myTerminal = "alacritty"
-- Focus follows mouse pointer
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
-- Define mod keys
myModMask = mod4Mask
altMask = mod1Mask
-- Define volume keys and commands
lowerVolumeCmd = "pulseaudio-ctl down 2"
raiseVolumeCmd = "pulseaudio-ctl up 2"
muteVolumeCmd = "pulseaudio-ctl mute"
-- Count windows
windowCount :: X (Maybe String)
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
-- Define workspaces
myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
-- Width of window border
myBorderWidth = 2
-- Border colors
myNormalBorderColor = "#ebdbb2"
myFocusedBorderColor = "#d3869b"
-- Prompt theming
myFont = "xft:Mononoki Nerd Font:bold:size=9:antialias=true:hinting=true"
yellow = "#504945"
base03 = "#ebdbb2"
active = "#b8bb26"
prompt = 20
myPromptTheme = def
{ font = myFont
, bgColor = base03
, fgColor = active
, fgHLight = base03
, bgHLight = active
, borderColor = base03
, promptBorderWidth = 0
, height = prompt
, position = Top
}
#+end_src
* Start Up
Set variable used later in the config, often a handful of times.
#+begin_src haskell
myStartupHook = do
spawnOnce "nitrogen --restore &"
spawnOnce "lxsession &"
spawnOnce "xsetroot -cursor_name left_ptr"
spawnOnce "imwheel -b 45"
#+end_src
* Layout
Set the possible layouts for great justice.
#+begin_src haskell
myLayout = spacing 2 $ smartBorders (tiled ||| Mirror tiled ||| Full ||| ThreeCol 1 (3/100) (1/2))
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 = 2/100
#+end_src
* Scrathpads
Define all my scrathpads.
#+begin_src haskell
myScratchPads :: [NamedScratchpad]
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
, NS "scr-mpv" spawnMpv findMpv manageMpv
, NS "discord" spawnDiscord findDiscord manageDiscord ]
where
spawnTerm = myTerminal ++ " -t terminal"
findTerm = title =? "terminal"
manageTerm = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 -h
l = 0.95 -w
spawnMpv = "mpv --player-operation-mode=pseudo-gui --title=scr-mpv"
findMpv = title =? "scr-mpv"
manageMpv = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 -h
l = 0.95 -w
spawnDiscord = "discord"
findDiscord = appName =? "discord"
manageDiscord = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 -h
l = 0.95 -w
#+end_src
* Hooks
Define some wicked hooks.
#+begin_src haskell
myManageHook = composeAll
-- Float fullscreen apps (mostly games)
[isDialog --> doCenterFloat,
isFullscreen --> doFullFloat,
className =? "Gimp" --> doFullFloat,
className =? "Anki" --> doFullFloat,
className =? "mpv" --> doRectFloat (W.RationalRect 0.55 0.05 0.4 0.4),
className =? "Steam" --> doFullFloat,
className =? "microsoft teams - preview" --> doFullFloat,
namedScratchpadManageHook myScratchPads]
#+end_src
* Events
Define some Events.
#+begin_src haskell
myEventHook = mempty
#+end_src
* Logging
Define some Events.
#+begin_src haskell
myLogHook = return ()
#+end_src
* Keybinds
** Add "Normal" Binds
Set all of the keybinds I use to control the universe from within Xmonad.
*** Window Management
#+begin_src haskell
myKeys :: String -> [([Char], X ())]
myKeys home =
[
-- close focused window
("M-q", kill)
-- Rotate through the available layout algorithms
, ("M-<Space>", sendMessage NextLayout)
-- Resize viewed windows to the correct size
, ("M-z", refresh)
-- Move focus to the next window
, ("M-j", windows W.focusDown)
-- Move focus to the previous window
, ("M-k", windows W.focusUp)
-- Move focus to the master window
, ("M-m", windows W.focusMaster)
-- Swap the focused window and the master window
, ("M-c", windows W.swapMaster)
-- Swap the focused window with the next window
, ("M-S-j", windows W.swapDown)
-- Swap the focused window with the previous window
, ("M-S-k", windows W.swapUp)
-- Shrink the master area
, ("M-h", sendMessage Shrink)
-- Expand the master area
, ("M-l", sendMessage Expand)
-- Push window back into tiling
, ("M-t", withFocused $ windows . W.sink)
, ("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
#+end_src
*** Basics
#+begin_src haskell
-- Spawn terminal
, ("M-<Return>" , spawn "alacritty")
-- Spawn rofi drun
, ("M-w" , spawn "rofi -show drun")
-- Spawn rofi window
, ("M-S-w", spawn "rofi -show window")
#+end_src
*** Media Control
#+begin_src haskell
-- mute overall volume
, ("<XF86AudioMute>", spawn muteVolumeCmd)
-- raise overall volume
, ("<XF86AudioRaiseVolume>", spawn raiseVolumeCmd)
-- lower overall volume
, ("<XF86AudioLowerVolume>", spawn lowerVolumeCmd)
#+end_src
*** Scratchpads
#+begin_src haskell
-- Spawn rofi window
, ("M-S-<Return>", namedScratchpadAction myScratchPads "terminal")
-- Spawn rofi window
, ("M-d", namedScratchpadAction myScratchPads "discord")
-- Spawn rofi window
, ("M-v", namedScratchpadAction myScratchPads "scr-mpv")
#+end_src
** Add Open Binds
#+begin_src haskell
-- Spawn firefox
, ("M-o b" , spawn "brave")
-- Spawn lutris
, ("M-o l" , spawn "lutris")
-- Spawn steam
, ("M-o s" , spawn "steam")
-- Spawn flameshot
, ("M-o c" , spawn "flameshot gui")
-- Spawn emacs
, ("M-o e" , spawn "emacs")
#+end_src
** Add System Utils Binds
#+begin_src haskell
-- Recompile and restart xmonad
, ("M-x r", spawn "xmonad --recompile; xmonad --restart")
-- Quit xmonad
, ("M-x q", io (exitWith ExitSuccess))
-- Start gamemode
, ("M-x g", spawn "gamemoded -r")
-- Stop gamemode
, ("M-x S-g", spawn "killall gamemoded")
]
where nonNSP = WSIs (return (\ws -> W.tag ws /= "nsp"))
nonEmptyNonNSP = WSIs (return (\ws -> isJust (W.stack ws) && W.tag ws /= "nsp"))
#+end_src
** Remove Unneeded Default Binds
#+begin_src haskell
rmKeys :: String -> [(KeyMask, KeySym)]
rmKeys keys =
[
-- Remove the default quit xmonad bind
(myModMask .|. shiftMask, xK_q)
]
#+end_src
* Main
The main function that gets it all done.
#+begin_src haskell
main = do
home <- getHomeDirectory
xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc"
--
xmonad $ docks $ ewmh $ ewmhFullscreen def
{
-- Simple items
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
borderWidth = myBorderWidth,
modMask = myModMask,
workspaces = myWorkspaces,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
-- Hooks, Layouts
layoutHook = avoidStruts $ myLayout,
manageHook = myManageHook,
handleEventHook = myEventHook,
logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP
{ ppOutput = \x -> hPutStrLn xmproc0 x
, ppCurrent = xmobarColor "#b8bb26" "" . wrap "[" "]" -- Current workspace in xmobar
, ppVisible = xmobarColor "#83a598" "" -- Visible but not current workspace
, ppHidden = xmobarColor "#83a598" "" . wrap "*" "" -- Hidden workspaces in xmobar
, ppHiddenNoWindows= \( _ ) -> "" -- Only shows visible workspaces. Useful for TreeSelect.
, ppTitle = xmobarColor "#ebdbb2" "" . shorten 60 -- Title of active window in xmobar
, ppSep = "<fc=#ebdbb2> | </fc>" -- Separators in xmobar
, ppUrgent = xmobarColor "#fb4934" "" . wrap "!" "!" -- Urgent workspace
, ppExtras = [windowCount] -- # of windows current workspace
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]},
startupHook = myStartupHook
} `removeKeys` rmKeys home
`additionalKeysP` myKeys home
#+end_src