36 lines
633 B
Go
36 lines
633 B
Go
package main
|
|
|
|
import (
|
|
"go.i3wm.org/i3"
|
|
)
|
|
|
|
func GetWorkspaceWallpaper(workspace string, config Config) string {
|
|
file := config.Default
|
|
workspaceFile := config.Workspaces[workspace]
|
|
|
|
if workspaceFile != "" {
|
|
file = workspaceFile
|
|
}
|
|
|
|
return file
|
|
}
|
|
|
|
func GetOutputsWallpapers(config Config) ([]string, error) {
|
|
files := []string{}
|
|
outputs, err := i3.GetOutputs()
|
|
if err != nil {
|
|
return files, err
|
|
}
|
|
|
|
for _, output := range outputs {
|
|
if output.CurrentWorkspace != "" {
|
|
file := GetWorkspaceWallpaper(output.CurrentWorkspace, config)
|
|
|
|
if file != "" {
|
|
files = append(files, file)
|
|
}
|
|
}
|
|
}
|
|
|
|
return files, nil
|
|
}
|