Compare commits

..

No commits in common. "master" and "future" have entirely different histories.

14 changed files with 68 additions and 376 deletions

1
.envrc
View File

@ -1 +0,0 @@
use flake

2
.gitignore vendored
View File

@ -2,9 +2,7 @@
artwork/
*.hi
*.o
.direnv/
prompt-history
xmonad-x86_64-linux
xmonad.errors
xmonad.state
dist-newstyle

View File

@ -1,43 +0,0 @@
{
"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": 1670064435,
"narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,19 +0,0 @@
{
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,7 +4,6 @@ module KeyBindings (
) where
import Control.Monad (void)
import Data.Foldable (forM_)
import Data.List (sort, isSuffixOf)
import Data.Maybe (isJust)
import Graphics.X11.Types
@ -18,15 +17,13 @@ import XMonad.Layout.ToggleLayouts
import XMonad.Operations
import XMonad.Prompt
import XMonad.Prompt.ConfirmPrompt
import XMonad.Prompt.FuzzyMatch
import XMonad.Prompt.Shell
import XMonad.Util.EZConfig
import XMonad.Util.NamedScratchpad
import qualified Nord as N
import qualified Solarized as S
import qualified Scratchpad as R
import qualified XMonad.StackSet as W
-- Custom (in libs)
import Password (passPrompt)
@ -63,46 +60,30 @@ modify conf = conf
, ("M-p n", switchProjectPrompt promptConfig)
, ("M-p r", renameProjectPrompt promptConfig)
, ("M-p s", shellPrompt promptConfig)
, ("M-p c", withFocused centerWindow)
, ("M-d", passPrompt promptConfig)
-- Scratchpads
, ("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 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/
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 ()
case project of
Just p -> switchProject p
Nothing -> return ()
promptConfig = def
{ position = Bottom
, alwaysHighlight = True
, borderColor = N.nord9
-- Normal
, bgColor = N.nord9
, fgColor = N.background
-- Selection
, bgHLight = N.nord6
, fgHLight = N.background
--
, bgColor = S.magenta
, bgHLight = S.base0
, borderColor = S.magenta
, defaultText = ""
, font = "xft:Iosevka Samae:style=Regular:size=8:charwidth=5"
, fgColor = S.base02
, fgHLight = S.base03
, font = "xft:Iosevka Samae:style=Regular:size=8"
, height = 24
, promptBorderWidth = 5
-- Fuzzysearch by default
, searchPredicate = fuzzyMatch
, sorter = fuzzySort
}
-- -- Slightly taken from

View File

@ -9,3 +9,4 @@ modify :: XConfig l -> XConfig l
modify conf = conf
{ 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

@ -37,31 +37,20 @@ 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
-- 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
-- Other change, use infixof instead of prefixof
mkXPrompt (Pass label) conf (\input -> pure (sortBy (compare `on` levenshtein input) . 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"] []
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

View File

@ -6,128 +6,29 @@ import XMonad
import XMonad.Actions.DynamicProjects
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 =
[ singleApp "carla"
, singleApp "obs"
, 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 = "nixpkgs"
, projectDirectory = "~/admin/nixpkgs"
, projectStartHook = Just $ do spawnGuiTextEditor
safeSpawnProg term
}
, Project { projectName = "overlays-personal"
, projectDirectory = "~/admin/overlays-personal"
, projectStartHook = Just $ do spawnGuiTextEditor
safeSpawnProg term
}
, Project { projectName = "steam"
, projectDirectory = "/tmp"
, projectStartHook = Just $ safeSpawn "steam" ["-pipewire"]
}
, Project { projectName = "youtube"
, projectDirectory = "/tmp"
, projectStartHook = Just $ safeSpawn "chromium"
["--app=youtube.com"
,"--incognito"]
}
, 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
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"
, 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 = "admin"
, projectDirectory = "~/admin"
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
safeSpawnProg "st"
}
, Project { projectName = "accounting"
, projectDirectory = "~/accounting"
, projectStartHook = Just $ do safeSpawnProg term
}
, Project { projectName = "arrangements"
, projectDirectory = "~/candy/Arrangements"
, projectStartHook = Just $ do spawnGuiTextEditor
safeSpawnProg term
, projectStartHook = Just $ do safeSpawnProg "st"
}
, Project { projectName = "flim"
, projectDirectory = "/flims/rtorrent/download"
, projectStartHook = Just $ do safeSpawnProg term
, projectStartHook = Just $ do safeSpawnProg "st"
}
, Project { projectName = "sound"
, projectDirectory = "/tmp"
, projectStartHook = Just $ do safeSpawnProg "pavucontrol"
}
, Project { projectName = "steam"
, projectDirectory = "~/"
, projectStartHook = Just $ do spawn "steam"
}
, Project { projectName = "web"
, projectDirectory = "/tmp"
, projectStartHook = Just $ do spawn "firefox"

View File

@ -12,11 +12,11 @@ import qualified XMonad.StackSet as W
modify :: XConfig l -> XConfig l
modify conf = conf
{ manageHook = manageHook conf <> namedScratchpadManageHook pads
{ manageHook = namedScratchpadManageHook pads
}
pads =
[ NS "htop" "kitty --title htop tmux" (title =? "htop")
[ NS "htop" "/run/current-system/sw/bin/st -t htop -e tmux" (title =? "htop")
(customFloating $ W.RationalRect (1/3) (1/3) (1/3) (1/3))
-- , NS "stardict" "stardict" (className =? "Stardict")
-- (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))

View File

@ -6,7 +6,7 @@ module StatusBar (
import Data.List
import Data.Monoid
import Nord as N
import Solarized as S
import XMonad.Core
import XMonad.Hooks.DynamicBars (dynStatusBarStartup,dynStatusBarEventHook,multiPP)
import XMonad.Hooks.DynamicLog
@ -38,17 +38,17 @@ killXmobar :: IO ()
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
{ ppCurrent = xmobarColor S.foreground S.background
, ppVisible = xmobarColor S.foreground S.background
, ppHidden = xmobarColor S.foreground S.background
, ppHiddenNoWindows = xmobarColor S.backgroundhl S.background
}
currentPP = def
{ ppCurrent = xmobarColor' N.orange
, ppVisible = xmobarColor' N.yellow -- other screen
, ppHidden = xmobarColor' N.foreground -- other workspaces with windows
, ppHiddenNoWindows = xmobarColor' N.foregroundll -- other workspaces
{ ppCurrent = xmobarColor' S.orange
, ppVisible = xmobarColor' S.yellow -- other screen
, ppHidden = xmobarColor' S.foreground -- other workspaces with windows
, ppHiddenNoWindows = xmobarColor' S.foregroundll -- other workspaces
, ppSep = " "
, ppWsSep = " "
, ppLayout = printLayout

View File

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

@ -1,7 +1,7 @@
cabal-version: >=1.10
name: xmonad-config
version: 0.11.0.0
version: 0.9.9.9
-- synopsis:
-- description:
-- bug-reports:
@ -14,15 +14,10 @@ build-type: Simple
extra-source-files: CHANGELOG.md
executable xmonad
main-is: xmonad.hs
other-modules: KeyBindings
, MouseBindings
, Nord
, Password
, Projects
, Scratchpad
main-is: xmonad.hs
-- other-modules:
-- other-extensions:
build-depends: base
build-depends: base >=4.13 && <4.14
, X11
, directory
, filepath

View File

@ -8,16 +8,13 @@ import XMonad
import XMonad.Actions.DynamicProjects
import XMonad.Config.Desktop
import XMonad.Hooks.DynamicLog
--import XMonad.Hooks.EwmhDesktops (ewmh, ewmhFullscreen)
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.NoBorders (noBorders, smartBorders, hasBorder, BorderMessage (HasBorder))
import XMonad.Layout.NoBorders (noBorders, smartBorders)
import XMonad.Layout.ResizableTile (ResizableTall(..))
import XMonad.Layout.Spacing
import XMonad.Layout.ToggleLayouts (toggleLayouts)
import XMonad.Util.EZConfig
import qualified Nord as N
import qualified XMonad.Layout.Spacing as SS (Border(..))
import qualified Solarized as S
-- Tidy modules
import KeyBindings as Keys (modify)
@ -28,43 +25,44 @@ import Scratchpad (modify)
--------- toggle btw vvvvvvvvvv or vvvvv
layouts = toggleLayouts fullscreen tiled
where
smallBorder = SS.Border 5 5 5 5
fullscreen = noBorders Full
tiled = smarts $ resizableTall ||| Mirror resizableTall
smarts = spacingRaw True smallBorder True smallBorder True . smartBorders
fullscreen = (noBorders Full)
tiled = smarts $ resizableTall ||| (Mirror resizableTall)
smarts = (smartSpacingWithEdge 5) . smartBorders
resizableTall = ResizableTall 1 (5/100) (1/2) []
-- 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 = composeAll
[ className =? "Patchage" --> doShift "patchage"
, className =? "Pavucontrol" --> doShift "music"
, className =? "Pinentry" --> doCenterFloat
, className =? "REAPER" --> hasBorder False
, className =? "Renoise" --> hasBorder False
, className =? "steam" --> doShift "steam"
, className =? "steamwebhelper" --> doShift "steam"
, className =? "cs2" --> doShift "steam"
, isDialog --> doCenterFloat
myManageHook = composeOne
[ className =? "Pavucontrol" -?> doShift "music"
, className =? "Pinentry" -?> doFloat
, className =? "Steam" -?> doShift "steam"
, className =? "VirtualBox" -?> doFloat
, className =? "csgo_linux64" -?> doShift "csgo"
, className =? "mpv" -?> doFullFloat <+> (doShift "flims")
, className =? "qemu-system-x86_64" -?> doFloat
, className =? "qutebrowser" -?> doShift "web"
, className =? "Wine System Tray" -?> doShift "wine"
, className =? "Blizzard Battle.net" -?> doShift "battlenet"
, isDialog -?> doCenterFloat
, isDialog -?> doCenterFloat
-- Move transient windows to their parent:
, transience'
, transience
]
------------ build the full config
withConfig =
ewmh
$ Projects.modify -- Apply projects config
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
{ manageHook = myManageHook
{ manageHook = myManageHook <+> manageHook desktopConfig
, layoutHook = desktopLayoutModifiers layouts
, terminal = "kitty"
, normalBorderColor = N.backgroundhl
, focusedBorderColor = N.nord9
, terminal = "/run/current-system/sw/bin/st"
, normalBorderColor = S.base03
, focusedBorderColor = S.violet
, borderWidth = 5
}