From a06ce3352ee3a07cd373817c1cfca50e1efd616a Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 21 Jan 2021 11:16:03 -0400 Subject: [PATCH] Make local unread markers optional, off by default Add RoomList.local_unread_markers option to settings.py, which is False by default. Before, this way always enabled and conflicts with push rules by marking anything as unread without any logic. --- docs/TODO.md | 3 --- src/backend/matrix_client.py | 6 ++++-- src/config/settings.py | 7 ++++++- src/gui/MainPane/RoomDelegate.qml | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/TODO.md b/docs/TODO.md index c7dda3b7..f955ee9a 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -8,9 +8,6 @@ - profiles missing in notifications - option to use plaintext notifications - Notification urgency level (plyer)? -- Make local unread counter an optional turned off by default - -- Implement fallback QML notifications, usable if dbus isn't available - annoying tooltips when menu open - add http_proxy support diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index a2e89064..1562e025 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -2246,8 +2246,10 @@ class MatrixClient(nio.AsyncClient): await self.update_account_unread_counts() return item - self.models[self.user_id, "rooms"][room.room_id].local_unreads = True - await self.update_account_unread_counts() + if self.backend.settings.RoomList.local_unread_markers: + room_item = self.models[self.user_id, "rooms"][room.room_id] + room_item.local_unreads = True + await self.update_account_unread_counts() # Alerts & notifications diff --git a/src/config/settings.py b/src/config/settings.py index 9ffe690b..bdba233b 100644 --- a/src/config/settings.py +++ b/src/config/settings.py @@ -74,9 +74,14 @@ class RoomList: min_width: int = 144 # Sort rooms in alphabetical order instead of recent activity. - # The application must be restarted to apply changes to this setting. + # The application must be restarted to apply changes for this setting. lexical_sort: bool = False + # When any event is received in a room, mark the room as unread with a [!], + # regardless of notification push rules. This does not take into account + # anything received while the client is not running. + local_unread_markers: bool = False + # When clicking on a room, recenter the room list on that room. click_centers: bool = False diff --git a/src/gui/MainPane/RoomDelegate.qml b/src/gui/MainPane/RoomDelegate.qml index 54a147af..8da2bcf5 100644 --- a/src/gui/MainPane/RoomDelegate.qml +++ b/src/gui/MainPane/RoomDelegate.qml @@ -66,7 +66,7 @@ HTile { (model.bookmarked ? "\u2665 " : "") + (model.display_name || qsTr("Empty room")) color: - model.local_unreads ? + model.unreads || model.local_unreads ? theme.mainPane.listView.room.unreadName : theme.mainPane.listView.room.name }