Compare commits
62 commits
iusenixbtw
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
8fe9b3bb4d | ||
|
91926d5975 | ||
|
2d0db0063a | ||
|
1f14f27da7 | ||
|
0b4d60b948 | ||
|
7dbaaaf3d2 | ||
|
4701c62ce3 | ||
|
f1a42476a2 | ||
|
2aafb06e25 | ||
|
57782266e2 | ||
|
591521b585 | ||
|
b9bd40efbe | ||
|
1d76815c13 | ||
|
d30047585b | ||
|
6335946eeb | ||
|
2de387233c | ||
|
4393aafc87 | ||
|
ea3951d543 | ||
|
e660118219 | ||
|
964e01a3fa | ||
|
1eaae43e46 | ||
|
a2faa356ab | ||
|
37c58fbd2c | ||
|
11fb80639d | ||
|
96fcfeee3f | ||
|
33ae468829 | ||
|
a39a26509e | ||
|
fe08cd4141 | ||
|
381753c2a0 | ||
|
a9cf599139 | ||
|
1d3c55f3e9 | ||
|
e206492ae9 | ||
|
9fd4e4c1a5 | ||
|
2cf1863ef3 | ||
|
b6b5e0d467 | ||
|
c2aca9ce98 | ||
|
b04bc2b679 | ||
|
f990027814 | ||
|
c768c1ac7c | ||
|
412957c518 | ||
|
368de76deb | ||
|
3a5d170fe9 | ||
|
1cc3ddd9f3 | ||
|
e383427104 | ||
|
281accb59c | ||
|
257b473ae1 | ||
|
77a9fd5c11 | ||
|
c5b4569491 | ||
|
e8a3d89468 | ||
|
cc119c89d5 | ||
|
34ebd77a58 | ||
|
c578bf77d2 | ||
|
037d8df111 | ||
|
c2226d9e19 | ||
|
3d82dd30c7 | ||
afacb0eac5 | |||
1600ae6e77 | |||
|
b5b91cdd8d | ||
|
82ae92f620 | ||
|
02ef1ead52 | ||
|
a3c2e1680d | ||
|
c41263a44e |
16 changed files with 517 additions and 123 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -2,7 +2,10 @@
|
||||||
artwork/
|
artwork/
|
||||||
*.hi
|
*.hi
|
||||||
*.o
|
*.o
|
||||||
|
.direnv/
|
||||||
prompt-history
|
prompt-history
|
||||||
xmonad-x86_64-linux
|
xmonad-x86_64-linux
|
||||||
xmonad.errors
|
xmonad.errors
|
||||||
xmonad.state
|
xmonad.state
|
||||||
|
dist-newstyle
|
||||||
|
result*
|
||||||
|
|
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Revision history for xmonad-config
|
||||||
|
|
||||||
|
## 0.1.0.0 -- YYYY-mm-dd
|
||||||
|
|
||||||
|
* First version. Released on an unsuspecting world.
|
2
Setup.hs
Normal file
2
Setup.hs
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
import Distribution.Simple
|
||||||
|
main = defaultMain
|
27
flake.lock
Normal file
27
flake.lock
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1725983898,
|
||||||
|
"narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
57
flake.nix
Normal file
57
flake.nix
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
description = "Build my xmonad config";
|
||||||
|
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
}: let
|
||||||
|
forAllSystems = function:
|
||||||
|
nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-linux"] (system:
|
||||||
|
function rec {
|
||||||
|
inherit system;
|
||||||
|
compilerVersion = "ghc966";
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
hsPkgs = pkgs.haskell.packages.${compilerVersion}.override {
|
||||||
|
overrides = hfinal: hprev: {
|
||||||
|
# Internal Packages
|
||||||
|
xmonad-config = hfinal.callCabal2nix "xmonad-config" ./. {};
|
||||||
|
xmonad-contrib = pkgs.haskell.lib.compose.doJailbreak (pkgs.haskell.lib.compose.overrideCabal (drv: {
|
||||||
|
version = "0.18.1";
|
||||||
|
sha256 = "sha256-BXOdIErNhNNS3slNBhiskH/zljVREjx0fu836BOGZDI=";
|
||||||
|
})
|
||||||
|
hprev.xmonad-contrib);
|
||||||
|
xmonad-extras = pkgs.haskell.lib.compose.doJailbreak (pkgs.haskell.lib.compose.overrideCabal (drv: {
|
||||||
|
version = "0.17.2";
|
||||||
|
sha256 = "sha256-KAqC6sDbvd79lhyByfbA0cYwSINJ+JkivsieUE2rm2U=";
|
||||||
|
})
|
||||||
|
hprev.xmonad-extras);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
formatter = forAllSystems ({pkgs, ...}: pkgs.alejandra);
|
||||||
|
packages = forAllSystems ({hsPkgs, ...}: ({
|
||||||
|
default = hsPkgs.xmonad-config;
|
||||||
|
}));
|
||||||
|
devShells = forAllSystems ({
|
||||||
|
hsPkgs,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
default = hsPkgs.shellFor {
|
||||||
|
name = "xmonad-config";
|
||||||
|
packages = p: [
|
||||||
|
p.xmonad-config
|
||||||
|
];
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
hsPkgs.haskell-language-server
|
||||||
|
hsPkgs.cabal-install
|
||||||
|
cabal2nix
|
||||||
|
haskellPackages.ghcid
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
|
@ -4,11 +4,12 @@ module KeyBindings (
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
|
import Data.Foldable (forM_)
|
||||||
import Data.List (sort, isSuffixOf)
|
import Data.List (sort, isSuffixOf)
|
||||||
import Data.Maybe (isJust)
|
import Data.Maybe (isJust)
|
||||||
import Graphics.X11.Types
|
import Graphics.X11.Types
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import Text.EditDistance
|
-- import Text.EditDistance
|
||||||
import XMonad
|
import XMonad
|
||||||
import XMonad.Actions.CycleWS
|
import XMonad.Actions.CycleWS
|
||||||
import XMonad.Actions.DynamicProjects
|
import XMonad.Actions.DynamicProjects
|
||||||
|
@ -17,13 +18,18 @@ import XMonad.Layout.ToggleLayouts
|
||||||
import XMonad.Operations
|
import XMonad.Operations
|
||||||
import XMonad.Prompt
|
import XMonad.Prompt
|
||||||
import XMonad.Prompt.ConfirmPrompt
|
import XMonad.Prompt.ConfirmPrompt
|
||||||
|
import XMonad.Prompt.FuzzyMatch
|
||||||
import XMonad.Prompt.Shell
|
import XMonad.Prompt.Shell
|
||||||
import XMonad.Util.EZConfig
|
import XMonad.Util.EZConfig
|
||||||
import XMonad.Util.NamedScratchpad
|
import XMonad.Util.NamedScratchpad
|
||||||
import qualified Solarized as S
|
import qualified Nord as N
|
||||||
import qualified Scratchpad as R
|
import qualified Scratchpad as R
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
|
|
||||||
|
|
||||||
|
-- Custom (in libs)
|
||||||
|
import Password (passPrompt)
|
||||||
|
|
||||||
modify :: XConfig l -> XConfig l
|
modify :: XConfig l -> XConfig l
|
||||||
modify conf = conf
|
modify conf = conf
|
||||||
{ modMask = mod4Mask -- Use the "Win" key for the mod key
|
{ modMask = mod4Mask -- Use the "Win" key for the mod key
|
||||||
|
@ -49,7 +55,7 @@ modify conf = conf
|
||||||
, ("M-S-<Delete>", spawn "/run/current-system/sw/bin/mpc pause; /run/current-system/sw/bin/xset s activate")
|
, ("M-S-<Delete>", spawn "/run/current-system/sw/bin/mpc pause; /run/current-system/sw/bin/xset s activate")
|
||||||
, ("M-S-<Left>", shiftToPrev >> prevWS)
|
, ("M-S-<Left>", shiftToPrev >> prevWS)
|
||||||
, ("M-S-<Right>", shiftToNext >> nextWS)
|
, ("M-S-<Right>", shiftToNext >> nextWS)
|
||||||
, ("M-s s", spawn "/run/current-system/sw/bin/flameshot gui")
|
, ("M-s s", spawn "flameshot gui")
|
||||||
, ("M-s t", spawn "/run/current-system/sw/bin/scrot /tmp/screen.png")
|
, ("M-s t", spawn "/run/current-system/sw/bin/scrot /tmp/screen.png")
|
||||||
-- Workspace and tasks
|
-- Workspace and tasks
|
||||||
, ("M-b", switchProjectPrompt promptConfig)
|
, ("M-b", switchProjectPrompt promptConfig)
|
||||||
|
@ -57,40 +63,57 @@ modify conf = conf
|
||||||
, ("M-p n", switchProjectPrompt promptConfig)
|
, ("M-p n", switchProjectPrompt promptConfig)
|
||||||
, ("M-p r", renameProjectPrompt promptConfig)
|
, ("M-p r", renameProjectPrompt promptConfig)
|
||||||
, ("M-p s", shellPrompt promptConfig)
|
, ("M-p s", shellPrompt promptConfig)
|
||||||
|
, ("M-p c", withFocused centerWindow)
|
||||||
|
, ("M-d", passPrompt promptConfig)
|
||||||
-- Scratchpads
|
-- Scratchpads
|
||||||
, ("M-p p", namedScratchpadAction R.pads "htop")
|
, ("M-p p", namedScratchpadAction R.pads "htop")
|
||||||
|
-- Dunst
|
||||||
|
, ("C-<Space>", spawn "dunstctl close")
|
||||||
|
, ("C-S-<Space>", spawn "dunstctl close-all")
|
||||||
|
, ("M-n p", spawn "dunstctl set-paused toggle")
|
||||||
]
|
]
|
||||||
|
|
||||||
viewProject :: WorkspaceId -> X ()
|
viewProject :: WorkspaceId -> X ()
|
||||||
viewProject id = do
|
viewProject id = do
|
||||||
project <- lookupProject id
|
project <- lookupProject id
|
||||||
case project of
|
forM_ project switchProject
|
||||||
Just p -> switchProject p
|
|
||||||
Nothing -> return ()
|
-- 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 ()
|
||||||
|
|
||||||
promptConfig = def
|
promptConfig = def
|
||||||
{ position = Bottom
|
{ position = Bottom
|
||||||
, alwaysHighlight = True
|
, alwaysHighlight = True
|
||||||
, bgColor = S.magenta
|
, borderColor = N.nord9
|
||||||
, bgHLight = S.base0
|
-- Normal
|
||||||
, borderColor = S.magenta
|
, bgColor = N.nord9
|
||||||
|
, fgColor = N.background
|
||||||
|
-- Selection
|
||||||
|
, bgHLight = N.nord6
|
||||||
|
, fgHLight = N.background
|
||||||
|
--
|
||||||
, defaultText = ""
|
, defaultText = ""
|
||||||
, fgColor = S.base02
|
, font = "xft:Iosevka Samae:style=Regular:size=8:charwidth=5"
|
||||||
, fgHLight = S.base03
|
|
||||||
, font = "xft:Iosevka Term:style=Regular:size=8"
|
|
||||||
, height = 24
|
, height = 24
|
||||||
, promptBorderWidth = 5
|
, promptBorderWidth = 5
|
||||||
|
-- Fuzzysearch by default
|
||||||
|
, searchPredicate = fuzzyMatch
|
||||||
|
, sorter = fuzzySort
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Slightly taken from
|
-- -- Slightly taken from
|
||||||
-- https://mail.haskell.org/pipermail/xmonad/2010-October/010671.html
|
-- -- https://mail.haskell.org/pipermail/xmonad/2010-October/010671.html
|
||||||
data FuzzySpawn = FuzzySpawn deriving (Read, Show)
|
-- data FuzzySpawn = FuzzySpawn deriving (Read, Show)
|
||||||
instance XPrompt FuzzySpawn where showXPrompt _ = "RunC: "
|
-- instance XPrompt FuzzySpawn where showXPrompt _ = "RunC: "
|
||||||
fuzzyPrompt config = do
|
-- fuzzyPrompt config = do
|
||||||
cmds <- io getCommands
|
-- cmds <- io getCommands
|
||||||
let compl s
|
-- let compl s
|
||||||
| null s = []
|
-- | null s = []
|
||||||
| otherwise = let weight c = levenshteinDistance defaultEditCosts s c
|
-- | otherwise = let weight c = levenshteinDistance defaultEditCosts s c
|
||||||
in map snd $ take 20 $ sort $ map (\c -> (weight c,c)) cmds
|
-- in map snd $ take 20 $ sort $ map (\c -> (weight c,c)) cmds
|
||||||
mkXPrompt FuzzySpawn config (return . compl) spawn
|
-- mkXPrompt FuzzySpawn config (return . compl) spawn
|
||||||
|
--
|
||||||
|
|
|
@ -9,4 +9,3 @@ modify :: XConfig l -> XConfig l
|
||||||
modify conf = conf
|
modify conf = conf
|
||||||
{ logHook = logHook conf >> updatePointer (0.5,0.5) (0,0)
|
{ logHook = logHook conf >> updatePointer (0.5,0.5) (0,0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
91
lib/Nord.hs
Normal file
91
lib/Nord.hs
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
module Nord
|
||||||
|
( nord0
|
||||||
|
, nord1
|
||||||
|
, nord2
|
||||||
|
, nord3
|
||||||
|
, nord4
|
||||||
|
, nord5
|
||||||
|
, nord6
|
||||||
|
, nord7
|
||||||
|
, nord8
|
||||||
|
, nord9
|
||||||
|
, nord10
|
||||||
|
, nord11
|
||||||
|
, nord12
|
||||||
|
, nord13
|
||||||
|
, nord14
|
||||||
|
, nord15
|
||||||
|
, yellow
|
||||||
|
, orange
|
||||||
|
, red
|
||||||
|
, purple
|
||||||
|
, green
|
||||||
|
, background
|
||||||
|
, backgroundhl
|
||||||
|
, foreground
|
||||||
|
, foregroundhl
|
||||||
|
, foregroundll
|
||||||
|
) where
|
||||||
|
|
||||||
|
-- POLAR NIGHT
|
||||||
|
-- The origin color or the Polar Night palette.
|
||||||
|
nord0 = "#2E3440";
|
||||||
|
|
||||||
|
-- A brighter shade color based on nord0.
|
||||||
|
nord1 = "#3B4252";
|
||||||
|
|
||||||
|
-- An even more brighter shade color of nord0.
|
||||||
|
nord2 = "#434C5E";
|
||||||
|
|
||||||
|
-- The brightest shade color based on nord0.
|
||||||
|
nord3 = "#4C566A";
|
||||||
|
|
||||||
|
-- SNOW STORM
|
||||||
|
-- The origin color or the Snow Storm palette.
|
||||||
|
nord4 = "#D8DEE9";
|
||||||
|
|
||||||
|
-- A brighter shade color of nord4.
|
||||||
|
nord5 = "#E5E9F0";
|
||||||
|
|
||||||
|
-- The brightest shade color based on nord4.
|
||||||
|
nord6 = "#ECEFF4";
|
||||||
|
|
||||||
|
-- FROST
|
||||||
|
-- A calm and highly contrasted color reminiscent of frozen polar water.
|
||||||
|
nord7 = "#8FBCBB";
|
||||||
|
|
||||||
|
-- The bright and shiny primary accent color reminiscent of pure and clear ice.
|
||||||
|
nord8 = "#88C0D0";
|
||||||
|
|
||||||
|
-- A more darkened and less saturated color reminiscent of arctic waters.
|
||||||
|
nord9 = "#81A1C1";
|
||||||
|
|
||||||
|
-- A dark and intensive color reminiscent of the deep arctic ocean.
|
||||||
|
nord10 = "#5E81AC";
|
||||||
|
|
||||||
|
-- AURORA
|
||||||
|
-- RED
|
||||||
|
nord11 = "#BF616A";
|
||||||
|
|
||||||
|
-- ORANGE
|
||||||
|
nord12 = "#D08770";
|
||||||
|
|
||||||
|
-- YELLOW
|
||||||
|
nord13 = "#EBCB8B";
|
||||||
|
|
||||||
|
-- GREEN
|
||||||
|
nord14 = "#A3BE8C";
|
||||||
|
|
||||||
|
-- PURPLE
|
||||||
|
nord15 = "#B48EAD";
|
||||||
|
|
||||||
|
foregroundhl = nord6
|
||||||
|
foreground = nord5
|
||||||
|
foregroundll = nord4
|
||||||
|
backgroundhl = nord1
|
||||||
|
background = nord0
|
||||||
|
red = nord11
|
||||||
|
orange = nord12
|
||||||
|
yellow = nord13
|
||||||
|
green = nord14
|
||||||
|
purple = nord15
|
68
lib/Password.hs
Normal file
68
lib/Password.hs
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
-- 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" selectPassword
|
||||||
|
|
||||||
|
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
|
||||||
|
mkXPrompt (Pass label) conf (passComplFun passwords) f
|
||||||
|
where
|
||||||
|
getPasswords = do
|
||||||
|
passwordStoreDir <- (</> "pass") <$> getHomeDirectory
|
||||||
|
files <- runProcessWithInput "find"
|
||||||
|
[ passwordStoreDir, "-type", "f", "-name", "*.gpg", "-printf"
|
||||||
|
, "%p\n"] []
|
||||||
|
return . lines $ files
|
||||||
|
|
||||||
|
-- | Find all entries (`allPasses`) matching `input`
|
||||||
|
passComplFun :: [String] -> String -> IO [String]
|
||||||
|
passComplFun allPasses input = pure $
|
||||||
|
sortBy (compare `on` levenshtein input)
|
||||||
|
. take 10
|
||||||
|
. filter (consumes input)
|
||||||
|
$ allPasses
|
||||||
|
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
|
||||||
|
|
||||||
|
selectPassword :: String -> X ()
|
||||||
|
selectPassword pass = spawn $ "gpg --decrypt " ++ pass ++ " | copy"
|
||||||
|
-- “copy” comes with the xmonad module in the nix configuration
|
||||||
|
|
151
lib/Projects.hs
151
lib/Projects.hs
|
@ -6,70 +6,131 @@ import XMonad
|
||||||
import XMonad.Actions.DynamicProjects
|
import XMonad.Actions.DynamicProjects
|
||||||
import XMonad.Util.Run
|
import XMonad.Util.Run
|
||||||
|
|
||||||
|
term = "kitty"
|
||||||
|
|
||||||
|
spawnGuiTextEditor :: X ()
|
||||||
|
spawnGuiTextEditor = safeSpawn "neovide" []
|
||||||
|
|
||||||
|
singleTermAppWithName :: String -> String -> Project
|
||||||
|
singleTermAppWithName name app = Project
|
||||||
|
{ projectName = name
|
||||||
|
, projectDirectory = "/tmp"
|
||||||
|
, projectStartHook = Just $ do safeSpawn term ["zsh","-c",app]
|
||||||
|
}
|
||||||
|
|
||||||
|
singleAppWithName :: String -> String -> Project
|
||||||
|
singleAppWithName name app = Project
|
||||||
|
{ projectName = name
|
||||||
|
, projectDirectory = "/tmp"
|
||||||
|
, projectStartHook = Just $ do spawn app
|
||||||
|
}
|
||||||
|
|
||||||
|
singleApp :: String -> Project
|
||||||
|
singleApp app = singleAppWithName app app
|
||||||
|
|
||||||
projects :: [Project]
|
projects :: [Project]
|
||||||
projects = [ Project { projectName = "admin"
|
projects =
|
||||||
, projectDirectory = "~/admin"
|
[ singleApp "carla"
|
||||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
, singleApp "obs"
|
||||||
safeSpawnProg "st"
|
, singleApp "reaper"
|
||||||
|
, singleApp "renoise"
|
||||||
|
, singleApp "mixxx"
|
||||||
|
, singleAppWithName "Books" "calibre"
|
||||||
|
, singleAppWithName "discord" "Discord"
|
||||||
|
, singleAppWithName "matrix" "element-desktop"
|
||||||
|
, singleAppWithName "signal" "signal-desktop"
|
||||||
|
, singleAppWithName "vcv" "Rack"
|
||||||
|
, singleTermAppWithName "email" "neomutt"
|
||||||
|
, Project { projectName = "admin"
|
||||||
|
, projectDirectory = "~/admin/nixos-config"
|
||||||
|
, projectStartHook = Just $ do spawnGuiTextEditor
|
||||||
|
safeSpawnProg term
|
||||||
}
|
}
|
||||||
, Project { projectName = "mordor"
|
, Project { projectName = "nixpkgs"
|
||||||
, projectDirectory = "~/mordor"
|
, projectDirectory = "~/admin/nixpkgs"
|
||||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
, projectStartHook = Just $ do spawnGuiTextEditor
|
||||||
safeSpawnProg "st"
|
safeSpawnProg term
|
||||||
}
|
}
|
||||||
, Project { projectName = "mordor-docs"
|
, Project { projectName = "overlays-personal"
|
||||||
, projectDirectory = "~/mordor-2"
|
, projectDirectory = "~/admin/overlays-personal"
|
||||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
, projectStartHook = Just $ do spawnGuiTextEditor
|
||||||
safeSpawnProg "st"
|
safeSpawnProg term
|
||||||
}
|
}
|
||||||
, Project { projectName = "mordor-other"
|
, Project { projectName = "steam"
|
||||||
, projectDirectory = "~/mordor-3"
|
|
||||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
|
||||||
safeSpawnProg "st"
|
|
||||||
}
|
|
||||||
, Project { projectName = "email"
|
|
||||||
, projectDirectory = "~/mail"
|
|
||||||
, projectStartHook = Just $ do safeSpawnProg "st"
|
|
||||||
}
|
|
||||||
, Project { projectName = "frs"
|
|
||||||
, projectDirectory = "/tmp"
|
, projectDirectory = "/tmp"
|
||||||
, projectStartHook = Just $ do safeSpawnProg "frs"
|
, projectStartHook = Just $ safeSpawn "steam" ["-pipewire"]
|
||||||
}
|
}
|
||||||
, Project { projectName = "fre"
|
, Project { projectName = "youtube"
|
||||||
, projectDirectory = "/tmp"
|
, projectDirectory = "/tmp"
|
||||||
, projectStartHook = Just $ do safeSpawnProg "fre"
|
, projectStartHook = Just $ safeSpawn "chromium"
|
||||||
|
["--app=youtube.com"]
|
||||||
}
|
}
|
||||||
, Project { projectName = "network-graph"
|
, Project { projectName = "cdc-config"
|
||||||
, projectDirectory = "~/relex/catch-a-network-bug/csvplotter"
|
, projectDirectory = "~/admin/cdc-config"
|
||||||
, projectStartHook = Just $ do safeSpawn "zathura" ["weekXGraph.pdf"]
|
, projectStartHook = Just $ do spawnGuiTextEditor
|
||||||
safeSpawnProg "st"
|
safeSpawnProg term
|
||||||
}
|
}
|
||||||
, Project { projectName = "orc"
|
, Project { projectName = "saehkoepoika-config"
|
||||||
|
, projectDirectory = "~/admin/saehkoepoika-configuration-nix"
|
||||||
|
, projectStartHook = Just $ do spawnGuiTextEditor
|
||||||
|
safeSpawnProg term
|
||||||
|
}
|
||||||
|
, Project { projectName = "cdc-documentation"
|
||||||
|
, projectDirectory = "~/admin/cdc-documentation"
|
||||||
|
, projectStartHook = Just $ do
|
||||||
|
safeSpawnProg term
|
||||||
|
spawnGuiTextEditor
|
||||||
|
}
|
||||||
|
, Project { projectName = "adventOfCode"
|
||||||
|
, projectDirectory = "~/candy/adventofcode"
|
||||||
|
, projectStartHook = Just $ do
|
||||||
|
safeSpawnProg term
|
||||||
|
spawnGuiTextEditor
|
||||||
|
}
|
||||||
|
, Project { projectName = "rukokuoppa"
|
||||||
|
, projectDirectory = "~/candy/rukokuoppa"
|
||||||
|
, projectStartHook = Just $ do spawnGuiTextEditor
|
||||||
|
safeSpawnProg term
|
||||||
|
}
|
||||||
|
, Project { projectName = "notes"
|
||||||
|
, projectDirectory = "~/zk/org-roam-private"
|
||||||
|
, projectStartHook = Just $ safeSpawn "emacs" ["~/zk/org-roam-private"]
|
||||||
|
}
|
||||||
|
, Project { projectName = "groceries"
|
||||||
, projectDirectory = "/tmp"
|
, projectDirectory = "/tmp"
|
||||||
, projectStartHook = Just $ do safeSpawnProg "st"
|
, projectStartHook = Just $ safeSpawnProg "obsidian"
|
||||||
}
|
}
|
||||||
, Project { projectName = "mordor-ops"
|
, Project { projectName = "xmonad"
|
||||||
, projectDirectory = "~/relex/mordor-ops"
|
, projectDirectory = "~/.xmonad"
|
||||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
, projectStartHook = Just $ do spawnGuiTextEditor
|
||||||
safeSpawnProg "st"
|
safeSpawnProg term
|
||||||
}
|
}
|
||||||
, Project { projectName = "mordor-deploy"
|
, Project { projectName = "waymonad"
|
||||||
, projectDirectory = "~/relex/mordor-deploy"
|
, projectDirectory = "~/candy/waymonad"
|
||||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
, projectStartHook = Just $ do spawnGuiTextEditor
|
||||||
safeSpawnProg "st"
|
safeSpawnProg term
|
||||||
}
|
}
|
||||||
, Project { projectName = "scaleout-ops"
|
, Project { projectName = "accounting"
|
||||||
, projectDirectory = "~/relex/scaleout-ops"
|
, projectDirectory = "~/accounting"
|
||||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
, projectStartHook = Just $ do safeSpawnProg term
|
||||||
safeSpawnProg "st"
|
}
|
||||||
|
, Project { projectName = "arrangements"
|
||||||
|
, projectDirectory = "~/candy/Arrangements"
|
||||||
|
, projectStartHook = Just $ do spawnGuiTextEditor
|
||||||
|
safeSpawnProg term
|
||||||
|
}
|
||||||
|
, Project { projectName = "flim"
|
||||||
|
, projectDirectory = "/flims/rtorrent/download"
|
||||||
|
, projectStartHook = Just $ do safeSpawnProg term
|
||||||
}
|
}
|
||||||
, Project { projectName = "sound"
|
, Project { projectName = "sound"
|
||||||
, projectDirectory = "/tmp"
|
, projectDirectory = "/tmp"
|
||||||
, projectStartHook = Just $ do safeSpawnProg "pavucontrol"
|
, projectStartHook = Just $ do safeSpawnProg "pavucontrol"
|
||||||
|
safeSpawnProg "easyeffects"
|
||||||
}
|
}
|
||||||
, Project { projectName = "daily"
|
, Project { projectName = "web"
|
||||||
, projectDirectory = "/tmp"
|
, projectDirectory = "/tmp"
|
||||||
, projectStartHook = Just $ do safeSpawn "nix" ["run", "nixpkgs.chromium", "-c", "chromium"]
|
, projectStartHook = Just $ do spawn "firefox"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@ import qualified XMonad.StackSet as W
|
||||||
|
|
||||||
modify :: XConfig l -> XConfig l
|
modify :: XConfig l -> XConfig l
|
||||||
modify conf = conf
|
modify conf = conf
|
||||||
{ manageHook = namedScratchpadManageHook pads
|
{ manageHook = manageHook conf <> namedScratchpadManageHook pads
|
||||||
}
|
}
|
||||||
|
|
||||||
pads =
|
pads =
|
||||||
[ NS "htop" "/run/current-system/sw/bin/st -t htop -e tmux" (title =? "htop")
|
[ NS "htop" "kitty --title htop tmux" (title =? "htop")
|
||||||
(customFloating $ W.RationalRect (1/3) (1/3) (1/3) (1/3))
|
(customFloating $ W.RationalRect (1/3) (1/3) (1/3) (1/3))
|
||||||
-- , NS "stardict" "stardict" (className =? "Stardict")
|
-- , NS "stardict" "stardict" (className =? "Stardict")
|
||||||
-- (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))
|
-- (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))
|
||||||
|
|
|
@ -6,7 +6,7 @@ module StatusBar (
|
||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import Solarized as S
|
import Nord as N
|
||||||
import XMonad.Core
|
import XMonad.Core
|
||||||
import XMonad.Hooks.DynamicBars (dynStatusBarStartup,dynStatusBarEventHook,multiPP)
|
import XMonad.Hooks.DynamicBars (dynStatusBarStartup,dynStatusBarEventHook,multiPP)
|
||||||
import XMonad.Hooks.DynamicLog
|
import XMonad.Hooks.DynamicLog
|
||||||
|
@ -38,17 +38,17 @@ killXmobar :: IO ()
|
||||||
killXmobar = return ()
|
killXmobar = return ()
|
||||||
|
|
||||||
otherPP = currentPP
|
otherPP = currentPP
|
||||||
{ ppCurrent = xmobarColor S.foreground S.background
|
{ ppCurrent = xmobarColor N.foreground N.background
|
||||||
, ppVisible = xmobarColor S.foreground S.background
|
, ppVisible = xmobarColor N.foreground N.background
|
||||||
, ppHidden = xmobarColor S.foreground S.background
|
, ppHidden = xmobarColor N.foreground N.background
|
||||||
, ppHiddenNoWindows = xmobarColor S.backgroundhl S.background
|
, ppHiddenNoWindows = xmobarColor N.backgroundhl N.background
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPP = def
|
currentPP = def
|
||||||
{ ppCurrent = xmobarColor' S.orange
|
{ ppCurrent = xmobarColor' N.orange
|
||||||
, ppVisible = xmobarColor' S.yellow -- other screen
|
, ppVisible = xmobarColor' N.yellow -- other screen
|
||||||
, ppHidden = xmobarColor' S.foreground -- other workspaces with windows
|
, ppHidden = xmobarColor' N.foreground -- other workspaces with windows
|
||||||
, ppHiddenNoWindows = xmobarColor' S.foregroundll -- other workspaces
|
, ppHiddenNoWindows = xmobarColor' N.foregroundll -- other workspaces
|
||||||
, ppSep = " "
|
, ppSep = " "
|
||||||
, ppWsSep = " "
|
, ppWsSep = " "
|
||||||
, ppLayout = printLayout
|
, ppLayout = printLayout
|
||||||
|
|
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
|
||||||
|
];
|
||||||
|
}
|
36
xmonad-config.cabal
Normal file
36
xmonad-config.cabal
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
cabal-version: >=1.10
|
||||||
|
|
||||||
|
name: xmonad-config
|
||||||
|
version: 0.13.0.0
|
||||||
|
-- synopsis:
|
||||||
|
-- description:
|
||||||
|
-- bug-reports:
|
||||||
|
license: AGPL-3.0-or-later
|
||||||
|
author: EEva (JPotier)
|
||||||
|
maintainer: jpo.contributes.to.nixos@marvid.fr
|
||||||
|
-- copyright:
|
||||||
|
-- category:
|
||||||
|
build-type: Simple
|
||||||
|
extra-source-files: CHANGELOG.md
|
||||||
|
|
||||||
|
executable xmonad
|
||||||
|
main-is: xmonad.hs
|
||||||
|
other-modules: KeyBindings
|
||||||
|
, MouseBindings
|
||||||
|
, Nord
|
||||||
|
, Password
|
||||||
|
, Projects
|
||||||
|
, Scratchpad
|
||||||
|
-- other-extensions:
|
||||||
|
build-depends: base
|
||||||
|
, X11
|
||||||
|
, directory
|
||||||
|
, filepath
|
||||||
|
, mtl
|
||||||
|
, unix
|
||||||
|
, xmonad
|
||||||
|
, xmonad-contrib >= 0.18.1
|
||||||
|
, xmonad-extras
|
||||||
|
hs-source-dirs: .
|
||||||
|
, lib
|
||||||
|
default-language: Haskell2010
|
50
xmonad.hs
50
xmonad.hs
|
@ -9,12 +9,14 @@ import XMonad.Actions.DynamicProjects
|
||||||
import XMonad.Config.Desktop
|
import XMonad.Config.Desktop
|
||||||
import XMonad.Hooks.DynamicLog
|
import XMonad.Hooks.DynamicLog
|
||||||
import XMonad.Hooks.ManageHelpers
|
import XMonad.Hooks.ManageHelpers
|
||||||
import XMonad.Layout.NoBorders (noBorders, smartBorders)
|
import XMonad.Layout.NoBorders (noBorders, smartBorders, hasBorder, BorderMessage (HasBorder))
|
||||||
import XMonad.Layout.ResizableTile (ResizableTall(..))
|
import XMonad.Layout.ResizableTile (ResizableTall(..))
|
||||||
import XMonad.Layout.Spacing
|
import XMonad.Layout.Spacing
|
||||||
import XMonad.Layout.ToggleLayouts (toggleLayouts)
|
import XMonad.Layout.ToggleLayouts (toggleLayouts)
|
||||||
import XMonad.Util.EZConfig
|
import XMonad.Util.EZConfig
|
||||||
import qualified Solarized as S
|
import XMonad.Util.Hacks (fixSteamFlicker)
|
||||||
|
import qualified Nord as N
|
||||||
|
import qualified XMonad.Layout.Spacing as SS (Border(..))
|
||||||
|
|
||||||
-- Tidy modules
|
-- Tidy modules
|
||||||
import KeyBindings as Keys (modify)
|
import KeyBindings as Keys (modify)
|
||||||
|
@ -25,42 +27,46 @@ import Scratchpad (modify)
|
||||||
--------- toggle btw vvvvvvvvvv or vvvvv
|
--------- toggle btw vvvvvvvvvv or vvvvv
|
||||||
layouts = toggleLayouts fullscreen tiled
|
layouts = toggleLayouts fullscreen tiled
|
||||||
where
|
where
|
||||||
fullscreen = (noBorders Full)
|
smallBorder = SS.Border 5 5 5 5
|
||||||
tiled = smarts $ resizableTall ||| (Mirror resizableTall)
|
fullscreen = noBorders Full
|
||||||
smarts = (smartSpacingWithEdge 5) . smartBorders
|
tiled = smarts $ resizableTall ||| Mirror resizableTall
|
||||||
|
smarts = spacingRaw True smallBorder True smallBorder True . smartBorders
|
||||||
resizableTall = ResizableTall 1 (5/100) (1/2) []
|
resizableTall = ResizableTall 1 (5/100) (1/2) []
|
||||||
|
|
||||||
-- Use the `xprop' tool to get the info you need for these matches.
|
-- Use the `xprop' tool to get the info you need for these matches.
|
||||||
-- For className, use the second value that xprop gives you.
|
-- For className, use the second value that xprop gives you.
|
||||||
-------------- Here be the law of windows
|
-------------- Here be the law of windows
|
||||||
myManageHook = composeOne
|
myManageHook = composeAll
|
||||||
[ className =? "Pavucontrol" -?> doShift "music"
|
[ className =? "Patchage" --> doShift "patchage"
|
||||||
, className =? "Pinentry" -?> doFloat
|
, className =? "Pavucontrol" --> doShift "music"
|
||||||
, className =? "Steam" -?> doShift "steam"
|
, className =? "Pinentry" --> doCenterFloat
|
||||||
, className =? "VirtualBox" -?> doFloat
|
, className =? "REAPER" --> hasBorder False
|
||||||
, className =? "csgo_linux64" -?> doShift "csgo"
|
, className =? "Renoise" --> hasBorder False
|
||||||
, className =? "mpv" -?> doFullFloat <+> (doShift "flims")
|
, className =? "steam" --> doShift "steam"
|
||||||
, className =? "qemu-system-x86_64" -?> doFloat
|
, className =? "steamwebhelper" --> doShift "steam"
|
||||||
, className =? "qutebrowser" -?> doShift "web"
|
, className =? "cs2" --> doShift "steam"
|
||||||
, isDialog -?> doCenterFloat
|
, isDialog --> doCenterFloat
|
||||||
, isDialog -?> doCenterFloat
|
|
||||||
|
|
||||||
-- Move transient windows to their parent:
|
-- Move transient windows to their parent:
|
||||||
, transience
|
, transience'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
fixSteam :: XConfig l -> XConfig l
|
||||||
|
fixSteam c = c { handleEventHook = fixSteamFlicker <+> handleEventHook c }
|
||||||
|
|
||||||
------------ build the full config
|
------------ build the full config
|
||||||
withConfig =
|
withConfig =
|
||||||
Projects.modify -- Apply projects config
|
fixSteam -- And workaround steam bug
|
||||||
|
$ Projects.modify -- Apply projects config
|
||||||
$ Keys.modify -- Apply keybindings config
|
$ Keys.modify -- Apply keybindings config
|
||||||
$ Mouse.modify -- Apply mouse bindings config
|
$ Mouse.modify -- Apply mouse bindings config
|
||||||
$ Scratchpad.modify -- Apply scratchpad managehook config
|
$ Scratchpad.modify -- Apply scratchpad managehook config
|
||||||
$ desktopConfig -- on a default desktop config
|
$ desktopConfig -- on a default desktop config
|
||||||
{ manageHook = myManageHook <+> manageHook desktopConfig
|
{ manageHook = myManageHook
|
||||||
, layoutHook = desktopLayoutModifiers layouts
|
, layoutHook = desktopLayoutModifiers layouts
|
||||||
, terminal = "/run/current-system/sw/bin/st"
|
, terminal = "kitty"
|
||||||
, normalBorderColor = S.base03
|
, normalBorderColor = N.backgroundhl
|
||||||
, focusedBorderColor = S.violet
|
, focusedBorderColor = N.nord9
|
||||||
, borderWidth = 5
|
, borderWidth = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue