summaryrefslogtreecommitdiff
path: root/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management
diff options
context:
space:
mode:
Diffstat (limited to 'raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management')
-rw-r--r--raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/effect_row.js222
-rw-r--r--raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/effects_dialog.js174
-rw-r--r--raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/pipeline_choose_row.js106
-rw-r--r--raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/pipeline_group.js99
4 files changed, 0 insertions, 601 deletions
diff --git a/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/effect_row.js b/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/effect_row.js
deleted file mode 100644
index 130edfd..0000000
--- a/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/effect_row.js
+++ /dev/null
@@ -1,222 +0,0 @@
-import Adw from 'gi://Adw';
-import GObject from 'gi://GObject';
-import Gtk from 'gi://Gtk';
-import { gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
-
-import { get_supported_effects } from '../../effects/effects.js';
-
-
-export const EffectRow = GObject.registerClass({
- GTypeName: 'EffectRow',
- InternalChildren: [],
-}, class EffectRow extends Adw.ExpanderRow {
- constructor(effect, effects_dialog) {
- super({});
-
- this.SUPPORTED_EFFECTS = get_supported_effects(_);
-
- this.effect = effect;
- this.effects_dialog = effects_dialog;
- this.pipeline_id = effects_dialog.pipeline_id;
- this.pipelines_manager = effects_dialog.pipelines_manager;
-
- if (effect.type in this.SUPPORTED_EFFECTS) {
- this.set_title(this.SUPPORTED_EFFECTS[effect.type].name);
- this.set_subtitle(this.SUPPORTED_EFFECTS[effect.type].description);
- this.populate_options();
- }
- else {
- this._warn(`could not assign effect ${effect.type} to its correct name`);
- this.set_title(effect.type);
- }
-
- let prefix_bin = new Gtk.Box({
- spacing: 6
- });
- this.add_prefix(prefix_bin);
-
- let move_bin = new Gtk.Box({
- orientation: Gtk.Orientation.VERTICAL,
- 'width-request': 38,
- 'height-request': 38,
- 'margin-top': 6,
- 'margin-bottom': 6
- });
- prefix_bin.append(move_bin);
- move_bin.add_css_class('linked');
-
- this._move_up_button = new Gtk.Button({
- 'icon-name': 'go-up-symbolic',
- 'width-request': 38,
- 'height-request': 19
- });
- this._move_down_button = new Gtk.Button({
- 'icon-name': 'go-down-symbolic',
- 'width-request': 38,
- 'height-request': 19
- });
- this._move_up_button.add_css_class('flat');
- this._move_down_button.add_css_class('flat');
- move_bin.append(this._move_up_button);
- move_bin.append(this._move_down_button);
-
- this._move_up_button.connect('clicked', () => effects_dialog.move_row_by(this, -1));
- this._move_down_button.connect('clicked', () => effects_dialog.move_row_by(this, +1));
-
- let remove_button = new Gtk.Button({
- 'icon-name': 'remove-row-symbolic',
- 'width-request': 38,
- 'height-request': 38,
- 'margin-top': 6,
- 'margin-bottom': 6,
- 'valign': Gtk.Align.CENTER
- });
- prefix_bin.append(remove_button);
- remove_button.add_css_class('destructive-action');
-
- remove_button.connect('clicked', () => effects_dialog.remove_row(this));
- }
-
- populate_options() {
- const editable_params = this.SUPPORTED_EFFECTS[this.effect.type].editable_params;
-
- if (Object.keys(editable_params).length == 0)
- this.enable_expansion = false;
-
- for (const param_key in editable_params) {
- let param = editable_params[param_key];
- let row;
- switch (param.type) {
- case "integer":
- row = new Adw.SpinRow({
- adjustment: new Gtk.Adjustment({
- lower: param.min,
- upper: param.max,
- step_increment: param.increment
- })
- });
- row.adjustment.set_value(this.get_effect_param(param_key));
- row.adjustment.connect(
- 'value-changed', () => this.set_effect_param(param_key, row.adjustment.value)
- );
- break;
-
- case "float":
- row = new Adw.ActionRow;
- let scale = new Gtk.Scale({
- valign: Gtk.Align.CENTER,
- hexpand: true,
- width_request: 200,
- draw_value: true,
- value_pos: Gtk.PositionType.RIGHT,
- digits: param.digits,
- adjustment: new Gtk.Adjustment({
- lower: param.min,
- upper: param.max,
- step_increment: param.increment,
- page_increment: param.big_increment
- })
- });
- // TODO check if it's a good idea to set the default parameter, as the "good"
- // value really change depending on the user wallpaper... if so, do for dynamic
- // blur too
- scale.add_mark(
- this.get_default_effect_param(param_key), Gtk.PositionType.BOTTOM, null
- );
- row.add_suffix(scale);
- scale.adjustment.set_value(this.get_effect_param(param_key));
- scale.adjustment.connect(
- 'value-changed', () => this.set_effect_param(param_key, scale.adjustment.value)
- );
- break;
-
- case "boolean":
- row = new Adw.SwitchRow;
- row.set_active(this.get_effect_param(param_key));
- row.connect(
- 'notify::active', () => this.set_effect_param(param_key, row.active)
- );
- break;
-
- case "dropdown":
- row = new Adw.ComboRow({ model: new Gtk.StringList });
- param.options.forEach(option => row.model.append(option));
- row.selected = this.get_effect_param(param_key);
- row.connect(
- 'notify::selected', () => this.set_effect_param(param_key, row.selected)
- );
- break;
-
- case "rgba":
- row = new Adw.ActionRow;
- let color_button = new Gtk.ColorButton({
- valign: Gtk.Align.CENTER,
- width_request: 75,
- height_request: 45,
- show_editor: true,
- use_alpha: true
- });
- row.add_suffix(color_button);
- // set original color
- let c = color_button.get_rgba().copy();
- [c.red, c.green, c.blue, c.alpha] = this.get_effect_param(param_key);
- color_button.set_rgba(c);
- // update on on 'color-set'
- color_button.connect(
- 'color-set', () => {
- let c = color_button.get_rgba();
- this.set_effect_param(param_key, [c.red, c.green, c.blue, c.alpha]);
- }
- );
- break;
-
- default:
- row = new Adw.ActionRow;
- break;
- }
- row.set_title(param.name);
- row.set_subtitle(param.description);
- this.add_row(row);
- }
- }
-
- get_effect_param(key) {
- let effects = this.pipelines_manager.pipelines[this.pipeline_id].effects;
- const gsettings_effect = effects.find(e => e.id == this.effect.id);
-
- if ('params' in gsettings_effect && key in gsettings_effect.params)
- return gsettings_effect.params[key];
- else
- return this.get_default_effect_param(key);
- }
-
- get_default_effect_param(key) {
- return this.SUPPORTED_EFFECTS[this.effect.type].class.default_params[key];
- }
-
- set_effect_param(key, value) {
- // we must pay attention not to change the effects in the pipelines manager before updating
- // it in gsettings, else it won't be updated (or every effect will be)
- let effects = this.pipelines_manager.pipelines[this.pipeline_id].effects;
- const effect_index = effects.findIndex(e => e.id == this.effect.id);
-
- if (effect_index >= 0) {
- effects[effect_index] = {
- ...this.effect, params: { ...this.effect.params }
- };
- effects[effect_index].params[key] = value;
- this.effect = effects[effect_index];
- }
- else
- this._warn(`effect not found when setting key ${key}`);
-
- this.pipelines_manager.update_pipeline_effects(this.pipeline_id, effects, false);
- }
-
- _warn(str) {
- console.warn(
- `[Blur my Shell > effect row] pipeline '${this.pipeline_id}',`
- + ` effect '${this.effect.id}': ${str}`
- );
- }
-});
diff --git a/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/effects_dialog.js b/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/effects_dialog.js
deleted file mode 100644
index 222a92e..0000000
--- a/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/effects_dialog.js
+++ /dev/null
@@ -1,174 +0,0 @@
-import Adw from 'gi://Adw';
-import GLib from 'gi://GLib';
-import GObject from 'gi://GObject';
-import Gtk from 'gi://Gtk';
-import Gio from 'gi://Gio';
-import { gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
-
-import { EffectRow } from './effect_row.js';
-import { get_effects_groups, get_supported_effects } from '../../effects/effects.js';
-
-export const EffectsDialog = GObject.registerClass({
- GTypeName: 'EffectsDialog',
- Template: GLib.uri_resolve_relative(import.meta.url, '../../ui/effects-dialog.ui', GLib.UriFlags.NONE),
- InternalChildren: [
- "add_effect",
- "add_effect_alt_menu",
- "effects_list"
- ],
-}, class EffectsDialog extends Adw.PreferencesDialog {
- constructor(pipelines_manager, pipeline_id) {
- super({});
-
- this.EFFECTS_GROUPS = get_effects_groups(_);
- this.SUPPORTED_EFFECTS = get_supported_effects(_);
-
- this.pipelines_manager = pipelines_manager;
- this.pipeline_id = pipeline_id;
-
- let pipeline = pipelines_manager.pipelines[pipeline_id];
-
- this.set_title(pipeline.name.length > 0 ? _(`Effects for "${pipeline.name}"`) : _("Effects"));
-
- pipeline.effects.forEach(effect => {
- const effect_row = new EffectRow(effect, this);
- this._effects_list.add(effect_row);
- this.update_rows_insensitive_mover(effect_row);
- });
-
- // setup advanced effects chooser action
- this.show_advanced_effects = false;
- let action_group = new Gio.SimpleActionGroup();
- this.insert_action_group('effects-dialog', action_group);
- let advanced_effects_action = Gio.SimpleAction.new_stateful(
- 'advanced-effects-bool',
- null,
- GLib.Variant.new_boolean(this.show_advanced_effects)
- );
- advanced_effects_action.connect(
- 'change-state',
- (_, state) => {
- this.show_advanced_effects = state.get_boolean();
- this.build_effects_chooser();
- advanced_effects_action.set_state(state);
- }
- );
- action_group.add_action(advanced_effects_action);
-
- this.build_effects_chooser();
- this._add_effect.connect('clicked', () => this.effects_chooser_dialog.present(this));
- }
-
- build_effects_chooser() {
- this.effects_chooser_dialog = new Adw.Dialog({
- presentation_mode: Adw.DialogPresentationMode.BOTTOM_SHEET,
- content_width: 450
- });
-
- let page = new Adw.PreferencesPage;
- this.effects_chooser_dialog.set_child(page);
-
- for (const effects_group in this.EFFECTS_GROUPS) {
- const group_infos = this.EFFECTS_GROUPS[effects_group];
-
- let group = new Adw.PreferencesGroup({
- title: group_infos.name
- });
- page.add(group);
-
- for (const effect_type of group_infos.contains) {
- if (!(effect_type in this.SUPPORTED_EFFECTS))
- continue;
-
- if (!this.show_advanced_effects && this.SUPPORTED_EFFECTS[effect_type].is_advanced)
- continue;
-
- let action_row = new Adw.ActionRow({
- title: this.SUPPORTED_EFFECTS[effect_type].name,
- subtitle: this.SUPPORTED_EFFECTS[effect_type].description
- });
- let select_button = new Gtk.Button({
- 'icon-name': 'select-row-symbolic',
- 'width-request': 38,
- 'height-request': 38,
- 'margin-top': 6,
- 'margin-bottom': 6
- });
- group.add(action_row);
-
- select_button.add_css_class('flat');
- action_row.add_suffix(select_button);
- action_row.set_activatable_widget(select_button);
- select_button.connect('clicked', () => {
- this.append_effect(effect_type);
- this.effects_chooser_dialog.close();
- });
- }
- }
- }
-
- append_effect(effect_type) {
- const effect = {
- type: effect_type, id: "effect_" + ("" + Math.random()).slice(2, 16)
- };
- this.pipelines_manager.update_pipeline_effects(
- this.pipeline_id,
- [...this.pipelines_manager.pipelines[this.pipeline_id].effects, effect]
- );
-
- const effect_row = new EffectRow(effect, this);
- this._effects_list.add(effect_row);
- this.move_row_by(effect_row, 0);
- this.update_rows_insensitive_mover(effect_row);
- }
-
- move_row_by(row, number) {
- const effects = this.pipelines_manager.pipelines[this.pipeline_id].effects;
- const effect_index = effects.findIndex(e => e.id == row.effect.id);
-
- if (effect_index >= 0) {
- effects.splice(effect_index, 1);
- effects.splice(effect_index + number, 0, row.effect);
-
- const listbox = row.get_parent();
- listbox.set_sort_func((row_a, row_b) => {
- const id_a = effects.findIndex(e => e.id == row_a.effect.id);
- const id_b = effects.findIndex(e => e.id == row_b.effect.id);
- return id_a > id_b;
- });
-
- this.update_rows_insensitive_mover(row);
-
- this.pipelines_manager.update_pipeline_effects(
- this.pipeline_id, effects
- );
- }
- }
-
- update_rows_insensitive_mover(any_row) {
- if (this._insensitive_top)
- this._insensitive_top.set_sensitive(true);
- if (this._insensitive_bottom)
- this._insensitive_bottom.set_sensitive(true);
-
- const listbox = any_row.get_parent();
- this._insensitive_top = listbox.get_first_child()._move_up_button;
- this._insensitive_top?.set_sensitive(false);
- this._insensitive_bottom = listbox.get_last_child()._move_down_button;
- this._insensitive_bottom?.set_sensitive(false);
- }
-
- remove_row(row) {
- const effects = this.pipelines_manager.pipelines[this.pipeline_id].effects;
- const effect_index = effects.findIndex(e => e.id == row.effect.id);
-
- if (effect_index >= 0) {
- effects.splice(effect_index, 1);
- this.pipelines_manager.update_pipeline_effects(
- this.pipeline_id, effects
- );
- }
-
- this._effects_list.remove(row);
- }
-});
diff --git a/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/pipeline_choose_row.js b/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/pipeline_choose_row.js
deleted file mode 100644
index e0c5165..0000000
--- a/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/pipeline_choose_row.js
+++ /dev/null
@@ -1,106 +0,0 @@
-import Adw from 'gi://Adw';
-import GLib from 'gi://GLib';
-import GObject from 'gi://GObject';
-import Gtk from 'gi://Gtk';
-import { gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
-
-
-export const PipelineChooseRow = GObject.registerClass({
- GTypeName: 'PipelineChooseRow',
- Template: GLib.uri_resolve_relative(import.meta.url, '../../ui/pipeline-choose-row.ui', GLib.UriFlags.NONE),
- InternalChildren: [
- 'pipeline_choose',
- 'pipeline_model',
- 'pipeline_edit'
- ],
-}, class PipelineChooseRow extends Adw.ActionRow {
- initialize(preferences, pipelines_manager, pipelines_page) {
- this.preferences = preferences;
- this.pipelines_manager = pipelines_manager;
- this.pipelines_page = pipelines_page;
-
- this.create_pipelines_list();
-
- // display the correct pipeline name in the drop-down instead of their ids
- const closure_func = string_object => {
- const pipeline_id = string_object.get_string();
- if (pipeline_id == 'create_new')
- return _("Create new pipeline");
- if (pipeline_id in this.pipelines_manager.pipelines)
- return this.pipelines_manager.pipelines[pipeline_id].name;
- else
- return "";
- };
-
- const expression = new Gtk.ClosureExpression(GObject.TYPE_STRING, closure_func, []);
- this._pipeline_choose.expression = expression;
-
- // TODO fix the expression not being re-evaluated other than by setting it again
- this.pipelines_manager.connect(
- 'pipeline-names-changed',
- () => this._pipeline_choose.expression = new Gtk.ClosureExpression(
- GObject.TYPE_STRING, closure_func, []
- )
- );
-
- this.preferences.PIPELINE_changed(() => this.on_settings_pipeline_changed());
-
- this.pipelines_manager.connect('pipeline-list-changed', () => this.create_pipelines_list());
-
- this._pipeline_choose.connect('notify::selected', () => this.on_selected_pipeline_changed());
-
- this._pipeline_edit.connect(
- 'clicked',
- () => this.pipelines_page.open_effects_dialog(this.preferences.PIPELINE)
- );
- }
-
- on_selected_pipeline_changed() {
- if (!this._pipeline_choose.selected_item || this._is_creating_pipelines_list)
- return;
-
- const pipeline_id = this._pipeline_choose.selected_item.get_string();
- if (pipeline_id == 'create_new') {
- const id = this.pipelines_manager.create_pipeline(_("New pipeline"));
- this.preferences.PIPELINE = id;
- }
- else
- this.preferences.PIPELINE = pipeline_id;
- }
-
- on_settings_pipeline_changed() {
- for (let i = 0; i < this._pipeline_model.n_items; i++) {
- const pipeline_id = this._pipeline_model.get_string(i);
- // if we have more pipelines than we should have: rebuild...
- // that is the case when resetting the preferences for example
- if (!(pipeline_id in this.pipelines_manager)) {
- this.create_pipelines_list();
- return;
- }
- if (pipeline_id == this.preferences.PIPELINE)
- this._pipeline_choose.set_selected(i);
- }
- }
-
- create_pipelines_list() {
- // prevent the pipeline selector from being updated while re-creating the list
- this._is_creating_pipelines_list = true;
-
- // remove ancient items
- this._pipeline_model.splice(0, this._pipeline_model.n_items, null);
-
- // add new ones
- let i = 0;
- for (let pipeline_id in this.pipelines_manager.pipelines) {
- this._pipeline_model.append(pipeline_id);
- if (pipeline_id == this.preferences.PIPELINE)
- this._pipeline_choose.set_selected(i);
- i++;
- }
- this._pipeline_model.append('create_new');
-
- // now update the drop-down selector
- this._is_creating_pipelines_list = false;
- this.on_selected_pipeline_changed();
- }
-}); \ No newline at end of file
diff --git a/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/pipeline_group.js b/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/pipeline_group.js
deleted file mode 100644
index 627b576..0000000
--- a/raveos-theme/gnome/theme-data/extensions/installed/blur-my-shell@aunetx/preferences/pipelines_management/pipeline_group.js
+++ /dev/null
@@ -1,99 +0,0 @@
-import Adw from 'gi://Adw';
-import GLib from 'gi://GLib';
-import GObject from 'gi://GObject';
-import Gtk from 'gi://Gtk';
-import { gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
-
-import { get_supported_effects } from '../../effects/effects.js';
-
-
-export const PipelineGroup = GObject.registerClass({
- GTypeName: 'PipelineGroup',
- Template: GLib.uri_resolve_relative(import.meta.url, '../../ui/pipeline-group.ui', GLib.UriFlags.NONE),
- InternalChildren: [
- "title",
- "effects_description_row",
- "manage_effects"
- ],
-}, class PipelineGroup extends Adw.PreferencesGroup {
- constructor(pipelines_manager, pipeline_id, pipeline, pipelines_page) {
- super({});
-
- this.SUPPORTED_EFFECTS = get_supported_effects(_);
-
- this._pipelines_manager = pipelines_manager;
- this._pipelines_page = pipelines_page;
- this._pipeline_id = pipeline_id;
-
- // set the description
- this.set_description(_(`Pipeline id: "${pipeline_id}"`));
-
- // set the title and connect it to the text entry
- this.set_title(pipeline.name.length > 0 ? pipeline.name : " ");
- this._title.set_text(pipeline.name);
- this._title.connect(
- 'changed',
- () => pipelines_manager.rename_pipeline(pipeline_id, this._title.get_text())
- );
-
- // the bin containing the actions
- let prefix_bin = new Gtk.Box;
- prefix_bin.add_css_class('linked');
- this._title.add_prefix(prefix_bin);
-
- // add a 'remove' button if we are not the default pipeline
- if (pipeline_id != "pipeline_default") {
- let remove_button = new Gtk.Button({
- 'icon-name': 'remove-row-symbolic',
- 'width-request': 38,
- 'height-request': 38,
- 'margin-top': 6,
- 'margin-bottom': 6
- });
- remove_button.add_css_class('destructive-action');
- prefix_bin.append(remove_button);
- remove_button.connect('clicked', () => pipelines_manager.delete_pipeline(pipeline_id));
- }
- // add a 'duplicate' button
- let duplicate_button = new Gtk.Button({
- 'icon-name': 'duplicate-row-symbolic',
- 'width-request': 38,
- 'height-request': 38,
- 'margin-top': 6,
- 'margin-bottom': 6
- });
- prefix_bin.append(duplicate_button);
- duplicate_button.connect('clicked', () => pipelines_manager.duplicate_pipeline(pipeline_id));
-
- this.update_effects_description_row();
- this._pipelines_manager.connect(
- pipeline_id + '::pipeline-updated',
- () => this.update_effects_description_row()
- );
-
- this._manage_effects.connect(
- 'clicked',
- () => pipelines_page.open_effects_dialog(pipeline_id)
- );
- }
-
- update_effects_description_row() {
- const effects = this._pipelines_manager.pipelines[this._pipeline_id].effects;
-
- if (effects.length == 0)
- this._effects_description_row.set_title(_("No effect"));
- else if (effects.length == 1)
- this._effects_description_row.set_title(_("1 effect"));
- else
- this._effects_description_row.set_title(_(`${effects.length} effects`));
-
- let subtitle = "";
- effects.forEach(effect => {
- if (effect.type in this.SUPPORTED_EFFECTS)
- subtitle += _(`${this.SUPPORTED_EFFECTS[effect.type].name}, `);
- else
- subtitle += _("Unknown effect, ");
- });
- this._effects_description_row.set_subtitle(subtitle.slice(0, -2));
- }
-});