Now About Social Code
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2025-01-21 12:33:59 +0000
committerLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2025-01-21 12:33:59 +0000
commitf3201c850ed6fa967074e0a07d9d017540ae69f4 (patch)
treea30092bafb304c071a117f12f6e2e51ffc395772 /src
parent794e9692fc47b7c801183a12f1910d703cc9dfcb (diff)
message: Grey out system messages
Diffstat (limited to 'src')
-rw-r--r--src/chat.py5
-rw-r--r--src/message.py7
-rw-r--r--src/style.css4
3 files changed, 13 insertions, 3 deletions
diff --git a/src/chat.py b/src/chat.py
index ef43e5a..e99a524 100644
--- a/src/chat.py
+++ b/src/chat.py
@@ -165,7 +165,10 @@ class WeegtkChat(Adw.Bin):
last = self.model.get_string(count - 1)
last_data = json.loads(last)
if last_data["username"] == user:
- msg_type = "message_append"
+ if msg_type == "system":
+ msg_type = "system_append"
+ else:
+ msg_type = "message_append"
data = {
"username": user,
diff --git a/src/message.py b/src/message.py
index db50829..0be93c2 100644
--- a/src/message.py
+++ b/src/message.py
@@ -65,7 +65,7 @@ class WeegtkMessage(Gtk.Box):
else:
self.avatar.set_text(data["username"])
- if data["type"] == "message_append":
+ if data["type"] in ["message_append", "system_append"]:
self.avatar.set_visible(False)
self.username.set_visible(False)
@@ -80,7 +80,10 @@ class WeegtkMessage(Gtk.Box):
msg = Gtk.Label(label=markuped, selectable=True,
wrap=True, wrap_mode=Pango.WrapMode.WORD_CHAR, xalign=0,
margin_top=margin, use_markup=True,
- margin_start= padding_size if data["type"] == "message_append" else 0)
+ margin_start= padding_size if data["type"] in ["message_append", "system_append"] else 0)
+
+ if data["type"] in ["system", "system_append"]:
+ msg.add_css_class("system-message")
self.message_list.append(msg)
diff --git a/src/style.css b/src/style.css
index 44ec363..a95fb4d 100644
--- a/src/style.css
+++ b/src/style.css
@@ -11,3 +11,7 @@ box.message {
.messages > row {
min-height: 0px;
}
+
+.system-message {
+ opacity: 0.6;
+}