Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically exit the tabbed layout when only a single tab remains #392

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/extension/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,18 @@ export class Tree extends Node {
if (!this.extWm.floatingWindow(node)) cleanUpParent(existParent);
}

// If only a single tab remains, exit tabbed layout
if (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put a toggle in prefs.js and have it on by default.

this.settings.get_boolean("auto-exit-tabbed") &&
parentNode.nodeType === NODE_TYPES.CON &&
parentNode.layout === LAYOUT_TYPES.TABBED &&
parentNode.childNodes.length === 1
) {
parentNode.layout = this.extWm.determineSplitLayout();
this.resetSiblingPercent(parentNode);
parentNode.lastTabFocus = null;
}

if (node === this.attachNode) {
this.attachNode = null;
} else {
Expand Down
6 changes: 6 additions & 0 deletions lib/prefs/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ export class SettingsPage extends PreferencesPage {
{ id: "stacked", name: _("Stacked") },
],
}),
new SwitchRow({
title: _("Auto Exit Tabbed Tiling Mode"),
subtitle: _("Exit tabbed tiling mode when only a single tab remains"),
settings,
bind: "auto-exit-tabbed",
}),
new SwitchRow({
title: _("Auto Split"),
subtitle: _("Quarter Tiling"),
Expand Down
4 changes: 4 additions & 0 deletions schemas/org.gnome.shell.extensions.forge.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@
<default>true</default>
<summary>Floating windows toggle always-on-top</summary>
</key>
<key type="b" name="auto-exit-tabbed">
<default>true</default>
<summary>Exit tabbed tiling mode when only a single tab remains</summary>
</key>
<key type="b" name="auto-split-enabled">
<default>true</default>
<summary>Enable auto split or quarter-tiling based based on smaller side</summary>
Expand Down