Now all indicator updates properly

This commit is contained in:
eleksir
2024-09-23 19:05:45 +03:00
parent 1a4ab136dc
commit 5bb259a30c
15 changed files with 228 additions and 231 deletions

View File

@@ -26,7 +26,7 @@ type ClickEvent struct {
// ParseStdin tries to parse text that i3bar prints to our stdin. Currently - it is mouse click events on different
// area names of i3bar.
func (c MyConfig) ParseStdin() {
func (c *MyConfig) ParseStdin() {
reader := bufio.NewReader(os.Stdin)
// De-facto it is jsonl, except first line is garbage. Also, first symbol in each strint garbage too.
@@ -84,35 +84,35 @@ func (c MyConfig) ParseStdin() {
// Clock clicks parse.
if e.Name == "wallclock" {
if Conf.Clock.LeftClick.Enabled && e.Button == 1 {
RunChan <- Conf.Clock.LeftClick.Cmd
} else if Conf.Clock.RightClick.Enabled && e.Button == 3 {
RunChan <- Conf.Clock.RightClick.Cmd
if c.Clock.LeftClick.Enabled && e.Button == 1 {
c.Channels.RunChan <- c.Clock.LeftClick.Cmd
} else if c.Clock.RightClick.Enabled && e.Button == 3 {
c.Channels.RunChan <- c.Clock.RightClick.Cmd
}
continue
}
if e.Name == "simple-volume-pa" {
if Conf.SimpleVolumePa.Enabled {
SVPAHandlerChan <- e
if c.SimpleVolumePa.Enabled {
c.Channels.SVPAHandlerChan <- e
}
continue
}
if !Conf.AppButtons.Enabled {
if !c.AppButtons.Enabled {
continue
}
for _, app := range Conf.Apps {
for _, app := range c.Apps {
switch {
case app.Name != "" && app.Instance != "":
if app.Name == e.Name && app.Instance == e.Instance {
prg := append([]string{}, app.Cmd)
prg = append(prg, app.Args...)
RunChan <- prg
c.Channels.RunChan <- prg
break
}
@@ -120,13 +120,13 @@ func (c MyConfig) ParseStdin() {
prg := append([]string{}, app.Cmd)
prg = append(prg, app.Args...)
RunChan <- prg
c.Channels.RunChan <- prg
case app.Instance != "" && e.Instance == app.Instance:
prg := append([]string{}, app.Cmd)
prg = append(prg, app.Args...)
RunChan <- prg
c.Channels.RunChan <- prg
}
}
}