Separate window urgency hint setting for mentions

This commit is contained in:
miruka 2020-06-02 21:42:16 -04:00
parent ccd2308427
commit 76f0c5626f
5 changed files with 19 additions and 4 deletions

View File

@ -15,6 +15,11 @@ and this project adheres to
- `markRoomReadMsecDelay` setting to configure how long in milliseconds Mirage
will wait before marking a focused room as read, defaults to `200`
- `alertOnMentionForMsec` setting separate from `alertOnMessageForMsec`,
defaulting to `-1`: will trigger a non-expiring window highlight on
messages received that mention your user
(the behavior differs depending on desktop environment or window manager)
### Changed
- **Unread message/highlight counters**:
@ -22,6 +27,9 @@ and this project adheres to
and respect configured push rules for your account
- Read receipts will be sent to the server to mark rooms as read
- The `alertOnMessageForMsec` setting now defaults to `0`, disabling window
highlights for messages not mentioning you
- While an E2E key import operation is running, prevent accidentally closing
the popup by clicking outside of it

View File

@ -1476,4 +1476,5 @@ class MatrixClient(nio.AsyncClient):
if from_us or await self.event_is_past(ev):
return
AlertRequested()
mentions_us = HTML.user_id_link_in_html(item.content, self.user_id)
AlertRequested(high_importance=mentions_us)

View File

@ -41,6 +41,8 @@ class AlertRequested(PyOtherSideEvent):
flashes the taskbar icon on Windows.
"""
high_importance: bool = False
@dataclass
class CoroutineDone(PyOtherSideEvent):

View File

@ -228,7 +228,8 @@ class UISettings(JSONDataFile):
return "Ctrl" if platform.system() == "Darwin" else "Alt"
return {
"alertOnMessageForMsec": 4000,
"alertOnMentionForMsec": -1,
"alertOnMessageForMsec": 0,
"alwaysCenterRoomHeader": False,
"compactMode": False,
"clearRoomFilterOnEnter": True,

View File

@ -10,8 +10,11 @@ QtObject {
}
function onAlertRequested() {
const msec = window.settings.alertOnMessageForMsec
function onAlertRequested(highImportance) {
const msec =
highImportance ?
window.settings.alertOnMentionForMsec :
window.settings.alertOnMessageForMsec
if (Qt.application.state !== Qt.ApplicationActive && msec !== 0) {
window.alert(msec === -1 ? 0 : msec) // -1 0 = no time out