Compare commits

...

69 Commits
master ... wrk

Author SHA1 Message Date
Martin Potier 8b235d3a65
Changes 2023-11-03 17:13:33 +02:00
Martin Potier e4b903562b
Updates 2023-10-12 13:19:42 +03:00
Martin Potier eb9f84e65f
New project 2023-08-31 13:47:14 +03:00
Martin Potier 8b162c7c31
Add keybindings for numpad 2023-08-04 10:57:48 +03:00
Martin Potier 6070398070
Remove manual fuzzy matching, and use the dedicated module 2023-08-03 09:12:05 +03:00
Martin Potier db58691676
Rename isengard projects 2023-08-03 09:06:20 +03:00
Martin Potier 64cedbb27e
Use rescreen 2023-07-21 20:15:52 +03:00
Martin Potier 90d4dbb58e
Expand ~ manually 2023-06-21 12:21:59 +03:00
Martin Potier f8bd90fb48
Use the slack application 2023-05-29 14:00:52 +03:00
Martin Potier c70973d131
Add moria project 2023-05-26 12:42:11 +03:00
Martin Potier 5a9b9d09bd
Changes 2023-04-18 10:10:27 +03:00
Martin Potier a131b1bb1b move away from logseq 2023-04-02 10:56:26 +03:00
Martin Potier 5483cbda5e
Updates 2023-03-29 10:10:53 +03:00
Martin Potier 18e653b6f2
Updates 2023-03-29 10:10:20 +03:00
Martin Potier 735ec3214a
changes 2023-03-10 15:09:07 +02:00
Martin Potier baac904283
changes 2023-03-02 12:59:34 +02:00
Martin Potier 6694a0e07a
update project name 2023-01-23 10:02:12 +02:00
Martin Potier c830fce008
Fix path to mpc 2022-12-27 08:35:09 +02:00
Martin Potier 5a280ca7be
Configure changes in keybindings 2022-12-22 12:37:22 +02:00
Martin Potier 93c88791a1
Flakify xmonad 2022-12-07 14:58:01 +02:00
Martin Potier 7941767bc4
Fix flameshot path 2022-12-07 14:54:45 +02:00
Martin Potier b1c417b464
Changes 2022-09-15 16:23:00 +03:00
Martin Potier 049af82a9a
Spring cleanup 2022-04-08 12:43:00 +03:00
Martin Potier ae1da29574
Add new doTile function, force tile VPN client 2022-03-24 09:42:49 +02:00
Martin Potier 9b561492e8
Auto-start VPN on VPN project 2022-02-18 11:35:11 +02:00
Martin Potier 9cacbb2a0b
Move gpclient to its own project 2022-02-18 11:26:33 +02:00
Martin Potier 558f52c01b
Replacing obsidian with logseq 2022-02-16 09:19:11 +02:00
Martin Potier 767c37d492
More changes 2022-02-10 15:23:46 +02:00
Martin Potier 8d1c03a862
Switch to kitty 2021-12-15 12:38:09 +02:00
Martin Potier 29a3874b34
changes 2021-11-01 12:18:25 +02:00
Martin Potier 7f7fd27fd6
Move to emacs 2021-07-14 12:49:35 +03:00
Martin Potier 1b3f67199e
New project, limit passwords 2021-04-14 12:33:09 +03:00
Martin Potier 8cdfff9901
some changes 2021-04-06 09:29:14 +03:00
Martin Potier d9d0f13cbb
Add new project 2021-03-05 16:41:37 +02:00
Martin Potier 8914400110
Add right click stuff 2021-03-03 14:09:35 +02:00
Martin Potier 24581f06d0
New projects 2021-03-03 14:04:23 +02:00
Martin Potier d51ced34d5
Center floating window 2021-01-20 12:16:59 +02:00
Martin Potier 6f4d2c30c5
Add new work project 2021-01-20 12:14:51 +02:00
Martin Potier de4c5cc9c4
New projects 2021-01-18 12:36:50 +02:00
Martin Potier e1dfa4b269
Goodbye advent of code 2021-01-07 15:25:51 +02:00
Martin Potier 8bd5e58c8a
Add adventofcode 2020-12-18 12:53:30 +02:00
Martin Potier 24ec645a56
Add mordor-sudo 2020-12-01 12:14:53 +02:00
Martin Potier ebeb708303
Attempt to react to screen event 2020-11-23 16:01:13 +02:00
Martin Potier 05ca473721
Move to neuron 2020-11-23 16:00:47 +02:00
Martin Potier cf5baddf49
Some cleanup 2020-11-02 16:01:13 +02:00
Martin Potier a8b1a0d92d
Use nvidia opengl 2020-10-22 09:27:11 +03:00
Martin Potier 1ac9836718
Add stuff 2020-10-20 15:55:21 +03:00
Martin Potier b0cfdbe530
Disable titleBar
Make Xorg crazy… Maybe it's an nvidia thing
2020-10-19 09:16:17 +03:00
Martin Potier 3893cdb68e
Add window titles 2020-10-16 10:43:31 +03:00
Martin Potier 4fe78658cd
add new projects 2020-10-15 13:06:18 +03:00
Martin Potier 807734ba81
Fix paths, start patchage on sound 2020-09-28 16:24:06 +03:00
Martin Potier c7117f7e3e
Refactor for wrk 2020-09-25 12:13:26 +03:00
Martin Potier c604a4c006
Projects refactor 2020-07-22 10:24:04 +03:00
Martin Potier dd15ccfe6e
Cleanup projects 2020-06-05 10:48:19 +03:00
Martin Potier 9cc302cb98
Make use of git worktree, no duplication 2020-05-29 14:41:40 +03:00
Martin Potier 7bfe1c43bc
Cleanup terminated projects 2020-04-01 13:55:13 +03:00
Martin Potier 26b9fd7e68
More toplevel project helpers 2020-03-30 10:20:40 +03:00
Martin Potier a6f50829ae
New project, new status 2020-03-11 09:22:58 +02:00
Martin Potier 1f4e774ad7
New projects 2020-02-21 08:43:13 +02:00
Martin Potier ba75e65498
Update projects 2019-12-31 10:20:42 +02:00
Martin Potier c174503244
Rework projects declaration 2019-12-03 15:46:51 +02:00
Martin Potier 37631ed6a2
Update font name! 2019-12-03 15:45:19 +02:00
Martin Potier 5bf31dac93
Group Vim&St projects 2019-09-25 10:03:53 +03:00
Martin Potier c0dba2d167
Rename selectPassword to copyPassword 2019-09-25 10:03:38 +03:00
Martin Potier 1fba240b51
Support for widescreen 2019-09-25 10:03:08 +03:00
Martin Potier bc82caba10
New screen, new layout 2019-05-31 18:42:52 +03:00
Martin Potier 310dfd47eb Adding password manager for my own good 2019-05-16 09:03:35 +03:00
Martin Potier bdf505f52f Add some notes about getting password 2019-05-10 15:04:15 +03:00
Martin Potier c1c83e186e New layout logic 2019-04-17 17:31:38 +03:00
13 changed files with 388 additions and 98 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
.*.swp
artwork/
artwork
*.hi
*.o
prompt-history

