Compare commits

..

75 commits

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

7
.gitignore vendored
View file

@ -1,11 +1,8 @@
.*.swp .*.swp
artwork/ artwork
*.hi *.hi
*.o *.o
.direnv/
prompt-history prompt-history
xmonad-x86_64-linux xmonad-*-linux
xmonad.errors xmonad.errors
xmonad.state xmonad.state
dist-newstyle
result*

View file

@ -1,5 +0,0 @@
# Revision history for xmonad-config
## 0.1.0.0 -- YYYY-mm-dd
* First version. Released on an unsuspecting world.

View file

@ -1,2 +0,0 @@
import Distribution.Simple
main = defaultMain

View file

@ -1,12 +1,27 @@
{ {
"nodes": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1725983898, "lastModified": 1670242877,
"narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=", "narHash": "sha256-jBLh7dRHnbfvPPA9znOC6oQfKrCPJ0El8Zoe0BqnCjQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43", "rev": "6e51c97f1c849efdfd4f3b78a4870e6aa2da4198",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -18,6 +33,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View file

@ -2,56 +2,18 @@
description = "Build my xmonad config"; description = "Build my xmonad config";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { outputs = { self, nixpkgs, flake-utils }:
self,
nixpkgs, flake-utils.lib.eachDefaultSystem (system:
}: let let pkgs = nixpkgs.legacyPackages.${system}; in
forAllSystems = function: {
nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-linux"] (system: devShells.default = import ./shell.nix { inherit pkgs; };
function rec { }) // {
inherit system; packages.aarch64-linux.default =
compilerVersion = "ghc966"; # Notice the reference to nixpkgs here.
pkgs = nixpkgs.legacyPackages.${system}; with import nixpkgs { system = "aarch64-linux"; };
hsPkgs = pkgs.haskell.packages.${compilerVersion}.override { haskellPackages.callCabal2nix "xmonad-config" ./. {};
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
];
};
});
}; };
} }

82
lib/Catppuccin.hs Normal file
View 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"

View file

