initial project setup

This commit is contained in:
qvalentin 2021-09-21 10:59:13 +02:00
commit 90fd606fb3
11 changed files with 363 additions and 0 deletions

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
dist
dist-*
cabal-dev
*.o
*.hi
*.hie
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "xmonad"]
path = xmonad
url = https://github.com/xmonad/xmonad
[submodule "xmonad-contrib"]
path = xmonad-contrib
url = https://github.com/xmonad/xmonad-contrib

22
hie.yaml Normal file
View File

@ -0,0 +1,22 @@
cradle:
stack:
- path: "xmonad/src"
component: "xmonad:lib"
- path: "xmonad/./Main.hs"
component: "xmonad:exe:xmonad"
- path: "xmonad/tests"
component: "xmonad:test:properties"
- path: "xmonad-contrib/./"
component: "xmonad-contrib:lib"
- path: "xmonad-contrib/tests"
component: "xmonad-contrib:test:tests"
- path: "xmonad-contrib/."
component: "xmonad-contrib:test:tests"
- path: "././xmonad.hs"
component: "xmonad-qv:lib"

40
package.yaml Normal file
View File

@ -0,0 +1,40 @@
---
name: xmonad-qv
version: "0.1.0.0"
github: "qvalentin/xmonad"
license: GPL-3.0
author: "qvalentin"
maintainer: "qvalentin"
copyright: "GPL-3.0"
description: My xmonad Configuration
dependencies:
- base >= 4.7 && < 5
- xmonad
- xmonad-contrib
ghc-options:
- -Wall
- -Wcompat
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wredundant-constraints
library:
source-dirs: src
executable:
main: xmonad.hs
other-modules: []
ghc-options:
- -i
- -ilib
- -v0
- -O2
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -Wall
dependencies:
- xmonad-qv

6
src/Lib.hs Normal file
View File

@ -0,0 +1,6 @@
module Lib
( someFunc
) where
someFunc :: IO ()
someFunc = putStrLn "someFunc"

69
stack.yaml Normal file
View File

@ -0,0 +1,69 @@
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
#
# The location of a snapshot can be provided as a file or url. Stack assumes
# a snapshot provided as a file might change, whereas a url resource does not.
#
# Resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/10.yaml
# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# subdirs:
# - auto-update
# - wai
packages:
- .
- xmonad
- xmonad-contrib
# Dependency packages to be pulled from upstream that are not in the resolver.
# These entries can reference officially published versions as well as
# forks / in-progress versions pinned to a git hash. For example:
#
# extra-deps:
# - acme-missiles-0.3
# - git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
#
# extra-deps: []
# Override default flag values for local packages and extra-deps
# flags: {}
# Extra package databases containing global packages
# extra-package-dbs: []
# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=2.7"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
#extra-include-dirs: [/home/qv/.config/xmonad/Lib]
#extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor

13
stack.yaml.lock Normal file
View File

@ -0,0 +1,13 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
snapshots:
- original:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/10.yaml
completed:
sha256: 88b4f81e162ba3adc230a9fcccc4d19ac116377656bab56c7382ca88598b257a
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/10.yaml
size: 587546
packages: []

1
xmonad Submodule

@ -0,0 +1 @@
Subproject commit 33a86c0cdb9aa481e23cc5527a997adef5e32d42

1
xmonad-contrib Submodule

@ -0,0 +1 @@
Subproject commit 0c6fdf4e75dd4d31bc8423010fbabbab7c23ee03

44
xmonad-qv.cabal Normal file
View File

@ -0,0 +1,44 @@
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack
name: xmonad-qv
version: 0.1.0.0
description: My xmonad Configuration
homepage: https://github.com/qvalentin/xmonad#readme
bug-reports: https://github.com/qvalentin/xmonad/issues
author: qvalentin
maintainer: qvalentin
copyright: GPL-3.0
license: GPL-3.0
build-type: Simple
source-repository head
type: git
location: https://github.com/qvalentin/xmonad
library
exposed-modules:
Lib
other-modules:
Paths_xmonad_qv
hs-source-dirs:
src
ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
build-depends:
base >=4.7 && <5
, xmonad
, xmonad-contrib
default-language: Haskell2010
executable xmonad-qv
main-is: xmonad.hs
ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -i -ilib -v0 -O2 -threaded -rtsopts -with-rtsopts=-N -Wall
build-depends:
base >=4.7 && <5
, xmonad
, xmonad-contrib
, xmonad-qv
default-language: Haskell2010

138
xmonad.hs Normal file
View File