43
flake.lock Normal file
View 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
View 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.x86_64-linux.default =
# Notice the reference to nixpkgs here.
with import nixpkgs { system = "x86_64-linux"; };
haskellPackages.callCabal2nix "xmonad-config" ./. {};
};
}

View File

@ -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 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
@ -77,20 +119,23 @@ promptConfig = def
, defaultText = ""
, fgColor = S.base02
, fgHLight = S.base03
, font = "xft:Iosevka Term:style=Regular:size=8"
, 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
View 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"

View File

@ -6,74 +6,123 @@ 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 "nvidia-offload" ["kitty","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 "kitty" [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
}
adminProject = spinTextEditorAndTerm "~/admin/"
candyProject = spinTextEditorAndTerm "~/candy/"
workProject = spinTextEditorAndTerm "~/relex/"
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"
, justStartWithName "notes" "obsidian"
, justStartWithName "VPN" "gpclient"
, spinChat "element"
, spinChat "signal"
, spinInTerm "k9s"
, spinInTermWithName "email" "neomutt"
, spinTextEditorAndTerm "~/." "xmonad" -- Dark magic!
, workProject "azure-kube-platform"
, workProject "azure-kube-platform-environments"
, workProject "calculation-node-playbook"
, workProject "communication-nix-101"
, workProject "communication-nix-102"
, workProject "communication-nix-103"
, workProject "cooper"
, workProject "customer-configs"
, workProject "customer-modules"
, workProject "docker-images"
, workProject "fangorn"
, workProject "gitlab-runners"
, workProject "infra-inventory"
, workProject "isengard"
, workProject "isengard-2"
, workProject "isengard-3"
, workProject "jirawiz"
, 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 "nvidia-offload" ["kitty","gotop"]
}
, 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 = [] }

View File

@ -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" "nvidia-offload kitty --title htop 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))

21
lib/ScreenEvents.hs Normal file
View File

@ -0,0 +1,21 @@
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 = spawn "/home/e/.fehbg"

View File

@ -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"

View File

@ -31,7 +31,7 @@ runXmobar :: ScreenId -> IO Handle
runXmobar (S id) = spawnPipe
$ "/run/current-system/sw/bin/xmobar --screen="
<> show id
<> " /home/eeva/.xmonad/xmobarrc"
<> " /home/e/.xmonad/xmobarrc"
killXmobar :: IO ()
-- killXmobar = spawn "/run/current-system/sw/bin/pkill xmobar"

15
shell.nix Normal file
View 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 ];
}

View File

@ -9,11 +9,20 @@ 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
-- Tidy modules
@ -21,46 +30,54 @@ 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"
, startupHook = spawnOnce "sh /home/e/.fehbg"
, terminal = "nvidia-offload kitty"
, normalBorderColor = S.base03
, focusedBorderColor = S.violet
, focusedBorderColor = S.green
, borderWidth = 5
}