@ -11,6 +11,7 @@ import Graphics.X11.Types
import System.Exit import System.Exit
-- import Text.EditDistance -- import Text.EditDistance
import XMonad import XMonad
import XMonad.Actions.CopyWindow (kill1,copy)
import XMonad.Actions.CycleWS import XMonad.Actions.CycleWS
import XMonad.Actions.DynamicProjects import XMonad.Actions.DynamicProjects
import XMonad.Core import XMonad.Core
@ -20,16 +21,19 @@ import XMonad.Prompt
import XMonad.Prompt.ConfirmPrompt import XMonad.Prompt.ConfirmPrompt
import XMonad.Prompt.FuzzyMatch import XMonad.Prompt.FuzzyMatch
import XMonad.Prompt.Shell import XMonad.Prompt.Shell
import XMonad.Prompt.Workspace (workspacePrompt)
import XMonad.Util.EZConfig import XMonad.Util.EZConfig
import XMonad.Util.NamedScratchpad import XMonad.Util.NamedScratchpad
import qualified Nord as N import qualified Catppuccin as C
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) -- Custom (in libs)
import Password (passPrompt) 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 :: 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
@ -37,12 +41,20 @@ modify conf = conf
`additionalKeysP` -- Add some extra key bindings: `additionalKeysP` -- Add some extra key bindings:
[ ("M-S-q", confirmPrompt promptConfig "exit" (io exitSuccess)) [ ("M-S-q", confirmPrompt promptConfig "exit" (io exitSuccess))
, ("<XF86MonBrightnessDown>", spawn "/run/current-system/sw/bin/xbacklight -10") , ("<XF86MonBrightnessDown>", spawn "/run/current-system/sw/bin/light -U 10")
, ("<XF86MonBrightnessUp>", spawn "/run/current-system/sw/bin/xbacklight +10") , ("<XF86MonBrightnessUp>", spawn "/run/current-system/sw/bin/light -A 10")
, ("<XF86AudioPlay>", spawn "/run/current-system/sw/bin/mpc toggle") , ("<XF86AudioPlay>", spawn "/etc/profiles/per-user/e/bin/mpc toggle")
, ("<XF86AudioNext>", spawn "/run/current-system/sw/bin/mpc next") , ("<XF86AudioNext>", spawn "/etc/profiles/per-user/e/bin/mpc next")
, ("<XF86AudioPrev>", spawn "/run/current-system/sw/bin/mpc prev") , ("<XF86AudioPrev>", spawn "/etc/profiles/per-user/e/bin/mpc prev")
, ("M-<Delete>", kill) -- 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-<Down>", windows W.focusDown)
, ("M-<Esc>", sendMessage (Toggle "Full")) , ("M-<Esc>", sendMessage (Toggle "Full"))
, ("M-$", sendMessage (Toggle "Full")) , ("M-$", sendMessage (Toggle "Full"))
@ -52,31 +64,37 @@ modify conf = conf
, ("M-<Right>", nextWS) , ("M-<Right>", nextWS)
, ("M-<Tab>", toggleWS' ["NSP"]) , ("M-<Tab>", toggleWS' ["NSP"])
, ("M-<Up>", windows W.focusUp) , ("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-<Left>", shiftToPrev >> prevWS)
, ("M-S-<Right>", shiftToNext >> nextWS) , ("M-S-<Right>", shiftToNext >> nextWS)
, ("M-s s", spawn "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") , ("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)
, ("M-p c", withFocused centerWindow)
, ("M-p m", shiftToProjectPrompt promptConfig) , ("M-p m", shiftToProjectPrompt promptConfig)
, ("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) , ("M-d", passPrompt promptConfig)
-- Scratchpads -- Scratchpads
, ("M-p p", namedScratchpadAction R.pads "htop") , ("M-p p", namedScratchpadAction R.pads "htop")
-- Dunst -- Copy windows to workspaces
, ("C-<Space>", spawn "dunstctl close") , ("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") , ("C-S-<Space>", spawn "dunstctl close-all")
, ("M-n p", spawn "dunstctl set-paused toggle") , ("M-n p", spawn "dunstctl set-paused toggle")
] ]
viewProject :: WorkspaceId -> X ()
viewProject id = do
project <- lookupProject id
forM_ project switchProject
-- Borrowed from https://www.reddit.com/r/xmonad/comments/gzq316/how_can_i_centre_a_floating_window_without/fthtx29/ -- Borrowed from https://www.reddit.com/r/xmonad/comments/gzq316/how_can_i_centre_a_floating_window_without/fthtx29/
centerWindow :: Window -> X () centerWindow :: Window -> X ()
@ -85,19 +103,23 @@ centerWindow win = do
windows $ W.float win (W.RationalRect ((1 - w) / 2) ((1 - h) / 2) w h) windows $ W.float win (W.RationalRect ((1 - w) / 2) ((1 - h) / 2) w h)
return () return ()
viewProject :: WorkspaceId -> X ()
viewProject id = do
project <- lookupProject id
case project of
Just p -> switchProject p
Nothing -> return ()
promptConfig = def promptConfig = def
{ position = Bottom { position = Bottom
, alwaysHighlight = True , alwaysHighlight = True
, borderColor = N.nord9 , bgColor = C.lavender
-- Normal , bgHLight = C.surface0
, bgColor = N.nord9 , borderColor = C.lavender
, fgColor = N.background
-- Selection
, bgHLight = N.nord6
, fgHLight = N.background
--
, defaultText = "" , defaultText = ""
, font = "xft:Iosevka Samae:style=Regular:size=8:charwidth=5" , fgColor = C.surface2
, fgHLight = C.text
, font = "xft:Iosevka Samae:style=Regular:size=10:charwidth=6.5"
, height = 24 , height = 24
, promptBorderWidth = 5 , promptBorderWidth = 5
-- Fuzzysearch by default -- Fuzzysearch by default

View file

@ -9,3 +9,4 @@ 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)
} }

View file

@ -1,91 +0,0 @@
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

View file

@ -33,36 +33,23 @@ passGeneratePrompt :: XPConfig -> X ()
passGeneratePrompt _ = return () -- Not implemented passGeneratePrompt _ = return () -- Not implemented
passPrompt :: XPConfig -> X () passPrompt :: XPConfig -> X ()
passPrompt = mkPassPrompt "Select password" selectPassword passPrompt = mkPassPrompt "Select password" copyPassword
mkPassPrompt :: String -> (String -> X ()) -> XPConfig -> X () mkPassPrompt :: String -> (String -> X ()) -> XPConfig -> X ()
mkPassPrompt label f conf = do mkPassPrompt label f conf = do
-- I'm just sorting here, but could use some kind of fuzzy matching instead, -- I'm just sorting here, but could use some kind of fuzzy matching instead, but it requires a bit more effort
-- but it requires a bit more effort
passwords <- sort <$> liftIO getPasswords passwords <- sort <$> liftIO getPasswords
mkXPrompt (Pass label) conf (passComplFun passwords) f -- Other change, use infixof instead of prefixof
where mkXPrompt (Pass label) conf (\input -> pure (sortBy (compare `on` levenshtein input) . take 5 . filter (consumes input) $ passwords)) f
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 where
consumes [] _ = True -- everything consumed consumes [] _ = True -- everything consumed
consumes (_:_) [] = False -- all not consumed consumes (_:_) [] = False -- all not consumed
consumes (a:xs) (a':ys) | a == a' = consumes xs ys consumes (a:xs) (a':ys) | a == a' = consumes xs ys
| otherwise = consumes (a: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
selectPassword :: String -> X () copyPassword :: String -> X ()
selectPassword pass = spawn $ "gpg --decrypt " ++ pass ++ " | copy" copyPassword pass = spawn $ "gpg --decrypt " ++ pass ++ " | copy"
-- “copy” comes with the xmonad module in the nix configuration

View file

@ -6,135 +6,135 @@ import XMonad
import XMonad.Actions.DynamicProjects import XMonad.Actions.DynamicProjects
import XMonad.Util.Run import XMonad.Util.Run
term = "kitty" spinTextEditorAndTerm :: String -> String -> Project
spinTextEditorAndTerm dir name =
spawnGuiTextEditor :: X () Project { projectName = name
spawnGuiTextEditor = safeSpawn "neovide" [] , projectDirectory = dir <> name
, projectStartHook = Just
singleTermAppWithName :: String -> String -> Project $ safeSpawn "rio" ["-e","tmux","new","-A","-s",name]
singleTermAppWithName name app = Project
{ projectName = name
, projectDirectory = "/tmp"
, projectStartHook = Just $ do safeSpawn term ["zsh","-c",app]
} }
singleAppWithName :: String -> String -> Project spinChat :: String -> Project
singleAppWithName name app = Project spinChat name =
{ projectName = name Project { projectName = name
, projectDirectory = "/tmp" , projectDirectory = "/tmp"
, projectStartHook = Just $ do spawn app , projectStartHook = Just $ do safeSpawnProg (name <> "-desktop")
} }
singleApp :: String -> Project spinInTermWithName :: String -> String -> Project
singleApp app = singleAppWithName app app 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]
projects = projects = [ adminProject "wrk-config"
[ singleApp "carla" , adminProject "cdc-config"
, singleApp "obs" , adminProject "overlays-personal"
, singleApp "reaper" , candyProject "adventofcode"
, singleApp "renoise" , candyProject "dhall-packages"
, singleApp "mixxx" , candyProject "hfdb"
, singleAppWithName "Books" "calibre" , justStartWithName "fre" "ff-perso"
, singleAppWithName "discord" "Discord" , justStartWithName "frs" "ff-relex"
, singleAppWithName "matrix" "element-desktop" , justStartWithName "chat" "slack"
, singleAppWithName "signal" "signal-desktop" , justStartWithName "meet" "chromium"
, singleAppWithName "vcv" "Rack" , spinNotes
, singleTermAppWithName "email" "neomutt" , spinInTermWithName "VPN" "vpn-run"
, Project { projectName = "admin" , spinChat "element"
, projectDirectory = "~/admin/nixos-config" , spinChat "signal"
, projectStartHook = Just $ do spawnGuiTextEditor , spinInTerm "k9s"
safeSpawnProg term , spinInTermWithName "email" "neomutt"
} , spinTextEditorAndTerm "~/." "xmonad" -- Dark magic!
, Project { projectName = "nixpkgs" , workProject "azure-kube-platform"
, projectDirectory = "~/admin/nixpkgs" , workProject "azure-kube-platform-environments"
, projectStartHook = Just $ do spawnGuiTextEditor , workProject "azure-management"
safeSpawnProg term , workProject "calculation-node-playbook"
} , workProject "communication-nix-101"
, Project { projectName = "overlays-personal" , workProject "communication-nix-102"
, projectDirectory = "~/admin/overlays-personal" , workProject "communication-nix-103"
, projectStartHook = Just $ do spawnGuiTextEditor , workProject "cooper"
safeSpawnProg term , workProject "crebain"
} , workProject "customer-configs"
, Project { projectName = "steam" , 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" , projectDirectory = "/tmp"
, projectStartHook = Just $ safeSpawn "steam" ["-pipewire"] , projectStartHook = Just $ do safeSpawnProg "minecraft-launcher"
safeSpawnProg "mumble"
} }
, Project { projectName = "youtube" , Project { projectName = "status"
, projectDirectory = "/tmp" , projectDirectory = "/tmp"
, projectStartHook = Just $ safeSpawn "chromium"
["--app=youtube.com"]
}
, Project { projectName = "cdc-config"
, projectDirectory = "~/admin/cdc-config"
, projectStartHook = Just $ do spawnGuiTextEditor
safeSpawnProg term
}
, 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 , projectStartHook = Just $ do
safeSpawnProg term safeSpawn "rio" ["-e","btop"]
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"
, projectStartHook = Just $ safeSpawnProg "obsidian"
}
, Project { projectName = "xmonad"
, projectDirectory = "~/.xmonad"
, projectStartHook = Just $ do spawnGuiTextEditor
safeSpawnProg term
}
, Project { projectName = "waymonad"
, projectDirectory = "~/candy/waymonad"
, projectStartHook = Just $ do spawnGuiTextEditor
safeSpawnProg term
}
, Project { projectName = "accounting"
, projectDirectory = "~/accounting"
, projectStartHook = Just $ do safeSpawnProg term
}
, 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
safeSpawn "pw-jack" ["patchage"]
safeSpawnProg "easyeffects" safeSpawnProg "easyeffects"
} }
, Project { projectName = "web"
, projectDirectory = "/tmp"
, projectStartHook = Just $ do spawn "firefox"
}
] ]
modify :: XConfig l -> XConfig l modify :: XConfig l -> XConfig l
modify conf = dynamicProjects projects conf modify conf = dynamicProjects projects conf
{ workspaces = [] } { workspaces = [] }

