()
-let disposeWindowListeners: (() => void) | null = null
-
-function isMacPlatform(): boolean {
- return typeof navigator !== 'undefined' && navigator.userAgent.includes('Mac')
-}
-
-function setOptionPressed(nextPressed: boolean): void {
- if (optionPressed === nextPressed) {
- return
- }
- optionPressed = nextPressed
- for (const listener of listeners) {
- listener()
- }
-}
-
-function startWindowListeners(): void {
- if (disposeWindowListeners || !isMacPlatform() || typeof window === 'undefined') {
- return
- }
-
- const handleKeyChange = (event: KeyboardEvent): void => setOptionPressed(event.altKey)
- const handleWindowBlur = (): void => setOptionPressed(false)
- window.addEventListener('keydown', handleKeyChange, true)
- window.addEventListener('keyup', handleKeyChange, true)
- window.addEventListener('blur', handleWindowBlur)
- disposeWindowListeners = () => {
- window.removeEventListener('keydown', handleKeyChange, true)
- window.removeEventListener('keyup', handleKeyChange, true)
- window.removeEventListener('blur', handleWindowBlur)
- }
-}
-
-export function subscribeMacOptionKey(listener: OptionKeyListener): () => void {
- if (!isMacPlatform()) {
- return () => undefined
- }
- listeners.add(listener)
- startWindowListeners()
- return () => {
- listeners.delete(listener)
- if (listeners.size > 0) {
- return
- }
- disposeWindowListeners?.()
- disposeWindowListeners = null
- setOptionPressed(false)
- }
-}
-
-export function getMacOptionKeySnapshot(): boolean {
- return isMacPlatform() ? optionPressed : false
-}
-
-export function useMacOptionKeyPressed(): boolean {
- // Why: the sidebar can render dozens of cards. One shared external store
- // avoids a global key listener per card and only re-renders on Option flips.
- return useSyncExternalStore(subscribeMacOptionKey, getMacOptionKeySnapshot, () => false)
-}
diff --git a/src/renderer/src/components/sidebar/worktree-card-quick-action.ts b/src/renderer/src/components/sidebar/worktree-card-quick-action.ts
deleted file mode 100644
index f5bad051e2b..00000000000
--- a/src/renderer/src/components/sidebar/worktree-card-quick-action.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-export type WorktreeCardQuickActionKind = 'sleep' | 'delete' | null
-
-export function getWorkspaceQuickActionKind({
- hasActiveActivity,
- isDeletable,
- isInactive,
- isMacOptionPressed
-}: {
- hasActiveActivity: boolean
- isDeletable: boolean
- isInactive: boolean
- isMacOptionPressed: boolean
-}): WorktreeCardQuickActionKind {
- if (isInactive) {
- return isDeletable ? 'delete' : null
- }
- if (hasActiveActivity) {
- return isMacOptionPressed && isDeletable ? 'delete' : 'sleep'
- }
- return null
-}
diff --git a/src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx b/src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx
index 33ca8ea7a10..1d9193a5f25 100644
--- a/src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx
+++ b/src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx
@@ -11,7 +11,6 @@ import {
ChevronRight,
LoaderCircle,
MemoryStick,
- Moon,
RotateCw,
Terminal,
Trash2,
@@ -35,7 +34,6 @@ import { installWindowVisibilityInterval } from '@/lib/window-visibility-interva
import { useAppStore } from '../../store'
import { useWorktreeMap } from '../../store/selectors'
import { runWorktreeDelete } from '../sidebar/delete-worktree-flow'
-import { runSleepWorktree } from '../sidebar/sleep-worktree-flow'
import { useDaemonActions, DaemonActionDialog } from '../shared/useDaemonActions'
import type { AppMemory, UsageValues, Worktree } from '../../../../shared/types'
import { ORPHAN_WORKTREE_ID } from '../../../../shared/constants'
@@ -394,20 +392,20 @@ function SessionRow({
function WorktreeRow({
worktree,
storeRecord,
+ activeWorktreeId,
isCollapsed,
onToggle,
onNavigate,
- onSleep,
onDelete,
onKillSession,
navigateToTab
}: {
worktree: UnifiedWorktreeRow
storeRecord: Worktree | null
+ activeWorktreeId: string | null
isCollapsed: boolean
onToggle: () => void
onNavigate: () => void
- onSleep: () => void
onDelete: () => void
onKillSession: (session: UnifiedSessionRow) => void
navigateToTab: (tabId: string, paneKey: string | null) => void
@@ -420,10 +418,12 @@ function WorktreeRow({
const isSynthetic =
worktree.worktreeId === ORPHAN_WORKTREE_ID || worktree.repoId === UNATTRIBUTED_REPO_ID
const isNavigable = !isSynthetic
- // Why: Sleep / Delete affordances act on a sidebar worktree record; without
+ // Why: Delete acts on a sidebar worktree record; without
// one (synthesized SSH rows whose worktreeId isn't in worktreeById, or
- // synthetic buckets) we hide them but keep the row clickable for navigation.
- const showWorktreeActions = !isSynthetic && storeRecord !== null
+ // synthetic buckets), or for the active worktree, we hide it but keep the
+ // row clickable for navigation.
+ const showWorktreeActions =
+ !isSynthetic && storeRecord !== null && worktree.worktreeId !== activeWorktreeId
const isMainWorktree = storeRecord?.isMainWorktree ?? false
const rowLabel = storeRecord?.displayName?.trim() || worktree.worktreeName
@@ -481,25 +481,6 @@ function WorktreeRow({
{showWorktreeActions && (
-
-
-
-
-
- Sleep — close all panels in this workspace to free memory.
-
-