package oxbow

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file layout.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
type t =
  | Tiling [@name "tiling"]
  | Scrolling [@name "scrolling"]
  | Floating [@name "floating"]
[@@deriving yojson]

let all = [ Tiling; Scrolling; Floating ]

let to_string = function
  | Tiling -> "tiling"
  | Scrolling -> "scrolling"
  | Floating -> "floating"
;;

let of_string s =
  match String.trim s |> String.lowercase_ascii with
  | "tiling" -> Some Tiling
  | "scrolling" -> Some Scrolling
  | "floating" -> Some Floating
  | _ -> None
;;

let cycle t (dir : Direction.Logical.t) =
  match dir with
  | Next -> Ring.next_or_first t all |> Option.get
  | Prev -> Ring.prev_or_last t all |> Option.get
;;