first commit
This commit is contained in:
commit
f801982847
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
_build
|
||||
61
.ocamlformat
Normal file
61
.ocamlformat
Normal file
@ -0,0 +1,61 @@
|
||||
version=0.19.0
|
||||
align-cases=false
|
||||
align-constructors-decl=false
|
||||
align-variants-decl=false
|
||||
assignment-operator=end-line
|
||||
break-before-in=fit-or-vertical
|
||||
break-cases=all
|
||||
break-collection-expressions=fit-or-vertical
|
||||
break-fun-decl=wrap
|
||||
break-fun-sig=wrap
|
||||
break-infix=wrap
|
||||
break-infix-before-func=false
|
||||
break-separators=before
|
||||
break-sequences=true
|
||||
break-string-literals=auto
|
||||
break-struct=force
|
||||
cases-exp-indent=2
|
||||
cases-matching-exp-indent=normal
|
||||
disambiguate-non-breaking-match=false
|
||||
doc-comments=before
|
||||
doc-comments-padding=2
|
||||
doc-comments-tag-only=default
|
||||
dock-collection-brackets=false
|
||||
exp-grouping=preserve
|
||||
extension-indent=2
|
||||
field-space=loose
|
||||
function-indent=2
|
||||
function-indent-nested=never
|
||||
if-then-else=k-r
|
||||
indent-after-in=0
|
||||
indicate-multiline-delimiters=space
|
||||
indicate-nested-or-patterns=unsafe-no
|
||||
infix-precedence=indent
|
||||
leading-nested-match-parens=false
|
||||
let-and=sparse
|
||||
let-binding-indent=2
|
||||
let-binding-spacing=compact
|
||||
let-module=compact
|
||||
margin=80
|
||||
match-indent=0
|
||||
match-indent-nested=never
|
||||
max-indent=68
|
||||
module-item-spacing=sparse
|
||||
nested-match=wrap
|
||||
ocp-indent-compat=false
|
||||
parens-ite=false
|
||||
parens-tuple=always
|
||||
parens-tuple-patterns=multi-line-only
|
||||
parse-docstrings=true
|
||||
sequence-blank-line=preserve-one
|
||||
sequence-style=terminator
|
||||
single-case=compact
|
||||
space-around-arrays=true
|
||||
space-around-lists=true
|
||||
space-around-records=true
|
||||
space-around-variants=true
|
||||
stritem-extension-indent=0
|
||||
type-decl=sparse
|
||||
type-decl-indent=2
|
||||
wrap-comments=false
|
||||
wrap-fun-args=true
|
||||
1
CHANGES.md
Normal file
1
CHANGES.md
Normal file
@ -0,0 +1 @@
|
||||
## unreleased
|
||||
8
LICENSE.md
Normal file
8
LICENSE.md
Normal file
@ -0,0 +1,8 @@
|
||||
The ISC License (ISC)
|
||||
=====================
|
||||
|
||||
Copyright © 2021, TODO
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
40
README.md
Normal file
40
README.md
Normal file
@ -0,0 +1,40 @@
|
||||
# ccbg
|
||||
|
||||
ccbg is an [OCaml] executable/library to TODO.
|
||||
|
||||
## Installation
|
||||
|
||||
`ccbg` can be installed with [opam]:
|
||||
|
||||
```sh
|
||||
opam install ccbg
|
||||
```
|
||||
|
||||
If you don't have `opam`, you can install it following the [how to install opam] guide.
|
||||
|
||||
If you can't or don't want to use `opam`, consult the [opam file] for build instructions.
|
||||
|
||||
## Quickstart
|
||||
|
||||
```ocaml
|
||||
let () = Format.printf "TODO@."
|
||||
```
|
||||
|
||||
For more, have a look at the [example] folder, at the [documentation] or at the [test suite].
|
||||
|
||||
## About
|
||||
|
||||
- [LICENSE]
|
||||
- [CHANGELOG]
|
||||
|
||||
[CHANGELOG]: ./CHANGES.md
|
||||
[example]: ./example/
|
||||
[LICENSE]: ./LICENSE.md
|
||||
[opam file]: ./ccbg.opam
|
||||
[test suite]: ./test/
|
||||
|
||||
[documentation]: TODO
|
||||
[how to install opam]: https://opam.ocaml.org/doc/Install.html
|
||||
[OCaml]: https://ocaml.org
|
||||
[opam]: https://opam.ocaml.org/
|
||||
[ccbg]: TODO
|
||||
27
ccbg.opam
Normal file
27
ccbg.opam
Normal file
@ -0,0 +1,27 @@
|
||||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
synopsis: "OCaml library/executable to TODO"
|
||||
description: "ccbg is an OCaml library/executable to TODO."
|
||||
maintainer: ["TODO"]
|
||||
authors: ["TODO"]
|
||||
license: "ISC"
|
||||
tags: ["ccbg" "TODO" "TODO" "TODO" "TODO"]
|
||||
depends: [
|
||||
"dune" {>= "2.8"}
|
||||
"ocaml" {>= "4.08"}
|
||||
"odoc" {with-doc}
|
||||
]
|
||||
build: [
|
||||
["dune" "subst"] {dev}
|
||||
[
|
||||
"dune"
|
||||
"build"
|
||||
"-p"
|
||||
name
|
||||
"-j"
|
||||
jobs
|
||||
"@install"
|
||||
"@runtest" {with-test}
|
||||
"@doc" {with-doc}
|
||||
]
|
||||
]
|
||||
19
doc/index.mld
Normal file
19
doc/index.mld
Normal file
@ -0,0 +1,19 @@
|
||||
{0 ccbg}
|
||||
|
||||
{{:https://TODO} ccbg} is an {{:https://ocaml.org} OCaml} library/executable to TODO.
|
||||
|
||||
{1:api API}
|
||||
|
||||
|
||||
{!modules:
|
||||
Ccbg
|
||||
}
|
||||
|
||||
|
||||
{1:private_api Private API}
|
||||
|
||||
You shouldn't have to use any of these modules, they're used internally only.
|
||||
|
||||
{!modules:
|
||||
TODO
|
||||
}
|
||||
25
dune-project
Normal file
25
dune-project
Normal file
@ -0,0 +1,25 @@
|
||||
(lang dune 2.8)
|
||||
|
||||
(name ccbg)
|
||||
|
||||
(license ISC)
|
||||
|
||||
(authors "TODO")
|
||||
|
||||
(maintainers "TODO")
|
||||
|
||||
;(source
|
||||
; (github TODO/ccbg))
|
||||
|
||||
(generate_opam_files true)
|
||||
|
||||
(package
|
||||
(name ccbg)
|
||||
(synopsis "OCaml library/executable to TODO")
|
||||
(description
|
||||
"ccbg is an OCaml library/executable to TODO.")
|
||||
(tags
|
||||
(ccbg TODO TODO TODO TODO))
|
||||
(depends
|
||||
(ocaml
|
||||
(>= 4.08))))
|
||||
3
example/dune
Normal file
3
example/dune
Normal file
@ -0,0 +1,3 @@
|
||||
(executable
|
||||
(name main)
|
||||
(modules main))
|
||||
1
example/main.ml
Normal file
1
example/main.ml
Normal file
@ -0,0 +1 @@
|
||||
let () = Format.printf "TODO@."
|
||||
53
src/ccbg.ml
Normal file
53
src/ccbg.ml
Normal file
@ -0,0 +1,53 @@
|
||||
module Project_dirs = Directories.Project_dirs (struct
|
||||
let qualifier = "org"
|
||||
let organization = "zapashcanon"
|
||||
let application = "ccbg"
|
||||
end)
|
||||
|
||||
module User_dirs = Directories.User_dirs ()
|
||||
|
||||
let err msg =
|
||||
Format.eprintf "error: %s@." msg;
|
||||
exit 1
|
||||
|
||||
let config_dir =
|
||||
match Project_dirs.config_dir with
|
||||
| None -> err "can't compute config directory path"
|
||||
| Some dir -> dir
|
||||
|
||||
let wallpaper_dir =
|
||||
match User_dirs.picture_dir with
|
||||
| None -> err "can't compute picture directory path"
|
||||
| Some dir ->
|
||||
Filename.concat dir "wallpaper"
|
||||
|
||||
let time = 600
|
||||
let time = Format.sprintf "%ds" time
|
||||
|
||||
let () = Random.self_init ()
|
||||
|
||||
let wallpaper_files =
|
||||
match Bos.OS.Dir.contents (Fpath.v wallpaper_dir) with
|
||||
| Ok cnt ->
|
||||
let cnt = List.filter (fun path ->
|
||||
match Bos.OS.Dir.exists path with
|
||||
| Ok false -> true
|
||||
| Ok true -> false
|
||||
| _ -> false
|
||||
) cnt in
|
||||
Array.of_list (List.map Fpath.to_string cnt)
|
||||
| Error (`Msg e) -> err e
|
||||
|
||||
let random_wallpaper =
|
||||
let len = Array.length wallpaper_files in
|
||||
fun () ->
|
||||
wallpaper_files.(Random.int len)
|
||||
|
||||
let rec new_wallpaper () =
|
||||
match Bos.OS.Cmd.run Bos.Cmd.(v "timeout" % time % "swaybg" % "--mode" % "fill" %"--image" % (random_wallpaper ())) with
|
||||
| _ ->
|
||||
new_wallpaper ()
|
||||
|
||||
let () =
|
||||
match Bos.OS.Cmd.run Bos.Cmd.(v "killall" % "swaybg") with
|
||||
| _ -> new_wallpaper ()
|
||||
4
src/dune
Normal file
4
src/dune
Normal file
@ -0,0 +1,4 @@
|
||||
(executable
|
||||
(public_name ccbg)
|
||||
(modules ccbg)
|
||||
(libraries bos directories fpath))
|
||||
1
test/main.ml
Normal file
1
test/main.ml
Normal file
@ -0,0 +1 @@
|
||||
let () = assert true (* TODO *)
|
||||
Loading…
x
Reference in New Issue
Block a user