nandi/frqpublic Fork 0
9dd480b
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Read a pasted picture through the platform, so cosmic can lend its own

jvui reads the clipboard through its own window, and under libcosmic there
is none, so a pasted picture always came back as no picture at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-11T04:31:24-07:00 Browse files
9dd480b parent: 9a98b31
modified src/frq/cosmic.clj +3 -2
@@ -36,11 +36,12 @@
3636 (defn -main [& _]
3737 ;; What frq asks of glimmer-jvui directly, answered by this backend instead:
3838 ;; jvui's timers only run inside jvui's loop, its quit closes jvui's window,
39- ;; and it has no picture chooser on a desktop.
39+ ;; its picture chooser and its clipboard of pictures belong to jvui's window.
4040 (platform/override! {:after! cosmic/after!
4141 :quit! cosmic/quit!
4242 :pick-image! cosmic/pick-image!
43- :picked-image! cosmic/picked-image!})
43+ :picked-image! cosmic/picked-image!
44+ :clipboard-image-png! cosmic/clipboard-image-png!})
4445 (when-let [path (not-empty (System/getenv "FRQ_COSMIC_DUMP"))]
4546 (dump-tree-to! path))
4647 (app/start! {:after! cosmic/after!
@@ -36,11 +36,12 @@
36 (defn -main [& _]36 (defn -main [& _]
37 ;; What frq asks of glimmer-jvui directly, answered by this backend instead:37 ;; What frq asks of glimmer-jvui directly, answered by this backend instead:
38 ;; jvui's timers only run inside jvui's loop, its quit closes jvui's window,38 ;; jvui's timers only run inside jvui's loop, its quit closes jvui's window,
39- ;; and it has no picture chooser on a desktop.39+ ;; its picture chooser and its clipboard of pictures belong to jvui's window.
40 (platform/override! {:after! cosmic/after!40 (platform/override! {:after! cosmic/after!
41 :quit! cosmic/quit!41 :quit! cosmic/quit!
42 :pick-image! cosmic/pick-image!42 :pick-image! cosmic/pick-image!
43- :picked-image! cosmic/picked-image!})43+ :picked-image! cosmic/picked-image!
44+ :clipboard-image-png! cosmic/clipboard-image-png!})
44 (when-let [path (not-empty (System/getenv "FRQ_COSMIC_DUMP"))]45 (when-let [path (not-empty (System/getenv "FRQ_COSMIC_DUMP"))]
45 (dump-tree-to! path))46 (dump-tree-to! path))
46 (app/start! {:after! cosmic/after!47 (app/start! {:after! cosmic/after!
modified src/frq/platform.clj +7 -1
@@ -37,7 +37,7 @@
3737
3838 (defn override!
3939 "Replace some of what the platform does, for a backend other than jvui.
40- Keys: :after! :quit! :pick-image! :picked-image!."
40+ Keys: :after! :quit! :pick-image! :picked-image! :clipboard-image-png!."
4141 [m]
4242 (swap! overrides merge m)
4343 nil)
@@ -63,6 +63,12 @@
6363 [path]
6464 ((get @overrides :picked-image! gui/picked-image!) path))
6565
66+(defn clipboard-image-png!
67+ "Write the picture on the clipboard to `path` as PNG; true when there was one.
68+ jvui reads it through its own window, so another backend lends its own."
69+ [path]
70+ ((get @overrides :clipboard-image-png! gui/clipboard-image-png!) path))
71+
6672 (defn return-url
6773 "The link that brings the app back to the front once the browser is done, or
6874 nil where the browser never covered it. `frq://auth` is the manifest's own
@@ -37,7 +37,7 @@
37 37
38 (defn override!38 (defn override!
39 "Replace some of what the platform does, for a backend other than jvui.39 "Replace some of what the platform does, for a backend other than jvui.
40- Keys: :after! :quit! :pick-image! :picked-image!."40+ Keys: :after! :quit! :pick-image! :picked-image! :clipboard-image-png!."
41 [m]41 [m]
42 (swap! overrides merge m)42 (swap! overrides merge m)
43 nil)43 nil)
@@ -63,6 +63,12 @@
63 [path]63 [path]
64 ((get @overrides :picked-image! gui/picked-image!) path))64 ((get @overrides :picked-image! gui/picked-image!) path))
65 65
66+(defn clipboard-image-png!
67+ "Write the picture on the clipboard to `path` as PNG; true when there was one.
68+ jvui reads it through its own window, so another backend lends its own."
69+ [path]
70+ ((get @overrides :clipboard-image-png! gui/clipboard-image-png!) path))
71+
66 (defn return-url72 (defn return-url
67 "The link that brings the app back to the front once the browser is done, or73 "The link that brings the app back to the front once the browser is done, or
68 nil where the browser never covered it. `frq://auth` is the manifest's own74 nil where the browser never covered it. `frq://auth` is the manifest's own
modified src/frq/state.clj +2 -3
@@ -18,8 +18,7 @@
1818 [frq.oauth :as oauth]
1919 [frq.platform :as platform]
2020 [frq.store :as store]
21- [frq.upload :as upload]
22- [glimmer-jvui.core :as gui]))
21+ [frq.upload :as upload]))
2322
2423 (def default-host "irc.freeq.at")
2524 (def default-port "6697")
@@ -1368,7 +1367,7 @@
13681367 []
13691368 (let [path (paste-path)]
13701369 (host/mkdirs! (str (media/cache-dir) "/outgoing"))
1371- (if-not (gui/clipboard-image-png! path)
1370+ (if-not (platform/clipboard-image-png! path)
13721371 ;; Android has no clipboard of pictures to read at all, which is the
13731372 ;; other half of why the picker below exists.
13741373 (reset! error "No picture on the clipboard.")
@@ -18,8 +18,7 @@
18 [frq.oauth :as oauth]18 [frq.oauth :as oauth]
19 [frq.platform :as platform]19 [frq.platform :as platform]
20 [frq.store :as store]20 [frq.store :as store]
21- [frq.upload :as upload]21+ [frq.upload :as upload]))
22- [glimmer-jvui.core :as gui]))
23 22
24 (def default-host "irc.freeq.at")23 (def default-host "irc.freeq.at")
25 (def default-port "6697")24 (def default-port "6697")
@@ -1368,7 +1367,7 @@
1368 []1367 []
1369 (let [path (paste-path)]1368 (let [path (paste-path)]
1370 (host/mkdirs! (str (media/cache-dir) "/outgoing"))1369 (host/mkdirs! (str (media/cache-dir) "/outgoing"))
1371- (if-not (gui/clipboard-image-png! path)1370+ (if-not (platform/clipboard-image-png! path)
1372 ;; Android has no clipboard of pictures to read at all, which is the1371 ;; Android has no clipboard of pictures to read at all, which is the
1373 ;; other half of why the picker below exists.1372 ;; other half of why the picker below exists.
1374 (reset! error "No picture on the clipboard.")1373 (reset! error "No picture on the clipboard.")