Skip to content

Commit 3d2ca88

Browse files
committed
init commit
0 parents  commit 3d2ca88

File tree

13 files changed

+701
-0
lines changed

13 files changed

+701
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.stack-work/
2+
*~

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Xmonanza
2+
##### XMonad and Xmobar monorepo for sharing code between them, build with stack
3+
4+
1. Edit `src/AConfig.hs` (atleast iconpath (check xmobar/Main.hs for icons used))
5+
1. `stack install`
6+
`xmonad-afreak` and `xmobar-afreak` will then be created in `~/.local/bin` or `local-bin-path`
7+
(`~/.local/bin` needs to be in `$PATH`)
8+
1. Copy custom buildscript for xmonad `cp scripts/build ~/.xmonad/` and edit script to correct paths
9+
1. Link from `xmonad-afreak` -> `xmonad` somewhere in `$PATH` e.g. `ln -s ~/.local/bin/xmonad-afreak ~/.local/bin/xmonad`
10+
(not sure why, but `--restart` doesnt work properly if `xmonad` is not in `$PATH`)
11+
1. Append `xmonad` or `xmonad-afreak` to .xinitrc
12+
1. startx

Setup.hs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

app/Main.hs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Main where
2+
3+
import Lib
4+
5+
main :: IO ()
6+
main = someFunc

package.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: xmonanza
2+
version: 0.1.0.0
3+
github: "afreak/xmonanza"
4+
license: BSD3
5+
author: "Afreak"
6+
7+
extra-source-files:
8+
- README.md
9+
10+
# Metadata used when publishing your package
11+
# synopsis: Short description of your package
12+
# category: Web
13+
14+
# To avoid duplicated efforts in documentation and dealing with the
15+
# complications of embedding Haddock markup inside cabal files, it is
16+
# common to point users to the README.md file.
17+
description: Please see the README on GitHub at <https://github.com/afreakk/xmonanza#readme>
18+
19+
dependencies:
20+
- base >= 4.7 && < 5
21+
22+
library:
23+
source-dirs: src
24+
dependencies:
25+
- directory
26+
27+
executables:
28+
xmonad-afreak:
29+
main: Main.hs
30+
source-dirs: xmonad
31+
ghc-options:
32+
- -threaded
33+
- -rtsopts
34+
- -with-rtsopts=-N
35+
- -Wall
36+
- -fwarn-tabs
37+
- -O2
38+
dependencies:
39+
- containers
40+
- xmonanza
41+
- X11
42+
- xmonad
43+
- xmonad-contrib
44+
xmobar-afreak:
45+
main: Main.hs
46+
source-dirs: xmobar
47+
ghc-options:
48+
- -threaded
49+
- -rtsopts
50+
- -with-rtsopts=-N
51+
- -Wall
52+
- -fwarn-tabs
53+
- -O2
54+
dependencies:
55+
- xmobar
56+
- xmonanza
57+
58+
tests:
59+
xmonanza-test:
60+
main: Spec.hs
61+
source-dirs: test
62+
ghc-options:
63+
- -threaded
64+
- -rtsopts
65+
- -with-rtsopts=-N
66+
dependencies:
67+
- xmonanza

scripts/build

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
# The directory holding your source code and stack.yaml file:
3+
SRC_DIR=~/coding/xmonanza/
4+
# The name of the executable produced by stack. This comes from the
5+
# executable section of your *.cabal or package.yaml file.
6+
EXE_NAME=xmonad-afreak
7+
# Unset STACK_YAML, to ensure that $SRC_DIR/stack.yaml is used.
8+
unset STACK_YAML
9+
#
10+
# Do the build.
11+
cd $SRC_DIR
12+
stack build
13+
14+
# Create a hard link at the requested destination, replacing any existing one.
15+
ln -f -T $(stack exec -- which $EXE_NAME) $1

src/AConfig.hs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module AConfig (getConfig, AConfig(..)) where
2+
3+
data AConfig = AConfig
4+
{ cl_black :: String
5+
, cl_grey :: String
6+
, cl_red :: String
7+
, cl_aqua :: String
8+
, cl_lilly :: String
9+
, cl_font :: String
10+
, cl_iconRoot :: String
11+
, cl_barHeight :: Int
12+
} deriving (Show)
13+
14+
getConfig :: AConfig
15+
getConfig = AConfig
16+
{ cl_black = "#2D2D2D"
17+
, cl_grey = "#CCCCCC"
18+
, cl_red = "#F2777A"
19+
, cl_aqua = "#66CCCC"
20+
, cl_lilly = "#CC99CC"
21+
, cl_font = "xft:Hack:size=14:Regular:antialias=true"
22+
, cl_iconRoot="/home/afreak/icons"
23+
, cl_barHeight=25
24+
}
25+

