Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

slab-menubar: hide Dock icon, drop full-screen HUD overlay

Sets NSApplicationActivationPolicyAccessory so the menu bar app no longer
shows up in the Dock or Cmd-Tab. Removes the click-through full-screen
overlay (Overlay class, AppKit window/text-field imports, "Show desktop
HUD" menu item) — the menu bar status item is enough.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+8 -88
+1 -1
slab/README.md
··· 89 89 │ ├── lid-reactive.py # mic → pluck-arp synth (Python) 90 90 │ ├── lid-ambient-generate.py # generate ambient.wav 91 91 │ ├── lid-return-generate.py # generate lid-return.wav (smooth descending arp) 92 - │ ├── slab-menubar.py # rumps menu bar + transparent full-screen HUD 92 + │ ├── slab-menubar.py # rumps menu bar status item (no Dock icon) 93 93 │ ├── claude-sleep # sleep-state toggle 94 94 │ ├── claude-stop.sh # Stop-hook entry (prompts + subagents aware) 95 95 │ ├── claude-prompt-log.sh # UserPromptSubmit hook (touches active-prompts marker)
+7 -87
slab/bin/slab-menubar.py
··· 1 1 #!/usr/bin/env python3 2 - """Menu bar + transparent fullscreen HUD for the slab daemon. 2 + """Menu bar status item for the slab daemon. 3 3 4 - Polls lid/sleep/state every 2s and reflects status both in the menu bar 5 - title and in a click-through full-screen overlay that hugs the top-right 6 - corner of the screen (the rest of the overlay is fully transparent so the 7 - desktop shows through). 4 + Polls lid/sleep/state every 2s and reflects status in the menu bar title. 8 5 9 6 Menu bar icon legend: 10 7 ◦ idle — no Claude prompts or subagents in flight ··· 16 13 from pathlib import Path 17 14 18 15 import rumps 19 - from AppKit import ( 20 - NSBackingStoreBuffered, 21 - NSColor, 22 - NSFont, 23 - NSScreen, 24 - NSTextField, 25 - NSWindow, 26 - NSWindowCollectionBehaviorCanJoinAllSpaces, 27 - NSWindowCollectionBehaviorStationary, 28 - NSWindowStyleMaskBorderless, 29 - NSStatusWindowLevel, 30 - NSTextAlignmentRight, 31 - ) 32 - from Foundation import NSMakeRect 16 + from AppKit import NSApp, NSApplicationActivationPolicyAccessory 33 17 34 18 SLAB_HOME = Path(os.environ.get("SLAB_HOME", os.path.expanduser("~/.local/share/slab"))) 35 19 SLAB_BIN = Path(os.environ.get("SLAB_BIN", os.path.expanduser("~/.local/bin"))) ··· 80 64 return AMBIENT_FLAG.exists() 81 65 82 66 83 - class Overlay: 84 - """Full-screen, chromeless, click-through HUD. 85 - 86 - Background is fully transparent — only the small status label in the 87 - top-right corner is drawn. Sits at status-window level so it stays 88 - above normal app windows but out of the way of full-screen apps. 89 - """ 90 - def __init__(self): 91 - screen = NSScreen.mainScreen() 92 - frame = screen.frame() 93 - 94 - self.window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_( 95 - frame, NSWindowStyleMaskBorderless, NSBackingStoreBuffered, False 96 - ) 97 - self.window.setBackgroundColor_(NSColor.clearColor()) 98 - self.window.setOpaque_(False) 99 - self.window.setHasShadow_(False) 100 - self.window.setLevel_(NSStatusWindowLevel) 101 - self.window.setIgnoresMouseEvents_(True) 102 - self.window.setCollectionBehavior_( 103 - NSWindowCollectionBehaviorCanJoinAllSpaces 104 - | NSWindowCollectionBehaviorStationary 105 - ) 106 - 107 - label = NSTextField.alloc().init() 108 - label.setBezeled_(False) 109 - label.setDrawsBackground_(False) 110 - label.setEditable_(False) 111 - label.setSelectable_(False) 112 - label.setFont_(NSFont.monospacedSystemFontOfSize_weight_(14, 0)) 113 - label.setAlignment_(NSTextAlignmentRight) 114 - label.setTextColor_(NSColor.colorWithWhite_alpha_(1.0, 0.45)) 115 - label.setStringValue_("slab") 116 - 117 - w, h = 320, 22 118 - margin = 18 119 - label.setFrame_(NSMakeRect( 120 - frame.size.width - w - margin, 121 - frame.size.height - h - margin - 24, # extra margin for notch/menu bar 122 - w, h, 123 - )) 124 - self.window.contentView().addSubview_(label) 125 - self.label = label 126 - 127 - self.window.orderFrontRegardless() 128 - 129 - def update(self, text: str, accent: bool = False): 130 - self.label.setStringValue_(text) 131 - # Brighten the label when ambient is playing for gentle emphasis. 132 - alpha = 0.85 if accent else 0.45 133 - self.label.setTextColor_(NSColor.colorWithWhite_alpha_(1.0, alpha)) 134 - 135 - 136 67 class SlabApp(rumps.App): 137 68 def __init__(self): 138 69 super().__init__("slab", title="◦", quit_button=None) ··· 142 73 self.awake_item = rumps.MenuItem( 143 74 "Stay awake (lid closed)", callback=self.toggle_awake 144 75 ) 145 - self.hud_item = rumps.MenuItem("Show desktop HUD", callback=self.toggle_hud) 146 - self.hud_item.state = 1 147 76 148 77 self.menu = [ 149 78 self.status_item, ··· 154 83 self.awake_item, 155 84 rumps.MenuItem("Sleep now", callback=self.sleep_now), 156 85 None, 157 - self.hud_item, 158 86 rumps.MenuItem("Open daemon log", callback=self.open_log), 159 87 rumps.MenuItem("Open sounds folder", callback=self.open_sounds), 160 88 None, 161 89 rumps.MenuItem("Reload daemon", callback=self.reload_daemon), 162 90 rumps.MenuItem("Quit menu bar", callback=self.quit_app), 163 91 ] 164 - self.overlay = Overlay() 165 92 self.refresh(None) 166 93 167 94 @rumps.timer(2) ··· 194 121 self.subs_item.title = f"Subagents in flight: {subs}" 195 122 self.awake_item.state = 1 if sd else 0 196 123 197 - hud_text = f"slab {icon} {status}" 198 - self.overlay.update(hud_text, accent=amb) 199 - 200 124 def toggle_awake(self, sender): 201 125 cmd = "auto" if sender.state else "awake" 202 126 subprocess.run([str(SLAB_BIN / "claude-sleep"), cmd], check=False) ··· 204 128 def sleep_now(self, _): 205 129 subprocess.run([str(SLAB_BIN / "claude-sleep"), "now"], check=False) 206 130 207 - def toggle_hud(self, sender): 208 - sender.state = 0 if sender.state else 1 209 - if sender.state: 210 - self.overlay.window.orderFrontRegardless() 211 - else: 212 - self.overlay.window.orderOut_(None) 213 - 214 131 def open_log(self, _): 215 132 subprocess.run(["open", "-a", "Console", str(LID_LOG)], check=False) 216 133 ··· 229 146 230 147 231 148 if __name__ == "__main__": 232 - SlabApp().run() 149 + app = SlabApp() 150 + # Hide from Dock and Cmd-Tab — menu bar item only. 151 + NSApp.setActivationPolicy_(NSApplicationActivationPolicyAccessory) 152 + app.run()