Updated a few things in XMonad and Doom Emacs configs

This commit is contained in:
Phil Bajsicki 2023-08-11 21:37:18 +02:00
parent 4196f7ac92
commit 912ef5c159
4 changed files with 69 additions and 108 deletions

View file

@ -86,7 +86,7 @@
org-agenda-log-mode-items '(closed clock state))
(setq org-agenda-files '("~/enc/org/"))
(setq org-agenda-files '("~/enc/org/org-agenda-files.org"))
;; from /home/phil/.emacs.d/modules/lang/org/config.el, edited
(setq org-todo-keywords

View file

@ -4,7 +4,7 @@
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(org-safe-remote-resources
'("\\`https://lvxnox\\.com/org-html-themes/org/theme-readtheorg\\.setup\\'" "\\`https://bajsicki\\.com\\(?:/\\|\\'\\)")))
'("\\`https://bajsicki\\.com/org-html-themes/org/theme-readtheorg\\.setup\\'")))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.

View file

@ -1,4 +1,4 @@
#+title: Phil B's xmonad config
#+title: Phil's xmonad config
#+author: Phil Bajsicki
#+PROPERTY: header-args :tangle xmonad.hs

View file

@ -1,23 +1,21 @@
-- 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
import XMonad.Actions.GridSelect
import XMonad.Actions.MouseResize
import XMonad.Actions.Promote
import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
import XMonad.Actions.SpawnOn
import XMonad.Actions.UpdatePointer
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
@ -25,7 +23,6 @@ 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(..))
@ -37,7 +34,6 @@ 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
@ -46,7 +42,6 @@ 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), (??))
@ -65,7 +60,6 @@ import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
import XMonad.Prompt
import XMonad.Prompt.OrgMode
-- Utilities
import XMonad.Util.Dmenu
import XMonad.Util.EZConfig
import XMonad.Util.NamedActions
@ -74,34 +68,18 @@ import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
import XMonad.Util.SpawnOnce
import XMonad.Util.ClickableWorkspaces
-- ColorScheme module (SET ONLY ONE!)
-- Possible choice are:
-- DoomOne
-- Dracula
-- GruvboxDark
-- MonokaiPro
-- Nord
-- OceanicNext
-- Palenight
-- SolarizedDark
-- SolarizedLight
-- TomorrowNight
import Colors.DoomOne
myBorderWidth :: Dimension
myBorderWidth = 2
myBorderWidth :: Dimension --used in 2 places
myBorderWidth = 2 -- Sets border width for windows
windowCount :: X (Maybe String) --used in 2 places
windowCount :: X (Maybe String)
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
--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
-- 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"]
$ smartBorders
-- $ windowNavigation
@ -121,33 +99,13 @@ tabs = renamed [Replace "tabs"]
-- add spacing between window and tabs which looks bad.
$ tabbed shrinkText myTabTheme
-- setting colors for tabs layout and tabs sublayout.
myTabTheme = def { fontName = "xft:Iosevka-9"
, activeColor = color15
, inactiveColor = colorBack
, activeBorderColor = color15
, inactiveBorderColor = colorFore
, activeTextColor = colorBack
, inactiveTextColor = colorFore
}
myManageHook = composeAll
[ 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 =? "zoom" --> doFloat
, className =? "Yad" --> doCenterFloat
, (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog
, isFullscreen --> doFullFloat
]
-- myWorkspaceIndices = M.fromList $ zipWith (,) workspaces [1..] -- (,) == \x y -> (x,y)
, inactiveTextColor = colorFore }
mySB = statusBarProp "xmobar" (clickablePP xmobarPP)
@ -159,45 +117,72 @@ myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9",
]
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
myManageHook = manageSpawn <> composeAll
[ 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 =? "zoom" --> doFloat
, className =? "Yad" --> doCenterFloat
, (className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog
, isFullscreen --> doFullFloat
]
myStartupHook = do
setWMName "LG3D"
spawnOnce "lxsession"
spawnOnce "setxkbmap -model pc104 -layout pl -option compose:rctrl"
spawnOnce "gocryptfs ~/.bajsicki enc --extpass lxqt-openssh-askpass"
spawnOnce "feh --randomize --bg-fill /usr/share/backgrounds/archlinux/*"
spawn "killall trayer" -- kill current trayer on each
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 20")
spawnOnce "dunst"
spawnOnce "aw-server"
spawnOnce "aw-watcher-afk"
spawnOnce "aw-watcher-window"
spawnOnce "poetry run aw-watcher-spotify"
spawnOnce "/usr/bin/emacs --daemon"
spawnOn "1" "firefox-developer-edition"
spawnOn "2" "evolution"
spawnOn "9" "steam"
spawnOn "3" "discord"
spawnOn "6" "google-chrome-stable"
spawnOn "e" "/usr/bin/emacsclient"
spawnOn "j" "keepassxc"
main :: IO ()
main = do
-- Launching three instances of xmobar on their monitors.
xmproc0 <- spawnPipe ("xmobar -x 0 $HOME/.config/xmobar/tomorrow-night-xmobarrc")
xmproc1 <- spawnPipe ("xmobar -x 1 $HOME/.config/xmobar/tomorrow-night-xmobarrc")
xmproc2 <- spawnPipe ("xmobar -x 2 $HOME/.config/xmobar/tomorrow-night-xmobarrc")
-- the xmonad, ya know...what the WM is named after!
xmonad $ ewmh $ docks $ def
{ manageHook = myManageHook <+> manageDocks
, handleEventHook = swallowEventHook (className =? "Alacritty" <||> className =? "st-256color" <||> className =? "XTerm") (return True)
-- docks
-- Uncomment this line to enable fullscreen support on things like YouTube/Netflix.
-- This works perfect on SINGLE monitor systems. On multi-monitor systems,
-- it adds a border around the window if screen does not have focus. So, solution
-- is to use a keybinding to toggle fullscreen noborders instead. (M-<Space>)
-- <+> fullscreenEventHook
, modMask = mod4Mask
, terminal = "alacritty"
, startupHook = do
setWMName "LG3D"
spawnOnce "feh --randomize --bg-fill /usr/share/backgrounds/dtos-backgrounds/*" -- feh set random wallpaper"
spawnOnce "lxsession"
spawnOnce "nm-applet"
spawnOnce "picom"
spawnOnce "volumeicon"
spawn "~/.screenalyout/3-laptop-center.sh"
spawn "setxkbmap -model pc104 -layout pl"
spawn "dunst"
spawnOnce "python tech/source/aw-watcher-spotify/aw_watcher_spotify/main.py"
spawnOnce "aw-watcher-afk"
spawnOnce "aw-watcher-window"
spawn "killall conky" -- kill current conky on each restart
spawn "/usr/bin/emacs --daemon" -- emacs daemon for the emacsclient
spawn "killall trayer" -- kill current trayer on each
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 20")
, startupHook = myStartupHook
, layoutHook = avoidStruts
$ windowNavigation
$ subTabbed
@ -210,19 +195,19 @@ main = do
, borderWidth = myBorderWidth
, normalBorderColor = colorBack
, focusedBorderColor = color15
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = \x -> hPutStrLn xmproc0 x -- xmobar on monitor 1
>> hPutStrLn xmproc1 x -- xmobar on monitor 2
>> hPutStrLn xmproc2 x -- xmobar on monitor 3
{ ppOutput = \x -> hPutStrLn xmproc0 x
>> hPutStrLn xmproc1 x
>> hPutStrLn xmproc2 x
, ppCurrent = xmobarColor color06 "" . wrap
("<box type=Bottom width=2 mb=1 color=" ++ color06 ++ ">") "</box>"
-- Visible but not current workspace
, ppVisible = xmobarColor color06 "" . clickable
-- Hidden workspace
, ppHidden = xmobarColor color05 "" . wrap
("<box type=Top width=2 mt=1 color=" ++ color05 ++ ">") "</box>" . clickable
-- Hidden workspaces (no windows)
, ppHiddenNoWindows = xmobarColor color05 "" . clickable
-- Title of active window
, ppTitle = xmobarColor colorFore "" . shorten 48
-- Separator character
@ -235,10 +220,7 @@ main = do
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
} >> updatePointer (0.5, 0.5) (0.0, 0.0) }
`additionalKeysP`
-- subKeys "Switch to workspace"
[ ("M-s 1", (windows $ W.greedyView $ myWorkspaces !! 0))
, ("M-s 2", (windows $ W.greedyView $ myWorkspaces !! 1))
, ("M-s 3", (windows $ W.greedyView $ myWorkspaces !! 2))
@ -275,7 +257,6 @@ main = do
, ("M-s z", (windows $ W.greedyView $ myWorkspaces !! 33))
, ("M-s p", (windows $ W.greedyView $ myWorkspaces !! 34))
-- ^++^ subKeys "Throw to workspace"
, ("M-t 1", (windows $ W.shift $ myWorkspaces !! 0))
, ("M-t 2", (windows $ W.shift $ myWorkspaces !! 1))
, ("M-t 3", (windows $ W.shift $ myWorkspaces !! 2))
@ -312,7 +293,6 @@ main = do
, ("M-t z", (windows $ W.shift $ myWorkspaces !! 33))
, ("M-t p", (windows $ W.shift $ myWorkspaces !! 34))
, ("M-o", windows W.focusUp)
, ("M-a", windows W.focusDown)
@ -328,19 +308,11 @@ main = do
, ("M-.", nextScreen)
, ("M-,", prevScreen)
-- Switch layouts
, ("M-<Tab>", sendMessage NextLayout)
, ("M-f", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts)
-- Window resizing
, ("M-y", sendMessage Shrink)
, ("M-l", sendMessage Expand)
-- , ("M-M1-j", addName "Shrink window vertically" $ sendMessage MirrorShrink)
-- , ("M-M1-k", addName "Expand window vertically" $ sendMessage MirrorExpand)
-- Floating windows
-- ("M-f", addName "Toggle float layout" $ sendMessage (T.Toggle "floats"))
-- , ("M-S-t", addName "Sink a floating window" $ withFocused $ windows . W.sink)
, ("M-b", sinkAll)
-- Sublayouts
@ -355,47 +327,36 @@ main = do
, ("C-S-M1-j", onGroup W.focusUp')
, ("C-S-M1-y", onGroup W.focusDown')
-- XMonad and apps
, ("C-M1-S-0", sequence_ [spawn "xmonad --restart", spawn "xmonad --recompile"])
, ("M-S-M1-C-0", io exitSuccess)
, ("S-C-M1-q", kill1)
, ("M-S-C-M1-q", killAll)
, ("M-S-<Return>", spawn "~/.local/bin/dm-run")
, ("M-d", spawn "rofi -show drun")
, ("M-e", spawn "emacsclient -c -a 'emacs'")
, ("M-<Return>", spawn "alacritty")
, ("M-S-<F11>", spawn "feh --randomize --bg-fill ~/pictures/wallpapers/*")
, ("M-S-<F11>", spawn "feh --randomize --bg-fill /usr/share/backgrounds/archlinux/*")
, ("M-<Print>", spawn "dm-maim")
, ("<Print>", spawn "flameshot gui")
-- ORG PROMPTS
, ("M-c i", orgPrompt def "TODO" "~/enc/org/inbox.org")
, ("M-c l", orgPromptPrimary def "LINK" "~/enc/org/inbox.org")
, ("M-c n", orgPrompt def "NOTE" "~/enc/org/inbox.org")
, ("M-c p", orgPromptRefile def "TODO" "~/enc/org/phil.org")
-- , ("<Print>", spawn "maim -so | xclip -selection clipboard -t image/png")
-- Time! Timestamps!
, ("M-w l", spawn "sleep 0.5 && xdotool type \"$(date +'%Y.%m.%d %H:%M:%S %Z')\"")
, ("M-w e", spawn "sleep 0.5 && xdotool type \"$(TZ=America/New_York date +'%Y.%m.%d %H:%M:%S %Z')\"")
, ("M-w m", spawn "sleep 0.5 && xdotool type \"$(TZ=America/Denver date +'%Y.%m.%d %H:%M:%S %Z')\"")
-- Multimedia Keys
, ("<XF86AudioPlay>", spawn "mpc toggle")
, ("<XF86AudioPrev>", spawn "mpc prev")
, ("<XF86AudioNext>", spawn "mpc next")
, ("<XF86AudioMute>", spawn "amixer set Master toggle")
, ("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume \"bluez_output.E8_EE_CC_02_F6_8A.1\" -5%")
, ("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume \"bluez_output.E8_EE_CC_02_F6_8A.1\" +5%")
-- , ("<XF86HomePage>", addName "Open home page" $ spawn (myBrowser ++ " https://www.youtube.com/c/DistroTube"))
, ("<XF86Search>", spawn "dm-websearch")
, ("<XF86Mail>", runOrRaise "evolution" (resource =? "evolution"))
, ("<XF86Calculator>", runOrRaise "qalculate-gtk" (resource =? "qalculate-gtk"))
-- , ("<XF86Eject>", spawn "eject /dev/cdrom")
]
`additionalMouseBindings`
[ ((mod4Mask, button4), \w -> focus w >> prevWS)
, ((mod4Mask, button5), \w -> focus w >> nextWS)]