Skip to content

Commit 05786d0

Browse files
committed
Add --low-power flag to disable visualizer
Sets cfg.Visualizer = "none" so the tick loop falls back to TickSlow (5 FPS for time/seek display only). Targets battery, slow terminals, and SSH sessions where the spectrum redraw + FFT pipeline is the dominant CPU cost. Press v in the player to cycle the visualizer back on at any time.
1 parent 6569747 commit 05786d0

4 files changed

Lines changed: 22 additions & 0 deletions

File tree

commands.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func buildApp() *cli.Command {
4343
&cli.StringFlag{Name: "audio-device", Usage: "audio output device (use 'list' to show)"},
4444
&cli.StringFlag{Name: "playlist", Usage: "load a local TOML playlist by name and start playing"},
4545
&cli.StringFlag{Name: "log-level", Usage: "log level: debug, info, warn, error"},
46+
&cli.BoolFlag{Name: "low-power", Usage: "low-power mode: disable visualizer to minimize CPU"},
4647
}
4748

4849
return &cli.Command{
@@ -195,6 +196,10 @@ func overridesFromFlags(c *cli.Command) (config.Overrides, error) {
195196
}
196197
ov.LogLevel = &v
197198
}
199+
if c.IsSet("low-power") {
200+
v := c.Bool("low-power")
201+
ov.LowPower = &v
202+
}
198203
return ov, nil
199204
}
200205

config/flags.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Overrides struct {
1919
AudioDevice *string
2020
Playlist *string
2121
LogLevel *string
22+
LowPower *bool
2223
}
2324

2425
// Apply merges non-nil overrides into cfg and clamps the result.
@@ -74,5 +75,11 @@ func (o Overrides) Apply(cfg *Config) {
7475
if o.LogLevel != nil {
7576
cfg.LogLevel = *o.LogLevel
7677
}
78+
if o.LowPower != nil && *o.LowPower {
79+
// Low-power mode disables the visualizer entirely. With Mode = None,
80+
// the tick loop falls back to TickSlow (5 FPS) for time/seek display
81+
// only — the dominant CPU sink for the TUI.
82+
cfg.Visualizer = "none"
83+
}
7784
cfg.clamp()
7885
}

docs/cli.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ cliamp --log-level debug # raise log verbosity for one sessi
3838

3939
Logs are written to `~/.config/cliamp/cliamp.log`. Levels: `debug`, `info` (default), `warn`, `error`.
4040

41+
## Low-power mode
42+
43+
```sh
44+
cliamp --low-power track.mp3 # minimize CPU: visualizer off
45+
```
46+
47+
Forces the visualizer to `none` so the TUI ticks at 5 FPS for the time/seek display only. Useful on battery, slow terminals, or SSH sessions. Press `v` in the player to cycle visualizers back on at any time.
48+
4149
## Search
4250

4351
Search and play a track directly from the command line (requires [yt-dlp](https://github.com/yt-dlp/yt-dlp)):
@@ -84,6 +92,7 @@ cliamp track.mp3 --repeat all --mono ~/Music
8492
| `--bit-depth` | int | 16 | 16, 32 |
8593
| `--playlist` | string | | local TOML playlist name |
8694
| `--log-level` | string | info | debug, info, warn, error |
95+
| `--low-power` | bool | false | disables visualizer; cuts redraw + FFT cost |
8796

8897
CLI flags override config file values for the current session only. They are not persisted.
8998

site/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,6 +2014,7 @@ <h3>Run the setup wizard</h3>
20142014
<div class="key-row"><kbd>--resample-quality &lt;n&gt;</kbd><span>1–4</span></div>
20152015
<div class="key-row"><kbd>--bit-depth &lt;n&gt;</kbd><span>PCM: 16 or 32</span></div>
20162016
<div class="key-row"><kbd>--compact</kbd><span>Cap width at 80 cols</span></div>
2017+
<div class="key-row"><kbd>--low-power</kbd><span>Disable visualizer to save CPU</span></div>
20172018
<div class="key-row"><kbd>--playlist &lt;name&gt;</kbd><span>Load TOML playlist</span></div>
20182019
<div class="key-row"><kbd>--provider &lt;name&gt;</kbd><span>Default provider</span></div>
20192020
<div class="key-row"><kbd>--upgrade</kbd><span>Update in place</span></div>

0 commit comments

Comments
 (0)