Add setting to hide the window title in previews

This commit is contained in:
CharlesG
2018-04-05 23:03:50 -05:00
parent 3f5bcf4336
commit 609a298baa
4 changed files with 78 additions and 16 deletions

View File

@@ -2108,6 +2108,50 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listbox_preview_show_title">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_preview_show_title">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="preview_show_title_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Display window title in previews</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="preview_show_title_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listbox_preview_width">
<property name="width_request">100</property>

View File

@@ -675,6 +675,10 @@ const Settings = new Lang.Class({
this._builder.get_object('peek_mode_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('window-preview-show-title',
this._builder.get_object('preview_show_title_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('peek-mode',
this._builder.get_object('listboxrow_enter_peek_mode_timeout'),
'sensitive',
@@ -717,6 +721,7 @@ const Settings = new Lang.Class({
this._builder.get_object('preview_timeout_spinbutton').set_value(this._settings.get_int('show-window-previews-timeout'));
this._settings.set_value('peek-mode', this._settings.get_default_value('peek-mode'));
this._settings.set_value('window-preview-show-title', this._settings.get_default_value('window-preview-show-title'));
this._settings.set_value('enter-peek-mode-timeout', this._settings.get_default_value('enter-peek-mode-timeout'));
this._builder.get_object('enter_peek_mode_timeout_spinbutton').set_value(this._settings.get_int('enter-peek-mode-timeout'));
this._settings.set_value('peek-mode-opacity', this._settings.get_default_value('peek-mode-opacity'));

View File

@@ -257,6 +257,11 @@
<summary>Enable peek mode</summary>
<description>Peek a window upon hover for some time</description>
</key>
<key type="b" name="window-preview-show-title">
<default>true</default>
<summary>Display title in preview</summary>
<description>Display window title in preview</description>
</key>
<key type="i" name="window-previews-width">
<default>350</default>
<summary>Window previews width</summary>

View File

@@ -543,28 +543,35 @@ var thumbnailPreview = new Lang.Class({
this.overlayGroup.add_actor(this._previewBin);
this.overlayGroup.add_actor(this._closeButton);
this._title = new St.Label({ text: window.title });
this._titleBin = new St.Bin({ child: this._title,
x_align: St.Align.MIDDLE,
width: this._thumbnailWidth
});
this._titleBin.add_style_class_name("preview-window-title");
this._titleNotifyId = 0;
this._titleNotifyId = this.window.connect('notify::title', Lang.bind(this, function() {
this._title.set_text(this.window.title);
}));
this._windowBin = new St.Bin({ child: this.overlayGroup,
x_align: St.Align.MIDDLE,
width: this._thumbnailWidth,
height: this._thumbnailHeight
});
this._windowBin = new St.Bin({
child: this.overlayGroup,
x_align: St.Align.MIDDLE,
width: this._thumbnailWidth,
height: this._thumbnailHeight
});
this._windowBox.add_child(this._windowBin);
if (this._dtpSettings.get_boolean('window-preview-show-title')) {
this._title = new St.Label({ text: window.title });
this._titleBin = new St.Bin({ child: this._title,
x_align: St.Align.MIDDLE,
width: this._thumbnailWidth
});
this._titleBin.add_style_class_name("preview-window-title");
this._windowBox.add_child(this._titleBin);
this._titleNotifyId = this.window.connect('notify::title', Lang.bind(this, function() {
this._title.set_text(this.window.title);
}));
}
if (this.preview)
this._previewBin.set_child(this.preview);
this._windowBox.add_child(this._titleBin);
this.actor.add_child(this._windowBox);
this._queueRepositionCloseButton();
@@ -893,6 +900,7 @@ var thumbnailPreviewList = new Lang.Class({
this._dtpSettings.connect('changed::window-previews-width', () => this._resetPreviews());
this._dtpSettings.connect('changed::window-previews-height', () => this._resetPreviews());
this._dtpSettings.connect('changed::window-preview-show-title', () => this._resetPreviews());
this._stateChangedId = this.window ? 0 :
this.app.connect('windows-changed', Lang.bind(this, this._queueRedisplay));