Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,21 @@ jobs:
run: |
sudo apt-get install -y -q qml6-module-qtquick-controls qml6-module-qtquick-templates
python3 scripts/test-reaction-ui.py
- name: Reply target banner (synthetic QtTest)
run: |
sudo apt-get install -y -q qml6-module-qtquick-controls qml6-module-qtquick-templates qml6-module-qtquick-layouts
python3 scripts/test-reply-ui.py
- name: OTP desktop adapter (no desktop needed)
run: |
python3 -m py_compile otp-desktop.py
python3 test_otp_desktop.py
- name: Mac tools compile (python3 syntax, no macOS needed)
run: python3 -m py_compile bridge/linux/blip-bridged bridge/mac/imsg bridge/mac/imsg-send bridge/mac/contacts bridge/mac/tcc-check bridge/mac/blip-check bridge/mac/blip-dispatch bridge/mac/imsg-read bridge/mac/imsg-react bridge/mac/calling_codes.py bridge/mac/contact-save bridge/mac/read_state.py bridge/mac/findmy_city.py
run: python3 -m py_compile bridge/linux/blip-bridged bridge/mac/imsg bridge/mac/imsg-send bridge/mac/contacts bridge/mac/tcc-check bridge/mac/blip-check bridge/mac/blip-dispatch bridge/mac/imsg-read bridge/mac/imsg-react bridge/mac/imsg-reply bridge/mac/calling_codes.py bridge/mac/contact-save bridge/mac/read_state.py bridge/mac/findmy_city.py
- name: Native replies (synthetic database and Messages)
run: |
python3 bridge/mac/test_reply.py
python3 bridge/mac/test_reply_enrich.py
python3 bridge/mac/test_reply_jxa.py
- name: Sticker metadata and bounded animated rendering
run: |
sudo apt-get install -y -q ffmpeg imagemagick qt6-image-formats-plugins
Expand Down
51 changes: 50 additions & 1 deletion BarWidget.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import QtQuick
import "ReadSync.mjs" as ReadSync
import "SendState.mjs" as SendState
import "SourceId.mjs" as SourceId
import Quickshell
import Quickshell.Io
import qs.Commons
Expand Down Expand Up @@ -61,6 +63,9 @@ BarWidget {
* drives Messages through Accessibility, by action names Apple can rename.
* The shim refuses the tool without the same key. */
property bool tapbacks: false
/** `replies=on` in bridge.conf: Reply in the message menu sends a native reply
* through the Mac's imsg-reply. OFF by default, like tapbacks. */
property bool replies: false

// The imsg-react run lives HERE, not in the view that asked for it: the
// popout's surface and the app window are destroyed on close, and a run
Expand Down Expand Up @@ -118,6 +123,48 @@ BarWidget {
}
}

property var replyQueue: []
property var replyPending: []
property var replyJob: null
signal replyExited(var job, int code, string reason)
function queueReply(job, pending) {
root.replyPending = root.replyPending.concat([Object.assign({}, pending, {inFlight: true})])
root.replyQueue = root.replyQueue.concat([job])
root.pumpReply()
}
function reconcileReplies(chat, pending) {
var ids = pending.map(function(p) { return p.localId })
root.replyPending = root.replyPending.filter(function(p) { return p.inFlight === true || p.chat !== chat || ids.indexOf(p.localId) >= 0 })
}
function pumpReply() {
if (replyProc.running || root.replyQueue.length === 0) return
root.replyJob = root.replyQueue[0]
root.replyQueue = root.replyQueue.slice(1)
replyProc.lastErr = ""
replyProc.command = SourceId.bridgeArgv(root.replyJob.chat, "imsg-reply", root.binDir).concat(["--guid", root.replyJob.reply.guid, "--yes", "--text-stdin"])
replyProc.stdinEnabled = true
replyProc.running = true
replyProc.write(root.replyJob.text)
replyProc.stdinEnabled = false
}
function finishReply(code) {
var job = root.replyJob
if (!job) return
root.replyJob = null
root.replyPending = root.replyPending.map(function(p) { return p.localId === job.localId ? Object.assign({}, p, {inFlight: false}) : p })
var reason = code === 0 ? "" : SendState.replyFailure(code, replyProc.lastErr)
if (code !== 0) root.replyPending = SendState.markSendFailed(root.replyPending, job.localId, reason)
root.replyExited(job, code, reason)
Qt.callLater(root.pumpReply)
}
Process {
id: replyProc
property string lastErr: ""
onRunningChanged: if (!running) Qt.callLater(function() { if (!replyProc.running && root.replyJob) root.finishReply(SendState.REPLY_NOT_STARTED) })
stderr: StdioCollector { onStreamFinished: replyProc.lastErr = text }
onExited: function(code, status) { root.finishReply(SendState.replyExitCode(code, status)) }
}

// Local desktop-toast preferences outlive either view, just like tapbacks.
// FileView only watches: the TypeScript helper owns parsing and private writes.
property var toastAllowlist: []
Expand Down Expand Up @@ -1226,9 +1273,10 @@ BarWidget {
root.touchpadScrollGain = root.parseGain(t, /^\s*touchpad_scroll_gain\s*=\s*['"]?(\d*\.?\d+)/mi)
root.smoothScroll = /^\s*smooth_scroll\s*=\s*['"]?(on|true|1|yes)\b/mi.test(t)
root.tapbacks = TapbackActions.tapbacksOn(t)
root.replies = TapbackActions.repliesOn(t)
root.bridgeConfLoaded = true
}
onLoadFailed: { root.otpAutofill = false; root.automationOn = false; root.uiFontTheme = false; root.uiFontSize = 0; root.scrollGain = 1.0; root.touchpadScrollGain = 1.0; root.smoothScroll = false; root.tapbacks = false; root.binDir = root.home + "/bin"; root.bridgeConfLoaded = true }
onLoadFailed: { root.replies = false; root.otpAutofill = false; root.automationOn = false; root.uiFontTheme = false; root.uiFontSize = 0; root.scrollGain = 1.0; root.touchpadScrollGain = 1.0; root.smoothScroll = false; root.tapbacks = false; root.binDir = root.home + "/bin"; root.bridgeConfLoaded = true }
}
IpcHandler {
target: root.moduleName
Expand All @@ -1245,6 +1293,7 @@ BarWidget {
+ " scroll_gain=" + root.scrollGain + (root.touchpadScrollGain !== 1 ? "/" + root.touchpadScrollGain : "")
+ (root.smoothScroll ? " smooth_scroll=on" : "")
+ (root.tapbacks ? " tapbacks=on" : "")
+ (root.replies ? " replies=on" : "")
+ (root.lastError !== "" ? " error=" + root.lastError : "")
}
function citystatus(): string {
Expand Down
Loading
Loading