update wallpapers on start
This commit is contained in:
parent
1a94e88eff
commit
e229ae1440
4 changed files with 25 additions and 21 deletions
|
|
@ -1,5 +1,9 @@
|
|||
[Unreleased]
|
||||
|
||||
## v1.1.1
|
||||
### Fixed
|
||||
- Update wallpapers on start
|
||||
|
||||
## v1.1.0
|
||||
### Changed
|
||||
- Refactoring
|
||||
|
|
|
|||
14
event.go
14
event.go
|
|
@ -1,14 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func HandleFocusEvent(config Config) (*exec.Cmd, error) {
|
||||
files, err := GetOutputsWallpapers(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return FehUpdateWallpapers(files)
|
||||
}
|
||||
10
main.go
10
main.go
|
|
@ -21,17 +21,13 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
UpdateWallapers(config)
|
||||
|
||||
for recv.Next() {
|
||||
event := recv.Event().(*i3.WorkspaceEvent)
|
||||
|
||||
if event.Change == "focus" {
|
||||
cmd, err := HandleFocusEvent(config)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] cmd=%s error=%s", cmd.String(), err.Error())
|
||||
} else {
|
||||
log.Printf("[SUCCESS] cmd=%s", cmd.String())
|
||||
}
|
||||
UpdateWallapers(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
18
wallpaper.go
18
wallpaper.go
|
|
@ -1,6 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"go.i3wm.org/i3"
|
||||
)
|
||||
|
||||
|
|
@ -34,3 +36,19 @@ func GetOutputsWallpapers(config Config) ([]string, error) {
|
|||
|
||||
return files, nil
|
||||
}
|
||||
|
||||
func UpdateWallapers(config Config) {
|
||||
files, err := GetOutputsWallpapers(config)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] %s", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
cmd, err := FehUpdateWallpapers(files)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] cmd=%s error=%s", cmd.String(), err.Error())
|
||||
} else {
|
||||
log.Printf("[SUCCESS] cmd=%s", cmd.String())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue