Better chat notification

This commit is contained in:
jeffser 2024-07-04 11:42:35 -06:00
parent 91f203fc23
commit c75556346a
3 changed files with 10 additions and 7 deletions

View File

@ -1,3 +1,7 @@
.message_input_scroll_window > * {
box-shadow: none;
border-width: 0;
}
.message_text_view {
background-color: rgba(0,0,0,0);
}

View File

@ -904,7 +904,11 @@ Generate a title following these rules:
GLib.idle_add(self.bot_message.insert_markup, self.bot_message.get_end_iter(), text, len(text))
self.save_history()
GLib.idle_add(self.bot_message_button_container.set_visible, True)
GLib.idle_add(self.show_notification, _("Message Received"), _("New message from '{}'").format(self.chats["selected_chat"]), Gio.ThemedIcon.new("emblem-ok-symbolic"))
#Notification
first_paragraph = self.bot_message.get_text(self.bot_message.get_start_iter(), self.bot_message.get_end_iter(), False).split("\n")[0]
print(self.chats["selected_chat"] + "\n\n" + first_paragraph[:100] + (first_paragraph[100:] and '...'))
GLib.idle_add(self.show_notification, self.chats["selected_chat"], first_paragraph[:100] + (first_paragraph[100:] and '...'), Gio.ThemedIcon.new("chat-message-new-symbolic"))
else:
if id not in self.chats["chats"][self.chats["selected_chat"]]["messages"]:
GLib.idle_add(self.chat_container.remove, self.loading_spinner)

View File

@ -209,18 +209,13 @@
<object class="GtkBox">
<style>
<class name="card"/>
<class name="viewa"/>
</style>
<child>
<object class="GtkScrolledWindow">
<property name="max-content-height">150</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="propagate-natural-height">true</property>
<style>
<class name="message-input"/>
<class name="undershoot-bottom"/>
<class name="undershoot-top"/>
<class name="message_input_scroll_window"/>
</style>
<child>
<object class="GtkTextView" id="message_text_view">