diff --git a/gschemas.compiled b/gschemas.compiled
index 6121f5a..1cea5b3 100644
Binary files a/gschemas.compiled and b/gschemas.compiled differ
diff --git a/layouts.gschema.xml b/layouts.gschema.xml
index f7b0339..628b691 100644
--- a/layouts.gschema.xml
+++ b/layouts.gschema.xml
@@ -55,5 +55,15 @@
Simple vertical layout
Split screen vertically
+
+ 0
+ Gap size around tiled windows
+ Determines the gap size between windows
+
+
+ 0.25
+ Animation duration
+ Ajust duration of window move/resize animation
+
diff --git a/prefs.js b/prefs.js
index 7f91c75..d8d003c 100644
--- a/prefs.js
+++ b/prefs.js
@@ -33,6 +33,7 @@ function buildPrefsWidget() {
let notebook = new Gtk.Notebook();
accel_tab(notebook);
layouts_tab(notebook);
+ layouts_settings_tab(notebook);
/* basics_tab(notebook);
presets_tab(notebook);
@@ -167,10 +168,14 @@ function layouts_tab(notebook) {
let ks_window = new Gtk.ScrolledWindow({ vexpand: true });
const ks_lbox = new Gtk.ListBox({
- vexpand: false,
valign: Gtk.Align.START
});
- ks_window.add(ks_lbox);
+ const w_box = new Gtk.VBox({
+ border_width: 10
+ });
+
+ w_box.add(ks_lbox);
+ ks_window.add(w_box);
let ks_label = new Gtk.Label({
label: 'Layouts',
halign: Gtk.Align.START,
@@ -182,7 +187,11 @@ function layouts_tab(notebook) {
let item = new Gtk.Switch({ valign: Gtk.Align.CENTER });
const name = new Gtk.Label({ xalign: 0 });
- name.set_markup(`${layout}`);
+ name.set_markup(
+ `${layout
+ .replace('-', ' ')
+ .replace(/^\w/g, c => c.toUpperCase())}`
+ );
const desc = new Gtk.Label({ xalign: 0 });
desc.set_markup(`${description}`);
@@ -223,6 +232,79 @@ function layouts_tab(notebook) {
notebook.append_page(ks_window, ks_label);
}
+function layouts_settings_tab(notebook) {
+ const settings = getSettings('layouts');
+
+ let ks_window = new Gtk.ScrolledWindow({ vexpand: true });
+ const parent_vbox = new Gtk.VBox({
+ valign: Gtk.Align.START,
+ border_width: 10
+ });
+ ks_window.add(parent_vbox);
+ let ks_label = new Gtk.Label({
+ label: 'Tiling settings',
+ halign: Gtk.Align.START,
+ use_markup: false
+ });
+
+ const gaphbox = new Gtk.HBox();
+ const gap = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL, 0, 50, 1);
+ settings.bind(
+ 'gap',
+ gap.get_adjustment(),
+ 'value',
+ Gio.SettingsBindFlags.DEFAULT
+ );
+
+ const gapname = new Gtk.Label({ xalign: 0 });
+ gapname.set_markup(`Gap size`);
+ const gapdesc = new Gtk.Label({ xalign: 0 });
+ gapdesc.set_markup(
+ `Determines the gap size in pixel between windows`
+ );
+
+ const gapvbox = new Gtk.VBox();
+ gapvbox.pack_start(gapname, false, false, 0);
+ gapvbox.pack_start(gapdesc, false, false, 0);
+ gaphbox.pack_start(gapvbox, true, true, 10);
+ gaphbox.pack_end(gap, true, true, 0);
+
+ parent_vbox.add(gaphbox);
+
+ const tweentimehbox = new Gtk.HBox();
+ const tweentime = Gtk.Scale.new_with_range(
+ Gtk.Orientation.HORIZONTAL,
+ 0,
+ 1,
+ 0.01
+ );
+ settings.bind(
+ 'tween-time',
+ tweentime.get_adjustment(),
+ 'value',
+ Gio.SettingsBindFlags.DEFAULT
+ );
+ tweentime.add_mark(0.1, Gtk.PositionType.BOTTOM, 'Fast');
+ tweentime.add_mark(0.25, Gtk.PositionType.BOTTOM, 'Smooth');
+ tweentime.add_mark(0.75, Gtk.PositionType.BOTTOM, 'Mesmerizing');
+
+ const tweentimename = new Gtk.Label({ xalign: 0 });
+ tweentimename.set_markup(`Animation duration`);
+ const tweentimedesc = new Gtk.Label({ xalign: 0 });
+ tweentimedesc.set_markup(
+ `Ajust duration (in seconds) of window move/resize animation`
+ );
+
+ const tweentimevbox = new Gtk.VBox();
+ tweentimevbox.pack_start(tweentimename, false, false, 0);
+ tweentimevbox.pack_start(tweentimedesc, false, false, 0);
+ tweentimehbox.pack_start(tweentimevbox, true, true, 10);
+ tweentimehbox.pack_start(tweentime, true, true, 0);
+
+ parent_vbox.add(tweentimehbox);
+ notebook.append_page(ks_window, ks_label);
+}
+
function append_hotkey(model, settings, name, pretty_name) {
let [key, mods] = Gtk.accelerator_parse(settings.get_strv(name)[0]);
diff --git a/tilingManager/tilingLayouts/baseTiling.js b/tilingManager/tilingLayouts/baseTiling.js
index 331eefc..e019a80 100644
--- a/tilingManager/tilingLayouts/baseTiling.js
+++ b/tilingManager/tilingLayouts/baseTiling.js
@@ -3,8 +3,7 @@ const Main = imports.ui.main;
const Tweener = imports.ui.tweener;
const Me = imports.misc.extensionUtils.getCurrentExtension();
const { Backdrop } = Me.imports.widget.backdrop;
-
-const TILE_TWEEN_TIME = 0.25;
+const { getSettings } = Me.imports.utils.settings;
/* exported BaseTilingLayout */
var BaseTilingLayout = class BaseTilingLayout {
@@ -31,6 +30,18 @@ var BaseTilingLayout = class BaseTilingLayout {
this.onTile();
}
);
+ this.settings = getSettings('layouts');
+ this.settingsSignals = [
+ this.settings.connect('changed::gap', (schema, key) => {
+ this.gap = schema.get_int('gap');
+ this.onTile();
+ }),
+ this.settings.connect('changed::tween-time', (schema, key) => {
+ this.tweenTime = schema.get_double('tween-time');
+ })
+ ];
+ this.gap = this.settings.get_int('gap');
+ this.tweenTime = this.settings.get_double('tween-time');
this.windows = superWorkspace.windows;
}
@@ -90,6 +101,13 @@ var BaseTilingLayout = class BaseTilingLayout {
}
moveAndResizeMetaWindow(metaWindow, x, y, width, height) {
+ if (this.gap) {
+ x = x + this.gap;
+ y = y + this.gap;
+ width = width - 2 * this.gap;
+ height = height - 2 * this.gap;
+ }
+
const rect = metaWindow.get_frame_rect();
const buf = metaWindow.get_buffer_rect();
x = Math.floor(x);
@@ -118,7 +136,7 @@ var BaseTilingLayout = class BaseTilingLayout {
Tweener.addTween(actor, {
scale_x: width / oldRect.width,
scale_y: height / oldRect.height,
- time: TILE_TWEEN_TIME,
+ time: this.tweenTime,
transition: 'easeOutQuad'
});
return;
@@ -136,7 +154,7 @@ var BaseTilingLayout = class BaseTilingLayout {
scale_y: 1.0,
translation_x: 0,
translation_y: 0,
- time: TILE_TWEEN_TIME,
+ time: this.tweenTime,
transition: 'easeOutQuad'
});
});
@@ -177,6 +195,7 @@ var BaseTilingLayout = class BaseTilingLayout {
}
onDestroy() {
+ this.settings.disconnect(this.settingsSignal);
this.superWorkspace.disconnect(this.windowChangedId);
this.superWorkspace.disconnect(this.windowFocusedChangedId);
global.display.disconnect(this.workAreaChangedId);
diff --git a/tilingManager/tilingLayouts/custom/ratio.js b/tilingManager/tilingLayouts/custom/ratio.js
index 89ce95e..467eec8 100644
--- a/tilingManager/tilingLayouts/custom/ratio.js
+++ b/tilingManager/tilingLayouts/custom/ratio.js
@@ -16,18 +16,16 @@ var RatioLayout = class RatioLayout extends BaseGrabbableLayout {
this.settingsSignal = this.settings.connect(
'changed::ratio-value',
(schema, key) => {
- log('changed');
+ this.ratio = schema.get_double('ratio-value');
this.onTile();
}
);
+ this.ratio = this.settings.get_double('ratio-value');
}
onTileRegulars(windows) {
if (!windows.length) return;
- const ratio = this.settings.get_double('ratio-value');
- log('tile', ratio);
-
const workArea = Main.layoutManager.getWorkAreaForMonitor(
this.monitor.index
);
@@ -51,13 +49,13 @@ var RatioLayout = class RatioLayout extends BaseGrabbableLayout {
windowArea = freeArea;
} else {
if (freeArea.width > freeArea.height) {
- windowArea.width = freeArea.width * ratio;
+ windowArea.width = freeArea.width * this.ratio;
windowArea.height = freeArea.height;
freeArea.x += windowArea.width;
freeArea.width -= windowArea.width;
} else {
windowArea.width = freeArea.width;
- windowArea.height = freeArea.height * ratio;
+ windowArea.height = freeArea.height * this.ratio;
freeArea.y += windowArea.height;
freeArea.height -= windowArea.height;
}