Add Mumble message review shortcuts
This commit is contained in:
1 parent
d5f8a392cf
commit
64440fbb78
18 files changed
+484
-30
No files matched your search
@@ -26,6 +26,17 @@ type messageCopyResult struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func messageHistorySlots(process string) int {
|
||||
switch process {
|
||||
case "pidgin":
|
||||
return 9
|
||||
case "mumble":
|
||||
return 12
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
// messagingController belongs to the accessibility event loop. Histories survive
|
||||
// focus changes, retire with their native window/transcript, and clear on lock.
|
||||
// Its one clipboard worker has a bounded queue and never performs native queries.
|
||||
@@ -87,8 +98,8 @@ func (controller *messagingController) handle(event atspi.Event) bool {
|
||||
controller.history.Retire(id.BusName, id.Path)
|
||||
}
|
||||
message := event.ChatMessage
|
||||
if message == nil || event.Type != atspi.TextInsertedEvent || event.Source.ApplicationProcess != "pidgin" ||
|
||||
event.Source.Defunct || event.Source.Role != "text" ||
|
||||
if message == nil || event.Type != atspi.TextInsertedEvent || messageHistorySlots(event.Source.ApplicationProcess) == 0 ||
|
||||
event.Source.Defunct || (event.Source.Role != "text" && !(event.Source.ApplicationProcess == "mumble" && event.Source.Role == "label")) ||
|
||||
message.Provider != event.Source.BusName || message.Conversation != event.Source.Path ||
|
||||
!event.Source.ID().Valid() || event.Window != atspi.NewObjectID(message.Provider, message.Window) {
|
||||
return false
|
||||
@@ -117,7 +128,7 @@ func (controller *messagingController) present(text string, background bool) {
|
||||
|
||||
func (controller *messagingController) review(command input.Command, current atspi.Snapshot) {
|
||||
index, copyMessage, ok := input.MessageCommandIndex(command)
|
||||
if !ok || controller.gate.Locked() || controller.gate.Suspended() || current.ApplicationProcess != "pidgin" {
|
||||
if !ok || controller.gate.Locked() || controller.gate.Suspended() || index >= messageHistorySlots(current.ApplicationProcess) {
|
||||
return
|
||||
}
|
||||
message, exists := controller.history.Previous(current.BusName, index)
|
||||
|
||||
Reference in new issue
Block a user