Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manual/04-navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ hl.config({

A floating workspace works like a traditional desktop: windows overlap, and you move and size them yourself. Each window gets a titlebar in your theme's colors, with buttons to minimize, maximize, and close. `Super + M` minimizes the focused window too. A minimized window waits in the dock; click its app to bring it back. Click a window to bring it forward. Resize it from any edge or corner. Double-click a titlebar to maximize the window while keeping the top bar in view, and again to get its old size back. Chrome and other Chromium-based browsers, Disks and Document Viewer skip the titlebar and use their own header instead; `Super + Alt + F` maximizes them, and `Super + M` minimizes them.

A floating workspace also shows a dock, with your pinned apps, everything that's running, and a grid of every app behind the apps button, which `Super + Alt + Space` and _Apps_ in the Omarchy menu open too. Right-click an app on the grid, or press `Delete`, to uninstall it. Click an app to open it, or to bring its window forward; click again to cycle through its windows. Files only brings back a window from the workspace you're on and otherwise opens a new one, and Terminal and Agent always start another, though a minimized window comes back first. Middle-click opens a new window. Drag an icon along the dock to move it; dragging a running app in among the others keeps it there. Right-click to keep an app in the dock, take it out, or quit it. The dock gets out of the way of a fullscreen window. Right-click the apps button to move the dock to another edge or have it hide until the pointer reaches its edge. The position is also under _Appearance > Dock > Dock Position_, and `omarchy dock position left` and `omarchy dock autohide on` set both from a terminal. Apps you keep in the dock are faded while they aren't running.
A floating workspace also shows a dock, with your pinned apps, everything that's running, and a grid of every app behind the apps button, which `Super + Alt + Space` and _Apps_ in the Omarchy menu open too. Right-click an app on the grid, or press `Delete`, to uninstall it. Click an app to open it, or to bring its window forward; click again to cycle through its windows. Files only brings back a window from the workspace you're on and otherwise opens a new one, and Terminal and Agent always start another, though a minimized window comes back first. Middle-click opens a new window. Drag an icon along the dock to move it; dragging a running app in among the others keeps it there. Right-click to keep an app in the dock, take it out, or quit it. The dock gets out of the way of a fullscreen window, and of any window over it; push the pointer to its edge to bring it back. Right-click the apps button to move the dock to another edge or have it hide until the pointer reaches its edge. The position is also under _Appearance > Dock > Dock Position_, and `omarchy dock position left` and `omarchy dock autohide on` set both from a terminal. Apps you keep in the dock are faded while they aren't running.

New workspaces, and any you haven't given a layout of their own with `Super + L`, use the default layout. Changing the default resets every workspace without windows to it, while one with windows on it keeps the layout it has. A window minimized to the dock still counts as a window on the workspace it left. Pick it under _Appearance > Workspace Layout_: Tiling, Scrolling, or Floating. `omarchy-hyprland-workspace-layout-default scrolling` sets it from a terminal.

Expand Down
2 changes: 1 addition & 1 deletion shell/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ runs inside the long-lived `omarchy-shell` process, replacing the old

## Dock

App dock shown on floating workspaces, and hidden on tiled ones and behind a fullscreen window. Floating is not a Hyprland layout, so the dock reads each workspace's mode through `omarchy-hyprland-workspace-layout-current`, caches it, and is told to read again over `omarchy-shell omarchy.dock refresh` by the layout commands. `omarchy-shell omarchy.dock apps` toggles its grid of every app.
App dock shown on floating workspaces, and hidden on tiled ones and behind a fullscreen window. A maximized window, or any window over it (`DockModel.coversDock`, which also counts a special workspace open over the screen), tucks it away the way auto-hide does, so its edge still brings it back. Hyprland announces windows opening, closing, gaining focus, and changing workspace or floating, but not a floating window being moved or resized, so while a dock is out on a floating workspace with nothing else hiding it, one shared 250 ms timer also refreshes the window list; it starts no process. Floating is not a Hyprland layout, so the dock reads each workspace's mode through `omarchy-hyprland-workspace-layout-current`, caches it, and is told to read again over `omarchy-shell omarchy.dock refresh` by the layout commands. `omarchy-shell omarchy.dock apps` toggles its grid of every app.

Its settings live in the `dock:` subtree of `shell.json`: `position` (`top`, `bottom`, `left` or `right`) and `pinned` (desktop ids). A `shell.json` without pins uses the defaults. `omarchy dock` sets both.

Expand Down
29 changes: 29 additions & 0 deletions shell/plugins/dock/Dock.qml
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,38 @@ Item {
Hyprland.refreshWorkspaces()
Hyprland.refreshToplevels()
}
// Nor where windows are, which decides whether one covers the dock, nor
// a special workspace opening over a monitor.
else if (name === "activespecialv2") {
Hyprland.refreshMonitors()
Hyprland.refreshToplevels()
}
else if (root.watchingCover && root.coverEvents.indexOf(name) !== -1) Hyprland.refreshToplevels()
}
}

