Skip to content

Commit

Permalink
version 34 (#110)
Browse files Browse the repository at this point in the history
* fix settings ref in prefs
* Update Swedish translation (#108), Portuguese translation (#111)
* split out random timer, fix code quality issues
* correctly set refresh on random
* fix copy image to clipboard #80
* fix override errors on X11, doubled timer removal
* use Bing default locale #112
* fix handling of Japanese characters #114

Co-authored-by: krevad <[email protected]>
Co-authored-by: Juliano Camargo <[email protected]>
  • Loading branch information
3 people authored Jun 15, 2021
1 parent 95ec0c5 commit 29c0ec1
Show file tree
Hide file tree
Showing 24 changed files with 661 additions and 620 deletions.
13 changes: 4 additions & 9 deletions BWClipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,26 @@

const St = imports.gi.St;
const CLIPBOARD_TYPE = St.ClipboardType.CLIPBOARD;
/*const Gdk = imports.gi.Gdk;
const Gtk = imports.gi.Gtk;*/
const Gio = imports.gi.Gio;

var BWClipboard = class BWClipboard {
constructor() {
/*
this.display = Gdk.Display.get_default();
this.clipboard = this.display ? Gtk.Clipboard.get_default(this.display) : null;*/
this.clipboard = St.Clipboard.get_default();
}

// non functional, getting this to function would likely involve using Gtk, which seems to be a bit unsafe on Wayland
setImage(filename) {
try {
let file = Gio.File.new_for_path(filename);
let [success, image_data] = file.load_contents(null);
//log('error: '+success);
this.clipboard.set_content(CLIPBOARD_TYPE, 'image/jpeg', image_data);
if (success)
this.clipboard.set_content(CLIPBOARD_TYPE, 'image/jpeg', image_data);
} catch (err) {
log('unable to set clipboard to data in '+filename);
}
}

setText(text) {
/*this.clipboard.set_text(text, -1);*/
this.clipboard.set_text(CLIPBOARD_TYPE, text);
}
}
};
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Please include logs from your journal when submitting bug notices (make sure not
![Settings](/screenshot/settings.png)
![Settings](/screenshot/settings2.png)
![Settings](/screenshot/settings3.png)
![Settings](/screenshot/settings4.png)


Examples of adjustable blur on the lockscreen:
Expand Down
2 changes: 1 addition & 1 deletion Settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ Bing Wallpaper GNOME extension by: Michael Carroll
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">False</property>
<property name="label" translatable="yes">Default is English - United States</property>
<property name="label" translatable="no"></property>
<style>
<class name="dim-label"/>
</style>
Expand Down
2 changes: 1 addition & 1 deletion Settings4.ui
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ Bing Wallpaper GNOME extension by: Michael Carroll
<property name="can_focus">0</property>
<property name="halign">start</property>
<property name="hexpand">0</property>
<property name="label" translatable="yes">Default is English - United States</property>
<property name="label" translatable="no"></property>
<style>
<class name="dim-label"/>
</style>
Expand Down
8 changes: 4 additions & 4 deletions blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ var Blur = class Blur {
this._backgroundGroup.add_child(widget);
const themeContext = St.ThemeContext.get_for_stage(global.stage);
log("blur strength: " + blur_strength +" blur brightness: "+blur_brightness);
let effect = new Shell.BlurEffect({ brightness: blur_brightness * 0.01, sigma: blur_strength * themeContext.scale_factor / 5 });
this._scaleChangedId = themeContext.connect('notify::scale-factor', () => { effect.sigma = SIGMA_VALUE * themeContext.scale_factor; });
let effect = new Shell.BlurEffect({ brightness: blur_brightness * 0.01, sigma: blur_strength * themeContext.scale_factor / 5 }); // fix me, should this be /5?
this._scaleChangedId = themeContext.connect('notify::scale-factor', () => { effect.sigma = blur_strength * themeContext.scale_factor / 5; });
widget.add_effect(effect);
}

Expand Down Expand Up @@ -130,15 +130,15 @@ var Blur = class Blur {
log("shell version too old, no overriding");
}
}
}
};

function whichVersion() {
if ((shellVersionMajor == 3 && shellVersionMinor >= 36) || shellVersionMajor == 40) {
if (shellVersionMajor == 3 && shellVersionMinor == 36 && shellVersionPoint <= 3) {
return 1;
}
else {
return 2
return 2;
}
}
else {
Expand Down
50 changes: 25 additions & 25 deletions convenience.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function getSettings(schema) {
throw new Error('Schema ' + schema + ' could not be found for extension '
+ extension.metadata.uuid + '. Please check your installation.');

return new Gio.Settings({ settings_schema: schemaObj });
return new Gio.Settings({settings_schema: schemaObj});
}

const versionArray = (v) => v.split(".").map(Number);
Expand All @@ -104,58 +104,58 @@ const zip = function(a, b, defaultValue) {
};

function versionEqual(a, b) {
return zip(versionArray(a), versionArray(b), 0).reduce(
(prev, [a, b]) => prev && (a === b)
, true);
return zip(versionArray(a), versionArray(b), 0).reduce(
(prev, [a, b]) => prev && (a === b)
, true);
}

function versionGreater(a, b) {
const diff = zip(versionArray(a), versionArray(b), 0).find(([a, b]) => a !== b);
if (!diff) {
return false;
}
const [x, y] = diff;
return x > y;
const diff = zip(versionArray(a), versionArray(b), 0).find(([a, b]) => a !== b);
if (!diff) {
return false;
}
const [x, y] = diff;
return x > y;
}

function versionSmaller(a, b) {
return (!versionEqual(a, b)) && (!versionGreater(a, b));
return (!versionEqual(a, b)) && (!versionGreater(a, b));
}

function currentVersion() {
return Config.PACKAGE_VERSION;
return Config.PACKAGE_VERSION;
}

function currentVersionEqual(v) {
return versionEqual(currentVersion(), v);
return versionEqual(currentVersion(), v);
}

function currentVersionGreater(v) {
return versionGreater(currentVersion(), v);
return versionGreater(currentVersion(), v);
}

function currentVersionGreaterEqual(v) {
return versionEqual(currentVersion(), v)
return versionEqual(currentVersion(), v)
|| versionGreater(currentVersion(), v);
}

function currentVersionSmaller(v) {
return versionSmaller(currentVersion(), v);
return versionSmaller(currentVersion(), v);
}

function currentVersionSmallerEqual(v) {
return versionEqual(currentVersion(), v)
return versionEqual(currentVersion(), v)
&& (!versionGreater(currentVersion(), v));
}

var exports = {
initTranslations,
getSettings,
currentVersion,
currentVersionEqual,
currentVersionGreater,
currentVersionGreaterEqual,
currentVersionSmaller,
currentVersionSmallerEqual
initTranslations,
getSettings,
currentVersion,
currentVersionEqual,
currentVersionGreater,
currentVersionGreaterEqual,
currentVersionSmaller,
currentVersionSmallerEqual
};

Loading

0 comments on commit 29c0ec1

Please sign in to comment.