From 12f804946f989bfe448971a82433d0c8c0938cbc Mon Sep 17 00:00:00 2001 From: Florian Müllner Date: Feb 16 2022 11:45:34 +0000 Subject: prefs: Scale preview border We currently pick up the settings value directly, which is the border that is used on the actual (i.e. monitor-sized) background. That's way too big when applied as-is on the preview, so assume a common monitor size and compute an appropriate scale from that. --- diff --git a/prefs.js b/prefs.js index d910719..8070a96 100644 --- a/prefs.js +++ b/prefs.js @@ -15,6 +15,7 @@ const ExtensionUtils = imports.misc.extensionUtils; const BACKGROUND_SCHEMA = 'org.gnome.desktop.background'; +const MONITOR_WIDTH = 1920; const PREVIEW_WIDTH = 400; const PreviewGroup = GObject.registerClass( @@ -99,7 +100,9 @@ class PreviewGroup extends Adw.PreferencesGroup { } _getLogoPosition(width, height) { - let scaledBorder = this._settings.get_uint('logo-border'); + const previewScale = PREVIEW_WIDTH / MONITOR_WIDTH; + const scaledBorder = + previewScale * this._settings.get_uint('logo-border'); let x, y; const position = this._settings.get_string('logo-position'); if (position.endsWith('left'))