@ -0,0 +1,138 @@
import Control.Monad (liftM2)
import qualified Data.Monoid
import XMonad
import XMonad.Actions.WindowGo
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.StatusBar
import qualified XMonad.Layout.LayoutModifier
import XMonad.Layout.Spacing
import XMonad.Layout.WindowNavigation
import XMonad.StackSet (Workspace (tag), currentTag, integrate', stack, greedyView, shift)
import XMonad.Util.EZConfig
import XMonad.Util.Loggers
import XMonad.Util.SpawnOnce
import XMonad.Util.Ungrab
import XMonad.Util.WorkspaceCompare (getSortByIndex)
import XMonad.Hooks.InsertPosition (insertPosition, Position(Master, End), Focus (Newer))
main :: IO ()
main = do
colors <- getWalColors
xmonad . ewmhFullscreen . ewmh
. withEasySB (statusBarProp "xmobar ~/.config/xmobar/xmobarrc" (pure $ myXmobarPP colors)) defToggleStrutsKey
$ def
{ modMask = mod4Mask,
terminal = "st",
startupHook = myStartupHook,
normalBorderColor = colors !! 10,
focusedBorderColor = colors !! 12,
workspaces = myWorkspaces,
manageHook = myManageHook,
layoutHook = myLayout
}
`additionalKeysP` [ ("M-S-z", spawn "xscreensaver-command -lock"),
("M-S-s", unGrab *> spawn "scrot -s"),
("M-f", runOrRaise "brave" (className =? "Brave-browser")),
-- audio settings
("<XF86AudioLowerVolume>", spawn "amixer set Master 5%- unmute"),
("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+ unmute"),
("<XF86AudioMute>", spawn "amixer set Master toggle"),
-- window navigation
("M-l", sendMessage $ Go R),
("M-h", sendMessage $ Go L)
]
myXmobarPP :: [String] -> PP
myXmobarPP colors =
def
{ ppSep = magenta "",
ppTitleSanitize = xmobarStrip,
ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2,
ppHidden = white . wrap " " "",
ppHiddenNoWindows = white . wrap " " "",
ppUrgent = red . wrap (yellow "!") (yellow "!"),
ppOrder = \[ws, l, _, wins] -> [ws, l, wins],
ppExtras = [logTitles formatFocused formatUnfocused],
ppSort = hideWorkspaces
}
where
formatFocused = wrap (white "[") (white "]") . (xmobarColor (colors !! 7) "") . ppWindow
formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . (xmobarColor (colors !! 4) "") . ppWindow
ppWindow :: String -> String
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
blue, lowWhite, magenta, red, white, yellow :: String -> String
magenta = xmobarColor "#ff79c6" ""
blue = xmobarColor "#bd93f9" ""
white = xmobarColor "#f8f8f2" ""
yellow = xmobarColor "#f1fa8c" ""
red = xmobarColor "#ff5555" ""
lowWhite = xmobarColor "#bbbbbb" ""
hideWorkspaces = do
sortByIndex <- getSortByIndex
wsfilter <- thefilter
return (wsfilter . sortByIndex)
where
thefilter :: X ([WindowSpace] -> [WindowSpace])
--thefilter = filter ( not . isEmptyWs) . sortworkspaces
thefilter = do
currentWS <- withWindowSet (pure . currentTag)
return $ reverse . dropWhile (liftM2 (&&) ((currentWS /=) . tag) isEmptyWs) . reverse
where
isEmptyWs workspace = null $ integrate' $ stack workspace
myStartupHook :: X ()
myStartupHook = do
spawnOnce "picom &"
spawnOnce "sh $HOME/.fehbg"
getWalColors :: IO [String]
getWalColors = do
let file = "/home/qv/.cache/wal/colors"
contents <- readFile file
let colors = lines contents
return (colors ++ replicate (16 - length colors) "#000000")
mySpacing' :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
mySpacing' i = spacingRaw True (Border i i i i) True (Border i i i i) True
--myWorkspaces = [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "]
myWorkspaces :: [String]
myWorkspaces = show <$> [1 .. 9]
myLayout = windowNavigation tiled ||| Mirror tiled ||| Full
where
tiled = mySpacing' 8 $ Tall nmaster delta ratio
nmaster = 1 -- Default number of windows in the master pane
ratio = 1/2 -- Default proportion of screen occupied by master pane
delta = 3/100 -- Percent of screen to increment by when resizing panes
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
myManageHook =
composeAll
-- 'doFloat' forces a window to float. Useful for dialog boxes and such.
-- using 'doShift ( myWorkspaces !! 7)' sends program to workspace 8!
-- I'm doing it this way because otherwise I would have to write out the full
-- name of my workspaces and the names would be very long if using clickable workspaces.
[ className =? "confirm" --> doFloat,
className =? "file_progress" --> doFloat,
className =? "dialog" --> doFloat,
className =? "download" --> doFloat,
className =? "error" --> doFloat,
className =? "Gimp" --> doFloat,
className =? "notification" --> doFloat,
className =? "pinentry-gtk-2" --> doFloat,
className =? "splash" --> doFloat,
className =? "toolbar" --> doFloat,
title =? "Oracle VM VirtualBox Manager" --> doFloat,
title =? "Mozilla Firefox" --> viewShift (myWorkspaces !! 1),
title =? "Signal" --> viewShift (myWorkspaces !! 2),
className =? "TelegramDesktop" --> viewShift (myWorkspaces !! 2),
className =? "Gimp" --> doShift (myWorkspaces !! 8),
className =? "VirtualBox Manager" --> doShift (myWorkspaces !! 4),
(className =? "firefox" <&&> resource =? "Dialog") --> doFloat -- Float Firefox Dialog
] <+> insertPosition End Newer
where viewShift = doF . liftM2 (.) greedyView shift