// A window covering the dock hides it (DockWindow.covered). Hyprland
// announces windows opening, closing, gaining focus and changing workspace or
// floating, but not a floating window being moved or resized, so while a dock
// is out on a floating workspace with nothing else hiding it, the window list
// is also refreshed a few times a second.
readonly property var coverEvents: ["openwindow", "closewindow", "movewindowv2", "changefloatingmode", "activewindowv2", "minimized"]
readonly property bool watchingCover: {
if (root.autohide) return false
var windows = docks.instances
for (var i = 0; i < windows.length; i++) {
if (windows[i].shown && windows[i].fullscreenMode === 0) return true
}
return false
}

Timer {
interval: 250
repeat: true
running: root.watchingCover
onTriggered: Hyprland.refreshToplevels()
}

ShellIpc {
target: "omarchy.dock"

Expand Down
26 changes: 26 additions & 0 deletions shell/plugins/dock/DockModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,31 @@ function isMinimizedWorkspace(name) {
return String(name || "") === MINIMIZED_WORKSPACE
}

// Whether a window covers the dock: its client area, the border around it, and
// the titlebar above it on a floating workspace, against where the dock's
// icons sit when it is out. Windows are { workspaceId, workspaceName,
// at: [x, y], size: [w, h], hidden, mapped, tags }, from Hyprland; on is the
// dock screen's workspace id and the name of a special workspace open over it
// (named: Hyprland 0.57 gives special workspaces no id).
var TITLEBAR_HEIGHT = 30 // Omarchy's titlebar (default/hypr/workspace-modes.lua)
var BORDER = 2

function coversDock(windows, dockBox, on) {
for (var i = 0; i < (windows || []).length; i++) {
var w = windows[i]
if (!w || !(w.workspaceId === on.workspaceId || (on.special && w.workspaceName === on.special))) continue
if (!w.at || !w.size || w.hidden || w.mapped === false) continue
// Windows on a floating workspace have a titlebar, except apps drawing their
// own frame, which window snapping tags (default/hypr/workspace-modes.lua).
var tags = (w.tags || []).map(function(tag) { return String(tag).replace(/\*$/, "") })
var titled = tags.indexOf("omarchy-floating-workspace") !== -1 && tags.indexOf("omarchy-self-framed") === -1
var top = BORDER + (titled ? TITLEBAR_HEIGHT : 0)
if (w.at[0] - BORDER < dockBox.x + dockBox.width && w.at[0] + w.size[0] + BORDER > dockBox.x
&& w.at[1] - top < dockBox.y + dockBox.height && w.at[1] + w.size[1] + BORDER > dockBox.y) return true
}
return false
}

// A terminal app's window carries the app id its launcher gave the terminal,
// which no desktop entry names as its class. The entry that passes that app id
// claims it, and so does a terminal entry for the command Omarchy's TUI
Expand Down Expand Up @@ -216,6 +241,7 @@ if (typeof module !== "undefined") {
pinnedIds: pinnedIds,
isDockWindow: isDockWindow,
isMinimizedWorkspace: isMinimizedWorkspace,
coversDock: coversDock,
claimingEntryId: claimingEntryId,
standInKey: standInKey,
buildItems: buildItems,
Expand Down
46 changes: 42 additions & 4 deletions shell/plugins/dock/DockWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,32 @@ PanelWindow {
return mode
}
readonly property bool shown: !!dock && dock.isFloating(workspaceId) && fullscreenMode < 2
// A special workspace, such as the scratchpad, open over the workspace on
// this screen: its windows sit above the workspace's, and the dock's too.
readonly property string specialWorkspace: {
var ipc = monitor ? monitor.lastIpcObject : null
return ipc && ipc.specialWorkspace && ipc.specialWorkspace.name ? String(ipc.specialWorkspace.name) : ""
}
// Whether a window on the workspace, or on a special workspace open over it,
// reaches over the dock: its client area, the border around it, and the
// titlebar above it on a floating workspace, against where the dock's icons
// sit when it is out.
readonly property bool covered: {
if (!shown || !screen) return false
var windows = []
var toplevels = Hyprland.toplevels.values
for (var i = 0; i < toplevels.length; i++) {
var ipc = toplevels[i].lastIpcObject
if (!toplevels[i].workspace || !ipc) continue
windows.push({ workspaceId: toplevels[i].workspace.id, workspaceName: toplevels[i].workspace.name, at: ipc.at, size: ipc.size, hidden: ipc.hidden, mapped: ipc.mapped, tags: ipc.tags })
}
return DockModel.coversDock(windows, shownBodyBox(), { workspaceId: workspaceId, special: specialWorkspace })
}
// With auto-hide on, the dock waits off screen until the pointer reaches its
// edge, and stays while the pointer, a menu, or a drag still needs it. A
// maximized window hides the dock the same way, so it can still be called up.
readonly property bool autohide: !!dock && (dock.autohide || fullscreenMode === 1)
// maximized window hides the dock the same way, so it can still be called up,
// and so does any window that covers it.
readonly property bool autohide: !!dock && (dock.autohide || fullscreenMode === 1 || covered)
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
property bool revealed: false
readonly property bool menuOpen: menuItem !== null || settingsMenu
readonly property bool tucked: autohide && !(revealed || menuOpen || dragging || insertIndex >= 0)
Expand Down Expand Up @@ -93,6 +115,20 @@ PanelWindow {
return Qt.point(x, y)
}

// Where the icons sit when the dock is out, in Hyprland's global layout
// coordinates, whether it is out now or tucked away: the body's own
// placement below, without the tuck.
function shownBodyBox() {
var at = window.origin()
var x = window.position === "left" ? window.gap
: window.position === "right" ? window.width - body.width - window.gap
: Math.round((window.width - body.width) / 2)
var y = window.position === "top" ? window.gap
: window.position === "bottom" ? window.height - body.height - window.gap
: Math.round((window.height - body.height) / 2)
return Qt.rect(screen.x + at.x + x, screen.y + at.y + y, body.width, body.height)
}

// An app from the app grid lands where the pointer is, once it is over the
// dock or close to it on the inward side.
function moveExternalDrag(screenX, screenY) {
Expand Down Expand Up @@ -618,9 +654,11 @@ PanelWindow {
PopupMenuRow {
visible: window.settingsMenu
text: Commons.I18n.t("dock.autoHide")
checked: window.autohide
// The saved setting, not whether the dock is hiding now: a maximized or
// covering window hides it too, and the toggle would only save it again.
checked: !!dock && dock.autohide
onTriggered: {
Util.execDetached("omarchy-dock autohide " + (window.autohide ? "off" : "on"))
Util.execDetached("omarchy-dock autohide " + (dock && dock.autohide ? "off" : "on"))
window.closeMenu()
}
}
Expand Down
16 changes: 16 additions & 0 deletions test/shell.d/dock-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ assertDeepEqual(
assertDeepEqual(dock.pinnedIds({}, { pinned: ['spotify'] }), ['spotify'], 'dock falls back to the default pins')
assertDeepEqual(dock.pinnedIds({ pinned: [] }, { pinned: ['spotify'] }), [], 'dock keeps an emptied pin list empty')

// A dock at the bottom of a 1280x720 screen, 96x48 at 592,669: hidden while a
// window covers it, not while one only comes close.
const dockBox = { x: 592, y: 669, width: 96, height: 48 }
const win = (extra) => Object.assign({ workspaceId: 1, at: [400, 300], size: [500, 300], tags: [] }, extra)
assert(dock.coversDock([win({ at: [400, 500] })], dockBox, { workspaceId: 1 }), 'a window over the dock covers it')
assert(dock.coversDock([win({ size: [500, 368] })], dockBox, { workspaceId: 1 }), 'a window whose border reaches the dock covers it')
assert(!dock.coversDock([win({ size: [500, 366] })], dockBox, { workspaceId: 1 }), 'a window just clear of the dock leaves it out')
assert(!dock.coversDock([win({ at: [400, 500], workspaceId: 2 })], dockBox, { workspaceId: 1 }), "another workspace's window does not cover it")
assert(dock.coversDock([win({ at: [400, 500], workspaceId: undefined, workspaceName: 'special:scratchpad' })], dockBox, { workspaceId: 1, special: 'special:scratchpad' }), 'a window on a special workspace open over it covers it')
assert(!dock.coversDock([win({ at: [400, 500], workspaceId: undefined, workspaceName: 'special:scratchpad' })], dockBox, { workspaceId: 1, special: '' }), 'a closed special workspace does not cover it')
assert(!dock.coversDock([win({ at: [400, 500], hidden: true })], dockBox, { workspaceId: 1 }), 'a hidden window does not cover it')
const topDock = { x: 592, y: 4, width: 96, height: 48 }
assert(dock.coversDock([win({ at: [400, 80], tags: ['omarchy-floating-workspace*'] })], topDock, { workspaceId: 1 }), 'a titlebar reaching over a dock at the top covers it')
assert(!dock.coversDock([win({ at: [400, 80] })], topDock, { workspaceId: 1 }), 'a window without a titlebar below a dock at the top leaves it out')
assert(!dock.coversDock([win({ at: [400, 80], tags: ['omarchy-floating-workspace*', 'omarchy-self-framed*'] })], topDock, { workspaceId: 1 }), 'an app drawing its own frame gets no titlebar, so it leaves a dock at the top out')

const app = (key, id, extra) => Object.assign({ key, id, hasEntry: true, workspaceId: 3 }, extra)
const items = dock.buildItems(['chromium', 'Alacritty'], [
app('signal', 1),
Expand Down