Massive commit

This commit is contained in:
Allen
2023-08-01 02:20:48 -05:00
parent 81f2796b9b
commit dedec1c61d
4 changed files with 36 additions and 2 deletions

21
.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module aaw3/xmonad-log-multiscreen
go 1.20
require github.com/godbus/dbus v4.0.0+incompatible

2
go.sum Normal file
View File

@ -0,0 +1,2 @@
github.com/godbus/dbus v4.0.0+incompatible h1:iNJ3QcnEtQA2va/vj1d2Ng5Ld6tWno5HscHoVw9Bk/I=
github.com/godbus/dbus v4.0.0+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=

10
main.go
View File

@ -13,8 +13,14 @@ func main() {
os.Exit(1)
}
conn.BusObject().Call("org.freedesktop.DBus.AddMatch", 0,
"type='signal',path='/org/xmonad/Log',interface='org.xmonad.Log',member='Update'")
if len(os.Args) < 2 {
fmt.Fprintln(os.Stderr, "Missing screen_id argument, rerun as \"xmonad-log screen_id\" ex: xmonad-log 0")
os.Exit(1)
}
args := fmt.Sprintf("type='signal',path='/org/xmonad/Log%s',interface='org.xmonad.Log',member='Update'", os.Args[1])
conn.BusObject().Call("org.freedesktop.DBus.AddMatch", 0, args)
c := make(chan *dbus.Signal, 10)
conn.Signal(c)