Sweets

Window groups and tabs

Group tiled windows into one slot and switch between them

A group puts several windows in one tile. One window shows at a time. The tab bar sits above the window by default.

Bindings

There are no default bindings. These are suggestions:

sweets.bind("MOD+G", "group_toggle")
sweets.bind("MOD+Ctrl+G", "group_lock_toggle")
sweets.bind("MOD+Tab", "tab", "next")
sweets.bind("MOD+Shift+Tab", "tab", "prev")
sweets.bind("MOD+Alt+Left", "group_join_left")
sweets.bind("MOD+Alt+Right", "group_join_right")
sweets.bind("MOD+Alt+Up", "group_join_up")
sweets.bind("MOD+Alt+Down", "group_join_down")
sweets.bind("MOD+Alt+G", "group_leave")
sweets.bind("MOD+Alt+Tab", "tab_move", "next")
sweets.bind("MOD+Alt+Shift+Tab", "tab_move", "prev")
ActionResult
group_lock_toggleLock or unlock the focused group against new members
tab_bar_showShow the focused group's bar, even with one tab
tab_bar_hideHide the focused group's bar and use its space for the window
tab_bar_toggleShow or hide the focused group's bar
tab_bar_resetReturn the focused group's bar to your tab settings
group_toggleTurn the window into a group, or ungroup it
group_join_left/right/up/downJoin the window next to it
group_leaveTake the window out of its group
tab"next", "prev", or a tab number
tab_moveMove the tab "next" or "prev"

Mouse

  • Click a tab to show it.
  • Middle-click a tab to close it, unless middle_click_close is false.
  • Scroll over the bar to switch tabs, unless scroll_to_switch is false.
  • Drag along the bar to reorder tabs when you release.
  • Drag a tab off the bar to take it out of the group.
  • Drop a window on a tab bar to add it to that group.

A dragged-out tab becomes a normal window. Move it back over the bar in the same drag to undo.

The left and right halves of a tab insert before and after it. An insertion marker shows the position unless general.insert_hint is false.

Moving a group, by keyboard or by dragging the window, moves all its tabs.

Open new windows as tabs

sweets.tabs({ new_window = "group", new_tab_position = "end" })

New windows join the focused group. By default they open after the shown tab. Use "end" to put them at the end of the group.

Use a window rule to keep one app out.

sweets.window_rule({ app_id = "mpv", group = false })

Lock incoming tabs

Focus a group and use group_lock_toggle to keep new windows out. The shown tab and Waybar module display [locked]. Use the same action to unlock it.

The lock blocks every way a window can join, including window rules. You can still select, reorder, detach, minimize, close, or move existing tabs, and group_toggle still dissolves the group. The lock stays through moves and reloads.

Hide one group's bar

sweets.bind("MOD+Ctrl+Alt+T", "tab_bar_toggle")
sweets.bind("MOD+Ctrl+Shift+T", "tab_bar_reset")

Hiding the bar gives its space to the window. Keyboard tab switching still works. Other groups keep their own bars.

The choice stays through moves and configuration reloads. Use tab_bar_reset to follow hide_when_single again. tab_bar_show also shows a single tab.

sweets.tabs

sweets.tabs({
  middle_click_close = true,
  scroll_to_switch = true,
  height = 24,
  gap = 4,
  spacing = 0,
  border = { width = 0, color = "#333338" },
  font = "Sans 10",
  hide_when_single = false,
  colors = {
    focused = "#c27aff",
    active = "#333338",
    inactive = "#282828",
    urgent = "#f7768e",
  },
})
FieldDefaultEffect
new_window"group" in the installed configOpen new windows as tabs. Use "tile" for separate windows
new_tab_position"next"Insert after the shown tab, or use "end" to append
middle_click_closetrueMiddle-click a tab to close it; false ignores the click
scroll_to_switchtrueWheel over a tab to switch tabs; false ignores scrolling
position"top"Put the bar above ("top") or below ("bottom") the window
height24Bar height, 1–128
gap4Space between the bar and the window, 0–64
spacing0Space between neighboring tabs, 0–64
corner_radius4Tab corner radius, 0–64
border.width0Outline inside each tab, 0–64; 0 turns it off
border.color"#333338"Outline color for all tabs; gradients allowed
hide_when_singlefalseHide the bar when a group has one tab
font"Sans 10"Tab font
align"left""left" or "center" titles
iconstrueShow app icons
colors.focused"#c27aff"Shown tab in the focused group
colors.active"#333338"Shown tab in other groups
colors.inactive"#282828"Hidden tabs
colors.urgent"#f7768e"Tab asking for attention
text.focused, text.active, text.inactive, text.urgent"#ffffff"Title colors

Set position = "bottom" in your tabs table to move the bar below the window. Reloading applies the position to existing groups.

gap controls the space between the window and the bar. Set spacing = 6 for six pixels between tabs. Clicking between tabs does nothing. Dropping a window there joins the group.

Set border.width to 1 for a one-pixel outline. The outline follows corner_radius and fits inside the existing tab height. Titles and icons stay inside it. Tab spacing and click areas stay the same.

Icons use published pixels first, then the theme or desktop entry. Choose the shared theme with general.icon_theme.

Colors work like border colors, gradients included.

Scrolling layout

In the scrolling layout, group_toggle turns the whole column into tabs. Toggle again to stack them. consume_or_expel_left/right adds a window to a tabbed column or takes it out.

Waybar module

Show the focused group's tabs in Waybar. You need Python 3.

From the Sweets source directory:

mkdir -p ~/.config/waybar
cp scripts/sweets-waybar-tabs ~/.config/waybar/

Add the module to your Waybar config and restart Waybar:

"custom/sweets-tabs": {
  "exec": "python3 ~/.config/waybar/sweets-waybar-tabs",
  "return-type": "json",
  "format": "{text}",
  "escape": false,
  "hide-empty-text": true,
  "restart-interval": 2,
  "exec-on-event": false,
  "on-scroll-up": "python3 ~/.config/waybar/sweets-waybar-tabs --previous",
  "on-scroll-down": "python3 ~/.config/waybar/sweets-waybar-tabs --next"
}

Then add "custom/sweets-tabs" to a module list. Optional styles are in config/waybar/tabs.css.

Keep "escape": false. The helper already escapes window titles.

On this page