Add direct keybinds for presence states

This commit is contained in:
miruka 2020-07-10 15:15:53 -04:00
parent 3848ce60ca
commit fec1026346
3 changed files with 28 additions and 2 deletions

View File

@ -1,6 +1,5 @@
# TODO
- presence keybinds
- retry if media not found
- fix members not synced bug
- fix local unread counters order

View File

@ -299,7 +299,11 @@ class UISettings(JSONDataFile):
"toggleFocusMainPane": ["Alt+F"],
"clearRoomFilter": ["Alt+Shift+F"],
"toggleCollapseAccount": ["Alt+O"],
"openPresenceMenu": ["Alt+P"],
"togglePresenceUnavailable": ["Alt+Ctrl+U", "Alt+Ctrl+A"],
"togglePresenceInvisible": ["Alt+Ctrl+I"],
"togglePresenceOffline": ["Alt+Ctrl+O"],
"goToLastPage": ["Ctrl+Tab"],
"goToPreviousAccount": ["Alt+Shift+N"],

View File

@ -199,6 +199,11 @@ HTile {
setCollapse(! collapsed)
}
function togglePresence(presence) {
if (model.presence === presence) presence = "online"
py.callClientCoro(model.id, "set_presence", [presence])
}
HShortcut {
enabled: enableKeybinds
@ -217,4 +222,22 @@ HTile {
sequences: window.settings.keys.openPresenceMenu
onActivated: account.doRightClick(false)
}
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.togglePresenceUnavailable
onActivated: account.togglePresence("unavailable")
}
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.togglePresenceInvisible
onActivated: account.togglePresence("invisible")
}
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.togglePresenceOffline
onActivated: account.togglePresence("offline")
}
}