Skip to content

Commit

Permalink
Switch to ezjsonm-encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
lthms committed Jan 11, 2024
1 parent 5d88789 commit 519f598
Show file tree
Hide file tree
Showing 27 changed files with 86 additions and 835 deletions.
2 changes: 1 addition & 1 deletion bin/spatialblock/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(package spatial-shell)
(public_name spatialblock)
(name main)
(libraries mltp_ipc spatial_ipc unix jsoner))
(libraries mltp_ipc spatial_ipc unix ezjsonm-encoding))

(rule
(alias man-pages)
Expand Down
7 changes: 4 additions & 3 deletions bin/spatialblock/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ module App_id_map = Hashtbl.Make (String)
let app_id_map = App_id_map.create 10

let entry_jsoner =
let open Jsoner.Decoding in
let open Ezjsonm_encoding.Decoding in
let open Syntax in
let+ app_id = field "app_id" string and+ icon = field "icon" string in
(app_id, icon)

let config_jsoner = Jsoner.Decoding.list entry_jsoner
let config_jsoner = Ezjsonm_encoding.Decoding.list entry_jsoner

let load_config () =
let read_file path = In_channel.(with_open_text path input_all) in
Expand All @@ -22,7 +22,8 @@ let load_config () =
let config_path = config_dir // "spatial" // "spatialblock.json" in
if Sys.file_exists config_path then
let conf =
read_file config_path |> Jsoner.Decoding.of_string_exn config_jsoner
read_file config_path
|> Ezjsonm_encoding.Decoding.of_string_exn config_jsoner
in
List.iter (fun (entry, icon) -> App_id_map.add app_id_map entry icon) conf
else ()
Expand Down
2 changes: 1 addition & 1 deletion bin/spatialmsg/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let spatial_error = 2
type format = Json | Quiet

let pp_json encoding fmt value =
let json = Jsoner.to_string_exn ~minify:true encoding value in
let json = Ezjsonm_encoding.to_string_exn ~minify:true encoding value in
Format.fprintf fmt "%s" json

let output_get_windows (reply : Spatial_ipc.get_windows_reply) = function
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
(name spatial-shell)
(synopsis
"Implementing a spatial model inspired by Material Shell, for i3 and Sway")
(depends (ocaml (>= "5.0.0")) poll (clap (>= "0.3.0")) (ezjsonm (>= "1.2.0")) conf-scdoc))
(depends (ocaml (>= "5.0.0")) poll (clap (>= "0.3.0")) ezjsonm-encoding conf-scdoc))

(package
(allow_empty)
Expand Down
3 changes: 0 additions & 3 deletions lib/jsoner/dune

This file was deleted.

54 changes: 0 additions & 54 deletions lib/jsoner/json_decoder.ml

This file was deleted.

29 changes: 0 additions & 29 deletions lib/jsoner/json_encoder.ml

This file was deleted.

239 changes: 0 additions & 239 deletions lib/jsoner/jsoner.ml

This file was deleted.

Loading

0 comments on commit 519f598

Please sign in to comment.