diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..336e959 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# files produced by compiler +*.o +*.hi +*.errors + +# compiled xmonad executable +xmonad-* + +# files used by stack +.stack-work/ + +# directory created by `build` script +bin/ + +# files automatically created by xmonad +xmonad.state diff --git a/build b/build new file mode 100755 index 0000000..aef5317 --- /dev/null +++ b/build @@ -0,0 +1,9 @@ +#!/bin/sh +# +# As of 0.13, xmonad --recompile will look for a custom build script. + +set -e + +stack build :my-xmonad --verbosity error +stack install :my-xmonad --local-bin-path bin/ --verbosity error +mv bin/my-xmonad "$HOME/.local/bin/xmonad" diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 0000000..04a4a5b --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1 @@ +# This file is included so that a `lib/` directory will be created. diff --git a/my-xmonad.cabal b/my-xmonad.cabal new file mode 100644 index 0000000..c47bc60 --- /dev/null +++ b/my-xmonad.cabal @@ -0,0 +1,15 @@ +name: my-xmonad +version: 0.1.0.0 +build-type: Simple +cabal-version: >=1.10 + +executable my-xmonad + main-is: ../xmonad.hs + -- other-modules lists custom modules in my ~/.xmonad/lib/ directory + other-modules: + build-depends: base + , xmonad >= 0.13 + , xmonad-contrib >= 0.13 + hs-source-dirs: lib + default-language: Haskell2010 + ghc-options: -Wall -Werror -fno-warn-missing-signatures -threaded diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..f5b329d --- /dev/null +++ b/stack.yaml @@ -0,0 +1,66 @@ +# 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: lts-14.12 + +# 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: +- . +# 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.1" +# +# 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: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir] +# +# Allow a newer minor version of GHC than the snapshot specifies +# compiler-check: newer-minor diff --git a/xmonad.hs b/xmonad.hs new file mode 100644 index 0000000..bb9abef --- /dev/null +++ b/xmonad.hs @@ -0,0 +1,78 @@ +-------------------------------------------------------------------------------- +-- | Example.hs +-- +-- Example configuration file for xmonad using the latest recommended +-- features (e.g., 'desktopConfig'). +module Main (main) where + +-------------------------------------------------------------------------------- +import System.Exit +import XMonad +import XMonad.Config.Desktop +import XMonad.Hooks.DynamicLog +import XMonad.Hooks.ManageHelpers +import XMonad.Layout.BinarySpacePartition (emptyBSP) +import XMonad.Layout.NoBorders (noBorders) +import XMonad.Layout.ResizableTile (ResizableTall(..)) +import XMonad.Layout.ToggleLayouts (ToggleLayout(..), toggleLayouts) +import XMonad.Prompt +import XMonad.Prompt.ConfirmPrompt +import XMonad.Prompt.Shell +import XMonad.Util.EZConfig + +-------------------------------------------------------------------------------- +main = do + spawn "xmobar" -- Start a task bar such as xmobar. + + -- Start xmonad using the main desktop configuration with a few + -- simple overrides: + xmonad $ desktopConfig + { modMask = mod4Mask -- Use the "Win" key for the mod key + , manageHook = myManageHook <+> manageHook desktopConfig + , layoutHook = desktopLayoutModifiers $ myLayouts + , logHook = dynamicLogString def >>= xmonadPropLog + } + + `additionalKeysP` -- Add some extra key bindings: + [ ("M-S-q", confirmPrompt myXPConfig "exit" (io exitSuccess)) + , ("M-p", shellPrompt myXPConfig) + , ("M-", sendMessage (Toggle "Full")) + ] + +-------------------------------------------------------------------------------- +-- | Customize layouts. +-- +-- This layout configuration uses two primary layouts, 'ResizableTall' +-- and 'BinarySpacePartition'. You can also use the 'M-' key +-- binding defined above to toggle between the current layout and a +-- full screen layout. +myLayouts = toggleLayouts (noBorders Full) others + where + others = ResizableTall 1 (1.5/100) (3/5) [] ||| emptyBSP + +-------------------------------------------------------------------------------- +-- | Customize the way 'XMonad.Prompt' looks and behaves. It's a +-- great replacement for dzen. +myXPConfig = def + { position = Top + , alwaysHighlight = True + , promptBorderWidth = 0 + , font = "xft:monospace:size=9" + } + +-------------------------------------------------------------------------------- +-- | Manipulate windows as they are created. The list given to +-- @composeOne@ is processed from top to bottom. The first matching +-- rule wins. +-- +-- Use the `xprop' tool to get the info you need for these matches. +-- For className, use the second value that xprop gives you. +myManageHook = composeOne + [ className =? "Pidgin" -?> doFloat + , className =? "XCalc" -?> doFloat + , className =? "mpv" -?> doFloat + , isDialog -?> doCenterFloat + + -- Move transient windows to their parent: + , transience + ]