diff --git a/Settings.ui b/Settings.ui
index 2cd7e60..7bf6ce2 100644
--- a/Settings.ui
+++ b/Settings.ui
@@ -2207,17 +2207,18 @@
False
none
-
-
-
- True
- True
-
-
- True
- False
- 12
- 12
- 12
- 12
- 32
True
@@ -2274,7 +2258,7 @@
0
- 0
+ 1
@@ -2282,32 +2266,16 @@
True
True
4
- 0
+ 25
leave_timeout_adjustment
True
+ 25
1
- 0
+ 1
-
-
-
-
-
-
- True
- True
-
-
- True
- False
- 12
- 12
- 12
- 12
- 32
True
@@ -2318,7 +2286,7 @@
0
- 0
+ 2
@@ -2332,7 +2300,7 @@
1
- 0
+ 2
@@ -2383,32 +2351,19 @@
-
+
True
True
-
+
True
False
12
12
12
12
+ 12
32
-
-
- True
- True
- 4
- 0
- preview_size_adjustment
- True
-
-
- 1
- 0
-
-
True
@@ -2421,81 +2376,36 @@
0
0
+ 3
-
-
-
-
-
-
- True
- True
-
-
- True
- False
- 12
- 12
- 12
- 12
- 32
-
+
+ True
+ True
+ 4
+ 0
+ preview_size_adjustment
+ True
+
+
+ 2
+ 0
+
+
+
+
True
False
True
- Use a fixed size for the window previews
+ Window aspect ratio Y (height)
True
0
0
- 0
-
-
-
-
- True
- True
- end
- center
-
-
- 1
- 0
-
-
-
-
-
-
-
-
- True
- True
-
-
- True
- False
- 12
- 12
- 12
- 12
- 32
-
-
- True
- True
- 4
- 50
- preview_padding_adjustment
- True
- 50
-
-
- 1
- 0
+ 2
+ 2
@@ -2509,7 +2419,160 @@
0
- 0
+ 3
+ 2
+
+
+
+
+ True
+ True
+ 4
+ 50
+ preview_padding_adjustment
+ True
+ 50
+
+
+ 2
+ 3
+
+
+
+
+ True
+ False
+ 2
+ True
+
+
+ True
+ False
+ end
+ center
+
+ - 1
+ - 2
+ - 3
+ - 4
+ - 5
+ - 6
+ - 7
+ - 8
+ - 9
+ - 10
+ - 11
+ - 12
+ - 13
+ - 14
+ - 15
+ - 16
+ - 17
+ - 18
+ - 19
+ - 20
+ - 21
+
+
+
+ False
+ True
+ 1
+
+
+
+
+ Fixed
+ True
+ True
+ True
+
+
+ False
+ True
+ 2
+
+
+
+
+ 2
+ 1
+
+
+
+
+ True
+ False
+ True
+ Window aspect ratio X (width)
+ True
+ 0
+
+
+ 0
+ 1
+ 2
+
+
+
+
+ True
+ False
+ 2
+ True
+
+
+ True
+ False
+ end
+ center
+
+ - 1
+ - 2
+ - 3
+ - 4
+ - 5
+ - 6
+ - 7
+ - 8
+ - 9
+ - 10
+ - 11
+ - 12
+ - 13
+ - 14
+ - 15
+ - 16
+ - 17
+ - 18
+ - 19
+ - 20
+ - 21
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ Fixed
+ True
+ True
+ True
+
+
+ False
+ True
+ 1
+
+
+
+
+ 2
+ 2
diff --git a/prefs.js b/prefs.js
index ddf5b4f..6d82f4c 100644
--- a/prefs.js
+++ b/prefs.js
@@ -1030,8 +1030,13 @@ const Settings = new Lang.Class({
'active',
Gio.SettingsBindFlags.DEFAULT);
- this._settings.bind('window-preview-fixed-size',
- this._builder.get_object('preview_fixed_size_switch'),
+ this._settings.bind('window-preview-fixed-x',
+ this._builder.get_object('preview_aspect_ratio_x_fixed_togglebutton'),
+ 'active',
+ Gio.SettingsBindFlags.DEFAULT);
+
+ this._settings.bind('window-preview-fixed-y',
+ this._builder.get_object('preview_aspect_ratio_y_fixed_togglebutton'),
'active',
Gio.SettingsBindFlags.DEFAULT);
@@ -1090,6 +1095,16 @@ const Settings = new Lang.Class({
this._settings.set_int('window-preview-size', widget.get_value());
}));
+ this._builder.get_object('preview_aspect_ratio_x_combo').set_active_id(this._settings.get_int('window-preview-aspect-ratio-x').toString());
+ this._builder.get_object('preview_aspect_ratio_x_combo').connect('changed', Lang.bind (this, function(widget) {
+ this._settings.set_int('window-preview-aspect-ratio-x', parseInt(widget.get_active_id(), 10));
+ }));
+
+ this._builder.get_object('preview_aspect_ratio_y_combo').set_active_id(this._settings.get_int('window-preview-aspect-ratio-y').toString());
+ this._builder.get_object('preview_aspect_ratio_y_combo').connect('changed', Lang.bind (this, function(widget) {
+ this._settings.set_int('window-preview-aspect-ratio-y', parseInt(widget.get_active_id(), 10));
+ }));
+
this._builder.get_object('preview_padding_spinbutton').set_value(this._settings.get_int('window-preview-padding'));
this._builder.get_object('preview_padding_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
this._settings.set_int('window-preview-padding', widget.get_value());
@@ -1132,14 +1147,21 @@ const Settings = new Lang.Class({
this._settings.set_value('window-preview-size', this._settings.get_default_value('window-preview-size'));
this._builder.get_object('preview_size_spinbutton').set_value(this._settings.get_int('window-preview-size'));
+
+ this._settings.set_value('window-preview-fixed-x', this._settings.get_default_value('window-preview-fixed-x'));
+ this._settings.set_value('window-preview-fixed-y', this._settings.get_default_value('window-preview-fixed-y'));
+
+ this._settings.set_value('window-preview-aspect-ratio-x', this._settings.get_default_value('window-preview-aspect-ratio-x'));
+ this._builder.get_object('preview_aspect_ratio_x_combo').set_active_id(this._settings.get_int('window-preview-aspect-ratio-x').toString());
+
+ this._settings.set_value('window-preview-aspect-ratio-y', this._settings.get_default_value('window-preview-aspect-ratio-y'));
+ this._builder.get_object('preview_aspect_ratio_y_combo').set_active_id(this._settings.get_int('window-preview-aspect-ratio-y').toString());
this._settings.set_value('window-preview-padding', this._settings.get_default_value('window-preview-padding'));
this._builder.get_object('preview_padding_spinbutton').set_value(this._settings.get_int('window-preview-padding'));
this._settings.set_value('preview-middle-click-close', this._settings.get_default_value('preview-middle-click-close'));
- this._settings.set_value('window-preview-fixed-size', this._settings.get_default_value('window-preview-fixed-size'));
-
this._settings.set_value('window-preview-title-font-size', this._settings.get_default_value('window-preview-title-font-size'));
this._builder.get_object('preview_title_size_spinbutton').set_value(this._settings.get_int('window-preview-title-font-size'));
diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
index 31889c0..744a500 100644
--- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
@@ -436,16 +436,31 @@
Window previews size
Preferred window previews size
-
+
+ false
+ Fixed aspect ratio X
+ This defines if the window previews use a fixed aspect ratio X.
+
+
true
- Window previews fixed size
- This defines if the window previews use a fixed or dynamic size.
+ Fixed aspect ratio Y
+ This defines if the window previews use a fixed aspect ratio Y.
8
Window previews padding
The padding of the window previews
+
+ 16
+ Aspect ratio X
+ The window previews respected aspect ratio X.
+
+
+ 9
+ Aspect ratio Y
+ The window previews respected aspect ratio Y.
+
false
Provide workspace isolation
diff --git a/windowPreview.js b/windowPreview.js
index f0059ce..7db979c 100644
--- a/windowPreview.js
+++ b/windowPreview.js
@@ -46,11 +46,12 @@ const FOCUSED_COLOR_OFFSET = 24;
const HEADER_COLOR_OFFSET = -12;
const PEEK_INDEX_PROP = '_dtpPeekInitialIndex';
-var headerHeight = 0;
-var isLeftButtons = false;
-var isTopHeader = true;
-var scaleFactor = 1;
-var animationTime = 0;
+let headerHeight = 0;
+let isLeftButtons = false;
+let isTopHeader = true;
+let scaleFactor = 1;
+let animationTime = 0;
+let aspectRatio = {};
var PreviewMenu = Utils.defineClass({
Name: 'DashToPanel-PreviewMenu',
@@ -363,6 +364,14 @@ var PreviewMenu = Utils.defineClass({
scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
headerHeight = this._dtpSettings.get_boolean('window-preview-show-title') ? HEADER_HEIGHT * scaleFactor : 0;
animationTime = this._dtpSettings.get_int('window-preview-animation-time') * .001;
+ aspectRatio.x = {
+ size: this._dtpSettings.get_int('window-preview-aspect-ratio-x'),
+ fixed: this._dtpSettings.get_boolean('window-preview-fixed-x')
+ };
+ aspectRatio.y = {
+ size: this._dtpSettings.get_int('window-preview-aspect-ratio-y'),
+ fixed: this._dtpSettings.get_boolean('window-preview-fixed-y')
+ };
},
_resetHiddenState: function() {
@@ -902,20 +911,12 @@ var Preview = Utils.defineClass({
},
_getBinSize: function() {
- let width = -1;
- let height = -1;
+ let [fixedWidth, fixedHeight] = this._previewDimensions;
- if (this._previewMenu._dtpSettings.get_boolean('window-preview-fixed-size')) {
- let [fixedWidth, fixedHeight] = this._previewDimensions;
-
- if (this._previewMenu._checkIfLeftOrRight()) {
- width = fixedWidth + this._padding * 2;
- } else {
- height = fixedHeight + this._padding * 2;
- }
- }
-
- return [width, height];
+ return [
+ aspectRatio.x.fixed ? fixedWidth + this._padding * 2 : -1,
+ aspectRatio.y.fixed ? fixedHeight + this._padding * 2 : -1
+ ];
},
_resizeClone: function(cloneBin) {
@@ -935,16 +936,15 @@ var Preview = Utils.defineClass({
},
_getPreviewDimensions: function() {
- let primaryMonitor = Main.layoutManager.primaryMonitor;
let size = this._previewMenu._dtpSettings.get_int('window-preview-size') * scaleFactor;
let w, h;
if (this._previewMenu._checkIfLeftOrRight()) {
w = size;
- h = w * primaryMonitor.height / primaryMonitor.width;
+ h = w * aspectRatio.y.size / aspectRatio.x.size;
} else {
h = size;
- w = h * primaryMonitor.width / primaryMonitor.height;
+ w = h * aspectRatio.x.size / aspectRatio.y.size;
}
return [w, h];