More pulseaudio settings, fix formatting for indicator boxes

* Add setting that defines whether to exit pulseaudio daemon or not
* Fix styling of all indicators (use font settings instead of default box settings)
* Set defaults for battery, clock and volume indicators
This commit is contained in:
eleksir
2024-03-14 00:47:01 +03:00
parent 92bddadd9d
commit bb797d75b4
2 changed files with 22 additions and 9 deletions

View File

@@ -248,14 +248,15 @@ type MyConfig struct {
} `json:"vpn,omitempty"` } `json:"vpn,omitempty"`
SimpleVolumePa struct { SimpleVolumePa struct {
Enabled bool `json:"enabled,omitempty"` Enabled bool `json:"enabled,omitempty"`
Color string `json:"color,omitempty"` Color string `json:"color,omitempty"`
Background string `json:"background,omitempty"` Background string `json:"background,omitempty"`
Font string `json:"font,omitempty"` Font string `json:"font,omitempty"`
FontSize string `json:"font_size,omitempty"` FontSize string `json:"font_size,omitempty"`
Symbol string `json:"symbol,omitempty"` Symbol string `json:"symbol,omitempty"`
SymbolFont string `json:"symbol_font,omitempty"` SymbolFont string `json:"symbol_font,omitempty"`
SymbolFontSize string `json:"symbol_font_size,omitempty"` SymbolFontSize string `json:"symbol_font_size,omitempty"`
DontExitOnLogin bool `json:"dont_exit_on_login,omitempty"`
Separator struct { Separator struct {
Left struct { Left struct {

View File

@@ -151,7 +151,19 @@ func PaReinit() error {
} }
} }
cmd = exec.Command("pulseaudio", "--start") // PA has annoying feature: socket activation. Sound system must be persistent and available to all users regardless
// of init or other things. They just fail to understand that. Or they fucked up pulseaudio just because they scary
// of security something responsibility. Anyway this is grand design flaw, but we still have to bear with it.
// This setting defines if pulseaudio will be run in manner that allows it to exit is other login detected (how
// they guess it - I do not know). In general case we do not want to allow pa to exit and leave our session without
// audio.
if Conf.SimpleVolumePa.DontExitOnLogin {
// Do not exit on any kind of login/logout events.
cmd = exec.Command("pulseaudio", "--exit-idle-time=-1", "--start")
} else {
// Exit immediately on logout(?).
cmd = exec.Command("pulseaudio", "--exit-idle-time=0", "--start")
}
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
return fmt.Errorf("unable to initialize pulseaudio server instance: %w", err) return fmt.Errorf("unable to initialize pulseaudio server instance: %w", err)