SLOPSHOPPER

tmux-attention

Flags the tmux window hosting Claude with @claude ask or done

guardpromptprocess
A shopper browsing a rack in a slop shop
README

Dotfiles

Managed using GNU Stow

Reminders

Structure: "name-of-package"/path-to/destination stow "package-to-install" to set up symlinks stow -D "package-to-uninstall" to remove symlinks

OMP on Omarchy

Install both packages with stow omp omarchy, then apply an Omarchy theme to generate the OMP palette. Restart OMP once after setup so it starts with the custom theme's file watcher. Subsequent Omarchy theme switches update OMP live. Changing the theme through Appearance settings alone does not start the watcher in the current OMP runtime.

Vivaldi on Omarchy

Install the packages and browser UI modification from the repository root as your desktop user:

make install-vivaldi

The target runs Stow, prompts for sudo to patch Vivaldi's system resources, and reapplies the current Omarchy theme. Stow alone is not sufficient. Restart Vivaldi once after it completes. Subsequent theme switches update its interface within about a second, without a debugging port or local server. The integration selects its own Omarchy theme and disables Vivaldi's theme scheduling.

Run make install-vivaldi again after Vivaldi updates, then restart the browser. The modification uses Vivaldi's internal API and may need changes when that API changes. The installation supports one desktop user and shares that user's palette with every Vivaldi profile using this installation.

To stop syncing, remove the omarchy-theme.js script tag from /opt/vivaldi/resources/vivaldi/window.html, restart Vivaldi, and select your preferred theme and scheduling settings.

Required tools

  • stow
  • make
  • kitty
  • tmux and TPM
  • starship
  • gh, with extensions dlvhdr/gh-dash and dlvhdr/gh-enhance
  • lazygit
  • lazydocker
  • fzf
  • ripgrep
  • zoxide
  • eza
  • uv
  • python 3.14 or newer
  • stylua
  • dcg, from github.com/Dicklesworthstone/destructive_command_guard, and jq
  • shellcheck and lua-language-server, installed by nvim through Mason
Source 1 files
hooks/register.ts 92 lines
1import type { AgentStatus, EngineInterface, ProcessRunResult, Register } from 'claude-code'
2
3const DONE_AFTER_MS = 20_000
4const BUSY_AGENT_STATUSES: ReadonlySet<AgentStatus> = new Set(['pending', 'running', 'waiting'])
5
6let isFlagRaised = false
7let promptedAt: number | undefined
8let isWakeUp = false
9const askingToolUseIds = new Set<string>()
10
11function tmux($: EngineInterface, args: readonly string[]): Promise<ProcessRunResult> {
12  return $.process.run(['tmux', ...args])
13}
14
15async function clearFlag($: EngineInterface): Promise<void> {
16  const pane = await $.env.get('TMUX_PANE')
17  if (pane === undefined || !isFlagRaised) return
18  isFlagRaised = false
19  await tmux($, ['set-option', '-w', '-t', pane, '-u', '@claude'])
20}
21
22async function raiseFlag($: EngineInterface, flag: 'ask' | 'done'): Promise<void> {
23  const pane = await $.env.get('TMUX_PANE')
24  if (pane === undefined) return
25
26  const shown = await tmux($, [
27    'display', '-p', '-t', pane, '-F',
28    '#{pane_active}\t#{window_active}\t#{session_attached}\t#{session_name}',
29  ])
30  if (shown.exitCode !== 0) return
31  const [paneActive, windowActive, sessionAttached, sessionName = ''] = shown.stdout.trim().split('\t')
32
33  const clients = await tmux($, ['list-clients', '-t', sessionName, '-F', '#{client_flags}'])
34  const isFocused = clients.stdout.split('\n').some(flags => flags.includes('focused'))
35  const isWatched = paneActive === '1' && windowActive === '1' && sessionAttached !== '0' && isFocused
36  if (isWatched) return
37
38  isFlagRaised = true
39  await tmux($, ['set-option', '-w', '-t', pane, '@claude', flag])
40}
41
42async function isAgentBusy($: EngineInterface): Promise<boolean> {
43  const agents = await $.agent.list()
44  return agents.some(agent => BUSY_AGENT_STATUSES.has(agent.status))
45}
46
47async function startAsking($: EngineInterface, toolUseId: string): Promise<void> {
48  if (askingToolUseIds.has(toolUseId)) return
49  askingToolUseIds.add(toolUseId)
50  await raiseFlag($, 'ask')
51}
52
53async function stopAsking($: EngineInterface, toolUseId: string): Promise<void> {
54  if (!askingToolUseIds.delete(toolUseId) || askingToolUseIds.size > 0) return
55  await clearFlag($)
56}
57
58export const register: Register = on => {
59  on('prompt.submit', async ($, e, next) => {
60    const isFromUser = e.origin.kind === 'composer' || e.origin.kind === 'bridge'
61    const startsTurn = e.turnId === undefined
62    if (startsTurn) isWakeUp = e.origin.kind === 'task-notification'
63    if (isFromUser || (startsTurn && !isWakeUp)) promptedAt = await $.clock.now()
64    if (isFromUser) {
65      askingToolUseIds.clear()
66      await clearFlag($)
67    }
68    return next(e)
69  })
70
71  on('tool.call', async ($, e, next) => {
72    try {
73      if (e.agentId === undefined && (e.tool === 'AskUserQuestion' || e.tool === 'ExitPlanMode')) await startAsking($, e.tool_use_id)
74      return await next(e)
75    } finally {
76      await stopAsking($, e.tool_use_id)
77    }
78  })
79
80  on('turn.complete', async ($, e, next) => {
81    if (e.agentId === undefined) {
82      const wasWakeUp = isWakeUp
83      isWakeUp = false
84      if (!e.isAborted) {
85        const elapsedMs = wasWakeUp && promptedAt !== undefined ? (await $.clock.now()) - promptedAt : e.durationMs
86        if (elapsedMs >= DONE_AFTER_MS && !(await isAgentBusy($))) await raiseFlag($, 'done')
87      }
88    }
89    return next(e)
90  })
91}
92