clean code

This commit is contained in:
zapashcanon 2023-12-16 13:06:11 +01:00
parent c78df9ae69
commit ceeb19d971
Signed by: zapashcanon
GPG Key ID: 8981C3C62D1D28F1
2 changed files with 14 additions and 8 deletions

View File

@ -1,4 +1,4 @@
version=0.24.1
version=0.26.1
assignment-operator=end-line
break-cases=fit
break-fun-decl=wrap
@ -24,8 +24,9 @@ let-and=sparse
let-binding-spacing=compact
let-module=compact
margin=80
max-indent=68
max-indent=2
module-item-spacing=sparse
ocaml-version=4.14.0
ocp-indent-compat=false
parens-ite=false
parens-tuple=always

View File

@ -7,7 +7,6 @@ module App_id = struct
end
module Project_dirs = Directories.Project_dirs (App_id)
module User_dirs = Directories.User_dirs ()
let error msg =
@ -52,7 +51,7 @@ let mode =
| ("center" | "fill" | "fit" | "solid_color" | "stretch" | "tile") as mode
->
mode
| invalid_mode -> error (Format.sprintf "invalid mode `%s`" invalid_mode) )
| invalid_mode -> Format.ksprintf error "invalid mode `%s`" invalid_mode )
let wallpaper_files =
match Bos.OS.Dir.contents (Fpath.v wallpaper_dir) with
@ -60,13 +59,19 @@ let wallpaper_files =
| Ok cnt -> (
(* remove directories from the list... *)
let cnt =
List.filter
List.filter_map
(fun path ->
match Bos.OS.Dir.exists path with Ok b -> not b | _ -> false )
match Bos.OS.Dir.exists path with
| Ok is_dir ->
if is_dir then None
else
let path = Fpath.to_string path in
Some path
| _ -> None )
cnt
in
match Array.of_list (List.map Fpath.to_string cnt) with
| [||] -> error (Format.sprintf "no wallpaper found in %s" wallpaper_dir)
match Array.of_list cnt with
| [||] -> Format.ksprintf error "no wallpaper found in %s" wallpaper_dir
| wallpaper_files -> wallpaper_files )
let random_wallpaper =