From e545fcafdf0be80d811907b9ab62dffabd463ce3 Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Thu, 1 Nov 2018 18:10:32 +0100 Subject: [PATCH 1/8] fix reddit source adapter for gnome shell 3.22 --- randomwallpaper@iflow.space/sourceAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 randomwallpaper@iflow.space/sourceAdapter.js diff --git a/randomwallpaper@iflow.space/sourceAdapter.js b/randomwallpaper@iflow.space/sourceAdapter.js old mode 100644 new mode 100755 index ad3e3a1..91d4464 --- a/randomwallpaper@iflow.space/sourceAdapter.js +++ b/randomwallpaper@iflow.space/sourceAdapter.js @@ -369,7 +369,7 @@ var RedditAdapter = new Lang.Class({ const subreddits = this._settings.get('subreddits', 'string').split(',').map(s => s.trim()).join('+'); const require_sfw = this._settings.get('allow-sfw', 'boolean'); - const url = encodeURI(`https://www.reddit.com/r/${subreddits}.json`); + const url = encodeURI('https://www.reddit.com/r/' + subreddits + '.json'); let message = Soup.Message.new('GET', url); From 21496bb78815475d5cdc0622ed359f26a44a358d Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Thu, 1 Nov 2018 19:40:57 +0100 Subject: [PATCH 2/8] clear history cache when extension exits --- randomwallpaper@iflow.space/extension.js | 1 + 1 file changed, 1 insertion(+) diff --git a/randomwallpaper@iflow.space/extension.js b/randomwallpaper@iflow.space/extension.js index 5525928..6fffce4 100644 --- a/randomwallpaper@iflow.space/extension.js +++ b/randomwallpaper@iflow.space/extension.js @@ -50,6 +50,7 @@ function enable() { function disable() { // disable Extension + panelEntry.clearHistoryList(); panelEntry.destroy(); // remove all signal handlers From b89d670eb37eee22ef8c53471d1dc5f345ffbf29 Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Thu, 1 Nov 2018 20:03:30 +0100 Subject: [PATCH 3/8] fix panel icon inheritance Bug report https://bugzilla.gnome.org/show_bug.cgi\?id\=688973 --- randomwallpaper@iflow.space/elements.js | 18 +++++++++--------- randomwallpaper@iflow.space/extension.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/randomwallpaper@iflow.space/elements.js b/randomwallpaper@iflow.space/elements.js index cd6e44f..a8f610b 100644 --- a/randomwallpaper@iflow.space/elements.js +++ b/randomwallpaper@iflow.space/elements.js @@ -230,11 +230,11 @@ var NewWallpaperElement = new Lang.Class({ var StatusElement = new Lang.Class({ Name: 'StatusElement', - Extends: St.Icon, + + icon: null, _init: function () { - - this.parent({ + this.icon = new St.Icon({ icon_name: 'preferences-desktop-wallpaper-symbolic', style_class: 'system-status-icon' }); @@ -243,11 +243,11 @@ var StatusElement = new Lang.Class({ this.loadingTweenIn = { opacity: 20, - time: 1, + time: 2, transition: 'easeInOutSine', onComplete: function () { try { - Tweener.addTween(_this, _this.loadingTweenOut); + Tweener.addTween(_this.icon, _this.loadingTweenOut); } catch (e) { // swollow (not really important) } @@ -261,7 +261,7 @@ var StatusElement = new Lang.Class({ onComplete: function () { if (_this.isLoading) { try { - Tweener.addTween(_this, _this.loadingTweenIn); + Tweener.addTween(_this.icon, _this.loadingTweenIn); } catch (e) { // swollow (not really important) } @@ -276,13 +276,13 @@ var StatusElement = new Lang.Class({ startLoading: function () { this.isLoading = true; - Tweener.addTween(this, this.loadingTweenOut); + Tweener.addTween(this.icon, this.loadingTweenOut); }, stopLoading: function () { this.isLoading = false; - Tweener.removeTweens(this); - this.opacity = 255; + Tweener.removeTweens(this.icon); + this.icon.opacity = 255; } }); diff --git a/randomwallpaper@iflow.space/extension.js b/randomwallpaper@iflow.space/extension.js index 6fffce4..6e717a3 100644 --- a/randomwallpaper@iflow.space/extension.js +++ b/randomwallpaper@iflow.space/extension.js @@ -84,7 +84,7 @@ var RandomWallpaperEntry = new Lang.Class({ // Panelmenu Icon this.statusIcon = new CustomElements.StatusElement(); - this.actor.add_child(this.statusIcon); + this.actor.add_child(this.statusIcon.icon); // new wallpaper button this.newWallpaperItem = new CustomElements.NewWallpaperElement(); From 85811f8e4d233d2272ecb5890e2bb6ceda541eb5 Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Thu, 1 Nov 2018 20:05:20 +0100 Subject: [PATCH 4/8] deprecate support for gnome 3.20 --- randomwallpaper@iflow.space/metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/randomwallpaper@iflow.space/metadata.json b/randomwallpaper@iflow.space/metadata.json index 0a306c5..6c9eb6b 100644 --- a/randomwallpaper@iflow.space/metadata.json +++ b/randomwallpaper@iflow.space/metadata.json @@ -1,6 +1,5 @@ { "shell-version": [ - "3.20", "3.22", "3.24", "3.26", From 3d5f962133527dd940aa7239d73807295d50563a Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Thu, 1 Nov 2018 21:45:16 +0100 Subject: [PATCH 5/8] fix reddit source --- randomwallpaper@iflow.space/sourceAdapter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/randomwallpaper@iflow.space/sourceAdapter.js b/randomwallpaper@iflow.space/sourceAdapter.js index 91d4464..43edcfe 100755 --- a/randomwallpaper@iflow.space/sourceAdapter.js +++ b/randomwallpaper@iflow.space/sourceAdapter.js @@ -364,6 +364,10 @@ var RedditAdapter = new Lang.Class({ this._settings = new SettingsModule.Settings(RWG_SETTINGS_SCHEMA_REDDIT); }, + _ampDecode: function(string) { + return string.replace(/\&/g,'&'); + }, + requestRandomImage: function (callback) { let session = new Soup.SessionAsync(); @@ -391,7 +395,7 @@ var RedditAdapter = new Lang.Class({ } const random = Math.floor(Math.random() * submissions.length); const submission = submissions[random].data; - const imageDownloadUrl = submission.preview.images[0].source.url; + const imageDownloadUrl = this._ampDecode(submission.preview.images[0].source.url); if (callback) { let historyEntry = new HistoryModule.HistoryEntry(null, 'Reddit', imageDownloadUrl); From c7cb2e03e224a7e5062e101e50986288cf8b4a39 Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Fri, 2 Nov 2018 00:41:16 +0100 Subject: [PATCH 6/8] Update README.md --- README.md | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3fab0d8..6b49aa2 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,45 @@ RandomWallpaperGnome3 ===================== -Random Wallpapers for Gnome 3 is a gnome shell extension which fetches a random wallpaper from an online source and sets it as desktop background. +Random Wallpapers for Gnome 3 is a gnome-shell extension that fetches a random wallpaper from an online source and sets it as desktop background. ![Screenshot](/assets/screenshot.png) -## Installation (symlink to repository) +## Features + +* Many different online sources with filters + * Unsplash (https://unsplash.com/) + * Desktoppr (https://desktoppr.co/) + * Wallhaven (https://alpha.wallhaven.cc/) + * Reddit (https://reddit.com) + * Basically any JSON API/File ([Examples](https://github.com/ifl0w/RandomWallpaperGnome3/wiki/Generic-JSON-Source)) + * Chromecast Images + * NASA Picture of the day + * Bing Picture of the day + * Google Earth View +* History of previous images +* Set lock screen image +* Automatic renewal (Auto-Fetching) + +## Installation (symlink to the repository) Clone the repository and run `./install.sh` in the repository folder to make a symbolic link from the extensions folder to the git repository. This installation will depend on the repository folder, so do not delete the cloned folder. Then open the command prompt (Alt+F2) end enter `r` to restart the gnome session. -In the case you are using wayland, then no restart should be required. +In the case you are using Wayland, then no restart should be required. Now you should be able to activate the extension through the gnome-tweak-tool. __Installing this way has various advantages:__ * Switching between versions and branches. -* Updateing the extension with `git pull` +* Updating the extension with `git pull` ## Installation (manually) Clone or download the repository and copy the folder `randomwallpaper@iflow.space` in the repository to `~/.local/share/gnome-shell/extensions/`. Then open the command prompt (Alt+F2) end enter `r` to restart the gnome session. -In the case you are using wayland, then no restart should be required. +In the case you are using Wayland, then no restart should be required. Now you should be able to activate the extension through the gnome-tweak-tool. @@ -32,8 +48,14 @@ Run `./install uninstall` to delete the symbolic link. If you installed the extension manually you have to delete the extension folder `randomwallpaper@iflow.space` in `~/.local/share/gnome-shell/extensions/`. ## Debugging -Extension output can be followed with `./debug.sh`. Information should be printed using the existing logger class but can also be printed with `global.log()` (not recommended). +You can follow the output of the extension with `./debug.sh`. Information should be printed using the existing logger class but can also be printed with `global.log()` (not recommended). To debug the `prefs.js` use `./debug.sh perfs`. ## Compiling schemas This can be done with the command: `glib-compile-schemas randomwallpaper@iflow.space/schemas/` + +## Support Me +If you enjoy this extension and want to support the development, then feel free to buy me a coffee. :wink: :coffee: + + +[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RBLX73X4DPS7A) From 82d7e8065203632da7bc11471fd74a858c43fd5c Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Fri, 2 Nov 2018 01:14:36 +0100 Subject: [PATCH 7/8] change open in browser link for unsplash to the html page closes #43 --- randomwallpaper@iflow.space/sourceAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/randomwallpaper@iflow.space/sourceAdapter.js b/randomwallpaper@iflow.space/sourceAdapter.js index 43edcfe..6161ced 100755 --- a/randomwallpaper@iflow.space/sourceAdapter.js +++ b/randomwallpaper@iflow.space/sourceAdapter.js @@ -172,7 +172,7 @@ var UnsplashAdapter = new Lang.Class({ authorName = data.user.name; authorUrl = encodeURI(data.user.links.html); - imageLinkUrl = encodeURI(data.urls.raw + '&' + utmParameters); + imageLinkUrl = encodeURI(data.links.html); let downloadLocation = data.links.download_location + '?' + clientParam; downloadMessage = Soup.Message.new('GET', downloadLocation); @@ -194,7 +194,7 @@ var UnsplashAdapter = new Lang.Class({ let historyEntry = new HistoryModule.HistoryEntry(authorName, this.sourceName, encodeURI(downloadData.url)); historyEntry.source.sourceUrl = encodeURI(this.sourceUrl + '?' + utmParameters); historyEntry.source.authorUrl = encodeURI(authorUrl + '?' + utmParameters); - historyEntry.source.imageLinkUrl = imageLinkUrl; + historyEntry.source.imageLinkUrl = imageLinkUrl + '?' + utmParameters; callback(historyEntry); } } catch (e) { From 3e57b207fc24bd0d563ec927c0767a2a9c8b2dc0 Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Fri, 2 Nov 2018 01:16:35 +0100 Subject: [PATCH 8/8] bump version number --- randomwallpaper@iflow.space/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/randomwallpaper@iflow.space/metadata.json b/randomwallpaper@iflow.space/metadata.json index 6c9eb6b..6824c8f 100644 --- a/randomwallpaper@iflow.space/metadata.json +++ b/randomwallpaper@iflow.space/metadata.json @@ -11,6 +11,6 @@ "name": "Random Wallpaper", "description": "Fetches a random wallpaper from an online source and sets it as desktop background. \nThe desktop background can be updated periodically or manually.", "version": 13, - "semantic-version": "2.3.0", + "semantic-version": "2.3.1", "url": "https://github.com/ifl0w/RandomWallpaperGnome3" }