eufon/rc.fnl

90 lines
2.6 KiB
Plaintext
Raw Normal View History

(local { : view } (require :fennel))
2022-07-03 10:16:37 +00:00
(local texture (require :texture))
2022-07-03 13:03:35 +00:00
(local matrix (require :matrix))
2022-07-01 21:28:41 +00:00
(local socket-repl (require :socket-repl))
2022-07-01 21:28:41 +00:00
(let [repl-socket-name
(..
(: (os.getenv "XDG_RUNTIME_DIR") :gsub "/$" "")
"/kiwmi-repl."
(os.getenv "WAYLAND_DISPLAY")
".socket"
)]
(socket-repl.start repl-socket-name))
2022-05-08 21:38:44 +00:00
(kiwmi:on
"output"
(fn [output]
(output:set_mode 360 720 0)
2022-05-08 21:38:44 +00:00
(let [r (output:renderer)
2022-07-03 10:16:37 +00:00
kill (texture.from-file r "close-window.png")
launch (texture.from-file r "launcher.png")
spinner (texture.from-file r "carousel.png")]
(output:on "render"
(fn [{: output : renderer}]
2022-07-03 13:03:35 +00:00
(let [bar-height 40]
2022-05-08 21:38:44 +00:00
(renderer:draw_rect :#00000077
0 (- 720 bar-height)
690 360 bar-height)
(renderer:draw_texture
kill
2022-07-03 13:03:35 +00:00
matrix.identity
2022-05-08 21:38:44 +00:00
30 (- 720 bar-height)
0.7)
(renderer:draw_texture
2022-07-03 13:03:35 +00:00
launch
matrix.identity
2022-05-08 21:38:44 +00:00
(- 180 (/ bar-height 2)) (- 720 bar-height)
0.7)
(renderer:draw_texture
spinner
2022-07-03 13:03:35 +00:00
matrix.identity
2022-05-08 21:38:44 +00:00
(- 360 30 bar-height) (- 720 bar-height)
0.7)))))))
(fn kill-window []
(print "DIE")
true)
(fn launch []
(print "WHOOSH")
true)
(fn carousel []
(print "spin spin sugar")
true)
(let [cursor (kiwmi:cursor)]
(cursor:on "button_down"
(fn [button]
(let [(x y) (cursor:pos)]
(if (> y 680)
(if (< x 70)
(kill-window)
(and (< 150 x) (< x 190))
(launch)
(and (< 285 x) (< x 330))
(carousel)
false))))))
2022-04-26 21:13:51 +00:00
(kiwmi:on "view"
(fn [view]
(let [(w h) (: (kiwmi:active_output) :size)]
(view:resize w h)
(view:move 0 0))
(view:focus)
(view:show)
(view:on "request_move" #(view:imove))
(view:on "request_resize" (fn [ev] (view:iresize ev.edges)))))
2022-04-26 20:14:46 +00:00
2022-04-26 21:13:37 +00:00
;(kiwmi:spawn "swaybg -c '#ff00ff'")
(kiwmi:spawn "lua -l fennelrun modeline.fnl")
2022-04-26 22:01:30 +00:00
(kiwmi:spawn "lua -l fennelrun saturn/main.fnl")
2022-04-27 09:07:33 +00:00
(kiwmi:spawn "lua -l fennelrun crier/crier.fnl")
2022-04-27 12:26:54 +00:00
(kiwmi:spawn "lua -l fennelrun just/just.fnl")
2022-04-27 09:07:33 +00:00
;(kiwmi:spawn "foot")