diff --git a/docs/changelog.md b/docs/changelog.md index 4efc176..e936f4f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -11,10 +11,11 @@ SPDX-License-Identifier: CC-BY-4.0 #### New Features -* **New Effect: Glide.** A very subtle effect which simply fades the window and applies some 3D-like tilting and scaling. +* **New Effect: Glide.** A very subtle effect which simply fades the window and applies some 3D-like tilting and scaling. This effect is available on all support GNOME versions and on KDE. #### Other Enhancements +* The settings dialog has been redesigned specifically for libadwaita. These changes are only available on GNOME 42 and GNOME 43. * Burn-My-Windows now follows the [REUSE Specification](https://reuse.software/spec). * The KWin port of Burn-My-Windows now uses `metadata.json` files instead of the deprecated `metadata.desktop` format. diff --git a/docs/how-to-create-new-effects.md b/docs/how-to-create-new-effects.md index d6e04c6..3452fa1 100644 --- a/docs/how-to-create-new-effects.md +++ b/docs/how-to-create-new-effects.md @@ -268,12 +268,12 @@ gnome-extensions prefs burn-my-windows@schneegans.github.com There should be two sliders in this example: The animation duration and the width of the fading gradient. -If your effect supports GNOME Shell 3.3x _and_ GNOME Shell 40+, you will have to provide two `*.ui` files for this. +If your effect supports GNOME Shell 3.3x _and_ GNOME Shell 40+, you will have to provide three `*.ui` files for this. This is because starting with GNOME Shell 40, the preference dialog uses GTK4, before it used to use GTK3. -Usually, there are only a few minor differences between the two files. +Starting with GNOME Shell 42, it uses `libadwaita` which requires different UI files again. We will load the respective file in the `getPreferences()` method of your new effect class. -Just save the code below to `resources/ui/gtk3/SimpleFade.ui` and `resources/ui/gtk4/SimpleFade.ui` respectively. +Just save the code below to `resources/ui/gtk3/SimpleFade.ui`, `resources/ui/gtk4/SimpleFade.ui`, and `resources/ui/adw/SimpleFade.ui` respectively. Remember to replace any occurrence of `simple-fade` with your effect's nick-name!
@@ -423,6 +423,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
+ + +
Expand this to show the GTK4 code. @@ -553,6 +556,95 @@ SPDX-License-Identifier: GPL-3.0-or-later
+ +
+ Expand this to show the libadwaita code. + +```xml + + + + + + + + 5000 + 100 + 10 + 100 + + + + 1 + 0 + 0.01 + 0.1 + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + simple-fade-animation-time + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Fade Width + + + center + 1 + 2 + left + 300 + simple-fade-width + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + +``` + +
+ ### Loading the Preferences Page In order to load the above `*.ui` files, add the following code to your effect's `getPreferences()` method. @@ -561,7 +653,7 @@ In order to load the above `*.ui` files, add the following code to your effect's static getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/SimpleFade.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/SimpleFade.ui`); // These connect the settings to the UI elements. Have a look at prefs.js // on how to bind other types of UI elements. diff --git a/prefs.js b/prefs.js index 4440466..7f8c9cf 100644 --- a/prefs.js +++ b/prefs.js @@ -97,7 +97,7 @@ var PreferencesDialog = class PreferencesDialog { // Load the general user interface files. this._builder = new Gtk.Builder(); this._builder.add_from_resource(`/ui/common/main-menu.ui`); - this._builder.add_from_resource(`/ui/${utils.getGTKString()}/prefs.ui`); + this._builder.add_from_resource(`/ui/${utils.getUIDir()}/prefs.ui`); // Bind general options properties. this.bindSwitch('destroy-dialogs'); @@ -107,7 +107,7 @@ var PreferencesDialog = class PreferencesDialog { // the time - it seems that pop!_OS does not support libadwaita even on GNOME 42). We // have to use a different layout, as the stack sidebar looks pretty ugly with the // included Adw.Clamp... - if (Adw && utils.shellVersionIsAtLeast(42, 'beta')) { + if (utils.isADW()) { // This is our top-level widget which we will return later. this._widget = new Gtk.Box({orientation: Gtk.Orientation.VERTICAL}); @@ -116,62 +116,96 @@ var PreferencesDialog = class PreferencesDialog { const generalPrefs = this._builder.get_object('general-prefs'); this.gtkBoxAppend(this._widget, generalPrefs); - // Then add a preferences group with action rows to open the effect subpages. - const group = new Adw.PreferencesGroup({title: _('Effect Options')}); + // Then add a preferences group for the effect expander rows. + const group = new Adw.PreferencesGroup({title: _('Effects')}); this.gtkBoxAppend(this._widget, group); + // This stores all expander rows for the effects. We use this to implement the + // accordion-functionality of the effect settings. + this._effectRows = []; + + // Now add all the rows. this._ALL_EFFECTS.forEach(effect => { const [minMajor, minMinor] = effect.getMinShellVersion(); if (utils.shellVersionIsAtLeast(minMajor, minMinor)) { + const row = effect.getPreferences(this); - const row = new Adw.ActionRow({title: effect.getLabel(), activatable: true}); - row.add_suffix(new Gtk.Image({icon_name: 'go-next-symbolic'})); + // On older versions of Adw (e.g. on GNOME Shell <43), the set_use_markup() does + // not yet exist. + if (row.set_use_markup) { + row.set_title('' + effect.getLabel() + ''); + row.set_use_markup(true); + } else { + row.set_title(effect.getLabel()); + } - // Open a subpage with the effect's settings. - row.connect('activated', () => { - const page = new BurnMyWindowsEffectPage(effect, this); - page.valign = Gtk.Align.CENTER; - page.margin_top = 10; - page.margin_bottom = 10; - page.margin_start = 10; - page.margin_end = 10; - - // Add the effect's preferences (if any). - const preferences = effect.getPreferences(this); - if (preferences) { - this.gtkBoxAppend(page, preferences); + // Un-expand any previously expanded effect row. This way we ensure that there + // is only one expanded row at any time. + row.connect('notify::expanded', currentRow => { + if (currentRow.get_expanded()) { + this._effectRows.forEach(row => { + if (row != currentRow) { + row.set_expanded(false); + } + }); } - - // Add a button for back navigation. - const backButton = new Gtk.Button({ - halign: Gtk.Align.CENTER, - label: _('Go Back'), - }); - backButton.add_css_class('suggested-action'); - backButton.add_css_class('pill-button'); - backButton.connect('clicked', () => { - row.get_root().close_subpage(); - }); - - this.gtkBoxAppend(page, backButton); - - // Wrap the preferences group in an Adw.Clamp. - const clamp = new Adw.Clamp({ - child: page, - maximum_size: 600, - tightening_threshold: 400, - }); - - // Open the subpage on click. - row.get_root().present_subpage(clamp); }); + // Add three buttons on the right. + const box = new Gtk.Box(); + box.set_spacing(8); + + // The preview button. + const previewButton = Gtk.Button.new_from_icon_name('bmw-preview-symbolic'); + previewButton.add_css_class('circular'); + previewButton.add_css_class('flat'); + previewButton.set_tooltip_text(_('Preview this effect')); + previewButton.set_valign(Gtk.Align.CENTER); + box.append(previewButton); + + previewButton.connect('clicked', () => { + this._previewEffect(effect); + }); + + // Now add the two toggle buttons for enabling and disabling the effect. + const addToggle = (action, tooltip) => { + const button = Gtk.ToggleButton.new(); + button.set_action_name( + `${action}-effects.${effect.getNick()}-${action}-effect`); + button.set_child( + Gtk.Image.new_from_icon_name(`bmw-window-${action}-symbolic`)); + button.set_tooltip_text(tooltip); + button.set_valign(Gtk.Align.CENTER); + + // We switch some class when the button is enabled in order to make it more + // apparent which effects are currently in use. + button.add_css_class('circular'); + button.add_css_class('flat'); + button.connect('toggled', button => { + if (button.active) { + button.add_css_class('suggested-action'); + button.remove_css_class('flat'); + } else { + button.remove_css_class('suggested-action'); + button.add_css_class('flat'); + } + }); + + box.append(button); + }; + + addToggle('open', _('Use this effect when opening windows')); + addToggle('close', _('Use this effect when closing windows')); + + row.add_action(box); group.add(row); + + this._effectRows.push(row); } }); - } - // On older GNOME versions, we use a StackSidebar. + // On older GNOME versions, we use a StackSidebar. The code below works both, on GTK3 + // and GTK4. else { // This is our top-level widget which we will return later. @@ -305,44 +339,46 @@ var PreferencesDialog = class PreferencesDialog { // Populate the open-effects drop-down menu. { - const menu = this._builder.get_object('open-effect-menu'); const group = Gio.SimpleActionGroup.new(); window.insert_action_group('open-effects', group); this._ALL_EFFECTS.forEach(effect => { const [minMajor, minMinor] = effect.getMinShellVersion(); if (utils.shellVersionIsAtLeast(minMajor, minMinor)) { - const nick = effect.getNick(); - const label = effect.getLabel(); - const actionName = nick + '-open-effect'; - const fullName = 'open-effects.' + actionName; - - const action = this._settings.create_action(actionName); + const actionName = effect.getNick() + '-open-effect'; + const action = this._settings.create_action(actionName); group.add_action(action); - menu.append_item(Gio.MenuItem.new(label, fullName)); + // The menu only exists if not using libadwaita. With libadwaita, individual + // ToggleButtons are used for triggering the above actions. + if (!utils.isADW()) { + const menu = this._builder.get_object('open-effect-menu'); + const label = effect.getLabel(); + menu.append_item(Gio.MenuItem.new(label, 'open-effects.' + actionName)); + } } }); } // Populate the close-effects drop-down menu. { - const menu = this._builder.get_object('close-effect-menu'); const group = Gio.SimpleActionGroup.new(); window.insert_action_group('close-effects', group); this._ALL_EFFECTS.forEach(effect => { const [minMajor, minMinor] = effect.getMinShellVersion(); if (utils.shellVersionIsAtLeast(minMajor, minMinor)) { - const nick = effect.getNick(); - const label = effect.getLabel(); - const actionName = nick + '-close-effect'; - const fullName = 'close-effects.' + actionName; - - const action = this._settings.create_action(actionName); + const actionName = effect.getNick() + '-close-effect'; + const action = this._settings.create_action(actionName); group.add_action(action); - menu.append_item(Gio.MenuItem.new(label, fullName)); + // The menu only exists if not using libadwaita. With libadwaita, individual + // ToggleButtons are used for triggering the above actions. + if (!utils.isADW()) { + const menu = this._builder.get_object('close-effect-menu'); + const label = effect.getLabel(); + menu.append_item(Gio.MenuItem.new(label, 'close-effects.' + actionName)); + } } }); } @@ -482,16 +518,73 @@ var PreferencesDialog = class PreferencesDialog { return null; } + // Opens a modal window using the given effect. + _previewEffect(effect) { + + // Set the to-be-previewed effect. + this.getSettings().set_string('open-preview-effect', effect.getNick()); + this.getSettings().set_string('close-preview-effect', effect.getNick()); + + // Make sure that the window.show() firther below "sees" this change. + Gio.Settings.sync(); + + // Create the preview-window. + const window = new Gtk.Window({ + // Translators: %s will be replaced by the effect's name. + title: _('Preview for %s').replace('%s', effect.getLabel()), + default_width: 800, + default_height: 450, + modal: true, + transient_for: utils.isGTK4() ? this._widget.get_root() : + this._widget.get_toplevel() + }); + + // Add a header bar to the window. + if (utils.isGTK4()) { + const header = Gtk.HeaderBar.new(); + window.set_titlebar(header); + } + + const box = new Gtk.Box({ + orientation: Gtk.Orientation.VERTICAL, + valign: Gtk.Align.CENTER, + spacing: 10, + margin_start: 50, + margin_end: 50 + }); + + const label = Gtk.Label.new(_('Close this Window to Preview the Effect!')); + label.wrap = true; + label.justify = Gtk.Justification.CENTER; + label.get_style_context().add_class('large-title'); + + const image = new Gtk.Image({ + icon_name: 'burn-my-windows-symbolic', + pixel_size: 128, + }); + + this.gtkBoxAppend(box, image); + this.gtkBoxAppend(box, label); + + if (utils.isGTK4()) { + window.set_child(box); + window.show(); + } else { + window.add(box); + window.show_all(); + } + } + // Initializes template widgets used by the preferences dialog. _registerCustomClasses() { - // Each effect page is based on a template widget. This template contains the title - // and the preview button. - if (GObject.type_from_name('BurnMyWindowsEffectPage') == null) { + // If we are not using libadwaita, each effect page is based on a template widget. + // This template contains the title and the preview button. + if (!utils.isADW() && GObject.type_from_name('BurnMyWindowsEffectPage') == null) { BurnMyWindowsEffectPage = GObject.registerClass( { GTypeName: 'BurnMyWindowsEffectPage', - Template: `resource:///ui/${utils.getGTKString()}/effectPage.ui`, + Template: `resource:///ui/${utils.getUIDir()}/effectPage.ui`, InternalChildren: ['label', 'button'], }, class BurnMyWindowsEffectPage extends Gtk.Box { // ------------------------------ @@ -503,58 +596,7 @@ var PreferencesDialog = class PreferencesDialog { // Open the preview window once the preview button is clicked. this._button.connect('clicked', () => { - // Set the to-be-previewed effect. - dialog.getSettings().set_string('open-preview-effect', effect.getNick()); - dialog.getSettings().set_string('close-preview-effect', effect.getNick()); - - // Make sure that the window.show() firther below "sees" this change. - Gio.Settings.sync(); - - // Create the preview-window. - const window = new Gtk.Window({ - // Translators: %s will be replaced by the effect's name. - title: _('Preview for %s').replace('%s', effect.getLabel()), - default_width: 800, - default_height: 450, - modal: true, - transient_for: utils.isGTK4() ? this._button.get_root() : - this._button.get_toplevel() - }); - - // Add a header bar to the window. - if (utils.isGTK4()) { - const header = Gtk.HeaderBar.new(); - window.set_titlebar(header); - } - - const box = new Gtk.Box({ - orientation: Gtk.Orientation.VERTICAL, - valign: Gtk.Align.CENTER, - spacing: 10, - margin_start: 50, - margin_end: 50 - }); - - const label = Gtk.Label.new(_('Close this Window to Preview the Effect!')); - label.wrap = true; - label.justify = Gtk.Justification.CENTER; - label.get_style_context().add_class('large-title'); - - const image = new Gtk.Image({ - icon_name: 'burn-my-windows-symbolic', - pixel_size: 128, - }); - - dialog.gtkBoxAppend(box, image); - dialog.gtkBoxAppend(box, label); - - if (utils.isGTK4()) { - window.set_child(box); - window.show(); - } else { - window.add(box); - window.show_all(); - } + dialog._previewEffect(effect); }); } }); diff --git a/resources/img/scalable/actions/bmw-preview-symbolic.svg b/resources/img/scalable/actions/bmw-preview-symbolic.svg new file mode 100644 index 0000000..4fcae9e --- /dev/null +++ b/resources/img/scalable/actions/bmw-preview-symbolic.svg @@ -0,0 +1,2 @@ + + diff --git a/resources/img/scalable/actions/bmw-window-close-symbolic.svg b/resources/img/scalable/actions/bmw-window-close-symbolic.svg new file mode 100644 index 0000000..4103cc8 --- /dev/null +++ b/resources/img/scalable/actions/bmw-window-close-symbolic.svg @@ -0,0 +1,50 @@ + + + + + + + + + diff --git a/resources/img/scalable/actions/bmw-window-open-symbolic.svg b/resources/img/scalable/actions/bmw-window-open-symbolic.svg new file mode 100644 index 0000000..f40dbe5 --- /dev/null +++ b/resources/img/scalable/actions/bmw-window-open-symbolic.svg @@ -0,0 +1,49 @@ + + + + + + + + + diff --git a/resources/ui/adw/Apparition.ui b/resources/ui/adw/Apparition.ui new file mode 100644 index 0000000..fb737e8 --- /dev/null +++ b/resources/ui/adw/Apparition.ui @@ -0,0 +1,180 @@ + + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 2000 + 100 + 10 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Randomness + + + center + 1 + 2 + left + 300 + + + 1 + 0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Twirl Intensity + + + center + 1 + 1 + left + 300 + + + 10 + -10 + 0.1 + 1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Shake Intensity + + + center + 1 + 1 + left + 300 + + + 10 + 0 + 0.1 + 1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Suction Intensity + + + center + 1 + 2 + left + 300 + + + 1 + 0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/BrokenGlass.ui b/resources/ui/adw/BrokenGlass.ui new file mode 100644 index 0000000..bd131e6 --- /dev/null +++ b/resources/ui/adw/BrokenGlass.ui @@ -0,0 +1,170 @@ + + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 2 + left + 300 + + + 5 + 0.2 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Gravity + + + center + 1 + 2 + left + 300 + + + 2.0 + -2.0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Blow Force + + + center + 1 + 2 + left + 300 + + + 2.0 + -2.0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Shatter From Pointer Location + The shards will fly away from where your mouse pointer was when closing the window. + broken-glass-use-pointer + + + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/Doom.ui b/resources/ui/adw/Doom.ui new file mode 100644 index 0000000..8467aa6 --- /dev/null +++ b/resources/ui/adw/Doom.ui @@ -0,0 +1,146 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Horizontal Scale + + + center + 1 + 2 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Vertical Scale + + + center + 1 + 2 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Pixel Size + + + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/EnergizeA.ui b/resources/ui/adw/EnergizeA.ui new file mode 100644 index 0000000..fb0b196 --- /dev/null +++ b/resources/ui/adw/EnergizeA.ui @@ -0,0 +1,105 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 2 + left + 300 + + + 10 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Color + energize-a-color + + + center + 250 + 0 + 1 + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/EnergizeB.ui b/resources/ui/adw/EnergizeB.ui new file mode 100644 index 0000000..58b4ae2 --- /dev/null +++ b/resources/ui/adw/EnergizeB.ui @@ -0,0 +1,106 @@ + + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 2 + left + 300 + + + 10 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Color + energize-b-color + + + center + 250 + 0 + 1 + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/Fire.ui b/resources/ui/adw/Fire.ui new file mode 100644 index 0000000..b424437 --- /dev/null +++ b/resources/ui/adw/Fire.ui @@ -0,0 +1,209 @@ + + + + + + + + + + + Presets + fire-preset-button + + + center + Choose a Preset + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 2 + left + 300 + + + 3 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Speed + + + center + 1 + 2 + left + 300 + + + 2.0 + -2.0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + 3D Noise + Creates a more dynamic fire but requires more GPU power. + flame-3d-noise + + + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Gradient + + + + + + 1 + 1 + center + + + + + 1 + 1 + center + + + + + 1 + 1 + center + + + + + 1 + 1 + center + + + + + 1 + 1 + center + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/Glide.ui b/resources/ui/adw/Glide.ui new file mode 100644 index 0000000..08ad052 --- /dev/null +++ b/resources/ui/adw/Glide.ui @@ -0,0 +1,146 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 2000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 2 + left + 300 + + + 1 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Squish + + + center + 1 + 2 + left + 300 + + + 1 + 0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Tilt + + + center + 1 + 2 + left + 300 + + + 1 + -1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/Hexagon.ui b/resources/ui/adw/Hexagon.ui new file mode 100644 index 0000000..40ccddf --- /dev/null +++ b/resources/ui/adw/Hexagon.ui @@ -0,0 +1,186 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 2 + left + 300 + + + 10 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Mesh Line Width + + + center + 1 + 1 + left + 300 + + + 10 + 0 + 0.1 + 1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Line Color + hexagon-line-color + + + 1 + 1 + 250 + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Glow Color + hexagon-glow-color + + + 1 + 1 + 250 + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Additive Blending + You may want to enable this for dark window themes. + hexagon-additive-blending + + + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/Incinerate.ui b/resources/ui/adw/Incinerate.ui new file mode 100644 index 0000000..b2cc0df --- /dev/null +++ b/resources/ui/adw/Incinerate.ui @@ -0,0 +1,161 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 2 + left + 300 + + + 10 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Turbulence + + + center + 1 + 2 + left + 300 + + + 1 + 0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Start at Pointer + If disabled, a random location will be chosen. + incinerate-use-pointer + + + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Color + incinerate-color + + + 0 + 1 + 250 + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/Matrix.ui b/resources/ui/adw/Matrix.ui new file mode 100644 index 0000000..5391e98 --- /dev/null +++ b/resources/ui/adw/Matrix.ui @@ -0,0 +1,195 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 0 + left + 300 + + + 50 + 5 + 1 + 5 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Randomness + + + center + 1 + 2 + left + 300 + + + 1.0 + 0.0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Vertical Overshooting + + + center + 1 + 2 + left + 300 + + + 1.0 + 0.0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Trail Color + matrix-trail-color + + + 0 + center + 250 + 1 + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Tip Color + matrix-tip-color + + + 0 + center + 250 + 1 + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/PixelWheel.ui b/resources/ui/adw/PixelWheel.ui new file mode 100644 index 0000000..d5edb3a --- /dev/null +++ b/resources/ui/adw/PixelWheel.ui @@ -0,0 +1,113 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 2000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Spoke Count + + + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Pixel Size + + + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/PixelWipe.ui b/resources/ui/adw/PixelWipe.ui new file mode 100644 index 0000000..f29c16f --- /dev/null +++ b/resources/ui/adw/PixelWipe.ui @@ -0,0 +1,80 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 5000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Pixel Size + + + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/Pixelate.ui b/resources/ui/adw/Pixelate.ui new file mode 100644 index 0000000..04f216e --- /dev/null +++ b/resources/ui/adw/Pixelate.ui @@ -0,0 +1,113 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Noise + + + center + 1 + 0 + left + 300 + + + 100 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Pixel Size + + + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/SnapOfDisintegration.ui b/resources/ui/adw/SnapOfDisintegration.ui new file mode 100644 index 0000000..0f19009 --- /dev/null +++ b/resources/ui/adw/SnapOfDisintegration.ui @@ -0,0 +1,105 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 500 + 10 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 2 + left + 300 + + + 20 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Color + snap-color + + + 250 + center + 1 + 1 + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/TRexAttack.ui b/resources/ui/adw/TRexAttack.ui new file mode 100644 index 0000000..a5532f4 --- /dev/null +++ b/resources/ui/adw/TRexAttack.ui @@ -0,0 +1,171 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Claw Scratch Scale + + + center + 1 + 1 + left + 300 + + + 10 + 0.1 + 0.1 + 1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Claw Scratch Count + + + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Warp Effect + + + center + 1 + 2 + left + 300 + + + 1 + 0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Flash Color + claw-scratch-color + + + 1 + 1 + 250 + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/TVEffect.ui b/resources/ui/adw/TVEffect.ui new file mode 100644 index 0000000..fc3d1e8 --- /dev/null +++ b/resources/ui/adw/TVEffect.ui @@ -0,0 +1,72 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Color + tv-effect-color + + + 0 + 1 + 250 + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/Wisps.ui b/resources/ui/adw/Wisps.ui new file mode 100644 index 0000000..788e668 --- /dev/null +++ b/resources/ui/adw/Wisps.ui @@ -0,0 +1,105 @@ + + + + + + + + + + + Animation Time [ms] + + + center + 1 + 0 + left + 300 + + + 10000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Scale + + + center + 1 + 2 + left + 300 + + + 10 + 0.1 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Color + wisps-color + + + 0 + 1 + 250 + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/adw/prefs.ui b/resources/ui/adw/prefs.ui new file mode 100644 index 0000000..ba9e1af --- /dev/null +++ b/resources/ui/adw/prefs.ui @@ -0,0 +1,99 @@ + + + + + + + + + main-menu + open-menu-symbolic + + + + vertical + 60 + 20 + + + + center + burn-my-windows-symbolic + 128 + + + + + + Welcome to Burn-My-Windows! + 8 + 6 + + + + + + + If you like this extension, recommend it to your friends :) + 36 + + + + + + + + + Also Add Effects to Dialogs + destroy-dialogs + + + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + Disable on Battery Power + disable-on-battery + + + center + + + + + edit-clear-symbolic + center + Reset to Default Value + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/gtk3/effectPage.ui b/resources/ui/gtk3/effectPage.ui index 26dabd3..927a8d2 100644 --- a/resources/ui/gtk3/effectPage.ui +++ b/resources/ui/gtk3/effectPage.ui @@ -40,7 +40,7 @@ SPDX-License-Identifier: GPL-3.0-or-later start - Preview this Effect + Preview this effect diff --git a/src/Apparition.js b/src/Apparition.js index c2c3d7a..9c44da1 100644 --- a/src/Apparition.js +++ b/src/Apparition.js @@ -88,7 +88,7 @@ var Apparition = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Apparition.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Apparition.ui`); // Bind all properties. dialog.bindAdjustment('apparition-randomness'); diff --git a/src/BrokenGlass.js b/src/BrokenGlass.js index fee50f1..3a98030 100644 --- a/src/BrokenGlass.js +++ b/src/BrokenGlass.js @@ -146,7 +146,7 @@ var BrokenGlass = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource('/ui/gtk4/BrokenGlass.ui'); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/BrokenGlass.ui`); // Bind all properties. dialog.bindAdjustment('broken-glass-animation-time'); diff --git a/src/Doom.js b/src/Doom.js index 1a224f2..5e35cf8 100644 --- a/src/Doom.js +++ b/src/Doom.js @@ -95,7 +95,7 @@ var Doom = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Doom.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Doom.ui`); // Bind all properties. dialog.bindAdjustment('doom-animation-time'); diff --git a/src/EnergizeA.js b/src/EnergizeA.js index cda9785..391d5c9 100644 --- a/src/EnergizeA.js +++ b/src/EnergizeA.js @@ -87,7 +87,7 @@ var EnergizeA = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/EnergizeA.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/EnergizeA.ui`); // Bind all properties. dialog.bindAdjustment('energize-a-animation-time'); diff --git a/src/EnergizeB.js b/src/EnergizeB.js index e149535..d6318b9 100644 --- a/src/EnergizeB.js +++ b/src/EnergizeB.js @@ -88,7 +88,7 @@ var EnergizeB = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/EnergizeB.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/EnergizeB.ui`); // Bind all properties. dialog.bindAdjustment('energize-b-animation-time'); diff --git a/src/Fire.js b/src/Fire.js index 7c32fff..3123b28 100644 --- a/src/Fire.js +++ b/src/Fire.js @@ -107,7 +107,7 @@ var Fire = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Fire.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Fire.ui`); // Bind all properties. dialog.bindAdjustment('fire-animation-time'); diff --git a/src/Glide.js b/src/Glide.js index 350d728..f76e5f3 100644 --- a/src/Glide.js +++ b/src/Glide.js @@ -83,7 +83,7 @@ var Glide = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Glide.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Glide.ui`); // Bind all properties. dialog.bindAdjustment('glide-animation-time'); diff --git a/src/Hexagon.js b/src/Hexagon.js index a92a0d1..8116c70 100644 --- a/src/Hexagon.js +++ b/src/Hexagon.js @@ -105,7 +105,7 @@ var Hexagon = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Hexagon.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Hexagon.ui`); // Bind all properties. dialog.bindAdjustment('hexagon-animation-time'); diff --git a/src/Incinerate.js b/src/Incinerate.js index 1e67e0e..cc506e1 100644 --- a/src/Incinerate.js +++ b/src/Incinerate.js @@ -138,7 +138,7 @@ var Incinerate = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Incinerate.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Incinerate.ui`); // Bind all properties. dialog.bindAdjustment('incinerate-animation-time'); diff --git a/src/Matrix.js b/src/Matrix.js index 1c8969b..7b0f4f0 100644 --- a/src/Matrix.js +++ b/src/Matrix.js @@ -121,7 +121,7 @@ var Matrix = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource('/ui/gtk4/Matrix.ui'); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Matrix.ui`); // Bind all properties. dialog.bindAdjustment('matrix-animation-time'); diff --git a/src/PixelWheel.js b/src/PixelWheel.js index c568452..46a804e 100644 --- a/src/PixelWheel.js +++ b/src/PixelWheel.js @@ -81,7 +81,7 @@ var PixelWheel = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/PixelWheel.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/PixelWheel.ui`); // Bind all properties. dialog.bindAdjustment('pixel-wheel-animation-time'); diff --git a/src/PixelWipe.js b/src/PixelWipe.js index 1378d80..e78e1f1 100644 --- a/src/PixelWipe.js +++ b/src/PixelWipe.js @@ -107,7 +107,7 @@ var PixelWipe = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/PixelWipe.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/PixelWipe.ui`); // Bind all properties. dialog.bindAdjustment('pixel-wipe-animation-time'); diff --git a/src/Pixelate.js b/src/Pixelate.js index 3127fd0..3ca6713 100644 --- a/src/Pixelate.js +++ b/src/Pixelate.js @@ -81,7 +81,7 @@ var Pixelate = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Pixelate.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Pixelate.ui`); // Bind all properties. dialog.bindAdjustment('pixelate-animation-time'); diff --git a/src/SnapOfDisintegration.js b/src/SnapOfDisintegration.js index 1fb47cc..3750ff4 100644 --- a/src/SnapOfDisintegration.js +++ b/src/SnapOfDisintegration.js @@ -125,7 +125,8 @@ var SnapOfDisintegration = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource('/ui/gtk4/SnapOfDisintegration.ui'); + dialog.getBuilder().add_from_resource( + `/ui/${utils.getUIDir()}/SnapOfDisintegration.ui`); // Bind all properties. dialog.bindAdjustment('snap-animation-time'); diff --git a/src/TRexAttack.js b/src/TRexAttack.js index c5051b8..e59cf1f 100644 --- a/src/TRexAttack.js +++ b/src/TRexAttack.js @@ -123,7 +123,7 @@ var TRexAttack = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource('/ui/gtk4/TRexAttack.ui'); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/TRexAttack.ui`); // Bind all properties. dialog.bindAdjustment('trex-animation-time'); diff --git a/src/TVEffect.js b/src/TVEffect.js index fe0b270..2dabded 100644 --- a/src/TVEffect.js +++ b/src/TVEffect.js @@ -85,7 +85,7 @@ var TVEffect = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/TVEffect.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/TVEffect.ui`); // Bind all properties. dialog.bindAdjustment('tv-animation-time'); diff --git a/src/Wisps.js b/src/Wisps.js index 676cc02..76fe75d 100644 --- a/src/Wisps.js +++ b/src/Wisps.js @@ -93,7 +93,7 @@ var Wisps = class { getPreferences(dialog) { // Add the settings page to the builder. - dialog.getBuilder().add_from_resource(`/ui/${utils.getGTKString()}/Wisps.ui`); + dialog.getBuilder().add_from_resource(`/ui/${utils.getUIDir()}/Wisps.ui`); // Bind all properties. dialog.bindAdjustment('wisps-animation-time'); diff --git a/src/utils.js b/src/utils.js index 28b3346..8e5024f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -17,6 +17,14 @@ const {Gtk, Gio} = imports.gi; const ByteArray = imports.byteArray; +// libadwaita is available starting with GNOME Shell 42. +let Adw = null; +try { + Adw = imports.gi.Adw; +} catch (e) { + // Nothing to do. +} + // Returns the given argument, except for "alpha", "beta", and "rc". In these cases -3, // -2, and -1 are returned respectively. function toNumericVersion(x) { @@ -62,9 +70,16 @@ function isGTK4() { return Gtk.get_major_version() == 4; } -// This method returns 'gtk3' or 'gtk4' depending on the currently used gtk version. -function getGTKString() { - return isGTK4() ? 'gtk4' : 'gtk3'; +// Starting with GNOME Shell 42, the settings dialog uses libadwaita (at least most of +// the time - it seems that pop!_OS does not support libadwaita even on GNOME 42). +function isADW() { + return Adw && shellVersionIsAtLeast(42, 'beta'); +} + +// This method returns 'gtk3', 'gtk4', or 'adw' depending on the currently used GTK / and +// or libadwaita version. +function getUIDir() { + return isADW() ? 'adw' : (isGTK4() ? 'gtk4' : 'gtk3'); } // This method returns true if the current GNOME Shell version matches the given