From dedec1c61d4a2971ac5b597ab896c244659d6079 Mon Sep 17 00:00:00 2001 From: Allen <63997543+aaw3@users.noreply.github.com> Date: Tue, 1 Aug 2023 02:20:48 -0500 Subject: [PATCH] Massive commit --- .gitignore | 21 +++++++++++++++++++++ go.mod | 5 +++++ go.sum | 2 ++ main.go | 10 ++++++++-- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 go.mod create mode 100644 go.sum diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3b735ec --- /dev/null +++ b/.gitignore @@ -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 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..f592fd4 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module aaw3/xmonad-log-multiscreen + +go 1.20 + +require github.com/godbus/dbus v4.0.0+incompatible diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..237441e --- /dev/null +++ b/go.sum @@ -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= diff --git a/main.go b/main.go index ec5b826..8621e53 100644 --- a/main.go +++ b/main.go @@ -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)