diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/BWClipboard.js b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/BWClipboard.js index 279c65e..25ceae3 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/BWClipboard.js +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/BWClipboard.js @@ -1,5 +1,5 @@ // Bing Wallpaper GNOME extension -// Copyright (C) 2017-2023 Michael Carroll +// Copyright (C) 2017-2025 Michael Carroll // 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 @@ -20,11 +20,11 @@ export default class BWClipboard { try { let file = Gio.File.new_for_path(filename); let [success, image_data] = file.load_contents(null); - //log('error: '+success); + //console.log('error: '+success); if (success) this.clipboard.set_content(CLIPBOARD_TYPE, 'image/jpeg', image_data); } catch (err) { - log('unable to set clipboard to data in '+filename); + console.log('unable to set clipboard to data in '+filename); } } diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/README.md b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/README.md index fb547b3..192b114 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/README.md +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/README.md @@ -49,7 +49,7 @@ Also, check out my related [Google Earth View wallpaper extension](https://githu ![Gallery item](/screenshot/gallery.png) -The 4 buttons in the gallery (3rd page in the preferences) do have tool-tips but these do the following: +The 5 buttons in the gallery (3rd page in the preferences) do have tool-tips but these do the following: - Favorite - favorite this image (equivalent to doing this via the control bar) - Apply - set this image as wallpaper - View - open image in image viewer 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 b6111bf..355d841 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 @@ -1,5 +1,5 @@ // Bing Wallpaper GNOME extension -// Copyright (C) 2017-2023 Michael Carroll +// Copyright (C) 2017-2025 Michael Carroll // 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 @@ -32,7 +32,7 @@ var debug = false; var promptActive = false; // default GNOME method of testing this relies on state of a transisiton // so we are being explicit here (do not want any races, thanks) -function log(msg) { +function BingLog(msg) { if (debug) // set 'debug' above to false to keep the noise down in journal console.log("BingWallpaper extension/Blur: " + msg); } @@ -40,14 +40,14 @@ function log(msg) { // we patch UnlockDialog._updateBackgroundEffects() export function _updateBackgroundEffects_BWP(monitorIndex) { // GNOME shell 3.36.4 and above - log("_updateBackgroundEffects_BWP() called for shell >= 3.36.4"); + BingLog("_updateBackgroundEffects_BWP() called for shell >= 3.36.4"); const themeContext = St.ThemeContext.get_for_stage(global.stage); for (const widget of this._backgroundGroup.get_children()) { // set blur effects, we have two modes in lockscreen: login prompt or clock // blur on when clock is visible is adjustable const effect = widget.get_effect('blur'); if (promptActive) { - log('default blur active'); + BingLog('default blur active'); if (effect) { effect.set({ // GNOME defaults when login prompt is visible brightness: BLUR_BRIGHTNESS, @@ -56,7 +56,7 @@ export function _updateBackgroundEffects_BWP(monitorIndex) { } } else { - log('adjustable blur active'); + BingLog('adjustable blur active'); if (effect) { effect.set({ // adjustable blur when clock is visible brightness: BWP_BLUR_BRIGHTNESS * 0.01, // we use 0-100 rather than 0-1, so divide by 100 @@ -92,17 +92,17 @@ export function _clampValue(value) { export default class Blur { constructor() { this.enabled = false; - log('Bing Wallpaper adjustable blur is '+(supportedVersion()?'available':'not available')); + BingLog('Bing Wallpaper adjustable blur is '+(supportedVersion()?'available':'not available')); } set_blur_strength(value) { BWP_BLUR_SIGMA = _clampValue(value); - log("lockscreen blur strength set to "+BWP_BLUR_SIGMA); + BingLog("lockscreen blur strength set to "+BWP_BLUR_SIGMA); } set_blur_brightness(value) { BWP_BLUR_BRIGHTNESS = _clampValue(value); - log("lockscreen brightness set to " + BWP_BLUR_BRIGHTNESS); + BingLog("lockscreen brightness set to " + BWP_BLUR_BRIGHTNESS); } _switch(enabled) { @@ -116,7 +116,7 @@ export default class Blur { _enable() { if (supportedVersion()) { - log("Blur._enable() called on GNOME "+Config.PACKAGE_VERSION); + BingLog("Blur._enable() called on GNOME "+Config.PACKAGE_VERSION); UnlockDialog.UnlockDialog.prototype._updateBackgroundEffects = _updateBackgroundEffects_BWP; // we override _showClock and _showPrompt to patch in updates to blur effect before calling the GNOME functions UnlockDialog.UnlockDialog.prototype._showClock = _showClock_BWP; @@ -133,7 +133,7 @@ export default class Blur { _disable() { if (!this.enabled) return; - log("_lockscreen_blur_disable() called"); + BingLog("_lockscreen_blur_disable() called"); if (supportedVersion()) { // restore default functions UnlockDialog.UnlockDialog.prototype._updateBackgroundEffects = _updateBackgroundEffects; 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 6b0c294..6b0c106 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 @@ -1,5 +1,5 @@ // Bing Wallpaper GNOME extension -// Copyright (C) 2017-2023 Michael Carroll +// Copyright (C) 2017-2025 Michael Carroll // 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 @@ -30,7 +30,7 @@ export default class Carousel { this.searchEntry = null; this.extensionPath = extensionPath - this.log('create carousel...'); + this._log('create carousel...'); this.flowBox = prefs_flowbox; this.flowBox.insert(this._create_placeholder_item(), -1); @@ -43,11 +43,6 @@ export default class Carousel { } _create_gallery() { - Utils.randomIntervals.forEach((x) => { - let item = this._create_random_item(x.value, _(x.title)); - this.flowBox.insert(item, -1); - }); - this.imageList.forEach((image) => { let item = this._create_gallery_item(image); this.flowBox.insert(item, -1); @@ -72,7 +67,7 @@ export default class Carousel { if (Utils.isFavourite(image)) { favButton.set_visible(false); - this.log('image is favourited'); + this._log('image is favourited'); } else { unfavButton.set_visible(false); @@ -84,7 +79,7 @@ export default class Carousel { catch (e) { galleryImage.set_from_icon_name('image-missing'); galleryImage.set_icon_size = 2; // Gtk.GTK_ICON_SIZE_LARGE; - this.log('create_gallery_image: '+e); + this._log('create_gallery_image: '+e); } galleryImage.set_tooltip_text(image.copyright); @@ -96,16 +91,16 @@ export default class Carousel { applyButton.connect('clicked', () => { this.settings.set_string('selected-image', Utils.getImageUrlBase(image)); - this.log('gallery selected '+Utils.getImageUrlBase(image)); + this._log('gallery selected '+Utils.getImageUrlBase(image)); }); infoButton.connect('clicked', () => { Utils.openInSystemViewer(image.copyrightlink, false); - this.log('info page link opened '+image.copyrightlink); + this._log('info page link opened '+image.copyrightlink); }); deleteButton.connect('clicked', (widget) => { - this.log('Delete requested for '+filename); + this._log('Delete requested for '+filename); Utils.deleteImage(filename); Utils.setImageHiddenStatus(this.settings, image.urlbase, true); Utils.purgeImages(this.settings); // hide image instead @@ -116,7 +111,7 @@ export default class Carousel { // button is unchecked, so we want to make the checked one visible favButton.connect('clicked', (widget) => { - this.log('favourited '+Utils.getImageUrlBase(image)); + this._log('favourited '+Utils.getImageUrlBase(image)); widget.set_visible(false); unfavButton.set_visible(true); Utils.setImageFavouriteStatus(this.settings, image.urlbase, true); @@ -124,7 +119,7 @@ export default class Carousel { // button is checked, so we want to make the unchecked one visible unfavButton.connect('clicked', (widget) => { - this.log('unfavourited '+Utils.getImageUrlBase(image)); + this._log('unfavourited '+Utils.getImageUrlBase(image)); widget.set_visible(false); favButton.set_visible(true); Utils.setImageFavouriteStatus(this.settings, image.urlbase, false); @@ -134,27 +129,6 @@ export default class Carousel { return item; } - _create_random_item(interval, title) { - let buildable = new Gtk.Builder(); - - // grab appropriate object from UI file - buildable.add_objects_from_file(this.extensionPath + '/ui/carousel4.ui', ["flowBoxRandom"]); - - let randomLabel = buildable.get_object('randomLabel'); - randomLabel.set_text(title); - let filename = 'random'; - let applyButton = buildable.get_object('randomButton'); - - applyButton.connect('clicked', (widget) => { - this.settings.set_string('random-interval-mode', interval); - this.settings.set_boolean('random-mode-enabled', true); - this.log('gallery selected random with interval '+interval+' ('+title+')'); - }); - - let item = buildable.get_object('flowBoxRandom'); - return item; - } - _create_placeholder_item() { let buildable = new Gtk.Builder(); this.flowBox.set_max_children_per_line(1); @@ -212,7 +186,7 @@ export default class Carousel { } catch (e) { this._set_blank_image(galleryImage); - this.log('create_gallery_image: '+e); + this._log('create_gallery_image: '+e); } } } @@ -222,8 +196,8 @@ export default class Carousel { //galleryImage.set_icon_size = 2; // Gtk.GTK_ICON_SIZE_LARGE; } - log(msg) { + _log(msg) { if (this.settings.get_boolean('debug-logging')) console.log("BingWallpaper extension: " + msg); // disable to keep the noise down in journal } -}; \ No newline at end of file +}; 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 c520b31..1109e56 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 @@ -1,5 +1,5 @@ // Bing Wallpaper GNOME extension -// Copyright (C) 2017-2023 Michael Carroll +// Copyright (C) 2017-2025 Michael Carroll // 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 @@ -54,7 +54,7 @@ const newMenuSwitchItem = (label, state) => { return switchItem; } -function log(msg) { +function BingLog(msg) { if (BingDebug()) console.log('BingWallpaper extension: ' + msg); // disable to keep the noise down in journal } @@ -78,7 +78,7 @@ function doSetBackground(uri, schema) { gsettings.set_string('picture-uri-dark', uri); } catch (e) { - log("unable to set dark background for : " + e); + BingLog("unable to set dark background for : " + e); } Gio.Settings.sync(); gsettings.apply(); @@ -296,12 +296,12 @@ class BingWallpaperIndicator extends Button { toggles.forEach( (e) => { this.settings_connections.push( this._settings.connect('changed::'+e.key, () => { - log(e.key+' setting changed to '+ (this._settings.get_boolean(e.key)?'true':'false')); + BingLog(e.key+' setting changed to '+ (this._settings.get_boolean(e.key)?'true':'false')); e.toggle.setToggleState(this._settings.get_boolean(e.key)); }) ); e.toggle.connect('toggled', (item, state) => { - log(e.key+' switch toggled to '+ (state?'true':'false')); + BingLog(e.key+' switch toggled to '+ (state?'true':'false')); this._setBooleanSetting(e.key, state); }); }); @@ -319,17 +319,17 @@ class BingWallpaperIndicator extends Button { _setBooleanSetting(key, state) { let success = this._settings.set_boolean(key, state); - log('key '+key+' set to ' + (state?'true':'false') + ' (returned ' + (success?'true':'false')+')'); + BingLog('key '+key+' set to ' + (state?'true':'false') + ' (returned ' + (success?'true':'false')+')'); } _setStringSetting(key, value) { let success = this._settings.set_string(key, value); - log('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')'); + BingLog('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')'); } _setIntSetting(key, value) { let success = this._settings.set_int(key, value); - log('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')'); + BingLog('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')'); } _onDestroy() { @@ -358,14 +358,15 @@ class BingWallpaperIndicator extends Button { let maxlongdate = Utils.getMaxLongDate(this._settings); this.refreshduetext = _("Next refresh") + ": " + (this.refreshdue ? this.refreshdue.format("%Y-%m-%d %X") : '-') + - " (" + Utils.friendly_time_diff(this.refreshdue) + ")\n" + + " (" + (this.refreshdue?Utils.friendly_time_diff(this.refreshdue):"-") + ")\n" + _("Last refresh") + ": " + (maxlongdate? this._localeDate(maxlongdate, true) : '-'); // also show when shuffle is next due if (this._settings.get_boolean('random-mode-enabled')) { this.refreshduetext += "\n" + _("Next shuffle")+": " + (this.shuffledue ? this.shuffledue.format("%Y-%m-%d %X") : '-') + - " (" + Utils.friendly_time_diff(this.shuffledue) + ")"; + " (" + (this.refreshdue?Utils.friendly_time_diff(this.shuffledue):"-") + ")"; } + BingLog('refreshduetext :'+this.refreshduetext); this.refreshDueItem.label.set_text(this.refreshduetext); } @@ -378,7 +379,7 @@ class BingWallpaperIndicator extends Button { _setImage() { Utils.validate_imagename(this._settings); this.selected_image = this._settings.get_string('selected-image'); - log('selected image changed to: ' + this.selected_image); + BingLog('selected image changed to: ' + this.selected_image); this._selectImage(); //this._setShuffleToggleState(); } @@ -398,7 +399,7 @@ class BingWallpaperIndicator extends Button { let icon_name = this._settings.get_string('icon-name'); let gicon = Gio.icon_new_for_string(this._extension.dir.get_child('icons').get_path() + '/' + icon_name + '.svg'); this.icon = new St.Icon({gicon: gicon, style_class: 'system-status-icon'}); - log('Replace icon set to: ' + icon_name); + BingLog('Replace icon set to: ' + icon_name); this.remove_all_children(); this.add_child(this.icon); } @@ -411,7 +412,7 @@ class BingWallpaperIndicator extends Button { this._setThumbnailImage(); if (!this.dimensions.width || !this.dimensions.height) // if dimensions aren't in image database yet [this.dimensions.width, this.dimensions.height] = Utils.getFileDimensions(this.filename); - log('image set to : '+this.filename); + BingLog('image set to : '+this.filename); if (this._settings.get_boolean('set-background')) this._setBackgroundDesktop(); } @@ -439,7 +440,7 @@ class BingWallpaperIndicator extends Button { difference = 60; difference = difference + 300; // 5 minute fudge offset in case of inaccurate local clock - log('Next refresh due ' + difference + ' seconds from now'); + BingLog('Next refresh due ' + difference + ' seconds from now'); this._restartTimeout(difference); } @@ -450,7 +451,7 @@ class BingWallpaperIndicator extends Button { if (difference < 60 || difference > 86400) // clamp to a reasonable range difference = 60; - log('Next shuffle due ' + difference + ' seconds from now'); + BingLog('Next shuffle due ' + difference + ' seconds from now'); this._restartShuffleTimeout(difference); } @@ -563,24 +564,26 @@ class BingWallpaperIndicator extends Button { return; } - const image = new Clutter.Image(); - const success = image.set_data( + const [version] = Config.PACKAGE_VERSION.split('.').map(s => Number(s)); + const image = new St.ImageContent(); + const success = image.set_data.apply(image, [ + ...version >= 48 ? [Clutter.get_default_backend().get_cogl_context()] : [], pixbuf.get_pixels(), pixbuf.get_has_alpha() ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888, width, height, - pixbuf.get_rowstride() - ); + pixbuf.get_rowstride(), + ]); if (!success) { - throw Error("error creating Clutter.Image()"); + throw Error("error creating St.ImageContent()"); } this.thumbnailItem.hexpand = false; this.thumbnailItem.vexpand = false; this.thumbnailItem.content = image; - log('scale factor: ' + scale_factor); + BingLog('scale factor: ' + scale_factor); this.thumbnailItem.set_size(480*scale_factor, 270*scale_factor); this.thumbnailItem.setSensitive(true); } @@ -606,7 +609,7 @@ class BingWallpaperIndicator extends Button { x.setSensitive(randomEnabled); }); if (randomEnabled) { - log('enabled shuffle mode, by setting a shuffe timer (5 seconds)'); + BingLog('enabled shuffle mode, by setting a shuffe timer (5 seconds)'); this._restartShuffleTimeout(5); this._setBooleanSetting('revert-to-current-image', false); } @@ -619,19 +622,19 @@ class BingWallpaperIndicator extends Button { } _favouriteImage() { - log('favourite image '+this.imageURL+' status was '+this.favourite_status); + BingLog('favourite image '+this.imageURL+' status was '+this.favourite_status); this.favourite_status = !this.favourite_status; Utils.setImageFavouriteStatus(this._settings, this.imageURL, this.favourite_status); this._setFavouriteIcon(this.favourite_status?this.ICON_FAVE_BUTTON:this.ICON_UNFAVE_BUTTON); } _trashImage() { - log('trash image '+this.imageURL+' status was '+this.hidden_status); + BingLog('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?this.ICON_UNTRASH_BUTTON:this.ICON_TRASH_BUTTON); if (this._settings.get_boolean('trash-deletes-images')) { - log('image to be deleted: '+this.filename); + BingLog('image to be deleted: '+this.filename); Utils.deleteImage(this.filename); Utils.validate_imagename(this._settings); } @@ -705,7 +708,7 @@ class BingWallpaperIndicator extends Button { }); } catch(error) { - log('unable to send libsoup json message '+error); + BingLog('unable to send libsoup json message '+error); notifyError('Unable to fetch Bing metadata\n'+error); } } @@ -721,7 +724,7 @@ class BingWallpaperIndicator extends Button { }); } catch (error) { - log('unable to send libsoup json message '+error); + BingLog('unable to send libsoup json message '+error); notifyError('Unable to fetch Bing metadata\n'+error); } } @@ -734,14 +737,14 @@ class BingWallpaperIndicator extends Button { decoder.decode(this.httpSession.send_and_read_finish(message).get_data()): // Soup3 message.response_body.data; // Soup 2 - log('Recieved ' + data.length + ' bytes'); + BingLog('Recieved ' + data.length + ' bytes'); this._parseData(data); if (!this._settings.get_boolean('random-mode-enabled')) this._selectImage(); } catch (error) { - log('Network error occured: ' + error); + BingLog('Network error occured: ' + error); notifyError('network error occured\n'+error); this._updatePending = false; this._restartTimeout(TIMEOUT_SECONDS_ON_HTTP_ERROR); @@ -758,11 +761,11 @@ class BingWallpaperIndicator extends Button { this._timeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, seconds, this._refresh.bind(this)); this.refreshdue = GLib.DateTime.new_now_local().add_seconds(seconds); - log('next check in ' + seconds + ' seconds'); + BingLog('next check in ' + seconds + ' seconds'); } _restartShuffleTimeout(seconds = null) { - log('_restartShuffleTimeout('+seconds+')'); + BingLog('_restartShuffleTimeout('+seconds+')'); //console.trace(); if (this._shuffleTimeout) @@ -770,14 +773,14 @@ 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); + BingLog('shuffle ('+this.shuffledue.format_iso8601()+') diff = '+diff); 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') { let random_mode = this._settings.get_string('random-interval-mode'); seconds = Utils.seconds_until(random_mode); // else we shuffle at specified interval (midnight default) - log('shuffle mode = '+random_mode+' = '+seconds+' from now'); + BingLog('shuffle mode = '+random_mode+' = '+seconds+' from now'); } else { seconds = this._settings.get_int('random-interval'); // or whatever the user has specified (as a timer) @@ -786,7 +789,7 @@ class BingWallpaperIndicator extends Button { this._shuffleTimeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, seconds, this._selectImage.bind(this, true)); this.shuffledue = GLib.DateTime.new_now_local().add_seconds(seconds); - log('next shuffle in ' + seconds + ' seconds'); + BingLog('next shuffle in ' + seconds + ' seconds'); } // auto export Bing data to JSON file if requested @@ -805,7 +808,7 @@ class BingWallpaperIndicator extends Button { let newImages = Utils.mergeImageLists(this._settings, parsed.images); if (datamarket != prefmarket && prefmarket != 'auto') - log('WARNING: Bing returning market data for ' + datamarket + ' rather than selected ' + prefmarket); + BingLog('WARNING: Bing returning market data for ' + datamarket + ' rather than selected ' + prefmarket); Utils.purgeImages(this._settings); // delete older images if enabled //Utils.cleanupImageList(this._settings); // merged into purgeImages @@ -821,7 +824,7 @@ class BingWallpaperIndicator extends Button { if (!this._settings.get_boolean('notify-only-latest')) { // notify all new images newImages.forEach((image) => { - log('New image to notify: ' + Utils.getImageTitle(image)); + BingLog('New image to notify: ' + Utils.getImageTitle(image)); this._createImageNotification(image); }); } @@ -829,7 +832,7 @@ class BingWallpaperIndicator extends Button { // notify only the most recent image let last = newImages.pop(); if (last) { - log('New image to notify: ' + Utils.getImageTitle(last)); + BingLog('New image to notify: ' + Utils.getImageTitle(last)); this._createImageNotification(last); } } @@ -839,9 +842,9 @@ class BingWallpaperIndicator extends Button { this._updatePending = false; } catch (error) { - log('_parseData() failed with error ' + error + ' @ '+error.lineNumber); + BingLog('_parseData() failed with error ' + error + ' @ '+error.lineNumber); notifyError('Bing metadata parsing error check ' + error + ' @ '+error.lineNumber); - log(error.stack); + BingLog(error.stack); } } @@ -855,7 +858,7 @@ class BingWallpaperIndicator extends Button { let msg = _('Bing Wallpaper of the Day for') + ' ' + this._localeDate(image.fullstartdate); let details = Utils.getImageTitle(image); this._createNotification(msg, details); - log('_createImageNotification: '+msg+' details: '+details); + BingLog('_createImageNotification: '+msg+' details: '+details); } _createNotification(msg, details) { @@ -869,7 +872,7 @@ class BingWallpaperIndicator extends Button { }); systemSource.addNotification(bingNotify); //Main.notify(msg, details); - log('_createNotification: '+msg+' details: '+details); + BingLog('_createNotification: '+msg+' details: '+details); } _shuffleImage() { @@ -885,7 +888,7 @@ class BingWallpaperIndicator extends Button { imageList = favImageList; } else { - log('not enough filtered images available to shuffle'); + BingLog('not enough filtered images available to shuffle'); } // shuffle could fail for a number of reasons @@ -893,12 +896,12 @@ class BingWallpaperIndicator extends Button { this.imageIndex = Utils.getRandomInt(imageList.length); image = imageList[this.imageIndex]; - log('shuffled to image '+image.urlbase); + BingLog('shuffled to image '+image.urlbase); return image; } catch (e) { - log('shuffle failed '+e); + BingLog('shuffle failed '+e); return null; } } @@ -909,7 +912,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') + BingLog('forcing shuffle of image') image = this._shuffleImage(); if (this._settings.get_boolean('random-mode-enabled')) this._restartShuffleTimeout(); @@ -927,7 +930,7 @@ class BingWallpaperIndicator extends Button { if (image) this.imageIndex = Utils.imageIndex(imageList, image.urlbase); - log('_selectImage: ' + this.selected_image + ' = ' + (image && image.urlbase) ? image.urlbase : 'not found'); + BingLog('_selectImage: ' + this.selected_image + ' = ' + (image && image.urlbase ? image.urlbase : 'not found')); } } @@ -1003,7 +1006,7 @@ class BingWallpaperIndicator extends Button { }; let stateJSON = JSON.stringify(state); - log('Storing state as JSON: ' + stateJSON); + BingLog('Storing state as JSON: ' + stateJSON); this._setStringSetting('state', stateJSON); } } @@ -1016,7 +1019,7 @@ class BingWallpaperIndicator extends Button { let state = JSON.parse(stateJSON); let maxLongDate = null; - log('restoring state...'); + BingLog('restoring state...'); maxLongDate = state.maxlongdate ? state.maxlongdate : null; this.title = state.title; this.explanation = state.explanation; @@ -1040,7 +1043,7 @@ class BingWallpaperIndicator extends Button { } if (this._settings.get_boolean('random-mode-enabled')) { - log('random mode enabled, restarting random state'); + BingLog('random mode enabled, restarting random state'); this._restartShuffleTimeoutFromDueDate(this.shuffledue); // FIXME: use state value this._restartTimeoutFromLongDate(maxLongDate); } @@ -1051,7 +1054,7 @@ class BingWallpaperIndicator extends Button { return; } catch (error) { - log('bad state - refreshing... error was ' + error); + BingLog('bad state - refreshing... error was ' + error); } this._restartTimeout(60); } @@ -1079,7 +1082,7 @@ class BingWallpaperIndicator extends Button { notifyError('Download folder '+BingWallpaperDir+' does not exist or is not writable'); return; } - log("Downloading " + url + " to " + file.get_uri()); + BingLog("Downloading " + url + " to " + file.get_uri()); let request = Soup.Message.new('GET', url); // queue the http request @@ -1096,7 +1099,7 @@ class BingWallpaperIndicator extends Button { } } catch (error) { - log('error sending libsoup message '+error); + BingLog('error sending libsoup message '+error); notifyError('Network error '+error); } } @@ -1118,17 +1121,17 @@ class BingWallpaperIndicator extends Button { file.replace_contents_finish(res); if (set_background) this._setBackground(); - log('Download successful'); + BingLog('Download successful'); } catch(e) { - log('Error writing file: ' + e); + BingLog('Error writing file: ' + e); notifyError('Image '+file.get_path()+' is not writable, check folder permissions or select a different folder\n'+e); } } ); } catch (error) { - log('Unable download image '+error); + BingLog('Unable download image '+error); notifyError('Image '+file.get_path()+' file error, check folder permissions, disk space or select a different folder\n'+e); } } diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/cs/LC_MESSAGES/BingWallpaper.mo b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/cs/LC_MESSAGES/BingWallpaper.mo index 27c1a6f..b0344a7 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/cs/LC_MESSAGES/BingWallpaper.mo and b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/cs/LC_MESSAGES/BingWallpaper.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/en_AU/LC_MESSAGES/BingWallpaper.mo b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/en_AU/LC_MESSAGES/BingWallpaper.mo deleted file mode 100644 index 854350c..0000000 Binary files a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/en_AU/LC_MESSAGES/BingWallpaper.mo and /dev/null differ diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/nb/LC_MESSAGES/BingWallpaper.mo b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/nb/LC_MESSAGES/BingWallpaper.mo index 1c6a6c7..1df0fcf 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/nb/LC_MESSAGES/BingWallpaper.mo and b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/locale/nb/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 43b2bc4..0350386 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 @@ -7,9 +7,10 @@ "shell-version": [ "45", "46", - "47" + "47", + "48" ], "url": "https://github.com/neffo/bing-wallpaper-gnome-extension", "uuid": "BingWallpaper@ineffable-gmail.com", - "version": 50 + "version": 51 } \ 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 228a467..3b81047 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 @@ -1,5 +1,5 @@ // Bing Wallpaper GNOME extension -// Copyright (C) 2017-2023 Michael Carroll +// Copyright (C) 2017-2025 Michael Carroll // 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 @@ -44,7 +44,7 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen let carousel = null; let httpSession = null; - let log = (msg) => { // avoids need for globals + let BingLog = (msg) => { // avoids need for globals if (settings.get_boolean('debug-logging')) console.log("BingWallpaper extension: " + msg); // disable to keep the noise down in journal } @@ -82,7 +82,7 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen 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 version_row = buildable.get_object('version_row'); const change_log = buildable.get_object('change_log'); window.add(settings_page); @@ -104,18 +104,12 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen // add wallpaper folder open and change buttons const openBtn = new Gtk.Button( { - child: new Adw.ButtonContent({ - icon_name: 'folder-pictures-symbolic', - label: _('Open folder'), - },), + 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'), - },), + label: _('Change folder'), valign: Gtk.Align.CENTER, halign: Gtk.Align.CENTER, }); @@ -127,26 +121,17 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen 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'), - },), + 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'), - },), + 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'), - },), + label: _('Slight blur & dim'), valign: Gtk.Align.CENTER, halign: Gtk.Align.CENTER, }); @@ -160,18 +145,12 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen // 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'), - },), + 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'), - },), + label: _('Export'), valign: Gtk.Align.CENTER, halign: Gtk.Align.CENTER, }); @@ -179,27 +158,28 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen json_actionrow.add_suffix(buttonImportData); json_actionrow.add_suffix(buttonExportData); - version_button.set_label(this.metadata.version.toString()); + version_row.set_subtitle(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; } catch (e) { - log("Error creating httpSession: " + e); + BingLog("Error creating httpSession: " + e); } const icon_image = buildable.get_object('icon_image'); + const app_icon_image = buildable.get_object('app_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_icon(settings, this.path, icon_image, app_icon_image); Utils.validate_interval(settings); // Indicator & notifications settings.bind('hide', hideSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.bind('notify', notifySwitch, 'active', Gio.SettingsBindFlags.DEFAULT); settings.connect('changed::icon-name', () => { - Utils.validate_icon(settings, this.path, icon_image); + Utils.validate_icon(settings, this.path, icon_image, app_icon_image); iconEntry.set_value(1 + Utils.icon_list.indexOf(settings.get_string('icon-name'))); }); @@ -245,7 +225,7 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen 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); + BingLog(new_path); Utils.moveImagesToNewFolder(settings, Utils.getWallpaperDir(settings), new_path); Utils.setWallpaperDir(settings, new_path); }); diff --git a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/thumbnail.js b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/thumbnail.js index 58bdb55..b298355 100644 --- a/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/thumbnail.js +++ b/gnome/.local/share/gnome-shell/extensions/BingWallpaper@ineffable-gmail.com/thumbnail.js @@ -1,5 +1,5 @@ // Bing Wallpaper GNOME extension -// Copyright (C) 2017-2023 Michael Carroll +// Copyright (C) 2017-2025 Michael Carroll // 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 @@ -23,7 +23,7 @@ export default class Thumbnail { this.pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filePath, w, h); this.srcFile = Gio.File.new_for_path(filePath); } catch (err) { - log('Unable to create thumbnail for corrupt or incomplete file: ' + filePath + ' err: ' + err); + console.log('Unable to create thumbnail for corrupt or incomplete file: ' + filePath + ' err: ' + err); } } }; 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 4953091..3df7cb6 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 @@ -68,6 +68,9 @@ Author: Michael Carroll vertical 1 center + Favorite 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 index 2d48805..3efdf8d 100644 --- 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 @@ -23,7 +23,7 @@ Bing Wallpaper GNOME extension by: Michael Carroll - emblem-photos-symbolic + applications-system-symbolic Settings @@ -110,7 +110,7 @@ Bing Wallpaper GNOME extension by: Michael Carroll - applications-system-symbolic + system-lock-screen-symbolic Lock screen @@ -163,7 +163,7 @@ Bing Wallpaper GNOME extension by: Michael Carroll - document-open-recent-symbolic + emblem-photos-symbolic Gallery @@ -286,7 +286,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll - 128 + 64 + 8 presentation - - + @@ -367,6 +362,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll https://extensions.gnome.org/extension/1262/bing-wallpaper-changer/ + GNOME Extensions + GTK_ALIGN_CENTER @@ -386,6 +383,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll https://github.com/neffo/bing-wallpaper-gnome-extension + GitHub + GTK_ALIGN_CENTER @@ -405,6 +404,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll https://github.com/neffo/bing-wallpaper-gnome-extension/issues + GitHub + GTK_ALIGN_CENTER @@ -424,6 +425,8 @@ Bing Wallpaper GNOME extension by: Michael Carroll https://github.com/neffo/bing-wallpaper-gnome-extension/graphs/contributors + GitHub + GTK_ALIGN_CENTER 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 7c9f1ef..98e289f 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 @@ -1,5 +1,5 @@ // Bing Wallpaper GNOME extension -// Copyright (C) 2017-2023 Michael Carroll +// Copyright (C) 2017-2025 Michael Carroll // 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 @@ -58,7 +58,12 @@ export var randomIntervals = [ {value: 'hourly', title: ('on the hour')}, export var BingImageURL = 'https://www.bing.com/HPImageArchive.aspx'; export var BingParams = { format: 'js', idx: '0' , n: '8' , mbl: '1' , mkt: '' } ; -export function validate_icon(settings, extension_path, icon_image = null) { +export function validate_icon( + settings, + extension_path, + icon_image = null, + app_icon_image = null +) { BingLog('validate_icon()'); let icon_name = settings.get_string('icon-name'); if (icon_name == '' || icon_list.indexOf(icon_name) == -1) { @@ -66,10 +71,11 @@ export function validate_icon(settings, extension_path, icon_image = null) { icon_name = settings.get_string('icon-name'); } // if called from prefs - if (icon_image) { + if (icon_image && app_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', 64, 64); icon_image.set_from_pixbuf(pixbuf); + app_icon_image.set_from_pixbuf(pixbuf); } } 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 index d507fc9..d3419dc 100644 --- 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 @@ -54,7 +54,7 @@ export function TalkativeLog(msg) { * @returns {string} the version */ export function getFullVersion() { - return '1.10.0'; // FULL_VERSION + return '1.11.0'; // FULL_VERSION } /** 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 index b0c7dfb..0243b4a 100644 --- 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 @@ -6,9 +6,10 @@ "settings-schema": "org.gnome.shell.extensions.EasyScreenCast", "shell-version": [ "46", - "47" + "47", + "48" ], "url": "https://github.com/EasyScreenCast/EasyScreenCast", "uuid": "EasyScreenCast@iacopodeenosee.gmail.com", - "version": 51 + "version": 52 } \ No newline at end of file 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 d7f0daf..6f14df7 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 @@ -25,10 +25,10 @@ var VitalsMenuButton = GObject.registerClass({ }, class VitalsMenuButton extends PanelMenu.Button { _init(extensionObject) { super._init(Clutter.ActorAlign.FILL); - + this._extensionObject = extensionObject; this._settings = extensionObject.getSettings(); - + this._sensorIcons = { 'temperature' : { 'icon': 'temperature-symbolic.svg' }, 'voltage' : { 'icon': 'voltage-symbolic.svg' }, @@ -67,8 +67,7 @@ var VitalsMenuButton = GObject.registerClass({ x_align: Clutter.ActorAlign.START, y_align: Clutter.ActorAlign.CENTER, reactive: true, - x_expand: true, - pack_start: false + x_expand: true }); this._drawMenu(); @@ -109,7 +108,7 @@ var VitalsMenuButton = GObject.registerClass({ this._initializeMenuGroup(sensor, sensor); } - + for (let i = 1; i <= this._numGpus; i++) this._initializeMenuGroup('gpu#' + i, 'gpu', (this._numGpus > 1 ? ' ' + i : '')); @@ -128,8 +127,7 @@ var VitalsMenuButton = GObject.registerClass({ x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, reactive: true, - x_expand: true, - pack_start: false + x_expand: true }); // custom round refresh button @@ -255,7 +253,7 @@ var VitalsMenuButton = GObject.registerClass({ } ); } - + _createHotItem(key, value) { let icon = this._defaultIcon(key); this._hotIcons[key] = icon; @@ -291,7 +289,7 @@ var VitalsMenuButton = GObject.registerClass({ if(sensorName === 'gpu') { for(let i = 1; i <= this._numGpus; i++) this._groups[sensorName + '#' + i].visible = this._settings.get_boolean(sensor); - } else + } else this._groups[sensorName].visible = this._settings.get_boolean(sensor); } @@ -417,8 +415,7 @@ 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) { @@ -565,9 +562,8 @@ var VitalsMenuButton = GObject.registerClass({ arrow_pos = 0; break; } - + let centered = this._settings.get_boolean('menu-centered') - if (centered) arrow_pos = 0.5; // set arrow position when initializing and moving vitals @@ -605,7 +601,7 @@ var VitalsMenuButton = GObject.registerClass({ this._newGpuDetected = true; return; } - + this._numGpus = parseInt(split[1]); this._newGpuDetectedCount = 0; this._newGpuDetected = false; 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 index 7ec91a8..c95cc12 100644 --- 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 @@ -1 +1,2 @@ - \ 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 index 125ba60..ac7a6ee 100644 --- 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 @@ -1 +1,2 @@ - \ 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 index bd31f33..9ca1f68 100644 --- 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 @@ -1 +1,2 @@ - \ No newline at end of file + + diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/cs/LC_MESSAGES/vitals.mo b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/cs/LC_MESSAGES/vitals.mo index 1b2495d..689742c 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/cs/LC_MESSAGES/vitals.mo and b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/cs/LC_MESSAGES/vitals.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/es/LC_MESSAGES/vitals.mo b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/es/LC_MESSAGES/vitals.mo index 4cf48ae..fbdb72a 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/es/LC_MESSAGES/vitals.mo and b/gnome/.local/share/gnome-shell/extensions/Vitals@CoreCoding.com/locale/es/LC_MESSAGES/vitals.mo differ 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 cddf98d..bef804f 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 @@ -10,9 +10,10 @@ "shell-version": [ "45", "46", - "47" + "47", + "48" ], "url": "https://github.com/corecoding/Vitals", "uuid": "Vitals@CoreCoding.com", - "version": 69 + "version": 71 } \ No newline at end of file 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 537decf..950c1b0 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 @@ -898,7 +898,7 @@ start 5 5 - Monitor gpu (beta; NVIDIA only) + Monitor GPU (beta) @@ -1224,6 +1224,8 @@ BAT2 BATT CMB0 + CMB1 + CMB2 macsmc-battery 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 10f93c7..fa49d41 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 @@ -54,6 +54,8 @@ export const Sensors = GObject.registerClass({ this._addSettingChangedSignal('update-time', this._reconfigureNvidiaSmiProcess.bind(this)); //this._addSettingChangedSignal('include-static-gpu-info', this._reconfigureNvidiaSmiProcess.bind(this)); + this._gpu_drm_vendors = null; + this._gpu_drm_indices = null; this._nvidia_smi_process = null; this._nvidia_labels = []; this._bad_split_count = 0; @@ -74,7 +76,7 @@ export const Sensors = GObject.registerClass({ _refreshIPAddress(callback) { // check IP address - new FileModule.File('https://corecoding.com/vitals.php').read().then(contents => { + new FileModule.File('https://ipv4.corecoding.com').read().then(contents => { let obj = JSON.parse(contents); this._returnValue(callback, 'Public IP', obj['IPv4'], 'network', 'string'); }).catch(err => { }); @@ -375,20 +377,20 @@ export const Sensors = GObject.registerClass({ _queryBattery(callback) { let battery_slot = this._settings.get_int('battery-slot'); - // addresses issue #161 - let battery_key = 'BAT'; // BAT0, BAT1 and BAT2 - if (battery_slot == 3) { - battery_slot = 'T'; - } else if (battery_slot == 4) { - battery_key = 'CMB'; // CMB0 - battery_slot = 0; - } else if (battery_slot == 5) { - battery_key = 'macsmc-battery'; // supports Asahi linux - battery_slot = ''; - } + // create a mapping of indices to battery paths (from prefs.ui) + const BATTERY_PATHS = { + 0: 'BAT0', + 1: 'BAT1', + 2: 'BAT2', + 3: 'BATT', + 4: 'CMB0', + 5: 'CMB1', + 6: 'CMB2', + 7: 'macsmc-battery' + }; // uevent has all necessary fields, no need to read individual files - let battery_path = '/sys/class/power_supply/' + battery_key + battery_slot + '/uevent'; + let battery_path = '/sys/class/power_supply/' + BATTERY_PATHS[battery_slot] + '/uevent'; new FileModule.File(battery_path).read("\n").then(lines => { let output = {}; for (let line of lines) { @@ -496,10 +498,16 @@ export const Sensors = GObject.registerClass({ _queryGpu(callback) { if (!this._nvidia_smi_process) { - this._disableGpuLabels(callback); - return; + // no nvidia-smi, so we use sysfs DRM if any cards was discovered + if (!this._gpu_drm_indices){ + this._disableGpuLabels(callback); + return; + } else { + this._readGpuDrm(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 @@ -510,10 +518,9 @@ export const Sensors = GObject.registerClass({ 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 + // 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; @@ -544,13 +551,13 @@ export const Sensors = GObject.registerClass({ this._bad_split_count = 0; let [ - label, + label, fan_speed_pct, - temp_gpu, temp_mem, + 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, + power, power_avg, link_gen_current, link_width_current ] = csv_split; @@ -572,12 +579,9 @@ export const Sensors = GObject.registerClass({ } } - 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'); @@ -628,6 +632,50 @@ export const Sensors = GObject.registerClass({ this._returnStaticGpuValue(callback, 'Sub Device ID', staticInfo['sub_device_id'], typeName, 'string'); } + _readGpuDrm(callback){ + const multiGpu = this._gpu_drm_indices.length > 1; + const unit = this._settings.get_int('memory-measurement') ? 1000 : 1024; + for (let z = 0; z < this._gpu_drm_indices.length; z++ ) { + let i = this._gpu_drm_indices[z]; + const typeName = 'gpu#' + i; + const vendor = this._gpu_drm_vendors[z]; + + // AMD + if(vendor === "0x1002") { + // read GPU usage and create group lebel for card + new FileModule.File('/sys/class/drm/card'+i+'/device/gpu_busy_percent').read().then(value => { + // create group + this._returnGpuValue(callback, 'Graphics', parseInt(value) * 0.01, typeName + '-group', 'percent'); + this._returnGpuValue(callback, 'Vendor', "AMD", typeName, 'string'); + this._returnGpuValue(callback, 'Usage', parseInt(value) * 0.01, typeName, 'percent'); + }).catch(err => { + // nothing to do, keep old value displayed + }); + new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_vram_used').read().then(value => { + this._returnGpuValue(callback, 'Memory Used', parseInt(value) / unit, typeName, 'memory'); + }).catch(err => { + // nothing to do, keep old value displayed + }); + new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_vram_total').read().then(value => { + this._returnGpuValue(callback, 'Memory Total', parseInt(value) / unit, typeName, 'memory'); + }).catch(err => { + // nothing to do, keep old value displayed + }); + } else { + // for other vendors only show basic card info + let vendorName = null; + switch (vendor){ + case '0x10DE': vendorName = 'NVIDIA'; break; // should be never used as nvidia-smi should be preferred + case '0x13B5': vendorName = 'ARM'; break; + case '0x5143': vendorName = 'Qualcomm'; break; + case '0x8086': vendorName = 'Intel'; break; + default: vendorName = "Unknown " + vendor; + } + this._returnGpuValue(callback, 'Graphics', vendorName, typeName + '-group', 'string'); + } + } + } + _disableGpuLabels(callback) { for (let labelObj of this._nvidia_labels) this._returnValue(callback, labelObj.label, 'disabled', labelObj.type, labelObj.format); @@ -635,7 +683,7 @@ export const Sensors = GObject.registerClass({ _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')) + 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 @@ -645,7 +693,7 @@ export const Sensors = GObject.registerClass({ _returnGpuValue(callback, label, value, type, format, display = true) { if(!display) return; - if(value === 'N/A' || value === '[N/A]' || isNaN(value)) return; + if(format !== "string" && (value === 'N/A' || value === '[N/A]' || isNaN(value))) return; let nvidiaLabel = {'label': label, 'type': type, 'format': format}; if (!this._nvidia_labels.includes(nvidiaLabel)) @@ -748,6 +796,27 @@ export const Sensors = GObject.registerClass({ // Launch nvidia-smi subprocess if nvidia querying is enabled this._reconfigureNvidiaSmiProcess(); + this._discoverGpuDrm(); + } + + _discoverGpuDrm() { + // use DRM only if nvidia-smi is not used + if (this._settings.get_boolean('show-gpu') && this._nvidia_smi_process == null) { + // try to discover up to 10 cards starting from index 0 + for(let i = 0; i < 10 ; i++){ + new FileModule.File('/sys/class/drm/card'+i+'/device/vendor').read().then(value => { + if(!this._gpu_drm_indices){ + this._gpu_drm_indices = []; + this._gpu_drm_vendors = []; + } + this._gpu_drm_indices.push(i); + this._gpu_drm_vendors.push(value); + }).catch(err => { }); + } + } else { + this._gpu_drm_vendors = null; + this._gpu_drm_indices = null; + } } // The nvidia-smi subprocess will keep running and print new sensor data to stdout every @@ -772,7 +841,7 @@ export const Sensors = GObject.registerClass({ _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); @@ -786,13 +855,13 @@ export const Sensors = GObject.registerClass({ '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') ? + (!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,' + 'pci.domain,pci.bus,pci.device,pci.device_id,pci.sub_device_id,' : ''), '--format=csv,noheader,nounits', '-l', query_interval.toString() diff --git a/gnome/.local/share/gnome-shell/extensions/appindicatorsupport@rgcjonas.gmail.com/metadata.json b/gnome/.local/share/gnome-shell/extensions/appindicatorsupport@rgcjonas.gmail.com/metadata.json index 00567e1..bbb76d1 100644 --- a/gnome/.local/share/gnome-shell/extensions/appindicatorsupport@rgcjonas.gmail.com/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/appindicatorsupport@rgcjonas.gmail.com/metadata.json @@ -7,9 +7,10 @@ "shell-version": [ "45", "46", - "47" + "47", + "48" ], "url": "https://github.com/ubuntu/gnome-shell-extension-appindicator", "uuid": "appindicatorsupport@rgcjonas.gmail.com", "version": 59 -} \ No newline at end of file +} 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 7757c11..d65512b 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,10 +11,10 @@ "original-author": "mi-jan-sena@proton.me", "settings-schema": "org.gnome.shell.extensions.auto-activities", "shell-version": [ - "47" + "48" ], "url": "https://github.com/CleoMenezesJr/auto-activities", "uuid": "auto-activities@CleoMenezesJr.github.io", - "version": 14, - "version-name": "47.0" + "version": 15, + "version-name": "48.0" } \ No newline at end of file diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/LICENSE b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/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. + + + Copyright (C) + + 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) + 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/blur-my-shell@aunetx/components/overview.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/components/overview.js index 1399234..50a625e 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 @@ -148,6 +148,14 @@ export const OverviewBlur = class OverviewBlur { } // add the container widget for the overview only to the overview group Main.layoutManager.overviewGroup.insert_child_at_index(this.overview_background_group, 0); + // make sure it stays below + this.connections.connect(Main.layoutManager.overviewGroup, "child-added", (_, child) => { + if (child !== this.overview_background_group) { + if (this.overview_background_group.get_parent()) + Main.layoutManager.overviewGroup.remove_child(this.overview_background_group); + Main.layoutManager.overviewGroup.insert_child_at_index(this.overview_background_group, 0); + } + }); } /// Updates the classname to style overview components with semi-transparent @@ -166,6 +174,11 @@ export const OverviewBlur = class OverviewBlur { remove_background_actors() { this.overview_background_group.remove_all_children(); this.animation_background_group.remove_all_children(); + + this.connections.disconnect_all_for(Main.layoutManager.overviewGroup); + if (this.overview_background_group.get_parent()) + Main.layoutManager.overviewGroup.remove_child(this.overview_background_group); + this.overview_background_managers.forEach(background_manager => { background_manager._bms_pipeline.destroy(); background_manager.destroy(); 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 df1be7b..4562106 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 @@ -54,9 +54,6 @@ 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 workareas change this.connections.connect(global.display, 'workareas-changed', _ => this.reset() @@ -468,10 +465,14 @@ export const PanelBlur = class PanelBlur { this.settings.panel.OVERRIDE_BACKGROUND && should_override - ) + ) { panel.add_style_class_name( PANEL_STYLES[this.settings.panel.STYLE_PANEL] ); + } + + // update the classname if the panel to have or have not light text + this.update_light_text_classname(!should_override); } update_pipeline() { diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/effects.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/effects.js index 8678d9a..931d345 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/effects.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/effects.js @@ -148,6 +148,11 @@ export function get_supported_effects(_ = () => "") { name: _("Use base pixel"), description: _("Whether or not the original pixel is counted for the blur. If it is, the image will be more legible."), type: "boolean" + }, + prefer_closer_pixels: { + name: _("Prefer closer pixels"), + description: _("Whether or not the pixels that are closer to the original pixel will have more weight."), + type: "boolean" } } }, diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/monte_carlo_blur.glsl b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/monte_carlo_blur.glsl index 4142a46..27b3806 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/monte_carlo_blur.glsl +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/monte_carlo_blur.glsl @@ -5,6 +5,7 @@ uniform float brightness; uniform float width; uniform float height; uniform bool use_base_pixel; +uniform bool prefer_closer_pixels; float srand(vec2 a) { return sin(dot(a, vec2(1233.224, 1743.335))); @@ -19,24 +20,31 @@ void main() { vec2 uv = cogl_tex_coord0_in.st; vec2 p = 16 * radius / vec2(width, height); float r = srand(uv); + vec2 rv; + vec2 dir; + vec2 new_uv; + int strength; int count = 0; vec4 c = vec4(0.); for (int i = 0; i < iterations; i++) { rv.x = rand(r); - rv.y = rand(r); - vec2 new_uv = uv + rv * p; + rv.y = rand(r) * 3.141592; + dir = vec2(cos(rv.y), sin(rv.y)); + new_uv = uv + rv.x * dir * p; if (new_uv.x > 2. / width && new_uv.y > 2. / height && new_uv.x < 1. - 3. / width && new_uv.y < 1. - 3. / height) { - c += texture2D(tex, new_uv); - count += 1; + strength = prefer_closer_pixels ? (iterations - i)^2 : 1; + c += strength * texture2D(tex, new_uv); + count += strength; } } if (count == 0 || use_base_pixel) { - c += texture2D(tex, uv); - count += 1; + strength = prefer_closer_pixels ? (iterations + 1)^2 : 1; + c += strength * texture2D(tex, uv); + count += strength; } c.xyz *= brightness; diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/monte_carlo_blur.js b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/monte_carlo_blur.js index fbf01a7..0da56ed 100644 --- a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/monte_carlo_blur.js +++ b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/effects/monte_carlo_blur.js @@ -8,7 +8,8 @@ const Clutter = await utils.import_in_shell_only('gi://Clutter'); const SHADER_FILENAME = 'monte_carlo_blur.glsl'; const DEFAULT_PARAMS = { radius: 2., iterations: 5, brightness: .6, - width: 0, height: 0, use_base_pixel: true + width: 0, height: 0, use_base_pixel: true, + prefer_closer_pixels: true, }; @@ -64,6 +65,13 @@ export const MonteCarloBlurEffect = utils.IS_IN_PREFERENCES ? GObject.ParamFlags.READWRITE, true, ), + 'prefer_closer_pixels': GObject.ParamSpec.boolean( + `prefer_closer_pixels`, + `Prefer closer pixels`, + `Prefer closer pixels`, + GObject.ParamFlags.READWRITE, + true, + ), } }, class MonteCarloBlurEffect extends Clutter.ShaderEffect { constructor(params) { @@ -166,6 +174,18 @@ export const MonteCarloBlurEffect = utils.IS_IN_PREFERENCES ? } } + get prefer_closer_pixels() { + return this._prefer_closer_pixels; + } + + set prefer_closer_pixels(value) { + if (this._prefer_closer_pixels !== value) { + this._prefer_closer_pixels = value; + + this.set_uniform_value('prefer_closer_pixels', this._prefer_closer_pixels ? 1 : 0); + } + } + vfunc_set_actor(actor) { if (this._actor_connection_size_id) { let old_actor = this.get_actor(); 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 443d7b6..5dfb2f2 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 @@ -1,6 +1,7 @@ import Meta from 'gi://Meta'; import Clutter from 'gi://Clutter'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; @@ -253,16 +254,28 @@ export default class BlurMyShell extends Extension { /// Add the Clutter debug flag. _disable_clipped_redraws() { - Meta.add_clutter_debug_flags( - null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null - ); + let gnome_shell_major_version = parseInt(Config.PACKAGE_VERSION.split('.')[0]); + if (gnome_shell_major_version >= 48) + Clutter.add_debug_flags( + null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null + ); + else + Meta.add_clutter_debug_flags( + null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null + ); } /// Remove the Clutter debug flag. _reenable_clipped_redraws() { - Meta.remove_clutter_debug_flags( - null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null - ); + let gnome_shell_major_version = parseInt(Config.PACKAGE_VERSION.split('.')[0]); + if (gnome_shell_major_version >= 48) + Clutter.remove_debug_flags( + null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null + ); + else + Meta.remove_clutter_debug_flags( + null, Clutter.DrawDebugFlag.DISABLE_CLIPPED_REDRAWS, null + ); } /// Enables every component from the user session needed, should be called when the shell is diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ar/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ar/LC_MESSAGES/blur-my-shell@aunetx.mo index 782420b..ccb2bb2 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ar/LC_MESSAGES/blur-my-shell@aunetx.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@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/az/LC_MESSAGES/blur-my-shell@aunetx.mo index 118ad99..4bfe928 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/az/LC_MESSAGES/blur-my-shell@aunetx.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/az/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@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/bg/LC_MESSAGES/blur-my-shell@aunetx.mo index 5f80e8b..1fc31e5 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/bg/LC_MESSAGES/blur-my-shell@aunetx.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/bg/LC_MESSAGES/blur-my-shell@aunetx.mo 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 index a03611b..c21daf4 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ca/LC_MESSAGES/blur-my-shell@aunetx.mo 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/de/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/de/LC_MESSAGES/blur-my-shell@aunetx.mo index 0a31cf8..2b367d4 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/de/LC_MESSAGES/blur-my-shell@aunetx.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/es/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/es/LC_MESSAGES/blur-my-shell@aunetx.mo index 756a723..e7b9134 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/es/LC_MESSAGES/blur-my-shell@aunetx.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/hr/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hr/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..7a2a318 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/hr/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@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/it/LC_MESSAGES/blur-my-shell@aunetx.mo index 484f405..d4f5e58 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/it/LC_MESSAGES/blur-my-shell@aunetx.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/ja/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ja/LC_MESSAGES/blur-my-shell@aunetx.mo index 1a8f89e..ae09442 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ja/LC_MESSAGES/blur-my-shell@aunetx.mo and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ja/LC_MESSAGES/blur-my-shell@aunetx.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pl/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pl/LC_MESSAGES/blur-my-shell@aunetx.mo index 071cbd4..61ad499 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pl/LC_MESSAGES/blur-my-shell@aunetx.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@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt/LC_MESSAGES/blur-my-shell@aunetx.mo index 8206001..8565f59 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/pt/LC_MESSAGES/blur-my-shell@aunetx.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/ru/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ru/LC_MESSAGES/blur-my-shell@aunetx.mo index 25e129d..84960bb 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ru/LC_MESSAGES/blur-my-shell@aunetx.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/sv/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sv/LC_MESSAGES/blur-my-shell@aunetx.mo index efa421e..18fdfb2 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/sv/LC_MESSAGES/blur-my-shell@aunetx.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@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ta/LC_MESSAGES/blur-my-shell@aunetx.mo index 6efb1c7..52334a7 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/ta/LC_MESSAGES/blur-my-shell@aunetx.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@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/tr/LC_MESSAGES/blur-my-shell@aunetx.mo index 603f521..3e9d533 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/tr/LC_MESSAGES/blur-my-shell@aunetx.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/zh_CN/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_CN/LC_MESSAGES/blur-my-shell@aunetx.mo new file mode 100644 index 0000000..41b29f7 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_CN/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 deleted file mode 100644 index 19e2cfb..0000000 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_Hans/LC_MESSAGES/blur-my-shell@aunetx.mo and /dev/null differ diff --git a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_TW/LC_MESSAGES/blur-my-shell@aunetx.mo b/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_TW/LC_MESSAGES/blur-my-shell@aunetx.mo index c18174d..3a40372 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/blur-my-shell@aunetx/locale/zh_TW/LC_MESSAGES/blur-my-shell@aunetx.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 582a13f..7057c8d 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 @@ -17,9 +17,10 @@ "settings-schema": "org.gnome.shell.extensions.blur-my-shell", "shell-version": [ "46", - "47" + "47", + "48" ], "url": "https://github.com/aunetx/blur-my-shell", "uuid": "blur-my-shell@aunetx", - "version": 67 + "version": 68 } \ No newline at end of file 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 aef9827..1ea0ab8 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 @@ -11,9 +11,10 @@ "shell-version": [ "45", "46", - "47" + "47", + "48" ], "url": "https://github.com/forge-ext/forge", "uuid": "forge@jmmaranan.com", "version": 84 -} \ No newline at end of file +} 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 470c96b..dbe70a7 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 @@ -13,1207 +13,1331 @@ 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 * as InputSourceManager from 'resource:///org/gnome/shell/ui/status/keyboard.js'; +import * as Config from 'resource:///org/gnome/shell/misc/config.js' +const [major, minor] = Config.PACKAGE_VERSION.split('.').map(s => Number(s)); import { Dialog } from 'resource:///org/gnome/shell/ui/dialog.js'; import { Extension, gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; const State = { - OPENED: 0, - CLOSED: 1, - OPENING: 2, - CLOSING: 3, + OPENED: 0, + CLOSED: 1, + OPENING: 2, + CLOSING: 3, }; class KeyboardMenuToggle extends QuickSettings.QuickMenuToggle { - static { - GObject.registerClass(this); - } + static { + GObject.registerClass(this); + } - constructor(extensionObject) { - super({ - title: _('Screen Keyboard'), - iconName: 'input-keyboard-symbolic', - toggleMode: true, - }); + constructor(extensionObject) { + super({ + title: _('Screen Keyboard'), + iconName: 'input-keyboard-symbolic', + toggleMode: true, + }); - this.extensionObject = extensionObject; - this.settings = extensionObject.getSettings(); + 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()) { - const item = this._itemsSection._getMenuItems()[i] - const num = i - item.connect('activate', () => this.settings.set_int("enable-tap-gesture", num)) - } + 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()) { + const item = this._itemsSection._getMenuItems()[i] + const num = i + item.connect('activate', () => this.settings.set_int("enable-tap-gesture", num)) + } - this.menu.addMenuItem(this._itemsSection); - this.settings.bind('indicator-enabled', - this, 'checked', - Gio.SettingsBindFlags.DEFAULT); - this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); - const settingsItem = this.menu.addAction(_('More Settings'), - () => this.extensionObject.openPreferences()); - settingsItem.visible = Main.sessionMode.allowSettings; - this.menu._settingsActions[this.extensionObject.uuid] = settingsItem; - } + this.menu.addMenuItem(this._itemsSection); + this.settings.bind('indicator-enabled', + this, 'checked', + Gio.SettingsBindFlags.DEFAULT); + this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); + const settingsItem = this.menu.addAction(_('More Settings'), + () => this.extensionObject.openPreferences()); + settingsItem.visible = Main.sessionMode.allowSettings; + this.menu._settingsActions[this.extensionObject.uuid] = settingsItem; + } - _refresh() { - for (var i in this._itemsSection._getMenuItems()) { - this._itemsSection._getMenuItems()[i].setIcon(this.settings.get_int("enable-tap-gesture") == i ? 'emblem-ok-symbolic' : null) - } - } + _refresh() { + for (var i in this._itemsSection._getMenuItems()) { + this._itemsSection._getMenuItems()[i].setIcon(this.settings.get_int("enable-tap-gesture") == i ? 'emblem-ok-symbolic' : null) + } + } }; let keycodes; let layouts; +let currentMonitorId = 0; +let extract_dir = GLib.get_user_cache_dir() + "/gjs-osk"; +// [insert handwriting 1] export default class GjsOskExtension extends Extension { - _openKeyboard(instant) { - if (this.Keyboard.state == State.CLOSED) { - this.Keyboard.open(null, !instant ? null : true); - } - } + _openKeyboard(instant) { + if (this.Keyboard.state == State.CLOSED) { + this.Keyboard.open(null, !instant ? null : true); + } + } - _closeKeyboard(instant) { - if (this.Keyboard.state == State.OPENED) { - this.Keyboard.close(!instant ? null : true); - } - } + _closeKeyboard(instant) { + if (this.Keyboard.state == State.OPENED) { + this.Keyboard.close(!instant ? null : true); + } + } - _toggleKeyboard(instant = false) { - if (!this.Keyboard.opened) { - this._openKeyboard(instant); - this.Keyboard.openedFromButton = true; - this.Keyboard.closedFromButton = false - } else { - this._closeKeyboard(instant); - this.Keyboard.openedFromButton = false; - this.Keyboard.closedFromButton = true; - } - } + _toggleKeyboard(instant = false) { + if (!this.Keyboard.opened) { + this._openKeyboard(instant); + this.Keyboard.openedFromButton = true; + this.Keyboard.closedFromButton = false + } else { + this._closeKeyboard(instant); + this.Keyboard.openedFromButton = false; + this.Keyboard.closedFromButton = true; + } + } - open_interval() { - global.stage.disconnect(this.tapConnect) - if (this.openInterval !== null) { - clearInterval(this.openInterval); - this.openInterval = null; - } - this.openInterval = setInterval(() => { - if (global.stage.key_focus == this.Keyboard && this.Keyboard.prevKeyFocus != null) { - global.stage.key_focus = this.Keyboard.prevKeyFocus - } - 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 (Main.inputMethod.currentFocus != null && Main.inputMethod.currentFocus.is_focused() && !this.Keyboard.closedFromButton) { - this._openKeyboard(); - } else if (!this.Keyboard.closedFromButton && !this.Keyboard._dragging) { - this._closeKeyboard(); - this.Keyboard.closedFromButton = false - } else if (Main.inputMethod.currentFocus == null) { - this.Keyboard.closedFromButton = false - } - } - }, 300); - this.tapConnect = global.stage.connect("event", (_actor, event) => { - if (event.type() !== 4 && event.type() !== 5) { - this.lastInputMethod = [false, event.type() >= 9 && event.type() <= 12, true][this.settings.get_int("enable-tap-gesture")] - } - }) - } + open_interval() { + global.stage.disconnect(this.tapConnect) + if (this.openInterval !== null) { + clearInterval(this.openInterval); + this.openInterval = null; + } + this.openInterval = setInterval(() => { + if (this.Keyboard != null) { + if (global.stage.key_focus == this.Keyboard && this.Keyboard.prevKeyFocus != null) { + global.stage.key_focus = this.Keyboard.prevKeyFocus + } + 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 (Main.inputMethod.currentFocus != null && Main.inputMethod.currentFocus.is_focused() && !this.Keyboard.closedFromButton) { + this._openKeyboard(); + } else if (!this.Keyboard.closedFromButton && !this.Keyboard._dragging) { + this._closeKeyboard(); + this.Keyboard.closedFromButton = false + } else if (Main.inputMethod.currentFocus == null) { + this.Keyboard.closedFromButton = false + } + } + } + }, 300); + this.tapConnect = global.stage.connect("event", (_actor, event) => { + if (event.type() !== 4 && event.type() !== 5) { + this.lastInputMethod = [false, event.type() >= 9 && event.type() <= 12, true][this.settings.get_int("enable-tap-gesture")] + } + }) + } - enable() { - this.settings = this.getSettings(); - this.darkSchemeSettings = this.getSettings("org.gnome.desktop.interface"); - this.inputLanguageSettings = this.getSettings('org.gnome.desktop.input-sources') - this.gnomeKeyboardSettings = this.getSettings('org.gnome.desktop.a11y.applications'); - this.isGnomeKeyboardEnabled = this.gnomeKeyboardSettings.get_boolean('screen-keyboard-enabled'); - this.gnomeKeyboardSettings.set_boolean('screen-keyboard-enabled', false) - this.isGnomeKeyboardEnabledHandler = this.gnomeKeyboardSettings.connect('changed', () => { - this.gnomeKeyboardSettings.set_boolean('screen-keyboard-enabled', false) - }); - this.settings.scheme = "" - if (this.darkSchemeSettings.get_string("color-scheme") == "prefer-dark") - this.settings.scheme = "-dark" - this.openBit = this.settings.get_child("indicator"); + enable() { + this.settings = this.getSettings(); + this.darkSchemeSettings = this.getSettings("org.gnome.desktop.interface"); + this.inputLanguageSettings = InputSourceManager.getInputSourceManager(); + this.gnomeKeyboardSettings = this.getSettings('org.gnome.desktop.a11y.applications'); + this.isGnomeKeyboardEnabled = this.gnomeKeyboardSettings.get_boolean('screen-keyboard-enabled'); + this.gnomeKeyboardSettings.set_boolean('screen-keyboard-enabled', false) + this.isGnomeKeyboardEnabledHandler = this.gnomeKeyboardSettings.connect('changed', () => { + this.gnomeKeyboardSettings.set_boolean('screen-keyboard-enabled', false) + }); + this.settings.scheme = "" + if (this.darkSchemeSettings.get_string("color-scheme") == "prefer-dark") + this.settings.scheme = "-dark" + this.openBit = this.settings.get_child("indicator"); - this.openPrefs = () => { this.openPreferences() } + this.openPrefs = () => { this.openPreferences() } - let [okL, contentsL] = GLib.file_get_contents(this.path + '/physicalLayouts.json'); - if (okL) { - layouts = JSON.parse(contentsL); - } + let [okL, contentsL] = GLib.file_get_contents(this.path + '/physicalLayouts.json'); + if (okL) { + layouts = JSON.parse(contentsL); + } - let refresh = () => { - if (!Gio.File.new_for_path(this.path + "/keycodes").query_exists(null)) { - Gio.File.new_for_path(this.path + "/keycodes").make_directory(null); - let [status, out, err, code] = GLib.spawn_command_line_sync("tar -Jxf " + this.path + "/keycodes.tar.xz -C " + this.path + "/keycodes") - if (err != "" || code != 0) { - throw new Error(err); - } - } - if (this.Keyboard) - this.Keyboard.destroy(); - let [ok, contents] = GLib.file_get_contents(this.path + '/keycodes/' + KeyboardManager.getKeyboardManager().currentLayout.id + '.json'); - if (ok) { - keycodes = JSON.parse(contents); - } - this.Keyboard = new Keyboard(this.settings, this); - this.Keyboard.refresh = refresh - } - refresh() + let refresh = () => { + // [insert handwriting 2] + let currentMonitors = this.settings.get_string("default-monitor").split(";") + let currentMonitorMap = {}; + let monitors = Main.layoutManager.monitors; + for (var i of currentMonitors) { + let tmp = i.split(":"); + currentMonitorMap[tmp[0]] = tmp[1] + ""; + } + if (!Object.keys(currentMonitorMap).includes(monitors.length + "")) { + let allConfigs = Object.keys(currentMonitorMap).map(Number.parseInt).sort(); + currentMonitorMap[monitors.length + ""] = allConfigs[allConfigs.length - 1]; + } + try { + currentMonitorId = global.backend.get_monitor_manager().get_monitor_for_connector(currentMonitorMap[monitors.length + ""]); + if (currentMonitorId == -1) { + currentMonitorId = 0; + } + } catch { + currentMonitorId = 0; + } + if (!Gio.File.new_for_path(extract_dir).query_exists(null)) { + Gio.File.new_for_path(extract_dir).make_directory(null); + Gio.File.new_for_path(extract_dir + "/keycodes").make_directory(null); + let [status, out, err, code] = GLib.spawn_command_line_sync("tar -Jxf " + this.path + "/keycodes.tar.xz -C " + extract_dir + "/keycodes") + if (err != "" || code != 0) { + throw new Error(err); + } + } + if (this.Keyboard != null) { + this.Keyboard.destroy(); + this.Keyboard = null; + } + let [ok, contents] = GLib.file_get_contents(extract_dir + "/keycodes/" + KeyboardManager.getKeyboardManager().currentLayout.id + '.json'); + if (ok) { + keycodes = JSON.parse(contents); + } + this.Keyboard = new Keyboard(this.settings, this); + this.Keyboard.refresh = refresh + } + refresh() - this._originalLastDeviceIsTouchscreen = KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen; - KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen = () => { return false }; + 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")) { - this._indicator = new PanelMenu.Button(0.0, "GJS OSK Indicator", false); - let icon = new St.Icon({ - gicon: new Gio.ThemedIcon({ - name: 'input-keyboard-symbolic' - }), - style_class: 'system-status-icon' - }); - this._indicator.add_child(icon); + this._indicator = null; + this.openInterval = null; + if (this.settings.get_boolean("indicator-enabled")) { + this._indicator = new PanelMenu.Button(0.0, "GJS OSK Indicator", false); + let icon = new St.Icon({ + gicon: new Gio.ThemedIcon({ + name: 'input-keyboard-symbolic' + }), + 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() == Clutter.EventType.TOUCH_END) this._toggleKeyboard() - }); - Main.panel.addToStatusArea("GJS OSK Indicator", this._indicator); - } + this._indicator.connect("button-press-event", () => this._toggleKeyboard()); + this._indicator.connect("touch-event", (_actor, event) => { + if (event.type() == Clutter.EventType.TOUCH_END) this._toggleKeyboard() + }); + Main.panel.addToStatusArea("GJS OSK Indicator", this._indicator); + } - this._toggle = new KeyboardMenuToggle(this); - this._quick_settings_indicator = new QuickSettings.SystemIndicator(); - this._quick_settings_indicator.quickSettingsItems.push(this._toggle); - Main.panel.statusArea.quickSettings.addExternalIndicator(this._quick_settings_indicator); - this.open_interval(); - this.openFromCommandHandler = this.openBit.connect("changed", () => { - this.openBit.set_boolean("opened", false) - this._toggleKeyboard(); - }) - let settingsChanged = () => { - let opened = this.Keyboard.opened - if (this.darkSchemeSettings.get_string("color-scheme") == "prefer-dark") - this.settings.scheme = "-dark" - else - this.settings.scheme = "" - this.Keyboard.openedFromButton = false; - refresh() - this._toggle._refresh(); - if (this.settings.get_boolean("indicator-enabled")) { - if (this._indicator != null) { - this._indicator.destroy(); - this._indicator = null; - } - this._indicator = new PanelMenu.Button(0.0, "GJS OSK Indicator", false); - let icon = new St.Icon({ - gicon: new Gio.ThemedIcon({ - name: 'input-keyboard-symbolic' - }), - style_class: 'system-status-icon' - }); - this._indicator.add_child(icon); + this._toggle = new KeyboardMenuToggle(this); + this._quick_settings_indicator = new QuickSettings.SystemIndicator(); + this._quick_settings_indicator.quickSettingsItems.push(this._toggle); + Main.panel.statusArea.quickSettings.addExternalIndicator(this._quick_settings_indicator); + this.open_interval(); + this.openFromCommandHandler = this.openBit.connect("changed", () => { + this.openBit.set_boolean("opened", false) + this._toggleKeyboard(); + }) + let settingsChanged = () => { + let opened; + if (this.Keyboard != null) + opened = this.Keyboard.opened + else + opened = false + if (this.darkSchemeSettings.get_string("color-scheme") == "prefer-dark") + this.settings.scheme = "-dark" + else + this.settings.scheme = "" + this.Keyboard.openedFromButton = false; + refresh() + this._toggle._refresh(); + if (this.settings.get_boolean("indicator-enabled")) { + if (this._indicator != null) { + this._indicator.destroy(); + this._indicator = null; + } + this._indicator = new PanelMenu.Button(0.0, "GJS OSK Indicator", false); + let icon = new St.Icon({ + gicon: new Gio.ThemedIcon({ + name: 'input-keyboard-symbolic' + }), + 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() == Clutter.EventType.TOUCH_END) this._toggleKeyboard() - }); - Main.panel.addToStatusArea("GJS OSK Indicator", this._indicator); - } else { - if (this._indicator != null) { - this._indicator.destroy(); - this._indicator = null; - } - } - global.stage.disconnect(this.tapConnect) - if (this.openInterval !== null) { - clearInterval(this.openInterval); - this.openInterval = null; - } - this.open_interval(); - if (opened) { - this._toggleKeyboard(true); - } - } - this.settingsHandlers = [ - this.settings.connect("changed", settingsChanged), - this.darkSchemeSettings.connect("changed", (_, key) => { if (key == "color-scheme") settingsChanged() }), - this.inputLanguageSettings.connect("changed", settingsChanged) - ]; - } + this._indicator.connect("button-press-event", () => this._toggleKeyboard()); + this._indicator.connect("touch-event", (_actor, event) => { + if (event.type() == Clutter.EventType.TOUCH_END) this._toggleKeyboard() + }); + Main.panel.addToStatusArea("GJS OSK Indicator", this._indicator); + } else { + if (this._indicator != null) { + this._indicator.destroy(); + this._indicator = null; + } + } + global.stage.disconnect(this.tapConnect) + if (this.openInterval !== null) { + clearInterval(this.openInterval); + this.openInterval = null; + } + this.open_interval(); + if (opened) { + this._toggleKeyboard(true); + } + } + this.settingsHandlers = [ + this.settings.connect("changed", settingsChanged), + this.darkSchemeSettings.connect("changed", (_, key) => { if (key == "color-scheme") settingsChanged() }), + this.inputLanguageSettings.connect("current-source-changed", settingsChanged) + ]; + } - disable() { - this.gnomeKeyboardSettings.disconnect(this.isGnomeKeyboardEnabledHandler) - this.gnomeKeyboardSettings.set_boolean('screen-keyboard-enabled', this.isGnomeKeyboardEnabled); + disable() { + this.gnomeKeyboardSettings.disconnect(this.isGnomeKeyboardEnabledHandler) + this.gnomeKeyboardSettings.set_boolean('screen-keyboard-enabled', this.isGnomeKeyboardEnabled); - this._quick_settings_indicator.quickSettingsItems.forEach(item => item.destroy()); - this._quick_settings_indicator.destroy(); - this._quick_settings_indicator = null; + this._quick_settings_indicator.quickSettingsItems.forEach(item => item.destroy()); + this._quick_settings_indicator.destroy(); + this._quick_settings_indicator = null; - if (this._indicator !== null) { - this._indicator.destroy(); - this._indicator = null; - } - this.Keyboard.destroy(); - this.settings.disconnect(this.settingsHandlers[0]); - this.darkSchemeSettings.disconnect(this.settingsHandlers[1]) - this.inputLanguageSettings.disconnect(this.settingsHandlers[2]) - this.settings = null; - this.darkSchemeSettings = null; - this.inputLanguageSettings = null; - this.gnomeKeyboardSettings = null; - this.openBit.disconnect(this.openFromCommandHandler); - this.openBit = null; - global.stage.disconnect(this.tapConnect) - if (this.openInterval !== null) { - clearInterval(this.openInterval); - this.openInterval = null; - } - this._toggle.destroy() - this._toggle = null - this.settings = null - this.Keyboard = null - keycodes = null - if (this._originalLastDeviceIsTouchscreen !== null) { - KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen = this._originalLastDeviceIsTouchscreen; - this._originalLastDeviceIsTouchscreen = null; - } - } + if (this._indicator !== null) { + this._indicator.destroy(); + this._indicator = null; + } + if (this.Keyboard != null) + this.Keyboard.destroy(); + this.settings.disconnect(this.settingsHandlers[0]); + this.darkSchemeSettings.disconnect(this.settingsHandlers[1]) + this.inputLanguageSettings.disconnect(this.settingsHandlers[2]) + this.settings = null; + this.darkSchemeSettings = null; + this.inputLanguageSettings = null; + this.gnomeKeyboardSettings = null; + this.openBit.disconnect(this.openFromCommandHandler); + this.openBit = null; + global.stage.disconnect(this.tapConnect) + if (this.openInterval !== null) { + clearInterval(this.openInterval); + this.openInterval = null; + } + this._toggle.destroy() + this._toggle = null + this.settings = null + this.Keyboard = null + keycodes = null + if (this._originalLastDeviceIsTouchscreen !== null) { + KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen = this._originalLastDeviceIsTouchscreen; + this._originalLastDeviceIsTouchscreen = null; + } + } } +// [insert handwriting 3] class Keyboard extends Dialog { - static [GObject.signals] = { - 'drag-begin': {}, - 'drag-end': {} - }; + static [GObject.signals] = { + 'drag-begin': {}, + 'drag-end': {} + }; - static { - GObject.registerClass(this); - } + static { + GObject.registerClass(this); + } - _init(settings, extensionObject) { - this.settingsOpenFunction = extensionObject.openPrefs - this.inputDevice = Clutter.get_default_backend().get_default_seat().create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE); - this.settings = settings; - let monitor = Main.layoutManager.primaryMonitor; - super._init(Main.layoutManager.modalDialogGroup, 'db-keyboard-content'); - this.box = new St.Widget({ - layout_manager: new Clutter.GridLayout({ - orientation: Clutter.Orientation.HORIZONTAL, - row_spacing: settings.get_int("border-spacing-px") * 2, - column_spacing: settings.get_int("border-spacing-px") * 2, - }) - }); - this.widthPercent = (monitor.width > monitor.height) ? settings.get_int("landscape-width-percent") / 100 : settings.get_int("portrait-width-percent") / 100; - this.heightPercent = (monitor.width > monitor.height) ? settings.get_int("landscape-height-percent") / 100 : settings.get_int("portrait-height-percent") / 100; - this.buildUI(); - this.draggable = false; - this.add_child(this.box); - this.close(); - this.box.set_name("osk-gjs") - this.mod = []; - this.modBtns = []; - this.capsL = false; - this.shift = false; - this.alt = false; - this.opened = false; - this.state = State.CLOSED; - this.delta = []; - this.checkMonitor(); - this._dragging = false; - let side = null; - switch (this.settings.get_int("default-snap")) { - case 0: - case 1: - case 2: - side = St.Side.TOP; - break; - case 3: - side = St.Side.LEFT; - break; - case 5: - side = St.Side.RIGHT; - break; - case 6: - case 7: - case 8: - side = St.Side.BOTTOM; - break; - } - this.oldBottomDragAction = global.stage.get_action('osk'); - if (this.oldBottomDragAction !== null && this.oldBottomDragAction instanceof Clutter.Action) - global.stage.remove_action(this.oldBottomDragAction); - if (side != null) { - const mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN; - const bottomDragAction = new EdgeDragAction.EdgeDragAction(side, mode); - bottomDragAction.connect('activated', () => { - this.open(true); - this.openedFromButton = true; - this.closedFromButton = false; - this.gestureInProgress = false; - }); - bottomDragAction.connect('progress', (_action, progress) => { - if (!this.gestureInProgress) - this.open(false) - this.setOpenState(Math.min(Math.max(0, (progress / (side % 2 == 0 ? this.box.height : this.box.width)) * 100), 100)) - this.gestureInProgress = true; - }); - bottomDragAction.connect('gesture-cancel', () => { - if (this.gestureInProgress) { - this.close() - this.openedFromButton = false; - this.closedFromButton = true; - } - this.gestureInProgress = false; - return Clutter.EVENT_PROPAGATE; - }); - global.stage.add_action_full('osk', Clutter.EventPhase.CAPTURE, bottomDragAction); - this.bottomDragAction = bottomDragAction; - } else { - this.bottomDragAction = null; - } - this._oldMaybeHandleEvent = Main.keyboard.maybeHandleEvent - Main.keyboard.maybeHandleEvent = (e) => { - let lastInputMethod = [e.type() == 11, e.type() == 11, e.type() == 7 || e.type() == 11][this.settings.get_int("enable-tap-gesture")] - let ac = global.stage.get_event_actor(e) - if (this.contains(ac)) { - ac.event(e, true); - ac.event(e, false); - return true; - } else if (ac instanceof Clutter.Text && lastInputMethod && !this.opened) { - this.open(); - } - return false - } - } + _init(settings, extensionObject) { + this.settingsOpenFunction = extensionObject.openPrefs + this.inputDevice = Clutter.get_default_backend().get_default_seat().create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE); + this.settings = settings; + let monitor = Main.layoutManager.monitors[currentMonitorId]; + super._init(Main.layoutManager.modalDialogGroup, 'db-keyboard-content'); + this.box = new St.Widget({ + reactive: true, + layout_manager: new Clutter.GridLayout({ + orientation: Clutter.Orientation.HORIZONTAL, + }) + }); + this.widthPercent = (monitor.width > monitor.height) ? settings.get_int("landscape-width-percent") / 100 : settings.get_int("portrait-width-percent") / 100; + this.heightPercent = (monitor.width > monitor.height) ? settings.get_int("landscape-height-percent") / 100 : settings.get_int("portrait-height-percent") / 100; + this.nonDragBlocker = new Clutter.Actor(); + this.buildUI(); + this.draggable = false; + // [insert handwriting 4] + this.add_child(this.box); + this.close(); + this.box.set_name("osk-gjs") + this.mod = []; + this.modBtns = []; + this.capsL = false; + this.shift = false; + this.alt = false; + this.opened = false; + this.state = State.CLOSED; + this.delta = []; + this.monitorChecker = global.backend.get_monitor_manager().connect('monitors-changed', () => { + this.refresh() + }); + this._dragging = false; + let side = null; + switch (this.settings.get_int("default-snap")) { + case 0: + case 1: + case 2: + side = St.Side.TOP; + break; + case 3: + side = St.Side.LEFT; + break; + case 5: + side = St.Side.RIGHT; + break; + case 6: + case 7: + case 8: + side = St.Side.BOTTOM; + break; + } + this.oldBottomDragAction = global.stage.get_action('osk'); + if (this.oldBottomDragAction !== null && this.oldBottomDragAction instanceof Clutter.Action) + global.stage.remove_action(this.oldBottomDragAction); + if (side != null) { + const mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN; + const bottomDragAction = new EdgeDragAction.EdgeDragAction(side, mode); + bottomDragAction.connect('activated', () => { + this.open(true); + this.openedFromButton = true; + this.closedFromButton = false; + this.gestureInProgress = false; + }); + bottomDragAction.connect('progress', (_action, progress) => { + if (!this.gestureInProgress) + this.open(false) + this.setOpenState(Math.min(Math.max(0, (progress / (side % 2 == 0 ? this.box.height : this.box.width)) * 100), 100)) + this.gestureInProgress = true; + }); + bottomDragAction.connect('gesture-cancel', () => { + if (this.gestureInProgress) { + this.close() + this.openedFromButton = false; + this.closedFromButton = true; + } + this.gestureInProgress = false; + return Clutter.EVENT_PROPAGATE; + }); + global.stage.add_action_full('osk', Clutter.EventPhase.CAPTURE, bottomDragAction); + this.bottomDragAction = bottomDragAction; + } else { + this.bottomDragAction = null; + } + this._oldMaybeHandleEvent = Main.keyboard.maybeHandleEvent + Main.keyboard.maybeHandleEvent = (e) => { + let lastInputMethod = [e.type() == 11, e.type() == 11, e.type() == 7 || e.type() == 11][this.settings.get_int("enable-tap-gesture")] + let ac = global.stage.get_event_actor(e) + if (this.contains(ac)) { + ac.event(e, true); + ac.event(e, false); + return true; + } else if (ac instanceof Clutter.Text && lastInputMethod && !this.opened) { + this.open(); + } + return false + } + } - destroy() { - Main.keyboard.maybeHandleEvent = this._oldMaybeHandleEvent - global.stage.remove_action_by_name('osk') - if (this.oldBottomDragAction !== null && this.oldBottomDragAction instanceof Clutter.Action) - global.stage.add_action_full('osk', Clutter.EventPhase.CAPTURE, this.oldBottomDragAction) - if (this.monitorChecker !== null) { - clearInterval(this.monitorChecker); - this.monitorChecker = null; - } - if (this.textboxChecker !== null) { - clearInterval(this.textboxChecker); - this.textboxChecker = null; - } - if (this.stateTimeout !== null) { - clearTimeout(this.stateTimeout); - this.stateTimeout = null; - } - if (this.keyTimeout !== null) { - clearTimeout(this.keyTimeout); - this.keyTimeout = null; - } - this.keymap.disconnect(this.capslockConnect); - this.keymap.disconnect(this.numLockConnect); - super.destroy(); - } + destroy() { + Main.keyboard.maybeHandleEvent = this._oldMaybeHandleEvent + global.stage.remove_action_by_name('osk') + if (this.oldBottomDragAction !== null && this.oldBottomDragAction instanceof Clutter.Action) + global.stage.add_action_full('osk', Clutter.EventPhase.CAPTURE, this.oldBottomDragAction) + if (this.textboxChecker !== null) { + clearInterval(this.textboxChecker); + this.textboxChecker = null; + } + if (this.stateTimeout !== null) { + clearTimeout(this.stateTimeout); + this.stateTimeout = null; + } + if (this.keyTimeout !== null) { + clearTimeout(this.keyTimeout); + this.keyTimeout = null; + } + this.keymap.disconnect(this.capslockConnect); + this.keymap.disconnect(this.numLockConnect); + global.backend.get_monitor_manager().disconnect(this.monitorChecker) + super.destroy(); + if (this.nonDragBlocker !== null) { + Main.layoutManager.removeChrome(this.nonDragBlocker) + } + } - startDragging(event, delta) { - if (this.draggable) { - if (this._dragging) - return Clutter.EVENT_PROPAGATE; - this._dragging = true; - this.box.set_opacity(255); - this.box.ease({ - opacity: 200, - duration: 100, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => { } - }); - let device = event.get_device(); - let sequence = event.get_event_sequence(); - this._grab = global.stage.grab(this); - this._grabbedDevice = device; - this._grabbedSequence = sequence; - this.emit('drag-begin'); - let [absX, absY] = event.get_coords(); - this.snapMovement(absX - delta[0], absY - delta[1]); - return Clutter.EVENT_STOP; - } else { - return Clutter.EVENT_PROPAGATE; - } - } + startDragging(event, delta) { + if (this.draggable) { + if (this._dragging) + return Clutter.EVENT_PROPAGATE; + this._dragging = true; + this.box.set_opacity(255); + this.box.ease({ + opacity: 200, + duration: 100, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + onComplete: () => { } + }); + let device = event.get_device(); + let sequence = event.get_event_sequence(); + this._grab = global.stage.grab(this); + this._grabbedDevice = device; + this._grabbedSequence = sequence; + this.emit('drag-begin'); + let [absX, absY] = event.get_coords(); + this.snapMovement(absX - delta[0], absY - delta[1]); + return Clutter.EVENT_STOP; + } else { + return Clutter.EVENT_PROPAGATE; + } + } - endDragging() { - if (this.draggable) { - if (this._dragging) { - if (this._releaseId) { - this.disconnect(this._releaseId); - this._releaseId = 0; - } - if (this._grab) { - this._grab.dismiss(); - this._grab = null; - } + endDragging() { + if (this.draggable) { + if (this._dragging) { + if (this._releaseId) { + this.disconnect(this._releaseId); + this._releaseId = 0; + } + if (this._grab) { + this._grab.dismiss(); + this._grab = null; + } - this.box.set_opacity(200); - this.box.ease({ - opacity: 255, - duration: 100, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => { } - }); - this._grabbedSequence = null; - this._grabbedDevice = null; - this._dragging = false; - this.delta = []; - this.emit('drag-end'); - this._dragging = false; - } - this.draggable = false; - return Clutter.EVENT_STOP; - } else { - return Clutter.EVENT_STOP; - } - } + this.box.set_opacity(200); + this.box.ease({ + opacity: 255, + duration: 100, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + onComplete: () => { } + }); + this._grabbedSequence = null; + this._grabbedDevice = null; + this._dragging = false; + this.delta = []; + this.emit('drag-end'); + this._dragging = false; + } + this.draggable = false; + return Clutter.EVENT_STOP; + } else { + return Clutter.EVENT_STOP; + } + } - motionEvent(event) { - if (this.draggable) { - let [absX, absY] = event.get_coords(); - this.snapMovement(absX - this.delta[0], absY - this.delta[1]); - return Clutter.EVENT_STOP - } else { - return Clutter.EVENT_STOP - } - } + motionEvent(event) { + if (this.draggable) { + let [absX, absY] = event.get_coords(); + this.snapMovement(absX - this.delta[0], absY - this.delta[1]); + return Clutter.EVENT_STOP + } else { + return Clutter.EVENT_STOP + } + } - 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 - 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 - 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); - } - this.set_translation(xPos, yPos, 0); - } + snapMovement(xPos, yPos) { + let monitor = Main.layoutManager.monitors[currentMonitorId] + if (xPos < monitor.x || yPos < monitor.y || xPos > monitor.x + monitor.width || yPos > monitor.y + monitor.width) { + this.set_translation(xPos, yPos, 0); + return; + } + xPos -= monitor.x; + yPos -= monitor.y; + 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 - 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 - 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); + } + this.set_translation(xPos + monitor.x, yPos + monitor.y, 0); + } - checkMonitor() { - let monitor = Main.layoutManager.primaryMonitor; - let oldMonitorDimensions = [monitor.width, monitor.height]; - this.monitorChecker = setInterval(() => { - monitor = Main.layoutManager.primaryMonitor; - if (oldMonitorDimensions[0] != monitor.width || oldMonitorDimensions[1] != monitor.height) { - this.refresh() - oldMonitorDimensions = [monitor.width, monitor.height]; - } - }, 200); - } + setOpenState(percent) { + let monitor = Main.layoutManager.monitors[currentMonitorId]; + 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))]; + let mX = [-this.box.width, 0, this.box.width][(this.settings.get_int("default-snap") % 3)]; + let mY = [-this.box.height, 0, this.box.height][Math.floor((this.settings.get_int("default-snap") / 3))] + let [dx, dy] = [posX + mX * ((100 - percent) / 100) + monitor.x, posY + mY * ((100 - percent) / 100) + monitor.y] + let op = 255 * (percent / 100); + this.set_translation(dx, dy, 0) + this.box.set_opacity(op) + } - setOpenState(percent) { - let monitor = Main.layoutManager.primaryMonitor; - 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))]; - let mX = [-this.box.width, 0, this.box.width][(this.settings.get_int("default-snap") % 3)]; - let mY = [-this.box.height, 0, this.box.height][Math.floor((this.settings.get_int("default-snap") / 3))] - let [dx, dy] = [posX + mX * ((100 - percent) / 100), posY + mY * ((100 - percent) / 100)] - let op = 255 * (percent / 100); - this.set_translation(dx, dy, 0) - this.box.set_opacity(op) - } + open(noPrep = null, instant = null) { + if (this.updateCapsLock) this.updateCapsLock() + if (this.updateNumLock) this.updateNumLock() + if (noPrep == null || !noPrep) { + this.prevKeyFocus = global.stage.key_focus + this.inputDevice = Clutter.get_default_backend().get_default_seat().create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE); + this.state = State.OPENING + this.show(); + } + if (noPrep == null || noPrep) { + let monitor = Main.layoutManager.monitors[currentMonitorId]; + 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))]; + if (noPrep == null) { + let mX = [-this.box.width, 0, this.box.width][(this.settings.get_int("default-snap") % 3)]; + let mY = [-this.box.height, 0, this.box.height][Math.floor((this.settings.get_int("default-snap") / 3))] + this.set_translation(posX + mX + monitor.x, posY + mY + monitor.y, 0) + } + this.box.ease({ + opacity: 255, + duration: instant == null || !instant ? 100 : 0, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + onComplete: () => { + if (this.stateTimeout !== null) { + clearTimeout(this.stateTimeout); + this.stateTimeout = null; + } + this.stateTimeout = setTimeout(() => { + this.state = State.OPENED + }, 500); + } + }); + this.ease({ + translation_x: posX + monitor.x, + translation_y: posY + monitor.y, + duration: instant == null || !instant ? 100 : 0, + mode: Clutter.AnimationMode.EASE_OUT_QUAD + }) + if (!this.settings.get_boolean("enable-drag") && this.nonDragBlocker !== null) { + Main.layoutManager.addChrome(this.nonDragBlocker, { + affectsStruts: true, + trackFullscreen: true, + }) + } + this.opened = true; + // [insert handwriting 5] + } + } - open(noPrep = null, instant = null) { - if (noPrep == null || !noPrep) { - this.prevKeyFocus = global.stage.key_focus - this.inputDevice = Clutter.get_default_backend().get_default_seat().create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE); - this.state = State.OPENING - this.show(); - } - if (noPrep == null || noPrep) { - let monitor = Main.layoutManager.primaryMonitor; - 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))]; - if (noPrep == null) { - let mX = [-this.box.width, 0, this.box.width][(this.settings.get_int("default-snap") % 3)]; - let mY = [-this.box.height, 0, this.box.height][Math.floor((this.settings.get_int("default-snap") / 3))] - this.set_translation(posX + mX, posY + mY, 0) - } - this.box.ease({ - opacity: 255, - duration: instant == null || !instant ? 100 : 0, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => { - if (this.stateTimeout !== null) { - clearTimeout(this.stateTimeout); - this.stateTimeout = null; - } - this.stateTimeout = setTimeout(() => { - this.state = State.OPENED - }, 500); - } - }); - this.ease({ - translation_x: posX, - translation_y: posY, - duration: instant == null || !instant ? 100 : 0, - mode: Clutter.AnimationMode.EASE_OUT_QUAD - }) - this.opened = true; - } - } + close(instant = null) { + this.prevKeyFocus = null; + let monitor = Main.layoutManager.monitors[currentMonitorId]; + 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))]; + let mX = [-this.box.width, 0, this.box.width][(this.settings.get_int("default-snap") % 3)]; + let mY = [-this.box.height, 0, this.box.height][Math.floor((this.settings.get_int("default-snap") / 3))] + this.state = State.CLOSING + this.box.ease({ + opacity: 0, + duration: instant == null || !instant ? 100 : 0, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + onComplete: () => { + this.opened = false; + this.hide(); + if (this.stateTimeout !== null) { + clearTimeout(this.stateTimeout); + this.stateTimeout = null; + } + this.stateTimeout = setTimeout(() => { + this.state = State.CLOSED + }, 500); + }, + }); + this.ease({ + translation_x: posX + mX + monitor.x, + translation_y: posY + mY + monitor.y, + duration: instant == null || !instant ? 100 : 0, + mode: Clutter.AnimationMode.EASE_OUT_QUAD + }) + if (!this.settings.get_boolean("enable-drag") && this.nonDragBlocker !== null) { + Main.layoutManager.removeChrome(this.nonDragBlocker, { + affectsStruts: true, + trackFullscreen: true, + }) + } + this.openedFromButton = false + this.releaseAllKeys(); + // [insert handwrting 6] + } - close(instant = null) { - this.prevKeyFocus = null; - let monitor = Main.layoutManager.primaryMonitor; - 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))]; - let mX = [-this.box.width, 0, this.box.width][(this.settings.get_int("default-snap") % 3)]; - let mY = [-this.box.height, 0, this.box.height][Math.floor((this.settings.get_int("default-snap") / 3))] - this.state = State.CLOSING - this.box.ease({ - opacity: 0, - duration: instant == null || !instant ? 100 : 0, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => { - this.opened = false; - this.hide(); - if (this.stateTimeout !== null) { - clearTimeout(this.stateTimeout); - this.stateTimeout = null; - } - this.stateTimeout = setTimeout(() => { - this.state = State.CLOSED - }, 500); - }, - }); - this.ease({ - translation_x: posX + mX, - translation_y: posY + mY, - duration: instant == null || !instant ? 100 : 0, - mode: Clutter.AnimationMode.EASE_OUT_QUAD - }) - this.openedFromButton = false - this.releaseAllKeys(); - } + vfunc_button_press_event() { + this.delta = [Clutter.get_current_event().get_coords()[0] - this.translation_x, Clutter.get_current_event().get_coords()[1] - this.translation_y]; + return this.startDragging(Clutter.get_current_event(), this.delta) + } - vfunc_button_press_event() { - this.delta = [Clutter.get_current_event().get_coords()[0] - this.translation_x, Clutter.get_current_event().get_coords()[1] - this.translation_y]; - return this.startDragging(Clutter.get_current_event(), this.delta) - } + vfunc_button_release_event() { + if (this._dragging && !this._grabbedSequence) { + return this.endDragging(); + } + return Clutter.EVENT_PROPAGATE; + } - vfunc_button_release_event() { - if (this._dragging && !this._grabbedSequence) { - return this.endDragging(); - } - return Clutter.EVENT_PROPAGATE; - } - - vfunc_motion_event() { - let event = Clutter.get_current_event(); - if (this._dragging && !this._grabbedSequence) { - this.motionEvent(event); - } - return Clutter.EVENT_PROPAGATE; - } + vfunc_motion_event() { + let event = Clutter.get_current_event(); + if (this._dragging && !this._grabbedSequence) { + this.motionEvent(event); + } + return Clutter.EVENT_PROPAGATE; + } - vfunc_touch_event() { - let event = Clutter.get_current_event(); - let sequence = event.get_event_sequence(); + vfunc_touch_event() { + let event = Clutter.get_current_event(); + let sequence = event.get_event_sequence(); - if (!this._dragging && event.type() == Clutter.EventType.TOUCH_BEGIN) { - this.delta = [event.get_coords()[0] - this.translation_x, event.get_coords()[1] - this.translation_y]; - this.startDragging(event, this.delta); - return Clutter.EVENT_STOP; - } else if (this._grabbedSequence && sequence.get_slot() === this._grabbedSequence.get_slot()) { - if (event.type() == Clutter.EventType.TOUCH_UPDATE) { - return this.motionEvent(event); - } else if (event.type() == Clutter.EventType.TOUCH_END) { - return this.endDragging(); - } - } + if (!this._dragging && event.type() == Clutter.EventType.TOUCH_BEGIN) { + this.delta = [event.get_coords()[0] - this.translation_x, event.get_coords()[1] - this.translation_y]; + this.startDragging(event, this.delta); + return Clutter.EVENT_STOP; + } else if (this._grabbedSequence && sequence.get_slot() === this._grabbedSequence.get_slot()) { + if (event.type() == Clutter.EventType.TOUCH_UPDATE) { + return this.motionEvent(event); + } else if (event.type() == Clutter.EventType.TOUCH_END) { + return this.endDragging(); + } + } - return Clutter.EVENT_PROPAGATE; - } + return Clutter.EVENT_PROPAGATE; + } - buildUI() { - this.box.set_opacity(0); - this.keys = []; - let layoutName = Object.keys(layouts)[this.settings.get_int("layout")]; - let monitor = Main.layoutManager.primaryMonitor - this.box.width = Math.round((monitor.width - this.settings.get_int("snap-spacing-px") * 2) * (layoutName.includes("Split") ? 1 : this.widthPercent)) - this.box.height = Math.round((monitor.height - this.settings.get_int("snap-spacing-px") * 2) * this.heightPercent) + buildUI() { + this.box.set_opacity(0); + this.keys = []; + let monitor = Main.layoutManager.monitors[currentMonitorId] + let layoutName = Object.keys(layouts)[(monitor.width > monitor.height) ? this.settings.get_int("layout-landscape") : this.settings.get_int("layout-portrait")]; + this.box.width = Math.round((monitor.width - this.settings.get_int("snap-spacing-px") * 2) * (layoutName.includes("Split") ? 1 : this.widthPercent)) + this.box.height = Math.round((monitor.height - this.settings.get_int("snap-spacing-px") * 2) * this.heightPercent) - const grid = this.box.layout_manager - grid.set_row_homogeneous(true) - grid.set_column_homogeneous(!layoutName.includes("Split")) + if (!this.settings.get_boolean("enable-drag")) { + this.nonDragBlocker = new Clutter.Actor(); + switch (this.settings.get_int("default-snap")) { + case 0: + case 1: + case 2: + this.nonDragBlocker.x = monitor.x; + this.nonDragBlocker.y = monitor.y; + this.nonDragBlocker.width = monitor.width; + this.nonDragBlocker.height = this.box.height + 2 * this.settings.get_int("snap-spacing-px"); + break; + case 3: + this.nonDragBlocker.x = monitor.x; + this.nonDragBlocker.y = monitor.y; + this.nonDragBlocker.width = this.box.width + 2 * this.settings.get_int("snap-spacing-px"); + this.nonDragBlocker.height = monitor.height; + break; + case 5: + this.nonDragBlocker.x = monitor.x + monitor.width - (this.box.width + 2 * this.settings.get_int("snap-spacing-px")); + this.nonDragBlocker.y = monitor.y; + this.nonDragBlocker.width = this.box.width + 2 * this.settings.get_int("snap-spacing-px"); + this.nonDragBlocker.height = monitor.height; + break; + case 6: + case 7: + case 8: + this.nonDragBlocker.x = monitor.x; + this.nonDragBlocker.y = monitor.y + monitor.height - (this.box.height + 2 * this.settings.get_int("snap-spacing-px")); + this.nonDragBlocker.width = monitor.width; + this.nonDragBlocker.height = this.box.height + 2 * this.settings.get_int("snap-spacing-px"); + break; + } + if (this.settings.get_int("default-snap") == 4) { + this.nonDragBlocker.destroy(); + this.nonDragBlocker = null; + } + } else { + this.nonDragBlocker.destroy(); + this.nonDragBlocker = null; + } - let gridLeft; - let gridRight; - let currentGrid = grid; - let left; - let right; + const grid = this.box.layout_manager + grid.set_row_homogeneous(true) + grid.set_column_homogeneous(!layoutName.includes("Split")) - if (layoutName.includes("Split")) { - left = new St.Widget({ - layout_manager: new Clutter.GridLayout({ - orientation: Clutter.Orientation.HORIZONTAL, - row_spacing: this.settings.get_int("border-spacing-px") * 2, - column_spacing: this.settings.get_int("border-spacing-px") * 2, - row_homogeneous: true, - column_homogeneous: true - }), - width: Math.round((monitor.width - this.settings.get_int("snap-spacing-px") * 2) * this.widthPercent) / 2 - }) - gridLeft = left.layout_manager; - let middle = new St.Widget({ - width: this.box.width * (1 - this.widthPercent) - 10 + this.settings.get_int("border-spacing-px") - }); - right = new St.Widget({ - layout_manager: new Clutter.GridLayout({ - orientation: Clutter.Orientation.HORIZONTAL, - row_spacing: this.settings.get_int("border-spacing-px") * 2, - column_spacing: this.settings.get_int("border-spacing-px") * 2, - row_homogeneous: true, - column_homogeneous: true - }), - width: Math.round((monitor.width - this.settings.get_int("snap-spacing-px") * 2) * this.widthPercent) / 2 - }) - gridRight = right.layout_manager; - this.box.add_child(left) - this.box.add_child(middle) - this.box.add_child(right) - } + let gridLeft; + let gridRight; + let currentGrid = grid; + let left; + let right; + let topBtnWidth; - this.shiftButtons = []; + if (layoutName.includes("Split")) { + this.box.reactive = false; + left = new St.Widget({ + reactive: true, + layout_manager: new Clutter.GridLayout({ + orientation: Clutter.Orientation.HORIZONTAL, + row_homogeneous: true, + column_homogeneous: true + }), + width: Math.round((monitor.width - this.settings.get_int("snap-spacing-px") * 2) * this.widthPercent) / 2 + }) + gridLeft = left.layout_manager; + let middle = new St.Widget({ + reactive: false, + width: this.box.width * (1 - this.widthPercent) - 10 + this.settings.get_int("border-spacing-px") + }); + right = new St.Widget({ + reactive: true, + layout_manager: new Clutter.GridLayout({ + orientation: Clutter.Orientation.HORIZONTAL, + row_homogeneous: true, + column_homogeneous: true + }), + width: Math.round((monitor.width - this.settings.get_int("snap-spacing-px") * 2) * this.widthPercent) / 2 + }) + gridRight = right.layout_manager; + this.box.add_child(left) + this.box.add_child(middle) + this.box.add_child(right) + } - let currentLayout = layouts[layoutName]; - let width = 0; - for (const c of currentLayout[0]) { - width += (Object.hasOwn(c, "width") ? c.width : 1) - } - let rowSize; - let halfSize; - let r = 0; - let c; - const doAddKey = (keydef) => { - const i = Object.hasOwn(keydef, "key") ? keycodes[keydef.key] : Object.hasOwn(keydef, "split") ? "split" : "empty space"; - if (i != null && typeof i !== 'string') { - if (i.layers.default == null) { - for (var key of Object.keys(i.layers)) { - i.layers[key] = i.layers["_" + key] - } - } - let params = { - x_expand: true, - y_expand: true - } - - let iconKeys = ["left", "up", "right", "down", "space"] - if (this.settings.get_boolean("show-icons")) { - iconKeys = ["left", "up", "right", "down", "backspace", "tab", "capslock", "shift", "enter", "ctrl", "super", "alt", "space"] - } - if (iconKeys.some(j => { return i.layers.default.toLowerCase() == j })) { - params.style_class = i.layers.default.toLowerCase() + "_btn" - for (var key of Object.keys(i.layers)) { - i.layers["_" + key] = i.layers[key] - i.layers[key] = null - } - } else { - params.label = i.layers.default - } - i.isMod = false - if ([42, 54, 29, 125, 56, 100, 97, 58, 69].some(j => { return i.code == j })) { - i.isMod = true; - } - const keyBtn = new St.Button(params) - keyBtn.add_style_class_name('key') - keyBtn.char = i - if (i.code == 58) { - this.keymap = Clutter.get_default_backend().get_default_seat().get_keymap() - this.capslockConnect = this.keymap.connect("state-changed", (a, e) => { - this.setCapsLock(keyBtn, this.keymap.get_caps_lock_state()) - }) - } else if (i.code == 69) { - this.keymap = Clutter.get_default_backend().get_default_seat().get_keymap() - this.numLockConnect = this.keymap.connect("state-changed", (a, e) => { - this.setNumLock(keyBtn, this.keymap.get_num_lock_state()) - }) - } else if (i.code == 42 || i.code == 54) { - this.shiftButtons.push(keyBtn) - } - currentGrid.attach(keyBtn, c, 6 + r, (Object.hasOwn(keydef, "width") ? keydef.width : 1) * 8, r == 0 ? 6 : (Object.hasOwn(keydef, "height") ? keydef.height : 1) * 8) - keyBtn.visible = true - c += (Object.hasOwn(keydef, "width") ? keydef.width : 1) * 8 - this.keys.push(keyBtn) - } else if (i == "empty space") { - c += (Object.hasOwn(keydef, "width") ? keydef.width : 1) * 8 - } else if (i == "split") { - currentGrid = gridRight - const size = c - if (!halfSize) halfSize = size - } - } - - for (const kRow of currentLayout) { - c = 0; - if (layoutName.includes("Split")) { - currentGrid = gridLeft; - } - for (const keydef of kRow) { - if (keydef instanceof Array) { - keydef.forEach(i => {doAddKey(i); r += 4; c -= 8}); - c += 8; - r -= 8; - } else { - doAddKey(keydef) - } - } - const size = c; - if (!rowSize) rowSize = size; - r += r == 0 ? 6 : 8 - } + this.shiftButtons = []; + // [insert handwriting 7] - if (left != null) { - this.set_reactive(false) - left.add_style_class_name("boxLay"); - left.set_style("background-color: rgba(" + this.settings.get_double("background-r" + this.settings.scheme) + "," + this.settings.get_double("background-g" + this.settings.scheme) + "," + this.settings.get_double("background-b" + this.settings.scheme) + ", " + this.settings.get_double("background-a" + this.settings.scheme) + ");") - right.add_style_class_name("boxLay"); - right.set_style("background-color: rgba(" + this.settings.get_double("background-r" + this.settings.scheme) + "," + this.settings.get_double("background-g" + this.settings.scheme) + "," + this.settings.get_double("background-b" + this.settings.scheme) + ", " + this.settings.get_double("background-a" + this.settings.scheme) + ");") - if (this.lightOrDark(this.settings.get_double("background-r" + this.settings.scheme), this.settings.get_double("background-g" + this.settings.scheme), this.settings.get_double("background-b" + this.settings.scheme))) { - left.add_style_class_name("inverted"); - right.add_style_class_name("inverted"); - } else { - left.add_style_class_name("regular"); - right.add_style_class_name("regular"); - } - const settingsBtn = new St.Button({ - x_expand: true, - y_expand: true - }) - settingsBtn.add_style_class_name("settings_btn") - settingsBtn.add_style_class_name("key") - settingsBtn.connect("clicked", () => { - this.settingsOpenFunction(); - }) - gridLeft.attach(settingsBtn, 0, 0, 8, 5) - this.keys.push(settingsBtn) + let currentLayout = layouts[layoutName]; + let width = 0; + for (const c of currentLayout[0]) { + width += (Object.hasOwn(c, "width") ? c.width : 1) + } + let rowSize; + let halfSize; + let r = 0; + let c; + const doAddKey = (keydef) => { + const i = Object.hasOwn(keydef, "key") ? keycodes[keydef.key] : Object.hasOwn(keydef, "split") ? "split" : "empty space"; + if (i != null && typeof i !== 'string') { + if (i.layers.default == null) { + for (var key of Object.keys(i.layers)) { + i.layers[key] = i.layers["_" + key] + } + } + let params = { + x_expand: true, + y_expand: true + } - const closeBtn = new St.Button({ - x_expand: true, - y_expand: true - }) - closeBtn.add_style_class_name("close_btn") - closeBtn.add_style_class_name("key") - closeBtn.connect("clicked", () => { - this.close(); - this.closedFromButton = true; - }) - gridRight.attach(closeBtn, (rowSize - 8), 0, 8, 5) - this.keys.push(closeBtn) - - let moveHandleLeft = new St.Button({ - x_expand: true, - y_expand: true - }) - moveHandleLeft.add_style_class_name("moveHandle") - moveHandleLeft.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.scheme), this.settings.get_double("background-g" + this.settings.scheme), this.settings.get_double("background-b" + this.settings.scheme))) { - moveHandleLeft.add_style_class_name("inverted"); - } else { - moveHandleLeft.add_style_class_name("regular"); - } + let iconKeys = ["left", "up", "right", "down", "space"] + if (this.settings.get_boolean("show-icons")) { + iconKeys = ["left", "up", "right", "down", "backspace", "tab", "capslock", "shift", "enter", "ctrl", "super", "alt", "space"] + } + // [insert handwriting 8] + if (iconKeys.some(j => { return i.layers.default.toLowerCase() == j })) { + params.style_class = i.layers.default.toLowerCase() + "_btn" + for (var key of Object.keys(i.layers)) { + i.layers["_" + key] = i.layers[key] + i.layers[key] = null + } + } else { + params.label = i.layers.default + } + i.isMod = false + if ([42, 54, 29, 125, 56, 100, 97, 58, 69].some(j => { return i.code == j })) { + i.isMod = true; + } + const keyBtn = new St.Button(params) + keyBtn.add_style_class_name('key') + keyBtn.char = i + if (i.code == 58) { + this.keymap = Clutter.get_default_backend().get_default_seat().get_keymap() + this.capslockConnect = this.keymap.connect("state-changed", (a, e) => { + this.setCapsLock(keyBtn, this.keymap.get_caps_lock_state()) + }) + this.updateCapsLock = () => this.setCapsLock(keyBtn, this.keymap.get_caps_lock_state()) + } else if (i.code == 69) { + this.keymap = Clutter.get_default_backend().get_default_seat().get_keymap() + this.numLockConnect = this.keymap.connect("state-changed", (a, e) => { + this.setNumLock(keyBtn, this.keymap.get_num_lock_state()) + }) + this.updateNumLock = () => this.setNumLock(keyBtn, this.keymap.get_num_lock_state()) + } else if (i.code == 42 || i.code == 54) { + this.shiftButtons.push(keyBtn) + } + currentGrid.attach(keyBtn, c, 5 + r, (Object.hasOwn(keydef, "width") ? keydef.width : 1) * 2, r == 0 ? 3 : (Object.hasOwn(keydef, "height") ? keydef.height : 1) * 4) + keyBtn.visible = true + c += (Object.hasOwn(keydef, "width") ? keydef.width : 1) * 2 + this.keys.push(keyBtn) + // [insert handwriting 9] + } else if (i == "empty space") { + c += (Object.hasOwn(keydef, "width") ? keydef.width : 1) * 2 + } else if (i == "split") { + currentGrid = gridRight + const size = c + if (!halfSize) halfSize = size + } + } - moveHandleLeft.connect("event", (actor, event) => { - if (event.type() == Clutter.EventType.BUTTON_PRESS || event.type() == Clutter.EventType.TOUCH_BEGIN) { - this.draggable = this.settings.get_boolean("enable-drag"); - } - this.event(event, false) - }) - gridLeft.attach(moveHandleLeft, 8, 0, (halfSize - 8), 5) + for (const kRow of currentLayout) { + c = 0; + if (layoutName.includes("Split")) { + currentGrid = gridLeft; + } + for (const keydef of kRow) { + if (keydef instanceof Array) { + keydef.forEach(i => { doAddKey(i); r += 2; c -= (Object.hasOwn(i, "width") ? i.width : 1) * 2 }); + c += (Object.hasOwn(keydef[0], "width") ? keydef[0].width : 1) * 2; + r -= 4; + } else { + doAddKey(keydef) + } + } + if (!topBtnWidth) topBtnWidth = ((Object.hasOwn(kRow[kRow.length - 1], "width") && (Object.hasOwn(kRow[kRow.length - 1], "key"))) ? kRow[kRow.length - 1].width : 1) + const size = c; + if (!rowSize) rowSize = size; + r += r == 0 ? 3 : 4 + } - let moveHandleRight = new St.Button({ - x_expand: true, - y_expand: true - }) - moveHandleRight.add_style_class_name("moveHandle") - moveHandleRight.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.scheme), this.settings.get_double("background-g" + this.settings.scheme), this.settings.get_double("background-b" + this.settings.scheme))) { - moveHandleRight.add_style_class_name("inverted"); - } else { - moveHandleRight.add_style_class_name("regular"); - } + if (left != null) { + this.set_reactive(false) + left.add_style_class_name("boxLay"); + right.add_style_class_name("boxLay"); + if (this.settings.get_boolean("system-accent-col") && major >= 47) { + if (this.settings.scheme == "-dark") { + left.set_style("background-color: st-darken(-st-accent-color, 30%); padding: " + this.settings.get_int("outer-spacing-px") + "px;") + right.set_style("background-color: st-darken(-st-accent-color, 30%); padding: " + this.settings.get_int("outer-spacing-px") + "px;") + } else { + left.set_style("background-color: st-lighten(-st-accent-color, 10%); padding: " + this.settings.get_int("outer-spacing-px") + "px;") + right.set_style("background-color: st-lighten(-st-accent-color, 10%); padding: " + this.settings.get_int("outer-spacing-px") + "px;") + } + } else { + left.set_style("background-color: rgba(" + this.settings.get_double("background-r" + this.settings.scheme) + "," + this.settings.get_double("background-g" + this.settings.scheme) + "," + this.settings.get_double("background-b" + this.settings.scheme) + ", " + this.settings.get_double("background-a" + this.settings.scheme) + "); padding: " + this.settings.get_int("outer-spacing-px") + "px;") + right.set_style("background-color: rgba(" + this.settings.get_double("background-r" + this.settings.scheme) + "," + this.settings.get_double("background-g" + this.settings.scheme) + "," + this.settings.get_double("background-b" + this.settings.scheme) + ", " + this.settings.get_double("background-a" + this.settings.scheme) + "); padding: " + this.settings.get_int("outer-spacing-px") + "px;") + } + if (this.lightOrDark()) { + left.add_style_class_name("inverted"); + right.add_style_class_name("inverted"); + } else { + left.add_style_class_name("regular"); + right.add_style_class_name("regular"); + } + const settingsBtn = new St.Button({ + x_expand: true, + y_expand: true + }) + settingsBtn.add_style_class_name("settings_btn") + settingsBtn.add_style_class_name("key") + settingsBtn.connect("clicked", () => { + this.settingsOpenFunction(); + }) + gridLeft.attach(settingsBtn, 0, 0, 2 * topBtnWidth, 3) + this.keys.push(settingsBtn) - moveHandleRight.connect("event", (actor, event) => { - if (event.type() == Clutter.EventType.BUTTON_PRESS || event.type() == Clutter.EventType.TOUCH_BEGIN) { - this.draggable = this.settings.get_boolean("enable-drag"); - } - this.event(event, false) - }) - gridRight.attach(moveHandleRight, (rowSize - halfSize), 0, (rowSize - halfSize - 4), 5) - gridLeft.attach(new St.Widget({x_expand: true, y_expand: true}), 0, 5, halfSize, 1) - gridRight.attach(new St.Widget({x_expand: true, y_expand: true}), (rowSize - halfSize), 5, (rowSize - halfSize + 4), 1) - } else { - this.box.add_style_class_name("boxLay"); - this.box.set_style("background-color: rgba(" + this.settings.get_double("background-r" + this.settings.scheme) + "," + this.settings.get_double("background-g" + this.settings.scheme) + "," + this.settings.get_double("background-b" + this.settings.scheme) + ", " + this.settings.get_double("background-a" + this.settings.scheme) + ");") - if (this.lightOrDark(this.settings.get_double("background-r" + this.settings.scheme), this.settings.get_double("background-g" + this.settings.scheme), this.settings.get_double("background-b" + this.settings.scheme))) { - this.box.add_style_class_name("inverted"); - } else { - this.box.add_style_class_name("regular"); - } + const closeBtn = new St.Button({ + x_expand: true, + y_expand: true + }) + closeBtn.add_style_class_name("close_btn") + closeBtn.add_style_class_name("key") + closeBtn.connect("clicked", () => { + this.close(); + this.closedFromButton = true; + }) + gridRight.attach(closeBtn, (rowSize - 2 * topBtnWidth), 0, 2 * topBtnWidth, 3) + this.keys.push(closeBtn) - const settingsBtn = new St.Button({ - x_expand: true, - y_expand: true - }) - settingsBtn.add_style_class_name("settings_btn") - settingsBtn.add_style_class_name("key") - settingsBtn.connect("clicked", () => { - this.settingsOpenFunction(); - }) - grid.attach(settingsBtn, 0, 0, 8, 5) - this.keys.push(settingsBtn) + let moveHandleLeft = new St.Button({ + x_expand: true, + y_expand: true + }) + moveHandleLeft.add_style_class_name("moveHandle") + moveHandleLeft.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; font-weight: " + (this.settings.get_boolean("font-bold") ? "bold" : "normal") + "; border: " + this.settings.get_int("border-spacing-px") + "px solid transparent;"); + if (this.lightOrDark()) { + moveHandleLeft.add_style_class_name("inverted"); + } else { + moveHandleLeft.add_style_class_name("regular"); + } - const closeBtn = new St.Button({ - x_expand: true, - y_expand: true - }) - closeBtn.add_style_class_name("close_btn") - closeBtn.add_style_class_name("key") - closeBtn.connect("clicked", () => { - this.close(); - this.closedFromButton = true; - }) - grid.attach(closeBtn, (rowSize - 8), 0, 8, 5) - this.keys.push(closeBtn) - - let moveHandle= new St.Button({ - x_expand: true, - y_expand: true - }) - moveHandle.add_style_class_name("moveHandle") - moveHandle.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.scheme), this.settings.get_double("background-g" + this.settings.scheme), this.settings.get_double("background-b" + this.settings.scheme))) { - moveHandle.add_style_class_name("inverted"); - } else { - moveHandle.add_style_class_name("regular"); - } + moveHandleLeft.connect("event", (actor, event) => { + if (event.type() == Clutter.EventType.BUTTON_PRESS || event.type() == Clutter.EventType.TOUCH_BEGIN) { + this.draggable = this.settings.get_boolean("enable-drag"); + } + this.event(event, false) + }) + gridLeft.attach(moveHandleLeft, 2 * topBtnWidth, 0, (halfSize - 2 * topBtnWidth), 3) - moveHandle.connect("event", (actor, event) => { - if (event.type() == Clutter.EventType.BUTTON_PRESS || event.type() == Clutter.EventType.TOUCH_BEGIN) { - this.draggable = this.settings.get_boolean("enable-drag"); - } - this.event(event, false) - }) - grid.attach(moveHandle, 8, 0, (rowSize - 16), 5) - grid.attach(new St.Widget({x_expand: true, y_expand: true}), 0, 5, rowSize, 1) - } - - this.keys.forEach(item => { - 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; font-weight: " + (this.settings.get_boolean("font-bold") ? "bold" : "normal") + ";"); - if (this.lightOrDark(this.settings.get_double("background-r" + this.settings.scheme), this.settings.get_double("background-g" + this.settings.scheme), this.settings.get_double("background-b" + this.settings.scheme))) { - item.add_style_class_name("inverted"); - } else { - item.add_style_class_name("regular"); - } - item.set_pivot_point(0.5, 0.5) - item.connect("destroy", () => { - 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.tap_pressed !== null) { - clearTimeout(item.tap_pressed) - item.tap_pressed == null - } - if (item.tap_repeat !== null) { - clearInterval(item.tap_repeat) - item.tap_repeat == null - } - }) - 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) - } - 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) + let moveHandleRight = new St.Button({ + x_expand: true, + y_expand: true + }) + moveHandleRight.add_style_class_name("moveHandle") + moveHandleRight.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; font-weight: " + (this.settings.get_boolean("font-bold") ? "bold" : "normal") + "; border: " + this.settings.get_int("border-spacing-px") + "px solid transparent;"); + if (this.lightOrDark()) { + moveHandleRight.add_style_class_name("inverted"); + } else { + moveHandleRight.add_style_class_name("regular"); + } - for (var i of oldModBtns) { - this.decideMod(i.char, i) - } - }, 100); - }, 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, - duration: 100, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onComplete: () => { item.set_scale(1, 1); } - }) - 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; - } 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) { - pressEv("touch") - } else if (Clutter.get_current_event().type() == Clutter.EventType.TOUCH_END || Clutter.get_current_event().type() == Clutter.EventType.TOUCH_CANCEL) { - releaseEv() - } - }) - }); - } + moveHandleRight.connect("event", (actor, event) => { + if (event.type() == Clutter.EventType.BUTTON_PRESS || event.type() == Clutter.EventType.TOUCH_BEGIN) { + this.draggable = this.settings.get_boolean("enable-drag"); + } + this.event(event, false) + }) + gridRight.attach(moveHandleRight, halfSize, 0, (rowSize - halfSize - 2 * topBtnWidth), 3) + gridLeft.attach(new St.Widget({ x_expand: true, y_expand: true }), 0, 3, halfSize, 1) + gridRight.attach(new St.Widget({ x_expand: true, y_expand: true }), halfSize, 3, (rowSize - halfSize), 1) + } else { + this.box.add_style_class_name("boxLay"); + if (this.settings.get_boolean("system-accent-col") && major >= 47) { + if (this.settings.scheme == "-dark") { + this.box.set_style("background-color: st-darken(-st-accent-color, 30%); padding: " + this.settings.get_int("outer-spacing-px") + "px;") + } else { + this.box.set_style("background-color: st-lighten(-st-accent-color, 10%); padding: " + this.settings.get_int("outer-spacing-px") + "px;") + } + } else { + this.box.set_style("background-color: rgba(" + this.settings.get_double("background-r" + this.settings.scheme) + "," + this.settings.get_double("background-g" + this.settings.scheme) + "," + this.settings.get_double("background-b" + this.settings.scheme) + ", " + this.settings.get_double("background-a" + this.settings.scheme) + "); padding: " + this.settings.get_int("outer-spacing-px") + "px;") + } + if (this.lightOrDark()) { + this.box.add_style_class_name("inverted"); + } else { + this.box.add_style_class_name("regular"); + } - lightOrDark(r, g, b) { - var hsp; - hsp = Math.sqrt( - 0.299 * (r * r) + - 0.587 * (g * g) + - 0.114 * (b * b) - ); - if (hsp > 127.5) { - return true; - } else { - return false; - } - } - releaseAllKeys() { - let instances = []; + const settingsBtn = new St.Button({ + x_expand: true, + y_expand: true + }) + settingsBtn.add_style_class_name("settings_btn") + settingsBtn.add_style_class_name("key") + settingsBtn.connect("clicked", () => { + this.settingsOpenFunction(); + }) + grid.attach(settingsBtn, 0, 0, 2 * topBtnWidth, 3) + this.keys.push(settingsBtn) - 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]); - } - } - } - } + const closeBtn = new St.Button({ + x_expand: true, + y_expand: true + }) + closeBtn.add_style_class_name("close_btn") + closeBtn.add_style_class_name("key") + closeBtn.connect("clicked", () => { + this.close(); + this.closedFromButton = true; + }) + grid.attach(closeBtn, (rowSize - 2 * topBtnWidth), 0, 2 * topBtnWidth, 3) + this.keys.push(closeBtn) - traverse(keycodes); - instances.forEach(i => { - this.inputDevice.notify_key(Clutter.get_current_event_time(), i, Clutter.KeyState.RELEASED); - }) + // [insert handwriting 10] - 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++) { - this.inputDevice.notify_key(Clutter.get_current_event_time(), keys[i], Clutter.KeyState.PRESSED); - } - if (this.keyTimeout !== null) { - clearTimeout(this.keyTimeout); - this.keyTimeout = null; - } - this.keyTimeout = setTimeout(() => { - for (var j = keys.length - 1; j >= 0; j--) { - this.inputDevice.notify_key(Clutter.get_current_event_time(), keys[j], Clutter.KeyState.RELEASED); - } - }, 100); - } catch (err) { - throw new Error("GJS-OSK: An unknown error occured. Please report this bug to the Issues page (https://github.com/Vishram1123/gjs-osk/issues):\n\n" + err + "\n\nKeys Pressed: " + keys); - } - } + let moveHandle = new St.Button({ + x_expand: true, + y_expand: true + }) + moveHandle.add_style_class_name("moveHandle") + moveHandle.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; font-weight: " + (this.settings.get_boolean("font-bold") ? "bold" : "normal") + "; border: " + this.settings.get_int("border-spacing-px") + "px solid transparent;"); + if (this.lightOrDark()) { + moveHandle.add_style_class_name("inverted"); + } else { + moveHandle.add_style_class_name("regular"); + } - decideMod(i, mBtn) { - if (i.code == 29 || i.code == 56 || i.code == 97 || i.code == 125) { - this.setNormMod(mBtn); - } else if (i.code == 100) { - this.setAlt(mBtn); - } else if (i.code == 42 || i.code == 54) { - this.setShift(mBtn); - } else if (i.code == 58 || i.code == 69) { - this.sendKey([mBtn.char.code]); - } else { - this.mod.push(i.code); - this.sendKey(this.mod); - this.mod = []; - this.modBtns.forEach(button => { - button.remove_style_class_name("selected"); - }); - this.shiftButtons.forEach(i => { i.remove_style_class_name("selected") }) - this.resetAllMod(); - this.modBtns = []; - } - } + moveHandle.connect("event", (actor, event) => { + if (event.type() == Clutter.EventType.BUTTON_PRESS || event.type() == Clutter.EventType.TOUCH_BEGIN) { + this.draggable = this.settings.get_boolean("enable-drag"); + } + this.event(event, false) + }) + grid.attach(moveHandle, 2 * topBtnWidth, 0, (rowSize - 4 * topBtnWidth), 3) // [insert handwriting 11] + grid.attach(new St.Widget({ x_expand: true, y_expand: true }), 0, 3, rowSize, 1) + } - setCapsLock(button, state) { - if (state) { - button.add_style_class_name("selected"); - this.capsL = true; - } else { - button.remove_style_class_name("selected"); - this.capsL = false; - } - this.updateKeyLabels(); - } + this.keys.forEach(item => { + item.set_style("font-size: " + this.settings.get_int("font-size-px") + "px; border-radius: " + (this.settings.get_boolean("round-key-corners") ? (this.settings.get_int("border-spacing-px") + 5) + "px;" : "0;") + "background-size: " + this.settings.get_int("font-size-px") + "px; font-weight: " + (this.settings.get_boolean("font-bold") ? "bold" : "normal") + "; border: " + this.settings.get_int("border-spacing-px") + "px solid transparent;"); + if (this.lightOrDark()) { + item.add_style_class_name("inverted"); + } else { + item.add_style_class_name("regular"); + } + item.set_pivot_point(0.5, 0.5) + item.connect("destroy", () => { + 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.tap_pressed !== null) { + clearTimeout(item.tap_pressed) + item.tap_pressed == null + } + if (item.tap_repeat !== null) { + clearInterval(item.tap_repeat) + item.tap_repeat == null + } + }) + let pressEv = (evType) => { + this.box.set_child_at_index(item, this.box.get_children().length - 1); + 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) + } + 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) - setNumLock(button, state) { - if (state) { - button.add_style_class_name("selected"); - this.numsL = true; - } else { - button.remove_style_class_name("selected"); - this.numsL = false; - } - this.updateKeyLabels(); - } + for (var i of oldModBtns) { + this.decideMod(i.char, i) + } + }, 100); + }, 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, + duration: 100, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + onComplete: () => { item.set_scale(1, 1); } + }) + 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; + } 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) { + pressEv("touch") + } else if (Clutter.get_current_event().type() == Clutter.EventType.TOUCH_END || Clutter.get_current_event().type() == Clutter.EventType.TOUCH_CANCEL) { + releaseEv() + } + }) + }); + } - setAlt(button) { - this.alt = !this.alt; - this.updateKeyLabels(); - if (!this.alt) { - this.sendKey([button.char.code]); - } - this.setNormMod(button); - } + lightOrDark() { + let r, g, b; + if (this.settings.get_boolean("system-accent-col")) { + return this.settings.scheme != "-dark" + } else { + r = this.settings.get_double("background-r" + this.settings.scheme); + g = this.settings.get_double("background-g" + this.settings.scheme); + b = this.settings.get_double("background-b" + this.settings.scheme); + } + var hsp; + hsp = Math.sqrt( + 0.299 * (r * r) + + 0.587 * (g * g) + + 0.114 * (b * b) + ); + return hsp > 127.5 + } + releaseAllKeys() { + let instances = []; - setShift(button) { - this.shift = !this.shift; - this.updateKeyLabels(); - if (!this.shift) { - this.sendKey([button.char.code]); - this.shiftButtons.forEach(i => { i.remove_style_class_name("selected") }) - } else { - this.shiftButtons.forEach(i => { i.add_style_class_name("selected") }) - } - this.setNormMod(button); - } + 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]); + } + } + } + } - updateKeyLabels() { - this.keys.forEach(key => { - if (key.char != undefined) { - let layer = (this.alt ? 'alt' : '') + (this.shift ? 'shift' : '') + (this.numsL ? 'num' : '') + (this.capsL ? 'caps' : '') + (this.numsL || this.capsL ? 'lock' : '') - if (layer == '') layer = 'default' - key.label = key.char.layers[layer]; - } - }); - } + 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++) { + this.inputDevice.notify_key(Clutter.get_current_event_time(), keys[i], Clutter.KeyState.PRESSED); + } + if (this.keyTimeout !== null) { + clearTimeout(this.keyTimeout); + this.keyTimeout = null; + } + this.keyTimeout = setTimeout(() => { + for (var j = keys.length - 1; j >= 0; j--) { + this.inputDevice.notify_key(Clutter.get_current_event_time(), keys[j], Clutter.KeyState.RELEASED); + } + }, 100); + } catch (err) { + throw new Error("GJS-OSK: An unknown error occured. Please report this bug to the Issues page (https://github.com/Vishram1123/gjs-osk/issues):\n\n" + err + "\n\nKeys Pressed: " + keys); + } + } + + decideMod(i, mBtn) { + if (i.code == 29 || i.code == 56 || i.code == 97 || i.code == 125) { + this.setNormMod(mBtn); + } else if (i.code == 100) { + this.setAlt(mBtn); + } else if (i.code == 42 || i.code == 54) { + this.setShift(mBtn); + } else if (i.code == 58 || i.code == 69) { + this.sendKey([mBtn.char.code]); + } else { + this.mod.push(i.code); + this.sendKey(this.mod); + this.mod = []; + this.modBtns.forEach(button => { + button.remove_style_class_name("selected"); + }); + this.shiftButtons.forEach(i => { i.remove_style_class_name("selected") }) + this.resetAllMod(); + this.modBtns = []; + } + } + + setCapsLock(button, state) { + if (state) { + button.add_style_class_name("selected"); + this.capsL = true; + } else { + button.remove_style_class_name("selected"); + this.capsL = false; + } + this.updateKeyLabels(); + } + + setNumLock(button, state) { + if (state) { + button.add_style_class_name("selected"); + this.numsL = true; + } else { + button.remove_style_class_name("selected"); + this.numsL = false; + } + this.updateKeyLabels(); + } + + setAlt(button) { + this.alt = !this.alt; + this.updateKeyLabels(); + if (!this.alt) { + this.sendKey([button.char.code]); + } + this.setNormMod(button); + } + + setShift(button) { + this.shift = !this.shift; + this.updateKeyLabels(); + if (!this.shift) { + this.sendKey([button.char.code]); + this.shiftButtons.forEach(i => { i.remove_style_class_name("selected") }) + } else { + this.shiftButtons.forEach(i => { i.add_style_class_name("selected") }) + } + this.setNormMod(button); + } + + updateKeyLabels() { + this.keys.forEach(key => { + if (key.char != undefined) { + let layer = (this.alt ? 'alt' : '') + (this.shift ? 'shift' : '') + (this.numsL ? 'num' : '') + (this.capsL ? 'caps' : '') + (this.numsL || this.capsL ? 'lock' : '') + if (layer == '') layer = 'default' + key.label = key.char.layers[layer]; + } + }); + } - setNormMod(button) { - if (this.mod.includes(button.char.code)) { - this.mod.splice(this.mod.indexOf(button.char.code), this.mod.indexOf(button.char.code) + 1); - if (!(button.char.code == 42) && !(button.char.code == 54)) - button.remove_style_class_name("selected"); - this.modBtns.splice(this.modBtns.indexOf(button), this.modBtns.indexOf(button) + 1); - this.sendKey([button.char.code]); - } else { - if (!(button.char.code == 42) && !(button.char.code == 54)) - button.add_style_class_name("selected"); - this.mod.push(button.char.code); - this.modBtns.push(button); - } - } + setNormMod(button) { + if (this.mod.includes(button.char.code)) { + this.mod.splice(this.mod.indexOf(button.char.code), this.mod.indexOf(button.char.code) + 1); + if (!(button.char.code == 42) && !(button.char.code == 54)) + button.remove_style_class_name("selected"); + this.modBtns.splice(this.modBtns.indexOf(button), this.modBtns.indexOf(button) + 1); + this.inputDevice.notify_key(Clutter.get_current_event_time(), button.char.code, Clutter.KeyState.RELEASED); + } else { + if (!(button.char.code == 42) && !(button.char.code == 54)) + button.add_style_class_name("selected"); + this.mod.push(button.char.code); + this.modBtns.push(button); + this.inputDevice.notify_key(Clutter.get_current_event_time(), button.char.code, Clutter.KeyState.PRESSED); + } + } - resetAllMod() { - this.shift = false; - this.alt = false; - this.updateKeyLabels() - } + resetAllMod() { + this.shift = false; + this.alt = false; + this.updateKeyLabels() + } } diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/metadata.json b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/metadata.json index a5974b2..419a6f1 100644 --- a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/metadata.json @@ -1,15 +1,15 @@ { - "_generated": "Generated by SweetTooth, do not edit", - "description": "A new Onscreen Keyboard built using GNOME JS", - "gettext-domain": "gjsosk@vishram1123.com", - "name": "GJS OSK", - "settings-schema": "org.gnome.shell.extensions.gjsosk", - "shell-version": [ - "45", - "46", - "47" - ], - "url": "https://github.com/Vishram1123/gjs-osk", - "uuid": "gjsosk@vishram1123.com", - "version": 27 + "description": "A new Onscreen Keyboard built using GNOME JS", + "gettext-domain": "gjsosk@vishram1123.com", + "name": "GJS OSK", + "settings-schema": "org.gnome.shell.extensions.gjsosk", + "shell-version": [ + "45", + "46", + "47", + "48" + ], + "url": "https://github.com/Vishram1123/gjs-osk", + "uuid": "gjsosk@vishram1123.com", + "version": 100000 } diff --git a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/physicalLayouts.json b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/physicalLayouts.json index 17407d3..368bffe 100644 --- a/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/physicalLayouts.json +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/physicalLayouts.json @@ -69,5 +69,23 @@ [{"key":"CAPS", "width":2}, {"key":"AC01"}, {"key":"AC02"}, {"key":"AC03"}, {"key":"AC04"}, {"key":"AC05"}, {"split":true}, {"key":"AC06"}, {"key":"AC07"}, {"key":"AC08"}, {"key":"AC09"}, {"key":"AC10"}, {"key":"AC11"}, {"key": "RTRN", "width": 1.5}], [{"key":"LFSH", "width":2}, {"key":"LSGT"}, {"key":"AB01"}, {"key":"AB02"}, {"key":"AB03"}, {"key":"AB04"}, {"split":true}, {"key":"AB05"}, {"key":"AB06"}, {"key":"AB07"}, {"key":"AB08"}, {"key":"AB09"}, {"key":"AB10"}, {"key":"RTSH", "width": 1.5}], [{"key":"LCTL"}, {"key":"LWIN"}, {"key":"LALT"}, {"key":"SPCE", "width":4}, {"split":true}, {"key":"SPCE", "width":2.5}, {"key":"RALT"}, {"key":"RCTL"}, {"key":"LEFT"}, [{"key":"UP", "height": 0.5}, {"key":"DOWN", "height": 0.5}], {"key":"RGHT"}] + ], + + "Mobile": [ + [{"key":"TLDE", "width": 2}, {"key":"TAB", "width": 2}, {"key":"ESC", "width": 2}, {"key":"FK01", "width": 2}, {"key":"FK02", "width": 2}, {"key":"FK03", "width": 2}, {"key":"FK04", "width": 2}, {"key":"FK05", "width": 2}, {"key":"FK06", "width": 2}, {"key":"FK07", "width": 2}, {"key":"FK08", "width": 2}, {"key":"FK09", "width": 2}, {"key":"FK10", "width": 2}, {"key":"FK11", "width": 2}, {"key":"FK12", "width": 2}, {"key":"PRSC", "width": 2}, {"key":"DELE", "width": 2}, {"key":"BKSL", "width": 2}], + [{"key":"AE11", "width": 3}, {"key":"AE01", "width": 3}, {"key":"AE02", "width": 3}, {"key":"AE03", "width": 3}, {"key":"AE04", "width": 3}, {"key":"AE05", "width": 3}, {"key":"AE06", "width": 3}, {"key":"AE07", "width": 3}, {"key":"AE08", "width": 3}, {"key":"AE09", "width": 3}, {"key":"AE10", "width": 3}, {"key":"AE12", "width": 3}], + [{"key":"AD11", "width": 3}, {"key":"AD01", "width": 3}, {"key":"AD02", "width": 3}, {"key":"AD03", "width": 3}, {"key":"AD04", "width": 3}, {"key":"AD05", "width": 3}, {"key":"AD06", "width": 3}, {"key":"AD07", "width": 3}, {"key":"AD08", "width": 3}, {"key":"AD09", "width": 3}, {"key":"AD10", "width": 3}, {"key":"AD12", "width": 3}], + [{"width": 1.5}, {"key":"AC10", "width": 3}, {"key":"AC01", "width": 3}, {"key":"AC02", "width": 3}, {"key":"AC03", "width": 3}, {"key":"AC04", "width": 3}, {"key":"AC05", "width": 3}, {"key":"AC06", "width": 3}, {"key":"AC07", "width": 3}, {"key":"AC08", "width": 3}, {"key":"AC09", "width": 3}, {"key":"AC11", "width": 3}], + [{"key":"LFSH", "width": 2.5}, {"key":"LSGT", "width": 2}, {"key":"AB08", "width": 3}, {"key":"AB01", "width": 3}, {"key":"AB02", "width": 3}, {"key":"AB03", "width": 3}, {"key":"AB04", "width": 3}, {"key":"AB05", "width": 3}, {"key":"AB06", "width": 3}, {"key":"AB07", "width": 3}, {"key":"AB09", "width": 3}, {"key":"AB10", "width": 2}, {"key": "BKSP", "width": 2.5}], + [{"key":"CAPS", "width": 2.5}, {"key":"LCTL", "width": 2.5}, {"key":"LWIN", "width": 2.5}, {"key":"LALT", "width": 2.5}, {"key":"SPCE", "width":10}, {"key":"RALT", "width": 2.5}, {"key":"RCTL", "width": 2.5}, {"key":"LEFT", "width": 2.5}, [{"key":"UP", "width": 2.5, "height": 0.5}, {"key":"DOWN", "width": 2.5, "height": 0.5}], {"key":"RGHT", "width": 2.5}, {"key":"RTRN", "width": 3.5}] + ], + + "Split Mobile": [ + [{"key":"TLDE", "width": 2}, {"key":"TAB", "width": 2}, {"key":"ESC", "width": 2}, {"key":"FK01", "width": 2}, {"key":"FK02", "width": 2}, {"key":"FK03", "width": 2}, {"key":"FK04", "width": 2}, {"key":"FK05", "width": 2}, {"key":"FK06", "width": 2}, {"split":true}, {"key":"FK07", "width": 2}, {"key":"FK08", "width": 2}, {"key":"FK09", "width": 2}, {"key":"FK10", "width": 2}, {"key":"FK11", "width": 2}, {"key":"FK12", "width": 2}, {"key":"PRSC", "width": 2}, {"key":"DELE", "width": 3}, {"key":"BKSL", "width": 2.5}], + [{"key":"AE11", "width": 3}, {"key":"AE01", "width": 3}, {"key":"AE02", "width": 3}, {"key":"AE03", "width": 3}, {"key":"AE04", "width": 3}, {"key":"AE05", "width": 3}, {"split":true}, {"key":"AE06", "width": 3}, {"key":"AE07", "width": 3}, {"key":"AE08", "width": 3}, {"key":"AE09", "width": 3}, {"key":"AE10", "width": 3}, {"key":"AE12", "width": 4.5}], + [{"key":"AD11", "width": 3}, {"key":"AD01", "width": 3}, {"key":"AD02", "width": 3}, {"key":"AD03", "width": 3}, {"key":"AD04", "width": 3}, {"key":"AD05", "width": 3}, {"split":true}, {"key":"AD06", "width": 3}, {"key":"AD07", "width": 3}, {"key":"AD08", "width": 3}, {"key":"AD09", "width": 3}, {"key":"AD10", "width": 3}, {"key":"AD12", "width": 4.5}], + [{"key":"AC10", "width": 3}, {"key":"AC01", "width": 3}, {"key":"AC02", "width": 3}, {"key":"AC03", "width": 3}, {"key":"AC04", "width": 3}, {"key":"AC05", "width": 3}, {"split":true}, {"key":"AC05", "width": 3}, {"key":"AC06", "width": 3}, {"key":"AC07", "width": 3}, {"key":"AC08", "width": 3}, {"key":"AC09", "width": 3}, {"key":"AC11", "width": 4.5}], + [{"key":"LFSH", "width": 2}, {"key":"LSGT", "width": 2}, {"key":"AB08", "width": 2}, {"key":"AB01", "width": 3}, {"key":"AB02", "width": 3}, {"key":"AB03", "width": 3}, {"key":"AB04", "width": 3}, {"split":true}, {"key":"AB04", "width": 3}, {"key":"AB05", "width": 3}, {"key":"AB06", "width": 3}, {"key":"AB07", "width": 3}, {"key":"AB09", "width": 3}, {"key":"AB10", "width": 2}, {"key": "BKSP", "width": 2.5}], + [{"key":"CAPS", "width": 2.5}, {"key":"LCTL", "width": 2.5}, {"key":"LWIN", "width": 2.5}, {"key":"LALT", "width": 2.5}, {"key":"SPCE", "width":8}, {"split":true}, {"key":"SPCE", "width":4}, {"key":"RALT", "width": 2.5}, {"key":"RCTL", "width": 2.5}, {"key":"LEFT", "width": 2.5}, [{"key":"UP", "width": 2.5, "height": 0.5}, {"key":"DOWN", "width": 2.5, "height": 0.5}], {"key":"RGHT", "width": 2.5}, {"key":"RTRN", "width": 3}] ] } \ No newline at end of file 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 92488da..d9a83ac 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 @@ -3,9 +3,11 @@ import Adw from 'gi://Adw'; import Gtk from 'gi://Gtk'; import Gdk from 'gi://Gdk'; +import GLib from 'gi://GLib'; import { ExtensionPreferences, gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; - +import * as Config from 'resource:///org/gnome/Shell/Extensions/js/misc/config.js' +const [major, minor] = Config.PACKAGE_VERSION.split('.').map(s => Number(s)); export default class GjsOskPreferences extends ExtensionPreferences { fillPreferencesWindow(window) { @@ -25,18 +27,41 @@ export default class GjsOskPreferences extends ExtensionPreferences { }); page1.add(behaviorGroup); - const layoutRow = new Adw.ActionRow({ + const layoutRow = new Adw.ExpanderRow({ title: _('Layout') }); behaviorGroup.add(layoutRow); - let layoutList = ["Full Sized International", "Full Sized US", "Tenkeyless International", "Tenkeyless US", "Compact International", "Compact US", "Split International", "Split US"]; - let layoutDrop = Gtk.DropDown.new_from_strings(layoutList); - layoutDrop.valign = Gtk.Align.CENTER; - layoutDrop.selected = settings.get_int("layout"); + const layoutLandscapeRow = new Adw.ActionRow({ + title: _('Landscape Layout') + }); + layoutRow.add_row(layoutLandscapeRow); - layoutRow.add_suffix(layoutDrop); - layoutRow.activatable_widget = layoutDrop; + let layouts; + let [okL, contentsL] = GLib.file_get_contents(this.path + '/physicalLayouts.json'); + if (okL) { + layouts = JSON.parse(contentsL); + } + + let layoutList = Object.keys(layouts); + let layoutLandscapeDrop = Gtk.DropDown.new_from_strings(layoutList); + layoutLandscapeDrop.valign = Gtk.Align.CENTER; + layoutLandscapeDrop.selected = settings.get_int("layout-landscape"); + + layoutLandscapeRow.add_suffix(layoutLandscapeDrop); + layoutLandscapeRow.activatable_widget = layoutLandscapeDrop; + + const layoutPortraitRow = new Adw.ActionRow({ + title: _('Portrait Layout') + }); + layoutRow.add_row(layoutPortraitRow); + + let layoutPortraitDrop = Gtk.DropDown.new_from_strings(layoutList); + layoutPortraitDrop.valign = Gtk.Align.CENTER; + layoutPortraitDrop.selected = settings.get_int("layout-portrait"); + + layoutPortraitRow.add_suffix(layoutPortraitDrop); + layoutPortraitRow.activatable_widget = layoutPortraitDrop; const enableDragRow = new Adw.ActionRow({ title: _('Enable Dragging') @@ -132,6 +157,49 @@ export default class GjsOskPreferences extends ExtensionPreferences { landscapeSizing.add_row(lW); landscapeSizing.add_row(lH); + const defaultMonitor = new Adw.ActionRow({ + title: _('Default Monitor') + }) + behaviorGroup.add(defaultMonitor); + + let monitors = []; + + const display = Gdk.Display.get_default(); + if (display && "get_monitors" in display) { + const monitorsAvailable = display.get_monitors(); + + for (let idx = 0; idx < monitorsAvailable.get_n_items(); idx++) { + const monitor = monitorsAvailable.get_item(idx); + monitors.push(monitor); + } + } + let monitorDrop = Gtk.DropDown.new_from_strings(monitors.map(m => m.get_model())) + monitorDrop.valign = Gtk.Align.CENTER; + let currentMonitorMap = {}; + let currentMonitors; + if (settings.get_string("default-monitor").includes(";")) { + currentMonitors = settings.get_string("default-monitor").split(";") + } else { + currentMonitors = [("1:" + monitors[0].get_connector())] + } + + for (var i of currentMonitors) { + let tmp = i.split(":"); + currentMonitorMap[tmp[0]] = tmp[1] + ""; + } + if (!Object.keys(currentMonitorMap).includes(monitors.length + "")) { + let allConfigs = Object.keys(currentMonitorMap).map(Number.parseInt).sort(); + currentMonitorMap[monitors.length + ""] = allConfigs[allConfigs.length - 1]; + } + let index = monitors.map(m => { return m.get_connector() }).indexOf(currentMonitorMap[monitors.length + ""]); + if (index == -1) { + index = 0 + } + monitorDrop.selected = index; + + defaultMonitor.add_suffix(monitorDrop); + defaultMonitor.activatable_widget = monitorDrop; + const defaultPosition = new Adw.ActionRow({ title: _('Default Position') }); @@ -203,6 +271,23 @@ export default class GjsOskPreferences extends ExtensionPreferences { darkCol.add_suffix(colorButton_d); darkCol.activatable_widget = colorButton_d; + const systemAccCol = new Adw.ActionRow({ + title: _("Use System Accent Color") + }) + colorRow.add_row(systemAccCol) + + const systemAccColEnabled = new Gtk.Switch({ + active: settings.get_boolean("system-accent-col"), + valign: Gtk.Align.CENTER + }) + + systemAccCol.add_suffix(systemAccColEnabled) + systemAccCol.activatable_widget = systemAccColEnabled + + systemAccCol.set_sensitive(major >= 47) + lightCol.set_sensitive(!settings.get_boolean("system-accent-col")); + darkCol.set_sensitive(!settings.get_boolean("system-accent-col")); + let fontSize = new Adw.ActionRow({ title: _('Font Size (px)') }); @@ -211,7 +296,7 @@ export default class GjsOskPreferences extends ExtensionPreferences { let numChanger_font = Gtk.SpinButton.new_with_range(0, 100, 1); numChanger_font.value = settings.get_int('font-size-px'); numChanger_font.valign = Gtk.Align.CENTER; - + fontSize.add_suffix(numChanger_font); fontSize.activatable_widget = numChanger_font; @@ -239,6 +324,17 @@ export default class GjsOskPreferences extends ExtensionPreferences { borderSpacing.add_suffix(numChanger_bord); borderSpacing.activatable_widget = numChanger_bord; + let outerSpacing = new Adw.ActionRow({ + title: _('Outer Spacing (px)') + }); + appearanceGroup.add(outerSpacing); + + let numChanger_outer = Gtk.SpinButton.new_with_range(0, 30, 1); + numChanger_outer.value = settings.get_int('outer-spacing-px'); + numChanger_outer.valign = Gtk.Align.CENTER; + outerSpacing.add_suffix(numChanger_outer); + outerSpacing.activatable_widget = numChanger_outer; + let snapSpacing = new Adw.ActionRow({ title: _('Drag snap spacing (px)') }); @@ -309,7 +405,7 @@ export default class GjsOskPreferences extends ExtensionPreferences { context.add_class("title-1"); let another_label = new Gtk.Label({ - label: _("Autorelease ") + `fab8e97` + label: _("Autorelease ") + `776e35f` }); let links_pref_group = new Adw.PreferencesGroup(); @@ -348,8 +444,9 @@ export default class GjsOskPreferences extends ExtensionPreferences { page2.add(links_pref_group); window.add(page2); - - settings.bind("layout", layoutDrop, "selected", 0); + + settings.bind("layout-landscape", layoutLandscapeDrop, "selected", 0); + settings.bind("layout-portrait", layoutPortraitDrop, "selected", 0); settings.bind("enable-drag", dragEnableDT, "active", 0); settings.bind("enable-tap-gesture", dragOpt, "selected", 0); settings.bind("indicator-enabled", indEnabled, "active", 0); @@ -372,14 +469,29 @@ export default class GjsOskPreferences extends ExtensionPreferences { settings.bind("font-size-px", numChanger_font, "value", 0); settings.bind("font-bold", fontBoldEnabled, "active", 0) settings.bind("border-spacing-px", numChanger_bord, "value", 0); + settings.bind("outer-spacing-px", numChanger_outer, "value", 0); settings.bind("snap-spacing-px", numChanger_snap, "value", 0) settings.bind("round-key-corners", roundKeyCDT, "active", 0); settings.bind("play-sound", soundPlayDT, "active", 0); settings.bind("show-icons", showIconDT, "active", 0) settings.bind("default-snap", snapDrop, "selected", 0); + monitorDrop.connect("notify::selected", () => { + currentMonitorMap[monitors.length + ""] = monitors.map(m => { return m.get_connector() })[monitorDrop.selected]; + let representation = []; + for (var k of Object.keys(currentMonitorMap)) { + representation.push(k + ":" + currentMonitorMap[k]) + } + settings.set_string("default-monitor", representation.join(";")) + }) + systemAccColEnabled.connect("state-set", () => { + settings.set_boolean("system-accent-col", systemAccColEnabled.active) + lightCol.set_sensitive(!settings.get_boolean("system-accent-col")); + darkCol.set_sensitive(!settings.get_boolean("system-accent-col")); + }) window.connect("close-request", () => { - settings.set_int("layout", layoutDrop.selected); + settings.set_int("layout-landscape", layoutLandscapeDrop.selected); + settings.set_int("layout-portrait", layoutPortraitDrop.selected); settings.set_boolean("enable-drag", dragEnableDT.active); settings.set_int("enable-tap-gesture", dragOpt.selected); settings.set_boolean("indicator-enabled", indEnabled.active); @@ -398,11 +510,19 @@ export default class GjsOskPreferences extends ExtensionPreferences { settings.set_int("font-size-px", numChanger_font.value); settings.set_boolean("font-bold", fontBoldEnabled.active) settings.set_int("border-spacing-px", numChanger_bord.value); + settings.set_int("outer-spacing-px", numChanger_outer.value); settings.set_int("snap-spacing-px", numChanger_snap.value) settings.set_boolean("round-key-corners", roundKeyCDT.active); settings.set_boolean("play-sound", soundPlayDT.active); settings.set_boolean("show-icons", showIconDT.active) settings.set_int("default-snap", snapDrop.selected); + currentMonitorMap[monitors.length + ""] = monitors.map(m => { return m.get_connector() })[monitorDrop.selected]; + let representation = []; + for (var k of Object.keys(currentMonitorMap)) { + representation.push(k + ":" + currentMonitorMap[k]) + } + settings.set_string("default-monitor", representation.join(";")) + settings.set_boolean("system-accent-col", systemAccColEnabled.active) }) } }; 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 ac9dcce..6b8f5b6 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 c960c22..d2ef8de 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 @@ -1,7 +1,10 @@ - + + 0 + + 0 @@ -43,6 +46,9 @@ 1 + + false + 14 @@ -52,6 +58,9 @@ 2 + + 20 + 25 @@ -61,6 +70,9 @@ 7 + + "" + 1 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 1c2e987..f4e201c 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,11 +1,13 @@ .regular:pressed { background-color: rgba(255, 255, 255, 0.2); color: white; + border: 0; } .inverted:pressed { background-color: rgba(0, 0, 0, 0.2); color: black; + border: 0; } .regular { @@ -17,12 +19,16 @@ background-color: rgba(0, 0, 0, 0.05); color: black; } -.key, .moveHandle { - border: 0; + +.key, +.moveHandle { padding: 0; margin: 0; background-clip: padding-box; box-sizing: border-box; + background-image: url(ui/icons/hicolor/scalable/actions/transparent.svg); + background-repeat: no-repeat; + background-position: center; } .dr-b { @@ -34,6 +40,7 @@ .close_btn, .settings_btn, +/* [insert styles handwriting 1] */ .backspace_btn, .tab_btn, .capslock_btn, @@ -51,11 +58,13 @@ background-position: center; } -.close_btn.regular, .close_btn.selected.inverted { +.close_btn.regular, +.close_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/close.svg); } -.close_btn.inverted, .close_btn.selected.regular { +.close_btn.inverted, +.close_btn.selected.regular { background-image: url(ui/icons/hicolor/scalable/actions/close-dark.svg); } @@ -67,107 +76,135 @@ background-image: url(ui/icons/hicolor/scalable/actions/settings-dark.svg); } -.backspace_btn.regular, .backspace_btn.selected.inverted { +/* [insert styles handwriting 2] */ + +.backspace_btn.regular, +.backspace_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/backspace.svg); } -.backspace_btn.inverted, .backspace_btn.selected.regular { +.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 { +.tab_btn.regular, +.tab_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/tab.svg); } -.tab_btn.inverted, .tab_btn.selected.regular { +.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 { +.capslock_btn.regular, +.capslock_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/capslock.svg); } -.capslock_btn.inverted, .capslock_btn.selected.regular { +.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 { +.shift_btn.regular, +.shift_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/shift.svg); } -.shift_btn.inverted, .shift_btn.selected.regular { +.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 { +.enter_btn.regular, +.enter_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/enter.svg); } -.enter_btn.inverted, .enter_btn.selected.regular { +.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 { +.ctrl_btn.regular, +.ctrl_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/ctrl.svg); } -.ctrl_btn.inverted, .ctrl_btn.selected.regular { +.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 { +.super_btn.regular, +.super_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/super.svg); } -.super_btn.inverted, .super_btn.selected.regular { +.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 { +.alt_btn.regular, +.alt_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/alt.svg); } -.alt_btn.inverted, .alt_btn.selected.regular { +.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 { +.space_btn.regular, +.space_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/space.svg); } -.space_btn.inverted, .space_btn.selected.regular { +.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 { +.left_btn.regular, +.left_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/left.svg); } -.left_btn.inverted, .left_btn.selected.regular { +.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 { +.up_btn.regular, +.up_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/up.svg); } -.up_btn.inverted, .up_btn.selected.regular { +.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 { +.down_btn.regular, +.down_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/down.svg); } -.down_btn.inverted, .down_btn.selected.regular { +.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 { +.right_btn.regular, +.right_btn.selected.inverted { background-image: url(ui/icons/hicolor/scalable/actions/right.svg); } -.right_btn.inverted, .right_btn.selected.regular { +.right_btn.inverted, +.right_btn.selected.regular { background-image: url(ui/icons/hicolor/scalable/actions/right-dark.svg); } @@ -196,6 +233,5 @@ } .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/transparent.svg b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/transparent.svg new file mode 100644 index 0000000..f5a8c32 --- /dev/null +++ b/gnome/.local/share/gnome-shell/extensions/gjsosk@vishram1123.com/ui/icons/hicolor/scalable/actions/transparent.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 ae3aa53..ace7500 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 @@ -3,13 +3,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later export default { - PACKAGE_VERSION: 58, + PACKAGE_VERSION: 62, PACKAGE_URL: 'https://github.com/GSConnect/gnome-shell-extension-gsconnect', PACKAGE_BUGREPORT: 'https://github.com/GSConnect/gnome-shell-extension-gsconnect/issues/new', PACKAGE_DATADIR: '/usr/local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io', PACKAGE_LOCALEDIR: '/usr/local/share/locale', GSETTINGS_SCHEMA_DIR: '/usr/local/share/glib-2.0/schemas', - GNOME_SHELL_LIBDIR: '/usr/local/lib64', + GNOME_SHELL_LIBDIR: '/usr/local/lib/x86_64-linux-gnu', APP_ID: 'org.gnome.Shell.Extensions.GSConnect', APP_PATH: '/org/gnome/Shell/Extensions/GSConnect', diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/extension.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/extension.js index 9d960ac..b82a975 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/extension.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/extension.js @@ -22,9 +22,8 @@ import * as Device from './shell/device.js'; import * as Keybindings from './shell/keybindings.js'; import * as Notification from './shell/notification.js'; import * as Input from './shell/input.js'; -import * as Utils from './shell/utils.js'; import * as Remote from './utils/remote.js'; -import setup from './utils/setup.js'; +import * as Setup from './utils/setup.js'; const QuickSettingsMenu = Main.panel.statusArea.quickSettings; @@ -358,7 +357,7 @@ export default class GSConnectExtension extends Extension { constructor(metadata) { super(metadata); - setup(this.path); + Setup.setup(this.path); // If installed as a user extension, this checks the permissions // on certain critical files in the extension directory @@ -366,13 +365,13 @@ export default class GSConnectExtension extends Extension { // and makes them executable if not. Some packaging methods // (particularly GitHub Actions artifacts) automatically remove // executable bits from all contents, presumably for security. - Utils.ensurePermissions(); + Setup.ensurePermissions(); // If installed as a user extension, this will install the Desktop entry, // DBus and systemd service files necessary for DBus activation and // GNotifications. Since there's no uninit()/uninstall() hook for extensions // and they're only used *by* GSConnect, they should be okay to leave. - Utils.installService(); + Setup.installService(); // These modify the notification source for GSConnect's GNotifications and // need to be active even when the extension is disabled (eg. lock screen). diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ar/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ar/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index e286cbe..9f8f9b5 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ar/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ar/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/be/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/be/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 5e783fb..2c1005a 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/be/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/be/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/bg/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/bg/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo new file mode 100644 index 0000000..c05fed9 Binary files /dev/null and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/bg/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ca/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ca/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index cfb8988..d8c02e0 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ca/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ca/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/cs/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/cs/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 281c757..5ed7092 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/cs/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/cs/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/da/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/da/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 3fcc2a5..ca0461c 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/da/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/da/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/de/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/de/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 9ae0677..f58f461 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/de/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/de/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/es/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/es/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index a2fa920..2a70df8 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/es/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/es/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/et/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/et/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index e8ec924..2bda121 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/et/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/et/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fa/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fa/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index d792ee9..88b9784 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fa/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fa/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fi/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fi/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 1ecfc38..0347e6e 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fi/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fi/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 80b6edb..c63401b 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fy/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fy/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 7b7cc55..a67e1a3 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fy/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/fy/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/gl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/gl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index a26f6b6..33fb285 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/gl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/gl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ 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 index 6643a6a..10497da 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/he/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo 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/locale/hu/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/hu/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 783cc39..00f8dd3 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/hu/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/hu/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/id/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/id/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 15e8fa0..0c6161a 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/id/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/id/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/it/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/it/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 499500d..a3cee3d 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/it/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/it/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ko/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ko/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 973a851..89f118b 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ko/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ko/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/lt/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/lt/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 4188c8a..6a114a0 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/lt/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/lt/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/nl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/nl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index e01ae54..1a28914 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/nl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/nl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 73ed9e2..200c8e7 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pl/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pt/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pt/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 8aa6137..1ca99b5 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pt/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pt/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pt_BR/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pt_BR/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 86e64f2..5f764ab 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pt_BR/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/pt_BR/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ru/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ru/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index d504fad..6c7977d 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ru/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/ru/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sk/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sk/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index f6831f5..061cb91 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sk/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sk/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index a2a03e4..4ef2ec0 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sr@latin/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sr@latin/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index ddb718c..0890f5d 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sr@latin/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sr@latin/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sv/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sv/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index d17330c..cda989f 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sv/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/sv/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/tr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/tr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index a54b158..3851814 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/tr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/tr/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/uk/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/uk/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index a47d1e6..ca9ea4d 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/uk/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/uk/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/zh_CN/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/zh_CN/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index 284c930..75b509d 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/zh_CN/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/zh_CN/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo differ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/zh_TW/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/zh_TW/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo index f47aad6..80d15b8 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/zh_TW/LC_MESSAGES/org.gnome.Shell.Extensions.GSConnect.mo and b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/locale/zh_TW/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 16a0772..4823ba4 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 @@ -4,9 +4,10 @@ "name": "GSConnect", "shell-version": [ "46", - "47" + "47", + "48" ], "url": "https://github.com/GSConnect/gnome-shell-extension-gsconnect/wiki", "uuid": "gsconnect@andyholmes.github.io", - "version": 58 + "version": 62 } \ No newline at end of file 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 f4f8a05..33c5344 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/preferences/device.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/device.js index 76fc0c7..e8d30a8 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/device.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/device.js @@ -60,7 +60,7 @@ export function rowSeparators(row, before) { * * @param {Gtk.ListBoxRow} row1 - The first row * @param {Gtk.ListBoxRow} row2 - The second row - * @return {number} -1, 0 or 1 + * @returns {number} -1, 0 or 1 */ export function titleSortFunc(row1, row2) { if (!row1.title || !row2.title) @@ -605,7 +605,7 @@ export const Panel = GObject.registerClass({ const isPresent = value.get_boolean(); resolve(isPresent); - } catch (e) { + } catch { resolve(false); } } @@ -614,7 +614,7 @@ export const Panel = GObject.registerClass({ this.battery_system_label.visible = hasBattery; this.battery_system.visible = hasBattery; - } catch (e) { + } catch { this.battery_system_label.visible = false; this.battery_system.visible = false; } @@ -814,7 +814,7 @@ export const Panel = GObject.registerClass({ try { applications = JSON.parse(settings.get_string('applications')); - } catch (e) { + } catch { applications = {}; } @@ -858,7 +858,7 @@ export const Panel = GObject.registerClass({ try { applications = JSON.parse(settings.get_string('applications')); - } catch (e) { + } catch { applications = {}; } diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/init.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/init.js index 038f60e..7507628 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/init.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/init.js @@ -4,7 +4,7 @@ import GLib from 'gi://GLib'; -import setup, {setupGettext} from '../utils/setup.js'; +import {setup, setupGettext} from '../utils/setup.js'; // Bootstrap diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/keybindings.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/keybindings.js index be80dfe..b95bafd 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/keybindings.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/keybindings.js @@ -205,7 +205,7 @@ export const ShortcutChooserDialog = GObject.registerClass({ * @param {string} accelerator - An accelerator * @param {number} [modeFlags] - Mode Flags * @param {number} [grabFlags] - Grab Flags - * @param {boolean} %true if available, %false on error or unavailable + * @returns {boolean} %true if available, %false on error or unavailable */ export async function checkAccelerator(accelerator, modeFlags = 0, grabFlags = 0) { try { @@ -272,7 +272,7 @@ export async function checkAccelerator(accelerator, modeFlags = 0, grabFlags = 0 * * @param {string} summary - A description of the keybinding's function * @param {string} accelerator - An accelerator as taken by Gtk.ShortcutLabel - * @return {string} An accelerator or %null if it should be unset. + * @returns {string} An accelerator or %null if it should be unset. */ export async function getAccelerator(summary, accelerator = null) { try { @@ -311,4 +311,3 @@ export async function getAccelerator(summary, accelerator = null) { return accelerator; } } - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/service.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/service.js index e258f22..9f571fb 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/service.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/service.js @@ -422,6 +422,28 @@ export const Window = GObject.registerClass({ dialog.show_all(); } + _validateName(name) { + // None of the forbidden characters and at least one non-whitespace + if (name.trim() && /^[^"',;:.!?()[\]<>]{1,32}$/.test(name)) + return true; + + const dialog = new Gtk.MessageDialog({ + text: _('Invalid Device Name'), + // TRANSLATOR: %s is a list of forbidden characters + secondary_text: _('Device name must not contain any of %s ' + + 'and have a length of 1-32 characters') + .format('^"\',;:.!?()[]<>'), + secondary_use_markup: true, + buttons: Gtk.ButtonsType.OK, + modal: true, + transient_for: this, + }); + dialog.connect('response', (dialog) => dialog.destroy()); + dialog.show_all(); + + return false; + } + /* * "Help" GAction */ @@ -456,7 +478,7 @@ export const Window = GObject.registerClass({ } _onSetServiceName(widget) { - if (this.rename_entry.text.length) { + if (this._validateName(this.rename_entry.text)) { this.headerbar.title = this.rename_entry.text; this.settings.set_string('name', this.rename_entry.text); } diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/prefs.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/prefs.js index 4a94ca7..7937bab 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/prefs.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/prefs.js @@ -7,15 +7,15 @@ import GLib from 'gi://GLib'; import Adw from 'gi://Adw'; // Bootstrap -import * as Utils from './shell/utils.js'; -import setup from './utils/setup.js'; +import * as Setup from './utils/setup.js'; import {ExtensionPreferences} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; export default class GSConnectExtensionPreferences extends ExtensionPreferences { constructor(metadata) { super(metadata); - setup(this.path); - Utils.installService(); + Setup.setup(this.path); + Setup.ensurePermissions(); + Setup.installService(); } fillPreferencesWindow(window) { diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/backends/lan.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/backends/lan.js index 758e24b..5b8927e 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/backends/lan.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/backends/lan.js @@ -8,12 +8,13 @@ import GObject from 'gi://GObject'; import Config from '../../config.js'; import * as Core from '../core.js'; +import Device from '../device.js'; // Retain compatibility with GLib < 2.80, which lacks GioUnix let GioUnix; try { GioUnix = (await import('gi://GioUnix')).default; -} catch (e) { +} catch { GioUnix = { InputStream: Gio.UnixInputStream, OutputStream: Gio.UnixOutputStream, @@ -42,7 +43,7 @@ try { Gio.SocketType.STREAM, Gio.SocketProtocol.TCP ).get_option(6, 5); -} catch (e) { +} catch { _LINUX_SOCKETS = false; } @@ -148,6 +149,10 @@ export const ChannelService = GObject.registerClass({ return this._channels; } + get id() { + return this.certificate.common_name; + } + get port() { if (this._port === undefined) this._port = PROTOCOL_PORT_DEFAULT; @@ -172,13 +177,6 @@ export const ChannelService = GObject.registerClass({ } _initCertificate() { - if (GLib.find_program_in_path(Config.OPENSSL_PATH) === null) { - const error = new Error(); - error.name = _('OpenSSL not found'); - error.url = `${Config.PACKAGE_URL}/wiki/Error#openssl-not-found`; - throw error; - } - const certPath = GLib.build_filenamev([ Config.CONFIGDIR, 'certificate.pem', @@ -190,12 +188,7 @@ export const ChannelService = GObject.registerClass({ // Ensure a certificate exists with our id as the common name this._certificate = Gio.TlsCertificate.new_for_paths(certPath, keyPath, - this.id); - - // If the service ID doesn't match the common name, this is probably a - // certificate from an older version and we should amend ours to match - if (this.id !== this._certificate.common_name) - this._id = this._certificate.common_name; + null); } _initTcpListener() { @@ -282,7 +275,7 @@ export const ChannelService = GObject.registerClass({ this._udp6_source = this._udp6.create_source(GLib.IOCondition.IN, null); this._udp6_source.set_callback(this._onIncomingIdentity.bind(this, this._udp6)); this._udp6_source.attach(null); - } catch (e) { + } catch { this._udp6 = null; } @@ -360,13 +353,24 @@ export const ChannelService = GObject.registerClass({ async _onIdentity(packet) { try { // Bail if the deviceId is missing - if (!packet.body.hasOwnProperty('deviceId')) - return; + if (!this.identity.body.deviceId) + throw new Error('missing deviceId'); // Silently ignore our own broadcasts if (packet.body.deviceId === this.identity.body.deviceId) return; + // Reject invalid device IDs + if (!Device.validateId(packet.body.deviceId)) + throw new Error(`invalid deviceId "${packet.body.deviceId}"`); + + if (!packet.body.deviceName) + throw new Error('missing deviceName'); + + // Reject invalid device names + if (!Device.validateName(packet.body.deviceName)) + throw new Error(`invalid deviceName "${packet.body.deviceName}"`); + debug(packet); // Create a new channel @@ -596,7 +600,7 @@ export const Channel = GObject.registerClass({ * Authenticate a TLS connection. * * @param {Gio.TlsConnection} connection - A TLS connection - * @return {Promise} A promise for the operation + * @returns {Promise} A promise for the operation */ async _authenticate(connection) { // Standard TLS Handshake @@ -668,7 +672,7 @@ export const Channel = GObject.registerClass({ * Wrap the connection in Gio.TlsClientConnection and initiate handshake * * @param {Gio.TcpConnection} connection - The unauthenticated connection - * @return {Gio.TlsClientConnection} The authenticated connection + * @returns {Gio.TlsClientConnection} The authenticated connection */ _encryptClient(connection) { _configureSocket(connection); @@ -684,7 +688,7 @@ export const Channel = GObject.registerClass({ * Wrap the connection in Gio.TlsServerConnection and initiate handshake * * @param {Gio.TcpConnection} connection - The unauthenticated connection - * @return {Gio.TlsServerConnection} The authenticated connection + * @returns {Gio.TlsServerConnection} The authenticated connection */ _encryptServer(connection) { _configureSocket(connection); @@ -729,7 +733,25 @@ export const Channel = GObject.registerClass({ if (!this.identity.body.deviceId) throw new Error('missing deviceId'); + // Reject invalid device IDs + if (!Device.validateId(this.identity.body.deviceId)) + throw new Error(`invalid deviceId "${this.identity.body.deviceId}"`); + + if (!this.identity.body.deviceName) + throw new Error('missing deviceName'); + + // Reject invalid device names + if (!Device.validateName(this.identity.body.deviceName)) + throw new Error(`invalid deviceName "${this.identity.body.deviceName}"`); + this._connection = await this._encryptClient(connection); + + // Starting with protocol version 8, the devices are expected to + // exchange identity packets again after TLS negotiation + if (this.identity.body.protocolVersion >= 8) { + await this.sendPacket(this.backend.identity); + this.identity = await this.readPacket(); + } } catch (e) { this.close(); throw e; @@ -754,6 +776,13 @@ export const Channel = GObject.registerClass({ this.cancellable); this._connection = await this._encryptServer(connection); + + // Starting with protocol version 8, the devices are expected to + // exchange identity packets again after TLS negotiation + if (this.identity.body.protocolVersion >= 8) { + await this.sendPacket(this.backend.identity); + this.identity = await this.readPacket(); + } } catch (e) { this.close(); throw e; @@ -886,4 +915,3 @@ export const Channel = GObject.registerClass({ } } }); - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/atspi.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/atspi.js index 97581d7..f0abf88 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/atspi.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/atspi.js @@ -62,7 +62,7 @@ export default class Controller { modifier = keymap.get_entries_for_keyval(Gdk.KEY_Super_L)[1][0]; XKeycode.Super_L = modifier.keycode; - } catch (e) { + } catch { debug('using default modifier keycodes'); } } @@ -304,9 +304,8 @@ export default class Controller { destroy() { try { Atspi.exit(); - } catch (e) { + } catch { // Silence errors } } } - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/contacts.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/contacts.js index 3070f40..2ce5620 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/contacts.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/contacts.js @@ -17,7 +17,7 @@ try { EBook = (await import('gi://EBook')).default; EBookContacts = (await import('gi://EBookContacts')).default; EDataServer = (await import('gi://EDataServer')).default; -} catch (e) { +} catch { HAVE_EDS = false; } @@ -267,7 +267,7 @@ const Store = GObject.registerClass({ this._ebooks = new Map(); // Get the current EBooks - const registry = await this._getESourceRegistry(); + const registry = await EDataServer.SourceRegistry.new(null); for (const source of registry.list_sources('Address Book')) await this._onAppeared(null, source); @@ -329,7 +329,7 @@ const Store = GObject.registerClass({ * Save a Uint8Array to file and return the path * * @param {Uint8Array} contents - An image byte array - * @return {string|undefined} File path or %undefined on failure + * @returns {string|undefined} File path or %undefined on failure */ async storeAvatar(contents) { const md5 = GLib.compute_checksum_for_data(GLib.ChecksumType.MD5, @@ -353,10 +353,10 @@ const Store = GObject.registerClass({ /** * Query the Store for a contact by name and/or number. * - * @param {Object} query - A query object + * @param {object} query - A query object * @param {string} [query.name] - The contact's name * @param {string} query.number - The contact's number - * @return {Object} A contact object + * @returns {object} A contact object */ query(query) { // First look for an existing contact by number @@ -410,7 +410,7 @@ const Store = GObject.registerClass({ /** * Add a contact, checking for validity * - * @param {Object} contact - A contact object + * @param {object} contact - A contact object * @param {boolean} write - Write to disk */ add(contact, write = true) { @@ -468,8 +468,8 @@ const Store = GObject.registerClass({ * * { "555-5555": { "name": "...", "numbers": [], ... } } * - * @param {Object[]} addresses - A list of address objects - * @return {Object} A dictionary of phone numbers and contacts + * @param {object[]} addresses - A list of address objects + * @returns {object} A dictionary of phone numbers and contacts */ lookupAddresses(addresses) { const contacts = {}; @@ -502,7 +502,7 @@ const Store = GObject.registerClass({ /** * Update the contact store from a dictionary of our custom contact objects. * - * @param {Object} json - an Object of contact Objects + * @param {object} json - an Object of contact Objects */ async update(json = {}) { try { @@ -610,4 +610,3 @@ const Store = GObject.registerClass({ }); export default Store; - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/index.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/index.js index 249c7ee..302dbbe 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/index.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/index.js @@ -41,7 +41,7 @@ const Default = new Map(); * followed by a call to `release()`. * * @param {string} name - The module name - * @return {*} The default instance of a component + * @returns {*} The default instance of a component */ export function acquire(name) { if (functionOverrides.acquire) @@ -78,7 +78,7 @@ export function acquire(name) { * holder, the component will be freed. * * @param {string} name - The module name - * @return {null} A %null value, useful for overriding a traced variable + * @returns {null} A %null value, useful for overriding a traced variable */ export function release(name) { if (functionOverrides.release) @@ -99,4 +99,3 @@ export function release(name) { return null; } - 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 0675af3..d387127 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 @@ -51,7 +51,7 @@ const RemoteSession = GObject.registerClass({ get session_id() { try { return this.get_cached_property('SessionId').unpack(); - } catch (e) { + } catch { return null; } } @@ -327,22 +327,24 @@ export default class Controller { } async _ensureAdapter() { + // Update the timestamp of the last event + this._sessionExpiry = Math.floor((Date.now() / 1000) + SESSION_TIMEOUT); + + // Session is active + if (this._session !== null) + return this._session; + + // Mutter's RemoteDesktop is not available, fall back to Atspi + if (this.connection === null) { + debug('Falling back to Atspi'); + + this._session = new AtspiController(); + return this._session; + } + try { - // Update the timestamp of the last event - this._sessionExpiry = Math.floor((Date.now() / 1000) + SESSION_TIMEOUT); - - // Session is active - if (this._session !== null) - return; - - // Mutter's RemoteDesktop is not available, fall back to Atspi - if (this.connection === null) { - debug('Falling back to Atspi'); - - this._session = new AtspiController(); - // Mutter is available and there isn't another session starting - } else if (this._sessionStarting === false) { + if (this._sessionStarting === false) { this._sessionStarting = true; debug('Creating Mutter RemoteDesktop session'); @@ -368,18 +370,17 @@ export default class Controller { this._onSessionExpired.bind(this) ); } - this._sessionStarting = false; } + return this._session; } catch (e) { logError(e); - if (this._session !== null) { this._session.destroy(); this._session = null; } - this._sessionStarting = false; + throw e; } } @@ -387,111 +388,81 @@ export default class Controller { * Pointer Events */ movePointer(dx, dy) { - try { - if (dx === 0 && dy === 0) - return; + if (dx === 0 && dy === 0) + return; - this._ensureAdapter(); - this._session.movePointer(dx, dy); - } catch (e) { - debug(e); - } + this._ensureAdapter() + .then(session => session?.movePointer(dx, dy)) + .catch(e => debug(e)); } pressPointer(button) { - try { - this._ensureAdapter(); - this._session.pressPointer(button); - } catch (e) { - debug(e); - } + this._ensureAdapter() + .then(session => session?.pressPointer(button)) + .catch(e => debug(e)); } releasePointer(button) { - try { - this._ensureAdapter(); - this._session.releasePointer(button); - } catch (e) { - debug(e); - } + this._ensureAdapter() + .then(session => session?.releasePointer(button)) + .catch(e => debug(e)); } clickPointer(button) { - try { - this._ensureAdapter(); - this._session.clickPointer(button); - } catch (e) { - debug(e); - } + this._ensureAdapter() + .then(session => session?.clickPointer(button)) + .catch(e => debug(e)); } doubleclickPointer(button) { - try { - this._ensureAdapter(); - this._session.doubleclickPointer(button); - } catch (e) { - debug(e); - } + this._ensureAdapter() + .then(session => session?.doubleclickPointer(button)) + .catch(e => debug(e)); } scrollPointer(dx, dy) { if (dx === 0 && dy === 0) return; - try { - this._ensureAdapter(); - this._session.scrollPointer(dx, dy); - } catch (e) { - debug(e); - } + this._ensureAdapter() + .then(session => session?.scrollPointer(dx, dy)) + .catch(e => debug(e)); } /* * Keyboard Events */ pressKeysym(keysym) { - try { - this._ensureAdapter(); - this._session.pressKeysym(keysym); - } catch (e) { - debug(e); - } + this._ensureAdapter() + .then(session => session?.pressKeysym(keysym)) + .catch(e => debug(e)); } releaseKeysym(keysym) { - try { - this._ensureAdapter(); - this._session.releaseKeysym(keysym); - } catch (e) { - debug(e); - } + this._ensureAdapter() + .then(session => session?.releaseKeysym(keysym)) + .catch(e => debug(e)); } pressreleaseKeysym(keysym) { - try { - this._ensureAdapter(); - this._session.pressreleaseKeysym(keysym); - } catch (e) { - debug(e); - } + this._ensureAdapter() + .then(session => session?.pressreleaseKeysym(keysym)) + .catch(e => debug(e)); } /* * High-level keyboard input */ pressKeys(input, modifiers) { - try { - this._ensureAdapter(); - + this._ensureAdapter() + .then(session => { if (typeof input === 'string') { for (let i = 0; i < input.length; i++) - this._session.pressKey(input[i], modifiers); + session?.pressKey(input[i], modifiers); } else { - this._session.pressKey(input, modifiers); + session?.pressKey(input, modifiers); } - } catch (e) { - debug(e); - } + }).catch(e => debug(e)); } destroy() { diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/mpris.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/mpris.js index 70c4225..8f712d5 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/mpris.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/mpris.js @@ -472,6 +472,10 @@ const PlayerProxy = GObject.registerClass({ GTypeName: 'GSConnectMPRISPlayer', }, class PlayerProxy extends Player { + /** + * @constructs GSConnectMPRISPlayer + * @param {string} name - The name of the player + */ _init(name) { super._init(); @@ -539,7 +543,7 @@ const PlayerProxy = GObject.registerClass({ _get(proxy, name, fallback = null) { try { return proxy.get_cached_property(name).recursiveUnpack(); - } catch (e) { + } catch { return fallback; } } @@ -707,7 +711,7 @@ const PlayerProxy = GObject.registerClass({ ); return reply.recursiveUnpack()[0]; - } catch (e) { + } catch { return 0; } } @@ -914,7 +918,7 @@ const Manager = GObject.registerClass({ * Check for a player by its Identity. * * @param {string} identity - A player name - * @return {boolean} %true if the player was found + * @returns {boolean} %true if the player was found */ hasPlayer(identity) { for (const player of this._players.values()) { @@ -929,7 +933,7 @@ const Manager = GObject.registerClass({ * Get a player by its Identity. * * @param {string} identity - A player name - * @return {GSConnectMPRISPlayer|null} A player or %null + * @returns {GSConnectMPRISPlayer|null} A player or %null */ getPlayer(identity) { for (const player of this._players.values()) { @@ -943,7 +947,7 @@ const Manager = GObject.registerClass({ /** * Get a list of player identities. * - * @return {string[]} A list of player identities + * @returns {string[]} A list of player identities */ getIdentities() { const identities = []; @@ -1000,4 +1004,3 @@ const Manager = GObject.registerClass({ * The service class for this component */ export default Manager; - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/notification.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/notification.js index 0566a25..36dc482 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/notification.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/notification.js @@ -144,7 +144,7 @@ const Listener = GObject.registerClass({ * * @param {string} sender - A DBus unique name (eg. :1.2282) * @param {string} appName - @appName passed to Notify() (Optional) - * @return {string} A well-known name or %null + * @returns {string} A well-known name or %null */ async _getAppId(sender, appName) { try { @@ -189,7 +189,7 @@ const Listener = GObject.registerClass({ * * @param {string} sender - A DBus unique name * @param {string} [appName] - `appName` supplied by Notify() - * @return {string} A well-known name or %null + * @returns {string} A well-known name or %null */ async _getAppName(sender, appName = null) { // Check the cache first @@ -201,7 +201,7 @@ const Listener = GObject.registerClass({ const appInfo = Gio.DesktopAppInfo.new(`${appId}.desktop`); this._names[appName] = appInfo.get_name(); appName = appInfo.get_name(); - } catch (e) { + } catch { // Silence errors } @@ -261,7 +261,7 @@ const Listener = GObject.registerClass({ /** * Export interfaces for proxying notifications and become a monitor * - * @return {Promise} A promise for the operation + * @returns {Promise} A promise for the operation */ _monitorConnection() { // libnotify Interface 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 1165fc0..96717c2 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 @@ -19,7 +19,7 @@ try { GIRepository.Repository.prepend_library_path(typelibDir); Gvc = (await import('gi://Gvc')).default; -} catch (e) {} +} catch {} /** @@ -33,7 +33,7 @@ if (Gvc) { return this.description; return `${this.get_port().human_port} (${this.description})`; - } catch (e) { + } catch { return this.description; } }, diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/sound.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/sound.js index 0845acf..55ea5aa 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/sound.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/components/sound.js @@ -9,7 +9,7 @@ import GLib from 'gi://GLib'; let GSound = null; try { GSound = (await import('gi://GSound')).default; -} catch (e) {} +} catch {} const Player = class Player { @@ -169,4 +169,3 @@ const Player = class Player { * The service class for this component */ export default Player; - 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 43788ce..36948d8 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 @@ -6,13 +6,14 @@ import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; +import Device from './device.js'; import plugins from './plugins/index.js'; /** * Get the local device type. * - * @return {string} A device type string + * @returns {string} A device type string */ export function _getDeviceType() { try { @@ -27,7 +28,7 @@ export function _getDeviceType() { return 'laptop'; return 'desktop'; - } catch (e) { + } catch { return 'desktop'; } } @@ -69,8 +70,8 @@ export class Packet { /** * Deserialize and return a new Packet from an Object or string. * - * @param {Object|string} data - A string or dictionary to deserialize - * @return {Core.Packet} A new packet object + * @param {object|string} data - A string or dictionary to deserialize + * @returns {Packet} A new packet object */ static deserialize(data) { return new Packet(data); @@ -80,7 +81,7 @@ export class Packet { * Serialize the packet as a single line with a terminating new-line (`\n`) * character, ready to be written to a channel. * - * @return {string} A serialized packet + * @returns {string} A serialized packet */ serialize() { this.id = Date.now(); @@ -90,7 +91,7 @@ export class Packet { /** * Update the packet from a dictionary or string of JSON * - * @param {Object|string} data - Source data + * @param {object|string} data - Source data */ update(data) { try { @@ -106,7 +107,7 @@ export class Packet { /** * Check if the packet has a payload. * - * @return {boolean} %true if @packet has a payload + * @returns {boolean} %true if @packet has a payload */ hasPayload() { if (!this.hasOwnProperty('payloadSize')) @@ -219,7 +220,7 @@ export const Channel = GObject.registerClass({ * Read a packet. * * @param {Gio.Cancellable} [cancellable] - A cancellable - * @return {Promise} The packet + * @returns {Promise} The packet */ async readPacket(cancellable = null) { if (cancellable === null) @@ -247,9 +248,9 @@ export const Channel = GObject.registerClass({ /** * Send a packet. * - * @param {Core.Packet} packet - The packet to send + * @param {Packet} packet - The packet to send * @param {Gio.Cancellable} [cancellable] - A cancellable - * @return {Promise} %true if successful + * @returns {Promise} %true if successful */ sendPacket(packet, cancellable = null) { if (cancellable === null) @@ -262,7 +263,7 @@ export const Channel = GObject.registerClass({ /** * Reject a transfer. * - * @param {Core.Packet} packet - A packet with payload info + * @param {Packet} packet - A packet with payload info */ rejectTransfer(packet) { throw new GObject.NotImplementedError(); @@ -272,7 +273,7 @@ export const Channel = GObject.registerClass({ * Download a payload from a device. Typically implementations will override * this with an async function. * - * @param {Core.Packet} packet - A packet + * @param {Packet} packet - A packet * @param {Gio.OutputStream} target - The target stream * @param {Gio.Cancellable} [cancellable] - A cancellable for the upload */ @@ -285,7 +286,7 @@ export const Channel = GObject.registerClass({ * Upload a payload to a device. Typically implementations will override * this with an async function. * - * @param {Core.Packet} packet - The packet describing the transfer + * @param {Packet} packet - The packet describing the transfer * @param {Gio.InputStream} source - The source stream * @param {number} size - The payload size * @param {Gio.Cancellable} [cancellable] - A cancellable for the upload @@ -350,7 +351,7 @@ export const ChannelService = GObject.registerClass({ get name() { if (this._name === undefined) - this._name = GLib.get_host_name(); + this._name = GLib.get_host_name().slice(0, 32); return this._name; } @@ -365,7 +366,7 @@ export const ChannelService = GObject.registerClass({ get id() { if (this._id === undefined) - this._id = GLib.uuid_string_random(); + this._id = Device.generateId(); return this._id; } @@ -406,7 +407,7 @@ export const ChannelService = GObject.registerClass({ deviceId: this.id, deviceName: this.name, deviceType: _getDeviceType(), - protocolVersion: 7, + protocolVersion: 8, incomingCapabilities: [], outgoingCapabilities: [], }, @@ -429,7 +430,7 @@ export const ChannelService = GObject.registerClass({ /** * Emit Core.ChannelService::channel * - * @param {Core.Channel} channel - The new channel + * @param {Channel} channel - The new channel */ channel(channel) { if (!this.emit('channel', channel)) @@ -542,7 +543,7 @@ export const Transfer = GObject.registerClass({ /** * Ensure there is a stream for the transfer item. * - * @param {Object} item - A transfer item + * @param {object} item - A transfer item * @param {Gio.Cancellable} [cancellable] - A cancellable */ async _ensureStream(item, cancellable = null) { @@ -583,7 +584,7 @@ export const Transfer = GObject.registerClass({ /** * Add a file to the transfer. * - * @param {Core.Packet} packet - A packet + * @param {Packet} packet - A packet * @param {Gio.File} file - A file to transfer */ addFile(packet, file) { @@ -600,7 +601,7 @@ export const Transfer = GObject.registerClass({ /** * Add a filepath to the transfer. * - * @param {Core.Packet} packet - A packet + * @param {Packet} packet - A packet * @param {string} path - A filepath to transfer */ addPath(packet, path) { @@ -617,7 +618,7 @@ export const Transfer = GObject.registerClass({ /** * Add a stream to the transfer. * - * @param {Core.Packet} packet - A packet + * @param {Packet} packet - A packet * @param {Gio.InputStream|Gio.OutputStream} stream - A stream to transfer * @param {number} [size] - Payload size */ 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 index 1ddb356..f9b1f13 100755 --- 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 @@ -18,6 +18,7 @@ import system from 'system'; import './init.js'; import Config from '../config.js'; +import Device from './device.js'; import Manager from './manager.js'; import * as ServiceUI from './ui/service.js'; @@ -45,6 +46,61 @@ const Service = GObject.registerClass({ this._initOptions(); } + _migrateConfiguration() { + if (!Device.validateName(this.settings.get_string('name'))) + this.settings.set('name', GLib.get_host_name().slice(0, 32)); + + const [certPath, keyPath] = [ + GLib.build_filenamev([Config.CONFIGDIR, 'certificate.pem']), + GLib.build_filenamev([Config.CONFIGDIR, 'private.pem']), + ]; + const certificate = Gio.TlsCertificate.new_for_paths(certPath, keyPath, + null); + + if (Device.validateId(certificate.common_name)) + return; + + // Remove the old certificate, serving as the single source of truth + // for the device ID + try { + Gio.File.new_for_path(certPath).delete(null); + Gio.File.new_for_path(keyPath).delete(null); + } catch { + // Silence errors + } + + // For each device, remove it entirely if it violates the device ID + // constraints, otherwise mark it unpaired to preserve the settings. + const deviceList = this.settings.get_strv('devices').filter(id => { + const settingsPath = `/org/gnome/shell/extensions/gsconnect/device/${id}/`; + if (!Device.validateId(id)) { + GLib.spawn_command_line_async(`dconf reset -f ${settingsPath}`); + Gio.File.rm_rf(GLib.build_filenamev([Config.CACHEDIR, id])); + debug(`Invalid device ID ${id} removed.`); + return false; + } + + const settings = new Gio.Settings({ + settings_schema: Config.GSCHEMA.lookup( + 'org.gnome.Shell.Extensions.GSConnect.Device', true), + path: settingsPath, + }); + settings.set_boolean('paired', false); + return true; + }); + this.settings.set_strv('devices', deviceList); + + // Notify the user + const notification = Gio.Notification.new(_('Settings Migrated')); + notification.set_body(_('GSConnect has updated to support changes to the KDE Connect protocol. Some devices may need to be repaired.')); + notification.set_icon(new Gio.ThemedIcon({name: 'dialog-warning'})); + notification.set_priority(Gio.NotificationPriority.HIGH); + this.send_notification('settings-migrated', notification); + + // Finally, reset the service ID to trigger re-generation. + this.settings.reset('id'); + } + get settings() { if (this._settings === undefined) { this._settings = new Gio.Settings({ @@ -154,7 +210,7 @@ const Service = GObject.registerClass({ /** * Report a service-level error * - * @param {Object} error - An Error or object with name, message and stack + * @param {object} error - An Error or object with name, message and stack */ notify_error(error) { try { @@ -241,6 +297,9 @@ const Service = GObject.registerClass({ // GActions & GSettings this._initActions(); + // TODO: remove after a reasonable period of time + this._migrateConfiguration(); + this.manager.start(); } @@ -699,4 +758,3 @@ const Service = GObject.registerClass({ }); await (new Service()).runAsync([system.programInvocationName].concat(ARGV)); - 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 aef96a2..4742c64 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 @@ -11,6 +11,8 @@ import * as Components from './components/index.js'; import * as Core from './core.js'; import plugins from './plugins/index.js'; +const ALLOWED_TIMESTAMP_TIME_DIFFERENCE_SECONDS = 1800; // 30 min + /** * An object representing a remote device. * @@ -88,6 +90,7 @@ const Device = GObject.registerClass({ // GLib.Source timeout id's for pairing requests this._incomingPairRequest = 0; this._outgoingPairRequest = 0; + this._pairingTimestamp = 0; // Maps of name->Plugin, packet->Plugin, uuid->Transfer this._plugins = new Map(); @@ -128,6 +131,19 @@ const Device = GObject.registerClass({ this._loadPlugins(); } + static generateId() { + return GLib.uuid_string_random().replaceAll('-', ''); + } + + static validateId(id) { + return /^[a-zA-Z0-9_-]{32,38}$/.test(id); + } + + static validateName(name) { + // None of the forbidden characters and at least one non-whitespace + return name.trim() && /^[^"',;:.!?()[\]<>]{1,32}$/.test(name); + } + get channel() { if (this._channel === undefined) this._channel = null; @@ -162,47 +178,34 @@ const Device = GObject.registerClass({ // FIXME: backend should do this stuff get encryption_info() { - let localCert = null; - let remoteCert = null; + if (!this.channel) + return ''; // Bluetooth connections have no certificate so we use the host address if (this.connection_type === 'bluetooth') { // TRANSLATORS: Bluetooth address for remote device return _('Bluetooth device at %s').format('???'); - - // If the device is connected use the certificate from the connection - } else if (this.connected) { - remoteCert = this.channel.peer_certificate; - - // Otherwise pull it out of the settings - } else if (this.paired) { - remoteCert = Gio.TlsCertificate.new_from_pem( - this.settings.get_string('certificate-pem'), - -1 - ); } // FIXME: another ugly reach-around - let lanBackend; + const localCert = this.service.manager.backends.get('lan')?.certificate; + const remoteCert = this.channel?.peer_certificate; + if (!localCert || !remoteCert) + return ''; - if (this.service !== null) - lanBackend = this.service.manager.backends.get('lan'); + const checksum = new GLib.Checksum(GLib.ChecksumType.SHA256); + let [a, b] = [localCert.pubkey_der(), remoteCert.pubkey_der()]; + if (a.compare(b) < 0) + [a, b] = [b, a]; // swap + checksum.update(a.toArray()); + checksum.update(b.toArray()); - if (lanBackend && lanBackend.certificate) - localCert = lanBackend.certificate; + if (this.channel?.identity.body.protocolVersion >= 8) + checksum.update(String(this._pairingTimestamp)); - - let verificationKey = ''; - if (localCert && remoteCert) { - let a = localCert.pubkey_der(); - let b = remoteCert.pubkey_der(); - if (a.compare(b) < 0) - [a, b] = [b, a]; // swap - const checksum = new GLib.Checksum(GLib.ChecksumType.SHA256); - checksum.update(a.toArray()); - checksum.update(b.toArray()); - verificationKey = checksum.get_string(); - } + const verificationKey = checksum.get_string() + .substring(0, 8) + .toUpperCase(); // TRANSLATORS: Label for TLS connection verification key // @@ -384,7 +387,7 @@ const Device = GObject.registerClass({ * * @param {string[]} args - process arguments * @param {Gio.Cancellable} [cancellable] - optional cancellable - * @return {Gio.Subprocess} The subprocess + * @returns {Gio.Subprocess} The subprocess */ launchProcess(args, cancellable = null) { if (this._launcher === undefined) { @@ -418,7 +421,7 @@ const Device = GObject.registerClass({ * Handle a packet and pass it to the appropriate plugin. * * @param {Core.Packet} packet - The incoming packet object - * @return {undefined} no return value + * @returns {undefined} no return value */ handlePacket(packet) { try { @@ -443,7 +446,7 @@ const Device = GObject.registerClass({ /** * Send a packet to the device. * - * @param {Object} packet - An object of packet data... + * @param {object} packet - An object of packet data... */ async sendPacket(packet) { try { @@ -524,7 +527,7 @@ const Device = GObject.registerClass({ * device menu. * * @param {string} actionName - An action name with scope (eg. device.foo) - * @return {number} An 0-based index or -1 if not found + * @returns {number} An 0-based index or -1 if not found */ getMenuAction(actionName) { for (let i = 0, len = this.menu.get_n_items(); i < len; i++) { @@ -533,7 +536,7 @@ const Device = GObject.registerClass({ if (val.unpack() === actionName) return i; - } catch (e) { + } catch { continue; } } @@ -546,7 +549,7 @@ const Device = GObject.registerClass({ * * @param {Gio.MenuItem} menuItem - A GMenuItem * @param {number} [index] - The position to place the item - * @return {number} The position the item was placed + * @returns {number} The position the item was placed */ addMenuItem(menuItem, index = -1) { try { @@ -570,7 +573,7 @@ const Device = GObject.registerClass({ * @param {number} [index] - The position to place the item * @param {string} label - A label for the item * @param {string} icon_name - A themed icon name for the item - * @return {number} The position the item was placed + * @returns {number} The position the item was placed */ addMenuAction(action, index = -1, label, icon_name) { try { @@ -600,7 +603,7 @@ const Device = GObject.registerClass({ * Remove a GAction from the top level of the device menu by action name * * @param {string} actionName - A GAction name, including scope - * @return {number} The position the item was removed from or -1 + * @returns {number} The position the item was removed from or -1 */ removeMenuAction(actionName) { try { @@ -631,7 +634,7 @@ const Device = GObject.registerClass({ /** * Show a device notification. * - * @param {Object} params - A dictionary of notification parameters + * @param {object} params - A dictionary of notification parameters * @param {number} [params.id] - A UNIX epoch timestamp (ms) * @param {string} [params.title] - A title * @param {string} [params.body] - A body @@ -728,7 +731,7 @@ const Device = GObject.registerClass({ /** * Create a transfer object. * - * @return {Core.Transfer} A new transfer + * @returns {Core.Transfer} A new transfer */ createTransfer() { const transfer = new Core.Transfer({device: this}); @@ -747,13 +750,11 @@ const Device = GObject.registerClass({ * Reject the transfer payload described by @packet. * * @param {Core.Packet} packet - A packet - * @return {Promise} A promise for the operation + * @returns {void} */ rejectTransfer(packet) { - if (!packet || !packet.hasPayload()) - return; - - return this.channel.rejectTransfer(packet); + if (packet?.hasPayload()) + return this.channel.rejectTransfer(packet); } openPath(action, parameter) { @@ -816,15 +817,19 @@ const Device = GObject.registerClass({ // The device thinks we're unpaired } else if (this.paired) { this._setPaired(true); + this._pairingTimestamp = Math.floor(Date.now() / 1000); this.sendPacket({ type: 'kdeconnect.pair', - body: {pair: true}, + body: { + pair: true, + timestamp: this._pairingTimestamp, + }, }); this._triggerPlugins(); // The device is requesting pairing } else { - this._notifyPairRequest(); + this._notifyPairRequest(packet.body?.timestamp); } // Device is requesting unpairing/rejecting our request } else { @@ -835,11 +840,14 @@ const Device = GObject.registerClass({ /** * Notify the user of an incoming pair request and set a 30s timeout + * + * @param {number} [timestamp] - Timestamp for the pair request */ - _notifyPairRequest() { + _notifyPairRequest(timestamp = 0) { // Reset any active request this._resetPairRequest(); + this._pairingTimestamp = timestamp; this.showNotification({ id: 'pair-request', // TRANSLATORS: eg. Pair Request from Google Pixel @@ -884,6 +892,8 @@ const Device = GObject.registerClass({ GLib.source_remove(this._outgoingPairRequest); this._outgoingPairRequest = 0; } + + this._pairingTimestamp = 0; } /** @@ -931,8 +941,24 @@ const Device = GObject.registerClass({ // If we're accepting an incoming pair request, set the internal // paired state and send the confirmation before loading plugins. if (this._incomingPairRequest) { - this._setPaired(true); + if (this.identity?.body.protocolVersion >= 8) { + const currentTimestamp = Math.floor(Date.now() / 1000); + const diffTimestamp = Number.abs(this._pairingTimestamp - currentTimestamp); + if (diffTimestamp > ALLOWED_TIMESTAMP_TIME_DIFFERENCE_SECONDS) { + this._setPaired(false); + this.showNotification({ + id: 'pair-request', + // TRANSLATORS: eg. Failed to pair with Google Pixel + title: _('Failed to pair with %s').format(this.name), + body: _('Device clocks are out of sync'), + icon: new Gio.ThemedIcon({name: 'dialog-warning-symbolic'}), + priority: Gio.NotificationPriority.URGENT, + }); + return; + } + } + this._setPaired(true); this.sendPacket({ type: 'kdeconnect.pair', body: {pair: true}, @@ -945,9 +971,13 @@ const Device = GObject.registerClass({ } else if (!this.paired) { this._resetPairRequest(); + this._pairingTimestamp = Math.floor(Date.now() / 1000); this.sendPacket({ type: 'kdeconnect.pair', - body: {pair: true}, + body: { + pair: true, + timestamp: this._pairingTimestamp, + }, }); this._outgoingPairRequest = GLib.timeout_add_seconds( diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/init.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/init.js index e54d87c..a024b17 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/init.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/init.js @@ -9,7 +9,7 @@ import GIRepository from 'gi://GIRepository'; import GLib from 'gi://GLib'; import Config from '../config.js'; -import setup, {setupGettext} from '../utils/setup.js'; +import {setup, setupGettext} from '../utils/setup.js'; // Promise Wrappers @@ -163,7 +163,7 @@ if (!globalThis.HAVE_GNOME) { * A simple (for now) pre-comparison sanitizer for phone numbers * See: https://github.com/KDE/kdeconnect-kde/blob/master/smsapp/conversationlistmodel.cpp#L200-L210 * - * @return {string} Return the string stripped of leading 0, and ' ()-+' + * @returns {string} Return the string stripped of leading 0, and ' ()-+' */ String.prototype.toPhoneNumber = function () { const strippedNumber = this.replace(/^0*|[ ()+-]/g, ''); @@ -179,7 +179,7 @@ String.prototype.toPhoneNumber = function () { * A simple equality check for phone numbers based on `toPhoneNumber()` * * @param {string} number - A phone number string to compare - * @return {boolean} If `this` and @number are equivalent phone numbers + * @returns {boolean} If `this` and @number are equivalent phone numbers */ String.prototype.equalsPhoneNumber = function (number) { const a = this.toPhoneNumber(); @@ -212,12 +212,12 @@ Gio.File.rm_rf = function (file) { Gio.File.rm_rf(iter.get_child(info)); iter.close(null); - } catch (e) { + } catch { // Silence errors } file.delete(null); - } catch (e) { + } catch { // Silence errors } }; @@ -227,7 +227,7 @@ Gio.File.rm_rf = function (file) { * Extend GLib.Variant with a static method to recursively pack a variant * * @param {*} [obj] - May be a GLib.Variant, Array, standard Object or literal. - * @return {GLib.Variant} The resulting GVariant + * @returns {GLib.Variant} The resulting GVariant */ function _full_pack(obj) { let packed; @@ -283,7 +283,7 @@ GLib.Variant.full_pack = _full_pack; * Extend GLib.Variant with a method to recursively deepUnpack() a variant * * @param {*} [obj] - May be a GLib.Variant, Array, standard Object or literal. - * @return {*} The resulting object + * @returns {*} The resulting object */ function _full_unpack(obj) { obj = (obj === undefined) ? this : obj; @@ -310,7 +310,7 @@ function _full_unpack(obj) { unpacked[key] = Gio.Icon.deserialize(value); else unpacked[key] = _full_unpack(value); - } catch (e) { + } catch { unpacked[key] = _full_unpack(value); } } @@ -326,8 +326,8 @@ GLib.Variant.prototype.full_unpack = _full_unpack; /** - * Creates a GTlsCertificate from the PEM-encoded data in @cert_path and - * @key_path. If either are missing a new pair will be generated. + * Creates a GTlsCertificate from the PEM-encoded data in %cert_path and + * %key_path. If either are missing a new pair will be generated. * * Additionally, the private key will be added using ssh-add to allow sftp * connections using Gio. @@ -337,9 +337,16 @@ GLib.Variant.prototype.full_unpack = _full_unpack; * @param {string} certPath - Absolute path to a x509 certificate in PEM format * @param {string} keyPath - Absolute path to a private key in PEM format * @param {string} commonName - A unique common name for the certificate - * @return {Gio.TlsCertificate} A TLS certificate + * @returns {Gio.TlsCertificate} A TLS certificate */ Gio.TlsCertificate.new_for_paths = function (certPath, keyPath, commonName = null) { + if (GLib.find_program_in_path(Config.OPENSSL_PATH) === null) { + const error = new Error(); + error.name = _('OpenSSL not found'); + error.url = `${Config.PACKAGE_URL}/wiki/Error#openssl-not-found`; + throw error; + } + // Check if the certificate/key pair already exists const certExists = GLib.file_test(certPath, GLib.FileTest.EXISTS); const keyExists = GLib.file_test(keyPath, GLib.FileTest.EXISTS); @@ -348,17 +355,18 @@ Gio.TlsCertificate.new_for_paths = function (certPath, keyPath, commonName = nul if (!certExists || !keyExists) { // If we weren't passed a common name, generate a random one if (!commonName) - commonName = GLib.uuid_string_random(); + commonName = GLib.uuid_string_random().replaceAll('-', ''); const proc = new Gio.Subprocess({ argv: [ Config.OPENSSL_PATH, 'req', - '-new', '-x509', '-sha256', - '-out', certPath, - '-newkey', 'rsa:4096', '-nodes', + '-newkey', 'ec', + '-pkeyopt', 'ec_paramgen_curve:prime256v1', '-keyout', keyPath, + '-new', '-x509', '-nodes', '-days', '3650', '-subj', `/O=andyholmes.github.io/OU=GSConnect/CN=${commonName}`, + '-out', certPath, ], flags: (Gio.SubprocessFlags.STDOUT_SILENCE | Gio.SubprocessFlags.STDERR_SILENCE), @@ -396,7 +404,7 @@ Object.defineProperties(Gio.TlsCertificate.prototype, { /** * Get just the pubkey as a DER ByteArray of a certificate. * - * @return {GLib.Bytes} The pubkey as DER of the certificate. + * @returns {GLib.Bytes} The pubkey as DER of the certificate. */ 'pubkey_der': { value: function () { diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/manager.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/manager.js index ce9dca6..e4a71bd 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/manager.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/manager.js @@ -7,6 +7,7 @@ import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import Config from '../config.js'; +import * as Core from './core.js'; import * as DBus from './utils/dbus.js'; import Device from './device.js'; @@ -42,6 +43,13 @@ const Manager = GObject.registerClass({ GObject.ParamFlags.READWRITE, false ), + 'certificate': GObject.ParamSpec.object( + 'certificate', + 'Certificate', + 'The local TLS certificate', + GObject.ParamFlags.READABLE, + Gio.TlsCertificate + ), 'discoverable': GObject.ParamSpec.boolean( 'discoverable', 'Discoverable', @@ -53,7 +61,7 @@ const Manager = GObject.registerClass({ 'id', 'Id', 'The hostname or other network unique id', - GObject.ParamFlags.READWRITE, + GObject.ParamFlags.READABLE, null ), 'name': GObject.ParamSpec.string( @@ -92,6 +100,17 @@ const Manager = GObject.registerClass({ return this._backends; } + get certificate() { + if (this._certificate === undefined) { + this._certificate = Gio.TlsCertificate.new_for_paths( + GLib.build_filenamev([Config.CONFIGDIR, 'certificate.pem']), + GLib.build_filenamev([Config.CONFIGDIR, 'private.pem']), + null); + } + + return this._certificate; + } + get debug() { if (this._debug === undefined) this._debug = this.settings.get_boolean('debug'); @@ -156,18 +175,7 @@ const Manager = GObject.registerClass({ } get id() { - if (this._id === undefined) - this._id = this.settings.get_string('id'); - - return this._id; - } - - set id(value) { - if (this.id === value) - return; - - this._id = value; - this.notify('id'); + return this.certificate.common_name; } get name() { @@ -217,17 +225,12 @@ const Manager = GObject.registerClass({ * GSettings */ _initSettings() { - // Initialize the ID and name of the service - if (this.settings.get_string('id').length === 0) - this.settings.set_string('id', GLib.uuid_string_random()); - if (this.settings.get_string('name').length === 0) this.settings.set_string('name', GLib.get_host_name()); // Bound Properties this.settings.bind('debug', this, 'debug', 0); this.settings.bind('discoverable', this, 'discoverable', 0); - this.settings.bind('id', this, 'id', 0); this.settings.bind('name', this, 'name', 0); } @@ -382,7 +385,7 @@ const Manager = GObject.registerClass({ * of known devices if it doesn't exist. * * @param {Core.Packet} packet - An identity packet for the device - * @return {Device} A device object + * @returns {Device} A device object */ _ensureDevice(packet) { let device = this.devices.get(packet.body.deviceId); @@ -422,7 +425,7 @@ const Manager = GObject.registerClass({ */ _removeDevice(id) { // Delete all GSettings - const settings_path = `/org/gnome/shell/extensions/gsconnect/${id}/`; + const settings_path = `/org/gnome/shell/extensions/gsconnect/device/${id}/`; GLib.spawn_command_line_async(`dconf reset -f ${settings_path}`); // Delete the cache @@ -438,7 +441,7 @@ const Manager = GObject.registerClass({ * A GSourceFunc that tries to reconnect to each paired device, while * pruning unpaired devices that have disconnected. * - * @return {boolean} Always %true + * @returns {boolean} Always %true */ _reconnect() { for (const [id, device] of this.devices) { 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 index 297d180..939ed03 100755 --- 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 @@ -14,7 +14,7 @@ import system from 'system'; let GioUnix; try { GioUnix = (await import('gi://GioUnix?version=2.0')).default; -} catch (e) { +} catch { GioUnix = { InputStream: Gio.UnixInputStream, OutputStream: Gio.UnixOutputStream, @@ -142,7 +142,7 @@ const NativeMessagingHost = GObject.registerClass({ } return GLib.SOURCE_CONTINUE; - } catch (e) { + } catch { this.quit(); } } @@ -152,7 +152,7 @@ const NativeMessagingHost = GObject.registerClass({ const data = JSON.stringify(message); this._stdout.put_int32(data.length, null); this._stdout.put_string(data, null); - } catch (e) { + } catch { this.quit(); } } @@ -186,7 +186,7 @@ const NativeMessagingHost = GObject.registerClass({ _proxyGetter(name) { try { return this.get_cached_property(name).unpack(); - } catch (e) { + } catch { return null; } } @@ -222,4 +222,3 @@ const NativeMessagingHost = GObject.registerClass({ // NOTE: must not pass ARGV await (new NativeMessagingHost()).runAsync([system.programInvocationName]); - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugin.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugin.js index ed2a5ef..8912962 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugin.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugin.js @@ -7,6 +7,7 @@ import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import Config from '../config.js'; +import * as Core from './core.js'; import plugins from './plugins/index.js'; @@ -248,4 +249,3 @@ const Plugin = GObject.registerClass({ }); export default Plugin; - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/battery.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/battery.js index c7dbe04..bbcc5f2 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/battery.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/battery.js @@ -7,6 +7,7 @@ import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import * as Components from '../components/index.js'; +import * as Core from '../core.js'; import Plugin from '../plugin.js'; diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/connectivity_report.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/connectivity_report.js index 7107ff7..7040f66 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/connectivity_report.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/connectivity_report.js @@ -6,6 +6,7 @@ import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; +import * as Core from '../core.js'; import Plugin from '../plugin.js'; diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/contacts.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/contacts.js index 2168712..2a46ad2 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/contacts.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/contacts.js @@ -7,6 +7,7 @@ import GObject from 'gi://GObject'; import Plugin from '../plugin.js'; import Contacts from '../components/contacts.js'; +import * as Core from '../core.js'; /* * We prefer libebook's vCard parser if it's available @@ -18,7 +19,7 @@ export const setEBookContacts = (ebook) => { // This function is only for tests try { EBookContacts = (await import('gi://EBookContacts')).default; -} catch (e) { +} catch { EBookContacts = null; } @@ -150,7 +151,7 @@ const ContactsPlugin = GObject.registerClass({ * See: https://github.com/mathiasbynens/quoted-printable/blob/master/src/quoted-printable.js * * @param {string} input - The QUOTED-PRINTABLE string - * @return {string} The decoded string + * @returns {string} The decoded string */ _decodeQuotedPrintable(input) { return input @@ -171,7 +172,7 @@ const ContactsPlugin = GObject.registerClass({ * See: https://github.com/kvz/locutus/blob/master/src/php/xml/utf8_decode.js * * @param {string} input - The UTF-8 string - * @return {string} The decoded string + * @returns {string} The decoded string */ _decodeUTF8(input) { try { @@ -215,7 +216,7 @@ const ContactsPlugin = GObject.registerClass({ return output.join(''); // Fallback to old unfaithful - } catch (e) { + } catch { try { return decodeURIComponent(escape(input)); @@ -233,7 +234,7 @@ const ContactsPlugin = GObject.registerClass({ * See: http://jsfiddle.net/ARTsinn/P2t2P/ * * @param {string} vcard_data - The raw VCard data - * @return {Object} dictionary of vCard data + * @returns {object} dictionary of vCard data */ _parseVCard21(vcard_data) { // vcard skeleton diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/mousepad.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/mousepad.js index a4e40ae..88a8f17 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/mousepad.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/mousepad.js @@ -183,7 +183,7 @@ const MousepadPlugin = GObject.registerClass({ /** * Handle a input event. * - * @param {Object} input - The body of a `kdeconnect.mousepad.request` + * @param {object} input - The body of a `kdeconnect.mousepad.request` */ _handleInput(input) { if (!this.settings.get_boolean('share-control')) @@ -285,7 +285,7 @@ const MousepadPlugin = GObject.registerClass({ /** * Handle an echo/ACK of a event we sent, displaying it the dialog entry. * - * @param {Object} input - The body of a `kdeconnect.mousepad.echo` + * @param {object} input - The body of a `kdeconnect.mousepad.echo` */ _handleEcho(input) { if (!this._dialog || !this._dialog.visible) @@ -308,7 +308,7 @@ const MousepadPlugin = GObject.registerClass({ * Handle a state change from the remote keyboard. This is an indication * that the remote keyboard is ready to accept input. * - * @param {Object} packet - A `kdeconnect.mousepad.keyboardstate` packet + * @param {object} packet - A `kdeconnect.mousepad.keyboardstate` packet */ _handleState(packet) { this._state = !!packet.body.state; @@ -318,7 +318,7 @@ const MousepadPlugin = GObject.registerClass({ /** * Send an echo/ACK of @input, if requested * - * @param {Object} input - The body of a 'kdeconnect.mousepad.request' + * @param {object} input - The body of a 'kdeconnect.mousepad.request' */ _sendEcho(input) { if (!input.sendAck) @@ -335,8 +335,6 @@ const MousepadPlugin = GObject.registerClass({ /** * Send the local keyboard state - * - * @param {boolean} state - Whether we're ready to accept input */ _sendState() { this.device.sendPacket({ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/mpris.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/mpris.js index 2fd6a50..f3bb63a 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/mpris.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/mpris.js @@ -8,6 +8,7 @@ import GObject from 'gi://GObject'; import * as Components from '../components/index.js'; import Config from '../../config.js'; +import * as Core from '../core.js'; import * as DBus from '../utils/dbus.js'; import {Player} from '../components/mpris.js'; import Plugin from '../plugin.js'; @@ -42,6 +43,8 @@ const MPRISPlugin = GObject.registerClass({ this._transferring = new WeakSet(); this._updating = new WeakSet(); + this._queueTimers = new Map(); + this._mpris = Components.acquire('mpris'); this._playerAddedId = this._mpris.connect( @@ -75,6 +78,12 @@ const MPRISPlugin = GObject.registerClass({ disconnected() { super.disconnected(); + for (const [identity, timer] of this._queueTimers) { + if (timer) + GLib.source_remove(timer); + this._queueTimers.delete(identity); + } + for (const [identity, player] of this._players) { this._players.delete(identity); player.destroy(); @@ -144,7 +153,7 @@ const MPRISPlugin = GObject.registerClass({ /** * Handle an update for a remote player. * - * @param {Object} packet - A `kdeconnect.mpris` packet + * @param {object} packet - A `kdeconnect.mpris` packet */ _handlePlayerUpdate(packet) { const player = this._players.get(packet.body.player); @@ -174,7 +183,7 @@ const MPRISPlugin = GObject.registerClass({ * Handle a request for player information or action. * * @param {Core.Packet} packet - a `kdeconnect.mpris.request` - * @return {undefined} no return value + * @returns {undefined} no return value */ _handleRequest(packet) { // A request for the list of players @@ -258,18 +267,35 @@ const MPRISPlugin = GObject.registerClass({ } } - // Information Request - let hasResponse = false; + if (packet.body.hasOwnProperty('requestNowPlaying') || + packet.body.hasOwnProperty('requestVolume')) { + const response = this._getUpdate(player.Identity, packet); + this._sendUpdate(player, response); + } - const response = { - type: 'kdeconnect.mpris', - body: { - player: packet.body.player, - }, - }; + } catch (e) { + debug(e, this.device.name); + } finally { + this._updating.delete(player); + } + } + // Respond to information request (or push updated information) + _getUpdate(identity, packet) { + + const player = this._mpris?.getPlayer(identity); + if (!player) + return; + + const response = { + type: 'kdeconnect.mpris', + body: { + player: player.Identity, + }, + }; + + try { if (packet.body.hasOwnProperty('requestNowPlaying')) { - hasResponse = true; Object.assign(response.body, { pos: Math.floor(player.Position / 1000), @@ -330,31 +356,61 @@ const MPRISPlugin = GObject.registerClass({ } } - if (packet.body.hasOwnProperty('requestVolume')) { - hasResponse = true; + if (packet.body.hasOwnProperty('requestVolume')) response.body.volume = Math.floor(player.Volume * 100); - } - if (hasResponse) - this.device.sendPacket(response); + return response; } catch (e) { debug(e, this.device.name); - } finally { - this._updating.delete(player); } } + _sendUpdate(player, packet = null) { + if (!player || (!packet && this._updating.has(player))) + return GLib.SOURCE_REMOVE; + + debug(`Sending update for ${player.Identity}`); + this._updating.add(player); + + if (this._queueTimers.has(player.Identity)) { + const timer_id = this._queueTimers.get(player.Identity); + if (timer_id) { + debug(`Stopping timer id ${timer_id}`); + GLib.source_remove(timer_id); + } + this._queueTimers.delete(player.Identity); + } + if (!packet) { + packet = this._getUpdate(player.Identity, { + body: { + requestNowPlaying: true, + requestVolume: true, + }, + }, false); + } + this.device.sendPacket(packet); + + this._updating.delete(player); + return GLib.SOURCE_REMOVE; + } + _onPlayerChanged(mpris, player) { if (!this.settings.get_boolean('share-players')) return; - this._handleCommand({ - body: { - player: player.Identity, - requestNowPlaying: true, - requestVolume: true, - }, - }); + // Set a timer to send the updated state after a short delay. + // Allows further state changes to be bundled into a single packet. + if (this._queueTimers.has(player.Identity)) + return; + this._queueTimers.set(player.Identity, 0); + + const timer_id = GLib.timeout_add( + GLib.PRIORITY_DEFAULT, + 250, // ms (0.25 seconds) + this._sendUpdate.bind(this, player) + ); + this._queueTimers.set(player.Identity, timer_id); + debug(`Set update timer id ${timer_id} for ${player.Identity}`); } _onPlayerSeeked(mpris, player, offset) { @@ -434,6 +490,11 @@ const MPRISPlugin = GObject.registerClass({ } destroy() { + for (const [identity, timer] of this._queueTimers) { + this._queueTimers.delete(identity); + GLib.source_remove(timer); + } + if (this._mpris !== undefined) { this._mpris.disconnect(this._playerAddedId); this._mpris.disconnect(this._playerRemovedId); diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/notification.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/notification.js index bb317db..3a99d3c 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/notification.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/notification.js @@ -8,6 +8,7 @@ import GObject from 'gi://GObject'; import Gtk from 'gi://Gtk'; import * as Components from '../components/index.js'; +import * as Core from '../core.js'; import Config from '../../config.js'; import Plugin from '../plugin.js'; import ReplyDialog from '../ui/notification.js'; @@ -103,7 +104,7 @@ const SMS_APPS = [ * Try to determine if an notification is from an SMS app * * @param {Core.Packet} packet - A `kdeconnect.notification` - * @return {boolean} Whether the notification is from an SMS app + * @returns {boolean} Whether the notification is from an SMS app */ function _isSmsNotification(packet) { const id = packet.body.id; @@ -123,8 +124,8 @@ function _isSmsNotification(packet) { /** * Remove a local libnotify or Gtk notification. * - * @param {String|Number} id - Gtk (string) or libnotify id (uint32) - * @param {String|null} application - Application Id if Gtk or null + * @param {string | number} id - Gtk (string) or libnotify id (uint32) + * @param {string | null} application - Application Id if Gtk or null */ function _removeNotification(id, application = null) { let name, path, method, variant; @@ -416,7 +417,7 @@ const NotificationPlugin = GObject.registerClass({ * * @param {Core.Packet} packet - A `kdeconnect.notification` * @param {Gio.Icon|string|null} icon - An icon or %null - * @return {Promise} A promise for the operation + * @returns {Promise} A promise for the operation */ _uploadIcon(packet, icon = null) { // Normalize strings into GIcons @@ -438,7 +439,7 @@ const NotificationPlugin = GObject.registerClass({ /** * Send a local notification to the remote device. * - * @param {Object} notif - A dictionary of notification parameters + * @param {object} notif - A dictionary of notification parameters * @param {string} notif.appName - The notifying application * @param {string} notif.id - The notification ID * @param {string} notif.title - The notification title @@ -631,7 +632,7 @@ const NotificationPlugin = GObject.registerClass({ * * @param {string} uuid - The requestReplyId for the repliable notification * @param {string} message - The message to reply with - * @param {Object} notification - The original notification packet + * @param {object} notification - The original notification packet */ replyNotification(uuid, message, notification) { // If this happens for some reason, things will explode diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/runcommand.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/runcommand.js index c57c6c0..f4e6cd7 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/runcommand.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/runcommand.js @@ -150,14 +150,14 @@ const RunCommandPlugin = GObject.registerClass({ * Parse the response to a request for the remote command list. Remove the * command menu if there are no commands, otherwise amend the menu. * - * @param {string|Object[]} commandList - A list of remote commands + * @param {string | object[]} commandList - A list of remote commands */ _handleCommandList(commandList) { // See: https://github.com/GSConnect/gnome-shell-extension-gsconnect/issues/1051 if (typeof commandList === 'string') { try { commandList = JSON.parse(commandList); - } catch (e) { + } catch { commandList = {}; } } diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sftp.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sftp.js index 2789ff3..1f2257d 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sftp.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sftp.js @@ -7,6 +7,7 @@ import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import Config from '../../config.js'; +import * as Core from '../core.js'; import Plugin from '../plugin.js'; @@ -246,7 +247,7 @@ const SFTPPlugin = GObject.registerClass({ * Add GSConnect's private key identity to the authentication agent so our * identity can be verified by Android during private key authentication. * - * @return {Promise} A promise for the operation + * @returns {Promise} A promise for the operation */ async _addPrivateKey() { const ssh_add = this._launcher.spawnv([ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/share.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/share.js index 5e382b4..49a0a49 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/share.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/share.js @@ -443,7 +443,7 @@ const FileChooserDialog = GObject.registerClass({ chooser.preview_widget.pixbuf = pixbuf; chooser.preview_widget.visible = true; chooser.preview_widget_active = true; - } catch (e) { + } catch { chooser.preview_widget.visible = false; chooser.preview_widget_active = false; } diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sms.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sms.js index 4a359fd..ed0bbc7 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sms.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sms.js @@ -206,7 +206,7 @@ const SMSPlugin = GObject.registerClass({ /** * Handle a digest of threads. * - * @param {Object[]} messages - A list of message objects + * @param {object[]} messages - A list of message objects * @param {string[]} thread_ids - A list of thread IDs as strings */ _handleDigest(messages, thread_ids) { @@ -244,7 +244,7 @@ const SMSPlugin = GObject.registerClass({ /** * Handle a new single message * - * @param {Object} message - A message object + * @param {object} message - A message object */ _handleMessage(message) { let conversation = null; @@ -261,7 +261,7 @@ const SMSPlugin = GObject.registerClass({ /** * Parse a conversation (thread of messages) and sort them * - * @param {Object[]} thread - A list of sms message objects from a thread + * @param {object[]} thread - A list of sms message objects from a thread */ _handleThread(thread) { // If there are no addresses this will cause major problems... @@ -300,7 +300,7 @@ const SMSPlugin = GObject.registerClass({ /** * Handle a response to telephony.request_conversation(s) * - * @param {Object[]} messages - A list of sms message objects + * @param {object[]} messages - A list of sms message objects */ _handleMessages(messages) { try { @@ -394,7 +394,7 @@ const SMSPlugin = GObject.registerClass({ /** * Send a message * - * @param {Object[]} addresses - A list of address objects + * @param {object[]} addresses - A list of address objects * @param {string} messageBody - The message text * @param {number} [event] - An event bitmask * @param {boolean} [forceSms] - Whether to force SMS @@ -508,8 +508,8 @@ const SMSPlugin = GObject.registerClass({ /** * Try to find a thread_id in @smsPlugin for @addresses. * - * @param {Object[]} addresses - a list of address objects - * @return {string|null} a thread ID + * @param {object[]} addresses - a list of address objects + * @returns {string|null} a thread ID */ getThreadIdForAddresses(addresses = []) { const threads = Object.values(this.threads); diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/systemvolume.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/systemvolume.js index 9db02d1..9d2aa62 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/systemvolume.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/systemvolume.js @@ -2,13 +2,27 @@ // // SPDX-License-Identifier: GPL-2.0-or-later +import GIRepository from 'gi://GIRepository'; +import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import * as Components from '../components/index.js'; import Config from '../../config.js'; +import * as Core from '../core.js'; import Plugin from '../plugin.js'; +let Gvc = null; +try { + // Add gnome-shell's typelib dir to the search path + const typelibDir = GLib.build_filenamev([Config.GNOME_SHELL_LIBDIR, 'gnome-shell']); + GIRepository.Repository.prepend_search_path(typelibDir); + GIRepository.Repository.prepend_library_path(typelibDir); + + Gvc = (await import('gi://Gvc')).default; +} catch {} + + export const Metadata = { label: _('System Volume'), description: _('Enable the paired device to control the system volume'), @@ -73,12 +87,6 @@ const SystemVolumePlugin = GObject.registerClass({ } } - connected() { - super.connected(); - - this._sendSinkList(); - } - /** * Handle a request to change an output * @@ -121,7 +129,7 @@ const SystemVolumePlugin = GObject.registerClass({ * Update the cache for @stream * * @param {Gvc.MixerStream} stream - The stream to cache - * @return {Object} The updated cache object + * @returns {object} The updated cache object */ _updateCache(stream) { const state = { diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/telephony.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/telephony.js index af1dae1..7ce078a 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/telephony.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/telephony.js @@ -8,6 +8,7 @@ import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; import * as Components from '../components/index.js'; +import * as Core from '../core.js'; import Plugin from '../plugin.js'; @@ -114,7 +115,7 @@ const TelephonyPlugin = GObject.registerClass({ * Load a Gdk.Pixbuf from base64 encoded data * * @param {string} data - Base64 encoded JPEG data - * @return {Gdk.Pixbuf|null} A contact photo + * @returns {GdkPixbuf.Pixbuf|null} A contact photo */ _getThumbnailPixbuf(data) { const loader = new GdkPixbuf.PixbufLoader(); diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/contacts.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/contacts.js index 3ead960..119d757 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/contacts.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/contacts.js @@ -16,7 +16,7 @@ import system from 'system'; * * @param {*} [salt] - If not %null, will be used as salt for generating a color * @param {number} alpha - A value in the [0...1] range for the alpha channel - * @return {Gdk.RGBA} A new Gdk.RGBA object generated from the input + * @returns {Gdk.RGBA} A new Gdk.RGBA object generated from the input */ function randomRGBA(salt = null, alpha = 1.0) { let red, green, blue; @@ -41,7 +41,7 @@ function randomRGBA(salt = null, alpha = 1.0) { * See: https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef * * @param {Gdk.RGBA} rgba - A GdkRGBA object - * @return {number} The relative luminance of the color + * @returns {number} The relative luminance of the color */ function relativeLuminance(rgba) { const {red, green, blue} = rgba; @@ -59,7 +59,7 @@ function relativeLuminance(rgba) { * See: https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef * * @param {Gdk.RGBA} rgba - A GdkRGBA object for the background color - * @return {Gdk.RGBA} A GdkRGBA object for the foreground color + * @returns {Gdk.RGBA} A GdkRGBA object for the foreground color */ function getFgRGBA(rgba) { const bgLuminance = relativeLuminance(rgba); @@ -78,7 +78,7 @@ function getFgRGBA(rgba) { * @param {string} path - A local file path * @param {number} size - Size in pixels * @param {scale} [scale] - Scale factor for the size - * @return {Gdk.Pixbuf} A pixbuf + * @returns {Gdk.Pixbuf} A pixbuf */ function getPixbufForPath(path, size, scale = 1.0) { let data, loader; @@ -107,6 +107,15 @@ function getPixbufForPath(path, size, scale = 1.0) { return pixbuf.scale_simple(size, size, GdkPixbuf.InterpType.HYPER); } +/** + * Retrieve the GdkPixbuf for a named icon + * + * @param {string} name - The icon name to load + * @param {number} size - The pixel size requested + * @param {number} scale - The scale multiplier + * @param {string} bgColor - The background color the icon will be used against + * @returns {GdkPixbuf.pixbuf|null} The icon image + */ function getPixbufForIcon(name, size, scale, bgColor) { const color = getFgRGBA(bgColor); const theme = Gtk.IconTheme.get_default(); @@ -126,7 +135,7 @@ function getPixbufForIcon(name, size, scale, bgColor) { * See: http://www.ietf.org/rfc/rfc2426.txt * * @param {string} type - An RFC2426 phone number type - * @return {string} A localized string like 'Mobile' + * @returns {string} A localized string like 'Mobile' */ function getNumberTypeLabel(type) { if (type.includes('fax')) @@ -152,9 +161,9 @@ function getNumberTypeLabel(type) { /** * Get a display number from @contact for @address. * - * @param {Object} contact - A contact object + * @param {object} contact - A contact object * @param {string} address - A phone number - * @return {string} A (possibly) better display number for the address + * @returns {string} A (possibly) better display number for the address */ export function getDisplayNumber(contact, address) { const number = address.toPhoneNumber(); @@ -623,7 +632,7 @@ export const ContactChooser = GObject.registerClass({ /** * Get a dictionary of number-contact pairs for each selected phone number. * - * @return {Object[]} A dictionary of contacts + * @returns {object[]} A dictionary of contacts */ getSelected() { try { @@ -639,4 +648,3 @@ export const ContactChooser = GObject.registerClass({ } } }); - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/messaging.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/messaging.js index 6f53584..40cc5e5 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/messaging.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/messaging.js @@ -92,7 +92,7 @@ const _cFormat = new Intl.DateTimeFormat('default', { * Return a human-readable timestamp, formatted for longer contexts. * * @param {number} time - Milliseconds since the epoch (local time) - * @return {string} A localized timestamp similar to what Android Messages uses + * @returns {string} A localized timestamp similar to what Android Messages uses */ function getTime(time) { const date = new Date(time); @@ -134,7 +134,7 @@ function getTime(time) { * Return a human-readable timestamp, formatted for shorter contexts. * * @param {number} time - Milliseconds since the epoch (local time) - * @return {string} A localized timestamp similar to what Android Messages uses + * @returns {string} A localized timestamp similar to what Android Messages uses */ function getShortTime(time) { const date = new Date(time); @@ -175,13 +175,19 @@ function getShortTime(time) { * Return a human-readable timestamp, similar to `strftime()` with `%c`. * * @param {number} time - Milliseconds since the epoch (local time) - * @return {string} A localized timestamp + * @returns {string} A localized timestamp */ function getDetailedTime(time) { return _cFormat.format(time); } +/** + * Make the avatar for an incoming message visible or invisible + * + * @param {ConversationMessage} row - The message row to modify + * @param {boolean} visible - Whether the avatar should be visible + */ function setAvatarVisible(row, visible) { const incoming = row.message.type === Sms.MessageBox.INBOX; @@ -546,8 +552,8 @@ const Conversation = GObject.registerClass({ * Create a message row, ensuring a contact object has been retrieved or * generated for the message. * - * @param {Object} message - A dictionary of message data - * @return {ConversationMessage} A message row + * @param {object} message - A dictionary of message data + * @returns {ConversationMessage} A message row */ _createMessageRow(message) { // Ensure we have a contact @@ -655,7 +661,7 @@ const Conversation = GObject.registerClass({ /** * Log the next message in the conversation. * - * @param {Object} message - A message object + * @param {object} message - A message object */ logNext(message) { try { @@ -1073,8 +1079,8 @@ export const Window = GObject.registerClass({ /** * Find the thread row for @contacts * - * @param {Object[]} contacts - A contact group - * @return {ConversationSummary|null} The thread row or %null + * @param {object[]} contacts - A contact group + * @returns {ConversationSummary|null} The thread row or %null */ _getRowForContacts(contacts) { const addresses = Object.keys(contacts).map(address => { @@ -1156,8 +1162,8 @@ export const Window = GObject.registerClass({ /** * Try and find an existing conversation widget for @message. * - * @param {Object} message - A message object - * @return {Conversation|null} A conversation widget or %null + * @param {object} message - A message object + * @returns {Conversation|null} A conversation widget or %null */ getConversationForMessage(message) { // TODO: This shouldn't happen? @@ -1317,4 +1323,3 @@ export const ConversationChooser = GObject.registerClass({ this.destroy(); } }); - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/dbus.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/dbus.js index f4a9d67..bcea5ad 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/dbus.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/dbus.js @@ -11,12 +11,26 @@ import GObject from 'gi://GObject'; /* * Some utility methods */ + +/** + * Convert a label from kebab-case to CamelCase. + * Will also remove snake_case separators (without capitalizing) + * + * @param {string} string - The label to reformat + * @returns {string} The CamelCased label + */ function toDBusCase(string) { return string.replace(/(?:^\w|[A-Z]|\b\w)/g, (ltr, offset) => { return ltr.toUpperCase(); }).replace(/[\s_-]+/g, ''); } +/** + * Convert a label from CamelCase to snake_case. + * + * @param {string} string - The label to reformat + * @returns {string} - The snake_cased label + */ function toUnderscoreCase(string) { return string.replace(/(?:^\w|[A-Z]|_|\b\w)/g, (ltr, offset) => { if (ltr === '_') @@ -95,7 +109,7 @@ export const Interface = GObject.registerClass({ * Invoke an instance's method for a DBus method call. * * @param {Gio.DBusInterfaceInfo} info - The DBus interface - * @param {DBus.Interface} iface - The DBus interface + * @param {Gio.DBusInterface} iface - The DBus interface * @param {string} name - The DBus method name * @param {GLib.Variant} parameters - The method parameters * @param {Gio.DBusMethodInvocation} invocation - The method invocation info @@ -231,7 +245,7 @@ export const Interface = GObject.registerClass({ * * @param {Gio.BusType} [busType] - a Gio.BusType constant * @param {Gio.Cancellable} [cancellable] - an optional Gio.Cancellable - * @return {Promise} A new DBus connection + * @returns {Promise} A new DBus connection */ export function newConnection(busType = Gio.BusType.SESSION, cancellable = null) { return new Promise((resolve, reject) => { @@ -252,4 +266,3 @@ export function newConnection(busType = Gio.BusType.SESSION, cancellable = null) }); } - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/uri.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/uri.js index e7fca2c..11cbd74 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/uri.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/utils/uri.js @@ -79,7 +79,7 @@ const _numberRegex = new RegExp( * the position within @str where the URL was found. * * @param {string} str - the string to search - * @return {Object[]} the list of match objects, as described above + * @returns {object[]} the list of match objects, as described above */ export function findUrls(str) { _urlRegexp.lastIndex = 0; @@ -103,7 +103,7 @@ export function findUrls(str) { * * @param {string} str - The string to be modified * @param {string} [title] - An optional title (eg. alt text, tooltip) - * @return {string} the modified text + * @returns {string} the modified text */ export function linkify(str, title = null) { const text = GLib.markup_escape_text(str, -1); @@ -166,4 +166,3 @@ export default class URI { return this.body ? `${uri}?body=${escape(this.body)}` : uri; } } - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/clipboard.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/clipboard.js index c9b61f3..db28b9e 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/clipboard.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/clipboard.js @@ -172,7 +172,7 @@ export const Clipboard = GObject.registerClass({ invocation.return_value(retval); // Without a response, the client will wait for timeout - } catch (e) { + } catch { invocation.return_dbus_error( 'org.gnome.gjs.JSError.ValueError', 'Service implementation returned an incorrect value type' @@ -183,7 +183,7 @@ export const Clipboard = GObject.registerClass({ /** * Get the available mimetypes of the current clipboard content * - * @return {Promise} A list of mime-types + * @returns {Promise} A list of mime-types */ GetMimetypes() { return new Promise((resolve, reject) => { @@ -202,7 +202,7 @@ export const Clipboard = GObject.registerClass({ /** * Get the text content of the clipboard * - * @return {Promise} Text content of the clipboard + * @returns {Promise} Text content of the clipboard */ GetText() { return new Promise((resolve, reject) => { @@ -241,7 +241,7 @@ export const Clipboard = GObject.registerClass({ * Set the text content of the clipboard * * @param {string} text - text content to set - * @return {Promise} A promise for the operation + * @returns {Promise} A promise for the operation */ SetText(text) { return new Promise((resolve, reject) => { @@ -270,7 +270,7 @@ export const Clipboard = GObject.registerClass({ * Get the content of the clipboard with the type @mimetype. * * @param {string} mimetype - the mimetype to request - * @return {Promise} The content of the clipboard + * @returns {Promise} The content of the clipboard */ GetValue(mimetype) { return new Promise((resolve, reject) => { @@ -300,7 +300,7 @@ export const Clipboard = GObject.registerClass({ * * @param {Uint8Array} value - the value to set * @param {string} mimetype - the mimetype of the value - * @return {Promise} - A promise for the operation + * @returns {Promise} - A promise for the operation */ SetValue(value, mimetype) { return new Promise((resolve, reject) => { @@ -377,4 +377,3 @@ export function unwatchService() { _portalId = 0; } } - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/gmenu.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/gmenu.js index 62ae0f1..c85e982 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/gmenu.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/gmenu.js @@ -10,7 +10,7 @@ import St from 'gi://St'; import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; -import {getIcon} from './utils.js'; +import {HAS_ST_ORIENTATION, getIcon} from './utils.js'; import Tooltip from './tooltip.js'; @@ -20,7 +20,7 @@ import Tooltip from './tooltip.js'; * * @param {Gio.MenuModel} model - The menu model containing the item * @param {number} index - The index of the item in @model - * @return {Object} A dictionary of the item's attributes + * @returns {object} A dictionary of the item's attributes */ function getItemInfo(model, index) { const info = { @@ -92,12 +92,19 @@ export class ListBox extends PopupMenu.PopupMenuSection { this.actor.add_child(this.box); // Submenu Container - this.sub = new St.BoxLayout({ - clip_to_allocation: true, - vertical: false, - visible: false, - x_expand: true, - }); + this.sub = HAS_ST_ORIENTATION + ? new St.BoxLayout({ + clip_to_allocation: true, + orientation: Clutter.Orientation.HORIZONTAL, // GNOME 48 + visible: false, + x_expand: true, + }) + : new St.BoxLayout({ + clip_to_allocation: true, + vertical: false, // GNOME 46/47 + visible: false, + x_expand: true, + }); this.sub.set_pivot_point(1, 1); this.sub._delegate = this; this.actor.add_child(this.sub); @@ -464,24 +471,38 @@ export class IconBox extends PopupMenu.PopupMenuSection { Object.assign(this, params); // Main Actor - this.actor = new St.BoxLayout({ - vertical: true, - x_expand: true, - }); + this.actor = HAS_ST_ORIENTATION + ? new St.BoxLayout({ + orientation: Clutter.Orientation.VERTICAL, // GNOME 48 + x_expand: true, + }) + : new St.BoxLayout({ + vertical: true, // GNOME 46/47 + x_expand: true, + }); this.actor._delegate = this; // Button Box this.box._delegate = this; this.box.style_class = 'gsconnect-icon-box'; - this.box.vertical = false; + if (HAS_ST_ORIENTATION) + this.box.orientation = Clutter.Orientation.HORIZONTAL; // GNOME 48 + else + this.box.vertical = false; // GNOME 46/47 this.actor.add_child(this.box); // Submenu Container - this.sub = new St.BoxLayout({ - clip_to_allocation: true, - vertical: true, - x_expand: true, - }); + this.sub = HAS_ST_ORIENTATION + ? new St.BoxLayout({ + clip_to_allocation: true, + orientation: Clutter.Orientation.VERTICAL, // GNOME 48 + x_expand: true, + }) + : new St.BoxLayout({ + clip_to_allocation: true, + vertical: true, // GNOME 46/47 + x_expand: true, + }); this.sub.connect('transitions-completed', this._onTransitionsCompleted); this.sub._delegate = this; this.actor.add_child(this.sub); @@ -644,4 +665,3 @@ export class IconBox extends PopupMenu.PopupMenuSection { this._onItemsChanged(this.model, 0, 0, this.model.get_n_items()); } } - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/keybindings.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/keybindings.js index 442fa0d..55031df 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/keybindings.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/keybindings.js @@ -49,7 +49,7 @@ export class Manager { * * @param {string} accelerator - An accelerator in the form 'q' * @param {Function} callback - A callback for the accelerator - * @return {number} A non-zero action id on success, or 0 on failure + * @returns {*} A non-zero action id on success, or 0 on failure */ add(accelerator, callback) { try { @@ -100,4 +100,3 @@ export class Manager { this.removeAll(); } } - 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 a6940d2..4b95dd7 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,11 +9,14 @@ 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'; -import {getIcon} from './utils.js'; +import {HAS_MESSAGELIST_NOTIFICATIONMESSAGE, getIcon} from './utils.js'; + +const {NotificationMessage} = HAS_MESSAGELIST_NOTIFICATIONMESSAGE + ? await import('resource:///org/gnome/shell/ui/messageList.js') // GNOME 48 + : await import('resource:///org/gnome/shell/ui/calendar.js'); // GNOME 46/47 const APP_ID = 'org.gnome.Shell.Extensions.GSConnect'; const APP_PATH = '/org/gnome/Shell/Extensions/GSConnect'; @@ -29,6 +32,7 @@ const REPLY_REGEX = new RegExp(/^([^|]+)\|([\s\S]+)\|([0-9a-f]{8}-[0-9a-f]{4}-[1 /** * Extracted from notificationDaemon.js, as it's no longer exported * https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/notificationDaemon.js#L556 + * * @returns {{ 'desktop-startup-id': string }} Object with ID containing current time */ function getPlatformData() { @@ -45,7 +49,7 @@ const GtkNotificationDaemon = Main.notificationDaemon._gtkNotificationDaemon.con */ const NotificationBanner = GObject.registerClass({ GTypeName: 'GSConnectNotificationBanner', -}, class NotificationBanner extends Calendar.NotificationMessage { +}, class NotificationBanner extends NotificationMessage { constructor(notification) { super(notification); @@ -147,7 +151,7 @@ const NotificationBanner = GObject.registerClass({ (connection, res) => { try { connection.call_finish(res); - } catch (e) { + } catch { // Silence errors } } @@ -198,7 +202,7 @@ const Source = GObject.registerClass({ (connection, res) => { try { connection.call_finish(res); - } catch (e) { + } catch { // If we fail, reset in case we can try again notification._remoteClosed = false; } @@ -384,11 +388,17 @@ const _ensureAppSource = function (appId) { }; +/** + * Update the prototype for {@link GtkNotificationDaemon}. + */ export function patchGtkNotificationDaemon() { GtkNotificationDaemon.prototype._ensureAppSource = _ensureAppSource; } +/** + * Restore the prototype for {@link GtkNotificationDaemon}. + */ export function unpatchGtkNotificationDaemon() { GtkNotificationDaemon.prototype._ensureAppSource = __ensureAppSource; } @@ -399,6 +409,9 @@ export function unpatchGtkNotificationDaemon() { */ const _addNotification = NotificationDaemon.GtkNotificationDaemonAppSource.prototype.addNotification; +/** + * Update the prototype for {@link NotificationDaemon.GtkNotificationDaemonAppSource}. + */ export function patchGtkNotificationSources() { // eslint-disable-next-line func-style const _withdrawGSConnectNotification = function (id, notification, reason) { @@ -433,7 +446,7 @@ export function patchGtkNotificationSources() { (connection, res) => { try { connection.call_finish(res); - } catch (e) { + } catch { // If we fail, reset in case we can try again notification._remoteWithdrawn = false; } @@ -445,8 +458,10 @@ export function patchGtkNotificationSources() { } +/** + * Restore the prototype for {@link NotificationDaemon.GtkNotificationDaemonAppSource}. + */ export function unpatchGtkNotificationSources() { NotificationDaemon.GtkNotificationDaemonAppSource.prototype.addNotification = _addNotification; delete NotificationDaemon.GtkNotificationDaemonAppSource.prototype._withdrawGSConnectNotification; } - diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/tooltip.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/tooltip.js index 319621d..1f6acd1 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/tooltip.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/tooltip.js @@ -10,6 +10,7 @@ import St from 'gi://St'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; +import {HAS_ST_ORIENTATION} from './utils.js'; /** * An StTooltip for ClutterActors @@ -151,7 +152,15 @@ export default class Tooltip { if (this.custom) { this._bin.child = this.custom; } else { - this._bin.child = new St.BoxLayout({vertical: false}); + if (HAS_ST_ORIENTATION) { + // GNOME 48 + this._bin.child = new St.BoxLayout( + {orientation: Clutter.Orientation.HORIZONTAL} + ); + } else { + // GNOME 46/47 + this._bin.child = new St.BoxLayout({vertical: false}); + } if (this.gicon) { this._bin.child.icon = new St.Icon({ diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/utils.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/utils.js index beea462..f250ffc 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/utils.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/shell/utils.js @@ -3,22 +3,22 @@ // SPDX-License-Identifier: GPL-2.0-or-later import Gio from 'gi://Gio'; -import GLib from 'gi://GLib'; import Gtk from 'gi://Gtk'; +import St from 'gi://St'; -import Config from '../config.js'; +import {PACKAGE_VERSION} from 'resource:///org/gnome/shell/misc/config.js'; -let St = null; // St is not available for prefs.js importing this file. -try { - St = (await import('gi://St')).default; -} catch (e) { } +export const SHELL_MAJOR_VERSION = Number(PACKAGE_VERSION.split('.')[0]); + +export const HAS_ST_ORIENTATION = SHELL_MAJOR_VERSION >= 48; +export const HAS_MESSAGELIST_NOTIFICATIONMESSAGE = SHELL_MAJOR_VERSION >= 48; /** * Get a themed icon, using fallbacks from GSConnect's GResource when necessary. * * @param {string} name - A themed icon name - * @return {Gio.Icon} A themed icon + * @returns {Gio.Icon} A themed icon */ export function getIcon(name) { if (getIcon._resource === undefined) { @@ -64,220 +64,3 @@ export function getIcon(name) { // Fallback to hoping it's in the theme somewhere return new Gio.ThemedIcon({name: name}); } - - -/** - * Get the contents of a GResource file, replacing `@PACKAGE_DATADIR@` where - * necessary. - * - * @param {string} relativePath - A path relative to GSConnect's resource path - * @return {string} The file contents as a string - */ -function getResource(relativePath) { - try { - const bytes = Gio.resources_lookup_data( - GLib.build_filenamev([Config.APP_PATH, relativePath]), - Gio.ResourceLookupFlags.NONE - ); - - const source = new TextDecoder().decode(bytes.toArray()); - - return source.replace('@PACKAGE_DATADIR@', Config.PACKAGE_DATADIR); - } catch (e) { - logError(e, 'GSConnect'); - return null; - } -} - - -/** - * Install file contents, to an absolute directory path. - * - * @param {string} dirname - An absolute directory path - * @param {string} basename - The file name - * @param {string} contents - The file contents - * @return {boolean} A success boolean - */ -function _installFile(dirname, basename, contents) { - try { - const filename = GLib.build_filenamev([dirname, basename]); - GLib.mkdir_with_parents(dirname, 0o755); - - return GLib.file_set_contents(filename, contents); - } catch (e) { - logError(e, 'GSConnect'); - return false; - } -} - -/** - * Install file contents from a GResource, to an absolute directory path. - * - * @param {string} dirname - An absolute directory path - * @param {string} basename - The file name - * @param {string} relativePath - A path relative to GSConnect's resource path - * @return {boolean} A success boolean - */ -function _installResource(dirname, basename, relativePath) { - try { - const contents = getResource(relativePath); - - return _installFile(dirname, basename, contents); - } catch (e) { - logError(e, 'GSConnect'); - return false; - } -} - -/** - * Use Gio.File to ensure a file's executable bits are set. - * - * @param {string} filepath - An absolute path to a file - * @returns {boolean} - True if the file already was, or is now, executable - */ -function _setExecutable(filepath) { - try { - const file = Gio.File.new_for_path(filepath); - const finfo = file.query_info( - `${Gio.FILE_ATTRIBUTE_STANDARD_TYPE},${Gio.FILE_ATTRIBUTE_UNIX_MODE}`, - Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, - null); - - if (!finfo.has_attribute(Gio.FILE_ATTRIBUTE_UNIX_MODE)) - return false; - - const mode = finfo.get_attribute_uint32( - Gio.FILE_ATTRIBUTE_UNIX_MODE); - const new_mode = (mode | 0o111); - if (mode === new_mode) - return true; - - return file.set_attribute_uint32( - Gio.FILE_ATTRIBUTE_UNIX_MODE, - new_mode, - Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, - null); - } catch (e) { - logError(e, 'GSConnect'); - return false; - } -} - -/** - * Ensure critical files in the extension directory have the - * correct permissions. - */ -export function ensurePermissions() { - if (Config.IS_USER) { - const executableFiles = [ - 'gsconnect-preferences', - 'service/daemon.js', - 'service/nativeMessagingHost.js', - ]; - for (const file of executableFiles) - _setExecutable(GLib.build_filenamev([Config.PACKAGE_DATADIR, file])); - } -} - -/** - * Install the files necessary for the GSConnect service to run. - */ -export function installService() { - const settings = new Gio.Settings({ - settings_schema: Config.GSCHEMA.lookup( - 'org.gnome.Shell.Extensions.GSConnect', - null - ), - path: '/org/gnome/shell/extensions/gsconnect/', - }); - - const confDir = GLib.get_user_config_dir(); - const dataDir = GLib.get_user_data_dir(); - const homeDir = GLib.get_home_dir(); - - // DBus Service - const dbusDir = GLib.build_filenamev([dataDir, 'dbus-1', 'services']); - const dbusFile = `${Config.APP_ID}.service`; - - // Desktop Entry - const appDir = GLib.build_filenamev([dataDir, 'applications']); - const appFile = `${Config.APP_ID}.desktop`; - const appPrefsFile = `${Config.APP_ID}.Preferences.desktop`; - - // Application Icon - const iconDir = GLib.build_filenamev([dataDir, 'icons', 'hicolor', 'scalable', 'apps']); - const iconFull = `${Config.APP_ID}.svg`; - const iconSym = `${Config.APP_ID}-symbolic.svg`; - - // File Manager Extensions - const fileManagers = [ - [`${dataDir}/nautilus-python/extensions`, 'nautilus-gsconnect.py'], - [`${dataDir}/nemo-python/extensions`, 'nemo-gsconnect.py'], - ]; - - // WebExtension Manifests - const manifestFile = 'org.gnome.shell.extensions.gsconnect.json'; - const google = getResource(`webextension/${manifestFile}.google.in`); - const mozilla = getResource(`webextension/${manifestFile}.mozilla.in`); - const manifests = [ - [`${confDir}/chromium/NativeMessagingHosts/`, google], - [`${confDir}/google-chrome/NativeMessagingHosts/`, google], - [`${confDir}/google-chrome-beta/NativeMessagingHosts/`, google], - [`${confDir}/google-chrome-unstable/NativeMessagingHosts/`, google], - [`${confDir}/BraveSoftware/Brave-Browser/NativeMessagingHosts/`, google], - [`${confDir}/BraveSoftware/Brave-Browser-Beta/NativeMessagingHosts/`, google], - [`${confDir}/BraveSoftware/Brave-Browser-Nightly/NativeMessagingHosts/`, google], - [`${homeDir}/.mozilla/native-messaging-hosts/`, mozilla], - [`${homeDir}/.config/microsoft-edge-dev/NativeMessagingHosts`, google], - [`${homeDir}/.config/microsoft-edge-beta/NativeMessagingHosts`, google], - ]; - - // If running as a user extension, ensure the DBus service, desktop entry, - // file manager scripts, and WebExtension manifests are installed. - if (Config.IS_USER) { - // DBus Service - if (!_installResource(dbusDir, dbusFile, `${dbusFile}.in`)) - throw Error('GSConnect: Failed to install DBus Service'); - - // Desktop Entries - _installResource(appDir, appFile, appFile); - _installResource(appDir, appPrefsFile, appPrefsFile); - - // Application Icon - _installResource(iconDir, iconFull, `icons/${iconFull}`); - _installResource(iconDir, iconSym, `icons/${iconSym}`); - - // File Manager Extensions - const target = `${Config.PACKAGE_DATADIR}/nautilus-gsconnect.py`; - - for (const [dir, name] of fileManagers) { - const script = Gio.File.new_for_path(GLib.build_filenamev([dir, name])); - - if (!script.query_exists(null)) { - GLib.mkdir_with_parents(dir, 0o755); - script.make_symbolic_link(target, null); - } - } - - // WebExtension Manifests - if (settings.get_boolean('create-native-messaging-hosts')) { - for (const [dirname, contents] of manifests) - _installFile(dirname, manifestFile, contents); - } - - // Otherwise, if running as a system extension, ensure anything previously - // installed when running as a user extension is removed. - } else { - GLib.unlink(GLib.build_filenamev([dbusDir, dbusFile])); - GLib.unlink(GLib.build_filenamev([appDir, appFile])); - GLib.unlink(GLib.build_filenamev([appDir, appPrefsFile])); - GLib.unlink(GLib.build_filenamev([iconDir, iconFull])); - GLib.unlink(GLib.build_filenamev([iconDir, iconSym])); - - for (const [dir, name] of fileManagers) - GLib.unlink(GLib.build_filenamev([dir, name])); - - for (const manifest of manifests) - GLib.unlink(GLib.build_filenamev([manifest[0], manifestFile])); - } -} diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/utils/remote.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/utils/remote.js index 44760cd..b663671 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/utils/remote.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/utils/remote.js @@ -22,6 +22,13 @@ const _PROPERTIES = { }; +/** + * Initialize a Gio.DBusProxy in an awaitable manner + * + * @param {Gio.DBusProxy} proxy - The proxy object to initialize + * @param {Gio.Cancellable} [cancellable] - An optional cancellable object + * @returns {Promise} An awaitable Promise + */ function _proxyInit(proxy, cancellable = null) { if (proxy.__initialized !== undefined) return Promise.resolve(); @@ -127,7 +134,7 @@ export const Device = GObject.registerClass({ _get(name, fallback = null) { try { return this.get_cached_property(name).unpack(); - } catch (e) { + } catch { return fallback; } } @@ -297,7 +304,7 @@ export const Service = GObject.registerClass({ * org.freedesktop.DBus.ObjectManager.InterfacesAdded * * @param {string} object_path - Path interfaces have been added to - * @param {Object} interfaces - A dictionary of interface objects + * @param {object} interfaces - A dictionary of interface objects */ async _onInterfacesAdded(object_path, interfaces) { try { diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/utils/setup.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/utils/setup.js index eef58dc..d420a75 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/utils/setup.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/utils/setup.js @@ -21,11 +21,228 @@ export function setupGettext() { globalThis.ngettext = GLib.dngettext.bind(null, Config.APP_ID); } +/** + * Get the contents of a GResource file, replacing `@PACKAGE_DATADIR@` where + * necessary. + * + * @param {string} relativePath - A path relative to GSConnect's resource path + * @returns {string} The file contents as a string + */ +function getResource(relativePath) { + try { + const bytes = Gio.resources_lookup_data( + GLib.build_filenamev([Config.APP_PATH, relativePath]), + Gio.ResourceLookupFlags.NONE + ); + + const source = new TextDecoder().decode(bytes.toArray()); + + return source.replace('@PACKAGE_DATADIR@', Config.PACKAGE_DATADIR); + } catch (e) { + logError(e, 'GSConnect'); + return null; + } +} + + +/** + * Install file contents, to an absolute directory path. + * + * @param {string} dirname - An absolute directory path + * @param {string} basename - The file name + * @param {string} contents - The file contents + * @returns {boolean} A success boolean + */ +function _installFile(dirname, basename, contents) { + try { + const filename = GLib.build_filenamev([dirname, basename]); + GLib.mkdir_with_parents(dirname, 0o755); + + return GLib.file_set_contents(filename, contents); + } catch (e) { + logError(e, 'GSConnect'); + return false; + } +} + +/** + * Install file contents from a GResource, to an absolute directory path. + * + * @param {string} dirname - An absolute directory path + * @param {string} basename - The file name + * @param {string} relativePath - A path relative to GSConnect's resource path + * @returns {boolean} A success boolean + */ +function _installResource(dirname, basename, relativePath) { + try { + const contents = getResource(relativePath); + + return _installFile(dirname, basename, contents); + } catch (e) { + logError(e, 'GSConnect'); + return false; + } +} + +/** + * Use Gio.File to ensure a file's executable bits are set. + * + * @param {string} filepath - An absolute path to a file + * @returns {boolean} - True if the file already was, or is now, executable + */ +function _setExecutable(filepath) { + try { + const file = Gio.File.new_for_path(filepath); + const finfo = file.query_info( + `${Gio.FILE_ATTRIBUTE_STANDARD_TYPE},${Gio.FILE_ATTRIBUTE_UNIX_MODE}`, + Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, + null); + + if (!finfo.has_attribute(Gio.FILE_ATTRIBUTE_UNIX_MODE)) + return false; + + const mode = finfo.get_attribute_uint32( + Gio.FILE_ATTRIBUTE_UNIX_MODE); + const new_mode = (mode | 0o111); + if (mode === new_mode) + return true; + + return file.set_attribute_uint32( + Gio.FILE_ATTRIBUTE_UNIX_MODE, + new_mode, + Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, + null); + } catch (e) { + logError(e, 'GSConnect'); + return false; + } +} + +/** + * Ensure critical files in the extension directory have the + * correct permissions. + */ +export function ensurePermissions() { + if (Config.IS_USER) { + const executableFiles = [ + 'gsconnect-preferences', + 'service/daemon.js', + 'service/nativeMessagingHost.js', + ]; + for (const file of executableFiles) + _setExecutable(GLib.build_filenamev([Config.PACKAGE_DATADIR, file])); + } +} + +/** + * Install the files necessary for the GSConnect service to run. + */ +export function installService() { + const settings = new Gio.Settings({ + settings_schema: Config.GSCHEMA.lookup( + 'org.gnome.Shell.Extensions.GSConnect', + null + ), + path: '/org/gnome/shell/extensions/gsconnect/', + }); + + const confDir = GLib.get_user_config_dir(); + const dataDir = GLib.get_user_data_dir(); + const homeDir = GLib.get_home_dir(); + + // DBus Service + const dbusDir = GLib.build_filenamev([dataDir, 'dbus-1', 'services']); + const dbusFile = `${Config.APP_ID}.service`; + + // Desktop Entry + const appDir = GLib.build_filenamev([dataDir, 'applications']); + const appFile = `${Config.APP_ID}.desktop`; + const appPrefsFile = `${Config.APP_ID}.Preferences.desktop`; + + // Application Icon + const iconDir = GLib.build_filenamev([dataDir, 'icons', 'hicolor', 'scalable', 'apps']); + const iconFull = `${Config.APP_ID}.svg`; + const iconSym = `${Config.APP_ID}-symbolic.svg`; + + // File Manager Extensions + const fileManagers = [ + [`${dataDir}/nautilus-python/extensions`, 'nautilus-gsconnect.py'], + [`${dataDir}/nemo-python/extensions`, 'nemo-gsconnect.py'], + ]; + + // WebExtension Manifests + const manifestFile = 'org.gnome.shell.extensions.gsconnect.json'; + const google = getResource(`webextension/${manifestFile}.google.in`); + const mozilla = getResource(`webextension/${manifestFile}.mozilla.in`); + const manifests = [ + [`${confDir}/chromium/NativeMessagingHosts/`, google], + [`${confDir}/google-chrome/NativeMessagingHosts/`, google], + [`${confDir}/google-chrome-beta/NativeMessagingHosts/`, google], + [`${confDir}/google-chrome-unstable/NativeMessagingHosts/`, google], + [`${confDir}/BraveSoftware/Brave-Browser/NativeMessagingHosts/`, google], + [`${confDir}/BraveSoftware/Brave-Browser-Beta/NativeMessagingHosts/`, google], + [`${confDir}/BraveSoftware/Brave-Browser-Nightly/NativeMessagingHosts/`, google], + [`${homeDir}/.mozilla/native-messaging-hosts/`, mozilla], + [`${homeDir}/.config/microsoft-edge-dev/NativeMessagingHosts`, google], + [`${homeDir}/.config/microsoft-edge-beta/NativeMessagingHosts`, google], + ]; + + // If running as a user extension, ensure the DBus service, desktop entry, + // file manager scripts, and WebExtension manifests are installed. + if (Config.IS_USER) { + // DBus Service + if (!_installResource(dbusDir, dbusFile, `${dbusFile}.in`)) + throw Error('GSConnect: Failed to install DBus Service'); + + // Desktop Entries + _installResource(appDir, appFile, appFile); + _installResource(appDir, appPrefsFile, appPrefsFile); + + // Application Icon + _installResource(iconDir, iconFull, `icons/${iconFull}`); + _installResource(iconDir, iconSym, `icons/${iconSym}`); + + // File Manager Extensions + const target = `${Config.PACKAGE_DATADIR}/nautilus-gsconnect.py`; + + for (const [dir, name] of fileManagers) { + const script = Gio.File.new_for_path(GLib.build_filenamev([dir, name])); + + if (!script.query_exists(null)) { + GLib.mkdir_with_parents(dir, 0o755); + script.make_symbolic_link(target, null); + } + } + + // WebExtension Manifests + if (settings.get_boolean('create-native-messaging-hosts')) { + for (const [dirname, contents] of manifests) + _installFile(dirname, manifestFile, contents); + } + + // Otherwise, if running as a system extension, ensure anything previously + // installed when running as a user extension is removed. + } else { + GLib.unlink(GLib.build_filenamev([dbusDir, dbusFile])); + GLib.unlink(GLib.build_filenamev([appDir, appFile])); + GLib.unlink(GLib.build_filenamev([appDir, appPrefsFile])); + GLib.unlink(GLib.build_filenamev([iconDir, iconFull])); + GLib.unlink(GLib.build_filenamev([iconDir, iconSym])); + + for (const [dir, name] of fileManagers) + GLib.unlink(GLib.build_filenamev([dir, name])); + + for (const manifest of manifests) + GLib.unlink(GLib.build_filenamev([manifest[0], manifestFile])); + } +} + /** * Initialise and setup Config, GResources and GSchema. + * * @param {string} extensionPath - The absolute path to the extension directory */ -export default function setup(extensionPath) { +export function setup(extensionPath) { // Ensure config.js is setup properly Config.PACKAGE_DATADIR = extensionPath; const userDir = GLib.build_filenamev([GLib.get_user_data_dir(), 'gnome-shell']); diff --git a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/wl_clipboard.js b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/wl_clipboard.js index 8e1dedd..ec7abe9 100644 --- a/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/wl_clipboard.js +++ b/gnome/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/wl_clipboard.js @@ -141,7 +141,7 @@ export const Clipboard = GObject.registerClass( invocation.return_value(retval); // Without a response, the client will wait for timeout - } catch (e) { + } catch { invocation.return_dbus_error( 'org.gnome.gjs.JSError.ValueError', 'Service implementation returned an incorrect value type' @@ -150,11 +150,10 @@ export const Clipboard = GObject.registerClass( } /** - * Get the available mimetypes of the current clipboard content - * - * @return {Promise} A list of mime-types - */ - + * Get the available mimetypes of the current clipboard content + * + * @returns {Promise} A list of mime-types + */ GetMimetypes() { return new Promise((resolve, reject) => { const proc = launcher.spawnv([ @@ -179,10 +178,10 @@ export const Clipboard = GObject.registerClass( } /** - * Get the text content of the clipboard - * - * @return {Promise} Text content of the clipboard - */ + * Get the text content of the clipboard + * + * @returns {Promise} Text content of the clipboard + */ GetText() { return new Promise((resolve, reject) => { this.GetMimetypes().then((mimetypes) => { @@ -213,11 +212,11 @@ export const Clipboard = GObject.registerClass( } /** - * Set the text content of the clipboard - * - * @param {string} text - text content to set - * @return {Promise} A promise for the operation - */ + * Set the text content of the clipboard + * + * @param {string} text - text content to set + * @returns {Promise} A promise for the operation + */ SetText(text) { return new Promise((resolve, reject) => { try { diff --git a/gnome/.local/share/gnome-shell/extensions/impatience@gfxmonk.net/metadata.json b/gnome/.local/share/gnome-shell/extensions/impatience@gfxmonk.net/metadata.json index 66f450c..4548db6 100644 --- a/gnome/.local/share/gnome-shell/extensions/impatience@gfxmonk.net/metadata.json +++ b/gnome/.local/share/gnome-shell/extensions/impatience@gfxmonk.net/metadata.json @@ -6,9 +6,10 @@ "shell-version": [ "45", "46", - "47" + "47", + "48" ], "url": "http://gfxmonk.net/dist/0install/gnome-shell-impatience.xml", "uuid": "impatience@gfxmonk.net", - "version": 27 + "version": 28 } \ No newline at end of file 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 aa7faf1..bc4d291 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 @@ -11,9 +11,10 @@ "shell-version": [ "45", "46", - "47" + "47", + "48" ], "url": "https://github.com/shyzus/gnome-shell-extension-screen-autorotate", "uuid": "screen-rotate@shyzus.github.io", "version": 24 -} \ No newline at end of file +} diff --git a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/CHANGELOG.md b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/CHANGELOG.md index 6289aff..de79e68 100644 --- a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/CHANGELOG.md +++ b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/CHANGELOG.md @@ -299,4 +299,15 @@ other: Other ### Fixed - Issue [#24](https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues/24): The "NEVER" indicator mode does not work properly ### Changed -- "Automatic threshold detection disabled" is not convenient (no way to know the status before it is disabled for the first time), we returns to "model detection mode" and keeps "manual mode" (user settings) \ No newline at end of file +- "Automatic threshold detection disabled" is not convenient (no way to know the status before it is disabled for the first time), we returns to "model detection mode" and keeps "manual mode" (user settings) + +## [v50] - 2025-01-06 +### Other +- Update translations (German) +- Minor internal changes + +## [v51] - 2025-02-02 +### Other +- Update translations (Italian) +### Added +- Gnome 48 support \ No newline at end of file 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 index a1dd52c..41a68e1 100644 --- 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 @@ -332,34 +332,9 @@ export const ThinkPadBattery = GObject.registerClass({ logError(e, this.name); } - // Update flags on changes in threshold values - this._startId = this.connect( - 'notify::start-value', () => { - this._updateStatuses(); - } - ); - this._endId = this.connect( - 'notify::end-value', () => { - this._updateStatuses(); - } - ); + this._notifyHandlerId = this.connect('notify', () => this._updateStatuses()); - this._settingStartId = this.settings.connect( - `changed::start-${this.name.toLowerCase()}`, () => { - this._updateStatuses(); - } - ); - this._settingEndId = this.settings.connect( - `changed::end-${this.name.toLowerCase()}`, () => { - this._updateStatuses(); - } - ); - - this._settingDisabledValueId = this.settings.connect( - `changed::disabled-start-${this.name.toLowerCase()}-value`, () => { - this._updateStatuses(); - } - ); + this._settingsHandlerId = this.settings.connect('changed', () => this._updateStatuses()); // Load initial values this.startValue = readFileInt(this._startFilePath); @@ -618,23 +593,11 @@ export const ThinkPadBattery = GObject.registerClass({ } destroy() { - if (this._startId) { - this.disconnect(this._startId); + if (this._notifyHandlerId) { + this.disconnect(this._notifyHandlerId) } - 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._settingDisabledValueId) { - this.settings.disconnect(this._settingDisabledValueId); - } - if (this._monitorId) { - this._baseMonitor.disconnect(this._monitorId); + if (this._settingsHandlerId) { + this.settings.disconnect(this._settingsHandlerId) } this._baseMonitor.cancel(); this._baseMonitor = null; @@ -731,21 +694,8 @@ export const ThinkPad = GObject.registerClass({ // 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 pendingChangesId = battery.connect( - 'notify::pending-changes', (bat) => { - this.pendingChanges = this._checkPendingChanges(); - } - ); + const notifyHandlerId = battery.connect('notify', () => this._updateStatuses()); + const enableCompletedId = battery.connect( 'enable-completed', (bat, error) => { this.emit('enable-battery-completed', bat, error); @@ -756,13 +706,11 @@ export const ThinkPad = GObject.registerClass({ this.emit('disable-battery-completed', bat, error); } ); - this._batteriesId[battery.name] = [isAvailableId, isActiveId, enableCompletedId, disableCompletedId]; + this._batteriesId[battery.name] = [notifyHandlerId, enableCompletedId, disableCompletedId]; }); // Load initial values - this.isAvailable = this._checkAvailable(); - this.isActive = this._checkActive(); - this.pendingChanges = this._checkPendingChanges(); + this._updateStatuses(); } get environment() { @@ -806,35 +754,17 @@ export const ThinkPad = GObject.registerClass({ } /** - * 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 + * Update driver status */ - _checkPendingChanges() { - return this.batteries.some(bat => { - return bat.pendingChanges; + _updateStatuses() { + this.isAvailable = this.batteries.some(bat => { + return bat.isAvailable; }); - } - - /** - * 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 => { + this.isActive = 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; + this.pendingChanges = this.batteries.some(bat => { + return bat.pendingChanges; }); } 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 index 742e14d..45d8140 100644 --- 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 @@ -6,7 +6,7 @@ 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 { 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'; @@ -37,7 +37,7 @@ const BatteryItem = GObject.registerClass({ this._settings = settings; this._battery = battery; - + const box = new St.BoxLayout({ 'opacity': 128, 'x_expand': true, @@ -133,7 +133,7 @@ const BatteryItem = GObject.registerClass({ } 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.setIcon(getIcon('threshold-inactive', colorMode)); this._valuesLabel.visible = false; } // Reload 'button' @@ -166,11 +166,11 @@ const ThresholdToggle = GObject.registerClass({ 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()); + const item = new BatteryItem(battery, extensionObject.getSettings()); this.menu.addMenuItem(item); }); @@ -212,7 +212,7 @@ const ThresholdToggle = GObject.registerClass({ 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; @@ -226,7 +226,7 @@ export const ThresholdIndicator = GObject.registerClass({ super(); this._settings = extensionObject.getSettings(); - this._driver = new ThinkPad({'settings': this._settings}) + this._driver = new ThinkPad({ 'settings': this._settings }) this._name = extensionObject.metadata.name; this._indicator = this._addIndicator(); @@ -240,15 +240,7 @@ export const ThresholdIndicator = GObject.registerClass({ // Driver signals this._driver.connectObject( - 'notify::is-available', () => { - this._updateIndicator(); - }, - 'notify::is-active', () => { - this._updateIndicator(); - }, - 'notify::pending-changes', () => { - this._updateIndicator(); - }, + 'notify', () => this._updateIndicator(), 'enable-battery-completed', (driver, battery, error) => { if (!error) { this._notifyEnabled( @@ -388,27 +380,27 @@ export const ThresholdIndicator = GObject.registerClass({ * @param {string} iconName Icon name * @param {boolean} [transient=true] Transient notification */ - _notify(msg, details, iconName, transient=true) { + _notify(msg, details, iconName, transient = true) { if (!this._settings.get_boolean('show-notifications')) return; 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, true)} + source, + msg, + details, + { gicon: getIcon(iconName, true) } ); notification.setTransient(transient); source.showNotification(notification); } else { - const source = new MessageTray.Source({'title': this._name}); + const source = new MessageTray.Source({ 'title': this._name }); Main.messageTray.add(source); const notification = new MessageTray.Notification({ - source: source, - title: msg, - body: details, - isTransient: transient, + source: source, + title: msg, + body: details, + isTransient: transient, gicon: getIcon(iconName, true) }); source.addNotification(notification); @@ -424,20 +416,20 @@ export const ThresholdIndicator = GObject.registerClass({ this._notify(_('Battery Threshold'), message, 'threshold-error', false); } - /** - * Show enabled notification - * - * @param {string} message Message - */ + /** + * Show enabled notification + * + * @param {string} message Message + */ _notifyEnabled(message) { this._notify(_('Battery Threshold'), message, 'threshold-active'); } - /** - * Show disabled notification - * - * @param {string} message Message - */ + /** + * Show disabled notification + * + * @param {string} message Message + */ _notifyDisabled(message) { this._notify(_('Battery Threshold'), message, 'threshold-inactive'); } 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 index 532a68e..7da4eac 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/de/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo 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/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 index 6dbea71..a249e0e 100644 Binary files a/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/locale/it/LC_MESSAGES/thinkpad-battery-threshold@marcosdalvarez.org.mo 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/metadata.json b/gnome/.local/share/gnome-shell/extensions/thinkpad-battery-threshold@marcosdalvarez.org/metadata.json index e8ff14c..9bd2545 100644 --- 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 @@ -7,9 +7,10 @@ "shell-version": [ "45", "46", - "47" + "47", + "48" ], "url": "https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension", "uuid": "thinkpad-battery-threshold@marcosdalvarez.org", - "version": 49 + "version": 51 } \ No newline at end of file