Compare commits
8 Commits
70da3a582d
...
b34a43897a
Author | SHA1 | Date | |
---|---|---|---|
b34a43897a | |||
bd18a20251 | |||
27b28e997b | |||
ee2730f757 | |||
8683fce4aa | |||
1875b87592 | |||
69753c2345 | |||
07fd321f94 |
125
rc.fnl
125
rc.fnl
@ -17,37 +17,6 @@
|
|||||||
(when (string.find (output:name) "^WL-")
|
(when (string.find (output:name) "^WL-")
|
||||||
(output:set_mode 360 720 0)))
|
(output:set_mode 360 720 0)))
|
||||||
|
|
||||||
(kiwmi:on
|
|
||||||
"output"
|
|
||||||
(fn [output]
|
|
||||||
(resize-wayland-backend output)
|
|
||||||
(let [[width height] (output:size)
|
|
||||||
r (output:renderer)
|
|
||||||
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}]
|
|
||||||
(let [bar-height (/ height 15)]
|
|
||||||
(renderer:draw_rect :#00000077
|
|
||||||
0 (- height bar-height)
|
|
||||||
width bar-height)
|
|
||||||
(renderer:draw_texture
|
|
||||||
kill
|
|
||||||
matrix.identity
|
|
||||||
30 (- height bar-height)
|
|
||||||
0.7)
|
|
||||||
(renderer:draw_texture
|
|
||||||
launch
|
|
||||||
matrix.identity
|
|
||||||
(- (/ width 2) (/ bar-height 2)) (- height bar-height)
|
|
||||||
0.7)
|
|
||||||
(renderer:draw_texture
|
|
||||||
spinner
|
|
||||||
matrix.identity
|
|
||||||
(- width 30 bar-height) (- height bar-height)
|
|
||||||
0.7)))))))
|
|
||||||
|
|
||||||
(fn kill-window []
|
(fn kill-window []
|
||||||
(print "DIE")
|
(print "DIE")
|
||||||
true)
|
true)
|
||||||
@ -60,25 +29,95 @@
|
|||||||
(print "spin spin sugar")
|
(print "spin spin sugar")
|
||||||
true)
|
true)
|
||||||
|
|
||||||
|
(fn placements [output]
|
||||||
|
(let [(width height) (output:size)
|
||||||
|
bar-height (/ height 15)]
|
||||||
|
{
|
||||||
|
|
||||||
|
:application {
|
||||||
|
:x 0
|
||||||
|
:y 0
|
||||||
|
:w width
|
||||||
|
:h (- height (* bar-height 1.1))
|
||||||
|
}
|
||||||
|
:bar {
|
||||||
|
:x 0
|
||||||
|
:y (- height (* bar-height 1.1))
|
||||||
|
:w width
|
||||||
|
:h (* bar-height 1.1)
|
||||||
|
}
|
||||||
|
:kill {
|
||||||
|
:x (- (* width 0.25) (/ bar-height 2))
|
||||||
|
:y (- height bar-height)
|
||||||
|
:w bar-height
|
||||||
|
:h bar-height
|
||||||
|
:on-press kill-window
|
||||||
|
}
|
||||||
|
:launch {
|
||||||
|
:x (- (* width 0.5) (/ bar-height 2))
|
||||||
|
:y (- height bar-height)
|
||||||
|
:w bar-height
|
||||||
|
:h bar-height
|
||||||
|
:on-press launch
|
||||||
|
}
|
||||||
|
:overview {
|
||||||
|
:x (- (* width 0.75) (/ bar-height 2))
|
||||||
|
:y (- height bar-height)
|
||||||
|
:w bar-height
|
||||||
|
:h bar-height
|
||||||
|
:on-press carousel
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
(kiwmi:on
|
||||||
|
"output"
|
||||||
|
(fn [output]
|
||||||
|
(resize-wayland-backend output)
|
||||||
|
(let [(width height) (output:size)
|
||||||
|
r (output:renderer)
|
||||||
|
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}]
|
||||||
|
(let [buttons (placements output)]
|
||||||
|
(renderer:draw_rect :#77000077
|
||||||
|
buttons.bar.x buttons.bar.y
|
||||||
|
buttons.bar.w buttons.bar.h)
|
||||||
|
(renderer:draw_texture
|
||||||
|
kill
|
||||||
|
matrix.identity
|
||||||
|
buttons.kill.x buttons.kill.y
|
||||||
|
0.7)
|
||||||
|
(renderer:draw_texture
|
||||||
|
launch
|
||||||
|
matrix.identity
|
||||||
|
buttons.launch.x buttons.launch.y
|
||||||
|
0.7)
|
||||||
|
(renderer:draw_texture
|
||||||
|
spinner
|
||||||
|
matrix.identity
|
||||||
|
buttons.overview.x buttons.overview.y
|
||||||
|
0.7)))))))
|
||||||
|
|
||||||
|
|
||||||
(let [cursor (kiwmi:cursor)]
|
(let [cursor (kiwmi:cursor)]
|
||||||
(cursor:on "button_down"
|
(cursor:on "button_down"
|
||||||
(fn [button]
|
(fn [button]
|
||||||
(let [(x y) (cursor:pos)]
|
(let [(x y) (cursor:pos)]
|
||||||
(if (> y 680)
|
(each [name attribs (pairs (placements (kiwmi:active_output)))]
|
||||||
(if (< x 70)
|
(if (and
|
||||||
(kill-window)
|
(<= attribs.x x)
|
||||||
(and (< 150 x) (< x 190))
|
(< x (+ attribs.x attribs.w))
|
||||||
(launch)
|
(<= attribs.y y)
|
||||||
(and (< 285 x) (< x 330))
|
(< y (+ attribs.y attribs.h)))
|
||||||
(carousel)
|
(if attribs.on-press (attribs.on-press))))))))
|
||||||
false))))))
|
|
||||||
|
|
||||||
|
|
||||||
(kiwmi:on "view"
|
(kiwmi:on "view"
|
||||||
(fn [view]
|
(fn [view]
|
||||||
(let [(w h) (: (kiwmi:active_output) :size)]
|
(let [geom (placements (kiwmi:active_output))]
|
||||||
(view:resize w h)
|
(view:resize geom.application.w geom.application.h)
|
||||||
(view:move 0 0))
|
(view:move geom.application.x geom.application.y))
|
||||||
(view:focus)
|
(view:focus)
|
||||||
(view:show)
|
(view:show)
|
||||||
(view:on "request_move" #(view:imove))
|
(view:on "request_move" #(view:imove))
|
||||||
|
14
texture.fnl
Normal file
14
texture.fnl
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
(local { : GdkPixbuf } (require :lgi))
|
||||||
|
|
||||||
|
(fn from-file [renderer filename]
|
||||||
|
(let [pixels
|
||||||
|
(let [(buf err) (GdkPixbuf.Pixbuf.new_from_file filename)]
|
||||||
|
(if (not buf) (print :err err))
|
||||||
|
buf)]
|
||||||
|
(renderer:texture_from_pixels
|
||||||
|
pixels.rowstride
|
||||||
|
pixels.width
|
||||||
|
pixels.height
|
||||||
|
(pixels:get_pixels))))
|
||||||
|
|
||||||
|
{ : from-file }
|
Loading…
Reference in New Issue
Block a user