/usr/share/gnome-shell/extensions/hidetopbar@mathieu.bidon.ca/prefs.js is in gnome-shell-extension-autohidetopbar 20171126-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | const Gtk = imports.gi.Gtk;
const GObject = imports.gi.GObject;
const Gettext = imports.gettext.domain('hidetopbar');
const _ = Gettext.gettext;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;
let settings;
function init() {
settings = Convenience.getSettings();
Convenience.initTranslations("hidetopbar");
}
function buildPrefsWidget() {
let frame = new Gtk.VBox({border_width: 10, spacing: 6}),
settings_vbox,
settings_array,
settings_onoff,
settings_hbox,
settings_spin,
model,
model_row,
binding,
binding_key,
binding_mods,
treeview,
treeview_col,
cellrend;
/******************************************************************************
************************************** Section Sensitivity *******************
******************************************************************************/
frame.pack_start(new Gtk.Label({
label: _("<b>Sensitivity</b>"),
use_markup: true,
xalign: 0
}), false, false, 0);
settings_vbox = new Gtk.VBox({margin_left: 20, margin_top: 10, spacing: 6});
settings_array = [
['mouse-sensitive',_("Show panel when mouse approaches edge of the screen")],
['hot-corner',_("Keep hot corner sensitive, even in hidden state")],
['mouse-triggers-overview',_("In the above case show overview, too")],
];
settings_array.forEach(function (s) {
settings_onoff = new Gtk.Switch({active: settings.get_boolean(s[0])});
settings_onoff.connect('notify::active', function(w) {
settings.set_boolean(s[0], w.active);
});
settings.connect('changed::'+s[0], function(k,b) {
settings_onoff.set_active(settings.get_boolean(b));
});
settings_hbox = new Gtk.HBox();
settings_hbox.pack_start(new Gtk.Label({
label: s[1],
use_markup: true,
xalign: 0
}), true, true, 0);
settings_hbox.pack_end(settings_onoff, false, false, 0);
settings_vbox.pack_start(settings_hbox, false,false, 0);
});
frame.pack_start(settings_vbox, true, true, 0);
settings_vbox = new Gtk.VBox({margin_left: 20, margin_bottom: 10, spacing: 6});
settings_array = [
['pressure-threshold',_("Pressure barrier's threshold.")],
['pressure-timeout',_("Pressure barrier's timeout.")]
];
settings_array.forEach(function (s) {
settings_spin = Gtk.SpinButton.new_with_range(0,10000,1);
settings_spin.set_value(settings.get_int(s[0]));
settings_spin.connect('value-changed', function(w) {
settings.set_int(s[0], w.get_value());
});
settings.connect('changed::'+s[0], function(k,b) {
settings_spin.set_value(settings.get_int(b));
});
settings_hbox = new Gtk.HBox();
settings_hbox.pack_start(new Gtk.Label({
label: s[1],
use_markup: true,
xalign: 0
}), true, true, 0);
settings_hbox.pack_end(settings_spin, false, false, 0);
settings_vbox.pack_start(settings_hbox, false,false, 0);
});
frame.pack_start(settings_vbox, true, true, 0);
/******************************************************************************
************************************** Section Animation *********************
******************************************************************************/
frame.pack_start(new Gtk.Label({
label: _("<b>Animation</b>"),
use_markup: true,
xalign: 0
}), false, false, 0);
settings_vbox = new Gtk.VBox({margin_left: 20, margin_top: 10, margin_bottom: 10, spacing: 6});
settings_array = [
['animation-time-overview',_("Slide animation time when entering/leaving overview.")],
['animation-time-autohide',_("Slide animation time when mouse approaches edge of the screen.")]
];
settings_array.forEach(function (s) {
settings_spin = Gtk.SpinButton.new_with_range(0.0,1.0,0.1);
settings_spin.set_value(settings.get_double(s[0]));
settings_spin.connect('value-changed', function(w) {
settings.set_double(s[0], w.get_value());
});
settings.connect('changed::'+s[0], function(k,b) {
settings_spin.set_value(settings.get_double(b));
});
settings_hbox = new Gtk.HBox();
settings_hbox.pack_start(new Gtk.Label({
label: s[1],
use_markup: true,
xalign: 0
}), true, true, 0);
settings_hbox.pack_end(settings_spin, false, false, 0);
settings_vbox.pack_start(settings_hbox, false,false, 0);
});
frame.pack_start(settings_vbox, true, true, 0);
/******************************************************************************
************************************** Section Shortcuts *********************
******************************************************************************/
frame.pack_start(new Gtk.Label({
label: _("<b>Keyboard shortcuts</b>"),
use_markup: true,
xalign: 0
}), false, false, 0);
settings_vbox = new Gtk.VBox({margin_left: 20, margin_top: 10, spacing: 6});
/* ++++++++++++++++++++++++++++++++++++ Keyboard accelerator +++++ */
settings_hbox = new Gtk.HBox();
model = new Gtk.ListStore();
model.set_column_types([
GObject.TYPE_INT,
GObject.TYPE_INT
]);
model_row = model.append();
binding = settings.get_strv('shortcut-keybind')[0];
if (binding) {
[binding_key, binding_mods] = Gtk.accelerator_parse(binding);
} else {
[binding_key, binding_mods] = [0, 0];
}
model.set(model_row, [0, 1], [binding_mods, binding_key]);
treeview = new Gtk.TreeView({ 'expand': false, 'model': model });
cellrend = new Gtk.CellRendererAccel({
'editable': true,
'accel-mode': Gtk.CellRendererAccelMode.GTK
});
cellrend.connect('accel-edited', function(rend, iter, binding_key, binding_mods) {
let value = Gtk.accelerator_name(binding_key, binding_mods);
let [succ, iterator] = model.get_iter_from_string(iter);
if (!succ) {
throw new Error("Error updating keybinding");
}
model.set(iterator, [0, 1], [binding_mods, binding_key]);
settings.set_strv('shortcut-keybind', [value]);
});
cellrend.connect('accel-cleared', function(rend, iter, binding_key, binding_mods) {
let [succ, iterator] = model.get_iter_from_string(iter);
if (!succ) {
throw new Error("Error clearing keybinding");
}
model.set(iterator, [0, 1], [0, 0]);
settings.set_strv('shortcut-keybind', []);
});
treeview_col = new Gtk.TreeViewColumn({ min_width: 200 });
treeview_col.pack_end(cellrend, false);
treeview_col.add_attribute(cellrend, 'accel-mods', 0);
treeview_col.add_attribute(cellrend, 'accel-key', 1);
treeview.append_column(treeview_col);
treeview.set_headers_visible(false);
settings_hbox.pack_start(new Gtk.Label({
label: _("Key that triggers the bar to be shown."),
use_markup: true,
xalign: 0
}), true, true, 0);
settings_hbox.pack_end(treeview, false, true, 0);
settings.connect('changed::shortcut-keybind', function(k, b) {
let model_row = model.get(0);
model.set(model_row, [0, 1], settings.get_strv(b));
});
settings_vbox.pack_start(settings_hbox, false, false, 3);
/* ++++++++++++++++++++++++++++++++++++ End: Keyboard accelerator +++++ */
settings_spin = Gtk.SpinButton.new_with_range(0.0,10.0,0.1);
settings_spin.set_value(settings.get_double('shortcut-delay'));
settings_hbox = new Gtk.HBox();
settings_hbox.pack_start(new Gtk.Label({
label: _("Delay before the bar rehides after key press."),
use_markup: true,
xalign: 0
}), true, true, 0);
settings_hbox.pack_end(settings_spin, false, false, 0);
settings.connect('changed::shortcut-delay', function(k,b) {
settings_spin.set_value(settings.get_double(b));
});
settings_spin.connect('value-changed', function(w) {
settings.set_double('shortcut-delay', w.get_value());
});
settings_vbox.pack_start(settings_hbox, false,false, 0);
settings_array = [
['shortcut-toggles',_("Pressing the shortcut again rehides the panel.")],
];
settings_array.forEach(function (s) {
settings_onoff = new Gtk.Switch({active: settings.get_boolean(s[0])});
settings_onoff.connect('notify::active', function(w) {
settings.set_boolean(s[0], w.active);
});
settings.connect('changed::'+s[0], function(k,b) {
settings_onoff.set_active(settings.get_boolean(b));
});
settings_hbox = new Gtk.HBox();
settings_hbox.pack_start(new Gtk.Label({
label: s[1],
use_markup: true,
xalign: 0
}), true, true, 0);
settings_hbox.pack_end(settings_onoff, false, false, 0);
settings_vbox.pack_start(settings_hbox, false,false, 0);
});
frame.pack_start(settings_vbox, true, true, 0);
/******************************************************************************
************************************** Section Intellihide *******************
******************************************************************************/
frame.pack_start(new Gtk.Label({
label: _("<b>Intellihide</b>"),
use_markup: true,
xalign: 0
}), false, false, 0);
settings_vbox = new Gtk.VBox({margin_left: 20, margin_top: 10, spacing: 6});
settings_array = [
['enable-intellihide',_("Only hide panel when a window takes the space")],
['enable-active-window',_("Only when the active window takes the space")],
];
settings_array.forEach(function (s) {
settings_onoff = new Gtk.Switch({active: settings.get_boolean(s[0])});
settings_onoff.connect('notify::active', function(w) {
settings.set_boolean(s[0], w.active);
});
settings.connect('changed::'+s[0], function(k,b) {
settings_onoff.set_active(settings.get_boolean(b));
});
settings_hbox = new Gtk.HBox();
settings_hbox.pack_start(new Gtk.Label({
label: s[1],
use_markup: true,
xalign: 0
}), true, true, 0);
settings_hbox.pack_end(settings_onoff, false, false, 0);
settings_vbox.pack_start(settings_hbox, false,false, 0);
});
frame.pack_start(settings_vbox, true, true, 0);
frame.show_all();
return frame;
}
|