Fixes GTK4 Layer Shell and Ollama integration issues
Addresses multiple issues related to GTK4 Layer Shell initialization and Ollama integration. - Reorders initialization to ensure the layer shell is set up before window properties. - Adds error detection for layer shell initialization failures. - Implements a focus event handler to prevent focus-out warnings. - Introduces a launcher script to activate the virtual environment, force native Wayland, and preload the GTK4 Layer Shell library. - Warns users of incorrect GDK_BACKEND settings. - Updates the Ollama client to handle responses from both older and newer versions of the Ollama SDK. These changes improve the application's stability, compatibility, and functionality on Wayland systems.
This commit is contained in:
11
main.py
11
main.py
@@ -38,6 +38,17 @@ def main(argv: list[str] | None = None) -> int:
|
||||
)
|
||||
return 1
|
||||
|
||||
# Warn if GDK_BACKEND is set to X11 on Wayland systems
|
||||
if os.environ.get("WAYLAND_DISPLAY") and os.environ.get("GDK_BACKEND") == "x11":
|
||||
print(
|
||||
"Warning: GDK_BACKEND is set to 'x11' but you're on Wayland.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
print(
|
||||
"GTK4 Layer Shell requires native Wayland. Use './run.sh' instead.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
app = Gtk.Application(application_id="ai.sidebar")
|
||||
app.connect("activate", _on_activate)
|
||||
status = app.run(args)
|
||||
|
||||
Reference in New Issue
Block a user