Skip to content

Instantly share code, notes, and snippets.

@Trundle
Created October 17, 2021 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Trundle/b46fdd5188e3908fb11dcbd68c2a04dd to your computer and use it in GitHub Desktop.
Save Trundle/b46fdd5188e3908fb11dcbd68c2a04dd to your computer and use it in GitHub Desktop.
awc sample configuration
let Natural/enumerate =
https://prelude.dhall-lang.org/v19.0.0/Natural/enumerate.dhall
sha256:0cf083980a752b21ce0df9fc2222a4c139f50909e2353576e26a191002aa1ce3
let List/map =
https://prelude.dhall-lang.org/v19.0.0/List/map.dhall
sha256:dd845ffb4568d40327f2a817eb42d1c6138b929ca758d50bc33112ef3c885680
let Types = env:AWC_TYPES
let D = Types.Direction
let M = Types.Modifier
let mod = M.Logo
let forKeys =
λ(keys : List Types.Key) →
λ(mods : List M) →
λ(buildAction : ∀(n : Natural) → Types.Action) →
List/map
{ index : Natural, value : Types.Key }
Types.KeyBinding
( λ(x : { index : Natural, value : Types.Key }) →
{ mods, key = x.value, action = buildAction (x.index + 1) }
)
(List/indexed Types.Key keys)
let forKeyRange =
λ(n : Natural) →
λ(mods : List M) →
λ(keyPrefix : Text) →
λ(buildAction : ∀(n : Natural) → Types.Action) →
List/map
Natural
Types.KeyBinding
( λ(i : Natural) →
{ mods
, key = Types.Key.Sym (keyPrefix ++ Natural/show (i + 1))
, action = buildAction (i + 1)
}
)
(Natural/enumerate n)
let forKeyCodeRange =
λ(start : Natural) →
λ(stop : Natural) →
λ(mods : List M) →
λ(buildAction : ∀(n : Natural) → Types.Action) →
List/map
Natural
Types.KeyBinding
( λ(i : Natural) →
{ mods
, key = Types.Key.Code (start + i)
, action = buildAction (i + 1)
}
)
(Natural/enumerate (Natural/subtract start stop))
in Types.Config::{
, keyboards =
[ { type = Types.KeyboardType.Builtin, layout = "de(neo)" }
, { type = Types.KeyboardType.External, layout = "de(nodeadkeys)" }
]
, buttonBindings =
[ { mods = [ mod ]
, button = Types.Button.Left
, action = Types.ButtonAction.Move
}
, { mods = [ mod ]
, button = Types.Button.Right
, action = Types.ButtonAction.Resize
}
]
, keyBindings =
[ { -- Terminal on Mod + Shift + Return
mods =
[ mod, M.Shift ]
, key = Types.Key.Sym "Return"
, action =
Types.Action.Execute "kitty -o linux_display_server=wayland"
}
, { -- App menu on Mod + e
mods =
[ mod ]
, key = Types.Key.Sym "e"
, action =
Types.Action.Execute "j4-dmenu-desktop --dmenu=whisker-menu"
}
, { -- Screenshot on Mod + Shift + g
mods =
[ mod, M.Shift ]
, key = Types.Key.Sym "G"
, action =
Types.Action.Execute
"slurp | grim -g - - | wl-copy -t image/png"
}
, { -- Lock screen on Mod + l
mods =
[ mod ]
, key = Types.Key.Sym "l"
, action = Types.Action.Execute "swaylock"
}
, { -- Focus down on Mod + j
mods =
[ mod ]
, key = Types.Key.Sym "j"
, action = Types.Action.FocusDown
}
, { -- Focus up on Mod + k
mods =
[ mod ]
, key = Types.Key.Sym "k"
, action = Types.Action.FocusUp
}
, { -- Swap down on Shift + Mod + j
mods =
[ mod, M.Shift ]
, key = Types.Key.Sym "J"
, action = Types.Action.SwapDown
}
, { -- Swap up on Shift + Mod + k
mods =
[ mod, M.Shift ]
, key = Types.Key.Sym "K"
, action = Types.Action.SwapUp
}
, { -- Next layout on Mod + Space
mods =
[ mod ]
, key = Types.Key.Sym "space"
, action = Types.Action.NextLayout
}
, { -- Swap the focused surface and the primary surface
mods =
[ mod ]
, key = Types.Key.Sym "Return"
, action = Types.Action.SwapPrimary
}
, { -- Close focused surface on Mod + Shift + c
mods =
[ mod, M.Shift ]
, key = Types.Key.Sym "C"
, action = Types.Action.Close
}
, { -- Swap workspaces on primary and secondary output on Mod + s
mods =
[ mod ]
, key = Types.Key.Sym "s"
, action = Types.Action.SwapWorkspaces
}
, { -- Focus primary surface on Mod + m
mods =
[ mod ]
, key = Types.Key.Sym "m"
, action = Types.Action.FocusPrimary
}
, { -- Push focused surface back into tiling on Mod + t
mods =
[ mod ]
, key = Types.Key.Sym "t"
, action = Types.Action.Sink
}
, { -- Reload config on Mod + Ctrl + Alt + r
mods =
[ mod, M.Ctrl, M.Alt ]
, key = Types.Key.Sym "r"
, action = Types.Action.ConfigReload
}
, { -- Expand main area with Mod + +
mods =
[ mod, M.Mod5 ]
, key = Types.Key.Sym "plus"
, action = Types.Action.Expand
}
, { -- Shrink main area with Mod + -
mods =
[ mod, M.Mod5 ]
, key = Types.Key.Sym "minus"
, action = Types.Action.Shrink
}
, { -- Reset layouts on current workspace with Mod + Shift + Space
mods =
[ mod, M.Shift ]
, key = Types.Key.Sym "space"
, action = Types.Action.ResetLayouts
}
, { mods = [] : List M
, key = Types.Key.Sym "XF86MonBrightnessDown"
, action = Types.Action.Execute "light -U 5"
}
, { mods = [] : List M
, key = Types.Key.Sym "XF86MonBrightnessUp"
, action = Types.Action.Execute "light -A 5"
}
]
# forKeys
[ Types.Key.Sym "q", Types.Key.Sym "w" ]
[ mod ]
Types.Action.FocusOutput
# forKeys
[ Types.Key.Sym "Q", Types.Key.Sym "W" ]
[ mod, M.Shift ]
Types.Action.MoveToOutput
# forKeyRange
12
[ M.Alt, M.Ctrl ]
"XF86Switch_VT_"
Types.Action.SwitchVT
# forKeyRange
9
[ mod ]
""
(λ(i : Natural) → Types.Action.View (Natural/show i))
# forKeyRange
9
[ mod, M.Ctrl ]
""
( λ(i : Natural) →
Types.Action.SwapWorkspaceTagWith (Natural/show i)
)
# forKeyCodeRange
10
19
[ mod, M.Shift ]
(λ(i : Natural) → Types.Action.MoveTo (Natural/show i))
, outputs = [ { name = "DP-5", x = +1920, y = +0, scale = 1.0 } ]
, modifier = mod
, layout =
let twoPane = Types.twoPane 0.5 0.05
let rotatedTwoPane = Types.rotated twoPane
in Types.buildLayout
( Types.choose
Types.full
[ twoPane
, Types.rotated twoPane
, Types.reflected D.Horizontal twoPane
, Types.reflected D.Vertical rotatedTwoPane
]
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment