51 lines
1.7 KiB
JavaScript
51 lines
1.7 KiB
JavaScript
import Adw from 'gi://Adw';
|
|
import Gio from 'gi://Gio';
|
|
import Gtk from 'gi://Gtk';
|
|
|
|
import {ExtensionPreferences, gettext as _} from
|
|
'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
|
|
|
export default class WideTilePreferences extends ExtensionPreferences {
|
|
fillPreferencesWindow(window) {
|
|
const settings = this.getSettings();
|
|
|
|
const page = new Adw.PreferencesPage();
|
|
const group = new Adw.PreferencesGroup({
|
|
title: _('Tile width'),
|
|
description: _('Width used by Super+Left / Super+Right'),
|
|
});
|
|
|
|
const modeRow = new Adw.ComboRow({
|
|
title: _('Mode'),
|
|
model: Gtk.StringList.new([
|
|
_('Align with conky window'),
|
|
_('Fixed fraction of work area'),
|
|
]),
|
|
});
|
|
modeRow.selected = settings.get_string('mode') === 'fraction' ? 1 : 0;
|
|
modeRow.connect('notify::selected', () => {
|
|
settings.set_string('mode',
|
|
modeRow.selected === 1 ? 'fraction' : 'conky');
|
|
});
|
|
group.add(modeRow);
|
|
|
|
const fracRow = new Adw.SpinRow({
|
|
title: _('Fraction of work area'),
|
|
subtitle: _('Used in "fraction" mode and as fallback when conky is not running'),
|
|
adjustment: new Gtk.Adjustment({
|
|
lower: 0.3,
|
|
upper: 1.0,
|
|
step_increment: 0.05,
|
|
page_increment: 0.1,
|
|
value: settings.get_double('fraction'),
|
|
}),
|
|
digits: 2,
|
|
});
|
|
settings.bind('fraction', fracRow, 'value', Gio.SettingsBindFlags.DEFAULT);
|
|
group.add(fracRow);
|
|
|
|
page.add(group);
|
|
window.add(page);
|
|
}
|
|
}
|