From 47294824b98844723bef705b1d77553fb8c5025f Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Thu, 7 Mar 2024 14:39:47 -0800 Subject: [PATCH] GNOME extensions - WIP --- .../breezydesktop@org.xronlinux/extension.js | 49 +++++++++++++++++++ .../breezydesktop@org.xronlinux/metadata.json | 9 ++++ 2 files changed, 58 insertions(+) create mode 100644 gnome/breezydesktop@org.xronlinux/extension.js create mode 100644 gnome/breezydesktop@org.xronlinux/metadata.json diff --git a/gnome/breezydesktop@org.xronlinux/extension.js b/gnome/breezydesktop@org.xronlinux/extension.js new file mode 100644 index 0000000..00abeb7 --- /dev/null +++ b/gnome/breezydesktop@org.xronlinux/extension.js @@ -0,0 +1,49 @@ +const Lang = imports.lang; +const St = imports.gi.St; +const Clutter = imports.gi.Clutter; +const Gio = imports.gi.Gio; +const GObject = imports.gi.GObject; +const Cogl = imports.gi.Cogl; +const Shell = imports.gi.Shell; + +const ExtensionUtils = imports.misc.extensionUtils; +const Me = ExtensionUtils.getCurrentExtension(); +const Main = imports.ui.main; +const PanelMenu = imports.ui.panelMenu; + + +class Extension { + enable() { + var XREffect = GObject.registerClass({}, class XREffect extends Shell.GLSLEffect { + vfunc_build_pipeline() { + // TODO - replace this with the sombrero shader + const declares = ` + uniform sampler2D uDesktopTexture; + `; + const code = ` + cogl_color_out = texture2D(uDesktopTexture, cogl_tex_coord_in[0].xy); + `; + this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, declares, code, false); + } + + // TODO - read IMU data and update uniform variables + vfunc_paint_target(node, paintContext) { + if (!this._initialized) { + this.set_uniform_float(this.get_uniform_location('uDesktopTexture'), 1, [0]); + this._initialized = true; + } + + super.vfunc_paint_target(node, paintContext); + } + }); + + Main.uiGroup.add_effect(new XREffect()); + } + + disable() { + } +} + +function init() { + return new Extension(); +} \ No newline at end of file diff --git a/gnome/breezydesktop@org.xronlinux/metadata.json b/gnome/breezydesktop@org.xronlinux/metadata.json new file mode 100644 index 0000000..c9c7302 --- /dev/null +++ b/gnome/breezydesktop@org.xronlinux/metadata.json @@ -0,0 +1,9 @@ +{ + "uuid": "breezydesktop@org.xronlinux", + "name": "Breezy GNOME", + "description": "XR virtual desktop for Linux.", + "shell-version": [ + "43" + ], + "url": "https://github.com/wheaney/breezy-desktop" +} \ No newline at end of file