Compare commits
75 commits
master
...
iusenixbtw
Author | SHA1 | Date | |
---|---|---|---|
675e9f4125 | |||
da67a6d08f | |||
ef916319ca | |||
9c445e801a | |||
103f14ad32 | |||
f0f726f3ab | |||
8b235d3a65 | |||
e4b903562b | |||
eb9f84e65f | |||
8b162c7c31 | |||
6070398070 | |||
db58691676 | |||
64cedbb27e | |||
90d4dbb58e | |||
f8bd90fb48 | |||
c70973d131 | |||
5a9b9d09bd | |||
a131b1bb1b | |||
5483cbda5e | |||
18e653b6f2 | |||
735ec3214a | |||
baac904283 | |||
6694a0e07a | |||
c830fce008 | |||
5a280ca7be | |||
93c88791a1 | |||
7941767bc4 | |||
b1c417b464 | |||
049af82a9a | |||
ae1da29574 | |||
9b561492e8 | |||
9cacbb2a0b | |||
558f52c01b | |||
767c37d492 | |||
8d1c03a862 | |||
29a3874b34 | |||
7f7fd27fd6 | |||
1b3f67199e | |||
8cdfff9901 | |||
d9d0f13cbb | |||
8914400110 | |||
24581f06d0 | |||
d51ced34d5 | |||
6f4d2c30c5 | |||
de4c5cc9c4 | |||
e1dfa4b269 | |||
8bd5e58c8a | |||
24ec645a56 | |||
ebeb708303 | |||
05ca473721 | |||
cf5baddf49 | |||
a8b1a0d92d | |||
1ac9836718 | |||
b0cfdbe530 | |||
3893cdb68e | |||
4fe78658cd | |||
807734ba81 | |||
c7117f7e3e | |||
c604a4c006 | |||
dd15ccfe6e | |||
9cc302cb98 | |||
7bfe1c43bc | |||
26b9fd7e68 | |||
a6f50829ae | |||
1f4e774ad7 | |||
ba75e65498 | |||
c174503244 | |||
37631ed6a2 | |||
5bf31dac93 | |||
c0dba2d167 | |||
1fba240b51 | |||
bc82caba10 | |||
310dfd47eb | |||
bdf505f52f | |||
|
c1c83e186e |
14 changed files with 491 additions and 174 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,8 +1,8 @@
|
|||
.*.swp
|
||||
artwork/
|
||||
artwork
|
||||
*.hi
|
||||
*.o
|
||||
prompt-history
|
||||
xmonad-x86_64-linux
|
||||
xmonad-*-linux
|
||||
xmonad.errors
|
||||
xmonad.state
|
||||
|
|
43
flake.lock
Normal file
43
flake.lock
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1670242877,
|
||||
"narHash": "sha256-jBLh7dRHnbfvPPA9znOC6oQfKrCPJ0El8Zoe0BqnCjQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6e51c97f1c849efdfd4f3b78a4870e6aa2da4198",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
19
flake.nix
Normal file
19
flake.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
description = "Build my xmonad config";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system}; in
|
||||
{
|
||||
devShells.default = import ./shell.nix { inherit pkgs; };
|
||||
}) // {
|
||||
packages.aarch64-linux.default =
|
||||
# Notice the reference to nixpkgs here.
|
||||
with import nixpkgs { system = "aarch64-linux"; };
|
||||
haskellPackages.callCabal2nix "xmonad-config" ./. {};
|
||||
};
|
||||
}
|
82
lib/Catppuccin.hs
Normal file
82
lib/Catppuccin.hs
Normal file
|
@ -0,0 +1,82 @@
|
|||
module Catppuccin
|
||||
( base
|
||||
, blue
|
||||
, crust
|
||||
, flamingo
|
||||
, green
|
||||
, lavender
|
||||
, mantle
|
||||
, maroon
|
||||
, mauve
|
||||
, overlay0
|
||||
, overlay1
|
||||
, overlay2
|
||||
, peach
|
||||
, pink
|
||||
, red
|
||||
, rosewater
|
||||
, sapphire
|
||||
, sky
|
||||
, subtext0
|
||||
, subtext1
|
||||
, surface0
|
||||
, surface1
|
||||
, surface2
|
||||
, teal
|
||||
, text
|
||||
, yellow
|
||||
, theme
|
||||
) where
|
||||
|
||||
import XMonad.Layout.Decoration (Theme(..))
|
||||
|
||||
theme :: Theme
|
||||
theme =
|
||||
Theme { activeColor = mauve
|
||||
, inactiveColor = surface0
|
||||
, urgentColor = red
|
||||
, activeBorderColor = mauve
|
||||
, inactiveBorderColor = surface0
|
||||
, urgentBorderColor = red
|
||||
, activeBorderWidth = 1
|
||||
, inactiveBorderWidth = 1
|
||||
, urgentBorderWidth = 1
|
||||
, activeTextColor = surface0
|
||||
, inactiveTextColor = surface1
|
||||
, urgentTextColor = red
|
||||
, fontName = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
|
||||
, decoWidth = 200
|
||||
, decoHeight = 15
|
||||
, windowTitleAddons = []
|
||||
, windowTitleIcons = []
|
||||
}
|
||||
|
||||
-- Colors for the Mocha variant
|
||||
-- https://raw.githubusercontent.com/catppuccin/palette/main/palette.json
|
||||
-- cat palette.json|jq -rc '.mocha.colors|map ({(.name):.hex})|.[]'
|
||||
base = "#1e1e2e"
|
||||
blue = "#89b4fa"
|
||||
crust = "#11111b"
|
||||
flamingo = "#f2cdcd"
|
||||
green = "#a6e3a1"
|
||||
lavender = "#b4befe"
|
||||
mantle = "#181825"
|
||||
maroon = "#eba0ac"
|
||||
mauve = "#cba6f7"
|
||||
overlay0 = "#6c7086"
|
||||
overlay1 = "#7f849c"
|
||||
overlay2 = "#9399b2"
|
||||
peach = "#fab387"
|
||||
pink = "#f5c2e7"
|
||||
red = "#f38ba8"
|
||||
rosewater = "#f5e0dc"
|
||||
sapphire = "#74c7ec"
|
||||
sky = "#89dceb"
|
||||
subtext0 = "#a6adc8"
|
||||
subtext1 = "#bac2de"
|
||||
surface0 = "#313244"
|
||||
surface1 = "#45475a"
|
||||
surface2 = "#585b70"
|
||||
teal = "#94e2d5"
|
||||
text = "#cdd6f4"
|
||||
yellow = "#f9e2af"
|
|
@ -4,12 +4,14 @@ module KeyBindings (
|
|||
) where
|
||||
|
||||
import Control.Monad (void)
|
||||
import Data.Foldable (forM_)
|
||||
import Data.List (sort, isSuffixOf)
|
||||
import Data.Maybe (isJust)
|
||||
import Graphics.X11.Types
|
||||
import System.Exit
|
||||
import Text.EditDistance
|
||||
-- import Text.EditDistance
|
||||
import XMonad
|
||||
import XMonad.Actions.CopyWindow (kill1,copy)
|
||||
import XMonad.Actions.CycleWS
|
||||
import XMonad.Actions.DynamicProjects
|
||||
import XMonad.Core
|
||||
|
@ -17,13 +19,21 @@ import XMonad.Layout.ToggleLayouts
|
|||
import XMonad.Operations
|
||||
import XMonad.Prompt
|
||||
import XMonad.Prompt.ConfirmPrompt
|
||||
import XMonad.Prompt.FuzzyMatch
|
||||
import XMonad.Prompt.Shell
|
||||
import XMonad.Prompt.Workspace (workspacePrompt)
|
||||
import XMonad.Util.EZConfig
|
||||
import XMonad.Util.NamedScratchpad
|
||||
import qualified Solarized as S
|
||||
import qualified Catppuccin as C
|
||||
import qualified Scratchpad as R
|
||||
import qualified XMonad.StackSet as W
|
||||
|
||||
-- Custom (in libs)
|
||||
import Password (passPrompt)
|
||||
|
||||
lockScreenCmd =
|
||||
spawn "/etc/profiles/per-user/e/bin/mpc pause; /run/current-system/sw/bin/xset s activate"
|
||||
|
||||
modify :: XConfig l -> XConfig l
|
||||
modify conf = conf
|
||||
{ modMask = mod4Mask -- Use the "Win" key for the mod key
|
||||
|
@ -31,12 +41,20 @@ modify conf = conf
|
|||
|
||||
`additionalKeysP` -- Add some extra key bindings:
|
||||
[ ("M-S-q", confirmPrompt promptConfig "exit" (io exitSuccess))
|
||||
, ("<XF86MonBrightnessDown>", spawn "/run/current-system/sw/bin/xbacklight -10")
|
||||
, ("<XF86MonBrightnessUp>", spawn "/run/current-system/sw/bin/xbacklight +10")
|
||||
, ("<XF86AudioPlay>", spawn "/run/current-system/sw/bin/mpc toggle")
|
||||
, ("<XF86AudioNext>", spawn "/run/current-system/sw/bin/mpc next")
|
||||
, ("<XF86AudioPrev>", spawn "/run/current-system/sw/bin/mpc prev")
|
||||
, ("M-<Delete>", kill)
|
||||
, ("<XF86MonBrightnessDown>", spawn "/run/current-system/sw/bin/light -U 10")
|
||||
, ("<XF86MonBrightnessUp>", spawn "/run/current-system/sw/bin/light -A 10")
|
||||
, ("<XF86AudioPlay>", spawn "/etc/profiles/per-user/e/bin/mpc toggle")
|
||||
, ("<XF86AudioNext>", spawn "/etc/profiles/per-user/e/bin/mpc next")
|
||||
, ("<XF86AudioPrev>", spawn "/etc/profiles/per-user/e/bin/mpc prev")
|
||||
-- KP_1 -> KP_6 macros
|
||||
, ("<XF86Tools>", viewProject "sound")
|
||||
, ("<XF86Launch5>", viewProject "frs")
|
||||
, ("<XF86Launch6>", viewProject "chat")
|
||||
, ("<XF86Launch7>", viewProject "isengard")
|
||||
, ("<XF86Launch8>", viewProject "moria")
|
||||
, ("<XF86Launch9>", viewProject "fre")
|
||||
-- KP_Delete
|
||||
, ("Cancel", lockScreenCmd)
|
||||
, ("M-<Down>", windows W.focusDown)
|
||||
, ("M-<Esc>", sendMessage (Toggle "Full"))
|
||||
, ("M-$", sendMessage (Toggle "Full"))
|
||||
|
@ -46,21 +64,45 @@ modify conf = conf
|
|||
, ("M-<Right>", nextWS)
|
||||
, ("M-<Tab>", toggleWS' ["NSP"])
|
||||
, ("M-<Up>", windows W.focusUp)
|
||||
, ("M-S-<Delete>", spawn "/run/current-system/sw/bin/mpc pause; /run/current-system/sw/bin/xset s activate")
|
||||
, ("M-S-<Delete>", lockScreenCmd)
|
||||
, ("M-S-<Left>", shiftToPrev >> prevWS)
|
||||
, ("M-S-<Right>", shiftToNext >> nextWS)
|
||||
, ("M-s s", spawn "/run/current-system/sw/bin/flameshot gui")
|
||||
, ("M-s s", spawn "/etc/profiles/per-user/e/bin/flameshot gui")
|
||||
, ("M-s t", spawn "/run/current-system/sw/bin/scrot /tmp/screen.png")
|
||||
-- Workspace and tasks
|
||||
, ("M-b", switchProjectPrompt promptConfig)
|
||||
, ("M-p c", withFocused centerWindow)
|
||||
, ("M-p m", shiftToProjectPrompt promptConfig)
|
||||
, ("M-p n", switchProjectPrompt promptConfig)
|
||||
, ("M-p r", renameProjectPrompt promptConfig)
|
||||
, ("M-p s", shellPrompt promptConfig)
|
||||
, ("M-d", passPrompt promptConfig)
|
||||
-- Scratchpads
|
||||
, ("M-p p", namedScratchpadAction R.pads "htop")
|
||||
-- Copy windows to workspaces
|
||||
, ("M-<Delete>", kill1)
|
||||
, ("M-c", workspacePrompt promptConfig (\name -> windows $ copy name))
|
||||
-- Mouse stuff
|
||||
, ("<F9>", spawn "find-cursor")
|
||||
-- , ("M-$ $", spawn "xdotool click 3")
|
||||
-- , ("M-$ M-$", spawn "xdotool click 3") -- helpfull to combine M + right click
|
||||
-- resizing the master/slave ratio
|
||||
, ("M-h", sendMessage Shrink) -- Shrink the master area
|
||||
, ("M-l", sendMessage Expand) -- Expand the master area
|
||||
-- dunstctl calls
|
||||
-- , ("C-<Space>", spawn "dunstctl close")
|
||||
, ("C-S-<Space>", spawn "dunstctl close-all")
|
||||
, ("M-n p", spawn "dunstctl set-paused toggle")
|
||||
]
|
||||
|
||||
|
||||
-- Borrowed from https://www.reddit.com/r/xmonad/comments/gzq316/how_can_i_centre_a_floating_window_without/fthtx29/
|
||||
centerWindow :: Window -> X ()
|
||||
centerWindow win = do
|
||||
(_, W.RationalRect x y w h) <- floatLocation win
|
||||
windows $ W.float win (W.RationalRect ((1 - w) / 2) ((1 - h) / 2) w h)
|
||||
return ()
|
||||
|
||||
viewProject :: WorkspaceId -> X ()
|
||||
viewProject id = do
|
||||
project <- lookupProject id
|
||||
|
@ -71,26 +113,29 @@ viewProject id = do
|
|||
promptConfig = def
|
||||
{ position = Bottom
|
||||
, alwaysHighlight = True
|
||||
, bgColor = S.magenta
|
||||
, bgHLight = S.base0
|
||||
, borderColor = S.magenta
|
||||
, bgColor = C.lavender
|
||||
, bgHLight = C.surface0
|
||||
, borderColor = C.lavender
|
||||
, defaultText = ""
|
||||
, fgColor = S.base02
|
||||
, fgHLight = S.base03
|
||||
, font = "xft:Iosevka Term:style=Regular:size=8"
|
||||
, fgColor = C.surface2
|
||||
, fgHLight = C.text
|
||||
, font = "xft:Iosevka Samae:style=Regular:size=10:charwidth=6.5"
|
||||
, height = 24
|
||||
, promptBorderWidth = 5
|
||||
-- Fuzzysearch by default
|
||||
, searchPredicate = fuzzyMatch
|
||||
, sorter = fuzzySort
|
||||
}
|
||||
|
||||
-- Slightly taken from
|
||||
-- https://mail.haskell.org/pipermail/xmonad/2010-October/010671.html
|
||||
data FuzzySpawn = FuzzySpawn deriving (Read, Show)
|
||||
instance XPrompt FuzzySpawn where showXPrompt _ = "RunC: "
|
||||
fuzzyPrompt config = do
|
||||
cmds <- io getCommands
|
||||
let compl s
|
||||
| null s = []
|
||||
| otherwise = let weight c = levenshteinDistance defaultEditCosts s c
|
||||
in map snd $ take 20 $ sort $ map (\c -> (weight c,c)) cmds
|
||||
mkXPrompt FuzzySpawn config (return . compl) spawn
|
||||
|
||||
-- -- Slightly taken from
|
||||
-- -- https://mail.haskell.org/pipermail/xmonad/2010-October/010671.html
|
||||
-- data FuzzySpawn = FuzzySpawn deriving (Read, Show)
|
||||
-- instance XPrompt FuzzySpawn where showXPrompt _ = "RunC: "
|
||||
-- fuzzyPrompt config = do
|
||||
-- cmds <- io getCommands
|
||||
-- let compl s
|
||||
-- | null s = []
|
||||
-- | otherwise = let weight c = levenshteinDistance defaultEditCosts s c
|
||||
-- in map snd $ take 20 $ sort $ map (\c -> (weight c,c)) cmds
|
||||
-- mkXPrompt FuzzySpawn config (return . compl) spawn
|
||||
--
|
||||
|
|
55
lib/Password.hs
Normal file
55
lib/Password.hs
Normal file
|
@ -0,0 +1,55 @@
|
|||
-- Initially from
|
||||
-- https://github.com/MasseR/xmonad-masser/blob/master/src/XMonad/Password.hs
|
||||
|
||||
module Password (passGeneratePrompt, passPrompt) where
|
||||
|
||||
import Control.Monad.Trans (liftIO)
|
||||
import Data.Function (on)
|
||||
import Data.List (foldl', scanl', sort, sortBy)
|
||||
import System.Directory (getHomeDirectory)
|
||||
import System.FilePath.Posix (dropExtension, takeExtension, (</>))
|
||||
import System.Posix.Env (getEnv)
|
||||
import XMonad.Core
|
||||
import XMonad.Prompt
|
||||
import XMonad.Util.Run (runProcessWithInput)
|
||||
|
||||
newtype Pass = Pass { passLabel :: String }
|
||||
|
||||
-- Rosetta code levenshtein
|
||||
levenshtein :: String -> String -> Int
|
||||
levenshtein s1 s2 = last $ foldl' transform [0..length s1] s2
|
||||
where
|
||||
transform [] _ = []
|
||||
transform ns@(n:ns1) c = scanl' calc (n+1) $ zip3 s1 ns ns1
|
||||
where
|
||||
calc z (c1, x, y) = minimum [y+1, z+1, x + (fromEnum (c1 /= c) * 2)]
|
||||
|
||||
instance XPrompt Pass where
|
||||
showXPrompt p = passLabel p <> ": "
|
||||
commandToComplete _ = id
|
||||
nextCompletion _ = getNextCompletion
|
||||
|
||||
passGeneratePrompt :: XPConfig -> X ()
|
||||
passGeneratePrompt _ = return () -- Not implemented
|
||||
|
||||
passPrompt :: XPConfig -> X ()
|
||||
passPrompt = mkPassPrompt "Select password" copyPassword
|
||||
|
||||
mkPassPrompt :: String -> (String -> X ()) -> XPConfig -> X ()
|
||||
mkPassPrompt label f conf = do
|
||||
-- I'm just sorting here, but could use some kind of fuzzy matching instead, but it requires a bit more effort
|
||||
passwords <- sort <$> liftIO getPasswords
|
||||
-- Other change, use infixof instead of prefixof
|
||||
mkXPrompt (Pass label) conf (\input -> pure (sortBy (compare `on` levenshtein input) . take 5 . filter (consumes input) $ passwords)) f
|
||||
where
|
||||
consumes [] _ = True -- everything consumed
|
||||
consumes (_:_) [] = False -- all not consumed
|
||||
consumes (a:xs) (a':ys) | a == a' = consumes xs ys
|
||||
| otherwise = consumes (a:xs) ys
|
||||
getPasswords = do
|
||||
passwordStoreDir <- (</> "pass") <$> getHomeDirectory
|
||||
files <- runProcessWithInput "find" [ passwordStoreDir, "-type", "f", "-name", "*.gpg", "-printf", "%p\n"] []
|
||||
return . lines $ files
|
||||
|
||||
copyPassword :: String -> X ()
|
||||
copyPassword pass = spawn $ "gpg --decrypt " ++ pass ++ " | copy"
|
177
lib/Projects.hs
177
lib/Projects.hs
|
@ -6,74 +6,135 @@ import XMonad
|
|||
import XMonad.Actions.DynamicProjects
|
||||
import XMonad.Util.Run
|
||||
|
||||
spinTextEditorAndTerm :: String -> String -> Project
|
||||
spinTextEditorAndTerm dir name =
|
||||
Project { projectName = name
|
||||
, projectDirectory = dir <> name
|
||||
, projectStartHook = Just
|
||||
$ safeSpawn "rio" ["-e","tmux","new","-A","-s",name]
|
||||
}
|
||||
|
||||
spinChat :: String -> Project
|
||||
spinChat name =
|
||||
Project { projectName = name
|
||||
, projectDirectory = "/tmp"
|
||||
, projectStartHook = Just $ do safeSpawnProg (name <> "-desktop")
|
||||
}
|
||||
|
||||
spinInTermWithName :: String -> String -> Project
|
||||
spinInTermWithName projectName cmd =
|
||||
Project { projectName = projectName
|
||||
, projectDirectory = "/tmp"
|
||||
, projectStartHook = Just $ do safeSpawn "rio" ["-e",cmd]
|
||||
}
|
||||
|
||||
spinInTerm :: String -> Project
|
||||
spinInTerm name = spinInTermWithName name name
|
||||
|
||||
justStart :: String -> Project
|
||||
justStart name = justStartWithName name name
|
||||
|
||||
justStartWithName :: String -> String -> Project
|
||||
justStartWithName name pgm =
|
||||
Project { projectName = name
|
||||
, projectDirectory = "/tmp"
|
||||
, projectStartHook = Just $ do safeSpawnProg pgm
|
||||
}
|
||||
|
||||
spinNotes :: Project
|
||||
spinNotes =
|
||||
Project { projectName = "notes"
|
||||
, projectDirectory = "~/zk/org-roam/"
|
||||
, projectStartHook = Just $ do safeSpawn "emacs" ["~/zk/org-roam/20240202124747-index.org"]
|
||||
}
|
||||
|
||||
adminProject = spinTextEditorAndTerm "~/admin/"
|
||||
candyProject = spinTextEditorAndTerm "~/candy/"
|
||||
workProject = spinTextEditorAndTerm "~/relex/"
|
||||
workAnsibleProject = spinTextEditorAndTerm "~/relex/ansible-roles/"
|
||||
|
||||
projects :: [Project]
|
||||
projects = [ Project { projectName = "admin"
|
||||
, projectDirectory = "~/admin"
|
||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
||||
safeSpawnProg "st"
|
||||
}
|
||||
, Project { projectName = "mordor"
|
||||
, projectDirectory = "~/mordor"
|
||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
||||
safeSpawnProg "st"
|
||||
}
|
||||
, Project { projectName = "mordor-docs"
|
||||
, projectDirectory = "~/mordor-2"
|
||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
||||
safeSpawnProg "st"
|
||||
}
|
||||
, Project { projectName = "mordor-other"
|
||||
, projectDirectory = "~/mordor-3"
|
||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
||||
safeSpawnProg "st"
|
||||
}
|
||||
, Project { projectName = "email"
|
||||
, projectDirectory = "~/mail"
|
||||
, projectStartHook = Just $ do safeSpawnProg "st"
|
||||
}
|
||||
, Project { projectName = "frs"
|
||||
projects = [ adminProject "wrk-config"
|
||||
, adminProject "cdc-config"
|
||||
, adminProject "overlays-personal"
|
||||
, candyProject "adventofcode"
|
||||
, candyProject "dhall-packages"
|
||||
, candyProject "hfdb"
|
||||
, justStartWithName "fre" "ff-perso"
|
||||
, justStartWithName "frs" "ff-relex"
|
||||
, justStartWithName "chat" "slack"
|
||||
, justStartWithName "meet" "chromium"
|
||||
, spinNotes
|
||||
, spinInTermWithName "VPN" "vpn-run"
|
||||
, spinChat "element"
|
||||
, spinChat "signal"
|
||||
, spinInTerm "k9s"
|
||||
, spinInTermWithName "email" "neomutt"
|
||||
, spinTextEditorAndTerm "~/." "xmonad" -- Dark magic!
|
||||
, workProject "azure-kube-platform"
|
||||
, workProject "azure-kube-platform-environments"
|
||||
, workProject "azure-management"
|
||||
, workProject "calculation-node-playbook"
|
||||
, workProject "communication-nix-101"
|
||||
, workProject "communication-nix-102"
|
||||
, workProject "communication-nix-103"
|
||||
, workProject "cooper"
|
||||
, workProject "crebain"
|
||||
, workProject "customer-configs"
|
||||
, workProject "customer-modules"
|
||||
, workProject "docker-images"
|
||||
, workProject "fangorn"
|
||||
, workProject "gitlab-runners"
|
||||
, workProject "gitlab-self-manage"
|
||||
, workProject "infra-inventory"
|
||||
, workProject "isengard"
|
||||
, workProject "isengard-2"
|
||||
, workProject "isengard-3"
|
||||
, workProject "jirawiz"
|
||||
, workAnsibleProject "java"
|
||||
, workProject "morannon"
|
||||
, workProject "mordor-ca"
|
||||
, workProject "mordor-deploy"
|
||||
, workProject "mordor-interview"
|
||||
, workProject "mordor-nixpkgs"
|
||||
, workProject "mordor-ops"
|
||||
, workProject "mordor-the-repo"
|
||||
, workProject "mordorbooks"
|
||||
, workProject "moria"
|
||||
, workProject "muir"
|
||||
, workProject "nix"
|
||||
, workProject "nix-ansible-role"
|
||||
, workProject "nixos-modules"
|
||||
, workProject "nixpkgs"
|
||||
, workProject "one-off-scripts"
|
||||
, workProject "pck-access"
|
||||
, workProject "planning-cloud"
|
||||
, workProject "rfcs"
|
||||
, workProject "runner-tests"
|
||||
, workProject "slog-agent"
|
||||
, workProject "sm-terraform"
|
||||
, workProject "tech-radar"
|
||||
, workProject "time-tracking"
|
||||
, workProject "ugluk-ansible-role"
|
||||
, workProject "unified-application-gateway"
|
||||
, Project { projectName = "minecraft"
|
||||
, projectDirectory = "/tmp"
|
||||
, projectStartHook = Just $ do safeSpawnProg "frs"
|
||||
, projectStartHook = Just $ do safeSpawnProg "minecraft-launcher"
|
||||
safeSpawnProg "mumble"
|
||||
}
|
||||
, Project { projectName = "fre"
|
||||
, Project { projectName = "status"
|
||||
, projectDirectory = "/tmp"
|
||||
, projectStartHook = Just $ do safeSpawnProg "fre"
|
||||
}
|
||||
, Project { projectName = "network-graph"
|
||||
, projectDirectory = "~/relex/catch-a-network-bug/csvplotter"
|
||||
, projectStartHook = Just $ do safeSpawn "zathura" ["weekXGraph.pdf"]
|
||||
safeSpawnProg "st"
|
||||
}
|
||||
, Project { projectName = "orc"
|
||||
, projectDirectory = "/tmp"
|
||||
, projectStartHook = Just $ do safeSpawnProg "st"
|
||||
}
|
||||
, Project { projectName = "mordor-ops"
|
||||
, projectDirectory = "~/relex/mordor-ops"
|
||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
||||
safeSpawnProg "st"
|
||||
}
|
||||
, Project { projectName = "mordor-deploy"
|
||||
, projectDirectory = "~/relex/mordor-deploy"
|
||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
||||
safeSpawnProg "st"
|
||||
}
|
||||
, Project { projectName = "scaleout-ops"
|
||||
, projectDirectory = "~/relex/scaleout-ops"
|
||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
||||
safeSpawnProg "st"
|
||||
, projectStartHook = Just $ do
|
||||
safeSpawn "rio" ["-e","btop"]
|
||||
}
|
||||
, Project { projectName = "sound"
|
||||
, projectDirectory = "/tmp"
|
||||
, projectStartHook = Just $ do safeSpawnProg "pavucontrol"
|
||||
}
|
||||
, Project { projectName = "daily"
|
||||
, projectDirectory = "/tmp"
|
||||
, projectStartHook = Just $ do safeSpawn "nix" ["run", "nixpkgs.chromium", "-c", "chromium"]
|
||||
, projectStartHook = Just $ do
|
||||
safeSpawn "pw-jack" ["patchage"]
|
||||
safeSpawnProg "easyeffects"
|
||||
}
|
||||
]
|
||||
|
||||
modify :: XConfig l -> XConfig l
|
||||
modify conf = dynamicProjects projects conf
|
||||
{ workspaces = [] }
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ import qualified XMonad.StackSet as W
|
|||
|
||||
modify :: XConfig l -> XConfig l
|
||||
modify conf = conf
|
||||
{ manageHook = namedScratchpadManageHook pads
|
||||
{ manageHook = manageHook conf <> namedScratchpadManageHook pads
|
||||
}
|
||||
|
||||
pads =
|
||||
[ NS "htop" "/run/current-system/sw/bin/st -t htop -e tmux" (title =? "htop")
|
||||
[ NS "htop" "rio -e tmux" (title =? "htop")
|
||||
(customFloating $ W.RationalRect (1/3) (1/3) (1/3) (1/3))
|
||||
-- , NS "stardict" "stardict" (className =? "Stardict")
|
||||
-- (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))
|
||||
|
|
22
lib/ScreenEvents.hs
Normal file
22
lib/ScreenEvents.hs
Normal file
|
@ -0,0 +1,22 @@
|
|||
module ScreenEvents (
|
||||
ScreenEvents.modify
|
||||
) where
|
||||
|
||||
import XMonad
|
||||
import Data.Monoid (All(..))
|
||||
import XMonad.Hooks.Rescreen
|
||||
|
||||
-- screenChangeHandler :: Event -> X All
|
||||
-- screenChangeHandler (RRScreenChangeNotifyEvent _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) = do
|
||||
-- spawn "touch /tmp/xmonad-WAAAAAT"
|
||||
-- spawn "/home/e/.fehbg"
|
||||
-- return (All True)
|
||||
-- screenChangeHandler _ = return (All True)
|
||||
|
||||
modify :: XConfig l -> XConfig l
|
||||
modify = addAfterRescreenHook afterRescreen
|
||||
|
||||
afterRescreen :: X ()
|
||||
afterRescreen = do
|
||||
spawn "xrandr --dpi 96"
|
||||
spawn "/home/e/.fehbg"
|
|
@ -20,8 +20,33 @@ module Solarized
|
|||
, foreground
|
||||
, foregroundhl
|
||||
, foregroundll
|
||||
, theme
|
||||
) where
|
||||
|
||||
import XMonad.Layout.Decoration (Theme(..))
|
||||
|
||||
theme :: Theme
|
||||
theme =
|
||||
Theme { activeColor = violet
|
||||
, inactiveColor = base03
|
||||
, urgentColor = red
|
||||
, activeBorderColor = violet
|
||||
, inactiveBorderColor = base03
|
||||
, urgentBorderColor = red
|
||||
, activeBorderWidth = 1
|
||||
, inactiveBorderWidth = 1
|
||||
, urgentBorderWidth = 1
|
||||
, activeTextColor = base03
|
||||
, inactiveTextColor = base02
|
||||
, urgentTextColor = red
|
||||
, fontName = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
|
||||
, decoWidth = 200
|
||||
, decoHeight = 15
|
||||
, windowTitleAddons = []
|
||||
, windowTitleIcons = []
|
||||
}
|
||||
|
||||
|
||||
base03 = "#002b36"
|
||||
base02 = "#073642"
|
||||
base01 = "#586e75"
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
{-# LANGUAGE FlexibleContexts #-}
|
||||
|
||||
module StatusBar (
|
||||
StatusBar.modify
|
||||
) where
|
||||
|
||||
import Data.List
|
||||
import Data.Monoid
|
||||
import Solarized as S
|
||||
import XMonad.Core
|
||||
import XMonad.Hooks.DynamicBars (dynStatusBarStartup,dynStatusBarEventHook,multiPP)
|
||||
import XMonad.Hooks.DynamicLog
|
||||
import XMonad.ManageHook
|
||||
import XMonad.Util.Run
|
||||
|
||||
-- Type constructors
|
||||
import GHC.IO.Handle (Handle)
|
||||
|
||||
modify :: XConfig l -> XConfig l
|
||||
modify conf = conf
|
||||
{ startupHook = do
|
||||
startupHook conf
|
||||
dynStatusBarStartup runXmobar killXmobar
|
||||
, handleEventHook = handleEventHook conf <+> dynStatusBarEventHook runXmobar killXmobar
|
||||
, logHook = do
|
||||
logHook conf
|
||||
multiPP currentPP otherPP
|
||||
}
|
||||
|
||||
runXmobar :: ScreenId -> IO Handle
|
||||
runXmobar (S id) = spawnPipe
|
||||
$ "/run/current-system/sw/bin/xmobar --screen="
|
||||
<> show id
|
||||
<> " /home/eeva/.xmonad/xmobarrc"
|
||||
|
||||
killXmobar :: IO ()
|
||||
-- killXmobar = spawn "/run/current-system/sw/bin/pkill xmobar"
|
||||
killXmobar = return ()
|
||||
|
||||
otherPP = currentPP
|
||||
{ ppCurrent = xmobarColor S.foreground S.background
|
||||
, ppVisible = xmobarColor S.foreground S.background
|
||||
, ppHidden = xmobarColor S.foreground S.background
|
||||
, ppHiddenNoWindows = xmobarColor S.backgroundhl S.background
|
||||
}
|
||||
|
||||
currentPP = def
|
||||
{ ppCurrent = xmobarColor' S.orange
|
||||
, ppVisible = xmobarColor' S.yellow -- other screen
|
||||
, ppHidden = xmobarColor' S.foreground -- other workspaces with windows
|
||||
, ppHiddenNoWindows = xmobarColor' S.foregroundll -- other workspaces
|
||||
, ppSep = " "
|
||||
, ppWsSep = " "
|
||||
, ppLayout = printLayout
|
||||
, ppTitle = printTitle
|
||||
}
|
||||
where xmobarColor' fg = xmobarColor fg S.base03
|
||||
|
||||
printLayout s | "Mirror ResizableTall" `isSuffixOf` s = "[ — ]"
|
||||
printLayout s | "ResizableTall" `isSuffixOf` s = "[ | ]"
|
||||
printLayout "Full" = "[ F ]"
|
||||
printLayout l = "[" ++ l ++ "]"
|
||||
|
||||
printTitle t = let t' = shorten 120 t
|
||||
in xmobarColor' S.foregroundll "« "
|
||||
++ xmobarColor' S.foregroundhl t'
|
||||
++ xmobarColor' S.foregroundll " »"
|
||||
|
||||
|
15
shell.nix
Normal file
15
shell.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ pkgs }:
|
||||
let
|
||||
inherit (pkgs) callPackage fetchFromGitHub mkShell;
|
||||
easy-hls-src = fetchFromGitHub {
|
||||
owner = "jkachmar";
|
||||
repo = "easy-hls-nix";
|
||||
rev = "291cf77f512a7121bb6801cde35ee1e8b7287f91";
|
||||
sha256 = "1bvbcp9zwmh53sm16ycp8phhc6vzc72a71sf0bvyjgfbn6zp68bc";
|
||||
};
|
||||
easy-hls = callPackage easy-hls-src {};
|
||||
in
|
||||
|
||||
mkShell {
|
||||
buildInputs = [ easy-hls ];
|
||||
}
|
48
xmonad.hs
48
xmonad.hs
|
@ -9,58 +9,76 @@ import XMonad.Actions.DynamicProjects
|
|||
import XMonad.Config.Desktop
|
||||
import XMonad.Hooks.DynamicLog
|
||||
import XMonad.Hooks.ManageHelpers
|
||||
|
||||
import XMonad.Layout.NoBorders (noBorders, smartBorders)
|
||||
import XMonad.Layout.NoFrillsDecoration
|
||||
import XMonad.Layout.PerScreen
|
||||
import XMonad.Layout.Reflect
|
||||
import XMonad.Layout.ResizableTile (ResizableTall(..))
|
||||
import XMonad.Layout.Spacing
|
||||
import XMonad.Layout.ThreeColumns (ThreeCol(..))
|
||||
import XMonad.Layout.ToggleLayouts (toggleLayouts)
|
||||
|
||||
import XMonad.StackSet (sink)
|
||||
|
||||
import XMonad.Util.EZConfig
|
||||
import XMonad.Util.SpawnOnce
|
||||
import qualified Solarized as S
|
||||
import qualified Catppuccin as C
|
||||
|
||||
-- Tidy modules
|
||||
import KeyBindings as Keys (modify)
|
||||
import MouseBindings as Mouse (modify)
|
||||
import Projects (modify)
|
||||
import Scratchpad (modify)
|
||||
import ScreenEvents (modify)
|
||||
|
||||
--------- toggle btw vvvvvvvvvv or vvvvv
|
||||
-------------------- toggle btw vvvvvvvvvv or vvvvv
|
||||
--layouts = titleBar $ toggleLayouts fullscreen tiled
|
||||
layouts = toggleLayouts fullscreen tiled
|
||||
where
|
||||
fullscreen = (noBorders Full)
|
||||
tiled = smarts $ resizableTall ||| (Mirror resizableTall)
|
||||
tiled = smarts $ ifWider (1920 + 1) wideScreen normalScreen
|
||||
wideScreen = ThreeColMid 1 (5/100) (1/2)
|
||||
normalScreen = ResizableTall 1 (5/100) (1/2) []
|
||||
smarts = (smartSpacingWithEdge 5) . smartBorders
|
||||
resizableTall = ResizableTall 1 (5/100) (1/2) []
|
||||
--titleBar = noFrillsDeco shrinkText S.theme
|
||||
|
||||
-- Use the `xprop' tool to get the info you need for these matches.
|
||||
-- For className, use the second value that xprop gives you.
|
||||
-------------- Here be the law of windows
|
||||
myManageHook = composeOne
|
||||
[ className =? "Pavucontrol" -?> doShift "music"
|
||||
[ className =? "Gcr-prompter" -?> doCenterFloat
|
||||
, className =? "Pavucontrol" -?> doShift "music"
|
||||
, className =? "Pinentry" -?> doFloat
|
||||
, className =? "Steam" -?> doShift "steam"
|
||||
, className =? "VirtualBox" -?> doFloat
|
||||
, className =? "csgo_linux64" -?> doShift "csgo"
|
||||
, className =? "gpclient" -?> doTile <+> (doShift "VPN")
|
||||
, className =? "mpv" -?> doFullFloat <+> (doShift "flims")
|
||||
, className =? "qemu-system-x86_64" -?> doFloat
|
||||
, className =? "qutebrowser" -?> doShift "web"
|
||||
, isDialog -?> doCenterFloat
|
||||
, isDialog -?> doCenterFloat
|
||||
|
||||
-- Move transient windows to their parent:
|
||||
, transience
|
||||
]
|
||||
|
||||
doTile :: ManageHook
|
||||
doTile = ask >>= doF . sink
|
||||
|
||||
------------ build the full config
|
||||
withConfig =
|
||||
Projects.modify -- Apply projects config
|
||||
$ Keys.modify -- Apply keybindings config
|
||||
$ Mouse.modify -- Apply mouse bindings config
|
||||
$ Scratchpad.modify -- Apply scratchpad managehook config
|
||||
$ desktopConfig -- on a default desktop config
|
||||
Projects.modify -- Apply projects config
|
||||
$ Keys.modify -- Apply keybindings config
|
||||
$ Mouse.modify -- Apply mouse bindings config
|
||||
$ Scratchpad.modify -- Apply scratchpad managehook config
|
||||
$ ScreenEvents.modify -- Apply screen event hook config
|
||||
$ desktopConfig -- on a default desktop config
|
||||
{ manageHook = myManageHook <+> manageHook desktopConfig
|
||||
, layoutHook = desktopLayoutModifiers layouts
|
||||
, terminal = "/run/current-system/sw/bin/st"
|
||||
, normalBorderColor = S.base03
|
||||
, focusedBorderColor = S.violet
|
||||
, startupHook = spawnOnce "sh /home/e/.fehbg"
|
||||
, terminal = "rio"
|
||||
, normalBorderColor = C.surface0
|
||||
, focusedBorderColor = C.mauve
|
||||
, borderWidth = 5
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue