Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Option for thumbnails at the overview bottom #67

Open
wants to merge 2 commits into
base: 3.28
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 38 additions & 0 deletions workspace-grid@mathematical.coffee.gmail.com/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,39 @@ function _replaceThumbnailsBoxActor (actorCallbackObject) {
slider.actor.add_actor(thumbnailsBox.actor);
}

let switcher_placement_overriden = false;
let bin_thumbnails = null;
function overrideSwitcherPlacement(do_override) {
let controls = Main.overview._controls;
if (do_override && !switcher_placement_overriden) {
// Place the workspace switcher at the bottom //
//// Remove the thumbnails switcher from the overview
controls._group.remove_actor(controls._thumbnailsSlider.actor);
//// Add it again, but not to the main layout
bin_thumbnails = new St.Bin({
child: controls._thumbnailsSlider.actor,
x_align: St.Align.MIDDLE
});
Main.overview._overview.add(bin_thumbnails);
//// Refresh (not sure if this is needed)
refreshThumbnailsBox();
//// Record this modification
switcher_placement_overriden = true;
} else if (!do_override && switcher_placement_overriden) {
// Restore placement
//// Remove it from the from the overview outer layout
Main.overview._overview.remove_actor(bin_thumbnails);
bin_thumbnails.remove_actor(controls._thumbnailsSlider.actor);
bin_thumbnails.destroy();
//// Restore the switcher to its original location
controls._group.add_actor(controls._thumbnailsSlider.actor);
//// Refresh (not sure if this is needed)
refreshThumbnailsBox();
//// Record this modification
switcher_placement_overriden = false;
}
}

/**
* We need to:
* 1) override the scroll event on workspaces display to allow sideways
Expand Down Expand Up @@ -1275,6 +1308,11 @@ function enable() {
signals.push(settings.connect('changed::' + KEY_COLS, nWorkspacesChanged));
signals.push(settings.connect('changed::' + KEY_MAX_HFRACTION, refreshThumbnailsBox));
signals.push(settings.connect('changed::' + KEY_MAX_HFRACTION_COLLAPSE, refreshThumbnailsBox));

// Connect to the overlay key to modify the thumbnails box position if the user so desires
signals.push(global.display.connect('overlay-key', () => {
overrideSwitcherPlacement(settings.get_boolean(Prefs.KEY_PLACE_SWITCHER_BOTTOM));
}));
}

function disable() {
Expand Down
4 changes: 4 additions & 0 deletions workspace-grid@mathematical.coffee.gmail.com/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ var KEY_MAX_HFRACTION = 'max-screen-fraction';
var KEY_MAX_HFRACTION_COLLAPSE = 'max-screen-fraction-before-collapse';
var KEY_SHOW_WORKSPACE_LABELS = 'show-workspace-labels';
var KEY_RELATIVE_WORKSPACE_SWITCHING ="relative-workspace-switching";
var KEY_PLACE_SWITCHER_BOTTOM = "place-switcher-bottom";

function init() {
Convenience.initTranslations();
Expand Down Expand Up @@ -99,6 +100,9 @@ const WorkspaceGridPrefsWidget = new GObject.Class({
this.addBoolean(_("Show workspace labels in the switcher?"),
KEY_SHOW_WORKSPACE_LABELS);

this.addBoolean(_("Place the overview workspace switcher at the bottom?"),
KEY_PLACE_SWITCHER_BOTTOM);

item = new Gtk.Label({
label: _("The following settings determine how much horizontal " +
"space the workspaces box\n in the overview can take up, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
<summary>Whether to show workspace names in the workspace switcher popup</summary>
<description>Whether to show workspace names in the workspace switcher popup</description>
</key>
<key type="b" name="place-switcher-bottom">
<default>false</default>
<summary>Whether to place the workspace switcher at the bottom of the overview screen</summary>
<description>Whether to place the workspace switcher at the bottom of the overview screen</description>
</key>
<key type="d" name="max-screen-fraction">
<default>0.7</default>
<range min="0" max="1.0"/>
Expand Down