-
Notifications
You must be signed in to change notification settings - Fork 773
Tab background glow on process exit/bell #2835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -526,6 +526,34 @@ func (bc *ShellController) manageRunningShellProcess(shellProc *shellexec.ShellP | |
| shellInputCh := make(chan *BlockInputUnion, 32) | ||
| bc.ShellInputCh = shellInputCh | ||
|
|
||
| // Fire amber "running" indicator for cmd blocks | ||
| if bc.ControllerType == BlockController_Cmd { | ||
| exitIndicatorEnabled := blockMeta.GetBool(waveobj.MetaKey_TermExitIndicator, false) | ||
| if !blockMeta.HasKey(waveobj.MetaKey_TermExitIndicator) { | ||
| if globalVal := wconfig.GetWatcher().GetFullConfig().Settings.TermExitIndicator; globalVal != nil { | ||
| exitIndicatorEnabled = *globalVal | ||
| } | ||
| } | ||
| if exitIndicatorEnabled { | ||
| indicator := wshrpc.TabIndicator{ | ||
| Icon: "spinner+spin", | ||
| Color: "#f59e0b", | ||
| Priority: 1.5, | ||
| ClearOnFocus: false, | ||
| } | ||
| eventData := wshrpc.TabIndicatorEventData{ | ||
| TabId: bc.TabId, | ||
| Indicator: &indicator, | ||
| } | ||
| event := wps.WaveEvent{ | ||
| Event: wps.Event_TabIndicator, | ||
| Scopes: []string{waveobj.MakeORef(waveobj.OType_Tab, bc.TabId).String()}, | ||
| Data: eventData, | ||
| } | ||
| wps.Broker.Publish(event) | ||
| } | ||
| } | ||
|
Comment on lines
+529
to
+555
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running indicator logic looks good. Global settings fallback is correctly implemented, and the indicator is appropriately scoped to One edge case: if the user disables Proposed fix+ // Always clear the running indicator for cmd blocks
+ if blockData.Meta.GetString(waveobj.MetaKey_Controller, "") == BlockController_Cmd {
+ clearEvent := wps.WaveEvent{
+ Event: wps.Event_TabIndicator,
+ Scopes: []string{waveobj.MakeORef(waveobj.OType_Tab, bc.TabId).String()},
+ Data: wshrpc.TabIndicatorEventData{TabId: bc.TabId, Indicator: nil},
+ }
+ wps.Broker.Publish(clearEvent)
+ }
if !exitIndicatorEnabled {
return
} |
||
|
|
||
| go func() { | ||
| // handles regular output from the pty (goes to the blockfile and xterm) | ||
| defer func() { | ||
|
|
@@ -616,6 +644,77 @@ func (bc *ShellController) manageRunningShellProcess(shellProc *shellexec.ShellP | |
| msg = fmt.Sprintf("%s (exit code %d)", baseMsg, exitCode) | ||
| } | ||
| bc.writeMutedMessageToTerminal("[" + msg + "]") | ||
| go func(exitCode int, exitSignal string) { | ||
| defer func() { | ||
| panichandler.PanicHandler("blockcontroller:exit-indicator", recover()) | ||
| }() | ||
| ctx, cancelFn := context.WithTimeout(context.Background(), DefaultTimeout) | ||
| defer cancelFn() | ||
| blockData, err := wstore.DBMustGet[*waveobj.Block](ctx, bc.BlockId) | ||
| if err != nil { | ||
| log.Printf("error getting block data for exit indicator: %v\n", err) | ||
| return | ||
| } | ||
| exitIndicatorEnabled := blockData.Meta.GetBool(waveobj.MetaKey_TermExitIndicator, false) | ||
| if !blockData.Meta.HasKey(waveobj.MetaKey_TermExitIndicator) { | ||
| if globalVal := wconfig.GetWatcher().GetFullConfig().Settings.TermExitIndicator; globalVal != nil { | ||
| exitIndicatorEnabled = *globalVal | ||
| } | ||
| } | ||
| if !exitIndicatorEnabled { | ||
| return | ||
| } | ||
| closeOnExit := blockData.Meta.GetBool(waveobj.MetaKey_CmdCloseOnExit, false) | ||
| closeOnExitForce := blockData.Meta.GetBool(waveobj.MetaKey_CmdCloseOnExitForce, false) | ||
| if closeOnExitForce || (closeOnExit && exitCode == 0) { | ||
| // Clear running indicator before block gets deleted | ||
| if bc.ControllerType == BlockController_Cmd { | ||
| clearEvent := wps.WaveEvent{ | ||
| Event: wps.Event_TabIndicator, | ||
| Scopes: []string{waveobj.MakeORef(waveobj.OType_Tab, bc.TabId).String()}, | ||
| Data: wshrpc.TabIndicatorEventData{TabId: bc.TabId, Indicator: nil}, | ||
| } | ||
| wps.Broker.Publish(clearEvent) | ||
| } | ||
| return | ||
| } | ||
| // Clear running indicator before exit indicator to prevent | ||
| // PersistentIndicator from resurrecting the amber glow | ||
| if bc.ControllerType == BlockController_Cmd { | ||
| clearEvent := wps.WaveEvent{ | ||
| Event: wps.Event_TabIndicator, | ||
| Scopes: []string{waveobj.MakeORef(waveobj.OType_Tab, bc.TabId).String()}, | ||
| Data: wshrpc.TabIndicatorEventData{TabId: bc.TabId, Indicator: nil}, | ||
| } | ||
| wps.Broker.Publish(clearEvent) | ||
| } | ||
| var indicator wshrpc.TabIndicator | ||
| if exitCode == 0 && exitSignal == "" { | ||
| indicator = wshrpc.TabIndicator{ | ||
| Icon: "check", | ||
| Color: "#4ade80", | ||
| Priority: 2, | ||
| ClearOnFocus: true, | ||
| } | ||
| } else { | ||
| indicator = wshrpc.TabIndicator{ | ||
| Icon: "xmark-large", | ||
| Color: "#f87171", | ||
| Priority: 2, | ||
| ClearOnFocus: true, | ||
| } | ||
| } | ||
| eventData := wshrpc.TabIndicatorEventData{ | ||
| TabId: bc.TabId, | ||
| Indicator: &indicator, | ||
| } | ||
| event := wps.WaveEvent{ | ||
| Event: wps.Event_TabIndicator, | ||
| Scopes: []string{waveobj.MakeORef(waveobj.OType_Tab, bc.TabId).String()}, | ||
| Data: eventData, | ||
| } | ||
| wps.Broker.Publish(event) | ||
| }(exitCode, exitSignal) | ||
| go checkCloseOnExit(bc.BlockId, exitCode) | ||
| }() | ||
| return nil | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mismatched amber fallback colors between background glow and icon.
Line 232 uses
#f59e0b(amber-500) for the background glow fallback, while Line 255 uses#fbbf24(amber-400) for the icon color fallback. These should likely be the same value for visual consistency when no explicitindicator.coloris provided.🐛 Proposed fix
Or extract a shared constant:
Also applies to: 255-255
🤖 Prompt for AI Agents