View file

@ -16,7 +16,7 @@ modify conf = conf
} }
pads = pads =
[ NS "htop" "kitty --title htop tmux" (title =? "htop") [ NS "htop" "rio -e 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))

22
lib/ScreenEvents.hs Normal file
View 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"

View file

@ -20,8 +20,33 @@ module Solarized
, foreground , foreground
, foregroundhl , foregroundhl
, foregroundll , foregroundll
, theme
) where ) 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" base03 = "#002b36"
base02 = "#073642" base02 = "#073642"
base01 = "#586e75" base01 = "#586e75"

View file

@ -1,69 +0,0 @@
{-# LANGUAGE FlexibleContexts #-}
module StatusBar (
StatusBar.modify
) where
import Data.List
import Data.Monoid
import Nord as N
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 N.foreground N.background
, ppVisible = xmobarColor N.foreground N.background
, ppHidden = xmobarColor N.foreground N.background
, ppHiddenNoWindows = xmobarColor N.backgroundhl N.background
}
currentPP = def
{ ppCurrent = xmobarColor' N.orange
, ppVisible = xmobarColor' N.yellow -- other screen
, ppHidden = xmobarColor' N.foreground -- other workspaces with windows
, ppHiddenNoWindows = xmobarColor' N.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 " »"

View file

@ -1,4 +1,5 @@
{pkgs}: let { pkgs }:
let
inherit (pkgs) callPackage fetchFromGitHub mkShell; inherit (pkgs) callPackage fetchFromGitHub mkShell;
easy-hls-src = fetchFromGitHub { easy-hls-src = fetchFromGitHub {
owner = "jkachmar"; owner = "jkachmar";
@ -8,8 +9,7 @@
}; };
easy-hls = callPackage easy-hls-src {}; easy-hls = callPackage easy-hls-src {};
in in
mkShell {
buildInputs = [ mkShell {
easy-hls buildInputs = [ easy-hls ];
]; }
}

View file

@ -1,36 +0,0 @@
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

View file

@ -9,64 +9,76 @@ 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, hasBorder, BorderMessage (HasBorder))
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.ResizableTile (ResizableTall(..))
import XMonad.Layout.Spacing import XMonad.Layout.Spacing
import XMonad.Layout.ThreeColumns (ThreeCol(..))
import XMonad.Layout.ToggleLayouts (toggleLayouts) import XMonad.Layout.ToggleLayouts (toggleLayouts)
import XMonad.StackSet (sink)
import XMonad.Util.EZConfig import XMonad.Util.EZConfig
import XMonad.Util.Hacks (fixSteamFlicker) import XMonad.Util.SpawnOnce
import qualified Nord as N import qualified Solarized as S
import qualified XMonad.Layout.Spacing as SS (Border(..)) import qualified Catppuccin as C
-- Tidy modules -- Tidy modules
import KeyBindings as Keys (modify) import KeyBindings as Keys (modify)
import MouseBindings as Mouse (modify) import MouseBindings as Mouse (modify)
import Projects (modify) import Projects (modify)
import Scratchpad (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 layouts = toggleLayouts fullscreen tiled
where where
smallBorder = SS.Border 5 5 5 5 fullscreen = (noBorders Full)
fullscreen = noBorders Full tiled = smarts $ ifWider (1920 + 1) wideScreen normalScreen
tiled = smarts $ resizableTall ||| Mirror resizableTall wideScreen = ThreeColMid 1 (5/100) (1/2)
smarts = spacingRaw True smallBorder True smallBorder True . smartBorders normalScreen = ResizableTall 1 (5/100) (1/2) []
resizableTall = ResizableTall 1 (5/100) (1/2) [] smarts = (smartSpacingWithEdge 5) . smartBorders
--titleBar = noFrillsDeco shrinkText S.theme
-- 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 = composeAll myManageHook = composeOne
[ className =? "Patchage" --> doShift "patchage" [ className =? "Gcr-prompter" -?> doCenterFloat
, className =? "Pavucontrol" --> doShift "music" , className =? "Pavucontrol" -?> doShift "music"
, className =? "Pinentry" --> doCenterFloat , className =? "Pinentry" -?> doFloat
, className =? "REAPER" --> hasBorder False , className =? "VirtualBox" -?> doFloat
, className =? "Renoise" --> hasBorder False , className =? "gpclient" -?> doTile <+> (doShift "VPN")
, className =? "steam" --> doShift "steam" , className =? "mpv" -?> doFullFloat <+> (doShift "flims")
, className =? "steamwebhelper" --> doShift "steam" , className =? "qemu-system-x86_64" -?> doFloat
, className =? "cs2" --> doShift "steam" , className =? "qutebrowser" -?> doShift "web"
, isDialog --> doCenterFloat , isDialog -?> doCenterFloat
-- Move transient windows to their parent: -- Move transient windows to their parent:
, transience' , transience
] ]
fixSteam :: XConfig l -> XConfig l doTile :: ManageHook
fixSteam c = c { handleEventHook = fixSteamFlicker <+> handleEventHook c } doTile = ask >>= doF . sink
------------ build the full config ------------ build the full config
withConfig = withConfig =
fixSteam -- And workaround steam bug Projects.modify -- Apply projects config
$ 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
$ ScreenEvents.modify -- Apply screen event hook config
$ desktopConfig -- on a default desktop config $ desktopConfig -- on a default desktop config
{ manageHook = myManageHook { manageHook = myManageHook <+> manageHook desktopConfig
, layoutHook = desktopLayoutModifiers layouts , layoutHook = desktopLayoutModifiers layouts
, terminal = "kitty" , startupHook = spawnOnce "sh /home/e/.fehbg"
, normalBorderColor = N.backgroundhl , terminal = "rio"
, focusedBorderColor = N.nord9 , normalBorderColor = C.surface0
, focusedBorderColor = C.mauve
, borderWidth = 5 , borderWidth = 5
} }