stack.yaml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This file was automatically generated by 'stack init'
2+
#
3+
# Some commonly used options have been documented as comments in this file.
4+
# For advanced use and comprehensive documentation of the format, please see:
5+
# https://docs.haskellstack.org/en/stable/yaml_configuration/
6+
7+
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
8+
# A snapshot resolver dictates the compiler version and the set of packages
9+
# to be used for project dependencies. For example:
10+
#
11+
# resolver: lts-3.5
12+
# resolver: nightly-2015-09-21
13+
# resolver: ghc-7.10.2
14+
#
15+
# The location of a snapshot can be provided as a file or url. Stack assumes
16+
# a snapshot provided as a file might change, whereas a url resource does not.
17+
#
18+
# resolver: ./custom-snapshot.yaml
19+
# resolver: https://example.com/snapshots/2018-01-01.yaml
20+
resolver: lts-16.1
21+
22+
# User packages to be built.
23+
# Various formats can be used as shown in the example below.
24+
#
25+
# packages:
26+
# - some-directory
27+
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
28+
# subdirs:
29+
# - auto-update
30+
# - wai
31+
packages:
32+
- .
33+
# Dependency packages to be pulled from upstream that are not in the resolver.
34+
# These entries can reference officially published versions as well as
35+
# forks / in-progress versions pinned to a git hash. For example:
36+
#
37+
# extra-deps:
38+
# - acme-missiles-0.3
39+
# - git: https://github.com/commercialhaskell/stack.git
40+
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
41+
#
42+
# extra-deps: []
43+
extra-deps:
44+
- xmobar-0.34
45+
rebuild-ghc-options: true
46+
flags:
47+
xmobar:
48+
with_xft: true
49+
with_alsa: true
50+
51+
# Override default flag values for local packages and extra-deps
52+
# flags: {}
53+
54+
# Extra package databases containing global packages
55+
# extra-package-dbs: []
56+
57+
# Control whether we use the GHC we find on the path
58+
# system-ghc: true
59+
#
60+
# Require a specific version of stack, using version ranges
61+
# require-stack-version: -any # Default
62+
# require-stack-version: ">=2.3"
63+
#
64+
# Override the architecture used by stack, especially useful on Windows
65+
# arch: i386
66+
# arch: x86_64
67+
#
68+
# Extra directories used by stack for building
69+
# extra-include-dirs: [/path/to/dir]
70+
# extra-lib-dirs: [/path/to/dir]
71+
#
72+
# Allow a newer minor version of GHC than the snapshot specifies
73+
# compiler-check: newer-minor

stack.yaml.lock

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file was autogenerated by Stack.
2+
# You should not edit this file by hand.
3+
# For more information, please see the documentation at:
4+
# https://docs.haskellstack.org/en/stable/lock_files
5+
6+
packages:
7+
- completed:
8+
hackage: xmobar-0.34@sha256:6022fc7678d668826eaa248acf8d8f3e1e3bb1a5f9469cbcbf341002ccb6e307,11617
9+
pantry-tree:
10+
size: 6270
11+
sha256: 8a6f9dacffd9faf1c090a9d91d3f8e9f2e155ac797a9117fc03bb27e215fe68f
12+
original:
13+
hackage: xmobar-0.34
14+
snapshots:
15+
- completed:
16+
size: 531237
17+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/1.yaml
18+
sha256: 954b6b14b0c8130732cf4773f7ebb4efc9a44600d1a5265d142868bf93462bc6
19+
original: lts-16.1

test/Spec.hs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
main :: IO ()
2+
main = putStrLn "Test suite not yet implemented"

xmobar/Main.hs

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import Xmobar
2+
import AConfig (getConfig, AConfig (..))
3+
4+
config :: AConfig -> Config
5+
config cnf =
6+
Config { verbose = False
7+
, wmClass = "xmobar"
8+
, wmName = "xmobar"
9+
, border = NoBorder
10+
, borderColor = "#BFBFBF"
11+
, borderWidth = 1
12+
, textOffsets = []
13+
, font = cl_font cnf
14+
, additionalFonts = []
15+
, bgColor = cl_black cnf
16+
, fgColor = cl_grey cnf
17+
, alpha = 150
18+
-- , position = Top
19+
, position = TopSize L 100 (cl_barHeight cnf)
20+
, textOffset = -1
21+
, iconOffset = -1
22+
, lowerOnStart = True
23+
, pickBroadest = False
24+
, persistent = False
25+
, hideOnStart = False
26+
, iconRoot = cl_iconRoot cnf
27+
, allDesktops = True
28+
, overrideRedirect = True
29+
, commands = [ Run $ Network "enp0s31f6" ["-L","0","-H","32000", "-m", "3", "--normal",cl_aqua cnf,"--high",cl_red cnf, "-t", "<rx>KB|<tx>KB"] 50
30+
, Run $ MultiCpu [ "--low", cl_aqua cnf, "--normal",cl_aqua cnf,"--high",cl_red cnf, "-t", "<total>%"] 50
31+
, Run $ Memory ["-t","<usedratio>%", "-L", "0", "-H", "90", "--normal",cl_aqua cnf,"--high",cl_red cnf, "-m", "2"] 50
32+
, Run $ Date "%a %b %_d %H:%M" "date" 600
33+
, Run $ Alsa "default" "Master" ["-t", "<volume>%", "--low", cl_aqua cnf, "--normal",cl_aqua cnf,"--high",cl_red cnf]
34+
, Run $ Com "nvidia-settings" ["-t","-q","[gpu:0]/GPUCoreTemp" ] "gputemp" 50
35+
, Run $ MultiCoreTemp [ "--low", cl_aqua cnf, "--normal",cl_aqua cnf,"--high",cl_red cnf, "-t", "<avg>°C"] 50
36+
, Run $ CatInt 0 "/sys/devices/platform/nct6775.2592/hwmon/hwmon3/fan2_input" [
37+
"-L", "0", "-H", "1082", "--normal",cl_aqua cnf,"--high",cl_red cnf] 50
38+
, Run $ StdinReader
39+
]
40+
, sepChar = "%"
41+
, alignSep = "}{"
42+
, template = "%StdinReader%}\
43+
\{<icon=volume.xpm/> %alsa:default:Master% | %enp0s31f6% | <icon=memory.xpm/> %memory% | <icon=cpu.xpm/> %multicpu% %multicoretemp% %cat0% | <icon=gpu.xpm/> %gputemp%°C | <fc=" ++ cl_lilly cnf ++ ">%date%</fc>"
44+
}
45+
46+
main :: IO ()
47+
main = xmobar $ config getConfig
48+

0 commit comments

Comments
 (0)