diff --git a/gnome/.commands.json b/gnome/.commands.json new file mode 100644 index 0000000..e93f560 --- /dev/null +++ b/gnome/.commands.json @@ -0,0 +1,34 @@ +[ + { + "title": "Record", + "command": "record", + "icon": "utilities-terminal" + }, + { + "title": "File Manager 3", + "command": "nautilus", + "icon": "folder" + }, + { + "type": "separator" + }, + { + "title": "Web Browser", + "command": "firefox", + "icon": "web-browser" + }, + { + "type": "separator" + }, + { + "title": "SSH Connections", + "type": "submenu", + "submenu": [ + { + "title": "Connect to Server (SSH)", + "command": "gnome-terminal -- bash -c 'ssh root@10.144.1.2 -p 8022'", + "icon": "utilities-terminal" + } + ] + } +] diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/blur.js b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/blur.js index e063be6..95c7b77 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/blur.js +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/blur.js @@ -37,7 +37,7 @@ function log(msg) { } // we patch UnlockDialog._updateBackgroundEffects() -function _updateBackgroundEffects_BWP(monitorIndex) { +export function _updateBackgroundEffects_BWP(monitorIndex) { // GNOME shell 3.36.4 and above log("_updateBackgroundEffects_BWP() called for shell >= 3.36.4"); const themeContext = St.ThemeContext.get_for_stage(global.stage); @@ -68,18 +68,26 @@ function _updateBackgroundEffects_BWP(monitorIndex) { // we patch both UnlockDialog._showClock() and UnlockDialog._showPrompt() to let us // adjustable blur in a Windows-like way (this ensures login prompt is readable) -function _showClock_BWP() { +export function _showClock_BWP() { promptActive = false; this._showClock_GNOME(); // pass to default GNOME function this._updateBackgroundEffects(); } -function _showPrompt_BWP() { +export function _showPrompt_BWP() { promptActive = true; this._showPrompt_GNOME(); // pass to default GNOME function this._updateBackgroundEffects(); } +export function _clampValue(value) { + // valid values are 0 to 100 + if (value > 100) + value = 100; + if (value < 0 ) + value = 0; + return value; +} export default class Blur { constructor() { this.enabled = false; @@ -87,24 +95,15 @@ export default class Blur { } set_blur_strength(value) { - BWP_BLUR_SIGMA = this._clampValue(value); + BWP_BLUR_SIGMA = _clampValue(value); log("lockscreen blur strength set to "+BWP_BLUR_SIGMA); } set_blur_brightness(value) { - BWP_BLUR_BRIGHTNESS = this._clampValue(value); + BWP_BLUR_BRIGHTNESS = _clampValue(value); log("lockscreen brightness set to " + BWP_BLUR_BRIGHTNESS); } - // valid values are 0 to 100 - _clampValue(value) { - if (value > 100) - value = 100; - if (value < 0 ) - value = 0; - return value; - } - _switch(enabled) { if (enabled && !this.enabled) { this._enable(); diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/carousel.js b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/carousel.js index c673b14..f522ee7 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/carousel.js +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/carousel.js @@ -107,8 +107,8 @@ export default class Carousel { deleteButton.connect('clicked', (widget) => { this.log('Delete requested for '+filename); Utils.deleteImage(filename); - //Utils.cleanupImageList(this.settings); // hide image instead - Utils.hideImage(this.settings, [image]); + Utils.setImageHiddenStatus(this.settings, image.urlbase, true); + Utils.cleanupImageList(this.settings); // hide image instead widget.get_parent().get_parent().set_visible(false); // bit of a hack if (this.callbackfunc) this.callbackfunc(); @@ -169,6 +169,7 @@ export default class Carousel { this.flowBox.remove(widget.get_parent()); this.flowBox.set_max_children_per_line(2); this._create_gallery(); + }); let item = buildable.get_object('flowBoxPlaceholder'); diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/extension.js b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/extension.js index e286d0f..493e2c8 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/extension.js +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/extension.js @@ -561,6 +561,7 @@ class BingWallpaperIndicator extends Button { _randomModeChanged() { let randomEnabled = this._settings.get_boolean('random-mode-enabled'); + Utils.validate_interval(this._settings); [this.toggleShuffleOnlyFaves, this.toggleShuffleOnlyUHD /*, this.toggleShuffleOnlyUnhidden*/] .forEach( x => { x.setSensitive(randomEnabled); @@ -588,8 +589,14 @@ class BingWallpaperIndicator extends Button { _trashImage() { log('trash image '+this.imageURL+' status was '+this.hidden_status); this.hidden_status = !this.hidden_status; - Utils.setImageHiddenStatus(this._settings, [this.imageURL], this.hidden_status); - this._setTrashIcon(this.hidden_status?ICON_UNTRASH_BUTTON:ICON_TRASH_BUTTON); + Utils.setImageHiddenStatus(this._settings, this.imageURL, this.hidden_status); + this._setTrashIcon(this.hidden_status?this.ICON_UNTRASH_BUTTON:this.ICON_TRASH_BUTTON); + if (this._settings.get_boolean('trash-deletes-images')) { + log('image to be deleted: '+this.filename); + Utils.deleteImage(this.filename); + Utils.validate_imagename(this._settings); + } + } _setFavouriteIcon(icon_name) { @@ -715,7 +722,7 @@ class BingWallpaperIndicator extends Button { if (seconds == null) { let diff = -Math.floor(GLib.DateTime.new_now_local().difference(this.shuffledue)/1000000); log('shuffle ('+this.shuffledue.format_iso8601()+') diff = '+diff); - if (diff > 0) { + if (diff > 30) { // on occasions the above will be 1 second seconds = diff; // if not specified, we should maintain the existing shuffle timeout (i.e. we just restored from saved state) } else if (this._settings.get_string('random-interval-mode') != 'custom') { @@ -842,6 +849,7 @@ class BingWallpaperIndicator extends Button { // special values, 'current' is most recent (default mode), 'random' picks one at random, anything else should be filename if (force_shuffle) { + log('forcing shuffle of image') image = this._shuffleImage(); if (this._settings.get_boolean('random-mode-enabled')) this._restartShuffleTimeout(); diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/pt_BR/LC_MESSAGES/BingWallpaper.mo b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/pt_BR/LC_MESSAGES/BingWallpaper.mo index 23eded6..618d397 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/pt_BR/LC_MESSAGES/BingWallpaper.mo and b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/pt_BR/LC_MESSAGES/BingWallpaper.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/metadata.json b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/metadata.json index 02d0da8..8d55d13 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/metadata.json @@ -5,9 +5,10 @@ "name": "Bing Wallpaper", "settings-schema": "org.gnome.shell.extensions.bingwallpaper", "shell-version": [ - "45" + "45", + "46" ], "url": "https://github.com/neffo/bing-wallpaper-gnome-extension", "uuid": "BingWallpaper@ineffable-gmail.com", - "version": 48 + "version": 49 } \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/prefs.js b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/prefs.js index 4986c7a..a2a1c20 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/prefs.js +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/prefs.js @@ -21,19 +21,25 @@ const BingImageURL = Utils.BingImageURL; var DESKTOP_SCHEMA = 'org.gnome.desktop.background'; -var PREFS_DEFAULT_WIDTH = 950; -var PREFS_DEFAULT_HEIGHT = 950; +// this is pretty wide because of the size of the gallery +var PREFS_DEFAULT_WIDTH = 750; +var PREFS_DEFAULT_HEIGHT = 750; export default class BingWallpaperExtensionPreferences extends ExtensionPreferences { fillPreferencesWindow(window) { // formally globals let settings = this.getSettings(Utils.BING_SCHEMA); - let desktop_settings = this.getSettings(Utils.DESKTOP_SCHEMA); + //let desktop_settings = this.getSettings(Utils.DESKTOP_SCHEMA); window.set_default_size(PREFS_DEFAULT_WIDTH, PREFS_DEFAULT_HEIGHT); - let icon_image = null; + /*let icon_image = null;*/ let provider = new Gtk.CssProvider(); + provider.load_from_path(this.dir.get_path() + '/ui/prefs.css'); + Gtk.StyleContext.add_provider_for_display( + Gdk.Display.get_default(), + provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); let carousel = null; let httpSession = null; @@ -42,55 +48,137 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen if (settings.get_boolean('debug-logging')) console.log("BingWallpaper extension: " + msg); // disable to keep the noise down in journal } - - // Prepare labels and controls + let buildable = new Gtk.Builder(); // GTK4 removes some properties, and builder breaks when it sees them - buildable.add_from_file( this.dir.get_path() + '/ui/Settings4.ui' ); - provider.load_from_path(this.dir.get_path() + '/ui/prefs.css'); - Gtk.StyleContext.add_provider_for_display( - Gdk.Display.get_default(), - provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + buildable.add_from_file( this.dir.get_path() + '/ui/prefsadw.ui' ); - let box = buildable.get_object('prefs_widget'); + // adw or gtk objects we'll attach to below + const settings_page = buildable.get_object('settings_page'); + const hideSwitch = buildable.get_object('hideSwitch'); + const notifySwitch = buildable.get_object('notifySwitch'); + const iconEntry = buildable.get_object('iconEntry'); + const bgSwitch = buildable.get_object('bgSwitch'); + const shuffleSwitch = buildable.get_object('shuffleSwitch'); + const shuffleInterval = buildable.get_object('shuffleInterval'); + const folderRow = buildable.get_object('folderRow'); + const lockscreen_page = buildable.get_object('lockscreen_page'); + const overrideSwitch = buildable.get_object('overrideSwitch'); + const blurPresets = buildable.get_object('blurPresets'); + const strengthEntry = buildable.get_object('strengthEntry'); + const brightnessEntry = buildable.get_object('brightnessEntry'); + const blurAdjustment = buildable.get_object('blurAdjustment'); + const brightnessAdjustment = buildable.get_object('brightnessAdjustment'); + const resolutionEntry = buildable.get_object('resolutionEntry'); + const debugSwitch = buildable.get_object('debug_switch'); + const revertSwitch = buildable.get_object('revert_switch'); + const trash_purge_switch = buildable.get_object('trash_purge_switch'); + const always_export_switch = buildable.get_object('always_export_switch'); + const gallery_page = buildable.get_object('gallery_page'); + const carouselFlowBox = buildable.get_object('carouselFlowBox'); + const randomIntervalEntry = buildable.get_object('entry_random_interval'); + const debug_page = buildable.get_object('debug_page'); + const json_actionrow = buildable.get_object('json_actionrow'); + const about_page = buildable.get_object('about_page'); + const version_button = buildable.get_object('version_button'); + const change_log = buildable.get_object('change_log'); - // fix size of prefs window in GNOME shell 40+ (but super racy, so is unreliable) + window.add(settings_page); + window.add(lockscreen_page); + window.add(gallery_page); + window.add(debug_page); + window.add(about_page); - buildable.get_object('extension_version').set_text(this.metadata.version.toString()); - buildable.get_object('extension_name').set_text(this.metadata.name.toString()); + iconEntry.set_value(1+Utils.icon_list.indexOf(settings.get_string('icon-name'))); - // assign variables to UI objects we've loaded - let hideSwitch = buildable.get_object('hide'); - let iconEntry = buildable.get_object('icon'); - let notifySwitch = buildable.get_object('notify'); - let bgSwitch = buildable.get_object('background'); - let styleEntry = buildable.get_object('background_style'); - let fileChooserBtn = buildable.get_object('download_folder'); - let fileChooser = buildable.get_object('file_chooser'); // this should only exist on Gtk4 - let folderOpenBtn = buildable.get_object('button_open_download_folder'); - let marketEntry = buildable.get_object('market'); - let resolutionEntry = buildable.get_object('resolution'); - let historyEntry = buildable.get_object('history'); - icon_image = buildable.get_object('icon_image'); - let overrideSwitch = buildable.get_object('lockscreen_override'); - let strengthEntry = buildable.get_object('entry_strength'); - let brightnessEntry = buildable.get_object('entry_brightness'); - let debugSwitch = buildable.get_object('debug_switch'); - let revertSwitch = buildable.get_object('revert_switch'); - let unsafeSwitch = buildable.get_object('unsafe_switch'); - let randomIntervalEntry = buildable.get_object('entry_random_interval'); - let change_log = buildable.get_object('change_log'); - let buttonGDMdefault = buildable.get_object('button_default_gnome'); - let buttonnoblur = buildable.get_object('button_no_blur'); - let buttonslightblur = buildable.get_object('button_slight_blur'); - let buttonImportData = buildable.get_object('button_json_import'); - let buttonExportData = buildable.get_object('button_json_export'); - let switchAlwaysExport = buildable.get_object('always_export_switch'); - let switchEnableShuffle = buildable.get_object('shuffle_enabled_switch'); - let entryShuffleMode = buildable.get_object('shuffle_mode_combo'); - let carouselFlowBox = (Gtk.get_major_version() == 4) ? buildable.get_object('carouselFlowBox'): null; + // shuffle intervals + const shuffleIntervals = new Gtk.StringList; + Utils.randomIntervals.forEach((x) => { + shuffleIntervals.append(_(x.title)); + }); + + shuffleInterval.set_model(shuffleIntervals); + shuffleInterval.set_selected(Utils.randomIntervals.map( e => e.value).indexOf(settings.get_string('random-interval-mode'))); + // add wallpaper folder open and change buttons + const openBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'folder-pictures-symbolic', + label: _('Open folder'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + const changeBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'folder-download-symbolic', + label: _('Change folder'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + + folderRow.add_suffix(openBtn); + folderRow.add_suffix(changeBtn); + + blurAdjustment.set_value(settings.get_int('lockscreen-blur-strength')); + brightnessAdjustment.set_value(settings.get_int('lockscreen-blur-brightness')); + + const defaultBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'emblem-default-symbolic', + label: _('Default'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + const noBlurBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'emblem-default-symbolic', + label: _('No blur, slight dim'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + const slightBlurBtn = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'emblem-default-symbolic', + label: _('Slight blur & dim'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + + // add to presets row + blurPresets.add_suffix(defaultBtn); + blurPresets.add_suffix(noBlurBtn); + blurPresets.add_suffix(slightBlurBtn); + + randomIntervalEntry.set_value(settings.get_int('random-interval')); + + // these buttons either export or import saved JSON data + const buttonImportData = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'document-send-symbolic', + label: _('Import'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + const buttonExportData = new Gtk.Button( { + child: new Adw.ButtonContent({ + icon_name: 'document-save-symbolic', + label: _('Export'), + },), + valign: Gtk.Align.CENTER, + halign: Gtk.Align.CENTER, + }); + + json_actionrow.add_suffix(buttonImportData); + json_actionrow.add_suffix(buttonExportData); + + version_button.set_label(this.metadata.version.toString()); + try { httpSession = new Soup.Session(); httpSession.user_agent = 'User-Agent: Mozilla/5.0 (X11; GNOME Shell/' + Config.PACKAGE_VERSION + '; Linux x86_64; +https://github.com/neffo/bing-wallpaper-gnome-extension ) BingWallpaper Gnome Extension/' + this.metadata.version; @@ -98,43 +186,42 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen catch (e) { log("Error creating httpSession: " + e); } - + const icon_image = buildable.get_object('icon_image'); + // check that these are valid (can be edited through dconf-editor) Utils.validate_resolution(settings); Utils.validate_icon(settings, this.path, icon_image); + Utils.validate_interval(settings); // Indicator & notifications settings.bind('hide', hideSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('notify', notifySwitch, 'active', Gio.SettingsBindFlags.DEFAULT); - - // add markets to dropdown list (aka a GtkComboText) - Utils.icon_list.forEach((iconname, index) => { - iconEntry.append(iconname, iconname); - }); - - // user selectable indicator icons - settings.bind('icon-name', iconEntry, 'active_id', Gio.SettingsBindFlags.DEFAULT); settings.connect('changed::icon-name', () => { Utils.validate_icon(settings, this.path, icon_image); + iconEntry.set_value(1 + Utils.icon_list.indexOf(settings.get_string('icon-name'))); + }); + + iconEntry.connect('output', () => { + settings.set_string('icon-name', Utils.icon_list[iconEntry.get_value()-1]); }); - iconEntry.set_active_id(settings.get_string('icon-name')); // connect switches to settings changes settings.bind('set-background', bgSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('debug-logging', debugSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('revert-to-current-image', revertSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); - settings.bind('override-unsafe-wayland', unsafeSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); + //settings.bind('override-unsafe-wayland', unsafeSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('random-interval', randomIntervalEntry, 'value', Gio.SettingsBindFlags.DEFAULT); - settings.bind('always-export-bing-json', switchAlwaysExport, 'active', Gio.SettingsBindFlags.DEFAULT); + settings.bind('trash-deletes-images', trash_purge_switch, 'active', Gio.SettingsBindFlags.DEFAULT); + settings.bind('always-export-bing-json', always_export_switch, 'active', Gio.SettingsBindFlags.DEFAULT); // button opens Nautilus at our image folder - folderOpenBtn.connect('clicked', (widget) => { + openBtn.connect('clicked', (widget) => { Utils.openImageFolder(settings); }); - + // we populate the tab (gtk4+, gnome 40+), this was previously a button to open a new window in gtk3 carousel = new Carousel(settings, null, null, carouselFlowBox, this.dir.get_path()); // auto load carousel - + // this is intended for migrating image folders between computers (or even sharing) or backups // we export the Bing JSON data to the image directory, so this folder becomes portable buttonImportData.connect('clicked', () => { @@ -144,104 +231,66 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen Utils.exportBingJSON(settings); }); - //download folder - fileChooserBtn.set_label(Utils.getWallpaperDir(settings)); - - fileChooserBtn.connect('clicked', (widget) => { - let parent = widget.get_root(); - let curWallpaperDir = Gio.File.new_for_path(Utils.getWallpaperDir(settings)); - fileChooser.set_current_folder(curWallpaperDir.get_parent()); - fileChooser.set_action(Gtk.FileChooserAction.SELECT_FOLDER); - fileChooser.set_transient_for(parent); - fileChooser.set_accept_label(_('Select folder')); - fileChooser.show(); + // change wallpaper button + const dirChooser = new Gtk.FileDialog( { + accept_label: "Select", + modal: true, + title: _("Select wallpaper download folder"), }); - fileChooser.connect('response', (widget, response) => { - if (response !== Gtk.ResponseType.ACCEPT) { - return; - } - let fileURI = fileChooser.get_file().get_path().replace('file://', ''); - fileChooserBtn.set_label(fileURI); - Utils.moveImagesToNewFolder(settings, Utils.getWallpaperDir(settings), fileURI); - Utils.setWallpaperDir(settings, fileURI); - }); + changeBtn.connect('clicked', (widget) => { + dirChooser.set_initial_folder(Gio.File.new_for_path(Utils.getWallpaperDir(settings))); + dirChooser.select_folder(window, null, (self, res) => { + let new_path = self.select_folder_finish(res).get_uri().replace('file://', ''); + log(new_path); + Utils.moveImagesToNewFolder(settings, Utils.getWallpaperDir(settings), new_path); + Utils.setWallpaperDir(settings, new_path); + }); - // in Gtk 4 instead we use a DropDown, but we need to treat it a bit special - let market_grid = buildable.get_object('market_grid'); - marketEntry = Gtk.DropDown.new_from_strings(Utils.marketName); - marketEntry.set_selected(Utils.markets.indexOf(settings.get_string('market'))); - market_grid.attach(marketEntry, 1, 0, 1, 2); - marketEntry.connect('notify::selected-item', () => { - let id = marketEntry.get_selected(); - settings.set_string('market', Utils.markets[id]); }); - settings.connect('changed::market', () => { - marketEntry.set_selected(Utils.markets.indexOf(settings.get_string('market'))); - }); - - settings.connect('changed::download-folder', () => { - fileChooserBtn.set_label(Utils.getWallpaperDir(settings)); - }); - - // Resolution + const resolutionModel = new Gtk.StringList(); Utils.resolutions.forEach((res) => { // add res to dropdown list (aka a GtkComboText) - resolutionEntry.append(res, res); + resolutionModel.append(res); }); + resolutionEntry.set_model(resolutionModel); - settings.bind('resolution', resolutionEntry, 'active_id', Gio.SettingsBindFlags.DEFAULT); + settings.connect('changed::resolution', () => { + resolutionEntry.set_selected(Utils.resolutions.map( e => e.value).indexOf(settings.get_string('resolution'))); + }); settings.connect('changed::resolution', () => { Utils.validate_resolution(settings); }); // shuffle modes - settings.bind('random-mode-enabled', switchEnableShuffle, 'active', Gio.SettingsBindFlags.DEFAULT); - Utils.randomIntervals.forEach((x) => { - entryShuffleMode.append(x.value, _(x.title)); - }); - settings.bind('random-interval-mode', entryShuffleMode, 'active_id', Gio.SettingsBindFlags.DEFAULT); + settings.bind('random-mode-enabled', shuffleSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); + /*settings.bind('random-interval-mode', entryShuffleMode, 'active_id', Gio.SettingsBindFlags.DEFAULT);*/ - // selected image can no longer be changed through a dropdown (didn't scale) - settings.bind('selected-image', historyEntry, 'label', Gio.SettingsBindFlags.DEFAULT); - settings.connect('changed::selected-image', () => { - Utils.validate_imagename(settings); + settings.connect('changed::random-interval-mode', () => { + shuffleInterval.set_selected(Utils.randomIntervals.map( e => e.value).indexOf(settings.get_string('random-interval-mode'))); }); - - // background styles (e.g. zoom or span) - Utils.backgroundStyle.forEach((style) => { - styleEntry.append(style, style); - }); - desktop_settings.bind('picture-options', styleEntry, 'active_id', Gio.SettingsBindFlags.DEFAULT); - + // GDM3 lockscreen blur override settings.bind('override-lockscreen-blur', overrideSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('lockscreen-blur-strength', strengthEntry, 'value', Gio.SettingsBindFlags.DEFAULT); settings.bind('lockscreen-blur-brightness', brightnessEntry, 'value', Gio.SettingsBindFlags.DEFAULT); // add a couple of preset buttons - buttonGDMdefault.connect('clicked', (widget) => { + defaultBtn.connect('clicked', (widget) => { Utils.set_blur_preset(settings, Utils.PRESET_GNOME_DEFAULT); }); - buttonnoblur.connect('clicked', (widget) => { + noBlurBtn.connect('clicked', (widget) => { Utils.set_blur_preset(settings, Utils.PRESET_NO_BLUR); }); - buttonslightblur.connect('clicked', (widget) => { + slightBlurBtn.connect('clicked', (widget) => { Utils.set_blur_preset(settings, Utils.PRESET_SLIGHT_BLUR); }); - - // fetch + + // fetch change log (on about page) + if (httpSession) Utils.fetch_change_log(this.metadata.version.toString(), change_log, httpSession); - - const page = new Adw.PreferencesPage(); - const group = new Adw.PreferencesGroup(); - - group.add(box); - page.add(group); - - window.add(page); } } diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/schemas/gschemas.compiled b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/schemas/gschemas.compiled index 77f335c..bdd63d2 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/schemas/gschemas.compiled and b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/schemas/gschemas.compiled differ diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/schemas/org.gnome.shell.extensions.bingwallpaper.gschema.xml b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/schemas/org.gnome.shell.extensions.bingwallpaper.gschema.xml index c457c1d..b01c105 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/schemas/org.gnome.shell.extensions.bingwallpaper.gschema.xml +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/schemas/org.gnome.shell.extensions.bingwallpaper.gschema.xml @@ -211,7 +211,7 @@ - false + true Trash deletes images or just marks as bad diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/Settings4.ui b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/Settings4.ui deleted file mode 100644 index 073a3bf..0000000 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/Settings4.ui +++ /dev/null @@ -1,1451 +0,0 @@ - - - - - - 50 - 1 - 10 - - - 100 - 5 - 10 - - - 7 - 1 - 2 - - - 300 - 604800 - 300 - 3600 - - - Bing Wallpaper pictures folder - 0 - select-folder - 1 - - - - 120 - - - 0 - 0 - 0 - 500 - - - - - 0 - 12 - 12 - 12 - 12 - vertical - 12 - 0 - - - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - Hide the indicator - 1 - - 0 - 0 - - - - - - end - 1 - - 1 - 0 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - Indicator icon - 1 - - 0 - 0 - 2 - - - - - - 0 - end - - 1 - 1 - 1 - - - - - - 32 - 32 - 0 - end - 1 - ../icons/bing-symbolic.svg - icon_image_black_bg - - 1 - 0 - 1 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - Enable desktop notifications - 1 - - 0 - 0 - - - - - - end - 1 - - 1 - 0 - - - - - - - - - - - - - - - - - 0 - - - 0 - none - - - - - 0 - 12 - 12 - 12 - 12 - - - 0 - Set background image - - 0 - 0 - - - - - - end - 1 - - 1 - 0 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Background style option - - 0 - 0 - - - - - - - 1 - 0 - 1 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - Download folder - - 0 - 0 - - - - - - True - False - end - false - Bing Wallpaper pictures folder - - 1 - 0 - - - - - - Open folder - True - True - - 2 - 0 - - - - - - - - - - - - - - - - - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Selected image - - 0 - 0 - - - - - - - 1 - 0 - 1 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Shuffle enabled - - 0 - 0 - - - - - - end - 1 - - 1 - 0 - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Shuffle mode - - 0 - 0 - - - - - - - 1 - 0 - 1 - - - - - - - - - - - - - - - - - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Bing locale - 1 - - 0 - 0 - - - - - - 0 - start - 0 - - - - 0 - 1 - - - - - - - - - - - - - - - - - - - 0 - Settings - - - - - - - 1 - - - 0 - 12 - 12 - 12 - 12 - vertical - 12 - - - 0 - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - end - - 1 - 0 - - - - - - 0 - start - 1 - Dynamically switches blur on GDM3 lock screen - - - 0 - 1 - - - - - - 0 - start - 1 - Enable dynamic lockscreen blur - 1 - - 0 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Blur can improve readability - - - 0 - 1 - - - - - - 0 - start - 1 - Background blur intensity - - 0 - 0 - - - - - - adjustment_blur - 1 - - 1 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Can improve contrast of login prompt - - - 0 - 1 - - - - - - 0 - start - 1 - Background brightness - - 0 - 0 - - - - - - adjustment_brightness - 1 - - 1 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Presets - 1 - - 0 - 0 - - - - - - No blur, slight dim - 1 - - 1 - 3 - - - - - - GNOME default - 1 - - 1 - 2 - - - - - - Slight blur, slight dim - 1 - - 1 - 4 - - - - - - - - - - - - - - - - - - - - - - 0 - Lock Screen - - - - - - - 2 - - - 0 - 12 - 12 - 12 - 12 - vertical - 12 - - - 0 - 0 - - - 0 - none - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - end - - 1 - 0 - - - - - - 0 - start - 1 - Enable logging to system journal - - - 0 - 1 - - - - - - 0 - start - 1 - Debug logging - 1 - - 0 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Switch to new images when available (unless on random mode) - - - 0 - 1 - - - - - - 0 - start - 1 - Always show new images - 1 - - 0 - 0 - - - - - - end - - 1 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Some newer features may be unstable on Wayland - - - 0 - 1 - - - - - - 0 - start - 1 - Enable all features on Wayland - 1 - - 0 - 0 - - - - - - end - - 1 - 0 - - - - - - - - - - - - - 0 - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Screen resolution - 1 - - 0 - 0 - - - - - - 0 - start - Override automatic resolution selection - - - 0 - 1 - - - - - - - 1 - 0 - 2 - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Manually adjust random interval (seconds) - - - 0 - 1 - - - - - - 0 - start - 1 - Random interval - - 0 - 0 - - - - - - adjustment_random_interval - 1 - - 1 - 0 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Import Bing Wallpaper data - 1 - - 0 - 0 - - - - - - 0 - start - 1 - Import previously exported JSON data from wallpaper directory - - - 0 - 1 - - - - - - Import - 1 - - 1 - 1 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Export Bing Wallpaper data - 1 - - 0 - 0 - - - - - - 0 - start - 1 - Export JSON data to wallpaper dir for backup or data migration - - - 0 - 1 - - - - - - Export - 1 - - 1 - 1 - - - - - - - - - - - - - - - 0 - 12 - 12 - 12 - 12 - 32 - - - 0 - start - 1 - Always export Bing data - 1 - - 0 - 0 - - - - - - 0 - start - 1 - Export Bing JSON whenever data changes - - - - 0 - 1 - - - - - - end - - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - 0 - Debug options - - - - - - - 3 - - - 0 - vertical - - - - 0 - 500 - 0 - 0 - - - 0 - center - 1 - 2 - 2 - 2 - 2 - - - - - - - - - 0 - Gallery - - - - - - - 4 - - - 0 - - - 1 - 0 - vertical - 5 - - - - 0 - Bing Wallpaper - - - - - - - - 0 - New wallpaper images everyday from Bing - center - 1 - - - - - 0 - center - - - - 0 - end - GNOME shell extension version - - - - - 0 - start - ... - - - - - - - https://github.com/neffo/bing-wallpaper-gnome-extension - 0 - 1 - center - https://github.com/neffo/bing-wallpaper-gnome-extension - - - - - 0 - center - vertical - 5 - - - 0 - Maintained by Michael Carroll - - - - - 0 - ineffable@gmail.com - 1 - - - - - 0 - 36 - Show your support to the author on <a href="https://flattr.com/@neffo">Flattr</a> or <a href="https://github.com/sponsors/neffo">Github Sponsors</a>. - 1 - - - - - 0 - 36 - - 1 - - Changes since last version - 1 - - - - - 0 - 36 - Based on NASA APOD GNOME shell extension by Elia Argentieri - center - 1 - - - - - - - - - - 0 - 0 - <span size="small">This program comes with ABSOLUTELY NO WARRANTY. -See the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU General Public License, version 3 or later</a> for details.</span> - 1 - center - 1 - - - - - - - 0 - About - - - - - - diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/carousel4.ui b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/carousel4.ui index 4be8a98..c322874 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/carousel4.ui +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/carousel4.ui @@ -56,7 +56,7 @@ Author: Michael Carroll 320 - 180 + 120 0 1 1 @@ -186,7 +186,7 @@ Author: Michael Carroll 120 0 preferences-desktop-wallpaper-symbolic - 3 + 2 0 0 diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/prefsadw.ui b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/prefsadw.ui new file mode 100644 index 0000000..538035c --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/ui/prefsadw.ui @@ -0,0 +1,438 @@ + + + + + + + emblem-photos-symbolic + Settings + + + Indicator + + + Hide Indicator + Whether to hide the panel indicator + + + + + Desktop notifications + Enable notifications on new images + + + + + Indicator icon + Select from alternate tray icons + + + 1 + 5 + 1 + + + + + + + + + + 64 + 64 + 0 + end + 1 + ../icons/bing-symbolic.svg + icon_image_black_bg + + + + + + + + + Wallpaper + + + Set wallpaper + Whether to set wallpaper automatically + + + + + Shuffle wallpaper + Randomly select wallpaper from collection + + + + + Shuffle interval + How frequently to shuffle wallpapers + + + + + + + Downloads + + + Download folder + Open or change wallpaper downloads folder + + + + + + + applications-system-symbolic + Lock screen + + + Lockscreen blur + + + Dynamic lockscreen blur + Whether to enable dynamic blur mode on lock screen + + + + + Blur strength + Blur strength when login prompt is not visible + + + 0 + 50 + 10 + 1 + + + + + + + Wallpaper brightness + Dim wallpaper when login prompt is not visible + + + 0 + 100 + 10 + 1 + + + + + + + + + + + + Presets + + + + + + + document-open-recent-symbolic + Gallery + + + 0 + 500 + 0 + 0 + + + + + 0 + center + 1 + 2 + 2 + 2 + 2 + + + + + + + + + preferences-other-symbolic + Debug + + + Debug options + + + Debug logging + Enable logging to system journal + + + + + Always show new images + Switch to new images when available (unless on random mode) + + + + + Purge on trash + Trashing an image will remove it from database + + + + + Screen resolution + Override automatic resolution selection + + + + + Random interval + Custom shuffle interval when enabled + + + 300 + 604800 + 300 + 3600 + + + + + + + + + + + + Always export Bing data + Export Bing JSON when image data changes + + + + + Bing JSON data + Custom shuffle interval when enabled + + + + + + + user-info-symbolic + About + + + + + + 128 + presentation + + + + + + True + center + Bing Wallpaper + + + + + + 0 + New wallpaper images everyday from Bing + center + 1 + + + + + + True + center + Maintained by Michael Carroll + + + + + + + + + Version + + + center + True + + + + + + + + Release notes + + + True + left + + + + + + + + + + + vertical + + + + + + GNOME extensions page + True + True + extension_page_linkbutton + + + https://extensions.gnome.org/extension/1262/bing-wallpaper-changer/ + + + + + adw-external-link-symbolic + presentation + + + + + + + Source code + True + True + source_code_linkbutton + + + https://github.com/neffo/bing-wallpaper-gnome-extension + + + + + adw-external-link-symbolic + presentation + + + + + + + Report an issue + True + True + bug_report_linkbutton + + + https://github.com/neffo/bing-wallpaper-gnome-extension/issues + + + + + adw-external-link-symbolic + presentation + + + + + + + Contributors + True + True + contributors_linkbutton + + + https://github.com/neffo/bing-wallpaper-gnome-extension/graphs/contributors + + + + + adw-external-link-symbolic + presentation + + + + + + + License + + + True + left + This extension is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + + + + + + + + + + + + Change folder + true + Select new wallpaper download folder + + + + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/utils.js b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/utils.js index 6f2ff22..1ebe159 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/utils.js +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/utils.js @@ -12,9 +12,9 @@ import GLib from 'gi://GLib'; import Soup from 'gi://Soup'; import GdkPixbuf from 'gi://GdkPixbuf'; -export var PRESET_GNOME_DEFAULT = { blur: 60, dim: 55 }; // as at GNOME 40 -export var PRESET_NO_BLUR = { blur: 0, dim: 60 }; -export var PRESET_SLIGHT_BLUR = { blur: 2, dim: 60 }; +export var PRESET_GNOME_DEFAULT = { blur: 45, dim: 65 }; // as at GNOME 40 +export var PRESET_NO_BLUR = { blur: 0, dim: 65 }; +export var PRESET_SLIGHT_BLUR = { blur: 2, dim: 30 }; export var BING_SCHEMA = 'org.gnome.shell.extensions.bingwallpaper'; export var DESKTOP_SCHEMA = 'org.gnome.desktop.background'; @@ -52,7 +52,8 @@ export var backgroundStyle = ['none', 'wallpaper', 'centered', 'scaled', 'stretc export var randomIntervals = [ {value: 'hourly', title: ('on the hour')}, {value: 'daily', title: ('every day at midnight')}, - {value: 'weekly', title: ('every Sunday at midnight')} ]; + {value: 'weekly', title: ('Sunday at midnight')}, + { value: 'custom', title: ('User defined interval')} ]; export var BingImageURL = 'https://www.bing.com/HPImageArchive.aspx'; export var BingParams = { format: 'js', idx: '0' , n: '8' , mbl: '1' , mkt: '' } ; @@ -67,7 +68,7 @@ export function validate_icon(settings, extension_path, icon_image = null) { // if called from prefs if (icon_image) { BingLog('set icon to: ' + extension_path + '/icons/' + icon_name + '.svg'); - let pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(extension_path + '/icons/' + icon_name + '.svg', 32, 32); + let pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(extension_path + '/icons/' + icon_name + '.svg', 64, 64); icon_image.set_from_pixbuf(pixbuf); } } @@ -78,6 +79,12 @@ export function validate_resolution(settings) { settings.reset('resolution'); } +export function validate_interval(settings) { + let index = randomIntervals.map( e => e.value).indexOf(settings.get_string('random-interval-mode')); + if (index == -1) // if not a valid interval + settings.reset('random-interval-mode'); +} + // FIXME: needs work export function validate_imagename(settings) { let filename = settings.get_string('selected-image'); @@ -188,16 +195,15 @@ export function setImageList(settings, imageList) { } } -export function setImageHiddenStatus(settings, hide_image_list, hide_status) { +export function setImageHiddenStatus(settings, hide_image, hide_status) { // get current image list let image_list = getImageList(settings); + log ('image count = '+image_list.length+', hide_image = '+hide_image); image_list.forEach( (x, i) => { - hide_image_list.forEach(u => { - if (u.includes(x.urlbase)) { - // mark as hidden - x.hidden = hide_status; - } - }); + if (hide_image.includes(x.urlbase)) { + // mark as hidden + x.hidden = hide_status; + } }); // export image list back to settings setImageList(settings, image_list); @@ -294,6 +300,8 @@ export function getImageByIndex(imageList, index) { } export function cleanupImageList(settings) { + if (settings.get_boolean('trash-deletes-images') == false) + return; let curList = imageListSortByDate(getImageList(settings)); let cutOff = GLib.DateTime.new_now_utc().add_days(-8); // 8 days ago let newList = []; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/Options_UI.glade b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/Options_UI.glade new file mode 100644 index 0000000..6ee3bb3 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/Options_UI.glade @@ -0,0 +1,1493 @@ + + + + + 5 + + + center + stk_Main + + + + + 800 + slide-left-right + + + page0 + Options + + + borderless + + + options-grid + 18 + 15 + + + end + 4 + 1 + Recording status indicators + right + + 0 + 0 + + + + + + end + 1 + Show alerts and notifications + + 0 + 1 + + + + + + 1 + start + 1 + + 1 + 1 + + + + + + end + 1 + Show a border around the area being recorded + + 0 + 2 + + + + + + 1 + start + 1 + + 1 + 2 + + + + + + end + 1 + Enable keyboard shortcut + + 0 + 3 + + + + + + + + 1 + liststore_KeyShortcut + 0 + 0 + + + + + + + 1 + 4 + + + + + + + Both [ESC + Default] + ESC only + Default only + Not any + + + 1 + 0 + + + + + + These words will be replaced + _fpath = the absolute path of the screencast video file. +_dirpath = the absolute path of destination folder for the screencast video file. +_fname = the name of the screencast video file. + end + 1 + Command post-recording + + 0 + 9 + + + + + + 1 + These words will be replaced + _fpath = the absolute path of the screencast video file. +_dirpath = the absolute path of destination folder for the screencast video file. +_fname = the name of the screencast video file. + 1 + + 1 + 9 + + + + + + end + 1 + Execute command after recording + + 0 + 8 + + + + + + 1 + start + 0 + + 1 + 8 + + + + + + 1 + start + 1 + + 1 + 5 + + + + + + end + 1 + Draw cursor on screencast + + 0 + 5 + + + + + + 1 + end + 1 + Active shortcut + + 0 + 4 + + + + + + 1 + start + 1 + + 1 + 3 + + + + + + end + 1 + Execute command before recording + + 0 + 6 + + + + + + 1 + start + 0 + + 1 + 6 + + + + + + These words will be replaced +_dirpath = the absolute path of destination folder for the screencast video file. + end + 1 + Command pre-recording + + 0 + 7 + + + + + + 1 + These words will be replaced +_dirpath = the absolute path of destination folder for the screencast video file. + 1 + + 1 + 7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + page1 + Quality + + + borderless + + + vertical + + + 18 + 15 + + + end + 1 + Custom GStreamer Pipeline + + 0 + 0 + + + + + + 1 + start + 1 + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 800 + slide-up-down + + + pg_Preset + PagePreset + + + start + vertical + + + center + border-box + + + start + true + 100 + + + + + end + true + 100 + + + + + + + center + 1 + 1 + 18 + 5 + 0 + 0 + bottom + + + + + center + 1 + No GSP description + + 1 + word-char + end + + + + + + + + + pg_Custom + PageCustom + + + vertical + + + center + 18 + 15 + + + end + 1 + Frames Per Second + + 0 + 0 + + + + + + 1 + start + 1 + 0 + 1 + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 10 + 0.10000000149011612 + + + 1 + + + 1 + 5 + 5 + 1 + 1 + word-char + 0 + + + + + + + GStreamer Pipeline + + + + + + + center + vertical + + + start + The extension does NOT handle the webcam and audio when you use a custom gstreamer pipeline. + + 1 + + + + + + + + + + + 1 + Official doc + 1 + 1 + http://gstreamer.freedesktop.org/documentation/plugins.html + 1 + + + + + 1 + Wiki #1 + 1 + 1 + http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines + + + + + 1 + Wiki #2 + 1 + 1 + http://wiki.oz9aec.net/index.php/Gstreamer_Cheat_Sheet + + + + + + + + + + + + + + + + + + + + + + + + page2 + WebCam + + + borderless + + + vertical + + + center + No webcam device selected + center + + + + + + + + + center + center + 0 + - + center + end + 1 + + + + + + + + center + 1 + stk_Webcam + + + + + 1 + 1 + 800 + slide-up-down + + + pg_quality_webcam + Quality + + + 1 + True + + + 1 + 1 + 1 + liststore_QualityWebCam + 1 + horizontal + + + + + + + + + + + + pg_size_webcam + Size + + + 18 + 15 + + + end + 1 + Type of unit of measure + + 0 + 0 + + + + + + end + 1 + Width + + 0 + 1 + + + + + + end + 1 + Height + + 0 + 2 + + + + + + 1 + start + 1 + 1 + + 1 + 1 + + + + + + 1 + start + 1 + 1 + + 1 + 2 + + + + + + start + 1 + + Percentage + Pixel + + + 1 + 0 + + + + + + + + + + + + + + + + + + + pg_position_webcam + Position + + + 18 + 15 + + + end + 1 + Put the webcam in the corner + + 0 + 0 + + + + + + start + 1 + + Right-Bottom + Left-Bottom + Right-Top + Left-Top + + + 1 + 0 + + + + + + end + 1 + Margin X + + 0 + 1 + + + + + + 1 + start + 1 + 1 + + 1 + 1 + + + + + + end + 1 + Margin Y + + 0 + 2 + + + + + + 1 + start + 0 + 1 + + 1 + 2 + + + + + + end + 1 + Alpha channel + + 0 + 3 + + + + + + 1 + start + 1 + 0,00 + 0.05 + 2 + 1 + + 1 + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + page3 + File + + + borderless + + + 18 + 15 + + + Select the folder where the file is saved, if not specific a folder the file will be saved in the $XDG_VIDEOS_DIR if it exists, or the home directory otherwise. + end + 1 + Destination folder + + 0 + 3 + + + + + + The filename which may contain some escape sequences - %d and %t will be replaced by the start date and time of the recording. + end + 1 + File name template + + 0 + 2 + + + + + + 1 + 1 + The filename which may contain some escape sequences - %d and %t will be replaced by the start date and time of the recording. + 1 + + 1 + 2 + + + + + + True + False + Select the folder where the file is saved, if not specific a folder the file will be saved in the $XDG_VIDEOS_DIR if it exists, or the home directory otherwise. + + 1 + 3 + + + + + + end + 1 + File container + + 0 + 0 + + + + + + end + 1 + File resolution + + 0 + 1 + + + + + + + WebM [VP8 encoder + vorbis] + WebM [VP9 encoder + vorbis] + MP4 [x264 encoder + mp3] + Mkv [x264 encoder + flac] + Ogg [Theora encoder + opus] + MP4_AAC [x264 encoder + aac] + + + 1 + 0 + + + + + + vertical + + + 1 + center + 1 + stk_FileResolution + + + + + 10 + 0 + 800 + slide-up-down + 1 + + + native + Native + + + Native area resolution + + + + + + + + + + preset + Preset + + + 5 + 18 + 15 + + + end + 1 + Preset helper + + 0 + 0 + + + + + + start + 1 + + VGA [480p] [4:3] + FWVGA [480p] [16:9] + SVGA [600p] [4:3] + SMPTE [720p] [4:3] + HD [720p] [16:9] + XGA [768p] [4:3] + HD ready [768p] [16:9] + SXGA [1024p] [5:4] + Full HD [1080p] [16:9] + UXGA [1200p] [4:3] + QHD [1440p] [16:9] + QSXGA [2048p] [5:4] + 4K [2160p] [16:9] + + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + custom + Custom + + + vertical + + + 5 + 18 + 15 + + + end + 1 + Width + + 0 + 0 + + + + + + 1 + start + 1 + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + + + + + 5 + 18 + 15 + + + end + 1 + Height + + 0 + 0 + + + + + + 1 + start + 1 + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + + + + + 1 + keep original aspect ratio + 1 + center + 5 + + + + + + + + + + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + page5 + Support + + + borderless + + + vertical + + + 5 + 18 + 15 + + + This option enable more debug message, to view these run this command into a terminal: +$ journalctl --since=today --no-pager | grep js +$ dbus-monitor "interface=org.gnome.Shell.Screencast" + end + 1 + Enable verbose debug + + 0 + 0 + + + + + + 1 + This option enable more debug message, to view these run this command into a terminal: +$ journalctl /usr/bin/gnome-session --since=today | grep js +$ dbus-monitor "interface=org.gnome.Shell.Screencast" + start + 1 + + 1 + 0 + + + + + + start + 5 + 0 + + extension + last Gstreamer pipeline + gnome shell + + + 1 + 1 + + + + + + This option enable more debug message, to view these run this command into a terminal: +$ journalctl --since=today --no-pager | grep js +$ dbus-monitor "interface=org.gnome.Shell.Screencast" + end + 1 + Display the log of + + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + True + + + 1 + 0 + 1 + + + + + + + 5 + 5 + + + + + center + Restore default options + 1 + 1 + + + + + + + + + + + + + + page4 + Info + + + borderless + + + vertical + + + 100 + + + + + EasyScreenCast + + + + + + + + + + center + 10 + 1 + N/A + 1 + + + + + + + + center + 15 + 15 + This extension simplifies the use of the +screen recorder included in gnome shell + center + middle + + + + + + + + This software is licensed under GPL v3 + 1 + 1 + https://github.com/EasyScreenCast/EasyScreenCast/blob/master/COPYING + + + + + Credits + 1 + 1 + https://github.com/EasyScreenCast/EasyScreenCast/graphs/contributors + + + + + How to contribute? + + + + + With a translation + 1 + 1 + https://github.com/EasyScreenCast/EasyScreenCast#translation + + + + + Reporting bugs + 1 + 1 + https://github.com/EasyScreenCast/EasyScreenCast/issues + + + + + Add code + 1 + 1 + https://github.com/EasyScreenCast/EasyScreenCast/pulls + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/convenience.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/convenience.js new file mode 100644 index 0000000..33c9f99 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/convenience.js @@ -0,0 +1,86 @@ +/* + Copyright (c) 2011-2012, Giovanni Campagna + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the GNOME nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +'use strict'; + +import Gio from 'gi://Gio'; + +var debugEnabled = false; + +/** + * @param {boolean} d Enable/Disable debug logging + */ +function setDebugEnabled(d) { + debugEnabled = d; +} + +/** + * @param {string} msg the message to log + * @class + */ +function TalkativeLog(msg) { + if (debugEnabled) + log(`[ESC]${msg}`); +} + +/** + * Gets the full (semantic) version of this extension. + * + *

Note: The actual value is added during build time. + * + * @returns {string} the version + */ +function getFullVersion() { + return '1.9.0'; // FULL_VERSION +} + +/** + * Loads an icon from the extension's subdirectory "images". + * + * @param {Gio.File} extensionDir dir of the extension + * @param {string} name filename of the image + * @returns {Gio.FileIcon} the icon + */ +function loadIcon(extensionDir, name) { + return new Gio.FileIcon({ + file: Gio.File.new_for_path( + getImagePath(extensionDir, name) + ), + }); +} + +/** + * Gets the path to the image from the extension's subdirectory "images". + * + * @param {Gio.File} extensionDir dir of the extension + * @param {string} name filename of the image + * @returns {string} the path + */ +function getImagePath(extensionDir, name) { + return extensionDir.get_child(`images/${name}`).get_path(); +} + +export {TalkativeLog, getFullVersion, setDebugEnabled, loadIcon, getImagePath}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/display_module.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/display_module.js new file mode 100644 index 0000000..1f1702b --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/display_module.js @@ -0,0 +1,40 @@ +'use strict'; + +/** + * @type {{_display(): Meta_Display, number_of_displays(): int}} + */ +var DisplayApi = { + /** + * Returns the Wayland display or screen + * + * @returns {Meta.Display} + */ + _display() { + return global.display || global.screen; + }, + + /** + * @returns {int} + * @public + */ + number_displays() { + return this._display().get_n_monitors(); + }, + + /** + * @param {number} displayIndex the monitor number + * @returns {Meta.Rectangle} + */ + display_geometry_for_index(displayIndex) { + return this._display().get_monitor_geometry(displayIndex); + }, + + /** + * @param {Meta.Cursor} cursor the new cursor to set + */ + set_cursor(cursor) { + this._display().set_cursor(cursor); + }, +}; + +export {DisplayApi}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/extension.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/extension.js new file mode 100644 index 0000000..c151057 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/extension.js @@ -0,0 +1,1034 @@ +/* + Copyright (C) 2013 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + + +'use strict'; + +import GObject from 'gi://GObject'; +import St from 'gi://St'; +import Meta from 'gi://Meta'; +import Shell from 'gi://Shell'; +// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/panelMenu.js +import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; +import Clutter from 'gi://Clutter'; +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; +import * as Slider from 'resource:///org/gnome/shell/ui/slider.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; + +import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; + +import * as Lib from './convenience.js'; +import * as Settings from './settings.js'; +import * as Time from './timer.js'; +import * as UtilRecorder from './utilrecorder.js'; +import * as UtilAudio from './utilaudio.js'; +import * as UtilWebcam from './utilwebcam.js'; +import * as UtilNotify from './utilnotify.js'; +import * as Selection from './selection.js'; +import * as UtilExeCmd from './utilexecmd.js'; + +var Indicator; +let timerD = null; +let timerC = null; + +let isActive = false; +let pathFile = ''; + +let keybindingConfigured = false; + +/** + * @type {EasyScreenCastIndicator} + */ +const EasyScreenCastIndicator = GObject.registerClass({ + GTypeName: 'EasyScreenCast_Indicator', +}, class EasyScreenCastIndicator extends PanelMenu.Button { + constructor(extension) { + super(null, 'EasyScreenCast_Indicator'); + + this._extension = extension; + this._settings = new Settings.Settings(this._extension.getSettings()); + Lib.setDebugEnabled(this._settings.getOption('b', Settings.VERBOSE_DEBUG_SETTING_KEY)); + this._settings._settings.connect( + `changed::${Settings.VERBOSE_DEBUG_SETTING_KEY}`, + () => { + Lib.setDebugEnabled(this._settings.getOption('b', Settings.VERBOSE_DEBUG_SETTING_KEY)); + } + ); + + this.CtrlAudio = new UtilAudio.MixerAudio(); + this.CtrlWebcam = new UtilWebcam.HelperWebcam(_('Unspecified webcam')); + + this.CtrlNotify = new UtilNotify.NotifyManager(); + this.CtrlExe = new UtilExeCmd.ExecuteStuff(this); + + // load indicator icons + this._icons = { + on: Lib.loadIcon(this._extension.dir, 'icon_recording.svg'), + onSel: Lib.loadIcon(this._extension.dir, 'icon_recordingSel.svg'), + off: Lib.loadIcon(this._extension.dir, 'icon_default.svg'), + offSel: Lib.loadIcon(this._extension.dir, 'icon_defaultSel.svg'), + }; + + // check audio + if (!this.CtrlAudio.checkAudio()) { + Lib.TalkativeLog('-*-disable audio recording'); + this._settings.setOption(Settings.INPUT_AUDIO_SOURCE_SETTING_KEY, 0); + this._settings.setOption( + Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY, + Settings.getGSPstd(false) + ); + } + + // add enter/leave/click event + this.connect('enter_event', () => this.refreshIndicator(true)); + this.connect('leave_event', () => this.refreshIndicator(false)); + this.connect('button_press_event', (actor, event) => + this._onButtonPress(actor, event) + ); + + // prepare setting var + if (this._settings.getOption('i', Settings.TIME_DELAY_SETTING_KEY) > 0) + this.isDelayActive = true; + else + this.isDelayActive = false; + + + // Add the title bar icon and label for time display + this.indicatorBox = new St.BoxLayout(); + this.indicatorIcon = new St.Icon({ + gicon: this._icons.off, + icon_size: 16, + }); + this.timeLabel = new St.Label({ + text: '', + style_class: 'time-label', + y_expand: true, + y_align: Clutter.ActorAlign.CENTER, + }); + + this.indicatorBox.add_child(this.timeLabel); + this.indicatorBox.add_child(this.indicatorIcon); + + // init var + this.recorder = new UtilRecorder.CaptureVideo(); + this.AreaSelected = null; + this.TimeSlider = null; + + this._initMainMenu(); + } + + /** + * @private + */ + _initMainMenu() { + this._addStartStopMenuEntry(); + this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); + this.sub_menu_audio_recording = new PopupMenu.PopupSubMenuMenuItem(_('No audio source'), true); + this.sub_menu_audio_recording.icon.icon_name = 'audio-input-microphone-symbolic'; + this.menu.addMenuItem(this.sub_menu_audio_recording); + this._addAudioRecordingSubMenu(); + + // add sub menu webcam recording + this._addSubMenuWebCam(); + + this._addAreaRecordingSubMenu(); + this._addRecordingDelaySubMenu(); + this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); + this.menu_item_options = new PopupMenu.PopupMenuItem(_('Options')); + this.menu_item_options.actor.insert_child_at_index( + new St.Icon({ + style_class: 'popup-menu-icon', + icon_name: 'preferences-other-symbolic', + }), + 1 + ); + this.menu.addMenuItem(this.menu_item_options); + this.menu_item_options.connect('activate', () => this._openExtensionPreferences()); + } + + /** + * Set a new value for the time label. Integers are + * converted to seconds, minutes, hours. All other + * values are converted to strings. + * + * @param {string|number} newValue new value of the label. if a number, then it's the seconds passed. + * @returns {string} + */ + updateTimeLabel(newValue) { + /** + * @param {number} number a number + */ + function padZeros(number) { + if (number < 10) + number = `0${number}`; + + return number.toString(); + } + + if (typeof newValue === 'number') { + let hours = Math.floor(newValue / 3600); + newValue -= hours * 3600; + + let minutes = Math.floor(newValue / 60); + newValue -= minutes * 60; + + newValue = `${padZeros(hours)}:${padZeros(minutes)}:${padZeros(newValue)}`; + } + + this.timeLabel.set_text(newValue.toString()); + } + + /** + * Left clicking on the icon toggles the recording + * options menu. Any other mouse button will start + * the recording. + * Some submenus are refreshed to account for new + * sources. + * + * @param {Clutter.Actor} actor the actor + * @param {Clutter.Event} event a Clutter.Event + */ + _onButtonPress(actor, event) { + let button = event.get_button(); + + if (button === 1) { + Lib.TalkativeLog('-*-left click indicator'); + + this._setupExtensionMenu(); + } else { + Lib.TalkativeLog('-*-right click indicator'); + + if (this.menu.isOpen) + this.menu.close(); + + this.isShowNotify = this._settings.getOption('b', Settings.SHOW_NOTIFY_ALERT_SETTING_KEY); + this._doRecording(); + } + } + + /** + * Sets up the menu when the user opens it. + */ + _setupExtensionMenu() { + this._addAudioRecordingSubMenu(); + this._addWebcamSubMenu(); + } + + /** + * Sets up all the options for web-cams. Should only run the + * first time the icon is clicked an the CtrlWebcam is still + * null. + */ + _addWebcamSubMenu() { + if (this.CtrlWebcam === null) + this.CtrlWebcam = new UtilWebcam.HelperWebcam(_('Unspecified webcam')); + + // add sub menu webcam recording + this._populateSubMenuWebcam(); + + // start monitoring inputvideo + this.CtrlWebcam.startMonitor(); + } + + /** + * Adds individual webcam items to the webcam menu. + */ + _populateSubMenuWebcam() { + let arrMI = this._createMIWebCam(); + + this.smWebCam.menu.removeAll(); + for (let element in arrMI) + this.smWebCam.menu.addMenuItem(arrMI[element]); + + let i = this._settings.getOption('i', Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY); + Lib.TalkativeLog(`-*-populated submenuwebcam. Settings i=${i}`); + + this.smWebCam.label.text = this.WebCamDevice[i]; + } + + /** + * @private + */ + _addStartStopMenuEntry() { + this.imRecordAction = new PopupMenu.PopupBaseMenuItem(); + this.RecordingLabel = new St.Label({ + text: _('Start recording'), + style_class: 'RecordAction-label', + content_gravity: Clutter.ContentGravity.CENTER, + x_expand: true, + x_align: Clutter.ActorAlign.CENTER, + }); + this.imRecordAction.actor.add_child(this.RecordingLabel); + this.imRecordAction.x_expand = true; + this.imRecordAction.x_fill = true; + this.imRecordAction.x_align = Clutter.ActorAlign.CENTER; + this.imRecordAction.connect('activate', () => { + this.isShowNotify = this._settings.getOption('b', Settings.SHOW_NOTIFY_ALERT_SETTING_KEY); + this._doRecording(); + }); + + this.menu.addMenuItem(this.imRecordAction); + } + + /** + * Refreshes the submenu for audio recording sources. + */ + _addAudioRecordingSubMenu() { + Lib.TalkativeLog('-*-reset the sub menu audio'); + // remove old menu items + this.sub_menu_audio_recording.menu.removeAll(); + + Lib.TalkativeLog('-*-add new items to sub menu audio'); + var arrMI = this._createMIAudioRec(); + for (var ele in arrMI) + this.sub_menu_audio_recording.menu.addMenuItem(arrMI[ele]); + } + + /** + * @private + */ + _addSubMenuWebCam() { + this.smWebCam = new PopupMenu.PopupSubMenuMenuItem('', true); + this.smWebCam.icon.icon_name = 'camera-web-symbolic'; + + this.menu.addMenuItem(this.smWebCam); + } + + /** + * @private + */ + _addAreaRecordingSubMenu() { + this.sub_menu_area_recording = new PopupMenu.PopupSubMenuMenuItem('', true); + this.sub_menu_area_recording.icon.icon_name = 'view-fullscreen-symbolic'; + + var arrMI = this._createMIAreaRec(); + for (var ele in arrMI) + this.sub_menu_area_recording.menu.addMenuItem(arrMI[ele]); + + this.sub_menu_area_recording.label.text = this.AreaType[this._settings.getOption('i', Settings.AREA_SCREEN_SETTING_KEY)]; + this.menu.addMenuItem(this.sub_menu_area_recording); + } + + /** + * @private + */ + _addRecordingDelaySubMenu() { + this.smDelayRec = new PopupMenu.PopupSubMenuMenuItem('', true); + this.smDelayRec.icon.icon_name = 'alarm-symbolic'; + + var arrMI = this._createMIInfoDelayRec(); + for (var ele in arrMI) + this.smDelayRec.menu.addMenuItem(arrMI[ele]); + + var secDelay = this._settings.getOption('i', Settings.TIME_DELAY_SETTING_KEY); + if (secDelay > 0) { + this.smDelayRec.label.text = + secDelay + _(' sec. delay before recording'); + } else { + this.smDelayRec.label.text = _('Start recording immediately'); + } + + this.menu.addMenuItem(this.smDelayRec); + } + + /** + * @returns {Array} + * @private + */ + _createMIAreaRec() { + this.AreaType = [ + _('Record all desktop'), + _('Record a selected monitor'), + _('Record a selected window'), + _('Record a selected area'), + ]; + + this.AreaMenuItem = new Array(this.AreaType.length); + + for (var i = 0; i < this.AreaMenuItem.length; i++) { + this.AreaMenuItem[i] = new PopupMenu.PopupMenuItem( + this.AreaType[i], + { + reactive: true, + activate: true, + hover: true, + can_focus: true, + } + ); + + (function (areaSetting, arr, item, settings) { + this.connectMI = function () { + this.connect('activate', () => { + Lib.TalkativeLog(`-*-set area recording to ${areaSetting} ${arr[areaSetting]}`); + settings.setOption(Settings.AREA_SCREEN_SETTING_KEY, areaSetting); + + item.label.text = arr[areaSetting]; + }); + }; + this.connectMI(); + }.call( + this.AreaMenuItem[i], + i, + this.AreaType, + this.sub_menu_area_recording, + this._settings + )); + } + + return this.AreaMenuItem; + } + + /** + * @returns {Array} + * @private + */ + _createMIWebCam() { + this.WebCamDevice = [_('No WebCam recording')]; + // add menu item webcam device from GST + const devices = this.CtrlWebcam.getDevicesIV(); + this.WebCamDevice.push(...this.CtrlWebcam.getNameDevices()); + Lib.TalkativeLog(`-*-webcam list: ${this.WebCamDevice}`); + this.AreaMenuItem = new Array(this.WebCamDevice.length); + + for (var i = 0; i < this.AreaMenuItem.length; i++) { + let devicePath = ''; + + // i === 0 is "No Webcam selected" + if (i > 0) { + const device = devices[i - 1]; + devicePath = device.get_properties().get_string('device.path'); + Lib.TalkativeLog(`-*-webcam i=${i} devicePath: ${devicePath}`); + } + + Lib.TalkativeLog(`-*-webcam i=${i} menu-item-text: ${this.WebCamDevice[i]}`); + this.AreaMenuItem[i] = new PopupMenu.PopupMenuItem( + this.WebCamDevice[i], + { + reactive: true, + activate: true, + hover: true, + can_focus: true, + } + ); + + (function (index, devPath, arr, item, settings) { + this.connectMI = function () { + this.connect('activate', () => { + Lib.TalkativeLog(`-*-set webcam device to ${index} ${arr[index]} devicePath=${devPath}`); + settings.setOption(Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY, index); + settings.setOption(Settings.DEVICE_WEBCAM_SETTING_KEY, devPath); + item.label.text = arr[index]; + }); + }; + this.connectMI(); + }.call( + this.AreaMenuItem[i], + i, + devicePath, + this.WebCamDevice, + this.smWebCam, + this._settings + )); + } + + return this.AreaMenuItem; + } + + /** + * @returns {Array} + * @private + */ + _createMIAudioRec() { + // add std menu item + this.AudioChoice = [ + { + desc: _('No audio source'), + name: 'N/A', + port: 'N/A', + sortable: true, + resizeable: true, + }, + { + desc: _('Default audio source'), + name: 'N/A', + port: 'N/A', + sortable: true, + resizeable: true, + }, + ]; + // add menu item audio source from PA + var audioList = this.CtrlAudio.getListInputAudio(); + for (var index in audioList) + this.AudioChoice.push(audioList[index]); + + this.AudioMenuItem = new Array(this.AudioChoice.length); + + for (var i = 0; i < this.AudioChoice.length; i++) { + // create label menu + let labelMenu = this.AudioChoice[i].desc; + if (i >= 2) { + labelMenu += + _('\n - Port: ') + + this.AudioChoice[i].port + + _('\n - Name: ') + + this.AudioChoice[i].name; + } + // create submenu + this.AudioMenuItem[i] = new PopupMenu.PopupMenuItem(labelMenu, { + reactive: true, + activate: true, + hover: true, + can_focus: true, + }); + // add icon on submenu + this.AudioMenuItem[i].actor.insert_child_at_index( + new St.Icon({ + style_class: 'popup-menu-icon', + icon_name: 'audio-card-symbolic', + }), + 1 + ); + + // update choice audio from pref + if (i === this._settings.getOption('i', Settings.INPUT_AUDIO_SOURCE_SETTING_KEY)) { + Lib.TalkativeLog(`-*-get audio choice from pref ${i}`); + this.sub_menu_audio_recording.label.text = this.AudioChoice[i].desc; + } + + // add action on menu item + (function (audioIndex, arr, item, settings) { + this.connectMI = function () { + this.connect('activate', () => { + Lib.TalkativeLog(`-*-set audio choice to ${audioIndex}`); + settings.setOption(Settings.INPUT_AUDIO_SOURCE_SETTING_KEY, audioIndex); + item.label.text = arr[audioIndex].desc; + }); + }; + this.connectMI(); + }.call( + this.AudioMenuItem[i], + i, + this.AudioChoice, + this.sub_menu_audio_recording, + this._settings + )); + } + return this.AudioMenuItem; + } + + /** + * @returns {Array} + * @private + */ + _createMIInfoDelayRec() { + this.DelayTimeTitle = new PopupMenu.PopupMenuItem(_('Delay Time'), { + reactive: false, + }); + + this.DelayTimeLabel = new St.Label({ + text: + Math.floor( + this._settings.getOption('i', Settings.TIME_DELAY_SETTING_KEY) + ).toString() + _(' Sec'), + }); + this.DelayTimeTitle.actor.add_child(this.DelayTimeLabel); + // TODO this.DelayTimeTitle.align = St.Align.END; + + this.imSliderDelay = new PopupMenu.PopupBaseMenuItem({ + activate: false, + }); + this.TimeSlider = new Slider.Slider(this._settings.getOption('i', Settings.TIME_DELAY_SETTING_KEY) / 100); + this.TimeSlider.x_expand = true; + this.TimeSlider.y_expand = true; + + this.TimeSlider.connect('notify::value', item => { + this.DelayTimeLabel.set_text( + Math.floor(item.value * 100).toString() + _(' Sec') + ); + }); + + this.TimeSlider.connect('drag-end', () => this._onDelayTimeChanged()); + this.TimeSlider.connect('scroll-event', () => + this._onDelayTimeChanged() + ); + + this.imSliderDelay.actor.add_child(this.TimeSlider); + + return [this.DelayTimeTitle, this.imSliderDelay]; + } + + /** + * @private + */ + _enable() { + // enable key binding + this._enableKeybindings(); + // immediately activate/deactive shortcut on settings change + this._settings._settings.connect( + `changed::${Settings.ACTIVE_SHORTCUT_SETTING_KEY}`, + () => { + if (this._settings.getOption('b', Settings.ACTIVE_SHORTCUT_SETTING_KEY)) { + Lib.TalkativeLog('-^-shortcut changed - enabling'); + this._enableKeybindings(); + } else { + Lib.TalkativeLog('-^-shortcut changed - disabling'); + this._removeKeybindings(); + } + } + ); + + // start monitoring inputvideo + this.CtrlWebcam.startMonitor(); + + // add indicator + this.add_child(this.indicatorBox); + } + + /** + * @private + */ + _disable() { + // remove key binding + this._removeKeybindings(); + // stop monitoring inputvideo + this.CtrlWebcam.stopMonitor(); + // unregister mixer control + this.CtrlAudio.destroy(); + + // remove indicator + this.remove_child(this.indicatorBox); + } + + /** + * @private + */ + _doDelayAction() { + if (this.isDelayActive) { + Lib.TalkativeLog(`-*-delay recording called | delay= ${this.TimeSlider.value}`); + timerD = new Time.TimerDelay( + Math.floor(this.TimeSlider.value * 100), + this._doPreCommand, + this + ); + timerD.begin(); + } else { + Lib.TalkativeLog('-*-instant recording called'); + // start recording + this._doPreCommand(); + } + } + + /** + * @private + */ + _doPreCommand() { + if (this._settings.getOption('b', Settings.ACTIVE_PRE_CMD_SETTING_KEY)) { + Lib.TalkativeLog('-*-execute pre command'); + + const PreCmd = this._settings.getOption('s', Settings.PRE_CMD_SETTING_KEY); + + this.CtrlExe.Execute( + PreCmd, + false, + res => { + Lib.TalkativeLog(`-*-pre command final: ${res}`); + if (res === true) { + Lib.TalkativeLog('-*-pre command OK'); + this.recorder.start(); + } else { + Lib.TalkativeLog('-*-pre command ERROR'); + this.CtrlNotify.createNotify( + _('ERROR PRE COMMAND - See logs for more info'), + this._icons.off + ); + } + }, + line => { + Lib.TalkativeLog(`-*-pre command output: ${line}`); + } + ); + } else { + this.recorder.start(); + } + } + + /** + * @private + */ + _doRecording() { + // start/stop record screen + if (isActive === false) { + Lib.TalkativeLog('-*-start recording'); + + pathFile = ''; + + // get selected area + const optArea = this._settings.getOption('i', Settings.AREA_SCREEN_SETTING_KEY); + if (optArea > 0) { + Lib.TalkativeLog(`-*-type of selection of the area to record: ${optArea}`); + switch (optArea) { + case 3: + new Selection.SelectionArea(); + break; + case 2: + new Selection.SelectionWindow(); + break; + case 1: + new Selection.SelectionDesktop(); + break; + } + } else { + Lib.TalkativeLog('-*-recording full area'); + this._doDelayAction(); + } + } else { + Lib.TalkativeLog('-*-stop recording'); + isActive = false; + + this.recorder.stop(); + + if (timerC !== null) { + // stop counting rec + timerC.halt(); + timerC = null; + } + + // execute post-command + this._doPostCommand(); + } + + this.refreshIndicator(false); + } + + /** + * @private + */ + _doPostCommand() { + if (this._settings.getOption('b', Settings.ACTIVE_POST_CMD_SETTING_KEY)) { + Lib.TalkativeLog('-*-execute post command'); + + // launch cmd after registration + const tmpCmd = `/usr/bin/sh -c "${this._settings.getOption('s', Settings.POST_CMD_SETTING_KEY)}"`; + + const mapObj = { + _fpath: pathFile, + _dirpath: pathFile.substr(0, pathFile.lastIndexOf('/')), + _fname: pathFile.substr( + pathFile.lastIndexOf('/') + 1, + pathFile.length + ), + }; + + const Cmd = tmpCmd.replace(/_fpath|_dirpath|_fname/gi, match => { + return mapObj[match]; + }); + + Lib.TalkativeLog(`-*-post command:${Cmd}`); + + // execute post command + this.CtrlExe.Spawn(Cmd); + } + } + + /** + * @param {boolean} result whether the recording was successful + * @param {string} file file path of the recorded file + */ + doRecResult(result, file) { + if (result) { + isActive = true; + + Lib.TalkativeLog('-*-record OK'); + // update indicator + const indicators = this._settings.getOption('i', Settings.STATUS_INDICATORS_SETTING_KEY); + this._replaceStdIndicator(indicators === 1 || indicators === 3); + + if (this.isShowNotify) { + Lib.TalkativeLog('-*-show notify'); + // create counting notify + this.notifyCounting = this.CtrlNotify.createNotify( + _('Start Recording'), + this._icons.on + ); + this.notifyCounting.connect('destroy', () => { + Lib.TalkativeLog('-*-notification destroyed'); + this.notifyCounting = null; + }); + + // start counting rec + timerC = new Time.TimerCounting((secpassed, alertEnd) => { + this._refreshNotify(secpassed, alertEnd); + }, this); + timerC.begin(); + } + + // update path file video + pathFile = file; + Lib.TalkativeLog(`-*-update abs file path -> ${pathFile}`); + } else { + Lib.TalkativeLog('-*-record ERROR'); + + pathFile = ''; + + if (this.isShowNotify) { + Lib.TalkativeLog('-*-show error notify'); + this.CtrlNotify.createNotify( + _('ERROR RECORDER - See logs for more info'), + this._icons.off + ); + } + } + this.refreshIndicator(false); + } + + /** + * @param {number} sec the seconds passed + * @param {boolean} alertEnd whether the timer is ending + */ + _refreshNotify(sec, alertEnd) { + if (this.notifyCounting !== null && this.notifyCounting !== undefined && this.isShowNotify) { + if (alertEnd) { + this.CtrlNotify.updateNotify( + this.notifyCounting, + _(`Finish Recording / Seconds : ${sec}`), + this._icons.off, + true + ); + } else { + this.CtrlNotify.updateNotify( + this.notifyCounting, + _('Recording ... / Seconds passed : ') + sec, + this._icons.on, + false + ); + } + } + } + + /** + * @private + */ + _openExtensionPreferences() { + try { + this._extension.openPreferences(); + } catch (e) { + Lib.TalkativeLog(`Failed to open preferences: ${e}`); + } + } + + /** + * @private + */ + _onDelayTimeChanged() { + const secDelay = Math.floor(this.TimeSlider.value * 100); + this._settings.setOption(Settings.TIME_DELAY_SETTING_KEY, secDelay); + if (secDelay > 0) + this.smDelayRec.label.text = secDelay + _(' sec. delay before recording'); + else + this.smDelayRec.label.text = _('Start recording immediately'); + } + + /** + * @param {boolean} focus selects the correct icon depending on the focus state + */ + refreshIndicator(focus) { + Lib.TalkativeLog(`-*-refresh indicator -A ${isActive} -F ${focus}`); + + const indicators = this._settings.getOption('i', Settings.STATUS_INDICATORS_SETTING_KEY); + + if (isActive === true) { + if (indicators === 0 || indicators === 1) { + if (focus === true) + this.indicatorIcon.set_gicon(this._icons.onSel); + else + this.indicatorIcon.set_gicon(this._icons.on); + } else if (this._settings.getOption('b', Settings.ACTIVE_SHORTCUT_SETTING_KEY)) { + this.indicatorIcon.set_gicon(null); + } else if (focus === true) { + this.indicatorIcon.set_gicon(this._icons.onSel); + } else { + this.indicatorIcon.set_gicon(this._icons.on); + } + + this.RecordingLabel.set_text(_('Stop recording')); + } else { + if (focus === true) + this.indicatorIcon.set_gicon(this._icons.offSel); + else + this.indicatorIcon.set_gicon(this._icons.off); + + this.RecordingLabel.set_text(_('Start recording')); + } + } + + /** + * @param {boolean} OPTtemp whether to replace the standard indicator or use it + * @private + */ + _replaceStdIndicator(OPTtemp) { + if (Main.panel.statusArea === undefined) { + Lib.TalkativeLog('-*-no Main.panel.statusArea found'); + return; + } + + var stdMenu = Main.panel.statusArea.quickSettings; + if (stdMenu === undefined) { + Lib.TalkativeLog('-*-no quickSettings or aggregateMenu in Main.panel.statusArea'); + return; + } + if (stdMenu._remoteAccess === undefined) { + Lib.TalkativeLog('-*-no _remoteAccess indicator applet found'); + return; + } + var indicator = stdMenu._remoteAccess._indicator; + if (indicator === undefined) { + Lib.TalkativeLog('-*-no _indicator or _recordingIndicator found'); + return; + } + + if (OPTtemp) { + Lib.TalkativeLog('-*-replace STD indicator'); + indicator.visible = false; + } else { + Lib.TalkativeLog('-*-use STD indicator'); + indicator.visible = isActive; + } + } + + /** + * @private + */ + _enableKeybindings() { + if (this._settings.getOption('b', Settings.ACTIVE_SHORTCUT_SETTING_KEY)) { + Lib.TalkativeLog('-*-enable keybinding'); + + Main.wm.addKeybinding( + Settings.SHORTCUT_KEY_SETTING_KEY, + this._settings._settings, + Meta.KeyBindingFlags.NONE, + // available modes: https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/src/shell-action-modes.h + Shell.ActionMode.NORMAL | + Shell.ActionMode.OVERVIEW | + Shell.ActionMode.POPUP | + Shell.ActionMode.SYSTEM_MODAL, + () => { + Lib.TalkativeLog('-*-intercept key combination'); + this._doRecording(); + } + ); + keybindingConfigured = true; + } + } + + /** + * @private + */ + _removeKeybindings() { + if (keybindingConfigured) { + Lib.TalkativeLog('-*-remove keybinding'); + Main.wm.removeKeybinding(Settings.SHORTCUT_KEY_SETTING_KEY); + keybindingConfigured = false; + } + } + + getSelectedRect() { + var recX = this._settings.getOption('i', Settings.X_POS_SETTING_KEY); + var recY = this._settings.getOption('i', Settings.Y_POS_SETTING_KEY); + var recW = this._settings.getOption('i', Settings.WIDTH_SETTING_KEY); + var recH = this._settings.getOption('i', Settings.HEIGHT_SETTING_KEY); + return [recX, recY, recW, recH]; + } + + saveSelectedRect(x, y, h, w) { + this._settings.setOption(Settings.X_POS_SETTING_KEY, x); + this._settings.setOption(Settings.Y_POS_SETTING_KEY, y); + this._settings.setOption(Settings.HEIGHT_SETTING_KEY, h); + this._settings.setOption(Settings.WIDTH_SETTING_KEY, w); + } + + getSettings() { + return this._settings; + } + + getAudioSource() { + return this.CtrlAudio.getAudioSource(); + } + + /** + * Destroy indicator + */ + destroy() { + Lib.TalkativeLog('-*-destroy indicator called'); + + if (isActive) + isActive = false; + + if (this._settings) { + this._settings.destroy(); + this._settings = null; + } + + super.destroy(); + } +}); + +export default class EasyScreenCast extends Extension { + /** + * + */ + enable() { + Lib.TalkativeLog('-*-enableExtension called'); + Lib.TalkativeLog(`-*-version: ${this.metadata.version}`); + Lib.TalkativeLog(`-*-install path: ${this.path}`); + Lib.TalkativeLog(`-*-version (package.json): ${Lib.getFullVersion()}`); + + if (Indicator === null || Indicator === undefined) { + Lib.TalkativeLog('-*-create indicator'); + + Indicator = new EasyScreenCastIndicator(this); + Main.panel.addToStatusArea('EasyScreenCast-indicator', Indicator); + } + + Indicator._enable(); + } + + /** + * + */ + disable() { + Lib.TalkativeLog('-*-disableExtension called'); + + if (timerD !== null) { + Lib.TalkativeLog('-*-timerD stopped'); + timerD.stop(); + timerD = null; + } + + // this might happen, if the extension is disabled during recording + if (timerC !== null) { + // stop counting rec + timerC.halt(); + timerC = null; + } + + + if (Indicator !== null) { + Lib.TalkativeLog('-*-indicator call destroy'); + + Indicator._disable(); + Indicator.destroy(); + Indicator = null; + } + } +} + +export {Indicator}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/Icon_Info.png b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/Icon_Info.png new file mode 100644 index 0000000..7f15ae8 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/Icon_Info.png differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/Icon_Performance.svg b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/Icon_Performance.svg new file mode 100644 index 0000000..f23e320 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/Icon_Performance.svg @@ -0,0 +1,45 @@ + +image/svg+xml diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/Icon_Quality.svg b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/Icon_Quality.svg new file mode 100644 index 0000000..b7e8d3d --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/Icon_Quality.svg @@ -0,0 +1,45 @@ + +image/svg+xml diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_default.svg b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_default.svg new file mode 100644 index 0000000..ff59a8c --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_default.svg @@ -0,0 +1,99 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_defaultSel.svg b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_defaultSel.svg new file mode 100644 index 0000000..7a57f9a --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_defaultSel.svg @@ -0,0 +1,99 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_recording.svg b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_recording.svg new file mode 100644 index 0000000..0608982 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_recording.svg @@ -0,0 +1,99 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_recordingSel.svg b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_recordingSel.svg new file mode 100644 index 0000000..453444c --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/images/icon_recordingSel.svg @@ -0,0 +1,99 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/ca/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/ca/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..1e565d3 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/ca/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/cs/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/cs/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..ef74169 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/cs/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/de/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/de/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..9f6db59 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/de/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/es/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/es/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..d40762a Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/es/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/fr/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/fr/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..546ca3c Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/fr/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/it/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/it/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..35411ef Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/it/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/ja/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/ja/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..7256b66 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/ja/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/pt_BR/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/pt_BR/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..c88a3bc Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/pt_BR/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/ru/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/ru/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..2392f4c Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/ru/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/uk/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/uk/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..21ae02f Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/uk/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/vi/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/vi/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..7526ab9 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/vi/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/zh/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/zh/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo new file mode 100644 index 0000000..03ee607 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/locale/zh/LC_MESSAGES/EasyScreenCast@iacopodeenosee.gmail.com.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/metadata.json b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/metadata.json new file mode 100644 index 0000000..5fb398b --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/metadata.json @@ -0,0 +1,13 @@ +{ + "_generated": "Generated by SweetTooth, do not edit", + "description": "This extension simplifies the use of the video recording function integrated in gnome shell, allows quickly to change the various settings of the desktop recording.\n\nSOURCE CODE -> https://github.com/EasyScreenCast/EasyScreenCast\n\nVIDEO -> https://youtu.be/81E9AruraKU\n\n**NOTICE**\nif an error occurs during the update is recommended to reload GNOME Shell (Alt + F2, 'r') and reload the extension's installation page.", + "gettext-domain": "EasyScreenCast@iacopodeenosee.gmail.com", + "name": "EasyScreenCast", + "settings-schema": "org.gnome.shell.extensions.EasyScreenCast", + "shell-version": [ + "46" + ], + "url": "https://github.com/EasyScreenCast/EasyScreenCast", + "uuid": "EasyScreenCast@iacopodeenosee.gmail.com", + "version": 50 +} \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/prefs.css b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/prefs.css new file mode 100644 index 0000000..4dc0f17 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/prefs.css @@ -0,0 +1,7 @@ +.options-grid { + margin: 18px; +} + +.borderless { + border: none; +} diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/prefs.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/prefs.js new file mode 100644 index 0000000..e0dd1a2 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/prefs.js @@ -0,0 +1,1184 @@ +/* + Copyright (C) 2013 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + +'use strict'; + +import GIRepository from 'gi://GIRepository'; +GIRepository.Repository.prepend_search_path('/usr/lib64/gnome-shell'); +GIRepository.Repository.prepend_library_path('/usr/lib64/gnome-shell'); + +import Adw from 'gi://Adw'; +import GObject from 'gi://GObject'; +import Gio from 'gi://Gio'; +import Gtk from 'gi://Gtk'; +import Gdk from 'gi://Gdk'; +import Pango from 'gi://Pango'; + +import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; + +import * as Lib from './convenience.js'; +import * as UtilWebcam from './utilwebcam.js'; +import * as UtilGSP from './utilgsp.js'; +import * as Settings from './settings.js'; +import * as UtilExeCmd from './utilexecmd.js'; + +const EasyScreenCastSettingsWidget = GObject.registerClass({ + GTypeName: 'EasyScreenCast_SettingsWidget', +}, class EasyScreenCastSettingsWidget extends Gtk.Box { + /** + * @param {ExtensionPreferences} prefs the prefs instance + */ + constructor(prefs) { + super(); + + this._prefs = prefs; + this._settings = new Settings.Settings(this._prefs.getSettings()); + Lib.setDebugEnabled(this._settings.getOption('b', Settings.VERBOSE_DEBUG_SETTING_KEY)); + this.CtrlExe = new UtilExeCmd.ExecuteStuff(this); + this.CtrlWebcam = new UtilWebcam.HelperWebcam(_('Unspecified webcam')); + + let cssProvider = new Gtk.CssProvider(); + cssProvider.load_from_path(`${prefs.path}/prefs.css`); + Gtk.StyleContext.add_provider_for_display( + Gdk.Display.get_default(), + cssProvider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + + // creates the ui builder and add the main resource file + let uiFilePath = `${this._prefs.path}/Options_UI.glade`; + let builder = new Gtk.Builder(); + builder.set_translation_domain(this._prefs.metadata['gettext-domain']); + + if (builder.add_from_file(uiFilePath) === 0) { + Lib.TalkativeLog(`-^-could not load the ui file: ${uiFilePath}`); + let label = new Gtk.Label({ + label: _('Could not load the preferences UI file'), + vexpand: true, + }); + + this.append(label); + } else { + Lib.TalkativeLog(`-^-UI file receive and load: ${uiFilePath}`); + + // gets the interesting builder objects + let refBoxMainContainer = builder.get_object('Main_Container'); + this.append(refBoxMainContainer); + + // setup tab options + this._initTabOptions(this, builder, this._settings._settings); + + // setup tab quality + this._initTabQuality(this, builder, this._settings._settings); + + // setup tab webcam + this._initTabWebcam(this, builder, this._settings._settings); + + // setup tab file + this._initTabFile(this, builder, this._settings._settings); + + // setup tab support + this._initTabSupport(this, builder, this._settings._settings); + + // setup tab info + this._initTabInfo(this, builder); + + // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + // update GSP area + this._setStateGSP( + !this._settings.getOption('b', Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY) + ); + + // update list view + this._updateRowShortcut( + this._settings.getOption('as', Settings.SHORTCUT_KEY_SETTING_KEY)[0] + ); + + // update webcam widget state + this._updateStateWebcamOptions(); + + // connect keywebcam signal + this._settings._settings.connect( + `changed::${Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY}`, + () => { + Lib.TalkativeLog('-^-webcam device changed'); + + this._updateStateWebcamOptions(); + } + ); + } + } + + /** + * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget + * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file + * @param {Gio.Settings} tmpS the current settings + * @private + */ + _initTabOptions(ctx, gtkDB, tmpS) { + // implements show timer option + let refSwitchShowNotifyAlert = gtkDB.get_object('swt_ShowNotifyAlert'); + tmpS.bind( + Settings.SHOW_NOTIFY_ALERT_SETTING_KEY, + refSwitchShowNotifyAlert, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements show area option + let refSwitchShowAreaRec = gtkDB.get_object('swt_ShowAreaRec'); + tmpS.bind( + Settings.SHOW_AREA_REC_SETTING_KEY, + refSwitchShowAreaRec, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements show indicator option + let refComboboxIndicatorsRec = gtkDB.get_object('cbt_StatusIndicatorsRec'); + tmpS.bind( + Settings.STATUS_INDICATORS_SETTING_KEY, + refComboboxIndicatorsRec, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements draw cursor option + let refSwitchDrawCursorRec = gtkDB.get_object('swt_DrawCursorRec'); + tmpS.bind( + Settings.DRAW_CURSOR_SETTING_KEY, + refSwitchDrawCursorRec, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements enable keybinding option + let refSwitchEnableShortcut = gtkDB.get_object('swt_KeyShortcut'); + tmpS.bind( + Settings.ACTIVE_SHORTCUT_SETTING_KEY, + refSwitchEnableShortcut, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements selecting alternative key combo + let refTreeviewShortcut = gtkDB.get_object('treeview_KeyShortcut'); + refTreeviewShortcut.set_sensitive(true); + ctx.Ref_liststore_Shortcut = gtkDB.get_object('liststore_KeyShortcut'); + ctx.Iter_ShortcutRow = ctx.Ref_liststore_Shortcut.append(); + + let renderer = new Gtk.CellRendererAccel({ + editable: true, + }); + renderer.connect( + 'accel-edited', + (_0, _1, key, mods, _2) => { + Lib.TalkativeLog(`-^-edited key accel: key=${key} mods=${mods}`); + + let accel = Gtk.accelerator_name(key, mods); + + ctx._updateRowShortcut(accel); + this._settings.setOption(Settings.SHORTCUT_KEY_SETTING_KEY, [accel]); + } + ); + + renderer.connect('accel-cleared', () => { + Lib.TalkativeLog('-^-cleared key accel'); + + ctx._updateRowShortcut(null); + this._settings.setOption(Settings.SHORTCUT_KEY_SETTING_KEY, []); + }); + + let column = new Gtk.TreeViewColumn(); + column.pack_start(renderer, true); + column.add_attribute( + renderer, + 'accel-key', + Settings.SHORTCUT_COLUMN_KEY + ); + column.add_attribute( + renderer, + 'accel-mods', + Settings.SHORTCUT_COLUMN_MODS + ); + + refTreeviewShortcut.append_column(column); + + // implements post execute command + let refSwitchExecutePostCmd = gtkDB.get_object('swt_executepostcmd'); + tmpS.bind( + Settings.ACTIVE_POST_CMD_SETTING_KEY, + refSwitchExecutePostCmd, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + let refTexteditPostCmd = gtkDB.get_object('txe_postcmd'); + tmpS.bind( + Settings.POST_CMD_SETTING_KEY, + refTexteditPostCmd, + 'text', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements pre execute command + let refSwitchExecutePreCmd = gtkDB.get_object('swt_executeprecmd'); + tmpS.bind( + Settings.ACTIVE_PRE_CMD_SETTING_KEY, + refSwitchExecutePreCmd, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + let refTexteditPreCmd = gtkDB.get_object('txe_precmd'); + tmpS.bind( + Settings.PRE_CMD_SETTING_KEY, + refTexteditPreCmd, + 'text', + Gio.SettingsBindFlags.DEFAULT + ); + } + + /** + * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget + * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file + * @param {Gio.Settings} tmpS the current settings + * @private + */ + _initTabQuality(ctx, gtkDB, tmpS) { + // implements FPS option + let refSpinnerFrameRateRec = gtkDB.get_object('spb_FrameRateRec'); + // Create an adjustment to use for the second spinbutton + let adjustment1 = new Gtk.Adjustment({ + value: 30, + lower: 1, + upper: 666, + step_increment: 1, + page_increment: 10, + }); + refSpinnerFrameRateRec.configure(adjustment1, 10, 0); + tmpS.bind( + Settings.FPS_SETTING_KEY, + refSpinnerFrameRateRec, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements command string rec option + let refTexteditPipeline = gtkDB.get_object('txe_CommandStringRec'); + let refBufferPipeline = refTexteditPipeline.get_buffer(); + tmpS.bind( + Settings.PIPELINE_REC_SETTING_KEY, + refBufferPipeline, + 'text', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements label description GSP + let refLabelDescGSP = gtkDB.get_object('lbl_GSP_Description'); + refLabelDescGSP.set_text( + UtilGSP.getDescr( + this._settings.getOption('i', Settings.QUALITY_SETTING_KEY), + this._settings.getOption('i', Settings.FILE_CONTAINER_SETTING_KEY) + ) + ); + // update label description when container selection changed + this._settings._settings.connect(`changed::${Settings.FILE_CONTAINER_SETTING_KEY}`, () => { + Lib.TalkativeLog('-^- new setting for file container, update gps description'); + refLabelDescGSP.set_text( + UtilGSP.getDescr( + this._settings.getOption('i', Settings.QUALITY_SETTING_KEY), + this._settings.getOption('i', Settings.FILE_CONTAINER_SETTING_KEY) + ) + ); + }); + + + // implements quality scale option + let refScaleQuality = gtkDB.get_object('scl_Quality'); + refScaleQuality.set_valign(Gtk.Align.START); + let adjustment2 = new Gtk.Adjustment({ + value: 1, + lower: 0, + upper: 3, + step_increment: 1, + page_increment: 1, + }); + refScaleQuality.set_adjustment(adjustment2); + refScaleQuality.set_digits(1); + let ind = 0; + for (; ind < 4; ind++) + refScaleQuality.add_mark(ind, Gtk.PositionType.BOTTOM, ''); + + + refScaleQuality.set_value( + this._settings.getOption('i', Settings.QUALITY_SETTING_KEY) + ); + + let oldQualityValue = refScaleQuality.get_value(); + refScaleQuality.connect('value-changed', self => { + // not logging by default - it's too much + // Lib.TalkativeLog(`-^-value quality changed : ${self.get_value()}`); + + // round the value + let roundTmp = parseInt(self.get_value().toFixed(0)); + // not logging by default - it's too much + // Lib.TalkativeLog(`-^-value quality fixed : ${roundTmp}`); + + self.set_value(roundTmp); + + // only update labels for real changes + if (oldQualityValue !== roundTmp) { + oldQualityValue = roundTmp; + this._settings.setOption(Settings.QUALITY_SETTING_KEY, roundTmp); + + // update label descr GSP + refLabelDescGSP.set_text( + UtilGSP.getDescr( + roundTmp, + this._settings.getOption('i', Settings.FILE_CONTAINER_SETTING_KEY) + ) + ); + + // update fps + this._settings.setOption( + Settings.FPS_SETTING_KEY, + UtilGSP.getFps( + roundTmp, + this._settings.getOption('i', Settings.FILE_CONTAINER_SETTING_KEY) + ) + ); + } + }); + + // implements image for scale widget + let refImagePerformance = gtkDB.get_object('img_Performance'); + refImagePerformance.set_from_file(Lib.getImagePath(this._prefs.dir, 'Icon_Performance.svg')); + + let refImageQuality = gtkDB.get_object('img_Quality'); + refImageQuality.set_from_file(Lib.getImagePath(this._prefs.dir, 'Icon_Quality.svg')); + + // implements custom GSPipeline option + let refSwitchCustomGSP = gtkDB.get_object('swt_EnableCustomGSP'); + tmpS.bind( + Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY, + refSwitchCustomGSP, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + refSwitchCustomGSP.connect('state-set', () => { + // update GSP text area + ctx._setStateGSP(this._settings.getOption('b', Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY)); + }); + + ctx.Ref_stack_Quality = gtkDB.get_object('stk_Quality'); + } + + /** + * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget + * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file + * @param {Gio.Settings} tmpS the current settings + * @private + */ + _initTabWebcam(ctx, gtkDB, tmpS) { + // implements webcam quality option: Type: GtkListStore + ctx.Ref_ListStore_QualityWebCam = gtkDB.get_object( + 'liststore_QualityWebCam' + ); + let refTreeViewQualityWebCam = gtkDB.get_object( + 'treeview_QualityWebam' + ); + // create column data + let capsColumn = new Gtk.TreeViewColumn({ + title: _('WebCam Caps'), + }); + let normalColumn = new Gtk.CellRendererText(); + capsColumn.pack_start(normalColumn, true); + capsColumn.add_attribute(normalColumn, 'text', 0); + + // insert caps column into treeview + refTreeViewQualityWebCam.insert_column(capsColumn, 0); + + // setup selection liststore + let capsSelection = refTreeViewQualityWebCam.get_selection(); + + // connect selection signal + capsSelection.connect('changed', self => { + let [isSelected,, iter] = self.get_selected(); + if (isSelected) { + let Caps = ctx.Ref_ListStore_QualityWebCam.get_value(iter, 0); + Lib.TalkativeLog(`-^-treeview row selected : ${Caps}`); + + this._settings.setOption(Settings.QUALITY_WEBCAM_SETTING_KEY, Caps); + + // update label webcam caps + ctx.Ref_Label_WebCamCaps.set_ellipsize(Pango.EllipsizeMode.END); + ctx.Ref_Label_WebCamCaps.set_text(Caps); + } + }); + + // fill combobox with quality option webcam + ctx._updateWebCamCaps(this._settings.getOption('i', Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY)); + + // implements webcam corner position option + let refComboboxCornerWebCam = gtkDB.get_object('cbt_WebCamCorner'); + tmpS.bind( + Settings.CORNER_POSITION_WEBCAM_SETTING_KEY, + refComboboxCornerWebCam, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements webcam margin x position option + let refSpinnerMarginXWebCam = gtkDB.get_object('spb_WebCamMarginX'); + let adjustmentMarginX = new Gtk.Adjustment({ + value: 0, + lower: 0, + upper: 10000, + step_increment: 1, + page_increment: 10, + }); + refSpinnerMarginXWebCam.configure(adjustmentMarginX, 10, 0); + tmpS.bind( + Settings.MARGIN_X_WEBCAM_SETTING_KEY, + refSpinnerMarginXWebCam, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements webcam margin y position option + let refSpinnerMarginYWebCam = gtkDB.get_object('spb_WebCamMarginY'); + let adjustmentMarginY = new Gtk.Adjustment({ + value: 0, + lower: 0, + upper: 10000, + step_increment: 1, + page_increment: 10, + }); + refSpinnerMarginYWebCam.configure(adjustmentMarginY, 10, 0); + tmpS.bind( + Settings.MARGIN_Y_WEBCAM_SETTING_KEY, + refSpinnerMarginYWebCam, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements webcam aplha channel option + let refSpinnerAlphaWebCam = gtkDB.get_object('spb_WebCamAlpha'); + let adjustmentAlpha = new Gtk.Adjustment({ + value: 0.01, + lower: 0.0, + upper: 1.0, + step_increment: 0.05, + page_increment: 0.25, + }); + refSpinnerAlphaWebCam.configure(adjustmentAlpha, 0.25, 2); + tmpS.bind( + Settings.ALPHA_CHANNEL_WEBCAM_SETTING_KEY, + refSpinnerAlphaWebCam, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements webcam type unit dimension option + let refComboboxTypeUnitWebCam = gtkDB.get_object('cbt_WebCamUnitMeasure'); + tmpS.bind( + Settings.TYPE_UNIT_WEBCAM_SETTING_KEY, + refComboboxTypeUnitWebCam, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements webcam width option + let refSpinnerWidthWebCam = gtkDB.get_object('spb_WebCamWidth'); + let adjustmentWidth = new Gtk.Adjustment({ + value: 20, + lower: 0, + upper: 10000, + step_increment: 1, + page_increment: 10, + }); + refSpinnerWidthWebCam.configure(adjustmentWidth, 10, 0); + tmpS.bind( + Settings.WIDTH_WEBCAM_SETTING_KEY, + refSpinnerWidthWebCam, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements webcam heigth option + let refSpinnerHeightWebCam = gtkDB.get_object('spb_WebCamHeight'); + let adjustmentHeight = new Gtk.Adjustment({ + value: 10, + lower: 0, + upper: 10000, + step_increment: 1, + page_increment: 10, + }); + refSpinnerHeightWebCam.configure(adjustmentHeight, 10, 0); + tmpS.bind( + Settings.HEIGHT_WEBCAM_SETTING_KEY, + refSpinnerHeightWebCam, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements webcam stack menu chooser + ctx.Ref_StackSwitcher_WebCam = gtkDB.get_object('sts_Webcam'); + // implements webcam stack obj + ctx.Ref_StackObj_WebCam = gtkDB.get_object('stk_Webcam'); + // implements webcam stack menu chooser + ctx.Ref_Label_WebCam = gtkDB.get_object('lbl_Webcam'); + // implements webcam caps stack menu chooser + ctx.Ref_Label_WebCamCaps = gtkDB.get_object('lbl_WebcamCaps'); + } + + /** + * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget + * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file + * @param {Gio.Settings} tmpS the current settings + * @private + */ + _initTabFile(ctx, gtkDB, tmpS) { + // implements file name string rec option + let refTexteditFileName = gtkDB.get_object('txe_FileNameRec'); + tmpS.bind( + Settings.FILE_NAME_SETTING_KEY, + refTexteditFileName, + 'text', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements file container option + let refComboboxContainer = gtkDB.get_object('cbt_FileContainer'); + tmpS.bind( + Settings.FILE_CONTAINER_SETTING_KEY, + refComboboxContainer, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements file container resolution + let refStackFileResolution = gtkDB.get_object('stk_FileResolution'); + + // implements file resolution preset spinner + let refComboboxResolution = gtkDB.get_object('cbt_FileResolution'); + tmpS.bind( + Settings.FILE_RESOLUTION_TYPE_SETTING_KEY, + refComboboxResolution, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // intercept combobox res changed and update width/height value + refComboboxResolution.connect('changed', self => { + var activeRes = self.active; + Lib.TalkativeLog(`-^-preset combobox changed: ${activeRes}`); + if (activeRes >= 0 && activeRes < 15) { + var [h, w] = ctx._getResolutionPreset(activeRes); + + // update width/height + this._settings.setOption(Settings.FILE_RESOLUTION_HEIGHT_SETTING_KEY, h); + this._settings.setOption(Settings.FILE_RESOLUTION_WIDTH_SETTING_KEY, w); + Lib.TalkativeLog(`-^-Res changed h: ${h} w: ${w}`); + } + }); + + // load file resolution pref and upadte UI + var tmpRes = this._settings.getOption('i', Settings.FILE_RESOLUTION_TYPE_SETTING_KEY); + if (tmpRes < 0) + refStackFileResolution.set_visible_child_name('native'); + else if (tmpRes === 999) + refStackFileResolution.set_visible_child_name('custom'); + else + refStackFileResolution.set_visible_child_name('preset'); + + + // setup event on stack switcher + refStackFileResolution.connect('notify::visible-child-name', () => { + Lib.TalkativeLog('-^-stack_FR event grab'); + var page = refStackFileResolution.get_visible_child_name(); + Lib.TalkativeLog(`-^-active page -> ${page}`); + + if (page === 'native') { + // set option to -1 + this._settings.setOption(Settings.FILE_RESOLUTION_TYPE_SETTING_KEY, -1); + } else if (page === 'preset') { + // set option to fullHD 16:9 + this._settings.setOption(Settings.FILE_RESOLUTION_TYPE_SETTING_KEY, 8); + } else if (page === 'custom') { + // set option to 99 + this._settings.setOption(Settings.FILE_RESOLUTION_TYPE_SETTING_KEY, 999); + } else { + Lib.TalkativeLog('-^-page error'); + } + }); + + // implements file width option + let refSpinnerWidthRes = gtkDB.get_object('spb_ResWidth'); + let adjustmentResWidth = new Gtk.Adjustment({ + value: 640, + lower: 640, + upper: 3840, + step_increment: 1, + page_increment: 100, + }); + refSpinnerWidthRes.configure(adjustmentResWidth, 10, 0); + tmpS.bind( + Settings.FILE_RESOLUTION_WIDTH_SETTING_KEY, + refSpinnerWidthRes, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements file heigth option + let refSpinnerHeightRes = gtkDB.get_object('spb_ResHeight'); + let adjustmentResHeight = new Gtk.Adjustment({ + value: 480, + lower: 480, + upper: 2160, + step_increment: 1, + page_increment: 100, + }); + refSpinnerHeightRes.configure(adjustmentResHeight, 10, 0); + tmpS.bind( + Settings.FILE_RESOLUTION_HEIGHT_SETTING_KEY, + refSpinnerHeightRes, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements keep aspect ratio check box + let refCheckboxKeepAspectRatio = gtkDB.get_object('chb_FileResolution_kar'); + tmpS.bind( + Settings.FILE_RESOLUTION_KAR_SETTING_KEY, + refCheckboxKeepAspectRatio, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + // implements resolution width scale option + let refScaleWidthRes = gtkDB.get_object('scl_ResWidth'); + refScaleWidthRes.set_valign(Gtk.Align.START); + refScaleWidthRes.set_adjustment(adjustmentResWidth); + refScaleWidthRes.set_digits(0); + refScaleWidthRes.set_value(this._settings.getOption('i', Settings.FILE_RESOLUTION_WIDTH_SETTING_KEY)); + + // implements resolution height scale option + let refScaleHeightRes = gtkDB.get_object('scl_ResHeight'); + refScaleHeightRes.set_valign(Gtk.Align.START); + refScaleHeightRes.set_adjustment(adjustmentResHeight); + refScaleHeightRes.set_digits(0); + refScaleHeightRes.set_value(this._settings.getOption('i', Settings.FILE_RESOLUTION_HEIGHT_SETTING_KEY)); + + // add marks on width/height file resolution + let ind = 0; + for (; ind < 13; ind++) { + var [h, w] = ctx._getResolutionPreset(ind); + refScaleWidthRes.add_mark(w, Gtk.PositionType.BOTTOM, ''); + refScaleHeightRes.add_mark(h, Gtk.PositionType.BOTTOM, ''); + } + + // implements file folder string rec option + let refFilechooserFileFolder = gtkDB.get_object('fcb_FilePathRec'); + // check state initial value + var tmpFolder = this._settings.getOption('s', Settings.FILE_FOLDER_SETTING_KEY); + Lib.TalkativeLog(`-^-folder for screencast: ${tmpFolder}`); + if (tmpFolder === '' || tmpFolder === null || tmpFolder === undefined) { + let result = null; + ctx.CtrlExe.Execute( + 'xdg-user-dir VIDEOS', + true, + (success, out) => { + Lib.TalkativeLog(`-^-CALLBACK sync S: ${success} out: ${out}`); + if (success && out !== '' && out !== undefined) + result = out.replace(/(\n)/g, ''); + }, + null + ); + + if (result !== null) { + Lib.TalkativeLog(`-^-xdg-user video: ${result}`); + tmpFolder = result; + } else { + Lib.TalkativeLog('-^-NOT SET xdg-user video'); + + ctx.CtrlExe.Execute( + '/usr/bin/sh -c "echo $HOME"', + true, + (success, out) => { + Lib.TalkativeLog(`-^-CALLBACK sync S: ${success} out: ${out}`); + if (success && out !== '' && out !== undefined) + tmpFolder = out.replace(/(\n)/g, ''); + }, + null + ); + } + + // connect keywebcam signal + this._settings._settings.connect( + `changed::${Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY}`, + () => { + Lib.TalkativeLog('-^-webcam device changed'); + this._refreshWebcamOptions(); + } + ); + } + + refFilechooserFileFolder.set_label(`Selected: ${tmpFolder}`); + + refFilechooserFileFolder.connect('clicked', () => { + Lib.TalkativeLog('-^- file chooser button clicked...'); + + let dialog = new Gtk.FileChooserNative({ + 'title': 'Select folder', + 'transient-for': refFilechooserFileFolder.get_root(), + 'action': Gtk.FileChooserAction.SELECT_FOLDER, + 'accept-label': 'Ok', + 'cancel-label': 'Cancel', + }); + dialog.connect('response', (self, response) => { + if (response === Gtk.ResponseType.ACCEPT) { + var tmpPathFolder = self.get_file().get_path(); + Lib.TalkativeLog(`-^-file path get from widget : ${tmpPathFolder}`); + this._settings.setOption( + Settings.FILE_FOLDER_SETTING_KEY, + tmpPathFolder + ); + refFilechooserFileFolder.set_label(`Selected: ${tmpPathFolder}`); + } + ctx.fileChooserDialog = null; + }); + dialog.show(); + ctx.fileChooserDialog = dialog; // keep a reference to the dialog alive + }); + } + + /** + * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget + * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file + * @param {Gio.Settings} tmpS the current settings + * @private + */ + _initTabSupport(ctx, gtkDB, tmpS) { + // implements textentry log + let refTextViewEscLog = gtkDB.get_object('txe_ContainerLog'); + let refBufferLog = refTextViewEscLog.get_buffer(); + + // implements verbose debug option + let refSwitchVerboseDebug = gtkDB.get_object('swt_VerboseDebug'); + tmpS.bind( + Settings.VERBOSE_DEBUG_SETTING_KEY, + refSwitchVerboseDebug, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + this._settings._settings.connect( + `changed::${Settings.VERBOSE_DEBUG_SETTING_KEY}`, + () => { + Lib.setDebugEnabled(this._settings.getOption('b', Settings.VERBOSE_DEBUG_SETTING_KEY)); + } + ); + + refSwitchVerboseDebug.connect('state-set', self => { + // update log display widgets + refTextViewEscLog.sensistive = self.active; + refComboboxLogChooser.sensitive = self.active; + }); + + // implements file resolution preset spinner + let refComboboxLogChooser = gtkDB.get_object('cbt_LogChooser'); + + // intercept combobox res changed and update width/height value + refComboboxLogChooser.connect('changed', self => { + const activeLog = self.active; + Lib.TalkativeLog(`-^-log combobox changed: ${activeLog}`); + switch (activeLog) { + case 0: + // clear buffer + refBufferLog.delete( + refBufferLog.get_start_iter(), + refBufferLog.get_end_iter() + ); + + ctx.CtrlExe.Execute( + 'journalctl --since "15 min ago" --output=cat --no-pager', + false, + success => { + Lib.TalkativeLog(`-^-CALLBACK async S= ${success}`); + }, + line => { + let esc = line.indexOf('[ESC]'); + if ( + line !== '' && + line !== undefined && + esc !== -1 + ) { + line += '\n'; + refBufferLog.insert( + refBufferLog.get_end_iter(), + line, + line.length + ); + } + } + ); + break; + case 1: + // clear buffer + refBufferLog.delete( + refBufferLog.get_start_iter(), + refBufferLog.get_end_iter() + ); + + ctx.CtrlExe.Execute( + 'journalctl --since "15 min ago" --output=cat --no-pager', + false, + success => { + Lib.TalkativeLog(`-^-CALLBACK async S= ${success}`); + if (success) { + if (refBufferLog.get_line_count() > 0) { + let strNOgsp = _( + 'No Gstreamer pipeline found' + ); + refBufferLog.insert( + refBufferLog.get_end_iter(), + strNOgsp, + strNOgsp.length + ); + } + } + }, + line => { + let esc = line.indexOf('-§-final GSP :'); + if ( + line !== '' && + line !== undefined && + esc !== -1 + ) { + line += '\n'; + refBufferLog.insert( + refBufferLog.get_end_iter(), + line, + line.length + ); + } + } + ); + break; + case 2: + // clear buffer + refBufferLog.delete( + refBufferLog.get_start_iter(), + refBufferLog.get_end_iter() + ); + + ctx.CtrlExe.Execute( + 'journalctl /usr/bin/gnome-shell --since "15 min ago" --output=cat --no-pager', + false, + success => { + Lib.TalkativeLog(`-^-CALLBACK async S= ${success}`); + }, + line => { + if (line !== '' && line !== undefined) { + line += '\n'; + refBufferLog.insert( + refBufferLog.get_end_iter(), + line, + line.length + ); + } + } + ); + break; + default: + break; + } + }); + + // update state of get log + refComboboxLogChooser.sensistive = this._settings.getOption('b', Settings.VERBOSE_DEBUG_SETTING_KEY); + + // implements default button action + let refButtonSetDefaultSettings = gtkDB.get_object('btn_DefaultOption'); + refButtonSetDefaultSettings.connect('clicked', () => + ctx._setDefaultsettings() + ); + } + + /** + * @param {EasyScreenCastSettingsWidget} ctx the prefs/settings widget + * @param {Gtk.Builder} gtkDB the builder that loaded the UI glade file + * @private + */ + _initTabInfo(ctx, gtkDB) { + // implements info img extension + let refImageEsc = gtkDB.get_object('img_ESC'); + refImageEsc.set_from_file(Lib.getImagePath(this._prefs.dir, 'Icon_Info.png')); + + // implements info version label + let refLabelVersion = gtkDB.get_object('lbl_Version'); + refLabelVersion.set_markup(`${_('Version: ')}${this._prefs.metadata.version} (${Lib.getFullVersion()})`); + } + + /** + * @param {number} device device index + * @private + */ + _updateWebCamCaps(device) { + Lib.TalkativeLog(`-^-webcam device index: ${device}`); + + if (device > 0) { + this._initializeWebcamHelper(); + var listCaps = this.CtrlWebcam.getListCapsDevice(device - 1); + Lib.TalkativeLog(`-^-webcam caps: ${listCaps.length}`); + if (listCaps !== null && listCaps !== undefined) { + this.Ref_ListStore_QualityWebCam.clear(); + for (var index in listCaps) { + this.Ref_ListStore_QualityWebCam.set( + this.Ref_ListStore_QualityWebCam.append(), + [0], + [listCaps[index]] + ); + } + } else { + Lib.TalkativeLog('-^-NO List Caps Webcam'); + this.Ref_ListStore_QualityWebCam.clear(); + this._settings.setOption(Settings.QUALITY_WEBCAM_SETTING_KEY, ''); + } + } else { + Lib.TalkativeLog('-^-NO Webcam recording'); + this.Ref_ListStore_QualityWebCam.clear(); + this._settings.setOption(Settings.QUALITY_WEBCAM_SETTING_KEY, ''); + } + } + + /** + * Refreshes the webcam settings. + * + * @private + */ + _refreshWebcamOptions() { + Lib.TalkativeLog('-^-refresh webcam options'); + this._initializeWebcamHelper(); + + // fill combobox with quality option webcam + this._updateWebCamCaps(this._settings.getOption('i', Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY)); + + // update webcam widget state + this._updateStateWebcamOptions(); + } + + /** + * Initializes this.CtrlWebcam if it is null. + * + * @private + */ + _initializeWebcamHelper() { + if (this.CtrlWebcam === null) + this.CtrlWebcam = new UtilWebcam.HelperWebcam(_('Unspecified webcam')); + } + + /** + * @param {string} accel accelerator string parsable by Gtk.accelerator_parse, e.g. "<Super>E" + * @private + */ + _updateRowShortcut(accel) { + Lib.TalkativeLog(`-^-update row combo key accel: ${accel}`); + + let [key, mods] = [0, 0]; + + if (accel !== null && accel !== undefined) { + let ok; + [ok, key, mods] = Gtk.accelerator_parse(accel); + + if (ok !== true) { + Lib.TalkativeLog('-^-couldn\'t parse accel'); + key = 0; + mods = 0; + } + } + + Lib.TalkativeLog(`-^-key: ${key} mods: ${mods}`); + this.Ref_liststore_Shortcut.set( + this.Iter_ShortcutRow, + [Settings.SHORTCUT_COLUMN_KEY, Settings.SHORTCUT_COLUMN_MODS], + [key, mods] + ); + } + + /** + * @param {boolean} active custom or not custom GStream pipeline + * @private + */ + _setStateGSP(active) { + // update GSP text area + if (!active) { + Lib.TalkativeLog('-^-custom GSP'); + + this.Ref_stack_Quality.set_visible_child_name('pg_Custom'); + } else { + Lib.TalkativeLog('-^-NOT custom GSP'); + + this.Ref_stack_Quality.set_visible_child_name('pg_Preset'); + + var audio = false; + if (this._settings.getOption('i', Settings.INPUT_AUDIO_SOURCE_SETTING_KEY) > 0) + audio = true; + + this._settings.setOption( + Settings.PIPELINE_REC_SETTING_KEY, + Settings.getGSPstd(audio) + ); + } + } + + /** + * @private + */ + _updateStateWebcamOptions() { + Lib.TalkativeLog('-^-update webcam option widgets'); + + var tmpDev = this._settings.getOption( + 'i', + Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY + ); + this._updateWebCamCaps(tmpDev); + if (tmpDev > 0) { + var arrDev = this.CtrlWebcam.getNameDevices(); + this.Ref_Label_WebCam.set_text(arrDev[tmpDev - 1]); + + // setup label webcam caps + var tmpCaps = this._settings.getOption( + 's', + Settings.QUALITY_WEBCAM_SETTING_KEY + ); + if (tmpCaps === '') { + this.Ref_Label_WebCamCaps.use_markup = true; + this.Ref_Label_WebCamCaps.set_markup( + _( + 'No Caps selected, please select one from the caps list' + ) + ); + } else { + this.Ref_Label_WebCamCaps.set_text(tmpCaps); + } + + // webcam recording show widget + this.Ref_StackSwitcher_WebCam.set_sensitive(true); + this.Ref_StackObj_WebCam.set_sensitive(true); + } else { + this.Ref_Label_WebCam.set_text(_('No webcam device selected')); + // setup label webcam caps + this.Ref_Label_WebCamCaps.set_text(_('-')); + // webcam NOT recording hide widget + this.Ref_StackSwitcher_WebCam.set_sensitive(false); + this.Ref_StackObj_WebCam.set_sensitive(false); + } + } + + /** + * @param {number} index index of the predefined resolutions + * @returns {Array} + * @private + */ + _getResolutionPreset(index) { + var arrRes = [ + [480, 640], + [480, 854], + [600, 800], + [720, 960], + [720, 1280], + [768, 1024], + [768, 1366], + [1024, 1280], + [1080, 1920], + [1200, 1600], + [1440, 2560], + [2048, 2560], + [2160, 3840], + ]; + if (index >= 0 && index < arrRes.length) + return arrRes[index]; + else + return null; + } + + /** + * function to restore default value of the settings + * + * @private + */ + _setDefaultsettings() { + Lib.TalkativeLog('-^-restore default option'); + + this._settings.setOption(Settings.SHOW_NOTIFY_ALERT_SETTING_KEY, true); + this._settings.setOption(Settings.SHOW_AREA_REC_SETTING_KEY, false); + this._settings.setOption(Settings.STATUS_INDICATORS_SETTING_KEY, 1); + this._settings.setOption(Settings.DRAW_CURSOR_SETTING_KEY, true); + this._settings.setOption(Settings.VERBOSE_DEBUG_SETTING_KEY, false); + this._settings.setOption(Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY, false); + + this._settings.setOption(Settings.FPS_SETTING_KEY, 30); + this._settings.setOption(Settings.X_POS_SETTING_KEY, 0); + this._settings.setOption(Settings.Y_POS_SETTING_KEY, 0); + this._settings.setOption(Settings.WIDTH_SETTING_KEY, 600); + this._settings.setOption(Settings.HEIGHT_SETTING_KEY, 400); + + this._settings.setOption(Settings.FILE_NAME_SETTING_KEY, 'Screencast_%d_%t'); + this._settings.setOption(Settings.FILE_FOLDER_SETTING_KEY, ''); + this._settings.setOption(Settings.ACTIVE_POST_CMD_SETTING_KEY, false); + this._settings.setOption(Settings.ACTIVE_PRE_CMD_SETTING_KEY, false); + this._settings.setOption(Settings.POST_CMD_SETTING_KEY, 'xdg-open _fpath &'); + this._settings.setOption(Settings.INPUT_AUDIO_SOURCE_SETTING_KEY, 0); + this._settings.setOption(Settings.DEVICE_INDEX_WEBCAM_SETTING_KEY, 0); + this._settings.setOption(Settings.DEVICE_WEBCAM_SETTING_KEY, ''); + + this._settings.setOption(Settings.TIME_DELAY_SETTING_KEY, 0); + this._settings.setOption(Settings.FILE_CONTAINER_SETTING_KEY, 0); + this._settings.setOption(Settings.FILE_RESOLUTION_TYPE_SETTING_KEY, -1); + this._settings.setOption(Settings.QUALITY_SETTING_KEY, 1); + this._settings.setOption(Settings.QUALITY_WEBCAM_SETTING_KEY, ''); + this._settings.setOption(Settings.WIDTH_WEBCAM_SETTING_KEY, 20); + this._settings.setOption(Settings.HEIGHT_WEBCAM_SETTING_KEY, 10); + this._settings.setOption(Settings.TYPE_UNIT_WEBCAM_SETTING_KEY, 0); + this._settings.setOption(Settings.MARGIN_X_WEBCAM_SETTING_KEY, 0); + this._settings.setOption(Settings.MARGIN_Y_WEBCAM_SETTING_KEY, 0); + this._settings.setOption(Settings.ALPHA_CHANNEL_WEBCAM_SETTING_KEY, 0.75); + this._settings.setOption(Settings.CORNER_POSITION_WEBCAM_SETTING_KEY, 0); + } +}); + + +export default class EasyScreenCastPreferences extends ExtensionPreferences { + /** + * @param {Adw.PreferencesWindow} window preferences window? + * @returns {EasyScreenCastSettingsWidget} + */ + fillPreferencesWindow(window) { + window._settings = this.getSettings(); + + Lib.TalkativeLog('-^-Init pref widget'); + + const page = new Adw.PreferencesPage(); + + const group = new Adw.PreferencesGroup({ + title: _('EasyScreenCast'), + }); + page.add(group); + + const widget = new EasyScreenCastSettingsWidget(this); + group.add(widget); + + window.add(page); + } +} diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/schemas/gschemas.compiled b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/schemas/gschemas.compiled new file mode 100644 index 0000000..362d39e Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/schemas/gschemas.compiled differ diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/schemas/org.gnome.shell.extensions.easyscreencast.gschema.xml b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/schemas/org.gnome.shell.extensions.easyscreencast.gschema.xml new file mode 100644 index 0000000..51bbf18 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/schemas/org.gnome.shell.extensions.easyscreencast.gschema.xml @@ -0,0 +1,200 @@ + + + + true +

Enable show notify and alert message + Enable show notify and alert message + + + false + Enable show area screencast during recording + Enable show area screencast during recording + + + 0 + select input audio source + select input audio source + + + false + Active custom GStreamer Pipeline + Active custom GStreamer Pipeline + + + 0 + Time in seconds fot delay recording + Time in seconds fot delay recording + + + false + Enable verbose debug + Enable verbose debug + + + 0 + X position of screencasting + X position of screencasting + + + 0 + Y position of screencasting + Y position of screencasting + + + 600 + width of screencasting + width of screencasting + + + 400 + height of screencasting + height of screencasting + + + 1 + active status indicators + active status indicators + + + true + draw the cursor into screencast + draw the cursor into screencast + + + 30 + fps of screencasting + fps of screencasting + + + 'vp9enc min_quantizer=13 max_quantizer=13 cpu-used=5 deadline=1000000 threads=%T ! queue ! webmmux' + gstreamer pipeline of screencasting + gstreamer pipeline of screencasting + + + 0 + select area of screencast + select area of screencast + + + 'Screencast_%d_%t' + file name template of screencast + file name template of screencast + + + '' + file folder of screencast + file folder of screencast + + + false + enable execute pre command + enable execute pre command + + + '' + command to execute + command to execute + + + false + enable execute post command + enable execute post command + + + 'xdg-open _fpath' + command to execute + command to execute + + + + E']]]> + + + + false + Enable keyboard shortcut + Enable keyboard shortcut + + + 0 + file screencast container + file screencast container + + + -1 + file screencast resolution type + file screencast resolution type [native(-1),preset(0-99),custom(99)] + + + true + file screencast resolution Keep Aspect Ratio + file screencast resolution Keep Aspect Ratio (add borders) + + + 0 + file screencast resolution width + file screencast resolution width + + + 0 + file screencast resolution height + file screencast resolution height + + + 1 + store the quality index option + store the quality index option + + + 0 + select webcam device + select webcam device + + + "" + selected webcam device path + selected webcam device path + + + "" + select webcam quality + select webcam quality + + + 20 + width webcam + width webcam + + + 10 + height webcam + height webcam + + + 0 + type of unit of measure webcam + type of unit of measure + + + 0 + margin x from border webcam + margin x webcam + + + 0 + margin y from border webcam + margin y from border webcam + + + 0.75 + + alpha channel webcam + aplha channel webcam + + + 0 + the corner position of webcam + the corner position of webcam + + + diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/selection.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/selection.js new file mode 100644 index 0000000..0ed9c7a --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/selection.js @@ -0,0 +1,534 @@ +/* +The MIT License (MIT) +Copyright (c) 2013 otto.allmendinger@gmail.com + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +'use strict'; + +import GObject from 'gi://GObject'; +import Meta from 'gi://Meta'; +import Clutter from 'gi://Clutter'; +import St from 'gi://St'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; + +import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; + +import * as Lib from './convenience.js'; +import * as Ext from './extension.js'; +import * as UtilNotify from './utilnotify.js'; +import {DisplayApi} from './display_module.js'; + +/** + * @type {Capture} + */ +const Capture = GObject.registerClass({ + GTypeName: 'EasyScreenCast_Capture', + Signals: { + 'captured-event': { + param_types: [Clutter.Event.$gtype], + }, + 'stop': {}, + }, +}, class Capture extends GObject.Object { + constructor() { + super(); + Lib.TalkativeLog('-£-capture selection init'); + + this._mouseDown = false; + + this.monitor = Main.layoutManager.focusMonitor; + + this._areaSelection = new St.Widget({ + name: 'area-selection', + style_class: 'area-selection', + visible: 'true', + reactive: 'true', + x: -10, + y: -10, + }); + + Main.uiGroup.add_child(this._areaSelection); + + this._areaResolution = new St.Label({ + style_class: 'area-resolution', + text: '', + }); + this._areaResolution.opacity = 255; + this._areaResolution.set_position(0, 0); + + Main.uiGroup.add_child(this._areaResolution); + + this._grab = Main.pushModal(this._areaSelection); + + if (this._grab) { + this._signalCapturedEvent = this._areaSelection.connect( + 'captured-event', + this._onCaptureEvent.bind(this) + ); + + this._setCaptureCursor(); + } else { + Lib.TalkativeLog('-£-Main.pushModal() === false'); + } + } + + /** + * @private + */ + _setDefaultCursor() { + DisplayApi.set_cursor(Meta.Cursor.DEFAULT); + } + + /** + * @private + */ + _setCaptureCursor() { + DisplayApi.set_cursor(Meta.Cursor.CROSSHAIR); + } + + /** + * @param {Clutter.Actor} actor the actor that received the event + * @param {Clutter.Event} event a Clutter.Event + * @private + */ + _onCaptureEvent(actor, event) { + if (event.type() === Clutter.EventType.KEY_PRESS) { + if (event.get_key_symbol() === Clutter.KEY_Escape) + this._stop(); + } + + this.emit('captured-event', event); + } + + /** + * Draws a on-screen rectangle showing the area that will be captured by screen cast. + * + * @param {object} rect rectangle + * @param {number} rect.x left position in pixels + * @param {number} rect.y top position in pixels + * @param {number} rect.w width in pixels + * @param {number} rect.h height in pixels + * @param {boolean} showResolution whether to display the size of the selected area + */ + drawSelection({x, y, w, h}, showResolution) { + this._areaSelection.set_position(x, y); + this._areaSelection.set_size(w, h); + + if (showResolution && w > 100 && h > 50) { + this._areaResolution.set_text(`${w} X ${h}`); + this._areaResolution.set_position( + x + (w / 2 - this._areaResolution.width / 2), + y + (h / 2 - this._areaResolution.height / 2) + ); + } else { + this._areaResolution.set_position(0, 0); + this._areaResolution.set_text(''); + } + } + + /** + * Clear drawing selection + */ + clearSelection() { + this.drawSelection( + { + x: -10, + y: -10, + w: 0, + h: 0, + }, + false + ); + } + + /** + * @private + */ + _stop() { + Lib.TalkativeLog('-£-capture selection stop'); + + this._areaSelection.disconnect(this._signalCapturedEvent); + this._setDefaultCursor(); + Main.uiGroup.remove_child(this._areaSelection); + Main.popModal(this._grab); + Main.uiGroup.remove_child(this._areaResolution); + this._areaSelection.destroy(); + this.emit('stop'); + } + + _saveRect(x, y, h, w) { + Lib.TalkativeLog(`-£-selection x:${x} y:${y} height:${h} width:${w}`); + + Ext.Indicator.saveSelectedRect(x, y, h, w); + Ext.Indicator._doDelayAction(); + } + + toString() { + return this.GTypeName; + } +}); + +var SelectionArea = GObject.registerClass({ + GTypeName: 'EasyScreenCast_SelectionArea', + Signals: { + 'stop': {}, + }, +}, class SelectionArea extends GObject.Object { + constructor() { + super(); + Lib.TalkativeLog('-£-area selection init'); + + this._mouseDown = false; + this._capture = new Capture(); + this._capture.connect('captured-event', this._onEvent.bind(this)); + this._capture.connect('stop', () => { + this._ctrlNotify.resetAlert(); + this.emit('stop'); + }); + + this._ctrlNotify = new UtilNotify.NotifyManager(); + this._ctrlNotify.createAlert( + _('Select an area for recording or press [ESC] to abort') + ); + } + + /** + * @param {Clutter.actor} capture the actor the captured the event + * @param {Clutter.Event} event a Clutter.Event + * @private + */ + _onEvent(capture, event) { + let type = event.type(); + let [x, y] = global.get_pointer(); + + if (type === Clutter.EventType.BUTTON_PRESS) { + [this._startX, this._startY] = [x, y]; + this._mouseDown = true; + } else if (this._mouseDown) { + let rect = _getRectangle(this._startX, this._startY, x, y); + if (type === Clutter.EventType.MOTION) { + this._capture.drawSelection(rect, true); + } else if (type === Clutter.EventType.BUTTON_RELEASE) { + this._capture._stop(); + + Lib.TalkativeLog(`-£-area x: ${rect.x} y: ${rect.y} height: ${rect.h} width: ${rect.w}`); + + this._capture._saveRect(rect.x, rect.y, rect.h, rect.w); + } + } + } + + toString() { + return this.GTypeName; + } +}); + +var SelectionWindow = GObject.registerClass({ + GTypeName: 'EasyScreenCast_SelectionWindow', + Signals: { + 'stop': {}, + }, +}, class SelectionWindow extends GObject.Object { + constructor() { + super(); + Lib.TalkativeLog('-£-window selection init'); + + this._windows = global.get_window_actors(); + this._capture = new Capture(); + this._capture.connect('captured-event', this._onEvent.bind(this)); + this._capture.connect('stop', () => { + this._ctrlNotify.resetAlert(); + this.emit('stop'); + }); + + this._ctrlNotify = new UtilNotify.NotifyManager(); + this._ctrlNotify.createAlert( + _('Select a window for recording or press [ESC] to abort') + ); + } + + /** + * @param {Clutter.Actor} capture the actor the captured the event + * @param {Clutter.Event} event a Clutter.Event + * @private + */ + _onEvent(capture, event) { + let type = event.type(); + let [x, y] = global.get_pointer(); + + this._selectedWindow = _selectWindow(this._windows, x, y); + + if (this._selectedWindow) + this._highlightWindow(this._selectedWindow); + else + this._clearHighlight(); + + + if (type === Clutter.EventType.BUTTON_PRESS) { + if (this._selectedWindow) { + this._capture._stop(); + + var maxHeight = global.screen_height; + var maxWidth = global.screen_width; + Lib.TalkativeLog(`-£-global screen area H: ${maxHeight} W: ${maxWidth}`); + + var [w, h] = this._selectedWindow.get_size(); + var [wx, wy] = this._selectedWindow.get_position(); + + Lib.TalkativeLog(`-£-windows pre wx: ${wx} wy: ${wy} height: ${h} width: ${w}`); + + if (wx < 0) + wx = 0; + if (wy < 0) + wy = 0; + if (wx + w > maxWidth) + w = maxWidth - wx; + if (wy + h > maxHeight) + h = maxHeight - wy; + + Lib.TalkativeLog(`-£-windows post wx: ${wx} wy: ${wy} height: ${h} width: ${w}`); + + this._capture._saveRect(wx, wy, h, w); + } + } + } + + /** + * @param {Clutter.Actor} win the window to highlight + * @private + */ + _highlightWindow(win) { + let rect = _getWindowRectangle(win); + Lib.TalkativeLog(`-£-window highlight on, pos/meas: x:${rect.x} y:${rect.y} w:${rect.w} h:${rect.h}`); + this._capture.drawSelection(rect, false); + } + + /** + * @private + */ + _clearHighlight() { + Lib.TalkativeLog('-£-window highlight off'); + this._capture.clearSelection(); + } + + toString() { + return this.GTypeName; + } +}); + +var SelectionDesktop = GObject.registerClass({ + GTypeName: 'EasyScreenCast_SelectionDesktop', + Signals: { + 'stop': {}, + }, +}, class SelectionDesktop extends GObject.Object { + constructor() { + super(); + Lib.TalkativeLog('-£-desktop selection init'); + const displayCount = DisplayApi.number_displays(); + Lib.TalkativeLog(`-£-Number of monitor ${displayCount}`); + + for (var i = 0; i < displayCount; i++) { + var tmpM = DisplayApi.display_geometry_for_index(i); + Lib.TalkativeLog(`-£-monitor ${i} geometry x=${tmpM.x} y=${tmpM.y} w=${tmpM.width} h=${tmpM.height}`); + } + + this._capture = new Capture(); + this._capture.connect('captured-event', this._onEvent.bind(this)); + this._capture.connect('stop', () => { + this._ctrlNotify.resetAlert(); + this.emit('stop'); + }); + + this._ctrlNotify = new UtilNotify.NotifyManager(); + this._ctrlNotify.createAlert( + _('Select a desktop for recording or press [ESC] to abort') + ); + } + + /** + * @param {Clutter.Actor} capture the actor that captured the event + * @param {Clutter.Event} event a Clutter.Event + * @private + */ + _onEvent(capture, event) { + let type = event.type(); + + if (type === Clutter.EventType.BUTTON_PRESS) { + this._capture._stop(); + + let tmpM = Main.layoutManager.currentMonitor; + + var x = tmpM.x; + var y = tmpM.y; + var height = tmpM.height; + var width = tmpM.width; + Lib.TalkativeLog(`-£-desktop x: ${x} y: ${y} height: ${height} width: ${width}`); + + this._capture._saveRect(x, y, height, width); + } + } + + toString() { + return this.GTypeName; + } +}); + +var AreaRecording = GObject.registerClass({ + GTypeName: 'EasyScreenCast_AreaRecording', +}, class AreaRecording extends GObject.Object { + constructor() { + super(); + Lib.TalkativeLog('-£-area recording init'); + + this._areaRecording = new St.Widget({ + name: 'area-recording', + style_class: 'area-recording', + visible: 'true', + reactive: 'false', + x: -10, + y: -10, + }); + + var [recX, recY, recW, recH] = Ext.Indicator.getSelectedRect(); + var tmpH = Main.layoutManager.currentMonitor.height; + var tmpW = Main.layoutManager.currentMonitor.width; + + Main.uiGroup.add_child(this._areaRecording); + + Main.overview.connect('showing', () => { + Lib.TalkativeLog('-£-overview opening'); + + Main.uiGroup.remove_child(this._areaRecording); + }); + + Main.overview.connect('hidden', () => { + Lib.TalkativeLog('-£-overview closed'); + + Main.uiGroup.add_child(this._areaRecording); + }); + + if (recX + recW <= tmpW - 5 && recY + recH <= tmpH - 5) + this.drawArea(recX - 2, recY - 2, recW + 4, recH + 4); + } + + /** + * @param {number} x left position + * @param {number} y top position + * @param {number} w width + * @param {number} h height + */ + drawArea(x, y, w, h) { + Lib.TalkativeLog('-£-draw area recording'); + + this._visible = true; + this._areaRecording.set_position(x, y); + this._areaRecording.set_size(w, h); + } + + /** + * Clears the drawing area + */ + clearArea() { + Lib.TalkativeLog('-£-hide area recording'); + + this._visible = false; + this.drawArea(-10, -10, 0, 0); + } + + /** + * @returns {boolean} + */ + isVisible() { + return this._visible; + } + + toString() { + return this.GTypeName; + } +}); + +/** + * @param {number} x1 left position + * @param {number} y1 top position + * @param {number} x2 right position + * @param {number} y2 bottom position + * @returns {{x: number, y: number, w: number, h: number}} + */ +function _getRectangle(x1, y1, x2, y2) { + return { + x: Math.min(x1, x2), + y: Math.min(y1, y2), + w: Math.abs(x1 - x2), + h: Math.abs(y1 - y2), + }; +} + +/** + * @param {Clutter.Actor} win a Clutter.Actor + * @returns {{x: number, y: number, w: number, h: number}} + */ +function _getWindowRectangle(win) { + let [tw, th] = win.get_size(); + let [tx, ty] = win.get_position(); + + return { + x: tx, + y: ty, + w: tw, + h: th, + }; +} + +/** + * @param {Array(Clutter.Actor)} windows all windows on the display + * @param {number} x left position + * @param {number} y top position + * @returns {Clutter.Actor} + */ +function _selectWindow(windows, x, y) { + let filtered = windows.filter(win => { + if ( + win !== undefined && + win.visible && + typeof win.get_meta_window === 'function' + ) { + Lib.TalkativeLog(`-£-selectWin x:${x} y:${y}`); + + let [w, h] = win.get_size(); + let [wx, wy] = win.get_position(); + Lib.TalkativeLog(`-£-selectWin w:${w} h:${h} wx:${wx} wy:${wy}`); + + return wx <= x && wy <= y && wx + w >= x && wy + h >= y; + } else { + return false; + } + }); + + filtered.sort((a, b) => { + return ( + a.get_meta_window().get_layer() <= b.get_meta_window().get_layer() + ); + }); + + return filtered[0]; +} + +export {SelectionArea, SelectionWindow, SelectionDesktop, AreaRecording}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/settings.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/settings.js new file mode 100644 index 0000000..290d2f2 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/settings.js @@ -0,0 +1,192 @@ +/* + Copyright (C) 2013 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + +'use strict'; + +import GObject from 'gi://GObject'; + +// setting keys +var INPUT_AUDIO_SOURCE_SETTING_KEY = 'input-audio-source'; +var ACTIVE_POST_CMD_SETTING_KEY = 'execute-post-cmd'; +var POST_CMD_SETTING_KEY = 'post-cmd'; +var ACTIVE_PRE_CMD_SETTING_KEY = 'execute-pre-cmd'; +var PRE_CMD_SETTING_KEY = 'pre-cmd'; +var ACTIVE_CUSTOM_GSP_SETTING_KEY = 'active-custom-gsp'; +var ACTIVE_SHORTCUT_SETTING_KEY = 'active-shortcut'; +var SHORTCUT_KEY_SETTING_KEY = 'shortcut-key'; +var TIME_DELAY_SETTING_KEY = 'delay-time'; +var SHOW_NOTIFY_ALERT_SETTING_KEY = 'show-notify-alert'; +var SHOW_AREA_REC_SETTING_KEY = 'show-area-rec'; +var VERBOSE_DEBUG_SETTING_KEY = 'verbose-debug'; +var PIPELINE_REC_SETTING_KEY = 'pipeline'; +var FPS_SETTING_KEY = 'fps'; +var STATUS_INDICATORS_SETTING_KEY = 'status-indicators'; +var X_POS_SETTING_KEY = 'x-pos'; +var Y_POS_SETTING_KEY = 'y-pos'; +var WIDTH_SETTING_KEY = 'width-rec'; +var HEIGHT_SETTING_KEY = 'height-rec'; +var DRAW_CURSOR_SETTING_KEY = 'draw-cursor'; +var AREA_SCREEN_SETTING_KEY = 'area-screen'; +var FILE_NAME_SETTING_KEY = 'file-name'; +var FILE_FOLDER_SETTING_KEY = 'file-folder'; +var FILE_CONTAINER_SETTING_KEY = 'file-container'; +var FILE_RESOLUTION_TYPE_SETTING_KEY = 'file-resolution-type'; +var FILE_RESOLUTION_KAR_SETTING_KEY = 'file-resolution-kar'; +var FILE_RESOLUTION_WIDTH_SETTING_KEY = 'file-resolution-width'; +var FILE_RESOLUTION_HEIGHT_SETTING_KEY = 'file-resolution-height'; +var QUALITY_SETTING_KEY = 'quality-index'; +var DEVICE_INDEX_WEBCAM_SETTING_KEY = 'device-webcam-index'; +var DEVICE_WEBCAM_SETTING_KEY = 'device-webcam'; +var QUALITY_WEBCAM_SETTING_KEY = 'quality-webcam'; +var WIDTH_WEBCAM_SETTING_KEY = 'width-webcam'; +var HEIGHT_WEBCAM_SETTING_KEY = 'height-webcam'; +var TYPE_UNIT_WEBCAM_SETTING_KEY = 'type-unit-webcam'; +var MARGIN_X_WEBCAM_SETTING_KEY = 'margin-x-webcam'; +var MARGIN_Y_WEBCAM_SETTING_KEY = 'margin-y-webcam'; +var ALPHA_CHANNEL_WEBCAM_SETTING_KEY = 'alpha-channel-webcam'; +var CORNER_POSITION_WEBCAM_SETTING_KEY = 'corner-position-webcam'; + +// shortcut tree view columns +var SHORTCUT_COLUMN_KEY = 0; +var SHORTCUT_COLUMN_MODS = 1; + +var Settings = GObject.registerClass(class EasyScreenCastSettings extends GObject.Object { + constructor(settings) { + super(); + this._settings = settings; + } + + /** + * getter option + * + * @param {string} type value type of the option. one of 'b', 'i', 's', 'd', 'as' + * @param {string} key option key + * @returns {string} + */ + getOption(type, key) { + switch (type) { + case 'b': + return this._settings.get_boolean(key); + case 'i': + return this._settings.get_int(key); + case 's': + return this._settings.get_string(key); + case 'd': + return this._settings.get_double(key); + case 'as': + return this._settings.get_strv(key); + } + + return ''; + } + + /** + * setter option + * + * @param {string} key option key + * @param {boolean|number|string|double|object} option option value + * @returns {string} empty string if successful, 'ERROR' otherwise + */ + setOption(key, option) { + switch (typeof option) { + case 'boolean': + this._settings.set_boolean(key, option); + break; + + case 'number': + this._settings.set_int(key, option); + break; + + case 'string': + this._settings.set_string(key, option); + break; + + case 'double': + this._settings.set_double(key, option); + break; + + case 'object': + this._settings.set_strv(key, option); + break; + + default: + return 'ERROR'; + } + return ''; + } + + destroy() { + if (this._settings) + this._settings = null; + } +}); + + +/** + * get a standard gsp pipeline + * + * @param {boolean} audio with or without audio + * @returns {string} + */ +function getGSPstd(audio) { + // TODO update gsp + if (audio) + return 'queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! videorate ! vp8enc min_quantizer=0 max_quantizer=5 cpu-used=3 deadline=1000000 threads=%T ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mux. pulsesrc ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! audioconvert ! vorbisenc ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mux. webmmux name=mux '; + else + return 'vp9enc min_quantizer=0 max_quantizer=5 cpu-used=3 deadline=1000000 threads=%T ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! webmmux'; +} + +export { + getGSPstd, + Settings, + INPUT_AUDIO_SOURCE_SETTING_KEY, + ACTIVE_POST_CMD_SETTING_KEY, + POST_CMD_SETTING_KEY, + ACTIVE_PRE_CMD_SETTING_KEY, + PRE_CMD_SETTING_KEY, + ACTIVE_CUSTOM_GSP_SETTING_KEY, + ACTIVE_SHORTCUT_SETTING_KEY, + SHORTCUT_KEY_SETTING_KEY, + TIME_DELAY_SETTING_KEY, + SHOW_NOTIFY_ALERT_SETTING_KEY, + SHOW_AREA_REC_SETTING_KEY, + VERBOSE_DEBUG_SETTING_KEY, + PIPELINE_REC_SETTING_KEY, + FPS_SETTING_KEY, + STATUS_INDICATORS_SETTING_KEY, + X_POS_SETTING_KEY, + Y_POS_SETTING_KEY, + WIDTH_SETTING_KEY, + HEIGHT_SETTING_KEY, + DRAW_CURSOR_SETTING_KEY, + AREA_SCREEN_SETTING_KEY, + FILE_NAME_SETTING_KEY, + FILE_FOLDER_SETTING_KEY, + FILE_CONTAINER_SETTING_KEY, + FILE_RESOLUTION_TYPE_SETTING_KEY, + FILE_RESOLUTION_KAR_SETTING_KEY, + FILE_RESOLUTION_WIDTH_SETTING_KEY, + FILE_RESOLUTION_HEIGHT_SETTING_KEY, + QUALITY_SETTING_KEY, + DEVICE_INDEX_WEBCAM_SETTING_KEY, + DEVICE_WEBCAM_SETTING_KEY, + QUALITY_WEBCAM_SETTING_KEY, + WIDTH_WEBCAM_SETTING_KEY, + HEIGHT_WEBCAM_SETTING_KEY, + TYPE_UNIT_WEBCAM_SETTING_KEY, + MARGIN_X_WEBCAM_SETTING_KEY, + MARGIN_Y_WEBCAM_SETTING_KEY, + ALPHA_CHANNEL_WEBCAM_SETTING_KEY, + CORNER_POSITION_WEBCAM_SETTING_KEY, + SHORTCUT_COLUMN_KEY, + SHORTCUT_COLUMN_MODS +}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/stylesheet.css b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/stylesheet.css new file mode 100644 index 0000000..2802bd6 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/stylesheet.css @@ -0,0 +1,36 @@ +.RecordAction-label { + font-size: 15px; + font-weight: bold; +} + +.area-selection { + background-color: rgba(255, 0, 0, 0.5); + border: 2px solid rgba(255, 0, 0, 1); +} + +.area-recording { + border-style: dashed; + border: 2px rgba(255, 0, 0, 1); +} + +.alert-msg { + font-size: 40px; + font-weight: bold; + color: #ffffff; + background-color: rgba(10, 10, 10, 0.7); + border-radius: 5px; + padding: .5em; +} + +.area-resolution { + font-size: 20px; + font-weight: bold; + color: #ffffff; + background-color: rgba(0, 0, 0, 0.0); +} + +.time-label { + font-size: 14px; + padding-right: 5px; + color: #ff0000; +} diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/timer.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/timer.js new file mode 100644 index 0000000..9e35712 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/timer.js @@ -0,0 +1,259 @@ +/* + Copyright (C) 2013 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + +'use strict'; + +import GObject from 'gi://GObject'; +import GLib from 'gi://GLib'; +import * as Lib from './convenience.js'; + +/* + DELAY TIMER +*/ +let DelaySec = 0; +let timerDelayId = null; +let CallbackFuncDelay = null; +let ElapsedSec; + +/** + * @type {TimerDelay} + */ +const TimerDelay = GObject.registerClass({ + GTypeName: 'EasyScreenCast_TimerDelay', +}, class TimerDelay extends GObject.Object { + /** + * Create a new timer + * + * @param {number} delay delay in seconds + * @param {Function} callback callback function that is called after delay seconds (without arguments) + * @param {*} scope scope for the callback + */ + constructor(delay, callback, scope) { + super(); + if (isNaN(delay)) { + Lib.TalkativeLog(`-%-delay is NOT a number :${delay}`); + } else { + Lib.TalkativeLog(`-%-init TimerDelay called - sec : ${delay}`); + + DelaySec = delay; + ElapsedSec = 1; + + this.setCallback(callback); + this.Scope = scope; + } + } + + /** + * Set the callback-function + * + * @param {Function} callback callback function that is called after delay seconds (without arguments) + */ + setCallback(callback) { + Lib.TalkativeLog('-%-setcallback TimerDelay called'); + + if ( + callback === undefined || + callback === null || + typeof callback !== 'function' + ) + throw TypeError("'callback' needs to be a function."); + + CallbackFuncDelay = callback; + } + + /** + * Set the delay time + * + * @param {number} delay delay in seconds + */ + setDelay(delay) { + Lib.TalkativeLog(`-%-setdelay TimerDelay called: ${delay}`); + + DelaySec = delay; + } + + /** + * Start or restart a new timer + */ + begin() { + Lib.TalkativeLog('-%-start TimerDelay called'); + this.stop(); + + timerDelayId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, () => + this._callbackInternal() + ); + } + + /** + * Stop the current timer + */ + stop() { + Lib.TalkativeLog('-%-stop TimerDelay called'); + if (timerDelayId !== null) { + if (GLib.source_remove(timerDelayId)) { + timerDelayId = null; + + ElapsedSec = 1; + } + } + } + + /** + * A convenient way to restart the timer. + */ + restart() { + this.stop(); + this.begin(); + } + + /** + * The internal callback-function. + * + * @private + * @returns {boolean} + */ + _callbackInternal() { + Lib.TalkativeLog(`-%-internalFunction TimerDelay called | Sec = ${ElapsedSec} Sec delay = ${DelaySec}`); + if (ElapsedSec >= DelaySec) { + CallbackFuncDelay.apply(this.Scope, []); + ElapsedSec = 1; + return false; + } else { + ElapsedSec++; + return true; + } + } +}); + +/* + COUNTING TIMER +*/ +let timerCountingId = null; +let CallbackFuncCounting = null; +let isRunning = false; +let secpassed = 0; + +/** + * @type {TimerCounting} + */ +var TimerCounting = GObject.registerClass({ + GTypeName: 'EasyScreenCast_TimerCounting', +}, class TimerCounting extends GObject.Object { + /** + * Callback for the counting timer. + * + * @callback TimerCounting~callback + * @param {number} count seconds passed + * @param {boolean} alertEnd whether the timer is ending + */ + + /** + * Create a new timer + * + * @param {TimerCounting~callback} callback callback function that is called every second + * @param {EasyScreenCast_Indicator} scope scope for the callback function. This is also used to updateTimeLabel. + */ + constructor(callback, scope) { + super(); + Lib.TalkativeLog('-%-init TimerCounting called'); + + this.setCallback(callback); + secpassed = 0; + this.Scope = scope; + } + + /** + * Set the callback-function + * + * @param {TimerCounting~callback} callback callback function that is called every second + */ + setCallback(callback) { + Lib.TalkativeLog('-%-setcallback TimerCounting called'); + + if ( + callback === undefined || + callback === null || + typeof callback !== 'function' + ) + throw TypeError("'callback' needs to be a function."); + + CallbackFuncCounting = callback; + } + + /** + * Start or restart a new timer + */ + begin() { + Lib.TalkativeLog('-%-start TimerCounting called'); + + if (isRunning) + this.stop(); + + isRunning = true; + + timerCountingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, () => + this._callbackInternal() + ); + } + + /** + * Stop the current timer + */ + stop() { + Lib.TalkativeLog('-%-stop TimerCounting called'); + + isRunning = false; + + if (timerCountingId !== null && GLib.source_remove(timerCountingId)) + timerCountingId = null; + } + + /** + * A convenient way to stop timer + */ + halt() { + isRunning = false; + } + + /** + * The internal callback-function. Calls a function that handles + * the desktop notifications and one that sets the time label next + * to the icon. + * + * @private + * @returns {boolean} + */ + _callbackInternal() { + if (isRunning === false) { + Lib.TalkativeLog('-%-finish TimerCounting '); + + CallbackFuncCounting.apply(this.Scope, [secpassed, true]); + secpassed = 0; + + this.stop(); + this.Scope.updateTimeLabel(''); + + return false; + } else { + secpassed++; + + Lib.TalkativeLog(`-%-continued TimerCounting | sec: ${secpassed}`); + + CallbackFuncCounting.apply(this.Scope, [secpassed, false]); + this.Scope.updateTimeLabel(secpassed); + + return true; + } + } +}); + +export {TimerDelay, TimerCounting}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilaudio.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilaudio.js new file mode 100644 index 0000000..27201fc --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilaudio.js @@ -0,0 +1,321 @@ +/* + Copyright (C) 2015 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + +'use strict'; + +import GObject from 'gi://GObject'; +import GIRepository from 'gi://GIRepository'; +GIRepository.Repository.prepend_search_path('/usr/lib/gnome-shell'); +GIRepository.Repository.prepend_library_path('/usr/lib/gnome-shell'); +GIRepository.Repository.prepend_search_path('/usr/lib64/gnome-shell'); +GIRepository.Repository.prepend_library_path('/usr/lib64/gnome-shell'); +import Gvc from 'gi://Gvc'; + +import * as Lib from './convenience.js'; +import * as Settings from './settings.js'; +import * as Ext from './extension.js'; + +/** + * @type {MixerAudio} + */ +var MixerAudio = GObject.registerClass({ + GTypeName: 'EasyScreenCast_MixerAudio', +}, class MixerAudio extends GObject.Object { + constructor() { + super(); + Lib.TalkativeLog('-#-mixer constructor'); + + this._mixerControl = this._createMixerControl(); + this._isConnected = true; + this._mixerControl.connect('state-changed', () => + this._onChangeStatePAC() + ); + + // more log for debug + if (Lib.debugEnabled) { + this._mixerControl.connect('stream_added', (control, id) => { + this._onStreamAdd(control, id); + }); + this._mixerControl.connect('stream_removed', (control, id) => { + this._onStreamRemove(control, id); + }); + } + } + + /** + * @returns {Gvc.MixerControl} + * @private + */ + _createMixerControl() { + Lib.TalkativeLog('-#-mixer create'); + + // https://gitlab.gnome.org/GNOME/libgnome-volume-control + var _mixerTmp = new Gvc.MixerControl({ + name: 'ESC Mixer Control', + }); + _mixerTmp.open(); + + return _mixerTmp; + } + + _onChangeStatePAC() { + Lib.TalkativeLog('-#-mixer state changed'); + + switch (this._mixerControl.get_state()) { + case Gvc.MixerControlState.CLOSED: + Lib.TalkativeLog('-#-Mixer close'); + this._isConnected = false; + break; + case Gvc.MixerControlState.CONNECTING: + Lib.TalkativeLog('-#-Mixer connecting'); + this._isConnected = false; + break; + case Gvc.MixerControlState.FAILED: + Lib.TalkativeLog('-#-Mixer failed'); + this._isConnected = false; + break; + case Gvc.MixerControlState.READY: + Lib.TalkativeLog('-#-Mixer ready'); + this._isConnected = true; + + // more log for debug + if (Lib.debugEnabled) + this._getInfoPA(); + + break; + default: + Lib.TalkativeLog('-#-Mixer UNK'); + this._isConnected = false; + break; + } + } + + /** + * Gets a list of input audio sources. + * + * @returns {Array} + */ + getListInputAudio() { + Lib.TalkativeLog('-#-get list input audio'); + + if (this._isConnected) { + var arrayTmp = []; + + var tmpSinks = this._mixerControl.get_sinks(); + Lib.TalkativeLog(`-#-Mixer sink -> ${tmpSinks.length}`); + for (let x in tmpSinks) { + Lib.TalkativeLog(`-#-sink index: ${tmpSinks[x].index}`); + Lib.TalkativeLog(`-#-sink name: ${tmpSinks[x].name}`); + Lib.TalkativeLog( + `-#-sink description: ${tmpSinks[x].description}` + ); + Lib.TalkativeLog(`-#-sink port: ${tmpSinks[x].port}`); + + arrayTmp.push({ + desc: tmpSinks[x].description, + name: tmpSinks[x].name, + port: tmpSinks[x].port, + sortable: true, + resizeable: true, + }); + } + + var tmpSources = this._mixerControl.get_sources(); + Lib.TalkativeLog(`-#-Mixer sources -> ${tmpSources.length}`); + for (let x in tmpSources) { + Lib.TalkativeLog(`-#-source index: ${tmpSources[x].index}`); + Lib.TalkativeLog(`-#-source name: ${tmpSources[x].name}`); + Lib.TalkativeLog( + `-#-source description: ${tmpSources[x].description}` + ); + Lib.TalkativeLog(`-#-source port: ${tmpSources[x].port}`); + + arrayTmp.push({ + desc: tmpSources[x].description, + name: tmpSources[x].name, + port: tmpSources[x].port, + sortable: true, + resizeable: true, + }); + } + + Lib.TalkativeLog(`-#-MIXER SOURCE TOT -> ${arrayTmp.length}`); + + return arrayTmp; + } else { + Lib.TalkativeLog('-#-Error lib pulse NOT present or NOT respond'); + } + + return []; + } + + /** + * @returns {string} + */ + getAudioSource() { + Lib.TalkativeLog('-#-get source audio choosen'); + + var arrtmp = this.getListInputAudio(); + var index = Ext.Indicator.getSettings().getOption('i', Settings.INPUT_AUDIO_SOURCE_SETTING_KEY) - 2; + + if (index >= 0 && index < arrtmp.length) { + return arrtmp[index].name; + } else { + Lib.TalkativeLog('-#-ERROR, audio source missing'); + Ext.Indicator.getSettings().setOption(Settings.INPUT_AUDIO_SOURCE_SETTING_KEY, 0); + + return ''; + } + } + + /** + * @param {Gvc.MixerControl} control the mixer control to which the stream was added + * @param {number} id the stream id + * @private + */ + _onStreamAdd(control, id) { + Lib.TalkativeLog(`-#-mixer stream add - ID: ${id}`); + var streamTmp = control.lookup_stream_id(id); + + if ( + streamTmp.name === 'GNOME Shell' && + streamTmp.description === 'Record Stream' + ) { + Lib.TalkativeLog('-#-stream gnome recorder captured'); + + Lib.TalkativeLog(`-#-stream index: ${streamTmp.index}`); + Lib.TalkativeLog(`-#-stream card index: ${streamTmp.card_index}`); + Lib.TalkativeLog(`-#-application_ID: ${streamTmp.application_id}`); + Lib.TalkativeLog(`-#-stream name: ${streamTmp.name}`); + Lib.TalkativeLog(`-#-stream icon: ${streamTmp.icon_name}`); + Lib.TalkativeLog(`-#-stream description: ${streamTmp.description}`); + Lib.TalkativeLog(`-#-stream port: ${streamTmp.port}`); + } + } + + /** + * @param {Gvc.MixerControl} control the mixer control from where the stream was removed + * @param {number} id stream id + * @private + */ + _onStreamRemove(control, id) { + Lib.TalkativeLog(`-#-mixer stream remove - ID: ${id}`); + // note: the stream has been already removed, so + // control.lookup_stream_id(id) won't return anything + } + + /** + * @private + */ + _getInfoPA() { + var tmp = this._mixerControl.get_cards(); + Lib.TalkativeLog(`#-# mixer cards -> ${tmp.length}`); + for (let x in tmp) { + Lib.TalkativeLog(`-#-card index: ${tmp[x].index}`); + Lib.TalkativeLog(`-#-card name: ${tmp[x].name}`); + Lib.TalkativeLog(`-#-card icon: ${tmp[x].icon_name}`); + Lib.TalkativeLog(`-#-card profile: ${tmp[x].profile}`); + Lib.TalkativeLog(`-#-card human profile: ${tmp[x].human_profile}`); + } + + tmp = this._mixerControl.get_sources(); + Lib.TalkativeLog(`#-# mixer sources -> ${tmp.length}`); + for (let x in tmp) { + Lib.TalkativeLog(`-#-source index: ${tmp[x].index}`); + Lib.TalkativeLog(`-#-application_ID: ${tmp[x].application_id}`); + Lib.TalkativeLog(`-#-source name: ${tmp[x].name}`); + Lib.TalkativeLog(`-#-source icon: ${tmp[x].icon_name}`); + Lib.TalkativeLog(`-#-source description: ${tmp[x].description}`); + Lib.TalkativeLog(`-#-source port: ${tmp[x].port}`); + } + + tmp = this._mixerControl.get_source_outputs(); + Lib.TalkativeLog(`#-# mixer source output -> ${tmp.length}`); + for (let x in tmp) { + Lib.TalkativeLog(`-#-sourceouput index: ${tmp[x].index}`); + Lib.TalkativeLog(`-#-application_ID: ${tmp[x].application_id}`); + Lib.TalkativeLog(`-#-sourceouput name: ${tmp[x].name}`); + Lib.TalkativeLog(`-#-sourceoutput icon: ${tmp[x].icon_name}`); + Lib.TalkativeLog( + `-#-sourceoutput description: ${tmp[x].description}` + ); + Lib.TalkativeLog(`-#-sourceoutput port: ${tmp[x].port}`); + } + + tmp = this._mixerControl.get_sinks(); + Lib.TalkativeLog(`#-# mixer sink -> ${tmp.length}`); + for (let x in tmp) { + Lib.TalkativeLog(`-#-sink index: ${tmp[x].index}`); + Lib.TalkativeLog(`-#-application_ID: ${tmp[x].application_id}`); + Lib.TalkativeLog(`-#-sink name: ${tmp[x].name}`); + Lib.TalkativeLog(`-#-sink icon: ${tmp[x].icon_name}`); + Lib.TalkativeLog(`-#-sink description: ${tmp[x].description}`); + Lib.TalkativeLog(`-#-sink port: ${tmp[x].port}`); + } + + tmp = this._mixerControl.get_sink_inputs(); + Lib.TalkativeLog(`#-# mixer sink input -> ${tmp.length}`); + for (let x in tmp) { + Lib.TalkativeLog(`-#-sink input index: ${tmp[x].index}`); + Lib.TalkativeLog(`-#-application_ID: ${tmp[x].application_id}`); + Lib.TalkativeLog(`-#-sink input name: ${tmp[x].name}`); + Lib.TalkativeLog(`-#-sink input icon: ${tmp[x].icon_name}`); + Lib.TalkativeLog( + `-#-sink input description: ${tmp[x].description}` + ); + Lib.TalkativeLog(`-#-sink input port: ${tmp[x].port}`); + } + + tmp = this._mixerControl.get_streams(); + Lib.TalkativeLog(`#-# mixer stream -> ${tmp.length}`); + for (let x in tmp) { + Lib.TalkativeLog(`-#-STREAM index: ${tmp[x].index}`); + Lib.TalkativeLog(`-#-application_ID: ${tmp[x].application_id}`); + Lib.TalkativeLog(`-#-stream name: ${tmp[x].name}`); + Lib.TalkativeLog(`-#-stream icon: ${tmp[x].icon_name}`); + Lib.TalkativeLog(`-#-stream description: ${tmp[x].description}`); + + var tmp1 = tmp[x].get_ports(); + for (let y in tmp1) { + Lib.TalkativeLog(`-##-stream port number: ${y}`); + Lib.TalkativeLog(`-##-stream port name: ${tmp1[y].port}`); + Lib.TalkativeLog( + `-##-stream port human name: ${tmp1[y].human_port}` + ); + Lib.TalkativeLog( + `-##-stream port priority: ${tmp1[y].priority}` + ); + } + } + } + + /** + * @returns {boolean} + */ + checkAudio() { + Lib.TalkativeLog(`-#-check GVC lib presence: ${this._isConnected}`); + + return this._isConnected; + } + + /** + * Destroy mixer control + */ + destroy() { + if (this._mixerControl) { + this._mixerControl.close(); + this._mixerControl = null; + } + } +}); + +export {MixerAudio}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilexecmd.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilexecmd.js new file mode 100644 index 0000000..2ee88c6 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilexecmd.js @@ -0,0 +1,266 @@ +/* + Copyright (C) 2017 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + +'use strict'; + +import GObject from 'gi://GObject'; +import GLib from 'gi://GLib'; +import Gio from 'gi://Gio'; +import * as Lib from './convenience.js'; + +/** + * @type {ExecuteStuff} + */ +var ExecuteStuff = GObject.registerClass({ + GTypeName: 'EasyScreenCast_ExecuteStuff', +}, class ExecuteStuff extends GObject.Object { + /** + * @param {EasyScreenCastSettingsWidget|EasyScreenCastIndicator} scope the scope for executing callback methods + * @private + */ + constructor(scope) { + super(); + Lib.TalkativeLog(`-¶-init scope:${scope}`); + + this.Scope = scope; + this.Callback = null; + } + + /** + * @param {string} cmd the command to be executed + * @returns {*[]} + * @private + */ + _parseCmd(cmd) { + let successP, argv; + + try { + [successP, argv] = GLib.shell_parse_argv(cmd); + } catch (err) { + Lib.TalkativeLog('-¶-ERROR PARSE'); + successP = false; + } + if (successP) { + Lib.TalkativeLog(`-¶-parse: ${successP} argv: ${argv}`); + return [successP, argv]; + } else { + return [successP, null]; + } + } + + /** + * Result callback. + * + * @callback ExecuteStuff~resultCallback + * @param {boolean} result whether the executed command exited successfully or not + * @param {string} stdout (optional) output of the result, if it was executed synchronously + */ + + /** + * Line output callback for asynchronous commands. + * + * @callback ExecuteStuff~lineCallback + * @param {string} line a single line of output + */ + + /** + * @param {string} cmd the command to be executed + * @param {boolean} sync execute synchronously (wait for return) or fork a process + * @param {ExecuteStuff~resultCallback} resCb callback after the command is finished + * @param {ExecuteStuff~lineCallback} lineCb callback for stdout when command is executed asynchronosly + * @class + */ + Execute(cmd, sync, resCb, lineCb) { + Lib.TalkativeLog(`-¶-execute: ${cmd}`); + + this.CommandString = cmd; + if ( + resCb === undefined && + resCb === null && + typeof resCb !== 'function' + ) { + Lib.TalkativeLog('-¶-resCallback NEED to be a function'); + + this.Callback = null; + } else { + this.Callback = resCb; + } + + if (sync === true) { + Lib.TalkativeLog('-¶-sync execute (wait for return)'); + this._syncCmd(this.CommandString); + } else { + Lib.TalkativeLog('-¶-async execute (fork process)'); + if ( + lineCb === undefined && + lineCb === null && + typeof lineCb !== 'function' + ) { + Lib.TalkativeLog('-¶-lineCallback NEED to be a function'); + + this.lineCallback = null; + } else { + this.lineCallback = lineCb; + } + this._asyncCmd(this.CommandString); + } + } + + /** + * @param {string} cmd the command to be executed + * @returns {*} + * @class + */ + Spawn(cmd) { + let [successP, argv] = this._parseCmd(cmd); + if (successP) { + let successS, pid; + try { + [successS, pid] = GLib.spawn_async( + null, + argv, + null, + GLib.SpawnFlags.SEARCH_PATH | + GLib.SpawnFlags.DO_NOT_REAP_CHILD, + null + ); + } catch (err) { + Lib.TalkativeLog( + `-¶-ERROR SPAWN err:${err.message.toString()}` + ); + successS = false; + } + + if (successS) { + Lib.TalkativeLog(`-¶-spawn: ${successS} pid: ${pid}`); + return true; + } else { + Lib.TalkativeLog('-¶-spawn ERROR'); + return null; + } + } + return null; + } + + /** + * @param {string} cmd the command to be executed + * @private + */ + _syncCmd(cmd) { + let [successP, argv] = this._parseCmd(cmd); + let decoder = new TextDecoder(); + if (successP) { + Lib.TalkativeLog(`-¶-argv: ${argv}`); + let successS, stdOut, stdErr, exit; + try { + [successS, stdOut, stdErr, exit] = GLib.spawn_sync( + null, + argv, + null, + GLib.SpawnFlags.SEARCH_PATH, + () => {} + ); + } catch (err) { + Lib.TalkativeLog('-¶-ERROR SPAWN'); + successS = false; + } + if (successS) { + Lib.TalkativeLog(`-¶-argv: ${argv}`); + Lib.TalkativeLog(`-¶-stdOut: ${decoder.decode(stdOut)}`); + Lib.TalkativeLog(`-¶-stdErr: ${decoder.decode(stdErr)}`); + Lib.TalkativeLog(`-¶-exit: ${exit}`); + + Lib.TalkativeLog('-¶-exe RC'); + if (this.Callback !== null) { + this.Callback.apply(this.Scope, [ + true, + decoder.decode(stdOut), + ]); + } + } else { + Lib.TalkativeLog(`-¶-ERROR exe WC - exit status: ${exit}`); + if (this.Callback !== null) + this.Callback.apply(this.Scope, [false]); + } + } + } + + /** + * @param {string} cmd the command to be executed + * @private + */ + _asyncCmd(cmd) { + let [successP, argv] = this._parseCmd(cmd); + let decoder = new TextDecoder(); + if (successP) { + Lib.TalkativeLog(`-¶-argv: ${argv}`); + let successS, pid, stdIn, stdOut, stdErr; + + try { + [ + successS, + pid, + stdIn, + stdOut, + stdErr, + ] = GLib.spawn_async_with_pipes( + null, // working directory + argv, // argv + null, // envp + GLib.SpawnFlags.SEARCH_PATH, // flags + () => {} // child_setup + ); + } catch (err) { + Lib.TalkativeLog('-¶-ERROR SPAWN'); + successS = false; + } + if (successS) { + Lib.TalkativeLog(`-¶-argv: ${argv}`); + Lib.TalkativeLog(`-¶-pid: ${pid}`); + Lib.TalkativeLog(`-¶-stdIn: ${stdIn}`); + Lib.TalkativeLog(`-¶-stdOut: ${stdOut}`); + Lib.TalkativeLog(`-¶-stdErr: ${stdErr}`); + + let outReader = new Gio.DataInputStream({ + base_stream: new Gio.UnixInputStream({ + fd: stdOut, + }), + }); + let inWriter = new Gio.DataOutputStream({ + base_stream: new Gio.UnixOutputStream({ + fd: stdIn, + }), + }); + inWriter.close(null); + + let [out] = outReader.read_line(null); + while (out !== null) { + if (this.lineCallback !== null) + this.lineCallback.apply(this.Scope, [decoder.decode(out)]); + + [out] = outReader.read_line(null); + } + + if (this.Callback !== null) { + Lib.TalkativeLog('-¶-exe RC'); + this.Callback.apply(this.Scope, [true]); + } + } else { + Lib.TalkativeLog('-¶-ERROR exe WC'); + if (this.Callback !== null) + this.Callback.apply(this.Scope, [false]); + } + } + } +}); + +export {ExecuteStuff}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilgsp.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilgsp.js new file mode 100644 index 0000000..f9f45a3 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilgsp.js @@ -0,0 +1,737 @@ +/* + Copyright (C) 2016 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + +'use strict'; + +import * as Lib from './convenience.js'; +import * as Settings from './settings.js'; + +// CONST GSP - base +const SCREEN = + '_SCREENCAST_RES_ _ENCODER_VIDEO_ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! _CONTAINER_'; + +// CONST GSP - base plus sound +const SCREEN_SOUND = + 'queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! _SCREENCAST_RES_ _ENCODER_VIDEO_ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mux. pulsesrc ! audioconvert ! _ENCODER_AUDIO_ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mux. _CONTAINER_ name=mux '; + +// CONST GSP - base plus webcam +const SCREEN_WEBCAM = + 'queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! videomixer name=mix _WEBCAM_OPT_ ! videoconvert ! _SCREENCAST_RES_ _ENCODER_VIDEO_ ! mux. v4l2src _WEBCAM_DEV_ ! _WEBCAM_CAP_ ! videoscale ! video/x-raw, width=_WEBCAM_W_, height=_WEBCAM_H_, add-borders=false ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mix. _CONTAINER_ name=mux'; + +// CONST GSP - base plus sound and webcam stream +const SCREEN_WEBCAM_SOUND = + 'queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! videomixer name=mix _WEBCAM_OPT_ ! videoconvert ! _SCREENCAST_RES_ _ENCODER_VIDEO_ ! mux. v4l2src _WEBCAM_DEV_ ! _WEBCAM_CAP_ ! videoscale ! video/x-raw, width=_WEBCAM_W_, height=_WEBCAM_H_, add-borders=false ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mix. pulsesrc ! audioconvert ! _ENCODER_AUDIO_ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mux. _CONTAINER_ name=mux'; + +// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +// CONST CONTAINER - WebM +const webmVP8 = { + fileExt: '.webm', + nameGSP: 'webmmux', + quality: [ + { + // quality level 0 + fps: 15, + vq: + 'vp8enc min_quantizer=13 max_quantizer=20 cpu-used=5 deadline=1000000 sharpness=2 target-bitrate=10000 threads=%T', + aq: 'vorbisenc', + descr: + 'FPS: 15 \nVideo -> VP8 Encoder:\n-min_quantizer=13\n-max_quantizer=20\n-cpu-used=5\n-deadline=1000000\n-sharpness=2\n-target-bitrate=10000\nAudio -> Vorbis Encoder', + }, + { + // quality level 1 + fps: 30, + vq: + 'vp8enc min_quantizer=4 max_quantizer=13 cpu-used=2 deadline=500000 sharpness=0 target-bitrate=15000 threads=%T', + aq: 'vorbisenc', + descr: + 'FPS: 30 \nVideo -> VP8 Encoder:\n-min_quantizer=4\n-max_quantizer=13\n-cpu-used=2\n-deadline=500000\n-sharpness=0\n-target-bitrate=15000\nAudio -> Vorbis Encoder', + }, + { + // quality level 2 + fps: 30, + vq: + 'vp8enc min_quantizer=0 max_quantizer=7 cpu-used=1 deadline=500000 sharpness=0 target-bitrate=25000 threads=%T', + aq: 'vorbisenc', + descr: + 'FPS: 30 \nVideo -> VP8 Encoder:\n-min_quantizer=0\n-max_quantizer=7\n-cpu-used=1\n-deadline=500000\n-sharpness=0\n-target-bitrate=25000\nAudio -> Vorbis Encoder', + }, + { + // quality level 3 + fps: 60, + vq: + 'vp8enc min_quantizer=0 max_quantizer=0 cpu-used=0 deadline=100000 sharpness=0 target-bitrate=40000 threads=%T', + aq: 'vorbisenc', + descr: + 'FPS: 60 \nVideo -> VP8 Encoder:\n-min_quantizer=0\n-max_quantizer=0\n-cpu-used=0\n-deadline=100000\n-sharpness=0\n-target-bitrate=40000\nAudio -> Vorbis Encoder', + }, + ], +}; + +const webmVP9 = { + fileExt: '.webm', + nameGSP: 'webmmux', + quality: [ + { + // quality level 0 + fps: 15, + vq: + 'vp9enc min_quantizer=13 max_quantizer=20 cpu-used=5 deadline=1000000 sharpness=2 target-bitrate=10000 threads=%T', + aq: 'vorbisenc', + descr: + 'FPS: 15 \nVideo -> VP9 Encoder:\n-min_quantizer=13\n-max_quantizer=20\n-cpu-used=5\n-deadline=1000000\n-sharpness=2\n-target-bitrate=10000\nAudio -> Vorbis Encoder', + }, + { + // quality level 1 + fps: 30, + vq: + 'vp9enc min_quantizer=4 max_quantizer=13 cpu-used=2 deadline=500000 sharpness=0 target-bitrate=15000 threads=%T', + aq: 'vorbisenc', + descr: + 'FPS: 30 \nVideo -> VP9 Encoder:\n-min_quantizer=4\n-max_quantizer=13\n-cpu-used=2\n-deadline=500000\n-sharpness=0\n-target-bitrate=15000\nAudio -> Vorbis Encoder', + }, + { + // quality level 2 + fps: 30, + vq: + 'vp9enc min_quantizer=0 max_quantizer=7 cpu-used=1 deadline=500000 sharpness=0 target-bitrate=25000 threads=%T', + aq: 'vorbisenc', + descr: + 'FPS: 30 \nVideo -> VP9 Encoder:\n-min_quantizer=0\n-max_quantizer=7\n-cpu-used=1\n-deadline=500000\n-sharpness=0\n-target-bitrate=25000\nAudio -> Vorbis Encoder', + }, + { + // quality level 3 + fps: 60, + vq: + 'vp9enc min_quantizer=0 max_quantizer=0 cpu-used=0 deadline=100000 sharpness=0 target-bitrate=40000 threads=%T', + aq: 'vorbisenc', + descr: + 'FPS: 60 \nVideo -> VP9 Encoder:\n-min_quantizer=0\n-max_quantizer=0\n-cpu-used=0\n-deadline=100000\n-sharpness=0\n-target-bitrate=40000\nAudio -> Vorbis Encoder', + }, + ], +}; + +// CONST CONTAINER - Mp4 +const mp4 = { + fileExt: '.mp4', + nameGSP: 'mp4mux', + quality: [ + { + // quality level 0 + fps: 15, + vq: + 'x264enc psy-tune="none" speed-preset="superfast" subme=1 qp-min=28 qp-max=40 threads=%T', + aq: 'lamemp3enc', + descr: + 'FPS: 15 \nVideo -> x264enc Encoder:\n-psy-tune="none"\n-speed-preset="superfast"\n-subme=1\n-qp-min=28\n-qp-max=40\nAudio -> Mp3 Encoder', + }, + { + // quality level 1 + fps: 30, + vq: + 'x264enc psy-tune="animation" speed-preset="fast" subme=5 qp-min=18 qp-max=28 threads=%T', + aq: 'lamemp3enc', + descr: + 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="fast"\n-subme=5\n-qp-min=18\n-qp-max=28\nAudio -> Mp3 Encoder', + }, + { + // quality level 2 + fps: 30, + vq: + 'x264enc psy-tune="animation" speed-preset="medium" subme=8 qp-min=10 qp-max=18 threads=%T', + aq: 'lamemp3enc', + descr: + 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="medium"\n-subme=8\n-qp-min=10\n-qp-max=18\nAudio -> Mp3 Encoder', + }, + { + // quality level 3 + fps: 60, + vq: + 'x264enc psy-tune="film" speed-preset="slower" subme=10 qp-min=0 qp-max=10 threads=%T', + aq: 'lamemp3enc', + descr: + 'FPS: 60 \nVideo -> x264enc Encoder:\n-psy-tune="film"\n-speed-preset="slower"\n-subme=10\n-qp-min=0\n-qp-max=10\nAudio -> Mp3 Encoder', + }, + ], +}; + +const mp4Aac = { + fileExt: '.mp4', + nameGSP: 'mp4mux', + quality: [ + { + // quality level 0 + fps: 15, + vq: + 'x264enc psy-tune="none" speed-preset="superfast" subme=1 qp-min=28 qp-max=40 threads=%T', + aq: 'avenc_aac', + descr: + 'FPS: 15 \nVideo -> x264enc Encoder:\n-psy-tune="none"\n-speed-preset="superfast"\n-subme=1\n-qp-min=28\n-qp-max=40\nAudio -> AAC Encoder', + }, + { + // quality level 1 + fps: 30, + vq: + 'x264enc psy-tune="animation" speed-preset="fast" subme=5 qp-min=18 qp-max=28 threads=%T', + aq: 'avenc_aac', + descr: + 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="fast"\n-subme=5\n-qp-min=18\n-qp-max=28\nAudio -> AAC Encoder', + }, + { + // quality level 2 + fps: 30, + vq: + 'x264enc psy-tune="animation" speed-preset="medium" subme=8 qp-min=10 qp-max=18 threads=%T', + aq: 'avenc_aac', + descr: + 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="medium"\n-subme=8\n-qp-min=10\n-qp-max=18\nAudio -> AAC Encoder', + }, + { + // quality level 3 + fps: 60, + vq: + 'x264enc psy-tune="film" speed-preset="slower" subme=10 qp-min=0 qp-max=10 threads=%T', + aq: 'avenc_aac', + descr: + 'FPS: 60 \nVideo -> x264enc Encoder:\n-psy-tune="film"\n-speed-preset="slower"\n-subme=10\n-qp-min=0\n-qp-max=10\nAudio -> AAC Encoder', + }, + ], +}; + +// CONST CONTAINER - Mkv +const mkv = { + fileExt: '.mkv', + nameGSP: 'matroskamux', + quality: [ + { + // quality level 0 + fps: 15, + vq: + 'x264enc psy-tune="none" speed-preset="superfast" subme=1 qp-min=28 qp-max=40 threads=%T', + aq: 'flacenc', + descr: + 'FPS: 15 \nVideo -> x264enc Encoder:\n-psy-tune="none"\n-speed-preset="superfast"\n-subme=1\n-qp-min=28\n-qp-max=40\nAudio -> Flac Encoder', + }, + { + // quality level 1 + fps: 30, + vq: + 'x264enc psy-tune="animation" speed-preset="fast" subme=5 qp-min=18 qp-max=28 threads=%T', + aq: 'flacenc', + descr: + 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="fast"\n-subme=5\n-qp-min=18\n-qp-max=28\nAudio -> Flac Encoder', + }, + { + // quality level 2 + fps: 30, + vq: + 'x264enc psy-tune="animation" speed-preset="medium" subme=8 qp-min=10 qp-max=18 threads=%T', + aq: 'flacenc', + descr: + 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="medium"\n-subme=8\n-qp-min=10\n-qp-max=18\nAudio -> Flac Encoder', + }, + { + // quality level 3 + fps: 60, + vq: + 'x264enc psy-tune="film" speed-preset="slower" subme=10 qp-min=0 qp-max=10 threads=%T', + aq: 'flacenc', + descr: + 'FPS: 60 \nVideo -> x264enc Encoder:\n-psy-tune="film"\n-speed-preset="slower"\n-subme=10\n-qp-min=0\n-qp-max=10\nAudio -> Flac Encoder', + }, + ], +}; + +// CONST CONTAINER - Ogg +const ogg = { + fileExt: '.ogg', + nameGSP: 'oggmux', + quality: [ + { + // quality level 0 + fps: 15, + vq: + 'theoraenc speed-level=3 vp3-compatible=true quality=10 bitrate=10000', + aq: 'opusenc', + descr: + 'FPS: 15 \nVideo -> Theora Encoder:\n-speed-level=3\n-vp3-compatible=true\n-quality=10\n-bitrate=10000\nAudio -> Opus Encoder', + }, + { + // quality level 1 + fps: 30, + vq: + 'theoraenc speed-level=1 vp3-compatible=false quality=30 bitrate=25000', + aq: 'opusenc', + descr: + 'FPS: 30 \nVideo -> Theora Encoder:\n-speed-level=1\n-vp3-compatible=false\n-quality=30\n-bitrate=25000\nAudio -> Opus Encoder', + }, + { + // quality level 2 + fps: 30, + vq: + 'theoraenc speed-level=0 vp3-compatible=false quality=50 bitrate=50000', + aq: 'opusenc', + descr: + 'FPS: 30 \nVideo -> Theora Encoder:\n-speed-level=0\n-vp3-compatible=false\n-quality=50\n-bitrate=50000\nAudio -> Opus Encoder', + }, + { + // quality level 3 + fps: 60, + vq: + 'theoraenc speed-level=0 vp3-compatible=false quality=60 bitrate=100000', + aq: 'opusenc', + descr: + 'FPS: 60 \nVideo -> Theora Encoder\n-speed-level=0\n-vp3-compatible=false\n-quality=60\n-bitrate=100000\nAudio -> Opus Encoder', + }, + ], +}; + +// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +// CONST RESOLUTION +const RESOLUTION = [ + // NATIVE SCREENCAST RESOLUTION + '', + // PRESET/CUSTOM SCREENCAST RESOLUTION + 'videoscale ! video/x-raw, width=_RES_WIDTH_, height=_RES_HEIGHT_, add-borders=_RES_KAR_ ! ', +]; + +// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +// VAR ARRAY CONTAINER +// see cbt_FileContainer in *.glade files for the combo box +const CONTAINER = [webmVP8, webmVP9, mp4, mkv, ogg, mp4Aac]; + +// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +/** + * Compose GSP + * + * @param {EasyScreenCastSettings} settings the extension's settings + * @param {MixerAudio} mixer the mixer + * + * @returns {string} + */ +function composeGSP(settings, mixer) { + Lib.TalkativeLog('-§-COMPOSE GSP'); + + let tmpGSP = ''; + + // retrieve options + let deviceWebcam = settings.getOption('s', Settings.DEVICE_WEBCAM_SETTING_KEY); + let deviceAudio = settings.getOption('i', Settings.INPUT_AUDIO_SOURCE_SETTING_KEY); + let qualityGSP = settings.getOption('i', Settings.QUALITY_SETTING_KEY); + let qualityWebcam = settings.getOption('s', Settings.QUALITY_WEBCAM_SETTING_KEY); + let resolutionType = settings.getOption('i', Settings.FILE_RESOLUTION_TYPE_SETTING_KEY); + let resolutionKAR = settings.getOption('b', Settings.FILE_RESOLUTION_KAR_SETTING_KEY); + let resolutionHeight = settings.getOption('i', Settings.FILE_RESOLUTION_HEIGHT_SETTING_KEY); + let resolutionWidth = settings.getOption('i', Settings.FILE_RESOLUTION_WIDTH_SETTING_KEY); + let container = settings.getOption('i', Settings.FILE_CONTAINER_SETTING_KEY); + + Lib.TalkativeLog( + `-§-get option||devW: ${deviceWebcam}||devA: ${deviceAudio}||Qgsp: ${qualityGSP}||Qwc: ${qualityWebcam}||Res: ${resolutionType}||Cont: ${container}` + ); + + if (deviceWebcam !== '') { + switch (deviceAudio) { + case 0: + Lib.TalkativeLog('-§- SCREEN-WEBCAM'); + + tmpGSP = SCREEN_WEBCAM; + + // replace WEBCAM_DEVICE/WEBCAM_CAPS + tmpGSP = _replaceWebcam( + tmpGSP, + deviceWebcam, + qualityWebcam, + settings + ); + + break; + case 1: + Lib.TalkativeLog('-§-SCREEN-WEBCAM-AUDIO(d)'); + + tmpGSP = SCREEN_WEBCAM_SOUND; + + // replace WEBCAM_DEVICE/WEBCAM_CAPS/ENCODER-AUDIO + tmpGSP = _replaceAudio( + _replaceWebcam(tmpGSP, deviceWebcam, qualityWebcam, settings), + true, + container, + qualityGSP, + mixer + ); + + break; + default: + Lib.TalkativeLog('-§-SCREEN-WEBCAM-AUDIO'); + + tmpGSP = SCREEN_WEBCAM_SOUND; + + // replace WEBCAM_DEVICE/WEBCAM_CAPS/ENCODER-AUDIO/AUDIO_DEVICE + tmpGSP = _replaceAudio( + _replaceWebcam(tmpGSP, deviceWebcam, qualityWebcam, settings), + false, + container, + qualityGSP, + mixer + ); + } + } else { + switch (deviceAudio) { + case 0: + Lib.TalkativeLog('-§-SCREEN'); + + tmpGSP = SCREEN; + + break; + case 1: + Lib.TalkativeLog('-§-SCREEN-AUDIO(d)'); + + tmpGSP = SCREEN_SOUND; + + // replace ENCODER-AUDIO + tmpGSP = _replaceAudio( + tmpGSP, + true, + container, + qualityGSP, + mixer + ); + + break; + default: + Lib.TalkativeLog('-§-SCREEN-AUDIO'); + + tmpGSP = SCREEN_SOUND; + + // replace ENCODER-AUDIO/AUDIO_DEVICE + tmpGSP = _replaceAudio( + tmpGSP, + false, + container, + qualityGSP, + mixer + ); + } + } + + // compose resolution string + var resolution = _composeResolution( + resolutionType, + resolutionHeight, + resolutionWidth, + resolutionKAR + ); + + // replace RESOLUTION/ENCODER-VIDEO/CONTAINER + var mapObj = { + _SCREENCAST_RES_: resolution, + _ENCODER_VIDEO_: CONTAINER[container].quality[qualityGSP].vq, + _CONTAINER_: CONTAINER[container].nameGSP, + }; + + tmpGSP = tmpGSP.replace( + /_SCREENCAST_RES_|_ENCODER_VIDEO_|_CONTAINER_/gi, + match => { + return mapObj[match]; + } + ); + + Lib.TalkativeLog(`-§-final GSP :${tmpGSP}`); + + return tmpGSP; +} + +/** + * replace audio + * + * @param {string} gspRA input pipeline to be modified + * @param {boolean} defaultAudio whether to use the default audio device + * @param {int} ConTMP selected output container. Used to determine correct audio encoder + * @param {int} QGSPtmp quality setting + * @param {MixerAudio} mixer audio mixer + * @returns {string} pipeline with audio + */ +function _replaceAudio(gspRA, defaultAudio, ConTMP, QGSPtmp, mixer) { + Lib.TalkativeLog(`-§-replace audio default->${defaultAudio}`); + // replace device/encoder + var aq = CONTAINER[ConTMP].quality[QGSPtmp].aq; + Lib.TalkativeLog(`-§-pipeline pre-audio:${gspRA} aq:${aq}`); + var audioPipeline; + + if (defaultAudio) { + Lib.TalkativeLog('-§-default audio source'); + audioPipeline = gspRA.replace(/_ENCODER_AUDIO_/gi, aq); + } else { + var audiosource = mixer.getAudioSource(); + if (audiosource === undefined) { + Lib.TalkativeLog('-§-failure combination of array audio sources'); + audioPipeline = gspRA.replace(/_ENCODER_AUDIO_/gi, aq); + } else { + Lib.TalkativeLog('-§-correct audio source assignment'); + if (audiosource.indexOf('output') !== -1) + audiosource += '.monitor'; + + var reDev = `pulsesrc device="${audiosource}"`; + + var mapObj = { + pulsesrc: reDev, + _ENCODER_AUDIO_: aq, + }; + + audioPipeline = gspRA.replace( + /pulsesrc|_ENCODER_AUDIO_/gi, + match => { + return mapObj[match]; + } + ); + } + } + + Lib.TalkativeLog(`-§-pipeline post-audio:${audioPipeline}`); + + return audioPipeline; +} + +/** + * replace webcam + * + * @param {string} gspRW input pipeline to be modified + * @param {string} device webcam device file (e.g. /dev/video0) + * @param {string} caps quality options + * @param {EasyScreenCastSettings} settings the extension's settings + * @returns {string} pipeline with webcam settings + */ +function _replaceWebcam(gspRW, device, caps, settings) { + Lib.TalkativeLog(`-§-replace webcam -> ${device} caps: ${caps}`); + + // replace device/caps + var reDev = `device=${device}`; + var reWCopt = _composeWebCamOption(settings); + var [reWCwidth, reWCheight] = _getWebCamDimension(settings); + + Lib.TalkativeLog(`-§-pipeline pre-webcam:${gspRW}`); + + var mapObj = { + _WEBCAM_DEV_: reDev, + _WEBCAM_CAP_: caps, + _WEBCAM_OPT_: reWCopt, + _WEBCAM_W_: reWCwidth, + _WEBCAM_H_: reWCheight, + }; + + var webcamPipeline = gspRW.replace( + /_WEBCAM_DEV_|_WEBCAM_CAP_|_WEBCAM_OPT_|_WEBCAM_W_|_WEBCAM_H_/gi, + match => { + return mapObj[match]; + } + ); + + Lib.TalkativeLog(`-§-pipeline post-webcam:${webcamPipeline}`); + + return webcamPipeline; +} + +/** + * replace resolution + * + * @param {int} tmpRes resolution type: native/custom + * @param {int} h custom height + * @param {int} w custom width + * @param {boolean} kar whether to keep aspect ratio + * @returns {string} pipeline part for scaling resolution + */ +function _composeResolution(tmpRes, h, w, kar) { + Lib.TalkativeLog(`-§-resolution option: ${tmpRes}`); + var strRes = RESOLUTION[0]; + var mapObj = {}; + + switch (tmpRes) { + case -1: + break; + case 999: + mapObj = { + _RES_KAR_: kar ? 'true' : 'false', + _RES_HEIGHT_: h, + _RES_WIDTH_: w, + }; + + strRes = RESOLUTION[1].replace( + /_RES_KAR_|_RES_HEIGHT_|_RES_WIDTH_/gi, + match => { + return mapObj[match]; + } + ); + break; + default: + mapObj = { + _RES_KAR_: 'true', + _RES_HEIGHT_: h, + _RES_WIDTH_: w, + }; + + strRes = RESOLUTION[1].replace( + /_RES_KAR_|_RES_WIDTH_|_RES_HEIGHT_/gi, + match => { + return mapObj[match]; + } + ); + } + + Lib.TalkativeLog(`-§-compose resolution: ${strRes}`); + return strRes; +} + +/** + * compose option webcam position + * + * @param {EasyScreenCastSettings} settings the extension's settings + * + * @returns {string} + */ +function _composeWebCamOption(settings) { + Lib.TalkativeLog('-§-compose webcam option'); + + // retrieve option webcam + var webcamAlpha = settings.getOption('d', Settings.ALPHA_CHANNEL_WEBCAM_SETTING_KEY); + var webcamMarginX = settings.getOption('i', Settings.MARGIN_X_WEBCAM_SETTING_KEY); + var webcamMarginY = settings.getOption('i', Settings.MARGIN_Y_WEBCAM_SETTING_KEY); + var webcamCornerPosition = settings.getOption('i', Settings.CORNER_POSITION_WEBCAM_SETTING_KEY); + var [webcamWidth, webcamHeight, screenWidth, screenHeight] = _getWebCamDimension(settings); + + var posX = 0; + var posY = 0; + + Lib.TalkativeLog( + `-§-alpha=${webcamAlpha} |marX=${webcamMarginX} |marY=${webcamMarginY} |corner=${webcamCornerPosition}` + ); + + // corner top-left + posX = webcamMarginX; + posY = webcamMarginY; + + switch (webcamCornerPosition) { + case 0: + // corner bottom-right + posX = Math.floor(screenWidth - (webcamWidth + webcamMarginX)); + posY = Math.floor(screenHeight - (webcamHeight + webcamMarginY)); + break; + case 1: + // corner bottom-left + posX = webcamMarginX; + posY = Math.floor(screenHeight - (webcamHeight + webcamMarginY)); + break; + case 2: + // corner top-right + posX = Math.floor(screenWidth - (webcamWidth + webcamMarginX)); + posY = webcamMarginY; + break; + default: + } + + // check valid position + if ((posX < 0 || posX > screenWidth) && (posY < 0 || posY > screenHeight)) { + Lib.TalkativeLog('-§-NOT valid position'); + posX = 0; + posY = 0; + } + + var tmpWCopt = + `sink_0::alpha=1 sink_1::alpha=${ + webcamAlpha + } sink_1::xpos=${ + posX + } sink_1::ypos=${ + posY + } `; + + Lib.TalkativeLog(`-§-posX=${posX} |posY=${posY}`); + Lib.TalkativeLog(`-§-webcam option=${tmpWCopt}`); + + return tmpWCopt; +} + +/** + * retrieve dimension webcam + * + * @param {EasyScreenCastSettings} settings the extension's settings + * + * @returns {*[]} array with webcam width,height,screen-width,screen-height + */ +function _getWebCamDimension(settings) { + Lib.TalkativeLog('-§-get webcam dimension'); + + var webcamWidth = settings.getOption('i', Settings.WIDTH_WEBCAM_SETTING_KEY); + var webcamHeight = settings.getOption('i', Settings.HEIGHT_WEBCAM_SETTING_KEY); + var webcamUnit = settings.getOption('i', Settings.TYPE_UNIT_WEBCAM_SETTING_KEY); + var screenWidth = settings.getOption('i', Settings.WIDTH_SETTING_KEY); + var screenHeight = settings.getOption('i', Settings.HEIGHT_SETTING_KEY); + + if (settings.getOption('i', Settings.AREA_SCREEN_SETTING_KEY) === 0) { + screenWidth = global.screen_width; + screenHeight = global.screen_height; + } + + Lib.TalkativeLog( + `-§-WC w=${webcamWidth} WC h=${webcamHeight} WCtype=${webcamUnit} screen W=${screenWidth} screen H=${screenHeight}` + ); + + if (webcamUnit === 0) { + webcamWidth = Math.floor((screenWidth * webcamWidth) / 100); + webcamHeight = Math.floor((screenHeight * webcamHeight) / 100); + } + + Lib.TalkativeLog(`-§-after percentage WCw=${webcamWidth} WCh=${webcamHeight}`); + + return [webcamWidth, webcamHeight, screenWidth, screenHeight]; +} + +/** + * get description + * + * @param {int} quality selected quality + * @param {int} container selected container format + * @returns {string} + */ +function getDescr(quality, container) { + Lib.TalkativeLog(`-§-get description Q-> ${quality} C-> ${container}`); + + return CONTAINER[container].quality[quality].descr; +} + +/** + * get fps + * + * @param {int} quality selected quality + * @param {int} container selected container format + * @returns {number} + */ +function getFps(quality, container) { + Lib.TalkativeLog(`-§-get fps Q-> ${quality} C-> ${container}`); + + return CONTAINER[container].quality[quality].fps; +} + +/** + * get file extension + * + * @param {int} container selected container format + * @returns {string} + */ +function getFileExtension(container) { + Lib.TalkativeLog(`-§-get file extension C-> ${container}`); + + return CONTAINER[container].fileExt; +} + +export {composeGSP, getDescr, getFps, getFileExtension}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilnotify.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilnotify.js new file mode 100644 index 0000000..1bdb476 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilnotify.js @@ -0,0 +1,147 @@ +/* + Copyright (C) 2016 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + +'use strict'; + +import GObject from 'gi://GObject'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js +import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; +import St from 'gi://St'; + +import * as Lib from './convenience.js'; +import * as Settings from './settings.js'; +import * as Ext from './extension.js'; + +import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; + +/** + * @type {NotifyManager} + */ +var NotifyManager = GObject.registerClass({ + GTypeName: 'EasyScreenCast_NotifyManager', +}, class NotifyManager extends GObject.Object { + /** + * Create a notify manager + */ + constructor() { + super(); + Lib.TalkativeLog('-°-init notify manager'); + this._alertWidget = null; + } + + /** + * create notify + * + * @param {string} msg the title + * @param {Gio.FileIcon} icon the icon + * @param {boolean} sound whether to play a sound + * @returns {MessageTray.Notification} + */ + createNotify(msg, icon, sound) { + Lib.TalkativeLog(`-°-create notify :${msg}`); + var source = new MessageTray.Source({ + title: _('EasyScreenCast'), + }); + var notify = new MessageTray.Notification({ + source, + title: msg, + body: null, + gicon: icon, + isTransient: false, + resident: true, + }); + + Main.messageTray.add(source); + source.addNotification(notify); + + if (sound) + notify.playSound(); + + return notify; + } + + /** + * update notify + * + * @param {MessageTray.Notification} notify the already existing notification to update + * @param {string} msg the title + * @param {Gio.FileIcon} icon the icon + * @param {boolean} sound whether to play a sound + */ + updateNotify(notify, msg, icon, sound) { + Lib.TalkativeLog('-°-update notify'); + + notify.set({ + title: msg, + body: null, + gicon: icon, + }); + + if (sound) + notify.playSound(); + } + + /** + * create alert + * + * @param {string} msg the message + */ + createAlert(msg) { + Lib.TalkativeLog(`-°-show alert tweener : ${msg}`); + if (Ext.Indicator.getSettings().getOption('b', Settings.SHOW_NOTIFY_ALERT_SETTING_KEY)) { + var monitor = Main.layoutManager.focusMonitor; + + this.resetAlert(); + this._alertWidget = new St.Label({ + style_class: 'alert-msg', + opacity: 255, + text: msg, + }); + Main.uiGroup.add_child(this._alertWidget); + + this._alertWidget.set_position( + Math.floor(monitor.width / 2 - this._alertWidget.width / 2), + Math.floor(monitor.height / 2 - this._alertWidget.height / 2) + ); + + Lib.TalkativeLog(`-°-show alert tweener : opacity=${this._alertWidget.opacity}`); + + // see org/gnome/shell/ui/environment.js#_easeActor + // TODO: for some reason, no transition is created, so the onComplete + // callback is called _immediately_ + /* + import Clutter from 'gi://Clutter'; + this._alertWidget.ease({ + opacity: 0, + duration: 400, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + onComplete: () => { + Lib.TalkativeLog(`-°-show alert tweener completed: opacity=${this._alertWidget.opacity}`); + Main.uiGroup.remove_child(this._alertWidget); + this._alertWidget = null; + }, + }); + */ + } + } + + resetAlert() { + if (this._alertWidget !== null) { + this._alertWidget.hide(); + Main.uiGroup.remove_child(this._alertWidget); + this._alertWidget = null; + } + } +}); + +export {NotifyManager}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilrecorder.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilrecorder.js new file mode 100644 index 0000000..1b0a434 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilrecorder.js @@ -0,0 +1,216 @@ +/* + Copyright (C) 2013 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + +'use strict'; + +import GObject from 'gi://GObject'; +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; +import {loadInterfaceXML} from 'resource:///org/gnome/shell/misc/dbusUtils.js'; +const ScreencastIface = loadInterfaceXML('org.gnome.Shell.Screencast'); + +import * as Lib from './convenience.js'; +import * as Settings from './settings.js'; +import * as Selection from './selection.js'; +import * as UtilGSP from './utilgsp.js'; +import * as Ext from './extension.js'; + +/** + * @type {CaptureVideo} + */ +var CaptureVideo = GObject.registerClass({ + GTypeName: 'EasyScreenCast_CaptureVideo', +}, class CaptureVideo extends GObject.Object { + /** + * Create a video recorder + */ + constructor() { + super(); + Lib.TalkativeLog('-&-init recorder'); + + this.AreaSelected = null; + + // connect to d-bus service + const ScreenCastProxy = Gio.DBusProxy.makeProxyWrapper(ScreencastIface); + this._screenCastService = new ScreenCastProxy( + Gio.DBus.session, + 'org.gnome.Shell.Screencast', + '/org/gnome/Shell/Screencast', + (proxy, error) => { + if (error) + Lib.TalkativeLog(`-&-ERROR(d-bus proxy connected) - ${error.message}`); + else + Lib.TalkativeLog('-&-d-bus proxy connected'); + } + ); + } + + /** + * start recording + */ + start() { + Lib.TalkativeLog('-&-start video recording'); + this.recordingActive = false; + + let fileExt = UtilGSP.getFileExtension( + Ext.Indicator.getSettings().getOption('i', Settings.FILE_CONTAINER_SETTING_KEY) + ); + // prepare variable for screencast + let fileRec = Ext.Indicator.getSettings().getOption('s', Settings.FILE_NAME_SETTING_KEY); + + let folderRec = ''; + if (Ext.Indicator.getSettings().getOption('s', Settings.FILE_FOLDER_SETTING_KEY) !== '') + folderRec = Ext.Indicator.getSettings().getOption('s', Settings.FILE_FOLDER_SETTING_KEY); + + let pipelineRec = ''; + + if (Ext.Indicator.getSettings().getOption('b', Settings.ACTIVE_CUSTOM_GSP_SETTING_KEY)) { + pipelineRec = Ext.Indicator.getSettings().getOption( + 's', + Settings.PIPELINE_REC_SETTING_KEY + ); + } else { + // compose GSP + pipelineRec = UtilGSP.composeGSP(Ext.Indicator.getSettings(), Ext.Indicator.CtrlAudio); + } + + Lib.TalkativeLog(`-&-file template : ${fileRec}`); + fileRec = this._generateFileName(fileRec); + Lib.TalkativeLog(`-&-file final : ${fileRec}`); + const completeFileRecPath = folderRec !== '' + ? `${folderRec}/${fileRec}` + : fileRec; + Lib.TalkativeLog(`-&-file rec path complete : ${completeFileRecPath}${fileExt}`); + + // prefix with a videoconvert element + // see DEFAULT_PIPELINE in https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/dbusServices/screencast/screencastService.js#L26 + // this videoconvert element was added always previously (< Gnome 40) and needs to be added now explicitly + // https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/51bf7ec17617a9ed056dd563afdb98e17da07373 + pipelineRec = `videoconvert chroma-mode=GST_VIDEO_CHROMA_MODE_NONE dither=GST_VIDEO_DITHER_NONE matrix-mode=GST_VIDEO_MATRIX_MODE_OUTPUT_ONLY n-threads=%T ! queue ! ${pipelineRec}`; + Lib.TalkativeLog(`-&-pipeline : pipeline: ${pipelineRec}`); + + var optionsRec = { + 'draw-cursor': new GLib.Variant( + 'b', + Ext.Indicator.getSettings().getOption('b', Settings.DRAW_CURSOR_SETTING_KEY) + ), + framerate: new GLib.Variant( + 'i', + Ext.Indicator.getSettings().getOption('i', Settings.FPS_SETTING_KEY) + ), + pipeline: new GLib.Variant('s', pipelineRec), + }; + + if (Ext.Indicator.getSettings().getOption('i', Settings.AREA_SCREEN_SETTING_KEY) === 0) { + this._screenCastService.ScreencastRemote( + completeFileRecPath, + optionsRec, + (result, error) => { + if (error) { + Lib.TalkativeLog(`-&-ERROR(screencast execute) - ${error.message}`); + + this.stop(); + Ext.Indicator.doRecResult(false); + } else { + Lib.TalkativeLog(`-&-screencast execute - ${result[0]} - ${result[1]}`); + + let resultingFilePath = result[1]; + if (resultingFilePath.endsWith('.undefined')) { + resultingFilePath = resultingFilePath.substring(0, resultingFilePath.length - '.undefined'.length); + resultingFilePath = `${resultingFilePath}${fileExt}`; + } + this._originalFilePath = result[1]; + this._filePathWithExtension = resultingFilePath; + + Ext.Indicator.doRecResult(result[0], resultingFilePath); + } + } + ); + } else { + this._screenCastService.ScreencastAreaRemote( + Ext.Indicator.getSettings().getOption('i', Settings.X_POS_SETTING_KEY), + Ext.Indicator.getSettings().getOption('i', Settings.Y_POS_SETTING_KEY), + Ext.Indicator.getSettings().getOption('i', Settings.WIDTH_SETTING_KEY), + Ext.Indicator.getSettings().getOption('i', Settings.HEIGHT_SETTING_KEY), + completeFileRecPath, + optionsRec, + (result, error) => { + if (error) { + Lib.TalkativeLog(`-&-ERROR(screencast execute) - ${error.message}`); + + this.stop(); + Ext.Indicator.doRecResult(false); + } else { + Lib.TalkativeLog(`-&-screencast execute - ${result[0]} - ${result[1]}`); + + // draw area recording + if (Ext.Indicator.getSettings().getOption('b', Settings.SHOW_AREA_REC_SETTING_KEY)) + this.AreaSelected = new Selection.AreaRecording(); + + let resultingFilePath = result[1]; + if (resultingFilePath.endsWith('.undefined')) { + resultingFilePath = resultingFilePath.substring(0, resultingFilePath.length - '.undefined'.length); + resultingFilePath = `${resultingFilePath}${fileExt}`; + } + this._originalFilePath = result[1]; + this._filePathWithExtension = resultingFilePath; + + Ext.Indicator.doRecResult(result[0], resultingFilePath); + } + } + ); + } + } + + /** + * Stop recording + * + * @returns {boolean} + */ + stop() { + Lib.TalkativeLog('-&-stop video recording'); + + this._screenCastService.StopScreencastRemote((result, error) => { + if (error) { + Lib.TalkativeLog(`-&-ERROR(screencast stop) - ${error.message}`); + return false; + } else { + Lib.TalkativeLog(`-&-screencast stop - ${result[0]}`); + + + // rename the file... + Lib.TalkativeLog(`-&-screencast: rename ${this._originalFilePath} to ${this._filePathWithExtension}`); + const sourceFile = Gio.File.new_for_path(this._originalFilePath); + const destFile = Gio.File.new_for_path(this._filePathWithExtension); + sourceFile.move(destFile, 0, null, null); + } + + // clear area recording + if (this.AreaSelected !== null && this.AreaSelected.isVisible()) + this.AreaSelected.clearArea(); + + return true; + }); + } + + // without file extension + _generateFileName(template) { + template = template.replaceAll('%d', '%0x').replaceAll('%t', '%0X'); + const datetime = GLib.DateTime.new_now_local(); + let result = datetime.format(template); + result = result.replaceAll(' ', '_'); // remove white space + result = result.replaceAll('/', '_'); // remove path separators + return result; + } +}); + +export {CaptureVideo}; diff --git a/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilwebcam.js b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilwebcam.js new file mode 100644 index 0000000..d1ab076 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/EasyScreenCast@iacopodeenosee.gmail.com/utilwebcam.js @@ -0,0 +1,315 @@ +/* + Copyright (C) 2015 Borsato Ivano + + The JavaScript code in this page is free software: you can + redistribute it and/or modify it under the terms of the GNU + General Public License (GNU GPL) as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. The code is distributed WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. +*/ + +'use strict'; + +import GObject from 'gi://GObject'; +import GLib from 'gi://GLib'; +import Gst from 'gi://Gst?version=1.0'; +import * as Lib from './convenience.js'; + +var HelperWebcam = GObject.registerClass({ + GTypeName: 'EasyScreenCast_HelperWebcam', +}, class HelperWebcam extends GObject.Object { + /** + * Create a device monitor inputvideo + * + * @param {string} unspecifiedWebcamText localized text for "Unspecified Webcam" + */ + constructor(unspecifiedWebcamText) { + super(); + this._unspecified_webcam_text = unspecifiedWebcamText; + Lib.TalkativeLog('-@-init webcam'); + + Gst.init(null); + + // get gstreamer lib version + var [M, m, micro, nano] = Gst.version(); + Lib.TalkativeLog( + `-@-gstreamer version: ${M}.${m}.${micro}.${nano}` + ); + if (M === 1 && m >= 8) { + // gstreamer version equal or higher 1.8 + this.deviceMonitor = new Gst.DeviceMonitor({ + show_all: true, + }); + } else { + // gstreamer version lower 1.8 + this.deviceMonitor = new Gst.DeviceMonitor(); + } + + // get gstreamer plugin avaiable + let registry = new Gst.Registry(); + let listPI = registry.get_plugin_list(); + Lib.TalkativeLog(`-@-plugin list: ${listPI.length}`); + for (var ind in listPI) { + Lib.TalkativeLog( + `-@-plugin name: ${ + listPI[ind].get_name() + } Pfilename: ${ + listPI[ind].get_filename() + } Pdesc: ${ + listPI[ind].get_description() + } Pversion: ${ + listPI[ind].get_version() + } Pload: ${ + listPI[ind].is_loaded()}` + ); + } + + // create device monitor + if (this.deviceMonitor !== null && this.deviceMonitor !== undefined) { + Lib.TalkativeLog('-@-device monitor created'); + this.dmBus = this.deviceMonitor.get_bus(); + if (this.dmBus !== null && this.dmBus !== undefined) { + Lib.TalkativeLog('-@-dbus created'); + this.dmBus.add_watch(GLib.PRIORITY_DEFAULT, this._getMsg.bind(this)); + let caps = Gst.Caps.new_empty_simple('video/x-raw'); + this.deviceMonitor.add_filter('Video/Source', caps); + this.startMonitor(); + // update device and caps + this.refreshAllInputVideo(); + } else { + Lib.TalkativeLog('-@-ERROR dbus creation'); + } + } else { + Lib.TalkativeLog('-@-ERROR device monitor creation'); + } + } + + /** + * Callback for the DeviceMonitor watcher + * + * @param {Gst.Bus} bus the DeviceMonitor Bus of gstreamer + * @param {Gst.Message} message the message + * @returns {boolean} + */ + _getMsg(bus, message) { + Lib.TalkativeLog('-@-event getmsg'); + switch (message.type) { + case Gst.MessageType.DEVICE_ADDED: + Lib.TalkativeLog('Device added'); + + // update device and caps + this.refreshAllInputVideo(); + break; + case Gst.MessageType.DEVICE_REMOVED: + Lib.TalkativeLog('Device removed'); + + // update device and caps + this.refreshAllInputVideo(); + break; + default: + Lib.TalkativeLog('Device UNK'); + break; + } + + return GLib.SOURCE_CONTINUE; + } + + /** + * refresh all devices info + */ + refreshAllInputVideo() { + Lib.TalkativeLog('-@-refresh all video input'); + + this._listDevices = this.getDevicesIV(); + // compose devices array + this._listCaps = []; + for (var index in this._listDevices) { + this._listCaps[index] = this.getCapsForIV(this._listDevices[index].caps); + + Lib.TalkativeLog(`-@-webcam /dev/video${index} name: ${this._listDevices[index].display_name}`); + Lib.TalkativeLog(`-@-caps available: ${this._listCaps[index].length}`); + Lib.TalkativeLog(`-@-ListCaps[${index}]: ${this._listCaps[index]}`); + } + } + + /** + * get caps from device. + * A single capability might look like: video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1 + * This encodes a single capability (fixed), but there might also be capabilities which represent options, e.g. + * video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction) { 30/1, 25/1, 20/1 }. + *
+ * The code here will take always the first option and unroll the options for framerate. + * + * @param {Gst.Caps} tmpCaps capabilities of a device + * @returns {string[]} + */ + getCapsForIV(tmpCaps) { + Lib.TalkativeLog('-@-get all caps from a input video'); + Lib.TalkativeLog(`-@-caps available before filtering for video/x-raw: ${tmpCaps.get_size()}`); + + let cleanCaps = []; + for (let i = 0; i < tmpCaps.get_size(); i++) { + let capsStructure = tmpCaps.get_structure(i); + + // only consider "video/x-raw" + if (capsStructure.get_name() === 'video/x-raw') { + Lib.TalkativeLog(`-@-cap : ${i} : original : ${capsStructure.to_string()}`); + + let tmpStr = 'video/x-raw'; + let result, number, fraction; + result = capsStructure.get_string('format'); + if (result !== null) + tmpStr += `, format=(string)${result}`; + [result, number] = capsStructure.get_int('width'); + if (result === true) + tmpStr += `, width=(int)${number}`; + [result, number] = capsStructure.get_int('height'); + if (result === true) + tmpStr += `, height=(int)${number}`; + [result, number, fraction] = capsStructure.get_fraction('pixel-aspect-ratio'); + if (result === true) + tmpStr += `, pixel-aspect-ratio=(fraction)${number}/${fraction}`; + + + if (capsStructure.has_field('framerate')) { + [result, number, fraction] = capsStructure.get_fraction('framerate'); + if (result === true) { + // a single framerate + this._addAndLogCapability(cleanCaps, i, `${tmpStr}, framerate=(fraction)${number}/${fraction}`); + } else { + // multiple framerates + + // unfortunately GstValueList is not supported in this gjs-binding + // "Error: Don't know how to convert GType GstValueList to JavaScript object" + // -> capsStructure.get_value('framerate') <- won't work + // -> capsStructure.get_list('framerate') <- only returns the numerator of the fraction + // + // therefore manually parsing the framerate values from the string representation + let framerates = capsStructure.to_string(); + framerates = framerates.substring(framerates.indexOf('framerate=(fraction){') + 21); + framerates = framerates.substring(0, framerates.indexOf('}')); + framerates.split(',').forEach(element => { + let [numerator, denominator] = element.split('/', 2); + this._addAndLogCapability(cleanCaps, i, `${tmpStr}, framerate=(fraction)${numerator.trim()}/${denominator.trim()}`); + }); + } + } else { + // no framerate at all + this._addAndLogCapability(cleanCaps, i, tmpStr); + } + } else { + Lib.TalkativeLog(`-@-cap : ${i} : skipped : ${capsStructure.to_string()}`); + } + } + return cleanCaps; + } + + /** + * Adds the capability str to the array caps, if it is not already there. Avoids duplicates. + * + * @param {Array} caps the list of capabilities + * @param {int} originalIndex index of the original capabilities list from the device + * @param {string} str the capability string to add + */ + _addAndLogCapability(caps, originalIndex, str) { + if (caps.indexOf(str) === -1) { + caps.push(str); + Lib.TalkativeLog(`-@-cap : ${originalIndex} : added cap : ${str}`); + } else { + Lib.TalkativeLog(`-@-cap : ${originalIndex} : ignore duplicated cap : ${str}`); + } + } + + /** + * get devices IV + * + * @returns {Gst.Device[]} + */ + getDevicesIV() { + Lib.TalkativeLog('-@-get devices'); + + var list = this.deviceMonitor.get_devices(); + Lib.TalkativeLog(`-@-devices number: ${list.length}`); + + // Note: + // Although the computer may have just one webcam connected to + // it, more than one GstDevice may be listed and all pointing to + // the same video device (for example /dev/video0. Each + // GstDevice is supposed to be used with a specific source, for + // example, a pipewiresrc or a v4l2src. For now, we are only + // using v4l2src. + // See also: Gst.DeviceMonitor.get_providers: pipewiredeviceprovider,decklinkdeviceprovider,v4l2deviceprovider + // + // So, here we filter the devices, that have a device.path property, which + // means, these are only v4l2 devices + var filtered = list.filter(device => device.get_properties().get_string('device.path') !== null); + Lib.TalkativeLog(`-@-devices number after filtering for v4l2: ${filtered.length}`); + + return filtered; + } + + /** + * get array name devices IV + * + * @returns {Array} + */ + getNameDevices() { + Lib.TalkativeLog('-@-get name devices'); + let tmpArray = []; + + for (var index in this._listDevices) { + var wcName = this._unspecified_webcam_text; + + if (this._listDevices[index].display_name !== '') + wcName = this._listDevices[index].display_name; + + tmpArray.push(wcName); + } + + Lib.TalkativeLog(`-@-list devices name: ${tmpArray}`); + return tmpArray; + } + + /** + * get array caps + * + * @param {int} index device + * @returns {string[]} + */ + getListCapsDevice(index) { + const tmpArray = this._listCaps[index]; + Lib.TalkativeLog(`-@-list caps of device: ${tmpArray}`); + return tmpArray; + } + + /** + * start listening + */ + startMonitor() { + Lib.TalkativeLog('-@-start video devicemonitor'); + this.deviceMonitor.start(); + } + + /** + * Stop listening + */ + stopMonitor() { + Lib.TalkativeLog('-@-stop video devicemonitor'); + this.disconnectSourceBus(); + this.deviceMonitor.stop(); + } + + /** + * disconect bus + */ + disconnectSourceBus() { + if (this.dmBusId) { + this.dmBus.disconnect(this.dmBusId); + this.dmBusId = 0; + } + } +}); + +export {HelperWebcam}; diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/extension.js b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/extension.js index ee5d735..d7f0daf 100644 --- a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/extension.js +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/extension.js @@ -40,15 +40,23 @@ var VitalsMenuButton = GObject.registerClass({ 'icon-rx': 'network-download-symbolic.svg', 'icon-tx': 'network-upload-symbolic.svg' }, 'storage' : { 'icon': 'storage-symbolic.svg' }, - 'battery' : { 'icon': 'battery-symbolic.svg' } + 'battery' : { 'icon': 'battery-symbolic.svg' }, + 'gpu' : { 'icon': 'gpu-symbolic.svg' } } + // list with the prefixes for the according themes, the index of each + // item must match the index on the combo box + this._sensorsIconPathPrefix = ['/icons/original/', '/icons/gnome/']; + this._warnings = []; this._sensorMenuItems = {}; this._hotLabels = {}; this._hotIcons = {}; this._groups = {}; this._widths = {}; + this._numGpus = 1; + this._newGpuDetected = false; + this._newGpuDetectedCount = 0; this._last_query = new Date().getTime(); this._sensors = new Sensors.Sensors(this._settings, this._sensorIcons); @@ -64,15 +72,16 @@ var VitalsMenuButton = GObject.registerClass({ }); this._drawMenu(); - this.add_actor(this._menuLayout); + this.add_child(this._menuLayout); this._settingChangedSignals = []; this._refreshTimeoutId = null; this._addSettingChangedSignal('update-time', this._updateTimeChanged.bind(this)); this._addSettingChangedSignal('position-in-panel', this._positionInPanelChanged.bind(this)); this._addSettingChangedSignal('menu-centered', this._positionInPanelChanged.bind(this)); + this._addSettingChangedSignal('icon-style', this._iconStyleChanged.bind(this)); - let settings = [ 'use-higher-precision', 'alphabetize', 'hide-zeros', 'fixed-widths', 'hide-icons', 'unit', 'memory-measurement', 'include-public-ip', 'network-speed-format', 'storage-measurement', 'include-static-info' ]; + let settings = [ 'use-higher-precision', 'alphabetize', 'hide-zeros', 'fixed-widths', 'hide-icons', 'unit', 'memory-measurement', 'include-public-ip', 'network-speed-format', 'storage-measurement', 'include-static-info', 'include-static-gpu-info' ]; for (let setting of Object.values(settings)) this._addSettingChangedSignal(setting, this._redrawMenu.bind(this)); @@ -95,21 +104,14 @@ var VitalsMenuButton = GObject.registerClass({ // groups associated sensors under accordion menu if (sensor in this._groups) continue; - this._groups[sensor] = new PopupMenu.PopupSubMenuMenuItem(_(this._ucFirst(sensor)), true); - this._groups[sensor].icon.gicon = Gio.icon_new_for_string(this._extensionObject.path + '/icons/' + this._sensorIcons[sensor]['icon']); + //handle gpus separately. + if (sensor === 'gpu') continue; - // hide menu items that user has requested to not include - if (!this._settings.get_boolean('show-' + sensor)) - this._groups[sensor].actor.hide(); - - if (!this._groups[sensor].status) { - this._groups[sensor].status = this._defaultLabel(); - this._groups[sensor].actor.insert_child_at_index(this._groups[sensor].status, 4); - this._groups[sensor].status.text = _('No Data'); - } - - this.menu.addMenuItem(this._groups[sensor]); + this._initializeMenuGroup(sensor, sensor); } + + for (let i = 1; i <= this._numGpus; i++) + this._initializeMenuGroup('gpu#' + i, 'gpu', (this._numGpus > 1 ? ' ' + i : '')); // add separator this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); @@ -135,7 +137,7 @@ var VitalsMenuButton = GObject.registerClass({ refreshButton.connect('clicked', (self) => { // force refresh by clearing history this._sensors.resetHistory(); - this._values.resetHistory(); + this._values.resetHistory(this._numGpus); // make sure timer fires at next full interval this._updateTimeChanged(); @@ -143,7 +145,7 @@ var VitalsMenuButton = GObject.registerClass({ // refresh sensors now this._querySensors(); }); - customButtonBox.add_actor(refreshButton); + customButtonBox.add_child(refreshButton); // custom round monitor button let monitorButton = this._createRoundButton('org.gnome.SystemMonitor-symbolic', _('System Monitor')); @@ -151,7 +153,7 @@ var VitalsMenuButton = GObject.registerClass({ this.menu._getTopMenu().close(); Util.spawn(this._settings.get_string('monitor-cmd').split(" ")); }); - customButtonBox.add_actor(monitorButton); + customButtonBox.add_child(monitorButton); // custom round preferences button let prefsButton = this._createRoundButton('preferences-system-symbolic', _('Preferences')); @@ -159,10 +161,10 @@ var VitalsMenuButton = GObject.registerClass({ this.menu._getTopMenu().close(); this._extensionObject.openPreferences(); }); - customButtonBox.add_actor(prefsButton); + customButtonBox.add_child(prefsButton); // now add the buttons to the top bar - item.actor.add_actor(customButtonBox); + item.actor.add_child(customButtonBox); // add buttons this.menu.addMenuItem(item); @@ -179,6 +181,24 @@ var VitalsMenuButton = GObject.registerClass({ }); } + _initializeMenuGroup(groupName, optionName, menuSuffix = '', position = -1) { + this._groups[groupName] = new PopupMenu.PopupSubMenuMenuItem(_(this._ucFirst(groupName) + menuSuffix), true); + this._groups[groupName].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath(groupName)); + + // hide menu items that user has requested to not include + if (!this._settings.get_boolean('show-' + optionName)) + this._groups[groupName].actor.hide(); + + if (!this._groups[groupName].status) { + this._groups[groupName].status = this._defaultLabel(); + this._groups[groupName].actor.insert_child_at_index(this._groups[groupName].status, 4); + this._groups[groupName].status.text = _('No Data'); + } + + if(position == -1) this.menu.addMenuItem(this._groups[groupName]); + else this.menu.addMenuItem(this._groups[groupName], position); + } + _createRoundButton(iconName) { let button = new St.Button({ style_class: 'message-list-clear-button button vitals-button-action' @@ -239,7 +259,7 @@ var VitalsMenuButton = GObject.registerClass({ _createHotItem(key, value) { let icon = this._defaultIcon(key); this._hotIcons[key] = icon; - this._menuLayout.add_actor(icon) + this._menuLayout.add_child(icon) // don't add a label when no sensors are in the panel if (key == '_default_icon_') return; @@ -248,7 +268,7 @@ var VitalsMenuButton = GObject.registerClass({ style_class: 'vitals-panel-label', text: (value)?value:'\u2026', // ... y_expand: true, - y_align: Clutter.ActorAlign.START + y_align: Clutter.ActorAlign.CENTER }); // attempt to prevent ellipsizes @@ -258,7 +278,7 @@ var VitalsMenuButton = GObject.registerClass({ this._hotLabels[key] = label; // prevent "called on the widget" "which is not in the stage" errors by adding before width below - this._menuLayout.add_actor(label); + this._menuLayout.add_child(label); // support for fixed widths #55, save label (text) width this._widths[key] = label.width; @@ -266,11 +286,17 @@ var VitalsMenuButton = GObject.registerClass({ _showHideSensorsChanged(self, sensor) { this._sensors.resetHistory(); - this._groups[sensor.substr(5)].visible = this._settings.get_boolean(sensor); + + const sensorName = sensor.substr(5); + if(sensorName === 'gpu') { + for(let i = 1; i <= this._numGpus; i++) + this._groups[sensorName + '#' + i].visible = this._settings.get_boolean(sensor); + } else + this._groups[sensorName].visible = this._settings.get_boolean(sensor); } _positionInPanelChanged() { - this.container.get_parent().remove_actor(this.container); + this.container.get_parent().remove_child(this.container); let position = this._positionInPanel(); // allows easily addressable boxes @@ -284,6 +310,27 @@ var VitalsMenuButton = GObject.registerClass({ boxes[position[0]].insert_child_at_index(this.container, position[1]); } + _redrawDetailsMenuIcons() { + // updates the icons on the 'details' menu, the one + // you have to click to appear + this._sensors.resetHistory(); + for (const sensor in this._sensorIcons) { + if (sensor == "gpu") continue; + this._groups[sensor].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath(sensor)); + } + + // gpu's are indexed differently, handle them here + const gpuKeys = Object.keys(this._groups).filter(key => key.startsWith("gpu#")); + gpuKeys.forEach((gpuKey) => { + this._groups[gpuKey].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath("gpu")); + }); + } + + _iconStyleChanged() { + this._redrawDetailsMenuIcons(); + this._redrawMenu(); + } + _removeHotLabel(key) { if (key in this._hotLabels) { let label = this._hotLabels[key]; @@ -322,7 +369,7 @@ var VitalsMenuButton = GObject.registerClass({ this._drawMenu(); this._sensors.resetHistory(); - this._values.resetHistory(); + this._values.resetHistory(this._numGpus); this._querySensors(); } @@ -370,7 +417,8 @@ var VitalsMenuButton = GObject.registerClass({ } } } - + if(key === "_gpu#1_domain_number_") + console.error('UPDATING: ', key); // have we added this sensor before? let item = this._sensorMenuItems[key]; if (item) { @@ -394,7 +442,7 @@ var VitalsMenuButton = GObject.registerClass({ let split = sensor.type.split('-'); let type = split[0]; let icon = (split.length == 2)?'icon-' + split[1]:'icon'; - let gicon = Gio.icon_new_for_string(this._extensionObject.path + '/icons/' + this._sensorIcons[type][icon]); + let gicon = Gio.icon_new_for_string(this._sensorIconPath(type, icon)); let item = new MenuItem.MenuItem(gicon, key, sensor.label, sensor.value, this._hotLabels[key]); item.connect('toggle', (self) => { @@ -460,17 +508,28 @@ var VitalsMenuButton = GObject.registerClass({ }); // second condition prevents crash due to issue #225, which started when _max_ was moved to the end - if (type == 'default' || !(type in this._sensorIcons)) { - icon.gicon = Gio.icon_new_for_string(this._extensionObject.path + '/icons/' + this._sensorIcons['system']['icon']); + // don't use the default system icon if the type is a gpu; use the universal gpu icon instead + if (type == 'default' || (!(type in this._sensorIcons) && !type.startsWith('gpu'))) { + icon.gicon = Gio.icon_new_for_string(this._sensorIconPath('system')); } else if (!this._settings.get_boolean('hide-icons')) { // support for hide icons #80 let iconObj = (split.length == 2)?'icon-' + split[1]:'icon'; - icon.gicon = Gio.icon_new_for_string(this._extensionObject.path + '/icons/' + this._sensorIcons[type][iconObj]); + icon.gicon = Gio.icon_new_for_string(this._sensorIconPath(type, iconObj)); } return icon; } + _sensorIconPath(sensor, icon = 'icon') { + // If the sensor is a numbered gpu, use the gpu icon. Otherwise use whatever icon associated with the sensor name. + let sensorKey = sensor; + if(sensor.startsWith('gpu')) sensorKey = 'gpu'; + + const iconPathPrefixIndex = this._settings.get_int('icon-style'); + return this._extensionObject.path + this._sensorsIconPathPrefix[iconPathPrefixIndex] + this._sensorIcons[sensorKey][icon]; + } + _ucFirst(string) { + if(string.startsWith('gpu')) return 'Graphics'; return string.charAt(0).toUpperCase() + string.slice(1); } @@ -524,7 +583,8 @@ var VitalsMenuButton = GObject.registerClass({ this._last_query = now; this._sensors.query((label, value, type, format) => { - let key = '_' + type.replace('-group', '') + '_' + label.replace(' ', '_').toLowerCase() + '_'; + const typeKey = type.replace('-group', ''); + let key = '_' + typeKey + '_' + label.replace(' ', '_').toLowerCase() + '_'; // if a sensor is disabled, gray it out if (key in this._sensorMenuItems) { @@ -534,11 +594,39 @@ var VitalsMenuButton = GObject.registerClass({ if (value == 'disabled') return; } + // add/initialize any gpu groups that we haven't added yet + if(typeKey.startsWith('gpu') && typeKey !== 'gpu#1') { + const split = typeKey.split('#'); + if(split.length == 2 && this._numGpus < parseInt(split[1])) { + // occasionally two lines from nvidia-smi will be read at once + // so we only actually update the number of gpus if we have recieved multiple lines at least 3 times in a row + // i.e. we make sure that mutiple queries have detected a new gpu back-to-back + if(this._newGpuDetectedCount < 2) { + this._newGpuDetected = true; + return; + } + + this._numGpus = parseInt(split[1]); + this._newGpuDetectedCount = 0; + this._newGpuDetected = false; + // change label for gpu 1 from "Graphics" to "Graphics 1" since we have multiple gpus now + this._groups['gpu#1'].label.text = this._ucFirst('gpu#1') + ' 1'; + for(let i = 2; i <= this._numGpus; i++) + if(!('gpu#' + i in this._groups)) + this._initializeMenuGroup('gpu#' + i, 'gpu', ' ' + i, Object.keys(this._groups).length); + } + } + let items = this._values.returnIfDifferent(dwell, label, value, type, format, key); for (let item of Object.values(items)) this._updateDisplay(_(item[0]), item[1], item[2], item[3]); }, dwell); + //if a new gpu has been detected during the last query, then increment the amount of times we've detected a new gpu + if(this._newGpuDetected) this._newGpuDetectedCount++; + else this._newGpuDetectedCount = 0; + this._newGpuDetected = false; + if (this._warnings.length > 0) { this._notify('Vitals', this._warnings.join("\n"), 'folder-symbolic'); this._warnings = []; @@ -555,6 +643,7 @@ var VitalsMenuButton = GObject.registerClass({ destroy() { this._destroyTimer(); + this._sensors.destroy(); for (let signal of Object.values(this._settingChangedSignals)) this._settings.disconnect(signal); diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/helpers/subprocess.js b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/helpers/subprocess.js new file mode 100644 index 0000000..df0bf49 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/helpers/subprocess.js @@ -0,0 +1,54 @@ +import GLib from 'gi://GLib'; +import Gio from 'gi://Gio'; + +// convert Uint8Array into a literal string +function convertUint8ArrayToString(contents) { + const decoder = new TextDecoder('utf-8'); + return decoder.decode(contents).trim(); +} + +export function SubProcess(command) { + this.sub_process = Gio.Subprocess.new(command, Gio.SubprocessFlags.STDOUT_PIPE); + this.stdout = this.sub_process.get_stdout_pipe(); +} + +SubProcess.prototype.read = function(delimiter = '') { + return new Promise((resolve, reject) => { + this.stdout.read_bytes_async(512, GLib.PRIORITY_LOW, null, function(stdout, res) { + try { + let read_bytes = stdout.read_bytes_finish(res).get_data(); + + // convert contents to string + let read_str = convertUint8ArrayToString(read_bytes); + + // split read_str by delimiter if passed in + if (delimiter) { + if (read_str == '') + read_str = []; // EOF, ''.split(delimiter) would return [''] + else + read_str = read_str.split(delimiter); + } + + // return results + resolve(read_str); + } catch (e) { + if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.PENDING)) { + // previous read attempt is still waiting for something from stdout + // ignore second attempt, return empty data (like EOF) + if (delimiter) resolve([]); + else resolve(''); + } else { + reject(e.message); + } + } + }); + }); +}; + +SubProcess.prototype.terminate = function() { + const SIGINT = 2; + this.sub_process.send_signal(SIGINT); + this.sub_process = null; + this.stdout.close_async(GLib.PRIORITY_LOW, null, null); + this.stdout = null; +}; diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/battery-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/battery-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/battery-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/battery-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/cpu-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/cpu-symbolic.svg new file mode 100644 index 0000000..86ca8bf --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/cpu-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/fan-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/fan-symbolic.svg new file mode 100644 index 0000000..ea2b44f --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/fan-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/gpu-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/gpu-symbolic.svg new file mode 100644 index 0000000..d5cf157 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/gpu-symbolic.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/memory-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/memory-symbolic.svg new file mode 100644 index 0000000..1946901 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/memory-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/network-download-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/network-download-symbolic.svg new file mode 100644 index 0000000..4fc170b --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/network-download-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/network-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/network-symbolic.svg new file mode 100644 index 0000000..2ff9778 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/network-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/network-upload-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/network-upload-symbolic.svg new file mode 100644 index 0000000..0d67f65 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/network-upload-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/storage-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/storage-symbolic.svg new file mode 100644 index 0000000..30d9007 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/storage-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/system-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/system-symbolic.svg new file mode 100644 index 0000000..bfbf1bd --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/system-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/temperature-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/temperature-symbolic.svg new file mode 100644 index 0000000..e00a2eb --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/temperature-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/voltage-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/voltage-symbolic.svg new file mode 100644 index 0000000..1aa2210 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/gnome/voltage-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/battery-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/battery-symbolic.svg new file mode 100644 index 0000000..70df9ee --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/battery-symbolic.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/cpu-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/cpu-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/cpu-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/cpu-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/fan-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/fan-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/fan-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/fan-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/gpu-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/gpu-symbolic.svg new file mode 100644 index 0000000..d5cf157 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/gpu-symbolic.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/memory-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/memory-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/memory-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/memory-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/network-download-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/network-download-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/network-download-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/network-download-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/network-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/network-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/network-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/network-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/network-upload-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/network-upload-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/network-upload-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/network-upload-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/storage-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/storage-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/storage-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/storage-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/system-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/system-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/system-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/system-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/temperature-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/temperature-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/temperature-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/temperature-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/voltage-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/voltage-symbolic.svg similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/voltage-symbolic.svg rename to gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/icons/original/voltage-symbolic.svg diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/be/LC_MESSAGES/vitals.mo b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/be/LC_MESSAGES/vitals.mo new file mode 100644 index 0000000..1001254 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/be/LC_MESSAGES/vitals.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/de/LC_MESSAGES/vitals.mo b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/de/LC_MESSAGES/vitals.mo index fdc9849..f374b84 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/de/LC_MESSAGES/vitals.mo and b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/de/LC_MESSAGES/vitals.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/pt_BR/LC_MESSAGES/vitals.mo b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/pt_BR/LC_MESSAGES/vitals.mo index ddcca6d..986cf6d 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/pt_BR/LC_MESSAGES/vitals.mo and b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/pt_BR/LC_MESSAGES/vitals.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/menuItem.js b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/menuItem.js index 47a60fb..cf112ab 100644 --- a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/menuItem.js +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/menuItem.js @@ -21,18 +21,18 @@ export const MenuItem = GObject.registerClass({ this._gIcon = icon; // add icon - this.add(new St.Icon({ style_class: 'popup-menu-icon', gicon : this._gIcon })); + this.add_child(new St.Icon({ style_class: 'popup-menu-icon', gicon : this._gIcon })); // add label this._labelActor = new St.Label({ text: label }); - this.add(this._labelActor); + this.add_child(this._labelActor); // add value this._valueLabel = new St.Label({ text: value }); this._valueLabel.set_x_align(Clutter.ActorAlign.END); this._valueLabel.set_x_expand(true); this._valueLabel.set_y_expand(true); - this.add(this._valueLabel); + this.add_child(this._valueLabel); this.actor._delegate = this; } diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/metadata.json b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/metadata.json index 400c547..4c78f3a 100644 --- a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/metadata.json @@ -1,13 +1,17 @@ { "_generated": "Generated by SweetTooth, do not edit", "description": "A glimpse into your computer's temperature, voltage, fan speed, memory usage, processor load, system resources, network speed and storage stats. This is a one stop shop to monitor all of your vital sensors. Uses asynchronous polling to provide a smooth user experience. Feature requests or bugs? Please use GitHub.", + "donations": { + "paypal": "corecoding" + }, "gettext-domain": "vitals", "name": "Vitals", "settings-schema": "org.gnome.shell.extensions.vitals", "shell-version": [ - "45" + "45", + "46" ], "url": "https://github.com/corecoding/Vitals", "uuid": "Vitals@CoreCoding.com", - "version": 63 + "version": 66 } \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/prefs.js b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/prefs.js index 8cace02..07916bd 100644 --- a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/prefs.js +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/prefs.js @@ -48,7 +48,8 @@ const Settings = new GObject.Class({ 'show-network', 'show-storage', 'use-higher-precision', 'alphabetize', 'hide-zeros', 'include-public-ip', 'show-battery', 'fixed-widths', 'hide-icons', - 'menu-centered', 'include-static-info' ]; + 'menu-centered', 'include-static-info', + 'show-gpu', 'include-static-gpu-info' ]; for (let key in sensors) { let sensor = sensors[key]; @@ -61,7 +62,7 @@ const Settings = new GObject.Class({ } // process individual drop down sensor preferences - sensors = [ 'position-in-panel', 'unit', 'network-speed-format', 'memory-measurement', 'storage-measurement', 'battery-slot' ]; + sensors = [ 'position-in-panel', 'unit', 'network-speed-format', 'memory-measurement', 'storage-measurement', 'battery-slot', 'icon-style' ]; for (let key in sensors) { let sensor = sensors[key]; @@ -90,7 +91,7 @@ const Settings = new GObject.Class({ } // makes individual sensor preference boxes appear - sensors = [ 'temperature', 'network', 'storage', 'memory', 'battery', 'system', 'processor' ]; + sensors = [ 'temperature', 'network', 'storage', 'memory', 'battery', 'system', 'processor', 'gpu' ]; for (let key in sensors) { let sensor = sensors[key]; diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/prefs.ui b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/prefs.ui index 76d1473..ab07185 100644 --- a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/prefs.ui +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/prefs.ui @@ -45,6 +45,7 @@ end + 5
@@ -146,6 +147,7 @@ 0 start 5 + 5 Seconds between updates
@@ -170,6 +172,7 @@ 100 0 + 0 0 @@ -181,6 +184,7 @@ 0 start 5 + 5 Position in panel @@ -217,12 +221,14 @@ 0 start 5 + 5 Use higher precision end + 5
@@ -244,12 +250,14 @@ 0 start 5 + 5 Alphabetize sensors
end + 5
@@ -271,12 +279,14 @@ 0 start 5 + 5 Hide zero values
end + 5
@@ -298,12 +308,14 @@ 0 start 5 + 5 Use fixed widths
end + 5 @@ -325,12 +337,14 @@ 0 start 5 + 5 Hide icons in top bar end + 5 @@ -352,49 +366,55 @@ 0 start 5 + 5 Menu always centered end + 5 + + + + + + + + + 100 + 0 + 0 + + + 0 + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Icon style + + + + + 0 + 5 + 0 + + Original + GNOME + - - - - - - - - - - 0 - start - baseline - About - - - - - - - - 0 - - - 0 - start - baseline - 5 - Feature requests or bugs? Please visit <a href="https://github.com/corecoding/Vitals/issues">GitHub</a>. No warranty, expressed or implied. <a href="https://corecoding.com/donate.php">Donate</a> if you found this useful. - 1 - 1 - 0 @@ -427,423 +447,494 @@ 0 - - - 0 - - - 100 - 0 - - + + + 0 + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 0 - center - 6 - 6 - - - 1 - 0 - start - 5 - Monitor temperature - - - - - 0 - 6 - - - 1 - center - center - - - 0 - emblem-system-symbolic - - - - - - - - end - center - - - - + start + 5 + 5 + Monitor temperature - - - - - - 100 - 0 - + + 0 - center - 6 - 6 + 6 - - 1 - 0 - start - 5 - Monitor voltage + + 1 + center + center + + + 0 + emblem-system-symbolic + + + - + end + center + 5 - + - - - - 100 - 0 - - - 0 - center - 6 - 6 - - - 1 - 0 - start - 5 - Monitor fan - - - - - end - - - - - - - - - 100 - 0 - - - 0 - center - 6 - 6 - - - 1 - 0 - start - 5 - Monitor memory - - - - - 0 - 6 - - - 1 - center - center - - - 0 - emblem-system-symbolic - - - - - - - - end - center - - - - - - - - - - - 100 - 0 - - - 0 - center - 6 - 6 - - - 1 - 0 - start - 5 - Monitor processor - - - - - 0 - 6 - - - 1 - center - center - - - 0 - emblem-system-symbolic - - - - - - - - end - center - - - - - - - - - - - 100 - 0 - - - 0 - center - 6 - 6 - - - 1 - 0 - start - 5 - Monitor system - - - - - 0 - 6 - - - 1 - center - center - - - 0 - emblem-system-symbolic - - - - - - - - end - center - - - - - - - - - - - 100 - 0 - - - 0 - center - 6 - 6 - - - 1 - 0 - start - 5 - Monitor network - - - - - 0 - 6 - - - 1 - center - center - - - 0 - emblem-system-symbolic - - - - - - - - end - center - - - - - - - - - - - 100 - 0 - - - 0 - center - 6 - 6 - - - 1 - 0 - start - 5 - Monitor storage - - - - - 0 - 6 - - - 1 - center - center - - - 0 - emblem-system-symbolic - - - - - - - - end - center - - - - - - - - - - - 100 - 0 - - - 0 - center - 6 - 6 - - - 1 - 0 - start - 5 - Monitor battery - - - - - 0 - 6 - - - 1 - center - center - - - 0 - emblem-system-symbolic - - - - - - - - end - center - - - - - - - - + + + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Monitor voltage + + + + + end + 5 + + + + + + + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Monitor fan + + + + + end + 5 + + + + + + + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Monitor memory + + + + + 0 + 6 + + + 1 + center + center + + + 0 + emblem-system-symbolic + + + + + + + + end + center + 5 + + + + + + + + + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Monitor processor + + + + + 0 + 6 + + + 1 + center + center + + + 0 + emblem-system-symbolic + + + + + + + + end + center + 5 + + + + + + + + + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Monitor system + + + + + 0 + 6 + + + 1 + center + center + + + 0 + emblem-system-symbolic + + + + + + + + end + center + 5 + + + + + + + + + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Monitor network + + + + + 0 + 6 + + + 1 + center + center + + + 0 + emblem-system-symbolic + + + + + + + + end + center + 5 + + + + + + + + + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Monitor storage + + + + + 0 + 6 + + + 1 + center + center + + + 0 + emblem-system-symbolic + + + + + + + + end + center + 5 + + + + + + + + + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Monitor battery + + + + + 0 + 6 + + + 1 + center + center + + + 0 + emblem-system-symbolic + + + + + + + + end + center + 5 + + + + + + + + + + + 100 + 0 + + + 0 + center + 6 + 6 + + + 1 + 0 + start + 5 + 5 + Monitor gpu (beta; NVIDIA only) + + + + + 0 + 6 + + + 1 + center + center + + + 0 + emblem-system-symbolic + + + + + + + + end + center + 5 + + + + + + + + + @@ -854,6 +945,44 @@ + + + start + 0 + 12 + 9 + 12 + About + + + + + + + + 0 + 6 + 6 + + + 0 + start + baseline + 5 + 5 + 5 + 5 + Feature requests or bugs? Please visit <a href="https://github.com/corecoding/Vitals/issues">GitHub</a>. No warranty, expressed or implied. <a href="https://corecoding.com/donate.php">Donate</a> if you found this useful. + 1 + 1 + 0 + + + + + + + 1 @@ -1197,6 +1326,57 @@ end + 5 + + + + + + + + + + + + + 0 + 12 + 12 + 6 + 6 + vertical + + + 0 + + + 0 + none + + + 100 + 1 + 0 + + + 0 + 6 + 6 + 6 + 6 + 12 + + + 1 + 0 + start + Include static GPU info + + + + + end + 5 diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/schemas/gschemas.compiled b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/schemas/gschemas.compiled index 7f4d0c0..936fdb3 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/schemas/gschemas.compiled and b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/schemas/gschemas.compiled differ diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/schemas/org.gnome.shell.extensions.vitals.gschema.xml b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/schemas/org.gnome.shell.extensions.vitals.gschema.xml index 71e4935..7a0decd 100644 --- a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/schemas/org.gnome.shell.extensions.vitals.gschema.xml +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/schemas/org.gnome.shell.extensions.vitals.gschema.xml @@ -136,5 +136,20 @@ Include processor static information Display processor static information that doesn't change + + false + Monitor GPU + Display GPU information (requires the nvidia-smi tool) + + + false + Include GPU static information + Display GPU static information that doesn't change + + + 0 + Icon styles + Set the style for the displayed sensor icons ('original', 'updated') + diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/sensors.js b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/sensors.js index 39d175a..2ba8c2e 100644 --- a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/sensors.js +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/sensors.js @@ -25,6 +25,7 @@ */ import GObject from 'gi://GObject'; +import * as SubProcessModule from './helpers/subprocess.js'; import * as FileModule from './helpers/file.js'; import { gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; import NM from 'gi://NM'; @@ -48,6 +49,15 @@ export const Sensors = GObject.registerClass({ this._last_processor = { 'core': {}, 'speed': [] }; + this._settingChangedSignals = []; + this._addSettingChangedSignal('show-gpu', this._reconfigureNvidiaSmiProcess.bind(this)); + this._addSettingChangedSignal('update-time', this._reconfigureNvidiaSmiProcess.bind(this)); + //this._addSettingChangedSignal('include-static-gpu-info', this._reconfigureNvidiaSmiProcess.bind(this)); + + this._nvidia_smi_process = null; + this._nvidia_labels = []; + this._bad_split_count = 0; + if (hasGTop) { this.storage = new GTop.glibtop_fsusage(); this._storageDevice = ''; @@ -58,6 +68,10 @@ export const Sensors = GObject.registerClass({ } } + _addSettingChangedSignal(key, callback) { + this._settingChangedSignals.push(this._settings.connect('changed::' + key, callback)); + } + _refreshIPAddress(callback) { // check IP address new FileModule.File('https://corecoding.com/vitals.php').read().then(contents => { @@ -473,6 +487,166 @@ export const Sensors = GObject.registerClass({ }).catch(err => { }); } + _queryGpu(callback) { + if (!this._nvidia_smi_process) { + this._disableGpuLabels(callback); + return; + } + + this._nvidia_smi_process.read('\n').then(lines => { + /// for debugging multi-gpu on systems with only one gpu + /// duplicates the first gpu's data 3 times, for 4 total gpus + ///if(lines.length == 0) return; + ///for(let _gpuNum = 1; _gpuNum <= 3; _gpuNum++) + /// lines.push(lines[0]); + + for (let i = 0; i < lines.length; i++) { + this._parseNvidiaSmiLine(callback, lines[i], i + 1, lines.length > 1); + } + + + // if we've already updated the static info during the last parse, then stop doing so. + // this is so the _parseNvidiaSmiLine function won't return static info anymore + // and the nvidia-smi commmand won't be queried for static info either + if(!this._nvidia_static_returned) { + this._nvidia_static_returned = true; + //reconfigure the process to stop querying static info + this._reconfigureNvidiaSmiProcess(); + } + }).catch(err => { + this._disableGpuLabels(callback); + this._terminateNvidiaSmiProcess(); + }); + } + + _parseNvidiaSmiLine(callback, csv, gpuNum, multiGpu) { + const expectedSplitLength = 19; + let csv_split = csv.split(','); + + // occasionally the nvidia-smi command can get cut off before it can be fully read, thus the parse function only gets part of a line + // hence we count the number of bad splits and only terminate the process after a few bad splits in a row + // this prevents anomalous readings from terminating the process + if (csv_split.length < expectedSplitLength) { + this._bad_split_count++; + //if we've had 2 bad splits/reads in a row, try to restart the process + if (this._bad_split_count == 2) this._reconfigureNvidiaSmiProcess(); + //if we still get a bad read after that, then it's not an anomaly; terminate the process + else if (this._bad_split_count >= 3) this._terminateNvidiaSmiProcess(); + return; + } + this._bad_split_count = 0; + + let [ + label, + fan_speed_pct, + temp_gpu, temp_mem, + mem_total, mem_used, mem_reserved, mem_free, + util_gpu, util_mem, util_encoder, util_decoder, + clock_gpu, clock_mem, clock_encode_decode, + power, power_avg, + link_gen_current, link_width_current + ] = csv_split; + + const staticNames = [ + 'temp_limit', 'power_limit', + 'link_gen_max', 'link_width_max', + 'addressing_mode', + 'driver_version', 'vbios', 'serial', + 'domain_num', 'bus_num', 'device_num', 'device_id', 'sub_device_id' + ]; + let staticInfo = {}; + + // if we have queried static info this time around, populate our static info object + if(csv_split.length == (expectedSplitLength + staticNames.length)){ + for(let i = 0; i < staticNames.length; i++) { + //set the static info to a default (0) if it's undefined + const value = csv_split[expectedSplitLength + i]; + staticInfo[staticNames[i]] = (typeof value !== "undefined") ? value : 0; + } + } + + + const typeName = 'gpu#' + gpuNum; + const globalLabel = 'GPU' + (multiGpu ? ' ' + gpuNum : ''); + + const memTempValid = !isNaN(parseInt(temp_mem)); + + + this._returnGpuValue(callback, 'Graphics', parseInt(util_gpu) * 0.01, typeName + '-group', 'percent'); + + this._returnGpuValue(callback, 'Name', label, typeName, ''); + + this._returnGpuValue(callback, globalLabel, parseInt(fan_speed_pct) * 0.01, 'fan', 'percent'); + this._returnGpuValue(callback, 'Fan', parseInt(fan_speed_pct) * 0.01, typeName, 'percent'); + + this._returnGpuValue(callback, globalLabel, parseInt(temp_gpu) * 1000, 'temperature', 'temp'); + this._returnGpuValue(callback, 'Temperature', parseInt(temp_gpu) * 1000, typeName, 'temp'); + this._returnGpuValue(callback, 'Memory Temperature', parseInt(temp_mem) * 1000, typeName, 'temp', memTempValid); + this._returnStaticGpuValue(callback, 'Temperature Limit', parseInt(staticInfo['temp_limit']) * 1000, typeName, 'temp'); + + this._returnGpuValue(callback, 'Memory Usage', parseInt(mem_used) / parseInt(mem_total), typeName, 'percent'); + this._returnGpuValue(callback, 'Memory Total', parseInt(mem_total) * 1000, typeName, 'memory'); + this._returnGpuValue(callback, 'Memory Used', parseInt(mem_used) * 1000, typeName, 'memory'); + this._returnGpuValue(callback, 'Memory Reserved', parseInt(mem_reserved) * 1000, typeName, 'memory'); + this._returnGpuValue(callback, 'Memory Free', parseInt(mem_free) * 1000, typeName, 'memory'); + + this._returnGpuValue(callback, 'Memory Utilization', parseInt(util_mem) * 0.01, typeName, 'percent'); + this._returnGpuValue(callback, 'Utilization', parseInt(util_gpu) * 0.01, typeName, 'percent'); + this._returnGpuValue(callback, 'Encoder Utilization', parseInt(util_encoder) * 0.01, typeName, 'percent'); + this._returnGpuValue(callback, 'Decoder Utilization', parseInt(util_decoder) * 0.01, typeName, 'percent'); + + this._returnGpuValue(callback, 'Frequency', parseInt(clock_gpu) * 1000 * 1000, typeName, 'hertz'); + this._returnGpuValue(callback, 'Memory Frequency', parseInt(clock_mem) * 1000 * 1000, typeName, 'hertz'); + this._returnGpuValue(callback, 'Encoder/Decoder Frequency', parseInt(clock_encode_decode) * 1000 * 1000, typeName, 'hertz'); + + //this._returnGpuValue(callback, 'Encoder Sessions', parseInt(encoder_sessions), typeName, 'string'); + + this._returnGpuValue(callback, 'Power', power, typeName, 'watt-gpu'); + this._returnGpuValue(callback, 'Average Power', power_avg, typeName, 'watt-gpu'); + this._returnStaticGpuValue(callback, 'Power Limit', parseInt(staticInfo['power_limit']), typeName, 'watt-gpu'); + + this._returnGpuValue(callback, 'Link Speed', link_gen_current + 'x' + link_width_current, typeName, 'pcie'); + this._returnStaticGpuValue(callback, 'Maximum Link Speed', staticInfo['link_gen_max'] + 'x' + staticInfo['link_width_max'], typeName, 'pcie'); + + this._returnStaticGpuValue(callback, 'Addressing Mode', staticInfo['addressing_mode'], typeName, 'string'); + + this._returnStaticGpuValue(callback, 'Driver Version', staticInfo['driver_version'], typeName, 'string'); + this._returnStaticGpuValue(callback, 'vBIOS Version', staticInfo['vbios'], typeName, 'string'); + this._returnStaticGpuValue(callback, 'Serial Number', staticInfo['serial'], typeName, 'string'); + + this._returnStaticGpuValue(callback, 'Domain Number', staticInfo['domain_num'], typeName, 'string'); + this._returnStaticGpuValue(callback, 'Bus Number', staticInfo['bus_num'], typeName, 'string'); + this._returnStaticGpuValue(callback, 'Device Number', staticInfo['device_num'], typeName, 'string'); + this._returnStaticGpuValue(callback, 'Device ID', staticInfo['device_id'], typeName, 'string'); + this._returnStaticGpuValue(callback, 'Sub Device ID', staticInfo['sub_device_id'], typeName, 'string'); + } + + _disableGpuLabels(callback) { + for (let labelObj of this._nvidia_labels) + this._returnValue(callback, labelObj.label, 'disabled', labelObj.type, labelObj.format); + } + + _returnStaticGpuValue(callback, label, value, type, format) { + //if we've already tried to return existing static info before or if the option isn't enabled, then do nothing. + if (this._nvidia_static_returned || !this._settings.get_boolean('include-static-gpu-info')) + return; + + //we don't need to disable static info labels, so just use ordinary returnValue function + this._returnValue(callback, label, value, type, format); + } + + _returnGpuValue(callback, label, value, type, format, display = true) { + if(!display) return; + + if(value === 'N/A' || value === '[N/A]' || isNaN(value)) return; + + let nvidiaLabel = {'label': label, 'type': type, 'format': format}; + if (!this._nvidia_labels.includes(nvidiaLabel)) + this._nvidia_labels.push(nvidiaLabel); + + this._returnValue(callback, label, value, type, format); + } + _returnValue(callback, label, value, type, format) { // don't return if value is not a number - will revisit later //if (isNaN(value)) return; @@ -564,6 +738,74 @@ export const Sensors = GObject.registerClass({ this._returnValue(callback, 'Kernel', kernelArray[2], 'system', 'string'); }).catch(err => { }); } + + // Launch nvidia-smi subprocess if nvidia querying is enabled + this._reconfigureNvidiaSmiProcess(); + } + + // The nvidia-smi subprocess will keep running and print new sensor data to stdout every + // `update_time` seconds. _queryNvidiaSmi() will be called at roughly the same interval and + // read from the subprocess's stdout to get new sensor data. + + // Regarding "keeping main process & sub process in sync", there are two possible scenarios: + // - For some reason, nvidia-smi prints at a somewhat higher frequency than we call + // _queryNvidiaSmi() to read data. This is okay, eventually one call to _queryNvidiaSmi() + // will read two sensor data updates in a single call. + // - For some reason, _queryNvidiaSmi() is called at a somewhat higher frequency than + // nvidia-smi prints data. This is the more likely scenario with user actions triggering + // additional reads. This eventually triggers an "IO PENDING" error while attempting to + // read, because the previous async read is still waiting. To solve this, the subprocess + // module simply ignores PENDING errors. After ignoring the error, the earlier read will + // eventually return and sensor data will be updated, so this scenario is handled correctly. + + // Generally speaking, the call to _queryNvidiaSmi() and nvidia-smi's printing to stdout do + // not happen at the same time. So the async call in _queryNvidiaSmi() will usually have to + // wait up to `update_time` seconds before getting any results and reporting them through the + // callback. + _reconfigureNvidiaSmiProcess() { + if (this._settings.get_boolean('show-gpu')) { + this._terminateNvidiaSmiProcess(); + + try { + let update_time = this._settings.get_int('update-time'); + let query_interval = Math.max(update_time, 1); + let command = [ + 'nvidia-smi', + '--query-gpu=name,' + + 'fan.speed,' + + 'temperature.gpu,temperature.memory,' + + 'memory.total,memory.used,memory.reserved,memory.free,' + + 'utilization.gpu,utilization.memory,utilization.encoder,utilization.decoder,' + + 'clocks.gr,clocks.mem,clocks.video,' + + 'power.draw.instant,power.draw.average,' + + 'pcie.link.gen.gpucurrent,pcie.link.width.current,' + + (!this._nvidia_static_returned && this._settings.get_boolean('include-static-gpu-info') ? + 'temperature.gpu.tlimit,' + + 'power.limit,' + + 'pcie.link.gen.max,pcie.link.width.max,' + + 'addressing_mode,'+ + 'driver_version,vbios_version,serial,' + + 'pci.domain,pci.bus,pci.device,pci.device_id,pci.sub_device_id,' + : ''), + '--format=csv,noheader,nounits', + '-l', query_interval.toString() + ]; + + this._nvidia_smi_process = new SubProcessModule.SubProcess(command); + } catch(e) { + // proprietary nvidia driver not installed + this._terminateNvidiaSmiProcess(); + } + } else { + this._terminateNvidiaSmiProcess(); + } + } + + _terminateNvidiaSmiProcess() { + if (this._nvidia_smi_process) { + this._nvidia_smi_process.terminate(); + this._nvidia_smi_process = null; + } } _processTempVoltFan(callback, sensor_types, name, path, file) { @@ -664,8 +906,18 @@ export const Sensors = GObject.registerClass({ resetHistory() { this._next_public_ip_check = 0; this._hardware_detected = false; + this._nvidia_static_returned = false; this._processor_uses_cpu_info = true; this._battery_time_left_history = []; this._battery_charge_status = ''; + this._nvidia_labels = []; + this._bad_split_count = 0; + } + + destroy() { + this._terminateNvidiaSmiProcess(); + + for (let signal of Object.values(this._settingChangedSignals)) + this._settings.disconnect(signal); } }); diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/values.js b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/values.js index 77c47f1..a7cabb0 100644 --- a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/values.js +++ b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/values.js @@ -190,6 +190,10 @@ export const Values = GObject.registerClass({ value = value / 1000000; ending = 'W'; break; + case 'watt-gpu': + format = (use_higher_precision)?'%.2f %s':'%.1f %s'; + ending = 'W'; + break; case 'watt-hour': format = (use_higher_precision)?'%.2f %s':'%.1f %s'; value = value / 1000000; @@ -198,6 +202,11 @@ export const Values = GObject.registerClass({ case 'load': format = (use_higher_precision)?'%.2f %s':'%.1f %s'; break; + case 'pcie': + let split = value.split('x'); + value = 'PCIe ' + parseInt(split[0]) + (split.length > 1 ? ' x' + parseInt(split[1]) : ''); + format = '%s'; + break; default: format = '%s'; break; @@ -324,14 +333,22 @@ export const Values = GObject.registerClass({ return output; } - resetHistory() { + resetHistory(numGpus) { // don't call this._history = {}, as we want to keep network-rx and network-tx // otherwise network history statistics will start over for (let sensor in this._sensorIcons) { + //each gpu has it's own sensor name and thus must be handled separately + if(sensor === 'gpu') continue; + this._history[sensor] = {}; this._history[sensor + '-group'] = {}; //this._history2[sensor] = {}; //this._history2[sensor + '-group'] = {}; } + + for(let i = 1; i <= numGpus; i++){ + this._history['gpu#' + i] = {}; + this._history['gpu#' + i + '-group'] = {}; + } } }); diff --git a/gnome/.local/share/gnome-shell/extensions/auto-activities@CleoMenezesJr.github.io/metadata.json b/gnome/.local/share/gnome-shell/extensions/auto-activities@CleoMenezesJr.github.io/metadata.json index c57a2f7..230b379 100644 --- a/gnome/.local/share/gnome-shell/extensions/auto-activities@CleoMenezesJr.github.io/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/auto-activities@CleoMenezesJr.github.io/metadata.json @@ -11,9 +11,11 @@ "original-author": "mi-jan-sena@proton.me", "settings-schema": "org.gnome.shell.extensions.auto-activities", "shell-version": [ - "45" + "45", + "46" ], "url": "https://github.com/CleoMenezesJr/auto-activities", "uuid": "auto-activities@CleoMenezesJr.github.io", - "version": 12 + "version": 13, + "version-name": "46.1" } \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/block-caribou-36@lxylxy123456.ercli.dev/extension.js b/gnome/.local/share/gnome-shell/extensions/block-caribou-36@lxylxy123456.ercli.dev/extension.js deleted file mode 100644 index fb9e0f9..0000000 --- a/gnome/.local/share/gnome-shell/extensions/block-caribou-36@lxylxy123456.ercli.dev/extension.js +++ /dev/null @@ -1,28 +0,0 @@ -import * as KeyboardUI from 'resource:///org/gnome/shell/ui/keyboard.js'; - -function _modifiedLastDeviceIsTouchscreen() { - return false; -} - -export default class BlockCaribou { - constructor() { - this._originalLastDeviceIsTouchscreen = null; - } - - enable() { - this._originalLastDeviceIsTouchscreen = KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen; - KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen = _modifiedLastDeviceIsTouchscreen; - } - - /* - * In the lock screen, the on-screen keyboard (Caribou) also pops up by - * default. So this extension requires the "unlock-dialog" session mode to - * block Caribou in lock screen. - */ - disable() { - if (this._originalLastDeviceIsTouchscreen !== null) { - KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen = this._originalLastDeviceIsTouchscreen; - this._originalLastDeviceIsTouchscreen = null; - } - } -} diff --git a/gnome/.local/share/gnome-shell/extensions/block-caribou-36@lxylxy123456.ercli.dev/metadata.json b/gnome/.local/share/gnome-shell/extensions/block-caribou-36@lxylxy123456.ercli.dev/metadata.json deleted file mode 100644 index 730bd6a..0000000 --- a/gnome/.local/share/gnome-shell/extensions/block-caribou-36@lxylxy123456.ercli.dev/metadata.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "_generated": "Generated by SweetTooth, do not edit", - "description": "Blocks caribou (the on screen keyboard) from popping up when you use a touchscreen. Even if it's disabled in the accessibility services menu. Continuation of keringar's work. Tested on GNOME Shell version 3.36 - 45 on Fedora 32 - 39. For a higher version see https://github.com/lxylxy123456/cariboublocker#installing-on-high-gnome-shell-version .", - "name": "Block Caribou 36", - "session-modes": [ - "unlock-dialog", - "user" - ], - "shell-version": [ - "45" - ], - "url": "https://github.com/lxylxy123456/cariboublocker", - "uuid": "block-caribou-36@lxylxy123456.ercli.dev", - "version": 10 -} \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/appfolders.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/appfolders.js index cabce01..d16f32b 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/appfolders.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/appfolders.js @@ -37,11 +37,11 @@ let _zoomAndFadeIn = function () { let blur_effect = this.get_effect("appfolder-blur"); - blur_effect.sigma = 0; + blur_effect.radius = 0; blur_effect.brightness = 1.0; Tweener.addTween(blur_effect, { - sigma: sigma, + radius: sigma * 2, brightness: brightness, time: FOLDER_DIALOG_ANIMATION_TIME / 1000, transition: 'easeOutQuad' @@ -85,7 +85,7 @@ let _zoomAndFadeOut = function () { let blur_effect = this.get_effect("appfolder-blur"); Tweener.addTween(blur_effect, { - sigma: 0, + radius: 0, brightness: 1.0, time: FOLDER_DIALOG_ANIMATION_TIME / 1000, transition: 'easeInQuad' @@ -165,7 +165,7 @@ export const AppFoldersBlur = class AppFoldersBlur { let blur_effect = new Shell.BlurEffect({ name: "appfolder-blur", - sigma: sigma, + radius: sigma * 2, brightness: brightness, mode: Shell.BlurMode.BACKGROUND }); diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/applications.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/applications.js index 8334473..1a454ca 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/applications.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/applications.js @@ -1,18 +1,20 @@ import Shell from 'gi://Shell'; import Clutter from 'gi://Clutter'; import Meta from 'gi://Meta'; +import Gio from 'gi://Gio'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import { PaintSignals } from '../effects/paint_signals.js'; import { ApplicationsService } from '../dbus/services.js'; - export const ApplicationsBlur = class ApplicationsBlur { constructor(connections, settings, _) { this.connections = connections; this.settings = settings; this.paint_signals = new PaintSignals(connections); + this.mutter_gsettings = new Gio.Settings({ schema: 'org.gnome.mutter' }); + // stores every blurred window this.window_map = new Map(); // stores every blur actor @@ -67,14 +69,11 @@ export const ApplicationsBlur = class ApplicationsBlur { this.connections.connect( Main.overview, 'hidden', _ => { - let active_workspace = - global.workspace_manager.get_active_workspace(); - this.window_map.forEach((meta_window, _pid) => { let window_actor = meta_window.get_compositor_private(); if ( - meta_window.get_workspace() !== active_workspace + !meta_window.get_workspace().active ) window_actor.hide(); }); @@ -325,7 +324,7 @@ export const ApplicationsBlur = class ApplicationsBlur { /// Add the blur effect to the window. create_blur_effect(pid, window_actor, meta_window, brightness, sigma) { let blur_effect = new Shell.BlurEffect({ - sigma: sigma, + radius: sigma * 2, brightness: brightness, mode: Shell.BlurMode.BACKGROUND }); @@ -420,13 +419,15 @@ export const ApplicationsBlur = class ApplicationsBlur { } /// Compute the size and position for a blur actor. - /// On wayland, it seems like we need to divide by the scale to get the - /// correct result. + /// If `scale-monitor-framebuffer` experimental feature if on, we don't need to manage scaling. + /// Else, on wayland, we need to divide by the scale to get the correct result. compute_allocation(meta_window) { + const scale_monitor_framebuffer = this.mutter_gsettings.get_strv('experimental-features') + .includes('scale-monitor-framebuffer'); const is_wayland = Meta.is_wayland_compositor(); const monitor_index = meta_window.get_monitor(); // check if the window is using wayland, or xwayland/xorg for rendering - const scale = is_wayland && meta_window.get_client_type() == 0 + const scale = !scale_monitor_framebuffer && is_wayland && meta_window.get_client_type() == 0 ? Main.layoutManager.monitors[monitor_index].geometry_scale : 1; @@ -464,7 +465,7 @@ export const ApplicationsBlur = class ApplicationsBlur { /// Updates the blur effect by overwriting its sigma and brightness values. update_blur_effect(blur_actor, brightness, sigma) { let effect = blur_actor.get_effect('blur-effect'); - effect.sigma = sigma; + effect.radius = sigma * 2; effect.brightness = brightness; } @@ -500,6 +501,7 @@ export const ApplicationsBlur = class ApplicationsBlur { this._log("removing blur from applications..."); this.service?.unexport(); + delete this.mutter_gsettings; this.blur_actor_map.forEach(((_blur_actor, pid) => { this.remove_blur(pid); @@ -545,4 +547,4 @@ export const ApplicationsBlur = class ApplicationsBlur { if (this.settings.DEBUG) console.log(`[Blur my Shell > applications] ${str}`); } -}; \ No newline at end of file +}; diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/dash_to_dock.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/dash_to_dock.js index 3c56588..7d84c23 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/dash_to_dock.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/dash_to_dock.js @@ -1,9 +1,12 @@ import St from 'gi://St'; import Shell from 'gi://Shell'; +import Meta from 'gi://Meta'; +import Mtk from 'gi://Mtk'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; const Signals = imports.signals; import { PaintSignals } from '../effects/paint_signals.js'; +import { BlurEffect } from '../effects/blur_effect.js'; const DASH_STYLES = [ "transparent-dash", @@ -12,72 +15,191 @@ const DASH_STYLES = [ ]; +// An helper function to find the monitor in which an actor is situated, +/// there might be a pre-existing function in GLib already +function find_monitor_for(actor) { + let extents = actor.get_transformed_extents(); + let rect = new Mtk.Rectangle({ + x: extents.get_x(), + y: extents.get_y(), + width: extents.get_width(), + height: extents.get_height(), + }); + + let index = global.display.get_monitor_index_for_rect(rect); + + return Main.layoutManager.monitors[index]; +} + + /// This type of object is created for every dash found, and talks to the main /// DashBlur thanks to signals. /// /// This allows to dynamically track the created dashes for each screen. class DashInfos { - constructor(dash_blur, dash, background_parent, effect, settings) { + constructor(dash_blur, dash, dash_container, dash_background, background, background_parent, effect) { // the parent DashBlur object, to communicate this.dash_blur = dash_blur; + this.dash_container = dash_container; // the blurred dash this.dash = dash; + this.dash_background = dash_background; this.background_parent = background_parent; + this.background = background; this.effect = effect; - this.settings = settings; + this.settings = dash_blur.settings; this.old_style = this.dash._background.style; dash_blur.connections.connect(dash_blur, 'remove-dashes', () => { this._log("removing blur from dash"); this.dash.get_parent().remove_child(this.background_parent); - this.dash._background.style = this.old_style; - - DASH_STYLES.forEach( - style => this.dash.remove_style_class_name(style) - ); + this.remove_style(); }); dash_blur.connections.connect(dash_blur, 'update-sigma', () => { - this.effect.sigma = this.dash_blur.sigma; + if (this.dash_blur.is_static) { + this.dash_blur.update_size(); + } + this.effect.radius = 2 * this.dash_blur.sigma * this.effect.scale; }); dash_blur.connections.connect(dash_blur, 'update-brightness', () => { this.effect.brightness = this.dash_blur.brightness; }); - dash_blur.connections.connect(dash_blur, 'override-background', () => { - this.dash._background.style = null; + dash_blur.connections.connect(dash_blur, 'update-corner-radius', () => { + if (this.dash_blur.is_static) { + let monitor = find_monitor_for(this.dash); + let corner_radius = this.dash_blur.corner_radius * monitor.geometry_scale; + this.effect.corner_radius = Math.min( + corner_radius, this.effect.width / 2, this.effect.height / 2 + ); + } + }); - DASH_STYLES.forEach( - style => this.dash.remove_style_class_name(style) - ); + dash_blur.connections.connect(dash_blur, 'override-background', () => { + this.remove_style(); this.dash.set_style_class_name( DASH_STYLES[this.settings.dash_to_dock.STYLE_DASH_TO_DOCK] ); }); - dash_blur.connections.connect(dash_blur, 'reset-background', () => { - this.dash._background.style = this.old_style; - - DASH_STYLES.forEach( - style => this.dash.remove_style_class_name(style) - ); - }); + dash_blur.connections.connect(dash_blur, 'reset-background', () => this.remove_style()); dash_blur.connections.connect(dash_blur, 'show', () => { - this.effect.sigma = this.dash_blur.sigma; + if (this.dash_blur.is_static) + this.background_parent.show(); + else + this.effect.radius = this.dash_blur.sigma * 2 * this.effect.scale; }); dash_blur.connections.connect(dash_blur, 'hide', () => { - this.effect.sigma = 0; + if (this.dash_blur.is_static) + this.background_parent.hide(); + else + this.effect.radius = 0; }); + + dash_blur.connections.connect(dash_blur, 'update-wallpaper', () => { + if (this.dash_blur.is_static) { + let bg = Main.layoutManager._backgroundGroup.get_child_at_index( + Main.layoutManager.monitors.length + - find_monitor_for(this.dash).index - 1 + ); + if (bg && bg.get_content()) { + this.background.content.set({ + background: bg.get_content().background + }); + this._log('wallpaper updated'); + } else { + this._warn("could not get background for dash-to-dock"); + } + } + }); + + dash_blur.connections.connect(dash_blur, 'update-size', () => { + if (this.dash_blur.is_static) { + let [x, y] = this.get_dash_position(this.dash_container, this.dash_background); + + this.background.x = -x; + this.background.y = -y; + + this.effect.width = this.dash_background.width; + this.effect.height = this.dash_background.height; + + this.dash_blur.set_corner_radius(this.dash_blur.corner_radius); + + if (dash_container.get_style_class_name().includes("top")) { + this.background.set_clip(x, y + this.dash.y + this.dash_background.y, this.dash_background.width, this.dash_background.height); + } else if (dash_container.get_style_class_name().includes("bottom")) { + this.background.set_clip(x, y + this.dash.y + this.dash_background.y, this.dash_background.width, this.dash_background.height); + } else if (dash_container.get_style_class_name().includes("left")) { + this.background.set_clip(x + this.dash.x + this.dash_background.x, y + this.dash.y + this.dash_background.y, this.dash_background.width, this.dash_background.height); + } else if (dash_container.get_style_class_name().includes("right")) { + this.background.set_clip(x + this.dash.x + this.dash_background.x, y + this.dash.y + this.dash_background.y, this.dash_background.width, this.dash_background.height); + } + } else { + this.background.width = this.dash_background.width; + this.background.height = this.dash_background.height; + + this.background.x = this.dash_background.x; + this.background.y = this.dash_background.y + this.dash.y; + } + }); + + dash_blur.connections.connect(dash_blur, 'change-blur-type', () => { + this.background_parent.remove_child(this.background); + if (this.effect.chained_effect) + this.effect.get_actor()?.remove_effect(this.effect.chained_effect); + this.effect.get_actor()?.remove_effect(this.effect); + + let [background, effect] = this.dash_blur.add_blur(this.dash, this.dash_background, this.dash_container); + this.background = background; + this.effect = effect; + this.background_parent.add_child(this.background); + }); + } + + remove_style() { + this.dash._background.style = this.old_style; + + DASH_STYLES.forEach( + style => this.dash.remove_style_class_name(style) + ); + } + + get_dash_position(dash_container, dash_background) { + var x, y; + + let monitor = find_monitor_for(dash_container); + let dash_box = dash_container._slider.get_child(); + + if (dash_container.get_style_class_name().includes("top")) { + x = (monitor.width - dash_background.width) / 2; + y = dash_box.y; + } else if (dash_container.get_style_class_name().includes("bottom")) { + x = (monitor.width - dash_background.width) / 2; + y = monitor.height - dash_container.height; + } else if (dash_container.get_style_class_name().includes("left")) { + x = dash_box.x; + y = dash_container.y + (dash_container.height - dash_background.height) / 2 - dash_background.y; + } else if (dash_container.get_style_class_name().includes("right")) { + x = monitor.width - dash_container.width; + y = dash_container.y + (dash_container.height - dash_background.height) / 2 - dash_background.y; + } + + return [x, y]; } _log(str) { if (this.settings.DEBUG) console.log(`[Blur my Shell > dash] ${str}`); } + + _warn(str) { + console.warn(`[Blur my Shell > dash] ${str}`); + } } export const DashBlur = class DashBlur { @@ -92,11 +214,13 @@ export const DashBlur = class DashBlur { this.brightness = this.settings.dash_to_dock.CUSTOMIZE ? this.settings.dash_to_dock.BRIGHTNESS : this.settings.BRIGHTNESS; + this.corner_radius = this.settings.dash_to_dock.CORNER_RADIUS; + this.is_static = this.settings.dash_to_dock.STATIC_BLUR; this.enabled = false; } enable() { - this.connections.connect(Main.uiGroup, 'actor-added', (_, actor) => { + this.connections.connect(Main.uiGroup, 'child-added', (_, actor) => { if ( (actor.get_name() === "dashtodockContainer") && (actor.constructor.name === 'DashToDock') @@ -107,6 +231,9 @@ export const DashBlur = class DashBlur { this.blur_existing_dashes(); this.connect_to_overview(); + this.update_wallpaper(); + this.update_size(); + this.enabled = true; } @@ -143,13 +270,6 @@ export const DashBlur = class DashBlur { // Blurs the dash and returns a `DashInfos` containing its information blur_dash_from(dash, dash_container) { - // the effect to be applied - let effect = new Shell.BlurEffect({ - brightness: this.brightness, - sigma: this.sigma, - mode: Shell.BlurMode.BACKGROUND - }); - // dash background parent, not visible let background_parent = new St.Widget({ name: 'dash-blurred-background-parent', @@ -158,92 +278,50 @@ export const DashBlur = class DashBlur { height: 0 }); - // dash background widget - let background = new St.Widget({ - name: 'dash-blurred-background', - style_class: 'dash-blurred-background', - x: 0, - y: dash_container._slider.y, - width: dash.width, - height: dash.height, + // finally blur the dash + let dash_background = dash.get_children().find(child => { + return child.get_style_class_name() === 'dash-background'; }); + let [background, effect] = this.add_blur(dash, dash_background, dash_container); + + this.update_wallpaper(); + this.update_size(); + // updates size and position on change - this.connections.connect(dash_container._slider, 'notify::y', _ => { - background.y = dash_container._slider.y; - }); this.connections.connect(dash, 'notify::width', _ => { - background.width = dash.width; + this.update_size(); }); this.connections.connect(dash, 'notify::height', _ => { - background.height = dash.height; + this.update_size(); + }); + this.connections.connect(dash_container, 'notify::width', _ => { + this.update_size(); + }); + this.connections.connect(dash_container, 'notify::height', _ => { + this.update_size(); + }); + this.connections.connect(dash_container, 'notify::y', _ => { + this.update_wallpaper(); + this.update_size(); + }); + this.connections.connect(dash_container, 'notify::x', _ => { + this.update_wallpaper(); + this.update_size(); }); - // add the widget to the dash - background.add_effect(effect); background_parent.add_child(background); dash.get_parent().insert_child_at_index(background_parent, 0); - // HACK - // - //`Shell.BlurEffect` does not repaint when shadows are under it. [1] - // - // This does not entirely fix this bug (shadows caused by windows - // still cause artifacts), but it prevents the shadows of the panel - // buttons to cause artifacts on the panel itself - // - // [1]: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2857 - - if (this.settings.HACKS_LEVEL === 1) { - this._log("dash hack level 1"); - this.paint_signals.disconnect_all(); - - let rp = () => { - effect.queue_repaint(); - }; - - dash._box.get_children().forEach((icon) => { - try { - let zone = icon.get_child_at_index(0); - - this.connections.connect(zone, [ - 'enter-event', 'leave-event', 'button-press-event' - ], rp); - } catch (e) { - this._warn(`${e}, continuing`); - } - }); - - this.connections.connect(dash._box, 'actor-added', (_, actor) => { - try { - let zone = actor.get_child_at_index(0); - - this.connections.connect(zone, [ - 'enter-event', 'leave-event', 'button-press-event' - ], rp); - } catch (e) { - this._warn(`${e}, continuing`); - } - }); - - let show_apps = dash._showAppsIcon; - - this.connections.connect(show_apps, [ - 'enter-event', 'leave-event', 'button-press-event' - ], rp); - - this.connections.connect(dash, 'leave-event', rp); - } else if (this.settings.HACKS_LEVEL === 2) { - this._log("dash hack level 2"); - - this.paint_signals.connect(background, effect); - } else { - this.paint_signals.disconnect_all(); - } - // create infos let infos = new DashInfos( - this, dash, background_parent, effect, this.settings + this, + dash, + dash_container, + dash_background, + background, + background_parent, + effect ); // update the background @@ -253,6 +331,128 @@ export const DashBlur = class DashBlur { return infos; } + add_blur(dash, dash_background, dash_container) { + let monitor = find_monitor_for(dash); + + // dash background widget + let background = this.is_static + ? new Meta.BackgroundActor({ + meta_display: global.display, + monitor: monitor.index, + }) + : new St.Widget({ + name: 'dash-blurred-background', + style_class: 'dash-blurred-background', + x: dash_background.x, + y: dash_background.y + dash.y, + width: dash_background.width, + height: dash_background.height, + }); + + // the effect to be applied + let effect; + if (this.is_static) { + let corner_radius = this.corner_radius * monitor.geometry_scale; + corner_radius = Math.min(corner_radius, dash_background.width / 2, dash_background.height / 2); + + effect = new BlurEffect({ + radius: 2 * this.sigma * monitor.geometry_scale, + brightness: this.brightness, + width: dash_background.width, + height: dash_background.height, + corner_radius: corner_radius + }); + + // connect to every background change (even without changing image) + // FIXME this signal is fired very often, so we should find another one + // fired only when necessary (but that still catches all cases) + this.connections.connect( + Main.layoutManager._backgroundGroup, + 'notify', + _ => this.update_wallpaper() + ); + } else { + effect = new Shell.BlurEffect({ + brightness: this.brightness, + radius: this.sigma * 2 * monitor.geometry_scale, + mode: Shell.BlurMode.BACKGROUND + }); + + // HACK + // + //`Shell.BlurEffect` does not repaint when shadows are under it. [1] + // + // This does not entirely fix this bug (shadows caused by windows + // still cause artifacts), but it prevents the shadows of the panel + // buttons to cause artifacts on the panel itself + // + // [1]: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2857 + + if (this.settings.HACKS_LEVEL === 1) { + this._log("dash hack level 1"); + this.paint_signals.disconnect_all(); + + let rp = () => { + effect.queue_repaint(); + }; + + dash._box.get_children().forEach((icon) => { + try { + let zone = icon.get_child_at_index(0); + + this.connections.connect(zone, [ + 'enter-event', 'leave-event', 'button-press-event' + ], rp); + } catch (e) { + this._warn(`${e}, continuing`); + } + }); + + this.connections.connect(dash._box, 'actor-added', (_, actor) => { + try { + let zone = actor.get_child_at_index(0); + + this.connections.connect(zone, [ + 'enter-event', 'leave-event', 'button-press-event' + ], rp); + } catch (e) { + this._warn(`${e}, continuing`); + } + }); + + let show_apps = dash._showAppsIcon; + + this.connections.connect(show_apps, [ + 'enter-event', 'leave-event', 'button-press-event' + ], rp); + + this.connections.connect(dash, 'leave-event', rp); + } else if (this.settings.HACKS_LEVEL === 2) { + this._log("dash hack level 2"); + + this.paint_signals.connect(background, effect); + } else { + this.paint_signals.disconnect_all(); + } + } + + // store the scale in the effect in order to retrieve it in set_sigma + effect.scale = monitor.geometry_scale; + + background.add_effect(effect); + + return [background, effect]; + } + + change_blur_type() { + this.is_static = this.settings.dash_to_dock.STATIC_BLUR; + this.emit('change-blur-type', true); + + this.update_wallpaper(); + this.update_background(); + this.update_size(); + } + /// Connect when overview if opened/closed to hide/show the blur accordingly connect_to_overview() { this.connections.disconnect_all_for(Main.overview); @@ -276,6 +476,15 @@ export const DashBlur = class DashBlur { this.emit('reset-background', true); } + update_wallpaper() { + if (this.is_static) + this.emit('update-wallpaper', true); + } + + update_size() { + this.emit('update-size', true); + } + set_sigma(sigma) { this.sigma = sigma; this.emit('update-sigma', true); @@ -286,6 +495,11 @@ export const DashBlur = class DashBlur { this.emit('update-brightness', true); } + set_corner_radius(radius) { + this.corner_radius = radius; + this.emit('update-corner-radius', true); + } + // not implemented for dynamic blur set_color(c) { } set_noise_amount(n) { } diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/lockscreen.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/lockscreen.js index bd10908..00895ea 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/lockscreen.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/lockscreen.js @@ -21,6 +21,7 @@ export const LockscreenBlur = class LockscreenBlur { this.connections = connections; this.settings = settings; this.effects_manager = effects_manager; + this.enabled = false; } enable() { @@ -43,6 +44,8 @@ export const LockscreenBlur = class LockscreenBlur { : this.settings.NOISE_LIGHTNESS; this.update_lockscreen(); + + this.enabled = true; } update_lockscreen() { @@ -64,7 +67,7 @@ export const LockscreenBlur = class LockscreenBlur { let blur_effect = new Shell.BlurEffect({ name: 'blur', - sigma: sigma, + radius: sigma * 2, brightness: brightness }); @@ -118,7 +121,7 @@ export const LockscreenBlur = class LockscreenBlur { if (blur_effect) { blur_effect.set({ brightness: brightness, - sigma: sigma * blur_effect.scale, + radius: sigma * 2 * blur_effect.scale, }); } } @@ -158,6 +161,8 @@ export const LockscreenBlur = class LockscreenBlur { original_updateBackgroundEffects; this.connections.disconnect_all(); + + this.enabled = false; } _log(str) { diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/overview.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/overview.js index 3e04ac4..d612370 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/overview.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/overview.js @@ -160,6 +160,7 @@ export const OverviewBlur = class OverviewBlur { create_background_actor(monitor, is_transition) { let bg_actor = new Meta.BackgroundActor({ + name: "blur-my-shell_background_actor", meta_display: global.display, monitor: monitor.index }); @@ -184,10 +185,9 @@ export const OverviewBlur = class OverviewBlur { brightness: this.settings.overview.CUSTOMIZE ? this.settings.overview.BRIGHTNESS : this.settings.BRIGHTNESS, - sigma: this.settings.overview.CUSTOMIZE + radius: (this.settings.overview.CUSTOMIZE ? this.settings.overview.SIGMA - : this.settings.SIGMA - * monitor.geometry_scale, + : this.settings.SIGMA) * 2 * monitor.geometry_scale, mode: Shell.BlurMode.ACTOR }); @@ -235,7 +235,7 @@ export const OverviewBlur = class OverviewBlur { set_sigma(s) { this.effects.forEach(effect => { - effect.blur_effect.sigma = s * effect.blur_effect.scale; + effect.blur_effect.radius = s * 2 * effect.blur_effect.scale; }); } @@ -264,13 +264,15 @@ export const OverviewBlur = class OverviewBlur { } remove_background_actors() { - Main.layoutManager.overviewGroup.get_children().forEach(actor => { - if (actor.constructor.name === 'Meta_BackgroundActor') { - actor.get_effects().forEach(effect => { + Main.layoutManager.overviewGroup.get_children().forEach(child => { + if (child instanceof Meta.BackgroundActor + && child.get_name() == "blur-my-shell_background_actor" + ) { + child.get_effects().forEach(effect => { this.effects_manager.remove(effect); }); - Main.layoutManager.overviewGroup.remove_child(actor); - actor.destroy(); + Main.layoutManager.overviewGroup.remove_child(child); + child.destroy(); } }); this.effects = []; diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/panel.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/panel.js index a904f92..d1d3edb 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/panel.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/panel.js @@ -53,6 +53,9 @@ export const PanelBlur = class PanelBlur { // the blur when a window is near a panel this.connect_to_windows_and_overview(); + // update the classname if the panel to have or have not light text + this.update_light_text_classname(); + // connect to every background change (even without changing image) // FIXME this signal is fired very often, so we should find another one // fired only when necessary (but that still catches all cases) @@ -167,10 +170,9 @@ export const PanelBlur = class PanelBlur { brightness: this.settings.panel.CUSTOMIZE ? this.settings.panel.BRIGHTNESS : this.settings.BRIGHTNESS, - sigma: this.settings.panel.CUSTOMIZE + radius: (this.settings.panel.CUSTOMIZE ? this.settings.panel.SIGMA - : this.settings.SIGMA - * monitor.geometry_scale, + : this.settings.SIGMA) * 2 * monitor.geometry_scale, mode: this.settings.panel.STATIC_BLUR ? Shell.BlurMode.ACTOR : Shell.BlurMode.BACKGROUND @@ -317,7 +319,7 @@ export const PanelBlur = class PanelBlur { Main.layoutManager.monitors.length - this.find_monitor_for(actors.widgets.panel).index - 1 ); - if (bg) + if (bg && bg.get_content()) actors.widgets.background.content.set({ background: bg.get_content().background }); @@ -408,6 +410,9 @@ export const PanelBlur = class PanelBlur { this.connections.connect( appDisplay, 'hide', this.show.bind(this) ); + this.connections.connect( + Main.overview, 'hidden', this.show.bind(this) + ); } } @@ -436,10 +441,10 @@ export const PanelBlur = class PanelBlur { } // manage windows at their creation/removal - this.connections.connect(global.window_group, 'actor-added', + this.connections.connect(global.window_group, 'child-added', this.on_window_actor_added.bind(this) ); - this.connections.connect(global.window_group, 'actor-removed', + this.connections.connect(global.window_group, 'child-removed', this.on_window_actor_removed.bind(this) ); @@ -487,6 +492,14 @@ export const PanelBlur = class PanelBlur { this.window_signal_ids = new Map(); } + /// Update the css classname of the panel for light theme + update_light_text_classname(disable = false) { + if (this.settings.panel.FORCE_LIGHT_TEXT && !disable) + Main.panel.add_style_class_name("panel-light-text"); + else + Main.panel.remove_style_class_name("panel-light-text"); + } + /// Callback when a new window is added on_window_actor_added(container, meta_window_actor) { this.window_signal_ids.set(meta_window_actor, [ @@ -532,6 +545,7 @@ export const PanelBlur = class PanelBlur { && meta_window.get_window_type() !== Meta.WindowType.DESKTOP // exclude Desktop Icons NG && meta_window.get_gtk_application_id() !== "com.rastersoft.ding" + && meta_window.get_gtk_application_id() !== "com.desktop.ding" ); // check if at least one window is near enough to each panel and act @@ -590,7 +604,7 @@ export const PanelBlur = class PanelBlur { /// enabling/disabling other effects. invalidate_blur(actors) { if (this.settings.panel.STATIC_BLUR && actors.widgets.background) - actors.widgets.background.get_content().invalidate(); + actors.widgets.background.get_content()?.invalidate(); } invalidate_all_blur() { @@ -599,7 +613,7 @@ export const PanelBlur = class PanelBlur { set_sigma(s) { this.actors_list.forEach(actors => { - actors.effects.blur.sigma = s * actors.effects.blur.scale; + actors.effects.blur.radius = s * 2 * actors.effects.blur.scale; this.invalidate_blur(actors); }); } @@ -662,6 +676,8 @@ export const PanelBlur = class PanelBlur { this.disconnect_from_windows_and_overview(); + this.update_light_text_classname(true); + this.actors_list.forEach(actors => { this.set_should_override_panel(actors, false); this.effects_manager.remove(actors.effects.noise); diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/screenshot.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/screenshot.js index 34bb3c4..8241f0c 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/screenshot.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/screenshot.js @@ -82,10 +82,9 @@ export const ScreenshotBlur = class ScreenshotBlur { brightness: this.settings.screenshot.CUSTOMIZE ? this.settings.screenshot.BRIGHTNESS : this.settings.BRIGHTNESS, - sigma: this.settings.screenshot.CUSTOMIZE + radius: (this.settings.screenshot.CUSTOMIZE ? this.settings.screenshot.SIGMA - : this.settings.SIGMA - * monitor.geometry_scale, + : this.settings.SIGMA) * 2 * monitor.geometry_scale, mode: Shell.BlurMode.ACTOR }); @@ -117,7 +116,7 @@ export const ScreenshotBlur = class ScreenshotBlur { set_sigma(s) { this.effects.forEach(effect => { - effect.blur_effect.sigma = s * effect.blur_effect; + effect.blur_effect.radius = s * 2 * effect.blur_effect; }); } @@ -150,6 +149,7 @@ export const ScreenshotBlur = class ScreenshotBlur { if (actor._blur_actor) { actor.remove_child(actor._blur_actor); actor._blur_actor.destroy(); + delete actor._blur_actor; } }); this.effects = []; diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/window_list.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/window_list.js index 6a60564..2ba50b4 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/window_list.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/window_list.js @@ -24,7 +24,7 @@ export const WindowListBlur = class WindowListBlur { // if is window-list this.connections.connect( Main.layoutManager.uiGroup, - 'actor-added', + 'child-added', (_, child) => this.try_blur(child) ); @@ -46,9 +46,9 @@ export const WindowListBlur = class WindowListBlur { let blur_effect = new Shell.BlurEffect({ name: 'window-list-blur', - sigma: this.settings.window_list.CUSTOMIZE - ? this.settings.window_list.SIGMA - : this.settings.SIGMA, + radius: (this.settings.window_list.CUSTOMIZE + ? this.settings.window_list.SIGMA + : this.settings.SIGMA) * 2, brightness: this.settings.window_list.CUSTOMIZE ? this.settings.window_list.BRIGHTNESS : this.settings.BRIGHTNESS, @@ -65,7 +65,7 @@ export const WindowListBlur = class WindowListBlur { this.connections.connect( child._windowList, - 'actor-added', + 'child-added', (_, window) => this.blur_window_button(window) ); @@ -117,7 +117,7 @@ export const WindowListBlur = class WindowListBlur { set_sigma(s) { this.effects.forEach(effect => { - effect.blur_effect.sigma = s; + effect.blur_effect.radius = s * 2; }); } diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/conveniences/keys.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/conveniences/keys.js index 5a87ba4..71a357c 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/conveniences/keys.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/conveniences/keys.js @@ -49,6 +49,7 @@ export const Keys = [ { type: Type.D, name: "noise-lightness" }, { type: Type.B, name: "static-blur" }, { type: Type.B, name: "unblur-in-overview" }, + { type: Type.B, name: "force-light-text" }, { type: Type.B, name: "override-background" }, { type: Type.I, name: "style-panel" }, { type: Type.B, name: "override-background-dynamically" }, @@ -67,6 +68,7 @@ export const Keys = [ { type: Type.B, name: "unblur-in-overview" }, { type: Type.B, name: "override-background" }, { type: Type.I, name: "style-dash-to-dock" }, + { type: Type.I, name: "corner-radius" }, ] }, { diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/dbus/services.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/dbus/services.js index 9b566c2..4b1f4f0 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/dbus/services.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/dbus/services.js @@ -65,6 +65,9 @@ export const ApplicationsService = class ApplicationsService { if (type_str.includes('MetaSurfaceActor')) actor = target.get_parent(); + if (!actor.toString().includes('WindowActor')) + actor = actor.get_parent(); + if (!actor.toString().includes('WindowActor')) return send_picked_signal('window-not-found'); diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/blur_effect.glsl b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/blur_effect.glsl new file mode 100644 index 0000000..37059ae --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/blur_effect.glsl @@ -0,0 +1,114 @@ +uniform sampler2D tex; +uniform float sigma; +uniform int dir; +uniform float brightness; +uniform float corner_radius; +uniform float width; +uniform float height; + +float circleBounds(vec2 p, vec2 center, float clip_radius) { + vec2 delta = p - center; + float dist_squared = dot(delta, delta); + + float outer_radius = clip_radius + 0.5; + if (dist_squared >= (outer_radius * outer_radius)) + return 0.0; + + float inner_radius = clip_radius - 0.5; + if (dist_squared <= (inner_radius * inner_radius)) + return 1.0; + + return outer_radius - sqrt(dist_squared); +} + +vec4 shapeCorner(vec4 pixel, vec2 p, vec2 center, float clip_radius) { + float alpha = circleBounds(p, center, clip_radius); + return vec4(pixel.rgb * alpha, min(alpha, pixel.a)); +} + +vec4 getTexture(vec2 uv) { + if (uv.x < 2. / width) + uv.x = 2. / width; + + if (uv.y < 2. / height) + uv.y = 2. / height; + + if (uv.x > 1. - 3. / width) + uv.x = 1. - 3. / width; + + if (uv.y > 1. - 3. / height) + uv.y = 1. - 3. / height; + + return texture2D(tex, uv); +} + +void main(void) { + vec2 uv = cogl_tex_coord_in[0].xy; + + vec2 pos = uv * vec2(width, height); + + vec2 direction = vec2(dir, (1.0 - dir)); + + float pixel_step; + if (dir == 0) + pixel_step = 1.0 / height; + else + pixel_step = 1.0 / width; + + vec3 gauss_coefficient; + gauss_coefficient.x = 1.0 / (sqrt(2.0 * 3.14159265) * sigma); + gauss_coefficient.y = exp(-0.5 / (sigma * sigma)); + gauss_coefficient.z = gauss_coefficient.y * gauss_coefficient.y; + + float gauss_coefficient_total = gauss_coefficient.x; + + vec4 ret = getTexture(uv) * gauss_coefficient.x; + gauss_coefficient.xy *= gauss_coefficient.yz; + + int n_steps = int(ceil(1.5 * sigma)) * 2; + + for (int i = 1; i <= n_steps; i += 2) { + float coefficient_subtotal = gauss_coefficient.x; + gauss_coefficient.xy *= gauss_coefficient.yz; + coefficient_subtotal += gauss_coefficient.x; + + float gauss_ratio = gauss_coefficient.x / coefficient_subtotal; + + float foffset = float(i) + gauss_ratio; + vec2 offset = direction * foffset * pixel_step; + + ret += getTexture(uv + offset) * coefficient_subtotal; + ret += getTexture(uv - offset) * coefficient_subtotal; + + gauss_coefficient_total += 2.0 * coefficient_subtotal; + gauss_coefficient.xy *= gauss_coefficient.yz; + } + vec4 outColor = ret / gauss_coefficient_total; + + // apply brightness and rounding on the second pass (dir==0 comes last) + if (dir == 0) { + // left side + if (pos.x < corner_radius) { + // top left corner + if (pos.y < corner_radius) { + outColor = shapeCorner(outColor, pos, vec2(corner_radius + 2., corner_radius + 2.), corner_radius); + // bottom left corner + } else if (pos.y > height - corner_radius) { + outColor = shapeCorner(outColor, pos, vec2(corner_radius + 2., height - corner_radius - 1.), corner_radius); + } + // right side + } else if (pos.x > width - corner_radius) { + // top right corner + if (pos.y < corner_radius) { + outColor = shapeCorner(outColor, pos, vec2(width - corner_radius - 1., corner_radius + 2.), corner_radius); + // bottom right corner + } else if (pos.y > height - corner_radius) { + outColor = shapeCorner(outColor, pos, vec2(width - corner_radius - 1., height - corner_radius - 1.), corner_radius); + } + } + + outColor.rgb *= brightness; + } + + cogl_color_out = outColor; +} \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/blur_effect.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/blur_effect.js new file mode 100644 index 0000000..71d28d0 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/blur_effect.js @@ -0,0 +1,236 @@ +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; +import Clutter from 'gi://Clutter'; +import Shell from 'gi://Shell'; + +const SHADER_PATH = GLib.filename_from_uri(GLib.uri_resolve_relative(import.meta.url, 'blur_effect.glsl', GLib.UriFlags.NONE))[0]; + + +const get_shader_source = _ => { + try { + return Shell.get_file_contents_utf8_sync(SHADER_PATH); + } catch (e) { + console.warn(`[Blur my Shell] error loading shader from ${SHADER_PATH}: ${e}`); + return null; + } +}; + +export const BlurEffect = new GObject.registerClass({ + GTypeName: "BlurEffect", + Properties: { + 'radius': GObject.ParamSpec.double( + `radius`, + `Radius`, + `Blur radius`, + GObject.ParamFlags.READWRITE, + 0.0, 2000.0, + 200.0, + ), + 'brightness': GObject.ParamSpec.double( + `brightness`, + `Brightness`, + `Blur brightness`, + GObject.ParamFlags.READWRITE, + 0.0, 1.0, + 0.6, + ), + 'width': GObject.ParamSpec.double( + `width`, + `Width`, + `Width`, + GObject.ParamFlags.READWRITE, + 0.0, Number.MAX_SAFE_INTEGER, + 0.0, + ), + 'height': GObject.ParamSpec.double( + `height`, + `Height`, + `Height`, + GObject.ParamFlags.READWRITE, + 0.0, Number.MAX_SAFE_INTEGER, + 0.0, + ), + 'corner_radius': GObject.ParamSpec.double( + `corner_radius`, + `Corner Radius`, + `Corner Radius`, + GObject.ParamFlags.READWRITE, + 0, Number.MAX_SAFE_INTEGER, + 0, + ), + 'direction': GObject.ParamSpec.int( + `direction`, + `Direction`, + `Direction`, + GObject.ParamFlags.READWRITE, + 0, 1, + 0, + ), + 'chained_effect': GObject.ParamSpec.object( + `chained_effect`, + `Chained Effect`, + `Chained Effect`, + GObject.ParamFlags.READABLE, + GObject.Object, + ), + } +}, class BlurEffect extends Clutter.ShaderEffect { + constructor(params, settings) { + super(params); + + this._sigma = null; + this._brightness = null; + this._width = null; + this._height = null; + this._corner_radius = null; + + this._static = true; + this._settings = settings; + + this._direction = 0; + + this._chained_effect = null; + + if (params.sigma) + this.sigma = params.sigma; + if (params.brightness) + this.brightness = params.brightness; + if (params.width) + this.width = params.width; + if (params.height) + this.height = params.height; + if (params.corner_radius) + this.corner_radius = params.corner_radius; + if (params.direction) + this.direction = params.direction; + + // set shader source + this._source = get_shader_source(); + if (this._source) + this.set_shader_source(this._source); + } + + get radius() { + return this._radius; + } + + set radius(value) { + if (this._radius !== value) { + this._radius = value; + + // like Clutter, we use the assumption radius = 2*sigma + this.set_uniform_value('sigma', parseFloat(this._radius / 2 - 1e-6)); + + if (this._chained_effect) { + this._chained_effect.radius = value; + } + } + } + + get brightness() { + return this._brightness; + } + + set brightness(value) { + if (this._brightness !== value) { + this._brightness = value; + + this.set_uniform_value('brightness', parseFloat(this._brightness - 1e-6)); + + if (this._chained_effect) { + this._chained_effect.brightness = value; + } + } + } + + get width() { + return this._width; + } + + set width(value) { + if (this._width !== value) { + this._width = value; + + this.set_uniform_value('width', parseFloat(this._width + 3.0 - 1e-6)); + + if (this._chained_effect) { + this._chained_effect.width = value; + } + } + } + + get height() { + return this._height; + } + + set height(value) { + if (this._height !== value) { + this._height = value; + + this.set_uniform_value('height', parseFloat(this._height + 3.0 - 1e-6)); + + if (this._chained_effect) { + this._chained_effect.height = value; + } + } + } + + get corner_radius() { + return this._corner_radius; + } + + set corner_radius(value) { + if (this._corner_radius !== value) { + this._corner_radius = value; + + this.set_uniform_value('corner_radius', parseFloat(this._corner_radius - 1e-6)); + + if (this._chained_effect) { + this._chained_effect.corner_radius = value; + } + } + } + + get direction() { + return this._direction; + } + + set direction(value) { + if (this._direction !== value) { + this._direction = value; + } + } + + get chained_effect() { + return this._chained_effect; + } + + vfunc_set_actor(actor) { + super.vfunc_set_actor(actor); + + if (this._direction == 0) { + this._chained_effect = new BlurEffect({ + radius: this.radius, + brightness: this.brightness, + width: this.width, + height: this.height, + corner_radius: this.corner_radius, + direction: 1 + }); + if (actor !== null) + actor.add_effect(this._chained_effect); + } + } + + vfunc_paint_target(paint_node = null, paint_context = null) { + this.set_uniform_value("tex", 0); + this.set_uniform_value("dir", this._direction); + + if (paint_node && paint_context) + super.vfunc_paint_target(paint_node, paint_context); + else if (paint_node) + super.vfunc_paint_target(paint_node); + else + super.vfunc_paint_target(); + } +}); \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/extension.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/extension.js index 5aa7b9f..cd65616 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/extension.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/extension.js @@ -28,7 +28,7 @@ const INDEPENDENT_COMPONENTS = [ /// The main extension class, created when the GNOME Shell is loaded. export default class BlurMyShell extends Extension { - /// Enables the extension + /// Enables the extension. enable() { // add the extension to global to make it accessible to other extensions // create it first as it is very useful when debugging crashes @@ -69,12 +69,30 @@ export default class BlurMyShell extends Extension { this._applications_blur = new ApplicationsBlur(...init()); this._screenshot_blur = new ScreenshotBlur(...init()); - // maybe disable clipped redraw - this._update_clipped_redraws(); - // connect each component to preferences change this._connect_to_settings(); + // enable the lockscreen blur, only one important in both `user` session and `unlock-dialog` + if (this._settings.lockscreen.BLUR && !this._lockscreen_blur.enabled) + this._lockscreen_blur.enable(); + + // ensure we take the correct action for the current session mode + this._user_session_mode_enabled = false; + this._on_session_mode_changed(Main.sessionMode); + + // watch for changes to the session mode + this._connection.connect(Main.sessionMode, 'updated', + _ => this._on_session_mode_changed(Main.sessionMode) + ); + } + + /// Enables the components related to the user session (everything except lockscreen blur). + _enable_user_session() { + this._log("changing mode to user session..."); + + // maybe disable clipped redraw + this._update_clipped_redraws(); + // enable every component // if the shell is still starting up, wait for it to be entirely loaded; // this should prevent bugs like #136 and #137 @@ -112,30 +130,44 @@ export default class BlurMyShell extends Extension { this._log("Could not enable panel blur directly"); this._log(e); } + + // tells the extension we have enabled the user session components, so that we do not + // disable them later if they were not even enabled to begin with + this._user_session_mode_enabled = true; } - /// Disables the extension + /// Disables the extension. + /// + /// This extension needs to use the 'unlock-dialog' session mode in order to change the blur on + /// the lockscreen. We have kind of two states of enablement for this extension: + /// - the 'enabled' state, which means that we have created the necessary components (which only + /// are js objects) and enabled the lockscreen blur (which means swapping two functions from + /// the `UnlockDialog` constructor with our ones; + /// - the 'user session enabled` mode, which means that we are in the 'enabled' mode AND we are + /// in the user mode, and so we enable all the other components that we created before. + /// We switch from one state to the other thanks to `this._on_session_mode_changed`, and we + /// track wether or not we are in the user mode with `this._user_session_mode_enabled` (because + /// `this._on_session_mode_changed` might be called multiple times while in the user session + /// mode, typically when going back from simple lockscreen and not sleep mode). disable() { this._log("disabling extension..."); - // disable every component - this._panel_blur.disable(); - this._dash_to_dock_blur.disable(); - this._overview_blur.disable(); + // disable every component from user session mode + if (this._user_session_mode_enabled) + this._disable_user_session(); + + // disable lockscreen blur too this._lockscreen_blur.disable(); - this._appfolder_blur.disable(); - this._window_list_blur.disable(); - this._applications_blur.disable(); - this._screenshot_blur.disable(); // untrack them this._panel_blur = null; this._dash_to_dock_blur = null; this._overview_blur = null; - this._lockscreen_blur = null; this._appfolder_blur = null; + this._lockscreen_blur = null; this._window_list_blur = null; this._applications_blur = null; + this._screenshot_blur = null; // make sure no settings change can re-enable them this._settings.disconnect_all_settings(); @@ -157,16 +189,52 @@ export default class BlurMyShell extends Extension { this._settings = null; } - /// Restart the extension. + /// Disables the components related to the user session (everything except lockscreen blur). + _disable_user_session() { + this._log("disabling user session mode..."); + + // disable every component except lockscreen blur + this._panel_blur.disable(); + this._dash_to_dock_blur.disable(); + this._overview_blur.disable(); + this._appfolder_blur.disable(); + this._window_list_blur.disable(); + this._applications_blur.disable(); + this._screenshot_blur.disable(); + + // remove the clipped redraws flag + this._reenable_clipped_redraws(); + + // tells the extension we have disabled the user session components, so that we do not + // disable them later again if they were already disabled + this._user_session_mode_enabled = false; + } + + /// Restarts the components related to the user session. _restart() { this._log("restarting..."); - this.disable(); - this.enable(); + this._disable_user_session(); + this._enable_user_session(); this._log("restarted."); } + /// Changes the extension to operate either on 'user' mode or 'unlock-dialog' mode, switching + /// from one to the other means enabling/disabling every component except lockscreen blur. + _on_session_mode_changed(session) { + if (session.currentMode === 'user' || session.parentMode === 'user') { + if (!this._user_session_mode_enabled) + // we need to activate everything + this._enable_user_session(); + } + else if (session.currentMode === 'unlock-dialog') { + if (this._user_session_mode_enabled) + // we need to disable the components related to the user session mode + this._disable_user_session(); + } + } + /// Add or remove the clutter debug flag to disable clipped redraws. /// This will entirely fix the blur effect, but should not be used except if /// the user really needs it, as clipped redraws are a huge performance @@ -192,7 +260,7 @@ export default class BlurMyShell extends Extension { ); } - /// Enables every component needed, should be called when the shell is + /// Enables every component from the user session needed, should be called when the shell is /// entirely loaded as the `enable` methods interact with it. _enable_components() { // enable each component if needed, and if it is not already enabled @@ -206,9 +274,6 @@ export default class BlurMyShell extends Extension { if (this._settings.overview.BLUR && !this._overview_blur.enabled) this._overview_blur.enable(); - if (this._settings.lockscreen.BLUR) - this._lockscreen_blur.enable(); - if (this._settings.appfolder.BLUR) this._appfolder_blur.enable(); @@ -328,6 +393,12 @@ export default class BlurMyShell extends Extension { this._panel_blur.connect_to_windows_and_overview(); }); + // force light text toggled on/off + this._settings.panel.FORCE_LIGHT_TEXT_changed(() => { + if (this._settings.panel.BLUR) + this._panel_blur.update_light_text_classname(); + }); + // panel override background toggled on/off this._settings.panel.OVERRIDE_BACKGROUND_changed(() => { if (this._settings.panel.BLUR) @@ -358,11 +429,16 @@ export default class BlurMyShell extends Extension { } }); - // TODO implement static blur for dash // static blur toggled on/off this._settings.dash_to_dock.STATIC_BLUR_changed(() => { - //if (this._settings.dash_to_dock.BLUR) - // this._dash_to_dock_blur.change_blur_type(); + if (this._settings.dash_to_dock.BLUR) + this._dash_to_dock_blur.change_blur_type(); + }); + + // dash-to-dock corner radius changed + this._settings.dash_to_dock.CORNER_RADIUS_changed(() => { + if (this._settings.dash_to_dock.STATIC_BLUR) + this._dash_to_dock_blur.set_corner_radius(this._settings.dash_to_dock.CORNER_RADIUS); }); // dash-to-dock override background toggled on/off diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/af/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/af/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..a190bd4 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/af/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ar/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ar/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 73% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ar/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ar/LC_MESSAGES/blur-my-shell@aunetx.mo index 4a999d6..d44c239 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ar/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ar/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/az/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/az/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/az/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/az/LC_MESSAGES/blur-my-shell@aunetx.mo diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/be/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/be/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..2643e11 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/be/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/bg/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/bg/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/bg/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/bg/LC_MESSAGES/blur-my-shell@aunetx.mo diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ca/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ca/LC_MESSAGES/blur-my-shell.mo deleted file mode 100644 index 2309a34..0000000 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ca/LC_MESSAGES/blur-my-shell.mo and /dev/null differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ca/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ca/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..d397f3e Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ca/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/cs/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/cs/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 52% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/cs/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/cs/LC_MESSAGES/blur-my-shell@aunetx.mo index e2ddfb1..f16a792 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/cs/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/cs/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/de/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/de/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 71% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/de/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/de/LC_MESSAGES/blur-my-shell@aunetx.mo index 2a7d711..7785a81 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/de/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/de/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/el/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/el/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/el/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/el/LC_MESSAGES/blur-my-shell@aunetx.mo diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/es/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/es/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 53% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/es/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/es/LC_MESSAGES/blur-my-shell@aunetx.mo index cf6538f..c9ea2a6 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/es/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/es/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/fr/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/fr/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 54% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/fr/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/fr/LC_MESSAGES/blur-my-shell@aunetx.mo index 6dcf7e4..0b25369 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/fr/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/fr/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/he/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/he/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/he/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/he/LC_MESSAGES/blur-my-shell@aunetx.mo diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hi/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hi/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..91c892e Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hi/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hu/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hu/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 53% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hu/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hu/LC_MESSAGES/blur-my-shell@aunetx.mo index 594115a..b1831e1 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hu/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hu/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/id/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/id/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..2f8f20f Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/id/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/it/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/it/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 53% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/it/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/it/LC_MESSAGES/blur-my-shell@aunetx.mo index 58a2339..f1eb271 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/it/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/it/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ka/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ka/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ka/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ka/LC_MESSAGES/blur-my-shell@aunetx.mo diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ko/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ko/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ko/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ko/LC_MESSAGES/blur-my-shell@aunetx.mo diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nb_NO/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nb_NO/LC_MESSAGES/blur-my-shell.mo deleted file mode 100644 index 50b3aeb..0000000 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nb_NO/LC_MESSAGES/blur-my-shell.mo and /dev/null differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nb_NO/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nb_NO/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..acfeabf Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nb_NO/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nl/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nl/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 52% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nl/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nl/LC_MESSAGES/blur-my-shell@aunetx.mo index d100839..e0be4d0 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nl/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nl/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nn/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nn/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nn/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/nn/LC_MESSAGES/blur-my-shell@aunetx.mo diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pl/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pl/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 70% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pl/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pl/LC_MESSAGES/blur-my-shell@aunetx.mo index 2fc2150..2f3fe06 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pl/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pl/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 52% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt/LC_MESSAGES/blur-my-shell@aunetx.mo index fb80705..1387462 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt_BR/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt_BR/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 53% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt_BR/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt_BR/LC_MESSAGES/blur-my-shell@aunetx.mo index ff2e1e1..a68cb99 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt_BR/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt_BR/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ro/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ro/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..7b7e190 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ro/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ru/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ru/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 55% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ru/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ru/LC_MESSAGES/blur-my-shell@aunetx.mo index 672f192..22d2a2b 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ru/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ru/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sl/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sl/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 100% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sl/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sl/LC_MESSAGES/blur-my-shell@aunetx.mo diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sv/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sv/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 69% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sv/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sv/LC_MESSAGES/blur-my-shell@aunetx.mo index b561cb0..491c32b 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sv/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sv/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ta/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ta/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 57% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ta/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ta/LC_MESSAGES/blur-my-shell@aunetx.mo index 6854bc4..f524fad 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ta/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ta/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/tr/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/tr/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 55% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/tr/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/tr/LC_MESSAGES/blur-my-shell@aunetx.mo index 55feb4f..ba45f9b 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/tr/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/tr/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/uk/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/uk/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 73% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/uk/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/uk/LC_MESSAGES/blur-my-shell@aunetx.mo index dfbfc12..7a24fdd 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/uk/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/uk/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/vi/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/vi/LC_MESSAGES/blur-my-shell.mo deleted file mode 100644 index 7656681..0000000 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/vi/LC_MESSAGES/blur-my-shell.mo and /dev/null differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/vi/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/vi/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..5364ed4 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/vi/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_Hans/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_Hans/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..ad6d992 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_Hans/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_Hans/LC_MESSAGES/blur-my-shell.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_TW/LC_MESSAGES/blur-my-shell@aunetx.mo similarity index 53% rename from gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_Hans/LC_MESSAGES/blur-my-shell.mo rename to gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_TW/LC_MESSAGES/blur-my-shell@aunetx.mo index 199a39c..4d7557c 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_Hans/LC_MESSAGES/blur-my-shell.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_TW/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/metadata.json b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/metadata.json index 32ca8d1..497ccca 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/metadata.json @@ -5,16 +5,20 @@ "github": "aunetx", "kofi": "aunetx" }, - "gettext-domain": "blur-my-shell", + "gettext-domain": "blur-my-shell@aunetx", "name": "Blur my Shell", "original-authors": [ "me@aunetx.dev" ], + "session-modes": [ + "unlock-dialog", + "user" + ], "settings-schema": "org.gnome.shell.extensions.blur-my-shell", "shell-version": [ - "45" + "46" ], - "url": "https://github.com/aunetx/gnome-shell-extension-blur-my-shell", + "url": "https://github.com/aunetx/blur-my-shell", "uuid": "blur-my-shell@aunetx", - "version": 54 + "version": 59 } \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/dash.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/dash.js index ef8d9ed..3a42ff2 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/dash.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/dash.js @@ -10,6 +10,8 @@ export const Dash = GObject.registerClass({ InternalChildren: [ 'blur', 'customize', + 'static_blur', + 'corner_radius', 'override_background', 'style_dash_to_dock', 'unblur_in_overview' @@ -24,6 +26,16 @@ export const Dash = GObject.registerClass({ 'blur', this._blur, 'active', Gio.SettingsBindFlags.DEFAULT ); + this.preferences.dash_to_dock.settings.bind( + 'static-blur', + this._static_blur, 'active', + Gio.SettingsBindFlags.DEFAULT + ); + this.preferences.dash_to_dock.settings.bind( + 'corner-radius', + this._corner_radius, 'value', + Gio.SettingsBindFlags.DEFAULT + ); this.preferences.dash_to_dock.settings.bind( 'override-background', this._override_background, 'enable-expansion', diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/panel.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/panel.js index 6d9f72b..6243f1f 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/panel.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/panel.js @@ -12,6 +12,7 @@ export const Panel = GObject.registerClass({ 'customize', 'static_blur', 'unblur_in_overview', + 'force_light_text', 'override_background', 'style_panel', 'override_background_dynamically', @@ -36,6 +37,10 @@ export const Panel = GObject.registerClass({ 'unblur-in-overview', this._unblur_in_overview, 'active', Gio.SettingsBindFlags.DEFAULT ); + this.preferences.panel.settings.bind( + 'force-light-text', this._force_light_text, 'active', + Gio.SettingsBindFlags.DEFAULT + ); this.preferences.panel.settings.bind( 'override-background', this._override_background, 'enable-expansion', diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/window_row.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/window_row.js index c9786c9..fd150e0 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/window_row.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/preferences/window_row.js @@ -7,14 +7,14 @@ import Gtk from 'gi://Gtk'; import { pick, on_picking, on_picked } from '../dbus/client.js'; - export const WindowRow = GObject.registerClass({ GTypeName: 'WindowRow', Template: GLib.uri_resolve_relative(import.meta.url, '../ui/window-row.ui', GLib.UriFlags.NONE), InternalChildren: [ 'window_picker', 'window_class', - 'picking_failure_toast' + 'picking_failure_toast', + 'window_not_found_toast' ], }, class WindowRow extends Adw.ExpanderRow { constructor(list, app_page, app_name) { @@ -88,7 +88,7 @@ export const WindowRow = GObject.registerClass({ if (remove_if_failed) this._remove_row(); } - }, 15); + }, 250); on_picking(_ => has_responded = true @@ -98,6 +98,9 @@ export const WindowRow = GObject.registerClass({ if (should_take_answer) { if (wm_class == 'window-not-found') { console.warn("Can't pick window from here"); + this._app_page._preferences_window.add_toast( + this._window_not_found_toast + ); return; } this._window_class.buffer.text = wm_class; diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/schemas/gschemas.compiled b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/schemas/gschemas.compiled index c5aa01a..36fefef 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/schemas/gschemas.compiled and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/schemas/gschemas.compiled differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/schemas/org.gnome.shell.extensions.blur-my-shell.gschema.xml b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/schemas/org.gnome.shell.extensions.blur-my-shell.gschema.xml index 254af24..1e237e7 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/schemas/org.gnome.shell.extensions.blur-my-shell.gschema.xml +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/schemas/org.gnome.shell.extensions.blur-my-shell.gschema.xml @@ -1,11 +1,12 @@ - + 30 - Global sigma (gaussian blur radius) to use + Global gaussian sigma to use @@ -56,7 +57,8 @@ - + true @@ -70,7 +72,7 @@ 30 - Sigma (gaussian blur radius) to use for the blur effect + Gaussian sigma to use for the blur effect @@ -100,7 +102,8 @@ - + true @@ -114,7 +117,7 @@ 30 - Sigma (gaussian blur radius) to use for the blur effect + Gaussian sigma to use for the blur effect @@ -144,7 +147,8 @@ - + true @@ -158,7 +162,7 @@ 30 - Sigma (gaussian blur radius) to use for the blur effect + Gaussian sigma to use for the blur effect @@ -190,6 +194,11 @@ true Boolean, whether to disable blur from this component when opening the overview or not + + + false + Boolean, whether or not to force the panel to have light text, useful when using light theme + true @@ -208,7 +217,8 @@ - + false @@ -222,7 +232,7 @@ 30 - Sigma (gaussian blur radius) to use for the blur effect + Gaussian sigma to use for the blur effect @@ -264,13 +274,19 @@ false Boolean, whether to disable blur from this component when opening the overview or not + + + 12 + Radius for the corner rounding effect + - + - true + false Boolean, whether to blur activate the blur for this component or not @@ -281,7 +297,7 @@ 30 - Sigma (gaussian blur radius) to use for the blur effect + Gaussian sigma to use for the blur effect @@ -325,13 +341,14 @@ - ["Plank"] + ["Plank","com.desktop.ding", "Conky"] List of applications not to blur - + true @@ -345,7 +362,7 @@ 30 - Sigma (gaussian blur radius) to use for the blur effect + Gaussian sigma to use for the blur effect @@ -370,7 +387,8 @@ - + true @@ -384,7 +402,7 @@ 30 - Sigma (gaussian blur radius) to use for the blur effect + Gaussian sigma to use for the blur effect @@ -409,7 +427,8 @@ - + true @@ -423,7 +442,7 @@ 30 - Sigma (gaussian blur radius) to use for the blur effect + Gaussian sigma to use for the blur effect @@ -448,7 +467,8 @@ - + false @@ -457,7 +477,8 @@ - + true diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/stylesheet.css b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/stylesheet.css index 91cfb1f..7cfc773 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/stylesheet.css +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/stylesheet.css @@ -68,7 +68,7 @@ } -/*** DASH ***/ +/*** DASH-TO-DOCK ***/ /* * `.transparent-dash` @@ -107,7 +107,6 @@ */ .overview-components-transparent .workspace-thumbnail { - background-color: rgba(0, 0, 0, 0); border: 1px solid rgba(100, 100, 100, 0.35); } @@ -122,53 +121,88 @@ color: rgba(255, 255, 255, 0.65); } -.overview-components-transparent .search-section-content { - border: none; - box-shadow: none; -} - -.overview-components-transparent .search-section-content, -.overview-components-transparent .app-folder .overview-icon { - background-color: rgba(0, 0, 0, 0); -} - +.overview-components-transparent .overview-tile, +.overview-components-transparent .overview-icon, +.overview-components-transparent .list-search-result, +.overview-components-transparent .search-provider-icon, /* prevents the extension from interfering with Just Perfection */ -.overview-components-transparent.just-perfection .search-section-content { +.overview-components-transparent.just-perfection .search-section-content, +/* remove the rectangular background from the dash */ +.overview-components-transparent #dash .overview-tile { background-color: transparent; } -.overview-components-transparent .app-folder .overview-icon { - border-color: transparent; -} - -.overview-components-transparent .app-folder:hover .overview-icon, -.overview-components-transparent .app-folder:focus .overview-icon { - background-color: rgba(230, 230, 230, 0.08); -} - -.overview-components-transparent .app-folder:active .overview-icon, -.overview-components-transparent .app-folder:focus:hover .overview-icon, -.overview-components-transparent .app-folder:drop .overview-icon { - background-color: rgba(230, 230, 230, 0.12); -} - -.overview-components-transparent .app-folder:focus:active .overview-icon { - background-color: rgba(230, 230, 230, 0.15); -} - +.overview-components-transparent .workspace-thumbnail, +.overview-components-transparent .search-section-content, +.overview-components-transparent .overview-tile.app-folder, +.overview-components-transparent .page-navigation-arrow, +.overview-components-transparent .app-folder-dialog .icon-button, /* this shouldn't apply to Dash to Dock */ .overview-components-transparent StBoxLayout>StWidget>#dash>.dash-background { background-color: rgba(0, 0, 0, 0); } +.overview-components-transparent .overview-tile:hover, +.overview-components-transparent .overview-tile:focus, +.overview-components-transparent .overview-tile:selected, +.overview-components-transparent .overview-tile:highlighted, +.overview-components-transparent .list-search-result:hover, +.overview-components-transparent .list-search-result:focus, +.overview-components-transparent .list-search-result:selected, +.overview-components-transparent .list-search-result:highlighted, +.overview-components-transparent .search-provider-icon:hover, +.overview-components-transparent .search-provider-icon:focus, +.overview-components-transparent .page-navigation-arrow:hover, +.overview-components-transparent .page-navigation-arrow:focus, +.overview-components-transparent .app-folder-dialog .icon-button:hover, +.overview-components-transparent .app-folder-dialog .icon-button:focus, +.overview-components-transparent #dash .overview-tile:hover .overview-icon, +.overview-components-transparent #dash .overview-tile:focus .overview-icon, +.overview-components-transparent #dash .show-apps:hover .overview-icon, +.overview-components-transparent #dash .show-apps:focus .overview-icon { + background-color: rgba(230, 230, 230, 0.08); +} + +.overview-components-transparent .overview-tile:active, +.overview-components-transparent .overview-tile:focus:hover, +.overview-components-transparent .overview-tile:drop, +.overview-components-transparent .overview-tile:selected:hover, +.overview-components-transparent .overview-tile:highlighted:hover, +.overview-components-transparent .list-search-result:active, +.overview-components-transparent .list-search-result:focus:hover, +.overview-components-transparent .list-search-result:selected:hover, +.overview-components-transparent .list-search-result:highlighted:hover, +.overview-components-transparent .search-provider-icon:active, +.overview-components-transparent .search-provider-icon:focus:hover, +.overview-components-transparent .page-navigation-arrow:active, +.overview-components-transparent .page-navigation-arrow:focus:hover, +.overview-components-transparent .app-folder-dialog .icon-button:active, +.overview-components-transparent .app-folder-dialog .icon-button:focus:hover, +.overview-components-transparent #dash .overview-tile:active .overview-icon, +.overview-components-transparent #dash .overview-tile:focus:hover .overview-icon, +.overview-components-transparent #dash .overview-tile:drop .overview-icon, +.overview-components-transparent #dash .show-apps:checked .overview-icon { + background-color: rgba(230, 230, 230, 0.12); +} + +.overview-components-transparent .overview-tile:focus:active, +.overview-components-transparent .overview-tile:selected:active, +.overview-components-transparent .overview-tile:highlighted:active, +.overview-components-transparent .list-search-result:focus:active, +.overview-components-transparent .list-search-result:selected:active, +.overview-components-transparent .list-search-result:highlighted:active, +.overview-components-transparent .search-provider-icon:focus:active, +.overview-components-transparent .page-navigation-arrow:focus:active, +.overview-components-transparent .app-folder-dialog .icon-button:focus:active, +.overview-components-transparent #dash .show-apps:checked .overview-icon:hover { + background-color: rgba(230, 230, 230, 0.15); +} + + /* * `.overview-components-light` */ -.overview-components-light .workspace-thumbnail { - background-color: rgba(200, 200, 200, 0.2); -} - .overview-components-light .search-entry { color: white; background-color: rgba(200, 200, 200, 0.2); @@ -180,54 +214,88 @@ color: rgba(255, 255, 255, 0.65); } -.overview-components-light .search-section-content { - border: none; - box-shadow: none; -} - -.overview-components-light .search-section-content, -.overview-components-light .app-folder .overview-icon { - background-color: rgba(200, 200, 200, 0.2); -} - +.overview-components-light .overview-tile, +.overview-components-light .overview-icon, +.overview-components-light .list-search-result, +.overview-components-light .search-provider-icon, /* prevents the extension from interfering with Just Perfection */ -.overview-components-light.just-perfection .search-section-content { +.overview-components-light.just-perfection .search-section-content, +/* remove the rectangular background from the dash */ +.overview-components-light #dash .overview-tile { background-color: transparent; } -.overview-components-light .app-folder .overview-icon { - border-color: transparent; -} - -.overview-components-light .app-folder:hover .overview-icon, -.overview-components-light .app-folder:focus .overview-icon { - background-color: rgba(230, 230, 230, 0.2); -} - -.overview-components-light .app-folder:active .overview-icon, -.overview-components-light .app-folder:focus:hover .overview-icon, -.overview-components-light .app-folder:drop .overview-icon { - background-color: rgba(230, 230, 230, 0.25); -} - -.overview-components-light .app-folder:focus:active .overview-icon { - background-color: rgba(230, 230, 230, 0.3); -} - +.overview-components-light .workspace-thumbnail, +.overview-components-light .search-section-content, +.overview-components-light .overview-tile.app-folder, +.overview-components-light .page-navigation-arrow, +.overview-components-light .app-folder-dialog .icon-button, /* this shouldn't apply to Dash to Dock */ .overview-components-light StBoxLayout>StWidget>#dash>.dash-background { background-color: rgba(200, 200, 200, 0.2); } +.overview-components-light .overview-tile:hover, +.overview-components-light .overview-tile:focus, +.overview-components-light .overview-tile:selected, +.overview-components-light .overview-tile:highlighted, +.overview-components-light .list-search-result:hover, +.overview-components-light .list-search-result:focus, +.overview-components-light .list-search-result:selected, +.overview-components-light .list-search-result:highlighted, +.overview-components-light .search-provider-icon:hover, +.overview-components-light .search-provider-icon:focus, +.overview-components-light .page-navigation-arrow:hover, +.overview-components-light .page-navigation-arrow:focus, +.overview-components-light .app-folder-dialog .icon-button:hover, +.overview-components-light .app-folder-dialog .icon-button:focus, +.overview-components-light #dash .overview-tile:hover .overview-icon, +.overview-components-light #dash .overview-tile:focus .overview-icon, +.overview-components-light #dash .show-apps:hover .overview-icon, +.overview-components-light #dash .show-apps:focus .overview-icon { + background-color: rgba(230, 230, 230, 0.2); +} + +.overview-components-light .overview-tile:active, +.overview-components-light .overview-tile:focus:hover, +.overview-components-light .overview-tile:drop, +.overview-components-light .overview-tile:selected:hover, +.overview-components-light .overview-tile:highlighted:hover, +.overview-components-light .list-search-result:active, +.overview-components-light .list-search-result:focus:hover, +.overview-components-light .list-search-result:selected:hover, +.overview-components-light .list-search-result:highlighted:hover, +.overview-components-light .search-provider-icon:active, +.overview-components-light .search-provider-icon:focus:hover, +.overview-components-light .page-navigation-arrow:active, +.overview-components-light .page-navigation-arrow:focus:hover, +.overview-components-light .app-folder-dialog .icon-button:active, +.overview-components-light .app-folder-dialog .icon-button:focus:hover, +.overview-components-light #dash .overview-tile:active .overview-icon, +.overview-components-light #dash .overview-tile:focus:hover .overview-icon, +.overview-components-light #dash .overview-tile:drop .overview-icon, +.overview-components-light #dash .show-apps:checked .overview-icon { + background-color: rgba(230, 230, 230, 0.25); +} + +.overview-components-light .overview-tile:focus:active, +.overview-components-light .overview-tile:selected:active, +.overview-components-light .overview-tile:highlighted:active, +.overview-components-light .list-search-result:focus:active, +.overview-components-light .list-search-result:selected:active, +.overview-components-light .list-search-result:highlighted:active, +.overview-components-light .search-provider-icon:focus:active, +.overview-components-light .page-navigation-arrow:focus:active, +.overview-components-light .app-folder-dialog .icon-button:focus:active, +.overview-components-light #dash .show-apps:checked .overview-icon:hover { + background-color: rgba(230, 230, 230, 0.3); +} + /* * `.overview-components-dark` */ -.overview-components-dark .workspace-thumbnail { - background-color: rgba(100, 100, 100, 0.35); -} - .overview-components-dark .search-entry { color: white; background-color: rgba(100, 100, 100, 0.35); @@ -239,45 +307,83 @@ color: rgba(255, 255, 255, 0.65); } -.overview-components-dark .search-section-content { - border: none; - box-shadow: none; -} - -.overview-components-dark .search-section-content, -.overview-components-dark .app-folder .overview-icon { - background-color: rgba(100, 100, 100, 0.35); -} - +.overview-components-dark .overview-tile, +.overview-components-dark .overview-icon, +.overview-components-dark .list-search-result, +.overview-components-dark .search-provider-icon, /* prevents the extension from interfering with Just Perfection */ -.overview-components-dark.just-perfection .search-section-content { +.overview-components-dark.just-perfection .search-section-content, +/* remove the rectangular background from the dash */ +.overview-components-dark #dash .overview-tile { background-color: transparent; } -.overview-components-dark .app-folder .overview-icon { - border-color: transparent; -} - -.overview-components-dark .app-folder:hover .overview-icon, -.overview-components-dark .app-folder:focus .overview-icon { - background-color: rgba(120, 120, 120, 0.35); -} - -.overview-components-dark .app-folder:active .overview-icon, -.overview-components-dark .app-folder:focus:hover .overview-icon, -.overview-components-dark .app-folder:drop .overview-icon { - background-color: rgba(120, 120, 120, 0.4); -} - -.overview-components-dark .app-folder:focus:active .overview-icon { - background-color: rgba(120, 120, 120, 0.45); -} - +.overview-components-dark .workspace-thumbnail, +.overview-components-dark .search-section-content, +.overview-components-dark .overview-tile.app-folder, +.overview-components-dark .page-navigation-arrow, +.overview-components-dark .app-folder-dialog .icon-button, /* this shouldn't apply to Dash to Dock */ .overview-components-dark StBoxLayout>StWidget>#dash>.dash-background { background-color: rgba(100, 100, 100, 0.35); } +.overview-components-dark .overview-tile:hover, +.overview-components-dark .overview-tile:focus, +.overview-components-dark .overview-tile:selected, +.overview-components-dark .overview-tile:highlighted, +.overview-components-dark .list-search-result:hover, +.overview-components-dark .list-search-result:focus, +.overview-components-dark .list-search-result:selected, +.overview-components-dark .list-search-result:highlighted, +.overview-components-dark .search-provider-icon:hover, +.overview-components-dark .search-provider-icon:focus, +.overview-components-dark .page-navigation-arrow:hover, +.overview-components-dark .page-navigation-arrow:focus, +.overview-components-dark .app-folder-dialog .icon-button:hover, +.overview-components-dark .app-folder-dialog .icon-button:focus, +.overview-components-dark #dash .overview-tile:hover .overview-icon, +.overview-components-dark #dash .overview-tile:focus .overview-icon, +.overview-components-dark #dash .show-apps:hover .overview-icon, +.overview-components-dark #dash .show-apps:focus .overview-icon { + background-color: rgba(120, 120, 120, 0.35); +} + +.overview-components-dark .overview-tile:active, +.overview-components-dark .overview-tile:focus:hover, +.overview-components-dark .overview-tile:drop, +.overview-components-dark .overview-tile:selected:hover, +.overview-components-dark .overview-tile:highlighted:hover, +.overview-components-dark .list-search-result:active, +.overview-components-dark .list-search-result:focus:hover, +.overview-components-dark .list-search-result:selected:hover, +.overview-components-dark .list-search-result:highlighted:hover, +.overview-components-dark .search-provider-icon:active, +.overview-components-dark .search-provider-icon:focus:hover, +.overview-components-dark .page-navigation-arrow:active, +.overview-components-dark .page-navigation-arrow:focus:hover, +.overview-components-dark .app-folder-dialog .icon-button:active, +.overview-components-dark .app-folder-dialog .icon-button:focus:hover, +.overview-components-dark #dash .overview-tile:active .overview-icon, +.overview-components-dark #dash .overview-tile:focus:hover .overview-icon, +.overview-components-dark #dash .overview-tile:drop .overview-icon, +.overview-components-dark #dash .show-apps:checked .overview-icon { + background-color: rgba(120, 120, 120, 0.4); +} + +.overview-components-dark .overview-tile:focus:active, +.overview-components-dark .overview-tile:selected:active, +.overview-components-dark .overview-tile:highlighted:active, +.overview-components-dark .list-search-result:focus:active, +.overview-components-dark .list-search-result:selected:active, +.overview-components-dark .list-search-result:highlighted:active, +.overview-components-dark .search-provider-icon:focus:active, +.overview-components-dark .page-navigation-arrow:focus:active, +.overview-components-dark .app-folder-dialog .icon-button:focus:active, +.overview-components-dark #dash .show-apps:checked .overview-icon:hover { + background-color: rgba(120, 120, 120, 0.45); +} + /*** APPFOLDER DIALOG ***/ @@ -331,4 +437,98 @@ background-color: rgba(100, 100, 100, 0.35); border: 0; box-shadow: none; +} + + +/*** PANEL LIGHT TEXT ***/ + +/* +* `.panel-light-text`, adapted from gnome-shell-light.css +*/ + +#panel.panel-light-text .panel-button, +#panel.panel-light-text .panel-button.clock-display, +#panel.panel-light-text .netSpeedLabel { + color: #f6f5f4; + box-shadow: none; +} + +#panel.panel-light-text .panel-button:active, +#panel.panel-light-text .panel-button:focus, +#panel.panel-light-text .panel-button:checked, +#panel.panel-light-text .panel-button.clock-display:active .clock, +#panel.panel-light-text .panel-button.clock-display:focus .clock, +#panel.panel-light-text .panel-button.clock-display:checked .clock { + box-shadow: inset 0 0 0 100px rgba(246, 245, 244, 0.25); +} + +#panel.panel-light-text .panel-button:active:hover, +#panel.panel-light-text .panel-button:focus:hover, +#panel.panel-light-text .panel-button:checked:hover, +#panel.panel-light-text .panel-button.clock-display:active:hover, +#panel.panel-light-text .panel-button.clock-display:focus:hover, +#panel.panel-light-text .panel-button.clock-display:checked:hover, +#panel.panel-light-text .panel-button.clock-display:active .clock:hover, +#panel.panel-light-text .panel-button.clock-display:focus .clock:hover, +#panel.panel-light-text .panel-button.clock-display:checked .clock:hover { + box-shadow: inset 0 0 0 100px rgba(246, 245, 244, 0.35); +} + +#panel.panel-light-text .panel-button:hover, +#panel.panel-light-text .panel-button.clock-display:hover, +#panel.panel-light-text .panel-button.clock-display:hover .clock { + box-shadow: inset 0 0 0 100px rgba(246, 245, 244, 0.2); +} + +#panel.panel-light-text .panel-button#panelActivities .workspace-dot { + background-color: #f6f5f4; +} + +#panel.panel-light-text .panel-button.clock-display:active, +#panel.panel-light-text .panel-button.clock-display:focus, +#panel.panel-light-text .panel-button.clock-display:checked, +#panel.panel-light-text .panel-button.clock-display:hover { + box-shadow: none !important; +} + +#panel.panel-light-text .panel-button.screen-recording-indicator { + color: #f6f5f4; + box-shadow: inset 0 0 0 100px rgba(192, 28, 40, 0.8); +} + +#panel.panel-light-text .panel-button.screen-recording-indicator:active, +#panel.panel-light-text .panel-button.screen-recording-indicator:focus, +#panel.panel-light-text .panel-button.screen-recording-indicator:checked { + box-shadow: inset 0 0 0 100px #c01c28; +} + +#panel.panel-light-text .panel-button.screen-recording-indicator:active:hover, +#panel.panel-light-text .panel-button.screen-recording-indicator:focus:hover, +#panel.panel-light-text .panel-button.screen-recording-indicator:checked:hover { + box-shadow: inset 0 0 0 100px rgba(192, 28, 40, 0.95); +} + +#panel.panel-light-text .panel-button.screen-recording-indicator:hover { + box-shadow: inset 0 0 0 100px rgba(192, 28, 40, 0.9); +} + +#panel.panel-light-text .panel-button.screen-sharing-indicator { + color: #282828; + box-shadow: inset 0 0 0 100px rgba(255, 120, 0, 0.8); +} + +#panel.panel-light-text .panel-button.screen-sharing-indicator:active, +#panel.panel-light-text .panel-button.screen-sharing-indicator:focus, +#panel.panel-light-text .panel-button.screen-sharing-indicator:checked { + box-shadow: inset 0 0 0 100px #ff7800; +} + +#panel.panel-light-text .panel-button.screen-sharing-indicator:active:hover, +#panel.panel-light-text .panel-button.screen-sharing-indicator:focus:hover, +#panel.panel-light-text .panel-button.screen-sharing-indicator:checked:hover { + box-shadow: inset 0 0 0 100px rgba(255, 120, 0, 0.95); +} + +#panel.panel-light-text .panel-button.screen-sharing-indicator:hover { + box-shadow: inset 0 0 0 100px rgba(255, 120, 0, 0.9); } \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/applications.ui b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/applications.ui index 0b4b83c..54b0a02 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/applications.ui +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/applications.ui @@ -27,7 +27,7 @@ To get the best results possible, make sure to choose the option “No artifact Opacity The opacity of the window on top of the blur effect, a higher value will be more legible. - opacity + opacity_scale diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/dash.ui b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/dash.ui index 5eac21b..1afdbc2 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/dash.ui +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/dash.ui @@ -17,7 +17,47 @@ + + + + + + + Static blur + Uses a static blurred image, can be used with rounding effect. +<b>Important notice:</b> with this activated, you should not use a big sigma value as it will deteriorate performances. + static_blur + + + + center + + + + + + + + Rounded corner radius + The radius for the rounding effect. Only available with static blur. + corner_radius_scale + + + + + + center + true + 200px + true + right + horizontal + 0 + corner_radius + + @@ -70,4 +110,10 @@ Dark + + + 0 + 50 + 1 + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/panel.ui b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/panel.ui index 41d9cd1..f7a40e0 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/panel.ui +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/panel.ui @@ -38,13 +38,13 @@ - Disable in overview - Disables the blur from the panel when entering the overview. - unblur_in_overview + Force light text + Use a light text for the panel, useful when using gnome-shell's light theme. + force_light_text - + center @@ -89,6 +89,21 @@ Recommended unless you want to customize your GNOME theme. + + + + Disable in overview + Disables the blur from the panel when entering the overview. + unblur_in_overview + + + + + center + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/window-row.ui b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/window-row.ui index c4d8201..953585f 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/window-row.ui +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/ui/window-row.ui @@ -40,4 +40,8 @@ Could not pick window, make sure that the extension is enabled. + + + Could not pick window from here, does not seem like a valid window. + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/config/windows.json b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/config/windows.json index 4a5096e..2b9f450 100644 --- a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/config/windows.json +++ b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/config/windows.json @@ -16,6 +16,14 @@ { "wmClass": "gnome-terminal-server", "wmTitle": "Preferences – General", "mode": "float" }, { "wmClass": "gnome-terminal-preferences", "mode": "float" }, { "wmClass": "Guake", "mode": "float" }, - { "wmClass": "zoom", "mode": "float" } + { "wmClass": "zoom", "mode": "float" }, + { "wmClass": "firefox", "wmTitle": "About Mozilla Firefox", "mode": "float" }, + { "wmClass": "firefox", "wmTitle": "!Mozilla Firefox", "mode": "float" }, + { "wmClass": "org.mozilla.firefox.desktop", "wmTitle": "About Mozilla Firefox", "mode": "float" }, + { "wmClass": "org.mozilla.firefox.desktop", "wmTitle": "!Mozilla Firefox", "mode": "float" }, + { "wmClass": "thunderbird", "wmTitle": "About Mozilla Thunderbird", "mode": "float" }, + { "wmClass": "thunderbird", "wmTitle": "!Mozilla Thunderbird", "mode": "float" }, + { "wmClass": "org.mozilla.Thunderbird.desktop", "wmTitle": "About Mozilla Thunderbird", "mode": "float" }, + { "wmClass": "org.mozilla.Thunderbird.desktop", "wmTitle": "!Mozilla Thunderbird", "mode": "float" } ] } diff --git a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/indicator.js b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/indicator.js index 8132731..309dcf2 100644 --- a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/indicator.js +++ b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/indicator.js @@ -81,6 +81,14 @@ export class FeatureMenuToggle extends QuickMenuToggle { )) ); + this.menu.addMenuItem( + (this._focusMovePointer = new SettingsPopupSwitch( + _("Move Pointer with the Focus"), + this.extension, + "move-pointer-focus-enabled" + )) + ); + // Add an entry-point for more settings this.menu.addMenuItem(new PopupSeparatorMenuItem()); const settingsItem = this.menu.addAction(_("Settings"), () => this.extension.openPreferences()); diff --git a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/tree.js b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/tree.js index 8035211..ea0d767 100644 --- a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/tree.js +++ b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/tree.js @@ -79,6 +79,7 @@ export class Node extends GObject.Object { this.tab = null; this.decoration = null; this.app = null; + this.pointer = null; if (this.isWindow()) { // When destroy() is called on Meta.Window, it might not be @@ -474,9 +475,9 @@ export class Node extends GObject.Object { child: new St.Icon({ icon_name: "window-close-symbolic" }), }); - tabContents.add(iconBin); - tabContents.add(titleButton); - tabContents.add(closeButton); + tabContents.add_child(iconBin); + tabContents.add_child(titleButton); + tabContents.add_child(closeButton); let clickFn = () => { this.parentNode.childNodes.forEach((c) => { @@ -553,6 +554,17 @@ export class Node extends GObject.Object { set tile(value) { this.float = !value; } + + resetLayoutSingleChild() { + let tabbedOrStacked = this.isTabbed() || this.isStacked(); + if (tabbedOrStacked && this.singleOrNoChild()) { + this.layout = LAYOUT_TYPES.HSPLIT; + } + } + + singleOrNoChild() { + return this.childNodes.length <= 1; + } } /** @@ -946,6 +958,7 @@ export class Tree extends Node { } this.resetSiblingPercent(parentNode); this.resetSiblingPercent(parentTarget); + parentNode.resetLayoutSingleChild(); return true; } @@ -953,7 +966,7 @@ export class Tree extends Node { * Give the next sibling/parent/descendant on the tree based * on a given Meta.MotionDirection * - * @param {Tree.Node} node + * @param {Node} node * @param {Meta.MotionDirection} direction * * Credits: borrowed logic from tree.c of i3 @@ -1511,7 +1524,7 @@ export class Tree extends Node { } else { decoration.hide(); } - if (!decoration.contains(child.tab)) decoration.add(child.tab); + if (!decoration.contains(child.tab)) decoration.add_child(child.tab); } child.render(); @@ -1561,7 +1574,23 @@ export class Tree extends Node { } debugTree() { + // this.debugChildNodes(this); + } + + debugChildNodes(node) { this.debugNode(this); + node.childNodes.forEach((child) => { + this.debugChildNodes(child); + }); + } + + debugParentNodes(node) { + if (node) { + if (node.parentNode) { + this.debugParentNodes(node.parentNode); + } + this.debugNode(node); + } } debugNode(node) { @@ -1576,7 +1605,7 @@ export class Tree extends Node { let attributes = ""; - if (node.isWindow()) { + if (node.isWindow && node.isWindow()) { let metaWindow = node.nodeValue; attributes += `class:'${metaWindow.get_wm_class()}',title:'${ metaWindow.title @@ -1590,6 +1619,9 @@ export class Tree extends Node { if (node.rect) { attributes += `,rect:${node.rect.width}x${node.rect.height}+${node.rect.x}+${node.rect.y}`; + const pointerCoord = global.get_pointer(); + const pointerInside = Utils.rectContainsPoint(node.rect, pointerCoord) ? "yes" : "no"; + attributes += `,pointer:${pointerInside}`; } if (level !== 0) Logger.debug(`${spacing}|`); @@ -1598,10 +1630,6 @@ export class Tree extends Node { node.index !== null ? node.index : "-" } @${attributes}` ); - - node.childNodes.forEach((child) => { - this.debugNode(child); - }); } findParent(childNode, parentNodeType) { diff --git a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/window.js b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/window.js index 8fc9627..b5d3ceb 100644 --- a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/window.js +++ b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/extension/window.js @@ -68,49 +68,46 @@ export class WindowManager extends GObject.Object { !production ? "DEV" : `${PACKAGE_VERSION}-${ext.metadata.version}` }`; this.windowProps = this.ext.configMgr.windowProps; + this.windowProps.overrides = this.windowProps.overrides.filter((override) => !override.wmId); this._kbd = this.ext.keybindings; this._tree = new Tree(this); this.eventQueue = new Queue(); this.theme = this.ext.theme; + this.lastFocusedWindow = null; Logger.info("forge initialized"); } - addFloatOverride(metaWindow, byClass = true) { + addFloatOverride(metaWindow, withWmId) { let overrides = this.windowProps.overrides; - let wmTitle = metaWindow.get_title(); let wmClass = metaWindow.get_wm_class(); + let wmId = metaWindow.get_id(); for (let override in overrides) { - if (!byClass) { - if (override.wmClass === wmClass && override.wmTitle === wmTitle) return; - } else { - if (override.wmClass === wmClass && !override.wmTitle) return; - } + // if the window is already floating + if (override.wmClass === wmClass && override.mode === "float" && !override.wmTitle) return; } overrides.push({ wmClass: wmClass, - wmTitle: !byClass ? wmTitle : undefined, + wmId: withWmId ? wmId : undefined, mode: "float", }); this.windowProps.overrides = overrides; this.ext.configMgr.windowProps = this.windowProps; } - removeFloatOverride(metaWindow, byClass = true) { + removeFloatOverride(metaWindow, withWmId) { let overrides = this.windowProps.overrides; - let wmTitle = metaWindow.get_title(); let wmClass = metaWindow.get_wm_class(); - - if (byClass) { - // remove purely wmClass - by checking also if override title exists - overrides = overrides.filter( - (override) => !(override.wmClass === wmClass) && !override.wmTitle - ); - } else { - overrides = overrides.filter( - (override) => !(override.wmClass === wmClass && override.wmTitle === wmTitle) - ); - } + let wmId = metaWindow.get_id(); + overrides = overrides.filter( + (override) => + !( + override.wmClass === wmClass && + // rules with a Title are written by the user and peristent + !override.wmTitle && + (!withWmId || override.wmId === wmId) + ) + ); this.windowProps.overrides = overrides; this.ext.configMgr.windowProps = this.windowProps; @@ -121,26 +118,18 @@ export class WindowManager extends GObject.Object { if (!nodeWindow || !(action || action.mode)) return; if (nodeWindow.nodeType !== NODE_TYPES.WINDOW) return; - let floatToggle = action.name === "FloatToggle"; - let floatClassToggle = action.name === "FloatClassToggle"; + let withWmId = action.name === "FloatToggle"; let floatingExempt = this.isFloatingExempt(metaWindow); if (floatingExempt) { - if (floatClassToggle) { - this.removeFloatOverride(metaWindow); - } else if (floatToggle) { - this.removeFloatOverride(metaWindow, false); - } - nodeWindow.mode = WINDOW_MODES.TILE; + this.removeFloatOverride(metaWindow, withWmId); if (!this.isActiveWindowWorkspaceTiled(metaWindow)) { nodeWindow.mode = WINDOW_MODES.FLOAT; + } else { + nodeWindow.mode = WINDOW_MODES.TILE; } } else { - if (floatClassToggle) { - this.addFloatOverride(metaWindow); - } else if (floatToggle) { - this.addFloatOverride(metaWindow, false); - } + this.addFloatOverride(metaWindow, withWmId); nodeWindow.mode = WINDOW_MODES.FLOAT; } } @@ -350,6 +339,7 @@ export class WindowManager extends GObject.Object { const focusNodeWindow = this.tree.findNode(this.focusMetaWindow); this.updateStackedFocus(focusNodeWindow); this.updateTabbedFocus(focusNodeWindow); + this.movePointerWith(focusNodeWindow); }, }; this.queueEvent(eventObj); @@ -444,6 +434,7 @@ export class WindowManager extends GObject.Object { let currentLayout; switch (action.name) { + case "FloatNonPersistentToggle": case "FloatToggle": case "FloatClassToggle": this.toggleFloatingMode(action, focusWindow); @@ -499,6 +490,7 @@ export class WindowManager extends GObject.Object { if (prev) prev.parentNode.lastTabFocus = prev.nodeValue; this.renderTree("move-tabbed-queue"); } + this.movePointerWith(focusNodeWindow); } }, }); @@ -523,6 +515,7 @@ export class WindowManager extends GObject.Object { focusNodeWindow.nodeValue.raise(); this.updateTabbedFocus(focusNodeWindow); this.updateStackedFocus(focusNodeWindow); + this.movePointerWith(focusNodeWindow); this.renderTree("swap", true); break; case "Split": @@ -679,6 +672,7 @@ export class WindowManager extends GObject.Object { ); let lastActiveNodeWindow = this.tree.findNode(lastActiveWindow); this.tree.swapPairs(lastActiveNodeWindow, focusNodeWindow); + this.movePointerWith(focusNodeWindow); this.renderTree("swap-last-active"); } break; @@ -914,7 +908,7 @@ export class WindowManager extends GObject.Object { try { nodeWindow.tab.remove_style_class_name("window-tabbed-tab-active"); } catch (e) { - Logger.warn(e); + // Logger.warn(e); } } } @@ -1425,6 +1419,8 @@ export class WindowManager extends GObject.Object { this.updateDecorationLayout(); this.updateStackedFocus(); this.updateTabbedFocus(); + let focusNodeWindow = this.tree.findNode(this.focusMetaWindow); + this.movePointerWith(focusNodeWindow); }, }); let focusNodeWindow = this.tree.findNode(this.focusMetaWindow); @@ -1495,6 +1491,8 @@ export class WindowManager extends GObject.Object { .get_workspace() .activate_with_focus(metaWindow, global.display.get_current_time()); this.moveCenter(metaWindow); + } else { + this.movePointerWith(metaWindow); } } } @@ -1613,9 +1611,10 @@ export class WindowManager extends GObject.Object { let nodeWindow; nodeWindow = this.tree.findNodeByActor(actor); - if (nodeWindow) { + if (nodeWindow?.isWindow()) { this.tree.removeNode(nodeWindow); this.renderTree("window-destroy-quick", true); + this.removeFloatOverride(nodeWindow.nodeValue, true); } // find the next attachNode here @@ -1777,10 +1776,26 @@ export class WindowManager extends GObject.Object { */ movePointerWith(nodeWindow) { if (!nodeWindow || !nodeWindow._data) return; - let rect = nodeWindow._data.get_frame_rect(); - global.get_pointer(); - const seat = Clutter.get_default_backend().get_default_seat(); - seat.warp_pointer(rect.x, rect.y); + if (this.ext.settings.get_boolean("move-pointer-focus-enabled")) { + this.storePointerLastPosition(this.lastFocusedWindow); + if (this.canMovePointerInsideNodeWindow(nodeWindow)) { + this.warpPointerToNodeWindow(nodeWindow); + } + } + this.lastFocusedWindow = nodeWindow; + this.tree.debugParentNodes(nodeWindow); + } + + warpPointerToNodeWindow(nodeWindow) { + const newCoord = this.getPointerPositionInside(nodeWindow); + if (newCoord && newCoord.x && newCoord.y) { + const seat = Clutter.get_default_backend().get_default_seat(); + if (seat) { + const wmTitle = nodeWindow.nodeValue.get_title(); + Logger.debug(`moved pointer to [${wmTitle}] at (${newCoord.x},${newCoord.y})`); + seat.warp_pointer(newCoord.x, newCoord.y); + } + } } getPointer() { @@ -1820,6 +1835,7 @@ export class WindowManager extends GObject.Object { const horizontal = parentNodeTarget.isHSplit() || parentNodeTarget.isTabbed(); const isMonParent = parentNodeTarget.nodeType === NODE_TYPES.MONITOR; const isConParent = parentNodeTarget.nodeType === NODE_TYPES.CON; + const centerLayout = this.ext.settings.get_string("dnd-center-layout").toUpperCase(); const stacked = parentNodeTarget.isStacked(); const tabbed = parentNodeTarget.isTabbed(); const stackedOrTabbed = stacked || tabbed; @@ -1917,28 +1933,35 @@ export class WindowManager extends GObject.Object { const isCenter = Utils.rectContainsPoint(centerRegion, currPointer); if (isCenter) { - if (stackedOrTabbed) { - containerNode = parentNodeTarget; - referenceNode = null; + if (centerLayout == "SWAP") { + referenceNode = nodeWinAtPointer; previewParams = { - className: stacked ? "window-tilepreview-stacked" : "window-tilepreview-tabbed", targetRect: targetRect, }; } else { - if (isMonParent) { - childNode.createCon = true; + if (stackedOrTabbed) { containerNode = parentNodeTarget; - referenceNode = nodeWinAtPointer; + referenceNode = null; previewParams = { + className: stacked ? "window-tilepreview-stacked" : "window-tilepreview-tabbed", targetRect: targetRect, }; } else { - containerNode = parentNodeTarget; - referenceNode = null; - const parentTargetRect = this.tree.processGap(parentNodeTarget); - previewParams = { - targetRect: parentTargetRect, - }; + if (isMonParent) { + childNode.createCon = true; + containerNode = parentNodeTarget; + referenceNode = nodeWinAtPointer; + previewParams = { + targetRect: targetRect, + }; + } else { + containerNode = parentNodeTarget; + referenceNode = null; + const parentTargetRect = this.tree.processGap(parentNodeTarget); + previewParams = { + targetRect: parentTargetRect, + }; + } } } } else if (isLeft) { @@ -2117,7 +2140,6 @@ export class WindowManager extends GObject.Object { } else if (isTop || isBottom) { childNode.layout = LAYOUT_TYPES.VSPLIT; } else if (isCenter) { - const centerLayout = this.ext.settings.get_string("dnd-center-layout").toUpperCase(); childNode.layout = LAYOUT_TYPES[centerLayout]; } } else if (childNode.detachWindow) { @@ -2125,6 +2147,9 @@ export class WindowManager extends GObject.Object { isLeft || isRight ? ORIENTATION_TYPES.HORIZONTAL : ORIENTATION_TYPES.VERTICAL; this.tree.split(childNode, orientation); containerNode.insertBefore(childNode.parentNode, referenceNode); + } else if (isCenter && centerLayout == "SWAP") { + this.tree.swapPairs(referenceNode, focusNodeWindow); + this.renderTree("drag-swap"); } else { // Child Node is a WINDOW containerNode.insertBefore(childNode, referenceNode); @@ -2134,11 +2159,11 @@ export class WindowManager extends GObject.Object { if (!stackedOrTabbed) containerNode.layout = LAYOUT_TYPES.VSPLIT; } else if (isCenter) { if (containerNode.isHSplit() || containerNode.isVSplit()) { - const centerLayout = this.ext.settings.get_string("dnd-center-layout").toUpperCase(); containerNode.layout = LAYOUT_TYPES[centerLayout]; } } } + previousParent.resetLayoutSingleChild(); } else { updatePreview(focusNodeWindow, previewParams); } @@ -2147,6 +2172,70 @@ export class WindowManager extends GObject.Object { } } + canMovePointerInsideNodeWindow(nodeWindow) { + if (nodeWindow && nodeWindow._data) { + const metaWindow = nodeWindow.nodeValue; + const metaRect = metaWindow.get_frame_rect(); + const pointerCoord = global.get_pointer(); + return ( + metaRect && + // xdg-copy creates a 1x1 pixel window to capture mouse events. + metaRect.width > 8 && + metaRect.height > 8 && + !Utils.rectContainsPoint(metaRect, pointerCoord) && + !metaWindow.minimized && + !Main.overview.visible && + !this.pointerIsOverParentDecoration(nodeWindow, pointerCoord) + ); + } + return false; + } + + pointerIsOverParentDecoration(nodeWindow, pointerCoord) { + if (pointerCoord && nodeWindow && nodeWindow.parentNode) { + let node = nodeWindow.parentNode; + if (node.isTabbed() || node.isStacked()) { + return Utils.rectContainsPoint(node.rect, pointerCoord); + } + } + return false; + } + + getPointerPositionInside(nodeWindow) { + if (nodeWindow && nodeWindow._data) { + const metaWindow = nodeWindow.nodeValue; + const metaRect = metaWindow.get_frame_rect(); + // on: last position of cursor inside window + // on: titlebar: near to app toolbars, menubar, tabs, etc... + let [wx, wy] = nodeWindow.pointer + ? [nodeWindow.pointer.x, nodeWindow.pointer.y] + : [metaRect.width / 2, 8]; + let px = wx >= metaRect.width ? metaRect.width - 8 : wx; + let py = wy >= metaRect.height ? metaRect.height - 8 : wy; + return { + x: metaRect.x + px, + y: metaRect.y + py, + }; + } + return null; + } + + storePointerLastPosition(nodeWindow) { + if (nodeWindow && nodeWindow._data) { + const metaWindow = nodeWindow.nodeValue; + const metaRect = metaWindow.get_frame_rect(); + const pointerCoord = global.get_pointer(); + if (Utils.rectContainsPoint(metaRect, pointerCoord)) { + let px = pointerCoord[0] - metaRect.x; + let py = pointerCoord[1] - metaRect.y; + if (px > 0 && py > 0) { + nodeWindow.pointer = { x: px, y: py }; + Logger.debug(`stored pointer for [${metaWindow.get_title()}] at (${px},${py})`); + } + } + } + } + findNodeWindowAtPointer(focusNodeWindow) { let pointerCoord = global.get_pointer(); @@ -2451,37 +2540,34 @@ export class WindowManager extends GObject.Object { knownFloats.filter((kf) => { let matchTitle = false; let matchClass = false; + let matchId = false; if (kf.wmTitle) { if (kf.wmTitle === " ") { matchTitle = kf.wmTitle === windowTitle; } else { let titles = kf.wmTitle.split(","); - matchTitle = titles.filter((t) => { - if (windowTitle) { - if (t.startsWith('!')) { - return !windowTitle.includes(t.slice(1)) - } else { - return windowTitle.includes(t) + matchTitle = + titles.filter((t) => { + if (windowTitle) { + if (t.startsWith("!")) { + return !windowTitle.includes(t.slice(1)); + } else { + return windowTitle.includes(t); + } } - } - return false - }).length > 0; + return false; + }).length > 0; } } if (kf.wmClass) { matchClass = kf.wmClass.includes(metaWindow.get_wm_class()); } - - if (kf.wmClass && kf.wmTitle) { - return matchTitle && matchClass; - } else { - if (kf.wmTitle) { - return matchTitle; - } else { - return matchClass; - } + if (kf.wmId) { + matchId = kf.wmId === metaWindow.get_id(); } + + return (!kf.wmId || matchId) && (!kf.wmTitle || matchTitle) && matchClass; }).length > 0; return floatByType || floatOverride; diff --git a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/prefs/settings.js b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/prefs/settings.js index cfc520a..9333fe2 100644 --- a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/prefs/settings.js +++ b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/lib/prefs/settings.js @@ -101,6 +101,7 @@ export class SettingsPage extends PreferencesPage { type: "s", bind: "dnd-center-layout", items: [ + { id: "swap", name: _("Swap") }, { id: "tabbed", name: _("Tabbed") }, { id: "stacked", name: _("Stacked") }, ], @@ -129,6 +130,19 @@ export class SettingsPage extends PreferencesPage { ], }); + this.add_group({ + title: _("Behavior"), + children: [ + new SwitchRow({ + title: _("Move Pointer with the Focus"), + subtitle: _("Move the pointer when focusing or swapping via keyboard"), + experimental: true, + settings, + bind: "move-pointer-focus-enabled", + }), + ], + }); + if (!production) { this.add_group({ title: _("Logger"), diff --git a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/locale/it/LC_MESSAGES/forge.mo b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/locale/it/LC_MESSAGES/forge.mo index 5532b20..39f77a4 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/locale/it/LC_MESSAGES/forge.mo and b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/locale/it/LC_MESSAGES/forge.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/locale/pt_BR/LC_MESSAGES/forge.mo b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/locale/pt_BR/LC_MESSAGES/forge.mo index 071947e..30dce8d 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/locale/pt_BR/LC_MESSAGES/forge.mo and b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/locale/pt_BR/LC_MESSAGES/forge.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/metadata.json b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/metadata.json index 56c7f83..dda6394 100644 --- a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/metadata.json @@ -9,9 +9,10 @@ ], "settings-schema": "org.gnome.shell.extensions.forge", "shell-version": [ - "45" + "45", + "46" ], "url": "https://github.com/forge-ext/forge", "uuid": "forge@jmmaranan.com", - "version": 77 + "version": 78 } \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/stylesheet.css b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/stylesheet.css index 4159ffc..5f62896 100644 --- a/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/stylesheet.css +++ b/gnome/.local/share/gnome-shell/extensions/forge@jmmaranan.com/stylesheet.css @@ -123,6 +123,14 @@ background-color: rgba(247, 162, 43, 0.3); } +.window-tilepreview-swap { + border-width: 1px; + border-color: rgba(162, 247, 43, 0.4); + border-style: solid; + border-radius: 14px; + background-color: rgba(162, 247, 43, 0.4); +} + .window-tilepreview-tabbed { border-width: 1px; border-color: rgba(18, 199, 224, 0.4); diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/extension.js b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/extension.js index 4c6a249..d2f3997 100644 --- a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/extension.js +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/extension.js @@ -9,6 +9,7 @@ import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; import * as QuickSettings from 'resource:///org/gnome/shell/ui/quickSettings.js'; import * as KeyboardManager from 'resource:///org/gnome/shell/misc/keyboardManager.js'; +import * as KeyboardUI from 'resource:///org/gnome/shell/ui/keyboard.js'; import { Dialog } from 'resource:///org/gnome/shell/ui/dialog.js'; import { Extension, gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; @@ -28,13 +29,13 @@ class KeyboardMenuToggle extends QuickSettings.QuickMenuToggle { this.extensionObject = extensionObject; this.settings = extensionObject.getSettings(); - + this.menu.setHeader('input-keyboard-symbolic', _('Screen Keyboard'), _('Opening Mode')); this._itemsSection = new PopupMenu.PopupMenuSection(); this._itemsSection.addMenuItem(new PopupMenu.PopupImageMenuItem(_('Never'), this.settings.get_int("enable-tap-gesture") == 0 ? 'emblem-ok-symbolic' : null)); - this._itemsSection.addMenuItem(new PopupMenu.PopupImageMenuItem(_("Only on Touch"), this.settings.get_int("enable-tap-gesture") == 1 ? 'emblem-ok-symbolic' : null)); - this._itemsSection.addMenuItem(new PopupMenu.PopupImageMenuItem(_("Always"), this.settings.get_int("enable-tap-gesture") == 2 ? 'emblem-ok-symbolic' : null)); - for (var i in this._itemsSection._getMenuItems()){ + this._itemsSection.addMenuItem(new PopupMenu.PopupImageMenuItem(_("Only on Touch"), this.settings.get_int("enable-tap-gesture") == 1 ? 'emblem-ok-symbolic' : null)); + this._itemsSection.addMenuItem(new PopupMenu.PopupImageMenuItem(_("Always"), this.settings.get_int("enable-tap-gesture") == 2 ? 'emblem-ok-symbolic' : null)); + for (var i in this._itemsSection._getMenuItems()) { const item = this._itemsSection._getMenuItems()[i] const num = i item.connect('activate', () => this.settings.set_int("enable-tap-gesture", num)) @@ -52,7 +53,7 @@ class KeyboardMenuToggle extends QuickSettings.QuickMenuToggle { } _refresh() { - for (var i in this._itemsSection._getMenuItems()){ + for (var i in this._itemsSection._getMenuItems()) { this._itemsSection._getMenuItems()[i].setIcon(this.settings.get_int("enable-tap-gesture") == i ? 'emblem-ok-symbolic' : null) } } @@ -97,7 +98,7 @@ export default class GjsOskExtension extends Extension { this.openInterval = setInterval(() => { this.Keyboard.get_parent().set_child_at_index(this.Keyboard, this.Keyboard.get_parent().get_n_children() - 1); this.Keyboard.set_child_at_index(this.Keyboard.box, this.Keyboard.get_n_children() - 1); - if (!this.Keyboard.openedFromButton && this.lastInputMethod) { + if (!this.Keyboard.openedFromButton && this.lastInputMethod) { if (Main.inputMethod.currentFocus != null && Main.inputMethod.currentFocus.is_focused() && !this.Keyboard.closedFromButton) { this._openKeyboard(); } else if (!this.Keyboard.closedFromButton) { @@ -123,6 +124,10 @@ export default class GjsOskExtension extends Extension { keycodes = JSON.parse(contents)[['qwerty', 'azerty', 'dvorak', "qwertz"][this.settings.get_int("lang")]]; } this.Keyboard = new Keyboard(this.settings); + + this._originalLastDeviceIsTouchscreen = KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen; + KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen = () => { return false }; + this._indicator = null; this.openInterval = null; if (this.settings.get_boolean("indicator-enabled")) { @@ -151,9 +156,9 @@ export default class GjsOskExtension extends Extension { this.open_interval(); } this.openFromCommandHandler = this.openBit.connect("changed", () => { - this.openBit.set_boolean("opened", false) - this._toggleKeyboard(); - }) + this.openBit.set_boolean("opened", false) + this._toggleKeyboard(); + }) this.settingsHandler = this.settings.connect("changed", key => { this.Keyboard.openedFromButton = false; let [ok, contents] = GLib.file_get_contents(this.path + '/keycodes.json'); @@ -175,7 +180,7 @@ export default class GjsOskExtension extends Extension { style_class: 'system-status-icon' }); this._indicator.add_child(icon); - + this._indicator.connect("button-press-event", () => this._toggleKeyboard()); this._indicator.connect("touch-event", (_actor, event) => { if (event.type() == 11) this._toggleKeyboard() @@ -222,6 +227,10 @@ export default class GjsOskExtension extends Extension { this.settings = null this.Keyboard = null keycodes = null + if (this._originalLastDeviceIsTouchscreen !== null) { + KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen = this._originalLastDeviceIsTouchscreen; + this._originalLastDeviceIsTouchscreen = null; + } } } @@ -237,10 +246,11 @@ class Keyboard extends Dialog { } _init(settings) { + this.inputDevice = Clutter.get_default_backend().get_default_seat().create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE); this.startupInterval = setInterval(() => { this.init = KeyboardManager.getKeyboardManager()._current.id; this.initLay = Object.keys(KeyboardManager.getKeyboardManager()._layoutInfos); - if (this.initLay == undefined || this.init == undefined) { + if (this.initLay == undefined || this.init == undefined || this.inputDevice == undefined) { return; } this.settings = settings; @@ -268,9 +278,8 @@ class Keyboard extends Dialog { this.delta = []; this.checkMonitor(); this._dragging = false; - this.inputDevice = Clutter.get_default_backend().get_default_seat().create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE); clearInterval(this.startupInterval); - }, 200); + }, 200); } destroy() { @@ -290,7 +299,7 @@ class Keyboard extends Dialog { clearInterval(this.textboxChecker); this.textboxChecker = null; } - if (this.stateTimeout !== null ) { + if (this.stateTimeout !== null) { clearTimeout(this.stateTimeout); this.stateTimeout = null; } @@ -316,7 +325,7 @@ class Keyboard extends Dialog { opacity: 200, duration: 100, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => {} + onComplete: () => { } }); let device = event.get_device(); let sequence = event.get_event_sequence(); @@ -356,7 +365,7 @@ class Keyboard extends Dialog { opacity: 255, duration: 100, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => {} + onComplete: () => { } }); this._grabbedSequence = null; this._grabbedDevice = null; @@ -410,17 +419,18 @@ class Keyboard extends Dialog { snapMovement(xPos, yPos) { let monitor = Main.layoutManager.primaryMonitor + let snap_px = this.settings.get_int("snap-spacing-px") if (Math.abs(xPos - ((monitor.width * .5) - ((this.width * .5)))) <= 50) { xPos = ((monitor.width * .5) - ((this.width * .5))); - } else if (Math.abs(xPos - 25) <= 50) { - xPos = 25; - } else if (Math.abs(xPos - (monitor.width - this.width - 25)) <= 50) { - xPos = monitor.width - this.width - 25 + } else if (Math.abs(xPos - snap_px) <= 50) { + xPos = snap_px; + } else if (Math.abs(xPos - (monitor.width - this.width - snap_px)) <= 50) { + xPos = monitor.width - this.width - snap_px } - if (Math.abs(yPos - (monitor.height - this.height - 25)) <= 50) { - yPos = monitor.height - this.height - 25; - } else if (Math.abs(yPos - 25) <= 50) { - yPos = 25; + if (Math.abs(yPos - (monitor.height - this.height - snap_px)) <= 50) { + yPos = monitor.height - this.height - snap_px; + } else if (Math.abs(yPos - snap_px) <= 50) { + yPos = snap_px; } else if (Math.abs(yPos - ((monitor.height * .5) - (this.height * .5))) <= 50) { yPos = (monitor.height * .5) - (this.height * .5); } @@ -442,7 +452,7 @@ class Keyboard extends Dialog { refresh() { let monitor = Main.layoutManager.primaryMonitor; this.box.remove_all_children(); - this.box.set_style_class_name("boxLay") + this.box.set_style_class_name("boxLay") this.widthPercent = (monitor.width > monitor.height) ? this.settings.get_int("landscape-width-percent") / 100 : this.settings.get_int("portrait-width-percent") / 100; this.heightPercent = (monitor.width > monitor.height) ? this.settings.get_int("landscape-height-percent") / 100 : this.settings.get_int("portrait-height-percent") / 100; this.buildUI(); @@ -468,12 +478,12 @@ class Keyboard extends Dialog { this.startupTimeout = setTimeout(() => { this.init = KeyboardManager.getKeyboardManager()._current.id; this.initLay = Object.keys(KeyboardManager.getKeyboardManager()._layoutInfos); - if (this.initLay == undefined || this.init == undefined) { + if (this.initLay == undefined || this.init == undefined) { this.refresh(); return; } this.close(); - }, 200); + }, 200); this.mod = []; this.modBtns = []; this.capsL = false; @@ -495,7 +505,7 @@ class Keyboard extends Dialog { this.startupTimeout = setTimeout(() => { this.init = KeyboardManager.getKeyboardManager()._current.id; this.initLay = Object.keys(KeyboardManager.getKeyboardManager()._layoutInfos); - if (this.initLay == undefined || this.init == undefined) { + if (this.initLay == undefined || this.init == undefined) { this.open(); return; } @@ -522,13 +532,13 @@ class Keyboard extends Dialog { this.state = "opened" }, 500); let monitor = Main.layoutManager.primaryMonitor; - let posX = [25, ((monitor.width * .5) - ((this.width * .5))), monitor.width - this.width - 25][(this.settings.get_int("default-snap") % 3)]; - let posY = [25, ((monitor.height * .5) - ((this.height * .5))), monitor.height - this.height - 25][Math.floor((this.settings.get_int("default-snap") / 3))]; + let posX = [this.settings.get_int("snap-spacing-px"), ((monitor.width * .5) - ((this.width * .5))), monitor.width - this.width - this.settings.get_int("snap-spacing-px")][(this.settings.get_int("default-snap") % 3)]; + let posY = [this.settings.get_int("snap-spacing-px"), ((monitor.height * .5) - ((this.height * .5))), monitor.height - this.height - this.settings.get_int("snap-spacing-px")][Math.floor((this.settings.get_int("default-snap") / 3))]; this.set_translation(posX, posY, 0); } }); this.opened = true; - }, 200); + }, 200); } close() { @@ -537,8 +547,8 @@ class Keyboard extends Dialog { KeyboardManager.getKeyboardManager().apply(this.init); } let monitor = Main.layoutManager.primaryMonitor; - let posX = [25, ((monitor.width * .5) - ((this.width * .5))), monitor.width - this.width - 25][(this.settings.get_int("default-snap") % 3)]; - let posY = [25, ((monitor.height * .5) - ((this.height * .5))), monitor.height - this.height - 25][Math.floor((this.settings.get_int("default-snap") / 3))]; + let posX = [this.settings.get_int("snap-spacing-px"), ((monitor.width * .5) - ((this.width * .5))), monitor.width - this.width - this.settings.get_int("snap-spacing-px")][(this.settings.get_int("default-snap") % 3)]; + let posY = [this.settings.get_int("snap-spacing-px"), ((monitor.height * .5) - ((this.height * .5))), monitor.height - this.height - this.settings.get_int("snap-spacing-px")][Math.floor((this.settings.get_int("default-snap") / 3))]; this.state = "closing" this.box.ease({ opacity: 0, @@ -559,39 +569,64 @@ class Keyboard extends Dialog { }, }); this.openedFromButton = false + this.releaseAllKeys(); } buildUI() { this.keys = []; let monitor = Main.layoutManager.primaryMonitor - var topRowWidth = Math.round(((monitor.width - 90) * this.widthPercent) / 15); - var topRowHeight = Math.round(((monitor.height - 190) * this.heightPercent) / 6); + var topRowWidth = Math.round((monitor.width - 40 - this.settings.get_int("snap-spacing-px") * 2) * this.widthPercent / 15) + var topRowHeight = Math.round((monitor.height - 140 - this.settings.get_int("snap-spacing-px") * 2) * this.heightPercent / 6) let row1 = new St.BoxLayout({ pack_start: true }); for (var num in keycodes.row1) { const i = keycodes.row1[num] + if (i.lowerName == "") { + i.lowerName = i._lowerName; + i.upperName = i._upperName; + } var w = topRowWidth; - row1.add_child(new St.Button({ - label: i.lowerName, + let params = { height: topRowHeight, width: w - })); - var isMod = false; - for (var j of [42, 54, 29, 125, 56, 100, 97, 58]) { - if (i.code == j) { - isMod = true; + } + let styleClass = "" + switch (i.lowerName) { + case "delete": + case "backspace": + case "tab": + case "capslock": + case "shift": + case "enter": + case "ctrl": + case "super": + case "alt": + case "space": + case "left": + case "up": + case "down": + case "right": + styleClass = i.lowerName; + i._lowerName = i.lowerName; + i._upperName = i.upperName; + i.lowerName = ""; + i.upperName = ""; break; - } + default: + params.label = i.lowerName; + break; + } + row1.add_child(new St.Button(params)); + if (styleClass != "") { + row1.get_children()[num].add_style_class_name(styleClass + "_btn"); + } + i.isMod = false + if ([42, 54, 29, 125, 56, 100, 97, 58].some(j => { return i.code == j })) { + i.isMod = true; } row1.get_children()[num].char = i; - if (!isMod) { - row1.get_children()[num].connect("clicked", () => this.decideMod(i)) - } else { - const modButton = row1.get_children()[num]; - row1.get_children()[num].connect("clicked", () => this.decideMod(i, modButton)) - } } this.keys.push.apply(this.keys, row1.get_children()); row1.add_style_class_name("keysHolder"); @@ -600,6 +635,10 @@ class Keyboard extends Dialog { }); for (var num in keycodes.row2) { const i = keycodes.row2[num] + if (i.lowerName == "") { + i.lowerName = i._lowerName; + i.upperName = i._upperName; + } var w; if (num == 0) { w = ((row1.width - ((keycodes.row2.length - 2) * ((topRowWidth) + 5))) / 2) * 0.5; @@ -608,25 +647,45 @@ class Keyboard extends Dialog { } else { w = (topRowWidth) + 5; } - row2.add_child(new St.Button({ - label: i.lowerName, + let params = { height: topRowHeight + 20, width: w - })); - var isMod = false; - for (var j of [42, 54, 29, 125, 56, 100, 97, 58]) { - if (i.code == j) { - isMod = true; + } + let styleClass = "" + switch (i.lowerName) { + case "delete": + case "backspace": + case "tab": + case "capslock": + case "shift": + case "enter": + case "ctrl": + case "super": + case "alt": + case "space": + case "left": + case "up": + case "down": + case "right": + styleClass = i.lowerName; + i._lowerName = i.lowerName; + i._upperName = i.upperName; + i.lowerName = ""; + i.upperName = ""; break; - } + default: + params.label = i.lowerName; + break; + } + row2.add_child(new St.Button(params)); + if (styleClass != "") { + row2.get_children()[num].add_style_class_name(styleClass + "_btn"); + } + i.isMod = false + if ([42, 54, 29, 125, 56, 100, 97, 58].some(j => { return i.code == j })) { + i.isMod = true; } row2.get_children()[num].char = i; - if (!isMod) { - row2.get_children()[num].connect("clicked", () => this.decideMod(i)) - } else { - const modButton = row2.get_children()[num]; - row2.get_children()[num].connect("clicked", () => this.decideMod(i, modButton)) - } } this.keys.push.apply(this.keys, row2.get_children()); row2.add_style_class_name("keysHolder"); @@ -635,6 +694,10 @@ class Keyboard extends Dialog { }); for (var num in keycodes.row3) { const i = keycodes.row3[num] + if (i.lowerName == "") { + i.lowerName = i._lowerName; + i.upperName = i._upperName; + } var w; if (num == 0) { w = ((row1.width - ((keycodes.row3.length - 2) * ((topRowWidth) + 5))) / 2) * 1.1; @@ -643,25 +706,45 @@ class Keyboard extends Dialog { } else { w = (topRowWidth) + 5; } - row3.add_child(new St.Button({ - label: i.lowerName, + let params = { height: topRowHeight + 20, width: w - })); - var isMod = false; - for (var j of [42, 54, 29, 125, 56, 100, 97, 58]) { - if (i.code == j) { - isMod = true; + } + let styleClass = "" + switch (i.lowerName) { + case "delete": + case "backspace": + case "tab": + case "capslock": + case "shift": + case "enter": + case "ctrl": + case "super": + case "alt": + case "space": + case "left": + case "up": + case "down": + case "right": + styleClass = i.lowerName; + i._lowerName = i.lowerName; + i._upperName = i.upperName; + i.lowerName = ""; + i.upperName = ""; break; - } + default: + params.label = i.lowerName; + break; + } + row3.add_child(new St.Button(params)); + if (styleClass != "") { + row3.get_children()[num].add_style_class_name(styleClass + "_btn"); + } + i.isMod = false + if ([42, 54, 29, 125, 56, 100, 97, 58].some(j => { return i.code == j })) { + i.isMod = true; } row3.get_children()[num].char = i; - if (!isMod) { - row3.get_children()[num].connect("clicked", () => this.decideMod(i)) - } else { - const modButton = row3.get_children()[num]; - row3.get_children()[num].connect("clicked", () => this.decideMod(i, modButton)) - } } this.keys.push.apply(this.keys, row3.get_children()); row3.add_style_class_name("keysHolder"); @@ -670,31 +753,55 @@ class Keyboard extends Dialog { }); for (var num in keycodes.row4) { const i = keycodes.row4[num] + if (i.lowerName == "") { + i.lowerName = i._lowerName; + i.upperName = i._upperName; + } var w; if (num == 0 || num == keycodes.row4.length - 1) { w = ((row1.width - ((keycodes.row4.length - 2) * ((topRowWidth) + 5))) / 2); } else { w = (topRowWidth) + 5; } - row4.add_child(new St.Button({ - label: i.lowerName, + let params = { height: topRowHeight + 20, width: w - })); - var isMod = false; - for (var j of [42, 54, 29, 125, 56, 100, 97, 58]) { - if (i.code == j) { - isMod = true; + } + let styleClass = "" + switch (i.lowerName) { + case "delete": + case "backspace": + case "tab": + case "capslock": + case "shift": + case "enter": + case "ctrl": + case "super": + case "alt": + case "space": + case "left": + case "up": + case "down": + case "right": + styleClass = i.lowerName; + i._lowerName = i.lowerName; + i._upperName = i.upperName; + i.lowerName = ""; + i.upperName = ""; break; - } + default: + params.label = i.lowerName; + break; + } + row4.add_child(new St.Button(params)); + if (styleClass != "") { + row4.get_children()[num].add_style_class_name(styleClass + "_btn"); + } + i.isMod = false + if ([42, 54, 29, 125, 56, 100, 97, 58].some(j => { return i.code == j })) { + i.isMod = true; } row4.get_children()[num].char = i; - if (!isMod) { - row4.get_children()[num].connect("clicked", () => this.decideMod(i)) - } else { - const modButton = row4.get_children()[num]; - row4.get_children()[num].connect("clicked", () => this.decideMod(i, modButton)) - } } this.keys.push.apply(this.keys, row4.get_children()); row4.add_style_class_name("keysHolder"); @@ -703,31 +810,55 @@ class Keyboard extends Dialog { }); for (var num in keycodes.row5) { const i = keycodes.row5[num] + if (i.lowerName == "") { + i.lowerName = i._lowerName; + i.upperName = i._upperName; + } var w; if (num == 0 || num == keycodes.row5.length - 1) { w = ((row1.width - ((keycodes.row5.length - 2) * ((topRowWidth) + 5))) / 2); } else { w = (topRowWidth) + 5; } - row5.add_child(new St.Button({ - label: i.lowerName, + let params = { height: topRowHeight + 20, width: w - })); - var isMod = false; - for (var j of [42, 54, 29, 125, 56, 100, 97, 58]) { - if (i.code == j) { - isMod = true; + } + let styleClass = "" + switch (i.lowerName) { + case "delete": + case "backspace": + case "tab": + case "capslock": + case "shift": + case "enter": + case "ctrl": + case "super": + case "alt": + case "space": + case "left": + case "up": + case "down": + case "right": + styleClass = i.lowerName; + i._lowerName = i.lowerName; + i._upperName = i.upperName; + i.lowerName = ""; + i.upperName = ""; break; - } + default: + params.label = i.lowerName; + break; + } + row5.add_child(new St.Button(params)); + if (styleClass != "") { + row5.get_children()[num].add_style_class_name(styleClass + "_btn"); + } + i.isMod = false + if ([42, 54, 29, 125, 56, 100, 97, 58].some(j => { return i.code == j })) { + i.isMod = true; } row5.get_children()[num].char = i; - if (!isMod) { - row5.get_children()[num].connect("clicked", () => this.decideMod(i)) - } else { - const modButton = row5.get_children()[num]; - row5.get_children()[num].connect("clicked", () => this.decideMod(i, modButton)) - } } this.keys.push.apply(this.keys, row5.get_children()); row5.add_style_class_name("keysHolder"); @@ -736,52 +867,72 @@ class Keyboard extends Dialog { }); for (var num in keycodes.row6) { const i = keycodes.row6[num] + if (i.lowerName == "") { + i.lowerName = i._lowerName; + i.upperName = i._upperName; + } var w; if (num == 3) { w = ((row1.width - ((keycodes.row6.length + 1) * ((topRowWidth) + 5)))); - row6.add_child(new St.Button({ - label: i.lowerName, + let params = { height: topRowHeight + 20, width: w - })); - var isMod = false; - for (var j of [42, 54, 29, 125, 56, 100, 97, 58]) { - if (i.code == j) { - isMod = true; + } + let styleClass = "" + switch (i.lowerName) { + case "delete": + case "backspace": + case "tab": + case "capslock": + case "shift": + case "enter": + case "ctrl": + case "super": + case "alt": + case "space": + case "left": + case "up": + case "down": + case "right": + styleClass = i.lowerName; + i._lowerName = i.lowerName; + i._upperName = i.upperName; + i.lowerName = ""; + i.upperName = ""; break; - } + default: + params.label = i.lowerName; + break; + } + row6.add_child(new St.Button(params)); + if (styleClass != "") { + row6.get_children()[num].add_style_class_name(styleClass + "_btn"); + } + i.isMod = false + if ([42, 54, 29, 125, 56, 100, 97, 58].some(j => { return i.code == j })) { + i.isMod = true; } row6.get_children()[num].char = i; this.keys.push(row6.get_children()[num]); - if (!isMod) { - row6.get_children()[num].connect("clicked", () => this.decideMod(i)) - } else { - const modButton = row6.get_children()[num]; - row6.get_children()[num].connect("clicked", () => this.decideMod(i, modButton)) - } } else if (num == keycodes.row6.length - 1) { var gbox = new St.BoxLayout({ pack_start: true }); - var btn1 = new St.Button({ - label: (keycodes.row6[keycodes.row6.length - 1])[0].lowerName - }); + var btn1 = new St.Button(); + btn1.add_style_class_name("left_btn"); gbox.add_child(btn1); var vbox = new St.BoxLayout({ vertical: true }); - var btn2 = new St.Button({ - label: (keycodes.row6[keycodes.row6.length - 1])[1].lowerName - }); - var btn3 = new St.Button({ - label: (keycodes.row6[keycodes.row6.length - 1])[2].lowerName - }); + var btn2 = new St.Button(); + btn2.add_style_class_name("up_btn"); + var btn3 = new St.Button(); + btn3.add_style_class_name("down_btn"); vbox.add_child(btn2); vbox.add_child(btn3); gbox.add_child(vbox); - var btn4 = new St.Button({ - label: (keycodes.row6[keycodes.row6.length - 1])[3].lowerName - }); + var btn4 = new St.Button(); + btn4.add_style_class_name("right_btn"); gbox.add_child(btn4); var btn5 = new St.Button(); btn5.add_style_class_name("move_btn") @@ -791,10 +942,6 @@ class Keyboard extends Dialog { gbox.add_child(btn5); } gbox.add_child(btn6); - btn1.connect("clicked", () => this.decideMod((keycodes.row6[keycodes.row6.length - 1])[0])) - btn2.connect("clicked", () => this.decideMod((keycodes.row6[keycodes.row6.length - 1])[1])) - btn3.connect("clicked", () => this.decideMod((keycodes.row6[keycodes.row6.length - 1])[2])) - btn4.connect("clicked", () => this.decideMod((keycodes.row6[keycodes.row6.length - 1])[3])) btn5.connect("clicked", () => { if (this.settings.get_boolean("enable-drag")) { this.draggable = !this.draggable; @@ -820,13 +967,13 @@ class Keyboard extends Dialog { width: btn5.width * (this.draggable ? 2 : 0.5), duration: 100, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => {} + onComplete: () => { } }) btn6.ease({ width: this.draggable ? 0 : btn5.width / 2, duration: 100, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => {} + onComplete: () => { } }) } }) @@ -835,6 +982,14 @@ class Keyboard extends Dialog { btn2.char = (keycodes.row6[keycodes.row6.length - 1])[1] btn3.char = (keycodes.row6[keycodes.row6.length - 1])[2] btn4.char = (keycodes.row6[keycodes.row6.length - 1])[3] + btn1.char.lowerName = "" + btn1.char.upperName = "" + btn2.char.lowerName = "" + btn2.char.upperName = "" + btn3.char.lowerName = "" + btn3.char.upperName = "" + btn4.char.lowerName = "" + btn4.char.upperName = "" btn1.width = Math.round((((topRowWidth) + 5)) * (2 / 3)); btn1.height = topRowHeight + 20; btn2.width = Math.round((((topRowWidth) + 5)) * (2 / 3)); @@ -858,27 +1013,46 @@ class Keyboard extends Dialog { row6.add_child(gbox); } else { w = (topRowWidth) + 5; - row6.add_child(new St.Button({ - label: i.lowerName, + let params = { height: topRowHeight + 20, width: w - })); - - var isMod = false; - for (var j of [42, 54, 29, 125, 56, 100, 97, 58]) { - if (i.code == j) { - isMod = true; + } + let styleClass = "" + switch (i.lowerName) { + case "delete": + case "backspace": + case "tab": + case "capslock": + case "shift": + case "enter": + case "ctrl": + case "super": + case "alt": + case "space": + case "left": + case "up": + case "down": + case "right": + styleClass = i.lowerName; + i._lowerName = i.lowerName; + i._upperName = i.upperName; + i.lowerName = ""; + i.upperName = ""; break; - } + default: + params.label = i.lowerName; + break; + } + row6.add_child(new St.Button(params)); + if (styleClass != "") { + row6.get_children()[num].add_style_class_name(styleClass + "_btn"); + } + i.isMod = false + if ([42, 54, 29, 125, 56, 100, 97, 58].some(j => { return i.code == j })) { + i.isMod = true; } row6.get_children()[num].char = i; this.keys.push(row6.get_children()[num]); - if (!isMod) { - row6.get_children()[num].connect("clicked", () => this.decideMod(i)) - } else { - const modButton = row6.get_children()[num]; - row6.get_children()[num].connect("clicked", () => this.decideMod(i, modButton)) - } } } row6.add_style_class_name("keysHolder"); @@ -889,136 +1063,138 @@ class Keyboard extends Dialog { this.box.add_child(row4); this.box.add_child(row5); this.box.add_child(row6); - var containers_ = this.box.get_children(); - if (this.lightOrDark(this.settings.get_double("background-r"), this.settings.get_double("background-g"), this.settings.get_double("background-b"))) { + if (this.lightOrDark(this.settings.get_double("background-r"), this.settings.get_double("background-g"), this.settings.get_double("background-b"))) { this.box.add_style_class_name("inverted"); } else { this.box.add_style_class_name("regular"); } this.keys.forEach(item => { - item.width -= this.settings.get_int("border-spacing-px") * 2; - item.height -= this.settings.get_int("border-spacing-px") * 2; - item.set_style("margin: " + this.settings.get_int("border-spacing-px") + "px; font-size: " + this.settings.get_int("font-size-px") + "px; border-radius: " + (this.settings.get_boolean("round-key-corners") ? "5px;" : "0;") + "background-size: " + this.settings.get_int("font-size-px") + "px;"); + item.set_scale((item.width - this.settings.get_int("border-spacing-px") * 2) / item.width, (item.height - this.settings.get_int("border-spacing-px") * 2) / item.height); + item.set_style("font-size: " + this.settings.get_int("font-size-px") + "px; border-radius: " + (this.settings.get_boolean("round-key-corners") ? "5px;" : "0;") + "background-size: " + this.settings.get_int("font-size-px") + "px;"); if (this.lightOrDark(this.settings.get_double("background-r"), this.settings.get_double("background-g"), this.settings.get_double("background-b"))) { item.add_style_class_name("inverted"); } else { item.add_style_class_name("regular"); } - let isMod = false - for (var j of [42, 54, 29, 125, 56, 100, 97, 58]) { - try { - if (item.char.code == j) { - isMod = true; - break; - } - } catch { - print(item) - } - } item.set_pivot_point(0.5, 0.5) item.connect("destroy", () => { - if (item.button_pressed !== null){ + if (item.button_pressed !== null) { clearTimeout(item.button_pressed) item.button_pressed == null } - if (item.button_repeat !== null){ + if (item.button_repeat !== null) { clearInterval(item.button_repeat) item.button_repeat == null } - if (item.tap_pressed !== null){ - clearTimeout(item.tap_pressed) - item.tap_pressed == null + if (item.tap_pressed !== null) { + clearTimeout(item.tap_pressed) + item.tap_pressed == null } - if (item.tap_repeat !== null){ + if (item.tap_repeat !== null) { clearInterval(item.tap_repeat) item.tap_repeat == null } }) - item.connect("button-press-event", () => { + let pressEv = (evType) => { + item.space_motion_handler = null item.set_scale(1.2, 1.2) + item.add_style_pseudo_class("pressed") let player if (this.settings.get_boolean("play-sound")) { player = global.display.get_sound_player(); player.play_from_theme("dialog-information", "tap", null) } - item.button_pressed = setTimeout(() => { - if (!isMod) { + if (["delete_btn", "backspace_btn", "up_btn", "down_btn", "left_btn", "right_btn"].some(e => item.has_style_class_name(e))) { + item.button_pressed = setTimeout(() => { const oldModBtns = this.modBtns item.button_repeat = setInterval(() => { if (this.settings.get_boolean("play-sound")) { player.play_from_theme("dialog-information", "tap", null) } this.decideMod(item.char) - + for (var i of oldModBtns) { this.decideMod(i.char, i) } }, 100); - - } - }, 750); - }) - item.connect("button-release-event", () => { + }, 750); + } else if (item.has_style_class_name("space_btn")) { + item.button_pressed = setTimeout(() => { + let lastPos = (item.get_transformed_position()[0] + item.get_transformed_size()[0] / 2) + if (evType == "mouse") { + item.space_motion_handler = item.connect("motion_event", (actor, event) => { + let absX = event.get_coords()[0]; + if (Math.abs(absX - lastPos) > 20) { + if (absX > lastPos) { + this.sendKey([106]) + } else { + this.sendKey([105]) + } + lastPos = absX + } + }) + } else { + item.space_motion_handler = item.connect("touch_event", (actor, event) => { + if (event.type() == Clutter.EventType.TOUCH_UPDATE) { + let absX = event.get_coords()[0]; + if (Math.abs(absX - lastPos) > 20) { + if (absX > lastPos) { + this.sendKey([106]) + } else { + this.sendKey([105]) + } + lastPos = absX + } + } + }) + } + }, 750) + } else { + item.key_pressed = true; + item.button_pressed = setTimeout(() => { + releaseEv() + }, 1000); + } + } + let releaseEv = () => { + item.remove_style_pseudo_class("pressed") item.ease({ - scale_x: 1, - scale_y: 1, + scale_x: (item.width - this.settings.get_int("border-spacing-px") * 2) / item.width, + scale_y: (item.height - this.settings.get_int("border-spacing-px") * 2) / item.height, duration: 100, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => {item.set_scale(1, 1)} + onComplete: () => { item.set_scale((item.width - this.settings.get_int("border-spacing-px") * 2) / item.width, (item.height - this.settings.get_int("border-spacing-px") * 2) / item.height); } }) - if (item.button_pressed !== null){ + if (item.button_pressed !== null) { clearTimeout(item.button_pressed) item.button_pressed == null } - if (item.button_repeat !== null){ + if (item.button_repeat !== null) { clearInterval(item.button_repeat) item.button_repeat == null } - }) + if (item.space_motion_handler !== null) { + item.disconnect(item.space_motion_handler) + item.space_motion_handler = null; + } else if (item.key_pressed == true || item.space_motion_handler == null) { + try { + if (!item.char.isMod) { + this.decideMod(item.char) + } else { + const modButton = item; + this.decideMod(item.char, modButton) + } + } catch { } + } + item.key_pressed = false; + } + item.connect("button-press-event", () => pressEv("mouse")) + item.connect("button-release-event", releaseEv) item.connect("touch-event", () => { if (Clutter.get_current_event().type() == Clutter.EventType.TOUCH_BEGIN) { - item.set_scale(1.2, 1.2) - let player - if (this.settings.get_boolean("play-sound")) { - player = global.display.get_sound_player(); - player.play_from_theme("dialog-information", "tap", null) - } - - item.tap_pressed = setTimeout(() => { - - - if (!isMod) { - const oldModBtns = this.modBtns - item.tap_repeat = setInterval(() => { - - if (this.settings.get_boolean("play-sound")) { - player.play_from_theme("dialog-information", "tap", null) - } - this.decideMod(item.char) - - for (var i of oldModBtns) { - this.decideMod(i.char, i) - } - }, 100); - - } - }, 750); - } else if (Clutter.get_current_event().type() == Clutter.EventType.TOUCH_END) { - item.ease({ - scale_x: 1, - scale_y: 1, - duration: 100, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => {item.set_scale(1, 1)} - }) - if (item.tap_pressed !== null){ - clearTimeout(item.tap_pressed) - item.tap_pressed == null - } - if (item.tap_repeat !== null){ - clearInterval(item.tap_repeat) - item.tap_repeat == null - } + pressEv("touch") + } else if (Clutter.get_current_event().type() == Clutter.EventType.TOUCH_END || Clutter.get_current_event().type() == Clutter.EventType.TOUCH_CANCEL) { + releaseEv() } }) }); @@ -1037,7 +1213,42 @@ class Keyboard extends Dialog { return false; } } + releaseAllKeys() { + let instances = []; + function traverse(obj) { + for (let key in obj) { + if (obj.hasOwnProperty(key)) { + if (key === "code") { + instances.push(obj[key]); + } else if (typeof obj[key] === 'object' && obj[key] !== null) { + traverse(obj[key]); + } + } + } + } + + traverse(keycodes); + instances.forEach(i => { + this.inputDevice.notify_key(Clutter.get_current_event_time(), i, Clutter.KeyState.RELEASED); + }) + + this.keys.forEach(item => { + item.key_pressed = false; + if (item.button_pressed !== null) { + clearTimeout(item.button_pressed) + item.button_pressed == null + } + if (item.button_repeat !== null) { + clearInterval(item.button_repeat) + item.button_repeat == null + } + if (item.space_motion_handler !== null) { + item.disconnect(item.space_motion_handler) + item.space_motion_handler = null; + } + }) + } sendKey(keys) { try { for (var i = 0; i < keys.length; i++) { @@ -1068,23 +1279,6 @@ class Keyboard extends Dialog { } } - sendCommand(command_line) { - try { - let [success, argv] = GLib.shell_parse_argv(command_line); - trySpawn(argv); - } catch (err) { - let source = new imports.ui.messageTray.SystemNotificationSource(); - source.connect('destroy', () => { - source = null; - }) - Main.messageTray.add(source); - let notification = new imports.ui.messageTray.Notification(source, "GJS-OSK: An unknown error occured", "Please report this bug to the Issues page:\n\n" + err) - notification.setTransient(false); - notification.setResident(false); - source.showNotification(notification); - } - } - decideMod(i, mBtn) { if (i.code == 29 || i.code == 97 || i.code == 125) { this.setNormMod(mBtn); diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/keycodes.json b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/keycodes.json index 29626eb..4ff54b4 100644 --- a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/keycodes.json +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/keycodes.json @@ -87,8 +87,8 @@ }, { "code": 111, - "lowerName": "⌦", - "upperName": "⌦", + "lowerName": "delete", + "upperName": "delete", "altName": "" } ], @@ -173,16 +173,16 @@ }, { "code": 14, - "lowerName": "⌫", - "upperName": "⌫", + "lowerName": "backspace", + "upperName": "backspace", "altName": "" } ], "row3": [ { "code": 15, - "lowerName": "⇥", - "upperName": "⇥", + "lowerName": "tab", + "upperName": "tab", "altName": "" }, { @@ -277,8 +277,8 @@ "row4": [ { "code": 58, - "lowerName": "⇪", - "upperName": "⇪", + "lowerName": "capslock", + "upperName": "capslock", "altName": "" }, { @@ -358,16 +358,16 @@ }, { "code": 28, - "lowerName": "⏎", - "upperName": "⏎", + "lowerName": "enter", + "upperName": "enter", "altName": "" } ], "row5": [ { "code": 42, - "lowerName": "⇧", - "upperName": "⇧", + "lowerName": "shift", + "upperName": "shift", "altName": "" }, { @@ -439,71 +439,71 @@ }, { "code": 54, - "lowerName": "⇧", - "upperName": "⇧", + "lowerName": "shift", + "upperName": "shift", "altName": "" } ], "row6": [ { "code": 29, - "lowerName": "⌃", - "upperName": "⌃", + "lowerName": "ctrl", + "upperName": "ctrl", "altName": "" }, { "code": 125, - "lowerName": "❖", - "upperName": "❖", + "lowerName": "super", + "upperName": "super", "altName": "" }, { "code": 56, - "lowerName": "⌥", - "upperName": "⌥", + "lowerName": "alt", + "upperName": "alt", "altName": "" }, { "code": 57, - "lowerName": "␣", - "upperName": "␣", + "lowerName": "space", + "upperName": "space", "altName": "" }, { "code": 100, - "lowerName": "⌥", - "upperName": "⌥", + "lowerName": "alt", + "upperName": "alt", "altName": "" }, { "code": 97, - "lowerName": "⌃", - "upperName": "⌃", + "lowerName": "ctrl", + "upperName": "ctrl", "altName": "" }, [ { "code": 105, - "lowerName": "←", - "upperName": "←", + "lowerName": "left", + "upperName": "left", "altName": "" }, { "code": 103, - "lowerName": "↑", - "upperName": "↑", + "lowerName": "up", + "upperName": "up", "altName": "" }, { "code": 108, - "lowerName": "↓", - "upperName": "↓", + "lowerName": "down", + "upperName": "down", "altName": "" }, { "code": 106, - "lowerName": "→", - "upperName": "→", + "lowerName": "right", + "upperName": "right", "altName": "" } ] @@ -597,8 +597,8 @@ }, { "code": 111, - "lowerName": "⌦", - "upperName": "⌦", + "lowerName": "delete", + "upperName": "delete", "altName": "" } ], @@ -687,16 +687,16 @@ }, { "code": 14, - "lowerName": "⌫", - "upperName": "⌫", + "lowerName": "backspace", + "upperName": "backspace", "altName": "" } ], "row3": [ { "code": 15, - "lowerName": "⇥", - "upperName": "⇥", + "lowerName": "tab", + "upperName": "tab", "altName": "" }, { @@ -791,8 +791,8 @@ "row4": [ { "code": 58, - "lowerName": "⇪", - "upperName": "⇪", + "lowerName": "capslock", + "upperName": "capslock", "altName": "" }, { @@ -874,16 +874,16 @@ }, { "code": 28, - "lowerName": "⏎", - "upperName": "⏎", + "lowerName": "enter", + "upperName": "enter", "altName": "" } ], "row5": [ { "code": 42, - "lowerName": "⇧", - "upperName": "⇧", + "lowerName": "shift", + "upperName": "shift", "altName": "" }, { @@ -960,71 +960,71 @@ }, { "code": 54, - "lowerName": "⇧", - "upperName": "⇧", + "lowerName": "shift", + "upperName": "shift", "altName": "" } ], "row6": [ { "code": 29, - "lowerName": "⌃", - "upperName": "⌃", + "lowerName": "ctrl", + "upperName": "ctrl", "altName": "" }, { "code": 125, - "lowerName": "❖", - "upperName": "❖", + "lowerName": "super", + "upperName": "super", "altName": "" }, { "code": 56, - "lowerName": "⌥", - "upperName": "⌥", + "lowerName": "alt", + "upperName": "alt", "altName": "" }, { "code": 57, - "lowerName": "␣", - "upperName": "␣", + "lowerName": "space", + "upperName": "space", "altName": "" }, { "code": 100, - "lowerName": "⌥", - "upperName": "⌥", + "lowerName": "alt", + "upperName": "alt", "altName": "" }, { "code": 97, - "lowerName": "⌃", - "upperName": "⌃", + "lowerName": "ctrl", + "upperName": "ctrl", "altName": "" }, [ { "code": 105, - "lowerName": "←", - "upperName": "←", + "lowerName": "left", + "upperName": "left", "altName": "" }, { "code": 103, - "lowerName": "↑", - "upperName": "↑", + "lowerName": "up", + "upperName": "up", "altName": "" }, { "code": 108, - "lowerName": "↓", - "upperName": "↓", + "lowerName": "down", + "upperName": "down", "altName": "" }, { "code": 106, - "lowerName": "→", - "upperName": "→", + "lowerName": "right", + "upperName": "right", "altName": "" } ] @@ -1118,8 +1118,8 @@ }, { "code": 111, - "lowerName": "⌦", - "upperName": "⌦", + "lowerName": "delete", + "upperName": "delete", "altName": "" } ], @@ -1204,16 +1204,16 @@ }, { "code": 14, - "lowerName": "⌫", - "upperName": "⌫", + "lowerName": "backspace", + "upperName": "backspace", "altName": "" } ], "row3": [ { "code": 15, - "lowerName": "⇥", - "upperName": "⇥", + "lowerName": "tab", + "upperName": "tab", "altName": "" }, { @@ -1305,8 +1305,8 @@ "row4": [ { "code": 58, - "lowerName": "⇪", - "upperName": "⇪", + "lowerName": "capslock", + "upperName": "capslock", "altName": "" }, { @@ -1387,16 +1387,16 @@ }, { "code": 28, - "lowerName": "⏎", - "upperName": "⏎", + "lowerName": "enter", + "upperName": "enter", "altName": "" } ], "row5": [ { "code": 42, - "lowerName": "⇧", - "upperName": "⇧", + "lowerName": "shift", + "upperName": "shift", "altName": "" }, { @@ -1470,71 +1470,71 @@ }, { "code": 54, - "lowerName": "⇧", - "upperName": "⇧", + "lowerName": "shift", + "upperName": "shift", "altName": "" } ], "row6": [ { "code": 29, - "lowerName": "⌃", - "upperName": "⌃", + "lowerName": "ctrl", + "upperName": "ctrl", "altName": "" }, { "code": 125, - "lowerName": "❖", - "upperName": "❖", + "lowerName": "super", + "upperName": "super", "altName": "" }, { "code": 56, - "lowerName": "⌥", - "upperName": "⌥", + "lowerName": "alt", + "upperName": "alt", "altName": "" }, { "code": 57, - "lowerName": "␣", - "upperName": "␣", + "lowerName": "space", + "upperName": "space", "altName": "" }, { "code": 100, - "lowerName": "⌥", - "upperName": "⌥", + "lowerName": "alt", + "upperName": "alt", "altName": "" }, { "code": 97, - "lowerName": "⌃", - "upperName": "⌃", + "lowerName": "ctrl", + "upperName": "ctrl", "altName": "" }, [ { "code": 105, - "lowerName": "←", - "upperName": "←", + "lowerName": "left", + "upperName": "left", "altName": "" }, { "code": 103, - "lowerName": "↑", - "upperName": "↑", + "lowerName": "up", + "upperName": "up", "altName": "" }, { "code": 108, - "lowerName": "↓", - "upperName": "↓", + "lowerName": "down", + "upperName": "down", "altName": "" }, { "code": 106, - "lowerName": "→", - "upperName": "→", + "lowerName": "right", + "upperName": "right", "altName": "" } ] @@ -1628,8 +1628,8 @@ }, { "code": 111, - "lowerName": "⌦", - "upperName": "⌦", + "lowerName": "delete", + "upperName": "delete", "altName": "" } ], @@ -1714,16 +1714,16 @@ }, { "code": 14, - "lowerName": "⌫", - "upperName": "⌫", + "lowerName": "backspace", + "upperName": "backspace", "altName": "" } ], "row3": [ { "code": 15, - "lowerName": "⇥", - "upperName": "⇥", + "lowerName": "tab", + "upperName": "tab", "altName": "" }, { @@ -1780,7 +1780,7 @@ "lowerName": "i", "letter": "primary", "upperName": "I", - "altName": "→" + "altName": "right" }, { "code": 24, @@ -1819,8 +1819,8 @@ "row4": [ { "code": 58, - "lowerName": "⇪", - "upperName": "⇪", + "lowerName": "capslock", + "upperName": "capslock", "altName": "" }, { @@ -1902,16 +1902,16 @@ }, { "code": 28, - "lowerName": "⏎", - "upperName": "⏎", + "lowerName": "enter", + "upperName": "enter", "altName": "" } ], "row5": [ { "code": 42, - "lowerName": "⇧", - "upperName": "⇧", + "lowerName": "shift", + "upperName": "shift", "altName": "" }, { @@ -1989,71 +1989,71 @@ }, { "code": 54, - "lowerName": "⇧", - "upperName": "⇧", + "lowerName": "shift", + "upperName": "shift", "altName": "" } ], "row6": [ { "code": 29, - "lowerName": "⌃", - "upperName": "⌃", + "lowerName": "ctrl", + "upperName": "ctrl", "altName": "" }, { "code": 125, - "lowerName": "❖", - "upperName": "❖", + "lowerName": "super", + "upperName": "super", "altName": "" }, { "code": 56, - "lowerName": "⌥", - "upperName": "⌥", + "lowerName": "alt", + "upperName": "alt", "altName": "" }, { "code": 57, - "lowerName": "␣", - "upperName": "␣", + "lowerName": "space", + "upperName": "space", "altName": "" }, { "code": 100, - "lowerName": "⌥", - "upperName": "⌥", + "lowerName": "alt", + "upperName": "alt", "altName": "" }, { "code": 97, - "lowerName": "⌃", - "upperName": "⌃", + "lowerName": "ctrl", + "upperName": "ctrl", "altName": "" }, [ { "code": 105, - "lowerName": "←", - "upperName": "←", + "lowerName": "left", + "upperName": "left", "altName": "" }, { "code": 103, - "lowerName": "↑", - "upperName": "↑", + "lowerName": "up", + "upperName": "up", "altName": "" }, { "code": 108, - "lowerName": "↓", - "upperName": "↓", + "lowerName": "down", + "upperName": "down", "altName": "" }, { "code": 106, - "lowerName": "→", - "upperName": "→", + "lowerName": "right", + "upperName": "right", "altName": "" } ] diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/prefs.js b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/prefs.js index 7c47227..570da26 100644 --- a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/prefs.js +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/prefs.js @@ -39,6 +39,7 @@ export default class GjsOskPreferences extends ExtensionPreferences { settings.set_double("background-b", b); settings.set_int("font-size-px", numChanger_font.value); settings.set_int("border-spacing-px", numChanger_bord.value); + settings.set_int("snap-spacing-px", numChanger_snap.value) settings.set_boolean("round-key-corners", dragToggle2.active); settings.set_boolean("play-sound", dragToggle3.active); settings.set_int("default-snap", dropDown.selected); @@ -51,7 +52,7 @@ export default class GjsOskPreferences extends ExtensionPreferences { page1.add(group1); const row0 = new Adw.ActionRow({ - title: _('Language') + title: _('Layout') }); group1.add(row0); @@ -163,9 +164,9 @@ export default class GjsOskPreferences extends ExtensionPreferences { group1.add(row4); let posList = [ - _("Top Left"), _("Top Center"), _("Top Right"), - _("Center Left"), _("Center"), _("Center Right"), - _("Bottom Left"), _("Bottom Center"), _("Bottom Right") + _("Top Left"), _("Top Center"), _("Top Right"), + _("Center Left"), _("Center"), _("Center Right"), + _("Bottom Left"), _("Bottom Center"), _("Bottom Right") ]; let dropDown = Gtk.DropDown.new_from_strings(posList); dropDown.valign = Gtk.Align.CENTER; @@ -174,6 +175,19 @@ export default class GjsOskPreferences extends ExtensionPreferences { row4.add_suffix(dropDown); row4.activatable_widget = dropDown; + const row9 = new Adw.ActionRow({ + title: _('Play sound') + }); + group1.add(row9); + + const dragToggle3 = new Gtk.Switch({ + active: settings.get_boolean('play-sound'), + valign: Gtk.Align.CENTER, + }); + + row9.add_suffix(dragToggle3); + row9.activatable_widget = dragToggle3; + const group2 = new Adw.PreferencesGroup({ title: _("Appearance") }); @@ -182,7 +196,7 @@ export default class GjsOskPreferences extends ExtensionPreferences { const row5 = new Adw.ActionRow({ title: _('Color') }); - group2.add(row5);settings.set_boolean("enable-tap-gesture", dragOpt.selected); + group2.add(row5); settings.set_boolean("enable-tap-gesture", dragOpt.selected); let rgba = new Gdk.RGBA(); rgba.parse("rgba(" + settings.get_double("background-r") + ", " + settings.get_double("background-g") + ", " + settings.get_double("background-b") + ", 1)"); @@ -216,6 +230,17 @@ export default class GjsOskPreferences extends ExtensionPreferences { row7.add_suffix(numChanger_bord); row7.activatable_widget = numChanger_bord; + let row1t2 = new Adw.ActionRow({ + title: _('Drag snap spacing (px)') + }); + group2.add(row1t2); + + let numChanger_snap = Gtk.SpinButton.new_with_range(0, 50, 5); + numChanger_snap.value = settings.get_int('snap-spacing-px'); + numChanger_snap.valign = Gtk.Align.CENTER; + row1t2.add_suffix(numChanger_snap); + row1t2.activatable_widget = numChanger_snap; + const row8 = new Adw.ActionRow({ title: _('Round Corners') }); @@ -228,19 +253,6 @@ export default class GjsOskPreferences extends ExtensionPreferences { row8.add_suffix(dragToggle2); row8.activatable_widget = dragToggle2; - - const row9 = new Adw.ActionRow({ - title: _('Play sound') - }); - group2.add(row9); - - const dragToggle3 = new Gtk.Switch({ - active: settings.get_boolean('play-sound'), - valign: Gtk.Align.CENTER, - }); - - row9.add_suffix(dragToggle3); - row9.activatable_widget = dragToggle3; window.add(page1); @@ -288,9 +300,21 @@ export default class GjsOskPreferences extends ExtensionPreferences { uri: "https://github.com/Vishram1123/gjs-osk", }); + let icons_credit = new Adw.ActionRow({ + icon_name: "app-icon-design-symbolic", + title: _("Icons sourced from") + }); + let remixicon_link = new Gtk.LinkButton({ + label: "RemixIcon", + uri: "https://remixicon.com/", + }); + code_row.add_suffix(github_link); code_row.set_activatable_widget(github_link); links_pref_group.add(code_row); + icons_credit.add_suffix(remixicon_link); + icons_credit.set_activatable_widget(remixicon_link); + links_pref_group.add(icons_credit); label_box.append(label); label_box.append(another_label); @@ -317,6 +341,7 @@ export default class GjsOskPreferences extends ExtensionPreferences { settings.set_double("background-b", b); settings.set_int("font-size-px", numChanger_font.value); settings.set_int("border-spacing-px", numChanger_bord.value); + settings.set_int("snap-spacing-px", numChanger_snap.value) settings.set_boolean("round-key-corners", dragToggle2.active); settings.set_boolean("play-sound", dragToggle3.active); settings.set_int("default-snap", dropDown.selected); diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/schemas/gschemas.compiled b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/schemas/gschemas.compiled index edba05c..ceb5d5f 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/schemas/gschemas.compiled and b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/schemas/gschemas.compiled differ diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/schemas/org.gnome.shell.extensions.gjsosk.gschema.xml b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/schemas/org.gnome.shell.extensions.gjsosk.gschema.xml index 9bb9ca7..9a34bb7 100644 --- a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/schemas/org.gnome.shell.extensions.gjsosk.gschema.xml +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/schemas/org.gnome.shell.extensions.gjsosk.gschema.xml @@ -31,6 +31,9 @@ 2 + + 25 + false diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/stylesheet.css b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/stylesheet.css index dd8d159..629e010 100644 --- a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/stylesheet.css +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/stylesheet.css @@ -1,55 +1,195 @@ -.regular:active { +.regular:pressed { background-color: rgba(255, 255, 255, 0.2); color: white; } - .inverted:active { + +.inverted:pressed { background-color: rgba(0, 0, 0, 0.2); color: black; } - .regular { + +.regular { background-color: rgba(255, 255, 255, 0.05); color: white; } - .inverted { + +.inverted { background-color: rgba(0, 0, 0, 0.05); color: black; } - .keysHolder>* { + +.keysHolder>* { border: 0; background-clip: padding-box; box-sizing: border-box; } - .dr-b { + +.dr-b { border: 0; background-clip: padding-box; margin: inherit; box-sizing: border-box; } - .boxLay.regular:dragging { + +.boxLay.regular:dragging { background-image: url(ui/icons/hicolor/scalable/actions/move.svg); background-size: 100px; } + .boxLay.inverted:dragging { background-image: url(ui/icons/hicolor/scalable/actions/move-dark.svg); background-size: 100px; } -.close_btn, .move_btn { + +.close_btn, +.move_btn, +.delete_btn, +.backspace_btn, +.tab_btn, +.capslock_btn, +.shift_btn, +.enter_btn, +.ctrl_btn, +.super_btn, +.alt_btn, +.space_btn, +.left_btn, +.up_btn, +.down_btn, +.right_btn { background-repeat: no-repeat; background-position: center; } -.close_btn.regular { - background-image: url(ui/icons/hicolor/scalable/actions/close.svg); + +.close_btn.regular, .close_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/close.svg); } -.close_btn.inverted { - background-image: url(ui/icons/hicolor/scalable/actions/close-dark.svg); + +.close_btn.inverted, .close_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/close-dark.svg); } -.move_btn.regular { - background-image: url(ui/icons/hicolor/scalable/actions/move.svg); + +.move_btn.regular, .move_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/move.svg); } -.move_btn.inverted { - background-image: url(ui/icons/hicolor/scalable/actions/move-dark.svg); + +.move_btn.inverted, .move_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/move-dark.svg); } - .keyActionBtns { + +.delete_btn.regular, .delete_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/delete.svg); +} + +.delete_btn.inverted, .delete_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/delete-dark.svg); +} + +.backspace_btn.regular, .backspace_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/backspace.svg); +} + +.backspace_btn.inverted, .backspace_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/backspace-dark.svg); +} + +.tab_btn.regular, .tab_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/tab.svg); +} + +.tab_btn.inverted, .tab_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/tab-dark.svg); +} + +.capslock_btn.regular, .capslock_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/capslock.svg); +} + +.capslock_btn.inverted, .capslock_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/capslock-dark.svg); +} + +.shift_btn.regular, .shift_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/shift.svg); +} + +.shift_btn.inverted, .shift_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/shift-dark.svg); +} + +.enter_btn.regular, .enter_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/enter.svg); +} + +.enter_btn.inverted, .enter_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/enter-dark.svg); +} + +.ctrl_btn.regular, .ctrl_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/ctrl.svg); +} + +.ctrl_btn.inverted, .ctrl_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/ctrl-dark.svg); +} + +.super_btn.regular, .super_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/super.svg); +} + +.super_btn.inverted, .super_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/super-dark.svg); +} + +.alt_btn.regular, .alt_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/alt.svg); +} + +.alt_btn.inverted, .alt_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/alt-dark.svg); +} + +.space_btn.regular, .space_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/space.svg); +} + +.space_btn.inverted, .space_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/space-dark.svg); +} + +.left_btn.regular, .left_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/left.svg); +} + +.left_btn.inverted, .left_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/left-dark.svg); +} + +.up_btn.regular, .up_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/up.svg); +} + +.up_btn.inverted, .up_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/up-dark.svg); +} + +.down_btn.regular, .down_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/down.svg); +} + +.down_btn.inverted, .down_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/down-dark.svg); +} + +.right_btn.regular, .right_btn.selected.inverted { + background-image: url(ui/icons/hicolor/scalable/actions/right.svg); +} + +.right_btn.inverted, .right_btn.selected.regular { + background-image: url(ui/icons/hicolor/scalable/actions/right-dark.svg); +} + +.keyActionBtns { background-color: rgba(255, 255, 255, 0.00); border: 0; border-radius: 0px; @@ -57,20 +197,23 @@ margin: 0px !important; box-sizing: border-box; } - .selected.regular { + +.selected.regular { background-color: rgba(255, 255, 255, 0.7); color: black; } - .selected.inverted { + +.selected.inverted { background-color: rgba(0, 0, 0, 0.7); color: white; } - .db-keyboard-content { + +.db-keyboard-content { background-color: rgba(0, 0, 0, 0); border: 0; } - .boxLay { + +.boxLay { padding: 20px; border-radius: 10px; -} - +} \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/alt-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/alt-dark.svg new file mode 100644 index 0000000..08743bb --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/alt-dark.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/alt.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/alt.svg new file mode 100644 index 0000000..99fe6ed --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/alt.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/app-icon-design-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/app-icon-design-symbolic.svg new file mode 100644 index 0000000..b1f0d5f --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/app-icon-design-symbolic.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/backspace-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/backspace-dark.svg new file mode 100644 index 0000000..0d35547 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/backspace-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/backspace.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/backspace.svg new file mode 100644 index 0000000..b878e0c --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/backspace.svg @@ -0,0 +1,36 @@ + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/capslock-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/capslock-dark.svg new file mode 100644 index 0000000..efed6af --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/capslock-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/capslock.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/capslock.svg new file mode 100644 index 0000000..9c85b5b --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/capslock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/ctrl-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/ctrl-dark.svg new file mode 100644 index 0000000..820835b --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/ctrl-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/ctrl.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/ctrl.svg new file mode 100644 index 0000000..31d0467 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/ctrl.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/delete-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/delete-dark.svg new file mode 100644 index 0000000..ed6c0c9 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/delete-dark.svg @@ -0,0 +1,36 @@ + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/delete.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/delete.svg new file mode 100644 index 0000000..e1b7219 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/delete.svg @@ -0,0 +1,36 @@ + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/down-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/down-dark.svg new file mode 100644 index 0000000..444ec7c --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/down-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/down.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/down.svg new file mode 100644 index 0000000..31317c0 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/enter-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/enter-dark.svg new file mode 100644 index 0000000..5044154 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/enter-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/enter.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/enter.svg new file mode 100644 index 0000000..a66e2e7 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/enter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/left-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/left-dark.svg new file mode 100644 index 0000000..5ca8b9a --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/left-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/left.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/left.svg new file mode 100644 index 0000000..6b2c10d --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/right-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/right-dark.svg new file mode 100644 index 0000000..85f93cc --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/right-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/right.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/right.svg new file mode 100644 index 0000000..590cf90 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/shift-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/shift-dark.svg new file mode 100644 index 0000000..2730129 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/shift-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/shift.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/shift.svg new file mode 100644 index 0000000..64204df --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/shift.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/space-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/space-dark.svg new file mode 100644 index 0000000..87ac6ff --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/space-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/space.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/space.svg new file mode 100644 index 0000000..5237124 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/space.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/super-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/super-dark.svg new file mode 100644 index 0000000..f454aeb --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/super-dark.svg @@ -0,0 +1,37 @@ + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/super.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/super.svg new file mode 100644 index 0000000..916d903 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/super.svg @@ -0,0 +1,37 @@ + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/tab-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/tab-dark.svg new file mode 100644 index 0000000..c262766 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/tab-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/tab.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/tab.svg new file mode 100644 index 0000000..f6ebb49 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/up-dark.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/up-dark.svg new file mode 100644 index 0000000..f845bf1 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/up-dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/up.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/up.svg new file mode 100644 index 0000000..0780671 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/config.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/config.js index 583ad59..6a88a81 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/config.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/config.js @@ -5,10 +5,10 @@ var PACKAGE_VERSION = 56; var PACKAGE_URL = 'https://github.com/GSConnect/gnome-shell-extension-gsconnect'; var PACKAGE_BUGREPORT = 'https://github.com/GSConnect/gnome-shell-extension-gsconnect/issues/new'; -var PACKAGE_DATADIR = '/usr/local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io'; -var PACKAGE_LOCALEDIR = '/usr/local/share/locale'; -var GSETTINGS_SCHEMA_DIR = '/usr/local/share/glib-2.0/schemas'; -var GNOME_SHELL_LIBDIR = '/usr/local/lib/x86_64-linux-gnu'; +var PACKAGE_DATADIR = '/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io'; +var PACKAGE_LOCALEDIR = '/usr/share/locale'; +var GSETTINGS_SCHEMA_DIR = '/usr/share/glib-2.0/schemas'; +var GNOME_SHELL_LIBDIR = '/usr/lib64/'; var APP_ID = 'org.gnome.Shell.Extensions.GSConnect'; var APP_PATH = '/org/gnome/Shell/Extensions/GSConnect'; diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/gsconnect-preferences b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/gsconnect-preferences old mode 100755 new mode 100644 diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/he/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/he/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo new file mode 100644 index 0000000..6643a6a Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/he/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/metadata.json b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/metadata.json index df6761a..a2b73c2 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/metadata.json @@ -1,11 +1,8 @@ { - "_generated": "Generated by SweetTooth, do not edit", - "description": "GSConnect is a complete implementation of KDE Connect especially for GNOME Shell with Nautilus, Chrome and Firefox integration. It does not rely on the KDE Connect desktop application and will not work with it installed.\n\nKDE Connect allows devices to securely share content like notifications or files and other features like SMS messaging and remote control. The KDE Connect team has applications for Linux, BSD, Android, Sailfish, iOS, macOS and Windows.\n\nPlease report issues on Github!", - "name": "GSConnect", - "shell-version": [ - "45" - ], - "url": "https://github.com/GSConnect/gnome-shell-extension-gsconnect/wiki", - "uuid": "gsconnect@andyholmes.github.io", - "version": 56 -} \ No newline at end of file + "uuid": "gsconnect@andyholmes.github.io", + "name": "GSConnect", + "description": "GSConnect is a complete implementation of KDE Connect especially for GNOME Shell with Nautilus, Chrome and Firefox integration. It does not rely on the KDE Connect desktop application and will not work with it installed.\n\nKDE Connect allows devices to securely share content like notifications or files and other features like SMS messaging and remote control. The KDE Connect team has applications for Linux, BSD, Android, Sailfish, iOS, macOS and Windows.\n\nPlease report issues on Github!", + "version": 56, + "shell-version": [ "46" ], + "url": "https://github.com/GSConnect/gnome-shell-extension-gsconnect/wiki" +} diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/nautilus-gsconnect.py b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/nautilus-gsconnect.py index c253612..05a71b0 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/nautilus-gsconnect.py +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/nautilus-gsconnect.py @@ -177,24 +177,36 @@ class GSConnectShareExtension(GObject.Object, FileManager.MenuProvider): if not devices: return () - # Context Menu Item - menu = FileManager.MenuItem( - name="GSConnectShareExtension::Devices", - label=_("Send To Mobile Device"), - ) + # If there's exactly 1 device, no submenu + if len(devices) == 1: + name, action_group = devices[0] + menu = FileManager.MenuItem( + name="GSConnectShareExtension::Device" + name, + # TRANSLATORS: Send to , for file manager + # context menu + label=_("Send to %s") % name, + ) + menu.connect("activate", self.send_files, files, action_group) - # Context Submenu - submenu = FileManager.Menu() - menu.set_submenu(submenu) - - # Context Submenu Items - for name, action_group in devices: - item = FileManager.MenuItem( - name="GSConnectShareExtension::Device" + name, label=name + else: + # Context Menu Item + menu = FileManager.MenuItem( + name="GSConnectShareExtension::Devices", + label=_("Send To Mobile Device"), ) - item.connect("activate", self.send_files, files, action_group) + # Context Submenu + submenu = FileManager.Menu() + menu.set_submenu(submenu) - submenu.append_item(item) + # Context Submenu Items + for name, action_group in devices: + item = FileManager.MenuItem( + name="GSConnectShareExtension::Device" + name, label=name + ) + + item.connect("activate", self.send_files, files, action_group) + + submenu.append_item(item) return (menu,) diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/org.gnome.Shell.Extensions.GSConnect.gresource b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/org.gnome.Shell.Extensions.GSConnect.gresource index 04b844f..17fe485 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/org.gnome.Shell.Extensions.GSConnect.gresource and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/org.gnome.Shell.Extensions.GSConnect.gresource differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/input.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/input.js index 47540d8..121c4d9 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/input.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/input.js @@ -147,18 +147,7 @@ const RemoteSession = GObject.registerClass({ } scrollPointer(dx, dy) { - // NOTE: NotifyPointerAxis only seems to work on Wayland, but maybe - // NotifyPointerAxisDiscrete is the better choice anyways - if (HAVE_WAYLAND) { - this._call( - 'NotifyPointerAxis', - GLib.Variant.new('(ddu)', [dx, dy, 0]) - ); - this._call( - 'NotifyPointerAxis', - GLib.Variant.new('(ddu)', [0, 0, 1]) - ); - } else if (dy > 0) { + if (dy > 0) { this._call( 'NotifyPointerAxisDiscrete', GLib.Variant.new('(ui)', [Gdk.ScrollDirection.UP, 1]) @@ -266,50 +255,6 @@ class Controller { return this._connection; } - /** - * Check if this is a Wayland session, specifically for distributions that - * don't ship pipewire support (eg. Debian/Ubuntu). - * - * FIXME: this is a super ugly hack that should go away - * - * @return {boolean} %true if wayland is not supported - */ - _checkWayland() { - if (HAVE_WAYLAND) { - // eslint-disable-next-line no-global-assign - HAVE_REMOTEINPUT = false; - const service = Gio.Application.get_default(); - - if (service === null) - return true; - - // First we're going to disabled the affected plugins on all devices - for (const device of service.manager.devices.values()) { - const supported = device.settings.get_strv('supported-plugins'); - let index; - - if ((index = supported.indexOf('mousepad')) > -1) - supported.splice(index, 1); - - if ((index = supported.indexOf('presenter')) > -1) - supported.splice(index, 1); - - device.settings.set_strv('supported-plugins', supported); - } - - // Second we need each backend to rebuild its identity packet and - // broadcast the amended capabilities to the network - for (const backend of service.manager.backends.values()) - backend.buildIdentity(); - - service.manager.identify(); - - return true; - } - - return false; - } - _onNameAppeared(connection, name, name_owner) { try { this._connection = connection; @@ -394,10 +339,6 @@ class Controller { if (this.connection === null) { debug('Falling back to Atspi'); - // If we got here in Wayland, we need to re-adjust and bail - if (this._checkWayland()) - return; - const fallback = imports.service.components.atspi; this._session = new fallback.Controller(); diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/pulseaudio.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/pulseaudio.js index d3f6657..1e09fdb 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/pulseaudio.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/pulseaudio.js @@ -190,7 +190,7 @@ const Mixer = GObject.registerClass({ */ lowerVolume(duration = 1) { try { - if (this.output.volume > 0.15) { + if (this.output && this.output.volume > 0.15) { this._previousVolume = Number(this.output.volume); this.output.fade(0.15, duration); } @@ -204,7 +204,7 @@ const Mixer = GObject.registerClass({ */ muteVolume() { try { - if (this.output.muted) + if (!this.output || this.output.muted) return; this.output.muted = true; @@ -219,7 +219,7 @@ const Mixer = GObject.registerClass({ */ muteMicrophone() { try { - if (this.input.muted) + if (!this.input || this.input.muted) return; this.input.muted = true; @@ -266,4 +266,3 @@ const Mixer = GObject.registerClass({ * The service class for this component */ var Component = Mixer; - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/core.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/core.js index 2bd4fb1..e3406bf 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/core.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/core.js @@ -410,10 +410,6 @@ var ChannelService = GObject.registerClass({ }); for (const name in imports.service.plugins) { - // Exclude mousepad/presenter capability in unsupported sessions - if (!HAVE_REMOTEINPUT && ['mousepad', 'presenter'].includes(name)) - continue; - const meta = imports.service.plugins[name].Metadata; if (meta === undefined) diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/daemon.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/daemon.js old mode 100755 new mode 100644 diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js index 3402b6d..b0d24de 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js @@ -298,10 +298,6 @@ var Device = GObject.registerClass({ const supported = []; for (const name in imports.service.plugins) { - // Exclude mousepad/presenter plugins in unsupported sessions - if (!HAVE_REMOTEINPUT && ['mousepad', 'presenter'].includes(name)) - continue; - const meta = imports.service.plugins[name].Metadata; if (meta === undefined) diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/nativeMessagingHost.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/nativeMessagingHost.js old mode 100755 new mode 100644 diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/setup.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/setup.js index 2f9f6c1..04449dd 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/setup.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/setup.js @@ -99,13 +99,7 @@ for (const path of [Config.CACHEDIR, Config.CONFIGDIR, Config.RUNTIMEDIR]) GLib.mkdir_with_parents(path, 0o755); -/** - * Check if we're in a Wayland session (mostly for input synthesis) - * https://wiki.gnome.org/Accessibility/Wayland#Bugs.2FIssues_We_Must_Address - */ -globalThis.HAVE_REMOTEINPUT = GLib.getenv('GDMSESSION') !== 'ubuntu-wayland'; -globalThis.HAVE_WAYLAND = GLib.getenv('XDG_SESSION_TYPE') === 'wayland'; -globalThis.HAVE_GNOME = GLib.getenv('GNOME_SETUP_DISPLAY') !== null; +globalThis.HAVE_GNOME = GLib.getenv('GSCONNECT_MODE')?.toLowerCase() !== 'cli' && (GLib.getenv('GNOME_SETUP_DISPLAY') !== null || GLib.getenv('XDG_CURRENT_DESKTOP')?.toUpperCase()?.includes('GNOME') || GLib.getenv('XDG_SESSION_DESKTOP')?.toLowerCase() === 'gnome'); /** diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/notification.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/notification.js index 573bb97..78b7f54 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/notification.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/notification.js @@ -9,6 +9,7 @@ import St from 'gi://St'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; +import * as Calendar from 'resource:///org/gnome/shell/ui/calendar.js'; import * as NotificationDaemon from 'resource:///org/gnome/shell/ui/notificationDaemon.js'; import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; @@ -44,11 +45,10 @@ const GtkNotificationDaemon = Main.notificationDaemon._gtkNotificationDaemon.con */ const NotificationBanner = GObject.registerClass({ GTypeName: 'GSConnectNotificationBanner', -}, class NotificationBanner extends MessageTray.NotificationBanner { - - _init(notification) { - super._init(notification); +}, class NotificationBanner extends Calendar.NotificationMessage { + constructor(notification) { + super(notification); if (notification.requestReplyId !== undefined) this._addReplyAction(); } @@ -56,7 +56,7 @@ const NotificationBanner = GObject.registerClass({ _addReplyAction() { if (!this._buttonBox) { this._buttonBox = new St.BoxLayout({ - style_class: 'notification-actions', + style_class: 'notification-buttons-bin', x_expand: true, }); this.setActionArea(this._buttonBox); @@ -207,13 +207,10 @@ const Source = GObject.registerClass({ } /* - * Override to control notification spawning + * Parse the id to determine if it's a repliable notification, device + * notification or a regular local notification */ - addNotification(notificationId, notificationParams, showBanner) { - this._notificationPending = true; - - // Parse the id to determine if it's a repliable notification, device - // notification or a regular local notification + _parseNotificationId(notificationId) { let idMatch, deviceId, requestReplyId, remoteId, localId; if ((idMatch = REPLY_REGEX.exec(notificationId))) { @@ -227,42 +224,39 @@ const Source = GObject.registerClass({ } else { localId = notificationId; } + return [idMatch, deviceId, requestReplyId, remoteId, localId]; + } - // Fix themed icons - if (notificationParams.icon) { - let gicon = Gio.Icon.deserialize(notificationParams.icon); - - if (gicon instanceof Gio.ThemedIcon) { - gicon = getIcon(gicon.names[0]); - notificationParams.icon = gicon.serialize(); - } - } - - let notification = this._notifications[localId]; + /* + * Add notification to source or update existing notification with extra + * GsConnect information + */ + _createNotification(notification) { + const [idMatch, deviceId, requestReplyId, remoteId, localId] = this._parseNotificationId(notification.id); + const cachedNotification = this._notifications[localId]; // Check if this is a repeat - if (notification) { - notification.requestReplyId = requestReplyId; + if (cachedNotification) { + cachedNotification.requestReplyId = requestReplyId; // Bail early If @notificationParams represents an exact repeat - const title = notificationParams.title.unpack(); - const body = notificationParams.body - ? notificationParams.body.unpack() + const title = notification.title; + const body = notification.body + ? notification.body : null; - if (notification.title === title && - notification.bannerBodyText === body) { - this._notificationPending = false; - return; - } + if (cachedNotification.title === title && + cachedNotification.body === body) + return cachedNotification; - notification.title = title; - notification.bannerBodyText = body; + cachedNotification.title = title; + cachedNotification.body = body; + + return cachedNotification; + } // Device Notification - } else if (idMatch) { - notification = this._createNotification(notificationParams); - + if (idMatch) { notification.deviceId = deviceId; notification.remoteId = remoteId; notification.requestReplyId = requestReplyId; @@ -272,41 +266,66 @@ const Source = GObject.registerClass({ delete this._notifications[localId]; }); - this._notifications[localId] = notification; - // Service Notification } else { - notification = this._createNotification(notificationParams); notification.connect('destroy', (notification, reason) => { delete this._notifications[localId]; }); - this._notifications[localId] = notification; } - if (showBanner) - this.showNotification(notification); - else - this.pushNotification(notification); + this._notifications[localId] = notification; + return notification; + } + + /* + * Override to control notification spawning + */ + addNotification(notification) { + this._notificationPending = true; + + // Fix themed icons + if (notification.icon) { + let gicon = notification.icon; + + if (gicon instanceof Gio.ThemedIcon) { + gicon = getIcon(gicon.names[0]); + notification.icon = gicon.serialize(); + } + } + + const createdNotification = this._createNotification(notification); + this._addNotificationToMessageTray(createdNotification); this._notificationPending = false; } /* - * Override to raise the usual notification limit (3) + * Reimplementation of MessageTray.addNotification to raise the usual + * notification limit (3) */ - pushNotification(notification) { - if (this.notifications.includes(notification)) + _addNotificationToMessageTray(notification) { + if (this.notifications.includes(notification)) { + notification.acknowledged = false; return; + } - while (this.notifications.length >= 10) - this.notifications.shift().destroy(MessageTray.NotificationDestroyedReason.EXPIRED); + while (this.notifications.length >= 10) { + const [oldest] = this.notifications; + oldest.destroy(MessageTray.NotificationDestroyedReason.EXPIRED); + } notification.connect('destroy', this._onNotificationDestroy.bind(this)); - notification.connect('notify::acknowledged', this.countUpdated.bind(this)); - this.notifications.push(notification); - this.emit('notification-added', notification); + notification.connect('notify::acknowledged', () => { + this.countUpdated(); - this.countUpdated(); + // If acknowledged was set to false try to show the notification again + if (!notification.acknowledged) + this.emit('notification-request-banner', notification); + }); + this.notifications.push(notification); + + this.emit('notification-added', notification); + this.emit('notification-request-banner', notification); } createBanner(notification) { @@ -325,8 +344,10 @@ export function patchGSConnectNotificationSource() { if (source !== undefined) { // Patch in the subclassed methods source._closeGSConnectNotification = Source.prototype._closeGSConnectNotification; + source._parseNotificationId = Source.prototype._parseNotificationId; + source._createNotification = Source.prototype._createNotification; source.addNotification = Source.prototype.addNotification; - source.pushNotification = Source.prototype.pushNotification; + source._addNotificationToMessageTray = Source.prototype._addNotificationToMessageTray; source.createBanner = Source.prototype.createBanner; // Connect to existing notifications @@ -353,8 +374,10 @@ const _ensureAppSource = function (appId) { if (source._appId === APP_ID) { source._closeGSConnectNotification = Source.prototype._closeGSConnectNotification; + source._parseNotificationId = Source.prototype._parseNotificationId; + source._createNotification = Source.prototype._createNotification; source.addNotification = Source.prototype.addNotification; - source.pushNotification = Source.prototype.pushNotification; + source._addNotificationToMessageTray = Source.prototype._addNotificationToMessageTray; source.createBanner = Source.prototype.createBanner; } @@ -378,29 +401,6 @@ export function unpatchGtkNotificationDaemon() { const _addNotification = NotificationDaemon.GtkNotificationDaemonAppSource.prototype.addNotification; export function patchGtkNotificationSources() { - // This should diverge as little as possible from the original - // eslint-disable-next-line func-style - const addNotification = function (notificationId, notificationParams, showBanner) { - this._notificationPending = true; - - if (this._notifications[notificationId]) - this._notifications[notificationId].destroy(MessageTray.NotificationDestroyedReason.REPLACED); - - const notification = this._createNotification(notificationParams); - notification.connect('destroy', (notification, reason) => { - this._withdrawGSConnectNotification(notification, reason); - delete this._notifications[notificationId]; - }); - this._notifications[notificationId] = notification; - - if (showBanner) - this.showNotification(notification); - else - this.pushNotification(notification); - - this._notificationPending = false; - }; - // eslint-disable-next-line func-style const _withdrawGSConnectNotification = function (id, notification, reason) { if (reason !== MessageTray.NotificationDestroyedReason.DISMISSED) @@ -442,7 +442,6 @@ export function patchGtkNotificationSources() { ); }; - NotificationDaemon.GtkNotificationDaemonAppSource.prototype.addNotification = addNotification; NotificationDaemon.GtkNotificationDaemonAppSource.prototype._withdrawGSConnectNotification = _withdrawGSConnectNotification; } diff --git a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/extension.js b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/extension.js index 326f527..9b5b509 100644 --- a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/extension.js +++ b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/extension.js @@ -1,5 +1,5 @@ /* extension.js -* Copyright (C) 2023 kosmospredanie, shyzus, Shinigaminai +* Copyright (C) 2024 kosmospredanie, shyzus, Shinigaminai * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,17 +15,22 @@ * along with this program. If not, see . */ -import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; +import { Extension, gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; import Gio from 'gi://Gio'; +import GObject from 'gi://GObject'; +import GLib from 'gi://GLib'; import * as SystemActions from 'resource:///org/gnome/shell/misc/systemActions.js'; - +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as Rotator from './rotator.js' +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; const ORIENTATION_LOCK_SCHEMA = 'org.gnome.settings-daemon.peripherals.touchscreen'; const ORIENTATION_LOCK_KEY = 'orientation-lock'; +import { QuickMenuToggle, QuickSettingsMenu, SystemIndicator } from 'resource:///org/gnome/shell/ui/quickSettings.js'; + // Orientation names must match those provided by net.hadess.SensorProxy const Orientation = Object.freeze({ 'normal': 0, @@ -34,6 +39,100 @@ const Orientation = Object.freeze({ 'right-up': 3 }); +const ManualOrientationIndicator = GObject.registerClass( +class ManualOrientationIndicator extends SystemIndicator { + _init(ext_ref) { + super._init(); + this.toggle = new ManualOrientationMenuToggle(ext_ref); + this.quickSettingsItems.push(this.toggle); + } + + destroy() { + this.quickSettingsItems.pop(this.toggle); + this.toggle.destroy(); + } +}); + +const ManualOrientationMenuToggle = GObject.registerClass( +class ManualOrientationMenuToggle extends QuickMenuToggle { + _init(ext) { + super._init({ + title: _('Rotate'), + iconName: 'object-rotate-left-symbolic', + menuEnabled: true, + toggleMode: true, + }); + + this.menu.setHeader('object-rotate-left-symbolic', _('Screen Rotate')); + + this._section = new PopupMenu.PopupMenuSection(); + this.menu.addMenuItem(this._section); + + this.landscapeItem = new PopupMenu.PopupMenuItem('Landscape', { + reactive: true, + can_focus: true, + }); + + this.portraitLeftItem = new PopupMenu.PopupMenuItem('Portrait Left', { + reactive: true, + can_focus: true, + }); + + this.landscapeFlipItem = new PopupMenu.PopupMenuItem('Landscape Flipped', { + reactive: true, + can_focus: true, + }); + + this.portraitRightItem = new PopupMenu.PopupMenuItem('Portrait Right', { + reactive: true, + can_focus: true, + }); + + this.landscapeItem.connect('activate', () => { + this._onItemActivate(this.landscapeItem); + ext.rotate_to('normal'); + }); + this.portraitLeftItem.connect('activate', () => { + this._onItemActivate(this.portraitLeftItem); + ext.rotate_to('left-up'); + }); + this.landscapeFlipItem.connect('activate', () => { + this._onItemActivate(this.landscapeFlipItem); + ext.rotate_to('bottom-up'); + }); + this.portraitRightItem.connect('activate', () => { + this._onItemActivate(this.portraitRightItem); + ext.rotate_to('right-up'); + }); + + this._section.addMenuItem(this.landscapeItem); + this._section.addMenuItem(this.portraitLeftItem); + this._section.addMenuItem(this.landscapeFlipItem); + this._section.addMenuItem(this.portraitRightItem); + + this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); + this.menu.addSettingsAction(_('Extension Settings'), + 'com.mattjakeman.ExtensionManager.desktop'); + + this.connect('clicked', () => { + if (this.checked == true) { + ext.rotate_to('right-up'); + } else { + ext.rotate_to('normal'); + } + }); + } + + _onItemActivate(item) { + this.landscapeItem.setOrnament(PopupMenu.Ornament.HIDDEN); + this.portraitLeftItem.setOrnament(PopupMenu.Ornament.HIDDEN); + this.landscapeFlipItem.setOrnament(PopupMenu.Ornament.HIDDEN); + this.portraitRightItem.setOrnament(PopupMenu.Ornament.HIDDEN); + + item.setOrnament(PopupMenu.Ornament.CHECK); + } +}); + class SensorProxy { constructor(rotate_cb) { this._rotate_cb = rotate_cb; @@ -207,17 +306,72 @@ export default class ScreenAutoRotateExtension extends Extension { enable() { this._settings = this.getSettings(); this._ext = new ScreenAutorotate(this._settings); + + this._settings.connect('changed::manual-flip', (settings, key) => { + if (settings.get_boolean(key)) { + this._add_manual_flip(); + } else { + this._remove_manual_flip(); + } + }); + + this._settings.connect('changed::hide-lock-rotate', (settings, key) => { + this._set_hide_lock_rotate(settings.get_boolean(key)); + }); + + if (this._settings.get_boolean('manual-flip')) { + this._add_manual_flip(); + } else { + this._remove_manual_flip(); + } + + /* Timeout needed due to unknown race condition causing 'Auto Rotate' + * Quick Toggle to be undefined for a brief moment. + */ + this._timeoutId = setTimeout(() => { + this._set_hide_lock_rotate(this._settings.get_boolean('hide-lock-rotate')); + }, 1000); + } + + _set_hide_lock_rotate(state) { + const autoRotateIndicator = Main.panel.statusArea.quickSettings._autoRotate; + + if (state) { + Main.panel.statusArea.quickSettings._indicators.remove_child(autoRotateIndicator); + Main.panel.statusArea.quickSettings.menu._grid.remove_child(autoRotateIndicator.quickSettingsItems[0]); + } else { + Main.panel.statusArea.quickSettings._indicators.add_child(autoRotateIndicator); + Main.panel.statusArea.quickSettings._addItemsBefore( + autoRotateIndicator.quickSettingsItems, + Main.panel.statusArea.quickSettings._rfkill.quickSettingsItems[0] + ); + } + } + + _add_manual_flip() { + this.flipIndicator = new ManualOrientationIndicator(this._ext); + Main.panel.statusArea.quickSettings.addExternalIndicator(this.flipIndicator); + } + + _remove_manual_flip() { + if (this.flipIndicator != null) { + this.flipIndicator.destroy(); + this.flipIndicator = null; + } } disable() { /* Comment for unlock-dialog usage: - The unlock-dialog sesson-mode is usefull for this extension as it allows + The unlock-dialog session-mode is useful for this extension as it allows the user to rotate their screen or lock rotation after their device may have auto-locked. This provides the ability to log back in regardless of the orientation of the device in tablet mode. */ this._settings = null; + clearTimeout(this._timeoutId); + this._timeoutId = null; + this._remove_manual_flip(); this._ext.destroy(); this._ext = null; } diff --git a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/metadata.json b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/metadata.json index 8a53079..69547d5 100644 --- a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/metadata.json @@ -9,9 +9,10 @@ ], "settings-schema": "org.gnome.shell.extensions.screen-rotate", "shell-version": [ - "45" + "45", + "46" ], "url": "https://github.com/shyzus/gnome-shell-extension-screen-autorotate", "uuid": "screen-rotate@shyzus.github.io", - "version": 15 + "version": 19 } \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/prefs.js b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/prefs.js index 862423e..85c2e6c 100644 --- a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/prefs.js +++ b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/prefs.js @@ -1,5 +1,5 @@ /* prefs.js -* Copyright (C) 2023 kosmospredanie, shyzus, Shinigaminai +* Copyright (C) 2024 kosmospredanie, shyzus, Shinigaminai * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,10 @@ export default class MyExtensionPreferences extends ExtensionPreferences { orientationGroup.set_title('Orientation Settings') page.add(orientationGroup); + const shellMenuGroup = new Adw.PreferencesGroup(); + shellMenuGroup.set_title('GNOME Shell Menu Settings'); + page.add(shellMenuGroup); + const debugGroup = new Adw.PreferencesGroup(); debugGroup.set_title('Debug Settings'); page.add(debugGroup); @@ -62,6 +66,17 @@ export default class MyExtensionPreferences extends ExtensionPreferences { orientationGroup.add(setOffsetRow); + const enableManualFlipRow = new Adw.ActionRow({ + title: 'Enable manual flip', + subtitle: 'Enable a toggle in the GNOME Shell System Menu to manually flip between landscape and portrait.' + }); + shellMenuGroup.add(enableManualFlipRow); + + const hideLockRotateRow = new Adw.ActionRow({ + title: 'Hide the "Auto Rotate" quick toggle' + }); + shellMenuGroup.add(hideLockRotateRow); + const toggleLoggingRow = new Adw.ActionRow({ title: 'Enable debug logging', subtitle: 'Use "journalctl /usr/bin/gnome-shell -f" to see log output.' @@ -86,6 +101,16 @@ export default class MyExtensionPreferences extends ExtensionPreferences { const setOffsetSpinButton = Gtk.SpinButton.new_with_range(0, 3, 1); setOffsetSpinButton.value = window._settings.get_int('orientation-offset'); + const manualFlipSwitch = new Gtk.Switch({ + active: window._settings.get_boolean('manual-flip'), + valign: Gtk.Align.CENTER, + }); + + const hideLockRotateSwitch = new Gtk.Switch({ + active: window._settings.get_boolean('hide-lock-rotate'), + valign: Gtk.Align.CENTER, + }); + const toggleLoggingSwitch = new Gtk.Switch({ active: window._settings.get_boolean('debug-logging'), valign: Gtk.Align.CENTER @@ -103,6 +128,12 @@ export default class MyExtensionPreferences extends ExtensionPreferences { window._settings.bind('orientation-offset', setOffsetSpinButton, 'value', Gio.SettingsBindFlags.DEFAULT); + window._settings.bind('manual-flip', + manualFlipSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); + + window._settings.bind('hide-lock-rotate', + hideLockRotateSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); + window._settings.bind('debug-logging', toggleLoggingSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); @@ -118,7 +149,13 @@ export default class MyExtensionPreferences extends ExtensionPreferences { setOffsetRow.add_suffix(setOffsetSpinButton); setOffsetRow.activatable_widget = setOffsetSpinButton; + enableManualFlipRow.add_suffix(manualFlipSwitch); + enableManualFlipRow.activatable_widget = manualFlipSwitch; + + hideLockRotateRow.add_suffix(hideLockRotateSwitch); + hideLockRotateRow.activatable_widget = hideLockRotateSwitch; + toggleLoggingRow.add_suffix(toggleLoggingSwitch); toggleLoggingRow.activatable_widget = toggleLoggingSwitch; } -} \ No newline at end of file +} diff --git a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/rotator.js b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/rotator.js index 5f6ff13..6a104ee 100644 --- a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/rotator.js +++ b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/rotator.js @@ -64,8 +64,11 @@ export function get_state() { export function rotate_to(transform) { this.get_state().then(state => { - let builtin_monitor = state.builtin_monitor; - let logical_monitor = state.get_logical_monitor_for(builtin_monitor.connector); + let target_monitor = state.builtin_monitor; + if (target_monitor == undefined) { + target_monitor = state.monitors[0] + } + let logical_monitor = state.get_logical_monitor_for(target_monitor.connector); logical_monitor.transform = transform; let variant = state.pack_to_apply(BusUtils.Methods['temporary']); call_dbus_method('ApplyMonitorsConfig', variant); diff --git a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/schemas/gschemas.compiled b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/schemas/gschemas.compiled index 6833ea0..4e7e366 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/schemas/gschemas.compiled and b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/schemas/gschemas.compiled differ diff --git a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/schemas/org.gnome.shell.extensions.screen-rotate.gschema.xml b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/schemas/org.gnome.shell.extensions.screen-rotate.gschema.xml index f391aff..0eeb5f6 100644 --- a/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/schemas/org.gnome.shell.extensions.screen-rotate.gschema.xml +++ b/gnome/.local/share/gnome-shell/extensions/screen-rotate@shyzus.github.io/schemas/org.gnome.shell.extensions.screen-rotate.gschema.xml @@ -1,6 +1,6 @@ + +## [Unreleased] +- Sorry for my English, I use a translator. :) + +## [v1] - 2022-02-03 +### Added +- Initial release. + +## [v2] - 2022-02-04 +### Fixed +- Change GLib.idle_add() to 'realize' signal in buildPrefsWidget (prefs.js). +- Add settings-schema and gettext-domain in metadata.json. +- Remove unnecessary imports. +- Fix indentations. +- Elimination of unnecessary logs. +- Thanks JustPerfection!!! + +## [v3] - 2022-02-05 +### Added +- Add alernatives thresholds paths. +- Add available flag and the _init code is restructured according to this addition... Now the submenu is shown even if the thresholds are not available. +### Fixed +- Fix _available function. The test whether the files exist points to the start file twice! + +## [v4] - 2022-02-21 +### Added +- Add icon type option (symbolic/color). + +## [v5] - 2022-02-21 +### Fixed +- Fix icon type on start. + +## [v6] - 2022-03-16 +### Added +- Threshold related functions have been moved to a library and optimized. +- The option to apply the thresholds to the battery of the dock is implemented if it is available (try this, I don't have a dock!!!) +- Added option to show/hide current values in menu. +- Added tooltips in menu icons. +### Changed +- The settings are applied immediately except for the thresholds that will be applied the next time they are activated from this extension or using the button for this purpose in the preferences window. +- Remove thresholds limits. +### Performance +- Function to apply thresholds now use promise (async) and can catch errors. +- Function to apply thresholds now checks if are available to determine what can be applied (more compatibility?). +### Fixed +### Other +- Reformat strings. +- Icons are redesigned... something. +- Minor cosmetic changes. + +## [v7] - 2022-03-21 +### Fixed +- If the action of applying the thresholds is canceled, now it does not throw an error. +- Update error notification message. +- Fixed the problem that the state switch was not updated to the correct state in case of an error. +- Fixed texts. +### Other +- Change schema settings types. +- Preferences UI was moved to a .ui file and Gtk4 is implemented with cosmetic improvements. +- Files names changed. +### Changed +- The buttons to apply the thresholds on the settings page are removed... I didn't like it :) +- Validate availability before applying the threshold in extension.js. +- Update metadata information. +### Performance +- Improvements to file monitors to avoid repeated execution of the callback. +- Change GtkComboBoxText to GtkDroopDown. +### Added +- Added an option to show/hide tooltips. +- Gnome 42 and libadwaita compatibility. + +## [v8] - 2022-03-27 +### Performance +- Threshold write performance improvements (fewer writes). Inspired by [TLP](https://github.com/linrunner/TLP/blob/main/bat.d/05-thinkpad) +- Russian translation update (Andrey Sitnik) + +## [v9] - 2022-03-28 +### Fixed +- Russian translation update (Andrey Sitnik) + +## [v10] - 2022-05-25 +### Added +- Gnome 42 icons +- Added a menu to apply the configured values +- Added option to disable notifications +### Changed +- Revert switch to menu +### Other +- Update icons + +## [v11] - 2022-05-30 +### Fixed +- Russian translation update (Andrey Sitnik) + +## [v12] - 2022-10-08 +### Added +- Add option to show icon on inactive thresholds (based on the proposal of [Riccardo Massidda](https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues/3)) +- Gnome 43 compatibility (QuickSettings) - First attempt... many TODOs +### Fixed +- Dock battery callbacks + +## [v13] - 2022-10-16 +### Fixed +- Issue [#5](https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues/5): Bad function name +- Warnings fixes + +## [v14] - 2022-11-28 +### Performance +- Completely rewrites the "driver" using (or trying to) the GObject model +- Part of the "indicator" is rewritten +- Some text strings were modified to adapt them (The driver does not show text) +### Changed +- Thresholds can now be adjusted with 1% intervals +### Removed +- Support for versions older than Gnome 43 is removed. (Older versions of the extension are functional on Gnome 41/42) + +## [v15] - 2022-12-01 +### Fixed +- Fix platform detection (wrong regular expression) + +## [v16] - 2022-12-23 +### Added +- Added the option to reset the recommended thresholds on the preferences page +- Added the option to reset all preferences +### Other +- Move preference pages to separate classes +- Moved links to preferences window menu. Based on the excellent [GNOME Shell Extension - Blur my Shell](https://github.com/aunetx/blur-my-shell): All credits to [Aurélien Hamy](https://github.com/aunetx) + +## [v17] - 2022-12-27 +### Other +- Update translations + +## [v18] - 2023-01-03 +### Other +- Update translations + +## [v19] - 2023-01-24 +### Fixed +- Issue [#8](https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues/8): On some models the start threshold 0 is not allowed, instead 95 is used (Ex: E14 Gen 3) +### Other +- Update translations + +## [v20] - 2023-01-27 +### Other +- Update translations + +## [v21] - 2023-03-07 +### Added +- Environment object (kernel, product) +### Fixed +- Kernel version check + +## [v22] - 2023-03-10 +### Fixed +- Fix error "batteries is null" if platform is not supported +### Added +- Added support for Gnome 44 + +## [v23] - 2023-03-11 +### Fixed +- Remove duplicate kernel version message with debugging enabled +- Fixed error when checking if there are pending changes to apply in the driver +### Other +- (dis)connectObject is changed to connect/disconnect in the driver and battery classes because they are not GJS standards and it is not possible to use these classes in the preferences +### Added +- Suggestion [#11](https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues/11): Added buttons in preferences window to apply thresholds (if battery is available) +### Changed +- Now, the reset thresholds button in preferences window also tries to apply the values +- Now, the pending-changes property is true even if the thresholds are not active + +## [v24] - 2023-03-13 +### Added +- Added dialog messages to the reset buttons in the preferences window +### Changed +- Debug mode now takes effect immediately without the need to restart the extension +- The "Force compatible models" option is renamed to "Disable model compatibility check" and the value is also reversed (false = check compatibility - default) + +## [v25] - 2023-03-15 +### Other +- Update translations + +## [v26] - 2023-03-17 +### Other +- Update translations + +## [v27] - 2023-04-01 +### Fixed +- Fixed non-detection of attribute changes of the threshold files + +## [v28] - 2023-04-03 +### Other +- Update translations + +## [v29] - 2023-04-10 +### Fixed +- Fixed bug in preferences window if platform is not supported + +## [v30] - 2023-04-15 +### Other +- Update translations + +## [v31] - 2023-04-19 +### Fixed +- Fixed signal assignment in preferences window + +## [v32] - 2023-04-24 +### Fixed +- Issue [#15](https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues/15): Incorrect positioning on gnome 44 (Thanks @KayJay7) + +## [v33] - 2023-06-06 +### Other +- Update translations + +## [v34] - 2023-09-22 +### Fixed +- Preferences window is modified (About tab added) + +## [v35] - 2023-10-10 +### Added +- Gnome 45 support +### Removed +- Removed debug option +- Removed disable compatibility check option (unnecessary) +### Other +- Design changes in the preferences window +- Update strings + +## [v36] - 2023-10-10 +### Fixed +- Remove "this" in prefs.js (Thanks Just Perfection) +- Remove "run_dispose()" in driver.js and inicator.js (Thanks Just Perfection) + +## [v37] - 2023-10-13 +### Performance +- Object references in the preferences window are optimized +- Minor changes in implementations +### Other +- Update translations (German) + +## [v38] - 2023-11-12 +### Other +- Update translations (Russian) + +## [v39] - 2023-12-01 +### Other +- Update translations (Portuguese - Brazil) + +## [v40] - 2023-12-05 +### Other +- Update translations (Japanese) + +## [v41] - 2023-12-07 +### Other +- Update translations (Czech) + +## [v42] - 2023-12-19 +### Other +- Update translations (Portuguese) + +## [v43] - 2024-02-23 +### Other +- Update translations (Italian) + +## [v44] - 2024-03-20 +### Added +- Gnome 46 support \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/LICENSE b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/LICENSE new file mode 100644 index 0000000..76893fd --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + Thinkpad Battery Threshold Extension + Copyright (C) 2022 Marcos + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) 2022 Marcos + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/extension.js b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/extension.js new file mode 100644 index 0000000..be4e993 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/extension.js @@ -0,0 +1,35 @@ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * CHANGELOG: https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/blob/main/CHANGELOG.md + */ + +'use strict'; + +import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; + +import { ThresholdIndicator } from './libs/indicator.js'; + +export default class ExtensionManager extends Extension { + enable() { + this._indicator = new ThresholdIndicator(this); + } + + disable() { + this._indicator?.destroy(); + this._indicator = null; + } +} \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-active-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-active-symbolic.svg new file mode 100644 index 0000000..6484d27 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-active-symbolic.svg @@ -0,0 +1,47 @@ + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-active.svg b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-active.svg new file mode 100644 index 0000000..a3bc8be --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-active.svg @@ -0,0 +1,47 @@ + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-app-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-app-symbolic.svg new file mode 100644 index 0000000..6bb7b61 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-app-symbolic.svg @@ -0,0 +1,47 @@ + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-error-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-error-symbolic.svg new file mode 100644 index 0000000..9b7e2b4 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-error-symbolic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-error.svg b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-error.svg new file mode 100644 index 0000000..84f5f4e --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-error.svg @@ -0,0 +1,39 @@ + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-inactive-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-inactive-symbolic.svg new file mode 100644 index 0000000..3b712bd --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-inactive-symbolic.svg @@ -0,0 +1,45 @@ + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-inactive.svg b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-inactive.svg new file mode 100644 index 0000000..a32eb26 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-inactive.svg @@ -0,0 +1,45 @@ + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-unknown-symbolic.svg b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-unknown-symbolic.svg new file mode 100644 index 0000000..4097173 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-unknown-symbolic.svg @@ -0,0 +1,45 @@ + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-unknown.svg b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-unknown.svg new file mode 100644 index 0000000..4136530 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/icons/threshold-unknown.svg @@ -0,0 +1,45 @@ + + + + + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/libs/driver.js b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/libs/driver.js new file mode 100644 index 0000000..f19e4e0 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/libs/driver.js @@ -0,0 +1,857 @@ +/** + * Driver for handling thresholds in Lenovo ThinkPad series for models since 2011 + * + * Based on information from https://linrunner.de/tlp/faq/battery.html + * + * Original sources: https://github.com/linrunner/TLP/blob/main/bat.d/05-thinkpad + */ +'use strict'; + +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; +import Gio from 'gi://Gio'; + +// Driver constants +const BASE_PATH = '/sys/class/power_supply'; +const START_FILE_OLD = 'charge_start_threshold'; // kernel 4.17 and newer +const END_FILE_OLD = 'charge_stop_threshold'; // kernel 4.17 and newer +const START_FILE_NEW = 'charge_control_start_threshold'; // kernel 5.9 and newer +const END_FILE_NEW = 'charge_control_end_threshold'; // kernel 5.9 and newer + +/** + * Read file contents + * + * @param {string} path Path of file + * @returns {string} File contents + */ +const readFile = function(path) { + try { + const f = Gio.File.new_for_path(path); + const [, contents,] = f.load_contents(null); + const decoder = new TextDecoder('utf-8'); + return decoder.decode(contents); + } catch (e) { + return null; + } +} + +/** + * Read integer value from file + * + * @param {string} path Path of file + * @returns {number|null} Return a integer or null + */ +const readFileInt = function(path) { + try { + const v = readFile(path); + if (v) { + return parseInt(v); + } else { + return null; + } + } catch (e) { + return null; + } +} + +/** + * Test file/direcory exists + * + * @param {string} path File/directory path + * @returns {boolean} + */ +const fileExists = function(path) { + try { + const f = Gio.File.new_for_path(path); + return f.query_exists(null); + } catch (e) { + return false; + } +} + +/** + * Environment object + */ +const Environment = GObject.registerClass({ + GTypeName: 'Environment', +}, class Environment extends GObject.Object { + + get productVersion() { + if (this._productVersion === undefined) { + const tmp = readFile('/sys/class/dmi/id/product_version'); + if (tmp) { + // Remove non-alphanumeric characters + const sanitize = /([^ A-Za-z0-9])+/g; + this._productVersion = tmp.replace(sanitize, ''); + } else { + this._productVersion = null; + } + } + return this._productVersion; + } + + get kernelRelease() { + if (this._kernelRelease === undefined) { + try { + let proc = Gio.Subprocess.new( + ['uname', '-r'], + Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE + ); + const [ok, stdout, stderr] = proc.communicate_utf8(null, null); + proc = null; + this._kernelRelease = stdout.trim(); + } catch (e) { + logError(e); + } + } + return this._kernelRelease; + } + + get kernelMajorVersion() { + if (this._kernelMajorVersion === undefined) { + [this._kernelMajorVersion , this._kernelMinorVersion] = this.kernelRelease.split('.', 2); + } + return this._kernelMajorVersion; + } + + get kernelMinorVersion() { + if (this._kernelMinorVersion === undefined) { + [this._kernelMajorVersion , this._kernelMinorVersion] = this.kernelRelease.split('.', 2); + } + return this._kernelMinorVersion; + } + + checkMinKernelVersion(major, minor) { + return ( + this.kernelMajorVersion > major || + (this,this.kernelMajorVersion === major && this.kernelMinorVersion >= minor) + ); + } + +}); + +/** + * Execute a command and generate events based on its result + * + * @param {string} command Command to execute + * @param {boolean} asRoot True to run with elevated permissions + */ +const Runnable = GObject.registerClass({ + GTypeName: 'Runnable', + Signals: { + 'command-completed': { + param_types: [GObject.TYPE_JSOBJECT /* erro */] + } + } +}, class Runnable extends GObject.Object { + constructor(command, asRoot = false) { + super(); + if (!command) { + throw Error('The command cannot be an empty string'); + } + this._command = command; + this._asRoot = asRoot; + } + + run() { + const argv = ['sh', '-c', this._command]; + + if (this._asRoot) { + argv.unshift('pkexec'); + } + + try { + const [, pid] = GLib.spawn_async(null, argv, null, GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD, null); + + GLib.child_watch_add(GLib.PRIORITY_DEFAULT_IDLE, pid, (pid, status) => { + try { + GLib.spawn_check_exit_status(status); + this.emit('command-completed', null); + } catch(e) { + if (e.code == 126) { + // Cancelled + } else { + logError(e); + this.emit('command-completed', e); + } + } + GLib.spawn_close_pid(pid); + }); + } catch (e) { + logError(e); + this.emit('command-completed', e); + } + } +}); + +/** + * ThinkPad battery object + */ +export const ThinkPadBattery = GObject.registerClass({ + GTypeName: 'ThinkPadBattery', + Properties: { + 'environment': GObject.ParamSpec.object( + 'environment', + 'Environment', + 'Environment', + GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, + Environment.$gtype + ), + 'name': GObject.ParamSpec.string( + 'name', + 'Name', + 'Battery name', + GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, + null + ), + 'auth-required': GObject.ParamSpec.boolean( + 'auth-required', + 'Auth required', + 'Authorization is required to write the values', + GObject.ParamFlags.READABLE, + false + ), + 'is-active': GObject.ParamSpec.boolean( + 'is-active', + 'Is active', + 'Indicates if the thresholds are active or not', + GObject.ParamFlags.READABLE, + false + ), + 'is-available': GObject.ParamSpec.boolean( + 'is-available', + 'Is available', + 'Indicates if the battery are available or not', + GObject.ParamFlags.READABLE, + false + ), + 'pending-changes': GObject.ParamSpec.boolean( + 'pending-changes', + 'Pending changes', + 'Indicates if the current values do not match the configured values', + GObject.ParamFlags.READABLE, + false + ), + 'start-value': GObject.ParamSpec.int( + 'start-value', + 'Start value', + 'Current start value', + GObject.ParamFlags.READABLE, + 0, 100, + 0 + ), + 'end-value': GObject.ParamSpec.int( + 'end-value', + 'End value', + 'Current end value', + GObject.ParamFlags.READABLE, + 0, 100, + 100 + ), + 'settings': GObject.ParamSpec.object( + 'settings', + 'Settings', + 'Settings', + GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, + Gio.Settings.$gtype + ), + }, + Signals: { + 'enable-completed': { + param_types: [GObject.TYPE_JSOBJECT /* error */] + }, + 'disable-completed': { + param_types: [GObject.TYPE_JSOBJECT /* error */] + }, + }, +}, class ThinkPadBattery extends GObject.Object { + constructor(constructProperties = {}) { + super(constructProperties); + + if (!this.name) { + throw Error('Battery name not defined'); + } + + // Signals handlers IDs + this._monitorId = null; + this._settingStartId = null; + this._settingEndId = null; + this._startId = null; + this._endId = null; + + // Battery directory + this._baseDirectoryPath = `${BASE_PATH}/${this.name}`; + this._baseDirectory = Gio.File.new_for_path(this._baseDirectoryPath); + + // Set paths + if (this.environment.checkMinKernelVersion(5, 9)) { // kernel 5.9 and newer + this._startFilePath = `${BASE_PATH}/${this.name}/${START_FILE_NEW}`; + this._endFilePath = `${BASE_PATH}/${this.name}/${END_FILE_NEW}`; + } else if (this.environment.checkMinKernelVersion(4, 17)) { // kernel 4.17 and newer + this._startFilePath = `${BASE_PATH}/${this.name}/${START_FILE_OLD}`; + this._endFilePath = `${BASE_PATH}/${this.name}/${END_FILE_OLD}`; + } else { // Unsupported kernel + throw Error(`Unsupported kernel version (${this.environment.kernelRelease}). A kernel version greater than or equal to 4.17 is required.`); + } + + // Activate the directory monitor + try { + this._baseMonitor = this._baseDirectory.monitor_directory(Gio.FileMonitorFlags.NONE, null); + this._monitorId = this._baseMonitor.connect( + 'changed', (obj, file, otherFile, eventType) => { + const filePath = file.get_path(); + switch (eventType) { + case Gio.FileMonitorEvent.CHANGES_DONE_HINT: + case Gio.FileMonitorEvent.CREATED: + case Gio.FileMonitorEvent.DELETED: + switch (filePath) { + case this._startFilePath: + this.startValue = readFileInt(this._startFilePath); + break; + case this._endFilePath: + this.endValue = readFileInt(this._endFilePath); + break; + case this._baseDirectoryPath: + this.startValue = readFileInt(this._startFilePath); + this.endValue = readFileInt(this._endFilePath); + break; + default: + break; + } + break; + case Gio.FileMonitorEvent.ATTRIBUTE_CHANGED: + this.authRequired = this._checkAuthRequired(); + break; + default: + break; + } + } + ); + } catch (e) { + logError(e, this.name); + } + + // Update flags on changes in threshold values + this._startId = this.connect( + 'notify::start-value', () => { + this.isActive = this._checkActive(); + this.isAvailable = this.startValue !== null || this.endValue !== null; + this.pendingChanges = this._checkPendingChanges(); + } + ); + this._endId = this.connect( + 'notify::end-value', () => { + this.isActive = this._checkActive(); + this.isAvailable = this.startValue !== null || this.endValue !== null; + this.pendingChanges = this._checkPendingChanges(); + } + ); + + // Update pending changes flag on changes to setting values + this._settingStartId = this.settings.connect( + `changed::start-${this.name.toLowerCase()}`, () => { + this.pendingChanges = this._checkPendingChanges(); + } + ); + this._settingEndId = this.settings.connect( + `changed::end-${this.name.toLowerCase()}`, () => { + this.pendingChanges = this._checkPendingChanges(); + } + ); + + // Load initial values + this.startValue = readFileInt(this._startFilePath); + this.endValue = readFileInt(this._endFilePath); + this.authRequired = this._checkAuthRequired(); + } + + /** + * Check if thresholds is active + * + * @returns {boolean} Returns true if the battery has active thresholds + */ + _checkActive() { + // RegExs + /* On some models the start threshold 0 is not allowed, instead 95 is used (Ex: E14 Gen 3) + * See issue #8: https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues/8 + */ + const disableStart95 = /(Think[pP]ad) (E14 Gen 3)/; + + if (this.environment.productVersion.search(disableStart95) >= 0) { + return (this.startValue !== 95 && this.startValue !== null) || (this.endValue !== 100 && this.endValue !== null); + } else { + return (this.startValue !== 0 && this.startValue !== null) || (this.endValue !== 100 && this.endValue !== null); + } + } + + /** + * Check if there are changes to the settings that need to be applied + * + * @returns {boolean} Returns true if there are changes to the settings that need to be applied + */ + _checkPendingChanges() { + const startSetting = this.settings.get_int(`start-${this.name.toLowerCase()}`); + const endSetting = this.settings.get_int(`end-${this.name.toLowerCase()}`); + return ((this.startValue != null && this.startValue !== startSetting) || (this.endValue != null && this.endValue !== endSetting)); + } + + /** + * Check if authentication is required to apply the changes + * + * @returns {boolean} Returns true if authentication is required to apply the changes + */ + _checkAuthRequired() { + try { + const f = Gio.File.new_for_path(this._startFilePath); + const info = f.query_info('access::*', Gio.FileQueryInfoFlags.NONE, null); + if (!info.get_attribute_boolean('access::can-write')) { + return true; + } + } catch (e) { + // Ignored + } + + try { + const f = Gio.File.new_for_path(this._endFilePath); + const info = f.query_info('access::*', Gio.FileQueryInfoFlags.NONE, null); + if (!info.get_attribute_boolean('access::can-write')) { + return true; + } + } catch (e) { + // Ignored + } + return false; + } + + get authRequired() { + return this._authRequired; + } + + set authRequired(value) { + if (this.authRequired !== value) { + this._authRequired = value; + this.notify('auth-required'); + } + } + + get isActive() { + return this._isActive; + } + + set isActive(value) { + if (this.isActive !== value) { + this._isActive = value; + this.notify('is-active'); + } + } + + get isAvailable() { + return this._isAvaialble; + } + + set isAvailable(value) { + if (this.isAvailable !== value) { + this._isAvaialble = value; + this.notify('is-available'); + } + } + + get startValue() { + return this._startValue; + } + + set startValue(value) { + if (this.startValue !== value) { + this._startValue = value; + this.notify('start-value'); + } + } + + get endValue() { + return this._endValue; + } + + set endValue(value) { + if (this.endValue !== value) { + this._endValue = value; + this.notify('end-value'); + } + } + + get pendingChanges() { + return this._pendingChanges; + } + + set pendingChanges(value) { + if (this.pendingChanges !== value) { + this._pendingChanges = value; + this.notify('pending-changes'); + } + } + + /** + * Returns the command to set the thresholds. + * This function does not run the command, it just returns the string corresponding to the command. + * Passed values are not validated by the function, it is your responsibility to validate them first. + * + * @param {number} start Start value + * @param {number} end End value + * @returns {string|null} Command to modify the thresholds + */ + _getSetterCommand(start, end) { + if (!this.isAvailable) { + return null; + } + + if (!Number.isInteger(start) || !Number.isInteger(end)) { + throw TypeError(`Thresholds (${start}/${end}) on battery (${this.name}) are not integer`); + } + + if (start < 0 || end > 100 || start >= end) { + throw RangeError(`Thresholds (${start}/${end}) on battery (${this.name}) out of range`); + } + + // Commands + const setStart = `echo ${start.toString()} > ${this._startFilePath}`; + const setEnd = `echo ${end.toString()} > ${this._endFilePath}`; + + let oldStart = this.startValue; + let oldEnd = this.endValue; + + if ((oldStart === start || oldStart === null) && (oldEnd === end || oldEnd === null)) { + // Same thresholds + return null; + } + + if (oldStart >= oldEnd) { + // Invalid threshold reading, happens on ThinkPad E/L series + oldStart = null; + oldEnd = null; + } + + let command = null; + + if (fileExists(this._startFilePath) && fileExists(this._endFilePath)) { + if (oldStart === start) { // Same start, apply only stop + command = setEnd; + } else if (oldEnd === end) { // Same stop, apply only start + command = setStart; + } else { + // Determine sequence + let startStopSequence = true; + if (oldEnd != null && start > oldEnd) { + startStopSequence = false; + } + if (startStopSequence) { + command = setStart + ' && ' + setEnd; + } else { + command = setEnd + ' && ' + setStart; + } + } + } else if (fileExists(this._startFilePath)) { // Only start available + command = setStart; + } else if (fileExists(this._endFilePath)) { // Only stop available + command = setEnd; + } + + return command; + } + + /** + * Get the command string to enable the configured thresholds + * + * @returns {string|null} Enable thresholds command string + */ + get enableCommand() { + const startSetting = this.settings.get_int(`start-${this.name.toLowerCase()}`); + const endSetting = this.settings.get_int(`end-${this.name.toLowerCase()}`); + return this._getSetterCommand(startSetting, endSetting); + } + + /** + * Get the command string to disable the thresholds + * + * @returns {string|null} Enable thresholds command string + */ + get disableCommand() { + return this._getSetterCommand(0, 100); + } + + /** + * Enable the configured thresholds + */ + enable() { + const command = this.enableCommand; + if (!command) { + return; + } + const runnable = new Runnable(command, this.authRequired); + runnable.connect('command-completed', (obj, error) => { + this.emit('enable-completed', error); + }) + runnable.run(); + } + + /** + * Disable thresholds + */ + disable() { + const command = this.disableCommand; + if (!command) { + return; + } + const runnable = new Runnable(command, this.authRequired); + runnable.connect('command-completed', (obj, error) => { + this.emit('disable-completed', error); + }) + runnable.run(); + } + + /** + * Toggle thresholds status + */ + toggle() { + this.isActive ? this.disable() : this.enable(); + } + + destroy() { + if (this._startId) { + this.disconnect(this._startId); + } + if (this._endId) { + this.disconnect(this._endId); + } + if (this._settingStartId) { + this.settings.disconnect(this._settingStartId); + } + if (this._settingEndId) { + this.settings.disconnect(this._settingEndId); + } + if (this._monitorId) { + this._baseMonitor.disconnect(this._monitorId); + } + this._baseMonitor.cancel(); + this._baseMonitor = null; + this._baseDirectory = null; + } +}); + +export const ThinkPad = GObject.registerClass({ + GTypeName: 'ThinkPad', + Properties: { + 'environment': GObject.ParamSpec.object( + 'environment', + 'Environment', + 'Environment', + GObject.ParamFlags.READABLE, + Environment.$gtype + ), + 'is-active': GObject.ParamSpec.boolean( + 'is-active', + 'Is active', + 'Indicates if the thresholds are active or not', + GObject.ParamFlags.READABLE, + false + ), + 'is-available': GObject.ParamSpec.boolean( + 'is-available', + 'Is available', + 'Indicates if the battery are available or not', + GObject.ParamFlags.READABLE, + false + ), + 'batteries': GObject.ParamSpec.jsobject( + 'batteries', + 'Batteries', + 'Batteries object', + GObject.ParamFlags.READWRITE, + [] + ), + 'settings': GObject.ParamSpec.object( + 'settings', + 'Settings', + 'Settings', + GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, + Gio.Settings.$gtype + ), + }, + Signals: { + 'enable-battery-completed': { + param_types: [GObject.TYPE_OBJECT /* battery */, GObject.TYPE_JSOBJECT /* error */] + }, + 'disable-battery-completed': { + param_types: [GObject.TYPE_OBJECT /* battery */, GObject.TYPE_JSOBJECT /* error */] + }, + 'enable-all-completed': { + param_types: [GObject.TYPE_JSOBJECT /* error */] + }, + 'disable-all-completed': { + param_types: [GObject.TYPE_JSOBJECT /* error */] + }, + }, +}, class ThinkPad extends GObject.Object { + constructor(constructProperties = {}) { + super(constructProperties); + + if (!this.environment.checkMinKernelVersion(4, 17)) { + logError(new Error(`Kernel ${this.environment.kernelRelease} not supported`)); + this.batteries = []; + return; + } + + // Signals handlers IDs + this._batteriesId = {}; + + // Define batteries + this.batteries = [ + new ThinkPadBattery({ + 'environment': this.environment, + 'name': 'BAT0', + 'settings': this.settings + }), + new ThinkPadBattery({ + 'environment': this.environment, + 'name': 'BAT1', + 'settings': this.settings + }), + ]; + + // Connect the signals from the batteries to update the flags and notify commands + this.batteries.forEach(battery => { + const isAvailableId = battery.connect( + 'notify::is-available', (bat) => { + this.isAvailable = this._checkAvailable(); + } + ); + const isActiveId = battery.connect( + 'notify::is-active', (bat) => { + this.isActive = this._checkActive(); + } + ); + const enableCompletedId = battery.connect( + 'enable-completed', (bat, error) => { + this.emit('enable-battery-completed', bat, error); + } + ); + const disableCompletedId = battery.connect( + 'disable-completed', (bat, error) => { + this.emit('disable-battery-completed', bat, error); + } + ); + this._batteriesId[battery.name] = [isAvailableId, isActiveId, enableCompletedId, disableCompletedId]; + }); + + // Load initial values + this.isAvailable = this._checkAvailable(); + this.isActive = this._checkActive(); + } + + get environment() { + if (this._environment === undefined) { + this._environment = new Environment(); + } + return this._environment; + } + + get isAvailable() { + return this._isAvaialble; + } + + set isAvailable(value) { + if (this.isAvailable !== value) { + this._isAvaialble = value; + this.notify('is-available'); + } + } + + get isActive() { + return this._isActive; + } + + set isActive(value) { + if (this.isActive !== value) { + this._isActive = value; + this.notify('is-active'); + } + } + + /** + * Check if at least one battery has the thresholds active + * + * @returns {boolean} Returns true if at least one battery has the thresholds active + */ + _checkActive() { + return this.batteries.some(bat => { + return bat.isActive && bat.isAvailable; + }); + } + + /** + * Check if at least one battery is available to apply the thresholds + * + * @returns {boolean} Returns true if at least one battery is available to apply the thresholds + */ + _checkAvailable() { + return this.batteries.some(bat => { + return bat.isAvailable; + }); + } + + /** + * Enable all configured thresholds + */ + enableAll() { + let command = ''; + let authRequired = false; + this.batteries.forEach(battery => { + const batteryCommand = battery.enableCommand; + if (batteryCommand) { + command = `${command}${command ? ' && ' : ''}${batteryCommand}`; + authRequired = authRequired || battery.authRequired; + } + }); + if (!command) { + return; + } + const runnable = new Runnable(command, authRequired); + runnable.connect('command-completed', (obj, error) => { + this.emit('enable-all-completed', error); + }) + runnable.run(); + } + + /** + * Disable all thresholds + */ + disableAll() { + let command = ''; + let authRequired = false; + this.batteries.forEach(battery => { + const batteryCommand = battery.disableCommand; + if (batteryCommand) { + command = `${command}${command ? ' && ' : ''}${batteryCommand}`; + authRequired = authRequired || battery.authRequired; + } + }); + if (!command) { + return; + } + const runnable = new Runnable(command, authRequired); + runnable.connect('command-completed', (obj, error) => { + this.emit('disable-all-completed', error); + }) + runnable.run(); + } + + destroy() { + if (this._batteriesId) { + this.batteries.forEach(battery => { + const ids = this._batteriesId[battery.name]; + ids.forEach(id => { + battery.disconnect(id); + }); + battery.destroy() + }); + } + } +}); \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/libs/indicator.js b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/libs/indicator.js new file mode 100644 index 0000000..4e27e13 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/libs/indicator.js @@ -0,0 +1,431 @@ +'use strict'; + +import Clutter from 'gi://Clutter'; +import St from 'gi://St'; +import GObject from 'gi://GObject'; +import GLib from 'gi://GLib'; +import Gio from 'gi://Gio'; + +import {gettext as _, ngettext} from 'resource:///org/gnome/shell/extensions/extension.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js'; +import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; +import * as QuickSettings from 'resource:///org/gnome/shell/ui/quickSettings.js'; +import * as Config from 'resource://org/gnome/shell/misc/config.js'; + +import { ThinkPad } from './driver.js'; + +const ICONS_PATH = GLib.Uri.resolve_relative(import.meta.url, '../icons', GLib.UriFlags.NONE); +const SHELL_VERSION = Number(Config.PACKAGE_VERSION.split('.', 1)); + +/** + * Get icon + * + * @param {string} iconName Icon name + * @param {boolean} colorMode Color mode or symbolic + * @returns {Gio.Icon} + */ +function getIcon(iconName, colorMode = false) { + return Gio.icon_new_for_string(`${ICONS_PATH}/${iconName}${colorMode ? '' : '-symbolic'}.svg`); +} + +const BatteryItem = GObject.registerClass({ + GTypeName: 'BatteryItem', +}, class BatteryItem extends PopupMenu.PopupImageMenuItem { + constructor(battery, settings) { + super('', null); + + this._settings = settings; + this._battery = battery; + + // Flag to prevent the PopupImageMenuItem from being activated when the reload icon is clicked + this._reloading = false; + + const box = new St.BoxLayout({ + 'opacity': 128, + 'x_expand': true, + 'x_align': Clutter.ActorAlign.END, + 'style': 'spacing: 5px;', + }); + + this.add_child(box); + + // Reload icon + this._reload = new St.Icon({ + 'icon-size': 16, + 'reactive': true, + 'icon-name': 'view-refresh-symbolic', + }); + this._reload.connectObject( + 'button-press-event', () => { + this._reloading = true; + this._battery.enable(); + return true; // Does not prevent event propagation??? + }, + this + ); + box.add_child(this._reload); + + this._valuesLabel = new St.Label({ + 'y_align': Clutter.ActorAlign.CENTER, + 'style': 'font-size: 0.75em;', + }); + box.add_child(this._valuesLabel); + + // Battery signals + this._battery.connectObject( + 'notify', () => { + this._update(); + }, + this + ); + + // Settings changes + this._settings.connectObject( + 'changed', () => { + this._update(); + }, + this + ); + + // Menu item action + this.connectObject( + 'activate', () => { + if (!this._reloading) { + this._battery.toggle(); + } + this._reloading = false; + }, + 'destroy', () => { + this._settings.disconnectObject(this); + this._battery.disconnectObject(this); + this._reload.disconnectObject(this); + this.disconnectObject(this); + this._valuesLabel.destroy(); + this._valuesLabel = null; + this._reload.destroy(); + this._reload = null; + this._battery = null; + this._settings = null; + }, + this + ); + + this._update(); + } + + /** + * Update UI + */ + _update() { + const colorMode = this._settings.get_boolean('color-mode'); + // Menu text and icon + if (this._battery.isActive) { + // TRANSLATORS: %s is the name of the battery. + this.label.text = _('Disable thresholds (%s)').format(this._battery.name); + this.setIcon(getIcon('threshold-active', colorMode)); + // Status text + const showCurrentValues = this._settings.get_boolean('show-current-values'); + if (showCurrentValues) { + // TRANSLATORS: %d/%d are the [start/end] threshold values. The string %% is the percent symbol (may need to be escaped depending on the language) + this._valuesLabel.text = _('%d/%d %%').format(this._battery.startValue || 0, this._battery.endValue || 100); + this._valuesLabel.visible = true; + } else { + this._valuesLabel.visible = false; + } + } else { + // TRANSLATORS: %s is the name of the battery. + this.label.text = _('Enable thresholds (%s)').format(this._battery.name); + this.setIcon(getIcon('threshold-inactive', colorMode )); + this._valuesLabel.visible = false; + } + // Reload 'button' + this._reload.visible = this._battery.pendingChanges && this._battery.isActive; + // Menu item visibility + this.visible = this._battery.isAvailable; + } +}); + +const ThresholdToggle = GObject.registerClass({ + GTypeName: 'ThresholdToggle', +}, class ThresholdToggle extends QuickSettings.QuickMenuToggle { + constructor(driver, extensionObject) { + super({ + 'title': _('Thresholds'), + 'gicon': getIcon('threshold-app'), + 'toggle-mode': false, + //'subtitle': 'subtitle' + }); + + // Header + this.menu.setHeader( + getIcon('threshold-app'), // Icon + _('Battery Threshold'), // Title + driver.environment.productVersion ? driver.environment.productVersion : _('Unknown model')// Subtitle + ); + + // Unavailable + this.unavailableMenuItem = new PopupMenu.PopupImageMenuItem(_('Thresholds not available'), getIcon('threshold-unknown')); + this.unavailableMenuItem.sensitive = false; + this.unavailableMenuItem.visible = false; + this.menu.addMenuItem(this.unavailableMenuItem); + + // Batteries + driver.batteries.forEach(battery => { + // Battery menu item + const item = new BatteryItem(battery, extensionObject.getSettings()); + this.menu.addMenuItem(item); + }); + + // Unavailable status + this.unavailableMenuItem.visible = !driver.isAvailable; + + // Checked status + this.checked = driver.isActive; + + // Driver signals + driver.connectObject( + 'notify::is-active', () => { + this.checked = driver.isActive; + }, + 'notify::is-available', () => { + this.unavailableMenuItem.visible = !driver.isAvailable; + }, + this + ); + + // Signals + this.connectObject( + 'clicked', () => { + if (driver.isActive) { + driver.disableAll(); + } else { + driver.enableAll(); + } + }, + 'destroy', () => { + this.disconnectObject(this); + driver.disconnectObject(this); + this.menu.removeAll(); + }, + this + ); + + // Add an entry-point for more getSettings() + this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); + const settingsItem = this.menu.addAction(_('Thresholds settings'), + () => extensionObject.openPreferences()); + + // Ensure the getSettings() are unavailable when the screen is locked + settingsItem.visible = Main.sessionMode.allowSettings; + this.menu._settingsActions[extensionObject.uuid] = settingsItem; + } +}); + +export const ThresholdIndicator = GObject.registerClass({ + GTypeName: 'ThresholdIndicator', +}, class ThresholdIndicator extends QuickSettings.SystemIndicator { + constructor(extensionObject) { + super(); + + this._settings = extensionObject.getSettings(); + this._driver = new ThinkPad({'settings': this._settings}) + this._name = extensionObject.metadata.name; + + this._indicator = this._addIndicator(); + this._indicator.gicon = getIcon('threshold-unknown'); + + this.quickSettingsItems.push(new ThresholdToggle(this._driver, extensionObject)); + + Main.panel.statusArea.quickSettings.addExternalIndicator(this); + + this._updateIndicator(); + + // Driver signals + this._driver.connectObject( + 'notify::is-available', () => { + this._updateIndicator(); + }, + 'notify::is-active', () => { + this._updateIndicator(); + }, + 'enable-battery-completed', (driver, battery, error) => { + if (!error) { + this._notifyEnabled( + // TRANSLATORS: %s is the name of the battery. %d/%d are the [start/end] threshold values. The string %% is the percent symbol (may need to be escaped depending on the language) + _('Battery (%s) charge thresholds enabled at %d/%d %%').format( + battery.name, battery.startValue || 0, battery.endValue || 100 + ) + ); + } else { + this._notifyError( + // TRANSLATORS: The first %s is the name of the battery. The second %s is the error message. \n is new line. + _('Failed to enable thresholds on battery %s. \nError: %s').format( + battery.name, error.message + ) + ); + } + }, + 'disable-battery-completed', (driver, battery, error) => { + if (!error) { + this._notifyDisabled( + // TRANSLATORS: %s is the name of the battery. + _('Battery (%s) charge thresholds disabled').format( + battery.name + ) + ); + } else { + this._notifyError( + // TRANSLATORS: The first %s is the name of the battery. The second %s is the error message. \n is new line. + _('Failed to disable thresholds on battery %s. \nError: %s').format( + battery.name, error.message + ) + ); + } + }, + 'enable-all-completed', (driver, error) => { + if (!error) { + this._notifyEnabled(_('Thresholds enabled for all batteries')) + } else { + this._notifyError( + // TRANSLATORS: %s is the error message. \n is new line. + _('Failed to enable thresholds for all batteries. \nError: %s').format( + error.message + ) + ); + } + }, + 'disable-all-completed', (driver, error) => { + if (!error) { + this._notifyDisabled(_('Thresholds disabled for all batteries')); + } else { + this._notifyError( + // TRANSLATORS: %s is the error message. \n is new line. + _('Failed to disable thresholds for all batteries. \nError: %s').format( + error.message + ) + ); + } + }, + this + ); + + // Settings signals + this._settings.connectObject( + 'changed::color-mode', () => { + this._updateIndicator(); + }, + 'changed::indicator-mode', () => { + this._updateIndicator(); + }, + this + ); + + this.connect('destroy', () => { + this.quickSettingsItems.forEach(item => item.destroy()); + this._settings.disconnectObject(this); + this._settings = null; + this._driver.disconnectObject(this); + this._driver.destroy(); + this._driver = null; + this._extension = null; + }); + } + + /** + * Update indicator (tray-icon) + */ + _updateIndicator() { + const colorMode = this._settings.get_boolean('color-mode'); + if (this._driver.isAvailable) { + if (this._driver.isActive) { + this._indicator.gicon = getIcon('threshold-active', colorMode); + } else { + this._indicator.gicon = getIcon('threshold-inactive', colorMode); + } + } else { + this._indicator.gicon = getIcon('threshold-unknown', colorMode); + } + + const indicatorMode = this._settings.get_enum('indicator-mode'); + switch (indicatorMode) { + case 0: // Active + this._indicator.visible = this._driver.isActive; + break; + case 1: // Inactive + this._indicator.visible = !this._driver.isActive; + break; + case 2: // Always + this._indicator.visible = true; + break; + case 3: // Never + this._indicator.visible = false; + break; + default: + this._indicator.visible = true; + break; + } + } + + /** + * Show notificaion. + * + * @param {string} msg Title + * @param {string} details Message + * @param {string} iconName Icon name + */ + _notify(msg, details, iconName) { + if (!this._settings.get_boolean('show-notifications')) return; + const colorMode = this._settings.get_boolean('color-mode'); + if (SHELL_VERSION === 45) { + const source = new MessageTray.Source(this._name); + Main.messageTray.add(source); + const notification = new MessageTray.Notification( + source, + msg, + details, + {gicon: getIcon(iconName, colorMode)} + ); + notification.setTransient(true); + source.showNotification(notification); + } else { + const source = new MessageTray.Source({'title': this._name}); + Main.messageTray.add(source); + const notification = new MessageTray.Notification({ + source: source, + title: msg, + body: details, + isTransient: true, + gicon: getIcon(iconName, colorMode) + }); + source.addNotification(notification); + } + } + + /** + * Show error notification + * + * @param {string} message Message + */ + _notifyError(message) { + this._notify(_('Battery Threshold'), message, 'threshold-error'); + } + + /** + * Show enabled notification + * + * @param {string} message Message + */ + _notifyEnabled(message) { + this._notify(_('Battery Threshold'), message, 'threshold-active'); + } + + /** + * Show disabled notification + * + * @param {string} message Message + */ + _notifyDisabled(message) { + this._notify(_('Battery Threshold'), message, 'threshold-inactive'); + } +}); \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/cs/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/cs/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..0592953 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/cs/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/de/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/de/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..532a68e Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/de/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/es/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/es/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..8a8c663 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/es/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/fr/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/fr/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..4e7e869 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/fr/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/it/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/it/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..6dbea71 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/it/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/ja/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/ja/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..fd93464 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/ja/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/nb_NO/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/nb_NO/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..f852e26 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/nb_NO/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/pt/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/pt/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..da9e2ef Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/pt/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/pt_BR/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/pt_BR/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..fc4192c Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/pt_BR/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/ru/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/ru/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo new file mode 100644 index 0000000..b09ee32 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/ru/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/metadata.json b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/metadata.json new file mode 100644 index 0000000..3f2d6bf --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/metadata.json @@ -0,0 +1,14 @@ +{ + "_generated": "Generated by SweetTooth, do not edit", + "description": "Enable/Disable battery threshold on Lenovo Thinkpad laptops.\n\nIf you mainly use the system with the AC power adapter connected and only use the battery sporadically, you can increase battery life by setting the maximum charge value to less than 100%. This is useful because batteries that are used sporadically have a longer lifespan when kept at less than full charge.", + "gettext-domain": "thinkpad-battery-threshold@marcosdalvarez.org", + "name": "Thinkpad Battery Threshold", + "settings-schema": "org.gnome.shell.extensions.thinkpad-battery-threshold", + "shell-version": [ + "45", + "46" + ], + "url": "https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension", + "uuid": "thinkpad-battery-threshold@marcosdalvarez.org", + "version": 44 +} \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/about.js b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/about.js new file mode 100644 index 0000000..d547b1a --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/about.js @@ -0,0 +1,55 @@ +'use strict' + +import GLib from 'gi://GLib'; +import Adw from 'gi://Adw'; +import GObject from 'gi://GObject'; +import Gio from 'gi://Gio'; +import Gtk from 'gi://Gtk'; +import Gdk from 'gi://Gdk'; + +export const About = GObject.registerClass({ + GTypeName: 'AboutPrefs', + Template: GLib.Uri.resolve_relative(import.meta.url, '../ui/about.ui',GLib.UriFlags.NONE), + InternalChildren: [ + 'app_icon_image', + 'app_name_label', + 'version_label', + ] +}, class About extends Adw.PreferencesPage { + constructor(window) { + super({}); + + this._app_icon_image.gicon = Gio.icon_new_for_string(`${GLib.Uri.resolve_relative(import.meta.url, '../icons/threshold-active.svg',GLib.UriFlags.NONE)}`); + this._app_name_label.label = window._metadata.name; + this._version_label.label = window._metadata.version.toString(); + + // setup menu actions + const actionGroup = new Gio.SimpleActionGroup(); + window.insert_action_group('prefs', actionGroup); + + // a list of actions with their associated link + const actions = [ + { + name: 'open-bug-report', + link: 'https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues' + }, + { + name: 'open-readme', + link: 'https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/' + }, + { + name: 'open-license', + link: 'https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/blob/main/LICENSE' + }, + ]; + + actions.forEach(action => { + let act = new Gio.SimpleAction({ name: action.name }); + act.connect( + 'activate', + _ => Gtk.show_uri(window, action.link, Gdk.CURRENT_TIME) + ); + actionGroup.add_action(act); + }); + } +}); \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/general.js b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/general.js new file mode 100644 index 0000000..59eb0f9 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/general.js @@ -0,0 +1,75 @@ +'use strict' + +import GLib from 'gi://GLib'; +import Adw from 'gi://Adw'; +import GObject from 'gi://GObject'; +import Gio from 'gi://Gio'; + +import * as Utils from './utils.js'; + +export const General = GObject.registerClass({ + GTypeName: 'GeneralPrefs', + Template: GLib.Uri.resolve_relative(import.meta.url, '../ui/general.ui',GLib.UriFlags.NONE), + InternalChildren: [ + 'indicator_mode', + 'color_mode', + 'show_values', + 'show_notifications', + 'reset_all', + 'reset_dialog', + ], +}, class General extends Adw.PreferencesPage { + constructor(window) { + super({}); + + Utils.bindAdwComboRow(this._indicator_mode, window._settings, 'indicator-mode'); + window._settings.bind( + 'color-mode', + this._color_mode, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + window._settings.bind( + 'show-current-values', + this._show_values, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + window._settings.bind( + 'show-notifications', + this._show_notifications, + 'active', + Gio.SettingsBindFlags.DEFAULT + ); + + this._reset_dialog.connect('response', (obj, response, data) => { + if (response === 'reset') { + this._resetSettings(window._settings); + window._driver.enableAll(); + } + }); + + this._reset_all.connect('clicked', () => { + this._reset_dialog.transientFor = this.root; + this._reset_dialog.present(); + }); + } + + /** + * Reset all (recursively) settings values to default + * + * @param {Gio.Settings} settings Settings to reset + */ + _resetSettings(settings) { + const keys = settings.settings_schema.list_keys(); + keys.forEach(key => { + settings.reset(key); + }); + + const childrens = settings.settings_schema.list_children(); + childrens.forEach(children => { + const childrenSettings = settings.get_child(children); + this._resetSettings(childrenSettings); + }); + } +}); \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/thinkpad.js b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/thinkpad.js new file mode 100644 index 0000000..133ad85 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/thinkpad.js @@ -0,0 +1,119 @@ +'use strict' + +import GLib from 'gi://GLib'; +import Adw from 'gi://Adw'; +import GObject from 'gi://GObject'; +import Gio from 'gi://Gio'; + +export const Thinkpad = GObject.registerClass({ + GTypeName: 'ThinkpadPrefs', + Template: GLib.Uri.resolve_relative(import.meta.url, '../ui/thinkpad.ui',GLib.UriFlags.NONE), + InternalChildren: [ + 'start_bat0', + 'end_bat0', + 'start_bat1', + 'end_bat1', + 'reset', + 'apply_bat0', + 'apply_bat1', + 'reset_thresholds_dialog' + ], +}, class Thinkpad extends Adw.PreferencesPage { + constructor(window) { + super({}); + + window._settings.bind( + 'start-bat0', + this._start_bat0, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + window._settings.bind( + 'end-bat0', + this._end_bat0, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + window._settings.bind( + 'start-bat1', + this._start_bat1, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + window._settings.bind( + 'end-bat1', + this._end_bat1, + 'value', + Gio.SettingsBindFlags.DEFAULT + ); + + window._settings.connect('changed::start-bat0', () => { + if (this._start_bat0.value >= this._end_bat0.value) { + this._end_bat0.value = this._start_bat0.value + 1; + } + }); + window._settings.connect('changed::end-bat0', () => { + if (this._start_bat0.value >= this._end_bat0.value) { + this._start_bat0.value = this._end_bat0.value - 1; + } + }); + window._settings.connect('changed::start-bat1', () => { + if (this._start_bat1.value >= this._end_bat1.value) { + this._end_bat1.value = this._start_bat1.value + 1; + } + }); + window._settings.connect('changed::end-bat1', () => { + if (this._start_bat1.value >= this._end_bat1.value) { + this._start_bat1.value = this._end_bat1.value - 1; + } + }); + + const bat0 = window._driver.batteries.find(battery => battery.name === 'BAT0'); + const bat1 = window._driver.batteries.find(battery => battery.name === 'BAT1'); + + this._apply_bat0.connect('clicked', () => { + bat0.enable(); + }); + this._apply_bat1.connect('clicked', () => { + bat1.enable(); + }); + + this._apply_bat0.visible = bat0.isAvailable; + bat0.connect('notify::is-available', () => { + this._apply_bat0.visible = bat0.isAvailable; + }); + this._apply_bat0.sensitive = bat0.pendingChanges; + bat0.connect('notify::pending-changes', () => { + this._apply_bat0.sensitive = bat0.pendingChanges; + }); + + this._apply_bat1.visible = bat1.isAvailable; + bat1.connect('notify::is-available', () => { + this._apply_bat1.visible = bat1.isAvailable; + }); + this._apply_bat1.sensitive = bat1.pendingChanges; + bat1.connect('notify::pending-changes', () => { + this._apply_bat1.sensitive = bat1.pendingChanges; + }); + + this._reset_thresholds_dialog.connect('response', (obj, response, data) => { + if (response === 'reset') { + const keys = [ + 'start-bat0', + 'end-bat0', + 'start-bat1', + 'end-bat1' + ]; + keys.forEach(key => { + window._settings.reset(key); + }); + window._driver.enableAll(); + } + }); + + this._reset.connect('clicked', () => { + this._reset_thresholds_dialog.transientFor = this.root; + this._reset_thresholds_dialog.present(); + }); + } +}); \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/utils.js b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/utils.js new file mode 100644 index 0000000..05988ca --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/preferences/utils.js @@ -0,0 +1,20 @@ +'use strict' + +/** + * Bind AdwComboRow item + * + * @param {Adw.comboRow} comboRow Adw combo row item + * @param {Gio.Settings} settings Settings object + * @param {string} key Key name + */ +export function bindAdwComboRow(comboRow, settings, key) { + comboRow.selected = settings.get_enum(key); + settings.connect( + `changed::${key}`, () => { + comboRow.selected = settings.get_enum(key); + } + ); + comboRow.connect('notify::selected', () => { + settings.set_enum(key, comboRow.selected); + }); +} \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/prefs.js b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/prefs.js new file mode 100644 index 0000000..565b71b --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/prefs.js @@ -0,0 +1,23 @@ +'use strict'; + +import { ExtensionPreferences } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; + +import { General } from './preferences/general.js'; +import { Thinkpad } from './preferences/thinkpad.js'; +import { About } from './preferences/about.js'; + +import { ThinkPad } from './libs/driver.js'; + +export default class ThinkpadPreferences extends ExtensionPreferences { + fillPreferencesWindow(window) { + window._settings = this.getSettings(); + window._driver = new ThinkPad({'settings': window._settings}); + window._metadata = this.metadata; + + window.add(new General(window)); + window.add(new Thinkpad(window)); + window.add(new About(window)); + + window.search_enabled = true; + } +} \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/schemas/gschemas.compiled b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/schemas/gschemas.compiled new file mode 100644 index 0000000..bb8abf8 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/schemas/gschemas.compiled differ diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/schemas/org.gnome.shell.extensions.battery-threshold.gschema.xml b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/schemas/org.gnome.shell.extensions.battery-threshold.gschema.xml new file mode 100644 index 0000000..e9c4b22 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/schemas/org.gnome.shell.extensions.battery-threshold.gschema.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + "ACTIVE" + Set when the Icon tray should appear in Gnome tray + + + true + Show current threshold values in labels + + + true + Show notifications + + + true + Color mode + + + + + 75 + Start charging when the level is below this value + + + 80 + Stop charging when the level is above this value + + + 0 + Start charging when the level is below this value + + + 100 + Stop charging when the level is above this value + + + diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/ui/about.ui b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/ui/about.ui new file mode 100644 index 0000000..b0c116e --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/ui/about.ui @@ -0,0 +1,101 @@ + + + + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/ui/general.ui b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/ui/general.ui new file mode 100644 index 0000000..d178f50 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/ui/general.ui @@ -0,0 +1,84 @@ + + + + + + + On active + On inactive + Always + Never + + + + + Reset all preferences? + This action resets all extension settings to their recommended values (including thresholds), do you want to continue? + cancel + cancel + true + true + true + + Cancel + Reset + + + \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/ui/thinkpad.ui b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/ui/thinkpad.ui new file mode 100644 index 0000000..1f1a30a --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/ui/thinkpad.ui @@ -0,0 +1,148 @@ + + + + + + Reset thresholds? + This action resets the batteries thresholds to the recommended values, do you want to continue? + cancel + cancel + true + true + true + + Cancel + Reset + + + + + 5.0 + 1.0 + 99.0 + 0.0 + 75.0 + + + 5.0 + 1.0 + 100.0 + 1.0 + 80.0 + + + 5.0 + 1.0 + 99.0 + 0.0 + 75.0 + + + 5.0 + 1.0 + 100.0 + 1.0 + 80.0 + + \ No newline at end of file