cmd/tailscale: add systray subcommand on Linux builds

This will start including the sytray app in unstable builds for Linux,
unless the `ts_omit_systray` build flag is specified.

If we decide not to include it in the v1.88 release, we can pull it
back out or restrict it to unstable builds.

Updates #1708

Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d
Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
Will Norris
2025-08-01 14:16:00 -07:00
committed by Will Norris
parent 0f15e44196
commit 834630fedf
5 changed files with 81 additions and 4 deletions
+1
View File
@@ -261,6 +261,7 @@ change in the future.
driveCmd,
idTokenCmd,
configureHostCmd(),
systrayCmd,
),
FlagSet: rootfs,
Exec: func(ctx context.Context, args []string) error {
+24
View File
@@ -0,0 +1,24 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
//go:build linux && !ts_omit_systray
package cli
import (
"context"
"github.com/peterbourgon/ff/v3/ffcli"
"tailscale.com/client/systray"
)
var systrayCmd = &ffcli.Command{
Name: "systray",
ShortUsage: "tailscale systray",
ShortHelp: "Run a systray application to manage Tailscale",
Exec: func(_ context.Context, _ []string) error {
// TODO(will): pass localClient to menu to use the global --socket flag
new(systray.Menu).Run()
return nil
},
}
+31
View File
@@ -0,0 +1,31 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
//go:build !linux || ts_omit_systray
package cli
import (
"context"
"fmt"
"strings"
"github.com/peterbourgon/ff/v3/ffcli"
)
// TODO(will): update URL to KB article when available
var systrayHelp = strings.TrimSpace(`
The Tailscale systray app is not included in this client build.
To run it manually, see https://github.com/tailscale/tailscale/tree/main/cmd/systray
`)
var systrayCmd = &ffcli.Command{
Name: "systray",
ShortUsage: "tailscale systray",
ShortHelp: "Not available in this client build",
LongHelp: hidden + systrayHelp,
Exec: func(_ context.Context, _ []string) error {
fmt.Println(systrayHelp)
return nil
},
}