Skip to content

Commit e1c97be

Browse files
authored
Merge pull request #2 from zmeadows/revival/2025
Revival/2025: Part 2
2 parents bc126d8 + b696a0f commit e1c97be

File tree

11 files changed

+997
-794
lines changed

11 files changed

+997
-794
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: CI — Linux build & test
3+
4+
on:
5+
push:
6+
branches: [main, master, revivals/**, "**"]
7+
pull_request:
8+
9+
# Avoid duplicate runs on the same ref
10+
concurrency:
11+
group: ci-${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
build:
19+
name: build & test (ghc ${{ matrix.ghc }})
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
ghc: ["9.6.7"]
25+
# When deps allow, expand:
26+
# ghc: ["9.6.7", "9.10.3", "9.12.2"]
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Install system deps (X11 etc.)
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y \
36+
build-essential pkg-config \
37+
libx11-dev libxrandr-dev libxinerama-dev libxext-dev libxss-dev
38+
39+
- name: Set up Haskell (GHC+Cabal)
40+
id: setup-hs
41+
uses: haskell-actions/setup@v2
42+
with:
43+
ghc-version: ${{ matrix.ghc }}
44+
cabal-version: latest
45+
46+
- name: Cache Cabal store
47+
uses: actions/cache@v4
48+
with:
49+
path: ${{ steps.setup-hs.outputs.cabal-store }}
50+
key: ${{ runner.os }}-cabal-${{ steps.setup-hs.outputs.ghc-version }}-${{ hashFiles('**/*.cabal', 'cabal.project*') }}
51+
restore-keys: |
52+
${{ runner.os }}-cabal-${{ steps.setup-hs.outputs.ghc-version }}-
53+
${{ runner.os }}-cabal-
54+
55+
- name: Show tool versions
56+
run: |
57+
ghc --version
58+
cabal --version
59+
60+
- name: Freeze solver plan (optional, keeps logs useful)
61+
run: cabal build all --dry-run
62+
63+
- name: Build
64+
run: cabal build all --enable-tests --enable-benchmarks
65+
66+
- name: Test
67+
run: cabal test --test-show-details=direct --keep-going
68+
69+
- name: cabal check (packaging sanity)
70+
run: cabal check

.github/workflows/lint.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: Lint — Ormolu, HLint, cabal check
3+
4+
on:
5+
push:
6+
branches: [main, master, revivals/**, "**"]
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
ormolu:
14+
name: Ormolu (format check)
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Run Ormolu
19+
uses: haskell-actions/run-ormolu@v17
20+
with:
21+
mode: check
22+
# run-ormolu finds *.hs by default; pattern shown if you want to tweak:
23+
# pattern: |
24+
# **/*.hs
25+
# !dist-newstyle/**
26+
27+
hlint:
28+
name: HLint
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Set up HLint
33+
uses: haskell-actions/hlint-setup@v2.4.10
34+
- name: Run HLint (src/app/test)
35+
uses: haskell-actions/hlint-run@v2.4.10
36+
with:
37+
path: '["src/","app/","test/"]'
38+
fail-on: warning
39+
40+
cabal-check:
41+
name: cabal check
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Set up Cabal only
46+
uses: haskell-actions/setup@v2
47+
with:
48+
cabal-version: latest
49+
ghc-version: "9.6.7"
50+
- run: cabal check

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# sunwm
2+
![CI — Linux build & test](https://github.com/zmeadows/sunwm/actions/workflows/build-test-linux.yml/badge.svg)
3+
![Lint — Ormolu/HLint](https://github.com/zmeadows/sunwm/actions/workflows/lint.yml/badge.svg)
24

35
A small, hackable **tiling window manager for X11**. Wayland is **not** supported currently.
46

app/Main.hs

Lines changed: 61 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,77 @@
1-
import Sunwm.Core
2-
import Sunwm.STree
3-
4-
import Graphics.X11.Types
51
import Data.Bits hiding (shift)
62
import qualified Data.Map.Strict as M
3+
import Graphics.X11.Types
4+
import Sunwm.Core
5+
import Sunwm.STree
76

87
main :: IO ()
98
main = sunwm defaultConfig []
109

11-
workspaceNames:: [String]
12-
workspaceNames = map show ([1..9] :: [Integer])
10+
workspaceNames :: [String]
11+
workspaceNames = map show ([1 .. 9] :: [Integer])
1312

1413
defaultConfig :: UserConf
15-
defaultConfig = UserConf {
16-
_normalBorder = "rgb:4f/4f/4f",
17-
_focusedBorder = "rgb:ff/00/00",
18-
_borderWidth = 1,
19-
_keyBinds = defaultKeys,
20-
_topKeyBinds = defaultTopKeys,
21-
_wsNames = workspaceNames,
22-
_prefixKey = (controlMask, xK_t),
23-
_terminal = "xterm",
24-
_initHook = return (),
25-
_stackHook = return ()
14+
defaultConfig =
15+
UserConf
16+
{ _normalBorder = "rgb:4f/4f/4f",
17+
_focusedBorder = "rgb:ff/00/00",
18+
_borderWidth = 1,
19+
_keyBinds = defaultKeys,
20+
_topKeyBinds = defaultTopKeys,
21+
_wsNames = workspaceNames,
22+
_prefixKey = (controlMask, xK_t),
23+
_terminal = "xterm",
24+
_initHook = return (),
25+
_stackHook = return ()
2626
}
2727

2828
defaultKeys :: M.Map (KeyMask, KeySym) (SUN ())
29-
defaultKeys = M.fromList
30-
[ ((0, xK_l), focusTo R)
31-
, ((0, xK_h), focusTo L)
32-
, ((0, xK_j), focusTo D)
33-
, ((0, xK_k), focusTo U)
34-
, ((0, xK_v), splitV 0.5)
35-
, ((0, xK_n), splitH 0.5)
36-
, ((shiftMask, xK_h), swapToDir L)
37-
, ((shiftMask, xK_l), swapToDir R)
38-
, ((shiftMask, xK_k), swapToDir U)
39-
, ((shiftMask, xK_j), swapToDir D)
40-
, ((0, xK_o), raiseHidden R)
41-
, ((0, xK_i), raiseHidden L)
42-
, ((0, xK_r), removeFrame)
43-
, ((0, xK_c), spawnTerminal)
44-
, ((0, xK_e), makeOnly)
45-
, ((0, xK_q), killWindow)
46-
, ((0, xK_b), banish)
47-
, ((0, xK_Escape), return ())
48-
, ((0, xK_equal), equalize)
49-
, ((0, xK_slash), flipT)
50-
, ((mod1Mask, xK_h), shiftTo L)
51-
, ((mod1Mask, xK_l), shiftTo R)
52-
, ((mod1Mask, xK_j), shiftTo D)
53-
, ((mod1Mask, xK_k), shiftTo U)
29+
defaultKeys =
30+
M.fromList
31+
[ ((0, xK_l), focusTo R),
32+
((0, xK_h), focusTo L),
33+
((0, xK_j), focusTo D),
34+
((0, xK_k), focusTo U),
35+
((0, xK_v), splitV 0.5),
36+
((0, xK_n), splitH 0.5),
37+
((shiftMask, xK_h), swapToDir L),
38+
((shiftMask, xK_l), swapToDir R),
39+
((shiftMask, xK_k), swapToDir U),
40+
((shiftMask, xK_j), swapToDir D),
41+
((0, xK_o), raiseHidden R),
42+
((0, xK_i), raiseHidden L),
43+
((0, xK_r), removeFrame),
44+
((0, xK_c), spawnTerminal),
45+
((0, xK_e), makeOnly),
46+
((0, xK_q), killWindow),
47+
((0, xK_b), banish),
48+
((0, xK_Escape), return ()),
49+
((0, xK_equal), equalize),
50+
((0, xK_slash), flipT),
51+
((mod1Mask, xK_h), shiftTo L),
52+
((mod1Mask, xK_l), shiftTo R),
53+
((mod1Mask, xK_j), shiftTo D),
54+
((mod1Mask, xK_k), shiftTo U)
5455
]
5556

5657
defaultTopKeys :: M.Map (KeyMask, KeySym) (SUN ())
57-
defaultTopKeys = M.fromList $
58-
[ ((mod1Mask .|. shiftMask, xK_j), resizeFrame D 0.02)
59-
, ((mod1Mask .|. shiftMask, xK_k), resizeFrame U 0.02)
60-
, ((mod1Mask .|. shiftMask, xK_l), resizeFrame R 0.02)
61-
, ((mod1Mask .|. shiftMask, xK_h), resizeFrame L 0.02)
62-
, ((mod4Mask, xK_Tab), toggleScr)
63-
, ((mod1Mask, xK_Tab), toggleWS)
64-
, ((mod1Mask .|. shiftMask, xK_q), quit)
65-
] ++ workspaceSendBinds ++ workspaceMoveBinds
58+
defaultTopKeys =
59+
M.fromList $
60+
[ ((mod1Mask .|. shiftMask, xK_j), resizeFrame D 0.02),
61+
((mod1Mask .|. shiftMask, xK_k), resizeFrame U 0.02),
62+
((mod1Mask .|. shiftMask, xK_l), resizeFrame R 0.02),
63+
((mod1Mask .|. shiftMask, xK_h), resizeFrame L 0.02),
64+
((mod4Mask, xK_Tab), toggleScr),
65+
((mod1Mask, xK_Tab), toggleWS),
66+
((mod1Mask .|. shiftMask, xK_q), quit)
67+
]
68+
++ workspaceSendBinds
69+
++ workspaceMoveBinds
6670

67-
workspaceMoveBinds :: [((KeyMask, KeySym),SUN ())]
68-
workspaceMoveBinds = map (\(k,n) -> ((mod1Mask, k), changeWS n))
69-
$ zip [xK_1..] [1..length workspaceNames]
71+
workspaceMoveBinds :: [((KeyMask, KeySym), SUN ())]
72+
workspaceMoveBinds =
73+
zipWith (\k n -> ((mod1Mask, k), changeWS n)) [xK_1 ..] [1 .. length workspaceNames]
7074

71-
workspaceSendBinds :: [((KeyMask, KeySym),SUN ())]
72-
workspaceSendBinds = map (\(k,n) -> ((mod1Mask .|. shiftMask, k), moveWinToWS n))
73-
$ zip [xK_1..] [1..length workspaceNames]
75+
workspaceSendBinds :: [((KeyMask, KeySym), SUN ())]
76+
workspaceSendBinds =
77+
zipWith (\k n -> ((mod1Mask .|. shiftMask, k), moveWinToWS n)) [xK_1 ..] [1 .. length workspaceNames]

src/Lib.hs

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)