Compare commits
4 commits
594c0e99a9
...
84da4517cd
| Author | SHA1 | Date | |
|---|---|---|---|
| 84da4517cd | |||
| b0bf75382b | |||
| 58b110833a | |||
| 3a62b6bd8a |
7 changed files with 333 additions and 51 deletions
18
flake.lock
generated
18
flake.lock
generated
|
|
@ -53,11 +53,11 @@
|
|||
},
|
||||
"haskell-flake": {
|
||||
"locked": {
|
||||
"lastModified": 1738519333,
|
||||
"narHash": "sha256-QK7DIUmUC76cEBlntkDyBrhrZMD5fioCT2Xd6RbA8a8=",
|
||||
"lastModified": 1739713768,
|
||||
"narHash": "sha256-P8I3uARBkSra86d5lgTo7cK+ET27zVee1BxWrym+9z8=",
|
||||
"owner": "srid",
|
||||
"repo": "haskell-flake",
|
||||
"rev": "dcca937807b7190934118ae476865301885aef15",
|
||||
"rev": "b40fcefa008ffa7205058f542a577cc218bec9a4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -68,11 +68,11 @@
|
|||
},
|
||||
"nixos-unified": {
|
||||
"locked": {
|
||||
"lastModified": 1738770348,
|
||||
"narHash": "sha256-PQYCNoZ0QvaX8kmMVTaPn8z+EDPsl0tZG3+o0Z1+9CM=",
|
||||
"lastModified": 1739631166,
|
||||
"narHash": "sha256-BvGPP1MwuRZMK+4RLvMOQYUs15n5JA7BDH6TsXlsAU0=",
|
||||
"owner": "srid",
|
||||
"repo": "nixos-unified",
|
||||
"rev": "be4ce51cae1dda99e8fd57036215b19ef37bd7fd",
|
||||
"rev": "f9598ba02ad38df238a5987ad78ffac4845b7f3a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -83,11 +83,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1738734093,
|
||||
"narHash": "sha256-UEYOKfXXKU49fR7dGB05As0s2pGbLK4xDo48Qtdm7xs=",
|
||||
"lastModified": 1739863612,
|
||||
"narHash": "sha256-UbtgxplOhFcyjBcNbTVO8+HUHAl/WXFDOb6LvqShiZo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5b2753b0356d1c951d7a3ef1d086ba5a71fff43c",
|
||||
"rev": "632f04521e847173c54fa72973ec6c39a371211c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
11
justfile
11
justfile
|
|
@ -1,3 +1,4 @@
|
|||
# List available recipes
|
||||
default:
|
||||
@just --list
|
||||
|
||||
|
|
@ -10,6 +11,10 @@ docs:
|
|||
repl *ARGS:
|
||||
cabal repl {{ ARGS }}
|
||||
|
||||
# Run ghcid -- auto-recompile and run `main` function
|
||||
run:
|
||||
ghcid -T :main
|
||||
# Run cabal build
|
||||
build *ARGS:
|
||||
cabal build {{ ARGS }}
|
||||
|
||||
# Run cabal run
|
||||
run *ARGS:
|
||||
cabal run {{ ARGS }}
|
||||
|
|
|
|||
20
src/Main.hs
20
src/Main.hs
|
|
@ -1,20 +0,0 @@
|
|||
module Main where
|
||||
|
||||
import Main.Utf8 qualified as Utf8
|
||||
|
||||
data Example = Example
|
||||
{ name :: Text
|
||||
, age :: Int
|
||||
}
|
||||
deriving stock (Show, Eq)
|
||||
|
||||
{- |
|
||||
Main entry point.
|
||||
|
||||
`just run` will invoke this function.
|
||||
-}
|
||||
main :: IO ()
|
||||
main = do
|
||||
-- For withUtf8, see https://serokell.io/blog/haskell-with-utf8
|
||||
Utf8.withUtf8 $ do
|
||||
putTextLn "Hello 🌎 (from xmonad-config)"
|
||||
50
src/XMonadConfig/GruvboxMaterial.hs
Normal file
50
src/XMonadConfig/GruvboxMaterial.hs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
-- |
|
||||
-- Module: XMonadConfig.GruvboxMaterial
|
||||
-- Author: Jasmine Marie Wilson
|
||||
--
|
||||
-- Creates xmobar escape codes for use in our status bar,
|
||||
-- Based on Gruvbox Material Dark and Hard by sainnhe.
|
||||
module XMonadConfig.GruvboxMaterial
|
||||
( background
|
||||
, foreground
|
||||
, bg0
|
||||
, bg1
|
||||
, fg0
|
||||
, fg1
|
||||
, red
|
||||
, orange
|
||||
, yellow
|
||||
, green
|
||||
, aqua
|
||||
, blue
|
||||
, purple
|
||||
, grey0
|
||||
, grey1
|
||||
, grey2
|
||||
) where
|
||||
|
||||
import XMonad.Hooks.StatusBar.PP (xmobarColor)
|
||||
|
||||
background :: String
|
||||
background = "#1d2021"
|
||||
|
||||
foreground :: String
|
||||
foreground = "#d4be98"
|
||||
|
||||
bg0, bg1, fg0, fg1, red, orange, yellow, green, aqua, blue, purple, grey0, grey1, grey2 :: String -> String
|
||||
{- FOURMOLU_DISABLE -}
|
||||
bg0 = xmobarColor "#1d2021" ""
|
||||
bg1 = xmobarColor "#282828" ""
|
||||
fg0 = xmobarColor "#d4be98" ""
|
||||
fg1 = xmobarColor "#ddc7a1" ""
|
||||
red = xmobarColor "#ea6962" ""
|
||||
orange = xmobarColor "#e78a4e" ""
|
||||
yellow = xmobarColor "#d8a657" ""
|
||||
green = xmobarColor "#a9b665" ""
|
||||
aqua = xmobarColor "#89b482" ""
|
||||
blue = xmobarColor "#7daea3" ""
|
||||
purple = xmobarColor "#d3869b" ""
|
||||
grey0 = xmobarColor "#7c6f64" ""
|
||||
grey1 = xmobarColor "#928374" ""
|
||||
grey2 = xmobarColor "#a89984" ""
|
||||
{- FOURMOLU_ENABLE -}
|
||||
98
src/xmobar.hs
Normal file
98
src/xmobar.hs
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
import Xmobar
|
||||
|
||||
import XMonad.Hooks.StatusBar.PP (wrap)
|
||||
|
||||
import XMonadConfig.GruvboxMaterial
|
||||
|
||||
-- | Configures how things should be displayed on the bar
|
||||
config :: Config
|
||||
config =
|
||||
defaultConfig
|
||||
{ font = "Fira Code Semi Bold 9"
|
||||
, additionalFonts = ["Symbols Nerd Font 2048-em 24"]
|
||||
, bgColor = background
|
||||
, fgColor = foreground
|
||||
, position = Static {xpos = 1920, ypos = 0, width = 2560, height = 24}
|
||||
, commands = myCommands
|
||||
, sepChar = "%"
|
||||
, alignSep = "}{"
|
||||
, -- The output template is how xmobar will end up printing all of our configured commands.
|
||||
template =
|
||||
myLogo
|
||||
++ wrap " " " " (green "%uname%")
|
||||
++ "%uptime%"
|
||||
++ "%_XMONAD_LOG_1%"
|
||||
++ "} %date% {"
|
||||
++ "%YPJT% %disku%"
|
||||
}
|
||||
where
|
||||
myLogo :: String
|
||||
myLogo = wrap " " " " "<fn=1>\59255</fn>"
|
||||
|
||||
-- Commands to run xmobar modules on start
|
||||
myCommands :: [Runnable]
|
||||
myCommands =
|
||||
[ -- XPropertyLog PropName
|
||||
Run $ XPropertyLog "_XMONAD_LOG_1"
|
||||
, -- Com ProgramName Args Alias RefreshRate
|
||||
Run $
|
||||
Com
|
||||
"uname"
|
||||
["-r", "-s"]
|
||||
""
|
||||
(0 `seconds`)
|
||||
, -- Date Format Alias RefreshRate
|
||||
Run $
|
||||
Date
|
||||
(grey2 "%a %b %_d %Y " ++ yellow "%H:%M:%S")
|
||||
"date"
|
||||
(1 `seconds`)
|
||||
, -- Weather StationID Args RefreshRate
|
||||
Run $
|
||||
Weather
|
||||
"YPJT"
|
||||
[ "--template"
|
||||
, inWrapper (ppTitle "Temp" ++ green "<tempC>C")
|
||||
++ inWrapper (ppTitle "Wind" ++ purple "<windKmh>km/h")
|
||||
++ inWrapper (ppTitle "Humidity" ++ blue "<rh>%")
|
||||
]
|
||||
(30 `minutes`)
|
||||
, -- DiskU Disks Args RefreshRate
|
||||
Run $
|
||||
DiskU
|
||||
[ ("/", inWrapper' (ppTitle "System" ++ ppDiskSpace))
|
||||
, ("/home/sajenim", inWrapper' (ppTitle "Home" ++ ppDiskSpace))
|
||||
]
|
||||
[]
|
||||
(30 `minutes`)
|
||||
, -- Uptime Args RefreshRate
|
||||
Run $
|
||||
Uptime
|
||||
[ "--template"
|
||||
, inWrapper (ppTitle "Uptime" ++ red "<days>d <hours>h <minutes>m")
|
||||
]
|
||||
(60 `seconds`)
|
||||
]
|
||||
where
|
||||
-- Stylistic formatting
|
||||
ppDiskSpace :: String
|
||||
ppDiskSpace = orange "<used>" ++ grey0 "/" ++ aqua "<free>"
|
||||
|
||||
-- Convenience functions
|
||||
seconds :: Int -> Int
|
||||
seconds = (* 10)
|
||||
|
||||
minutes :: Int -> Int
|
||||
minutes = (60 *) . seconds
|
||||
|
||||
ppTitle :: String -> String
|
||||
ppTitle = wrap "" ": " . grey2
|
||||
|
||||
inWrapper :: String -> String
|
||||
inWrapper = wrap (grey0 " [ ") (grey0 " ] ")
|
||||
|
||||
inWrapper' :: String -> String
|
||||
inWrapper' = wrap (grey0 "[ ") (grey0 " ] ")
|
||||
|
||||
main :: IO ()
|
||||
main = configFromArgs config >>= xmobar
|
||||
143
src/xmonad.hs
Normal file
143
src/xmonad.hs
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
import Graphics.X11.ExtraTypes.XF86
|
||||
import XMonad
|
||||
import XMonad.Actions.CycleWS
|
||||
import XMonad.Hooks.DynamicLog
|
||||
import XMonad.Hooks.EwmhDesktops
|
||||
import XMonad.Hooks.ManageDocks
|
||||
import XMonad.Hooks.StatusBar
|
||||
import XMonad.Layout.BinarySpacePartition
|
||||
import XMonad.Layout.NoBorders
|
||||
import XMonad.Layout.Renamed
|
||||
import XMonad.Layout.Spacing
|
||||
import XMonad.StackSet qualified as W
|
||||
import XMonad.Util.EZConfig (additionalKeys)
|
||||
import XMonadConfig.GruvboxMaterial
|
||||
|
||||
{- FOURMOLU_DISABLE -}
|
||||
|
||||
-- | The main function
|
||||
main :: IO ()
|
||||
main = xmonad
|
||||
. docks
|
||||
. ewmhFullscreen
|
||||
. ewmh
|
||||
. withSB myXmobar
|
||||
$ myConfig
|
||||
|
||||
myConfig = def
|
||||
{ modMask = myModMask
|
||||
, layoutHook = myLayouts
|
||||
, terminal = myTerminal
|
||||
, borderWidth = myBorderWidth
|
||||
, normalBorderColor = myNormalBorderColor
|
||||
, focusedBorderColor = myFocusedBorderColor
|
||||
, workspaces = myWorkspaces
|
||||
} `additionalKeys` myKeybindings
|
||||
|
||||
-- | Configuration
|
||||
myTerminal = "wezterm"
|
||||
myModMask = mod4Mask
|
||||
myBorderWidth = 3
|
||||
myNormalBorderColor = background
|
||||
myFocusedBorderColor = foreground
|
||||
myWorkspaces = ["code", "chat", "web", "games", "misc"]
|
||||
myLauncher = "rofi -modi run,calc -show run"
|
||||
myScrot = "scrot -s '%Y%m%d_%H%M%S.png' -e 'mv $f ~/Pictures/scrots/'"
|
||||
volumeDown = "pactl set-sink-volume @DEFAULT_SINK@ -10%"
|
||||
volumeUp = "pactl set-sink-volume @DEFAULT_SINK@ +10%"
|
||||
|
||||
-- | Keybindings
|
||||
myKeybindings =
|
||||
-- launching and killing programs
|
||||
[ ((myModMask, xK_Return), spawn myTerminal) -- %! Launch terminal
|
||||
, ((myModMask, xK_Tab ), spawn myLauncher) -- %! Launch rofi
|
||||
, ((myModMask, xK_s ), spawn myScrot ) -- %! Take screenshot
|
||||
, ((myModMask, xK_Escape), kill ) -- %! Close the focused window
|
||||
, ((myModMask .|. controlMask, xK_Escape), io exitSuccess ) -- %! Quit xmonad
|
||||
|
||||
-- multimedia
|
||||
, ((noModMask, xF86XK_AudioPlay ), spawn "mpc toggle") -- %! Play/Pause music
|
||||
, ((noModMask, xF86XK_AudioStop ), spawn "mpc stop" ) -- %! Stop music
|
||||
, ((noModMask, xF86XK_AudioNext ), spawn "mpc next" ) -- %! Next track
|
||||
, ((noModMask, xF86XK_AudioPrev ), spawn "mpc prev" ) -- %! Previous track
|
||||
, ((noModMask, xF86XK_AudioLowerVolume), spawn volumeDown ) -- %! Volume down
|
||||
, ((noModMask, xF86XK_AudioRaiseVolume), spawn volumeUp ) -- %! Volume up
|
||||
|
||||
-- layouts
|
||||
, ((myModMask, xK_t), sendMessage $ JumpToLayout "dynamic tiling" ) -- %! Jump to our tiled layout
|
||||
, ((myModMask, xK_b), sendMessage $ JumpToLayout "binary space partition") -- %! Jump to our bsp layout
|
||||
, ((myModMask, xK_m), sendMessage $ JumpToLayout "maximised" ) -- %! Jump to our maximized layout
|
||||
, ((myModMask, xK_f), sendMessage $ JumpToLayout "fullscreen" ) -- %! Jump to our fullscreen layout
|
||||
, ((myModMask .|. shiftMask, xK_t), withFocused $ windows . W.sink ) -- %! Push window back into tiling
|
||||
|
||||
-- window stack
|
||||
, ((myModMask, xK_Down), windows W.focusDown) -- %! Move focus to the next window
|
||||
, ((myModMask, xK_Up ), windows W.focusUp ) -- %! Move focus to the previous window
|
||||
, ((myModMask .|. shiftMask, xK_Down), windows W.swapDown ) -- %! Swap the focused window with the next window
|
||||
, ((myModMask .|. shiftMask, xK_Up ), windows W.swapUp ) -- %! Swap the focused window with the previous window
|
||||
|
||||
-- master slave
|
||||
, ((myModMask, xK_space ), windows W.focusMaster ) -- %! Move focus to the master window
|
||||
, ((myModMask .|. shiftMask, xK_space ), windows W.swapMaster ) -- %! Swap the focused window with the master window
|
||||
, ((myModMask, xK_Page_Up ), sendMessage Shrink ) -- %! Shrink the master area
|
||||
, ((myModMask, xK_Page_Down), sendMessage Expand ) -- %! Expand the master area
|
||||
, ((myModMask .|. shiftMask, xK_Page_Up ), sendMessage (IncMasterN 1) ) -- %! Increase the number of windows in the master area
|
||||
, ((myModMask .|. shiftMask, xK_Page_Down), sendMessage (IncMasterN (-1))) -- %! Decrease the number of windows in the master area
|
||||
|
||||
-- workspaces
|
||||
, ((myModMask, xK_Right), moveTo Next hiddenWS) -- %! Move focus to the next hidden workspace
|
||||
, ((myModMask, xK_Left ), moveTo Prev hiddenWS) -- %! Move focus to the previous hidden workspace
|
||||
, ((myModMask .|. shiftMask, xK_Right), shiftTo Next hiddenWS) -- %! Move focused window to the next hidden workspace
|
||||
, ((myModMask .|. shiftMask, xK_Left ), shiftTo Prev hiddenWS) -- %! Move focused window to the previous hidden workspace
|
||||
|
||||
-- monitors
|
||||
, ((myModMask, xK_End ), nextScreen ) -- %! Move focus to the next screen
|
||||
, ((myModMask, xK_Home), prevScreen ) -- %! Move focus to the previous screen
|
||||
, ((myModMask .|. shiftMask, xK_End ), shiftNextScreen) -- %! Move focused window to the next screen
|
||||
, ((myModMask .|. shiftMask, xK_Home), shiftPrevScreen) -- %! Move focused window to the previous screen
|
||||
|
||||
-- binary space partition
|
||||
, ((myModMask .|. mod1Mask, xK_Right ), sendMessage $ ExpandTowardsBy R 0.01) -- %! Expand window towards the right
|
||||
, ((myModMask .|. mod1Mask, xK_Left ), sendMessage $ ExpandTowardsBy L 0.01) -- %! Expand window towards the left
|
||||
, ((myModMask .|. mod1Mask, xK_Down ), sendMessage $ ExpandTowardsBy D 0.01) -- %! Expand window downwards
|
||||
, ((myModMask .|. mod1Mask, xK_Up ), sendMessage $ ExpandTowardsBy U 0.01) -- %! Expand window upwards
|
||||
, ((myModMask .|. mod1Mask .|. controlMask, xK_Right ), sendMessage $ ShrinkFromBy R 0.01) -- %! Shrink window from the right
|
||||
, ((myModMask .|. mod1Mask .|. controlMask, xK_Left ), sendMessage $ ShrinkFromBy L 0.01) -- %! Shrink window from the left
|
||||
, ((myModMask .|. mod1Mask .|. controlMask, xK_Down ), sendMessage $ ShrinkFromBy D 0.01) -- %! Shrink window downwards
|
||||
, ((myModMask .|. mod1Mask .|. controlMask, xK_Up ), sendMessage $ ShrinkFromBy U 0.01) -- %! Shrink window upwards
|
||||
, ((myModMask .|. mod1Mask, xK_Page_Up ), sendMessage Rotate ) -- %! Rotate a split (horizontal/vertical) in the BSP
|
||||
, ((myModMask .|. mod1Mask, xK_Page_Down), sendMessage Swap ) -- %! Swap the left child of a split with the right child of split
|
||||
, ((myModMask .|. mod1Mask, xK_Home ), sendMessage $ SplitShift Prev ) -- %! Shift window by splitting previous neighbour
|
||||
, ((myModMask .|. mod1Mask, xK_End ), sendMessage $ SplitShift Next ) -- %! Shift window by splitting next neighbour
|
||||
]
|
||||
|
||||
-- | Layouts
|
||||
myLayouts = myTile ||| myBsp ||| myMax ||| myFull
|
||||
where
|
||||
-- our layouts
|
||||
myTile = renamed [Replace "tile"] . avoidStruts . myGaps $ Tall nmaster delta ratio
|
||||
myBsp = renamed [Replace "bsp" ] . avoidStruts . myGaps $ emptyBSP
|
||||
myMax = renamed [Replace "max" ] . avoidStruts . myGaps $ Full
|
||||
myFull = renamed [Replace "full"] . noBorders $ Full
|
||||
-- add a configurable amount of space around windows.
|
||||
myGaps = spacingRaw False (Border 10 10 10 10) True (Border 10 10 10 10) True
|
||||
-- layout configuration
|
||||
nmaster = 1 -- Default number of windows in the master pane
|
||||
ratio = 2/3 -- Default proportion of screen occupied by master pane
|
||||
delta = 3/100 -- Percent of screen to increment by when resizing panes
|
||||
|
||||
-- | Statusbar
|
||||
myXmobar = statusBarPropTo "_XMONAD_LOG_1" "xmobar" (pure myXmobarPP)
|
||||
|
||||
myXmobarPP :: PP
|
||||
myXmobarPP = def
|
||||
{ ppSep = grey0 " | "
|
||||
, ppCurrent = purple . wrap " " ""
|
||||
, ppVisible = blue . wrap " " ""
|
||||
, ppHidden = grey0 . wrap " " ""
|
||||
, ppHiddenNoWindows = grey0 . wrap " " ""
|
||||
, ppUrgent = red . wrap " " ""
|
||||
, ppLayout = aqua . wrap "" ""
|
||||
, ppOrder = \[ws, l, _] -> [ws, l]
|
||||
}
|
||||
|
||||
|
|
@ -1,23 +1,13 @@
|
|||
cabal-version: 2.4
|
||||
cabal-version: 3.0
|
||||
name: xmonad-config
|
||||
version: 0.1.0.0
|
||||
license: MIT
|
||||
copyright: 2022 Jasmine Marie Wilson
|
||||
maintainer: srid@srid.ca
|
||||
author: Jasmine Marie Wilson
|
||||
category: Web
|
||||
homepage: https://srid.ca/xmonad-config
|
||||
|
||||
-- TODO: Before hackage release.
|
||||
-- A short (one-line) description of the package.
|
||||
synopsis: A template for Haskell projects using Nix
|
||||
|
||||
-- A longer description of the package.
|
||||
-- description:
|
||||
|
||||
-- A URL where users can report bugs.
|
||||
-- bug-reports:
|
||||
|
||||
maintainer: its.jassy@pm.me
|
||||
category: System
|
||||
homepage: https://git.sajenim.dev/xmonad-config
|
||||
synopsis: My personal xmonad + xmobar configuration
|
||||
bug-reports: https://git.sajenim.dev/jasmine/xmonad-config/issues
|
||||
extra-source-files:
|
||||
LICENSE
|
||||
README.md
|
||||
|
|
@ -63,6 +53,22 @@ common shared
|
|||
hs-source-dirs: src
|
||||
default-language: GHC2021
|
||||
|
||||
executable xmonad-config
|
||||
import: shared
|
||||
main-is: Main.hs
|
||||
executable xmobar
|
||||
import: shared
|
||||
ghc-options: -threaded
|
||||
build-depends:
|
||||
, xmobar
|
||||
, xmonad-contrib
|
||||
|
||||
other-modules: XMonadConfig.GruvboxMaterial
|
||||
main-is: xmobar.hs
|
||||
|
||||
executable xmonad
|
||||
import: shared
|
||||
build-depends:
|
||||
, X11
|
||||
, xmonad
|
||||
, xmonad-contrib
|
||||
|
||||
other-modules: XMonadConfig.GruvboxMaterial
|
||||
main-is: xmonad.hs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue