From 29234ead927f64837fd49cab17cbcf261147ccfa Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Mon, 27 Jan 2025 22:58:57 +0000 Subject: chat: Fix spell checking, fix theme of GtkSource widget --- src/chat.py | 7 ++ src/gtk/custom_adwaita.xml | 188 +++++++++++++++++++++++++++++++++++++++++++++ src/main.py | 8 +- src/meson.build | 3 +- src/style.css | 4 +- src/weegtk.in | 1 + 6 files changed, 207 insertions(+), 4 deletions(-) create mode 100644 src/gtk/custom_adwaita.xml diff --git a/src/chat.py b/src/chat.py index d7f1ce8..1635faa 100644 --- a/src/chat.py +++ b/src/chat.py @@ -26,6 +26,7 @@ from weegtk import config from weegtk import netfile import json +import os GObject.type_register(GtkSource.View) @Gtk.Template(resource_path='/com/fryzekconcepts/weegtk/gtk/chat.ui') @@ -68,6 +69,12 @@ class WeegtkChat(Adw.Bin): adj.connect("value-changed", self.scroll_changes) adj.connect("notify::upper", self.upper_notify) + # This is a bit of hack to have the raised color match in the gtk source editor + manager = GtkSource.StyleSchemeManager().get_default() + scheme = manager.get_scheme('CustomAdwaita') + buffer = self.text_entry.get_buffer() + buffer.set_style_scheme(scheme) + sc_controller = Gtk.ShortcutController(propagation_phase=Gtk.PropagationPhase.CAPTURE) action = Gtk.CallbackAction.new(self.entry_callback, self) trigger = Gtk.ShortcutTrigger.parse_string("Return") diff --git a/src/gtk/custom_adwaita.xml b/src/gtk/custom_adwaita.xml new file mode 100644 index 0000000..c599df2 --- /dev/null +++ b/src/gtk/custom_adwaita.xml @@ -0,0 +1,188 @@ + + + + Christian Hergert + <_description>An style scheme for Adwaita + + + light + Adwaita-dark + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +