-
-
Notifications
You must be signed in to change notification settings - Fork 799
Block Level Indicators/Badges, Update TabBar Styling, Add Badges/Flags to Tabs #3009
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
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
7280bf4
update rules
sawka 4c6fd13
first cut at new block-tab based badge system
sawka 51489eb
Merge remote-tracking branch 'origin/main' into sawka/block-indicators
sawka a75253f
run go generate, fix baseds import
sawka f7fda6a
Merge remote-tracking branch 'origin/main' into sawka/block-indicators
sawka f3d27e5
move indicators to their own file (badge.ts)
sawka 95ec727
move tabindicatormap too
sawka ac7f295
move subscription to badge.ts, clean up some warnings
sawka e3aa0b8
clean up some warnings
sawka 30788d0
setup FE badge store
sawka a7acdb9
working on badge integration
sawka f980494
add clearall for badge event
sawka 260c767
add clearbyid
sawka c448ee7
add badgewatchpid
sawka f30f394
working on `wsh badge`
sawka a88c3bf
hook up pid watching to wsh badge command
sawka 8d6f2ad
checkpoint on moving from tabiindicators to badges
sawka 339cd6c
clear transient tab badges with focus as well
sawka ccf64e6
more badge migration
sawka 498e0d9
remove tabindicators (backend+frontend), more badges
sawka 09fed4e
getting the badges to show... up to 3 on a tab...
sawka 2fb15c4
add flag color
sawka 1806574
add context menu to flag tab...
sawka 144db86
remove badge persistence
sawka 820f535
focus should not clear pidlinked badges
sawka 897f2d4
update tab bar, change flag to be a flag, resort badges
sawka c737c6e
Merge remote-tracking branch 'origin/main' into sawka/block-indicators
sawka e50de18
clean up some scss
sawka ddc9cff
remove ::after psudo element, just render the dividers in react
sawka 9d1007d
dont use ctx in long running poller
sawka 2518d31
fix nits
sawka dc2315d
fix nit
sawka 64f6d4f
merge main
sawka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| // Copyright 2026, Command Line Inc. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package cmd | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "runtime" | ||
|
|
||
| "github.com/google/uuid" | ||
| "github.com/spf13/cobra" | ||
| "github.com/wavetermdev/waveterm/pkg/baseds" | ||
| "github.com/wavetermdev/waveterm/pkg/waveobj" | ||
| "github.com/wavetermdev/waveterm/pkg/wps" | ||
| "github.com/wavetermdev/waveterm/pkg/wshrpc" | ||
| "github.com/wavetermdev/waveterm/pkg/wshrpc/wshclient" | ||
| "github.com/wavetermdev/waveterm/pkg/wshutil" | ||
| ) | ||
|
|
||
| var badgeCmd = &cobra.Command{ | ||
| Use: "badge [icon]", | ||
| Short: "set or clear a block badge", | ||
| Args: cobra.MaximumNArgs(1), | ||
| RunE: badgeRun, | ||
| PreRunE: preRunSetupRpcClient, | ||
| } | ||
|
|
||
| var ( | ||
| badgeColor string | ||
| badgePriority float64 | ||
| badgeClear bool | ||
| badgeBeep bool | ||
| badgePid int | ||
| ) | ||
|
|
||
| func init() { | ||
| rootCmd.AddCommand(badgeCmd) | ||
| badgeCmd.Flags().StringVar(&badgeColor, "color", "", "badge color") | ||
| badgeCmd.Flags().Float64Var(&badgePriority, "priority", 10, "badge priority") | ||
| badgeCmd.Flags().BoolVar(&badgeClear, "clear", false, "clear the badge") | ||
| badgeCmd.Flags().BoolVar(&badgeBeep, "beep", false, "play system bell sound") | ||
| badgeCmd.Flags().IntVar(&badgePid, "pid", 0, "watch a pid and automatically clear the badge when it exits (default priority 5)") | ||
| } | ||
|
|
||
| func badgeRun(cmd *cobra.Command, args []string) (rtnErr error) { | ||
| defer func() { | ||
| sendActivity("badge", rtnErr == nil) | ||
| }() | ||
|
|
||
| if badgePid > 0 && runtime.GOOS == "windows" { | ||
| return fmt.Errorf("--pid flag is not supported on Windows") | ||
| } | ||
| if badgePid > 0 && !cmd.Flags().Changed("priority") { | ||
| badgePriority = 5 | ||
| } | ||
|
|
||
| oref, err := resolveBlockArg() | ||
| if err != nil { | ||
| return fmt.Errorf("resolving block: %v", err) | ||
| } | ||
| if oref.OType != waveobj.OType_Block && oref.OType != waveobj.OType_Tab { | ||
| return fmt.Errorf("badge oref must be a block or tab (got %q)", oref.OType) | ||
| } | ||
|
|
||
| var eventData baseds.BadgeEvent | ||
| eventData.ORef = oref.String() | ||
|
|
||
| if badgeClear { | ||
| eventData.Clear = true | ||
| } else { | ||
| icon := "circle-small" | ||
| if len(args) > 0 { | ||
| icon = args[0] | ||
| } | ||
| badgeId, err := uuid.NewV7() | ||
| if err != nil { | ||
| return fmt.Errorf("generating badge id: %v", err) | ||
| } | ||
| eventData.Badge = &baseds.Badge{ | ||
| BadgeId: badgeId.String(), | ||
| Icon: icon, | ||
| Color: badgeColor, | ||
| Priority: badgePriority, | ||
| PidLinked: badgePid > 0, | ||
| } | ||
| } | ||
|
|
||
| event := wps.WaveEvent{ | ||
| Event: wps.Event_Badge, | ||
| Scopes: []string{oref.String()}, | ||
| Data: eventData, | ||
| } | ||
|
|
||
| err = wshclient.EventPublishCommand(RpcClient, event, &wshrpc.RpcOpts{NoResponse: true}) | ||
| if err != nil { | ||
| return fmt.Errorf("publishing badge event: %v", err) | ||
| } | ||
|
|
||
| if badgeBeep { | ||
| err = wshclient.ElectronSystemBellCommand(RpcClient, &wshrpc.RpcOpts{Route: "electron"}) | ||
| if err != nil { | ||
| return fmt.Errorf("playing system bell: %v", err) | ||
| } | ||
| } | ||
|
|
||
| if badgePid > 0 && eventData.Badge != nil { | ||
| conn := RpcContext.Conn | ||
| if conn == "" { | ||
| conn = wshrpc.LocalConnName | ||
| } | ||
| connRoute := wshutil.MakeConnectionRouteId(conn) | ||
| watchData := wshrpc.CommandBadgeWatchPidData{ | ||
| Pid: badgePid, | ||
| ORef: *oref, | ||
| BadgeId: eventData.Badge.BadgeId, | ||
| } | ||
| err = wshclient.BadgeWatchPidCommand(RpcClient, watchData, &wshrpc.RpcOpts{Route: connRoute}) | ||
| if err != nil { | ||
| return fmt.Errorf("watching pid: %v", err) | ||
| } | ||
| } | ||
|
|
||
| if badgeClear { | ||
| fmt.Printf("badge cleared\n") | ||
| } else { | ||
| fmt.Printf("badge set\n") | ||
| } | ||
| return nil | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
WARNING: This command calls
BadgeWatchPidCommandwhich is only implemented inwshremote(remote server), not inwshserver(local server). When runningwsh badge --pidlocally without an SSH connection, this will fail with a "method not found" error because there's no handler in the local server. TheBadgeWatchPidCommandhandler needs to be added topkg/wshrpc/wshserver/wshserver.gofor local PID watching to work.