Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
5e7cf00
add goland project files to gitignore
tvidal-net Feb 9, 2022
c785334
reuse configuration from parent deck file
tvidal-net Feb 9, 2022
48dc460
reload the configuration on SIGHUP
tvidal-net Feb 9, 2022
0555de0
keep running on current config if new config is not valid
tvidal-net Feb 9, 2022
ce5b958
sleep Stream Deck on shutdown
tvidal-net Feb 10, 2022
0433bc1
prevent device from sleeping on shutdown
tvidal-net Feb 10, 2022
b4b9499
trigger inherent button action regardless of configured primary action
tvidal-net Feb 10, 2022
3684ed2
disabled image for toggle button
tvidal-net Feb 10, 2022
afc4bdf
check the state of a toggle button with a command
tvidal-net Feb 10, 2022
5d52be6
moved toggle button logic to its own widget
tvidal-net Feb 10, 2022
29a49bd
monitor the dbus for toggle button state
tvidal-net Feb 10, 2022
ce74755
clear recent window if application is closed
tvidal-net Feb 11, 2022
a6519b8
prevent consecutive updates of toggle button
tvidal-net Feb 11, 2022
66b5896
fix variable name clash
tvidal-net Feb 17, 2022
875ad65
add new dbus monitor rule
tvidal-net Feb 17, 2022
a79e098
Merge remote-tracking branch 'origin/master' into local-changes
tvidal-net Feb 18, 2022
39f5b6b
clear on shutdown
tvidal-net Oct 25, 2022
5373b5b
Merge remote-tracking branch 'fork/master' into local-changes
tvidal-net Oct 25, 2022
be454ee
reduce brightness on shutdown
tvidal-net Oct 26, 2022
f396cea
Bump github.com/jezek/xgb
dependabot[bot] Feb 23, 2023
832c4f3
Bump goreleaser/goreleaser-action from 3 to 4
dependabot[bot] Dec 13, 2022
445c9a7
docs: fix build badge
muesli Mar 12, 2023
38d5908
chore: bump streamdeck to v0.4.0
muesli Mar 12, 2023
3739ba3
chore: bump Go to 1.17
muesli Mar 12, 2023
2ecbbea
Bump actions/setup-go from 3 to 4
dependabot[bot] Mar 15, 2023
8e42f0c
Bump golang.org/x/image from 0.6.0 to 0.7.0
dependabot[bot] Apr 6, 2023
86efdec
Bump github.com/bendahl/uinput from 1.6.0 to 1.6.1
dependabot[bot] Apr 27, 2023
7f3a927
reuse configuration from parent deck file
tvidal-net Feb 9, 2022
74af038
reload the configuration on SIGHUP
tvidal-net Feb 9, 2022
8a0c478
keep running on current config if new config is not valid
tvidal-net Feb 9, 2022
0726da3
Merge remote-tracking branch 'fork/master'
tvidal-net Sep 28, 2023
0524d61
Merge branch 'local-changes'
tvidal-net Sep 28, 2023
9a2a6df
Merge remote-tracking branch 'fork/master'
tvidal-net Aug 15, 2024
09553e6
upgrade dependencies
tvidal-net Aug 28, 2024
283c555
remove dbus and xorg shenaningans
tvidal-net Aug 28, 2024
12d65c7
Revert "remove dbus and xorg shenaningans"
tvidal-net Jun 18, 2025
7e0d44f
upgrade dependencies
tvidal-net Jun 18, 2025
d062139
upgrade godbus to v5
tvidal-net Jun 18, 2025
ec02536
fix ref by value
tvidal-net Jun 18, 2025
3aa22f7
refactor dbus.go
tvidal-net Jun 19, 2025
de6c754
added dbus_kmix.go
tvidal-net Jun 19, 2025
0db96c1
remove widget_toggle
tvidal-net Jun 19, 2025
d9f9b85
widget_mute button
tvidal-net Jun 19, 2025
3284d75
attempt to use dbus action for widget_mute
tvidal-net Jun 20, 2025
ac24d4e
add pulseaudio client
tvidal-net Jun 20, 2025
4aeb7f0
use custom pulseaudio lib
tvidal-net Jun 20, 2025
a13c24a
remove unused dbus code
tvidal-net Jun 20, 2025
5071a47
widget_audio to change audio channels
tvidal-net Jun 20, 2025
dacb744
sort some merge issues
tvidal-net Jun 20, 2025
7928faa
remove unused comment
tvidal-net Jun 20, 2025
2ebc18b
bump up dependencies
tvidal-net Jun 20, 2025
574abff
sort out error messages
tvidal-net Jun 20, 2025
33cb344
rename config flags
tvidal-net Jun 20, 2025
c5302d6
remove custom pulseaudio error function
tvidal-net Jun 20, 2025
f57c221
rationalise naming
tvidal-net Jun 20, 2025
8b3cb0d
more error handling fixes
tvidal-net Jun 20, 2025
d6d7540
fix a few more error handling issues
tvidal-net Jun 20, 2025
ff651a8
bump go version
tvidal-net Jun 20, 2025
bd33aaa
update mute when stream changes
tvidal-net Jun 23, 2025
d97f2b2
remove cached list of monitor widgets
tvidal-net Jun 24, 2025
ec83954
fix reference usage for Xorg struct
tvidal-net Jul 1, 2025
4491126
error handling for xorg connection
tvidal-net Jul 1, 2025
1c30fd0
remove references to xorg
tvidal-net Jul 8, 2025
3dff83f
fix issue with errorLog
tvidal-net Jul 8, 2025
bde6cfd
import png image
tvidal-net Jul 8, 2025
c09f4f9
Revert "remove references to xorg"
tvidal-net Jul 9, 2025
6b49019
do not exit if pulseAudio is not available
tvidal-net Jul 9, 2025
4203fde
map of deck keys
tvidal-net Jul 10, 2025
7f98c55
use default X display
tvidal-net Jul 10, 2025
83a421c
extract dbus features
tvidal-net Jul 10, 2025
997e581
better error handling
tvidal-net Jul 10, 2025
abbc349
fixed dbus error
tvidal-net Jul 10, 2025
6bcb1ed
use non-private dbus session
tvidal-net Jul 10, 2025
cf5519b
monitor ActiveWindowChanged events
tvidal-net Jul 10, 2025
6511c03
kwin script to send DBus Notifications
tvidal-net Jul 10, 2025
b5e08f5
make kwin script kde5 compatible
tvidal-net Jul 10, 2025
6a359c3
expand executable
tvidal-net Jul 11, 2025
2024773
check if window is not null
tvidal-net Jul 17, 2025
7044ff5
fix window id
tvidal-net Jul 17, 2025
dc518b5
release child processes
tvidal-net Sep 2, 2025
fd68e8d
window changed notification as a struct
tvidal-net Sep 2, 2025
5f6a542
read windows from config
tvidal-net Sep 2, 2025
8f22045
load window overrides
tvidal-net Sep 2, 2025
3049d89
window sensitive keys
tvidal-net Sep 2, 2025
a2e0bb5
reap child processes to prevent leaving them defunct
tvidal-net Sep 3, 2025
7135858
strip unprintable chars
tvidal-net Sep 23, 2025
b53bd60
extract process control to process.go
tvidal-net Sep 23, 2025
fbe63b4
minor refactor
tvidal-net Sep 23, 2025
abc2b89
bump dependency versions
tvidal-net Sep 23, 2025
9e6d3e9
extract paths to constants
tvidal-net Sep 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
build:
strategy:
matrix:
go-version: [~1.17, ^1]
go-version: [~1.23, ^1]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ dist/

# direnv
.envrc

# GoLand Project Files
.idea/
*.iml
29 changes: 20 additions & 9 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"errors"
"fmt"
"image/color"
"io/ioutil"
"os"
"path/filepath"
"reflect"
"strconv"
"strings"

"github.com/BurntSushi/toml"
colorful "github.com/lucasb-eyer/go-colorful"
"github.com/lucasb-eyer/go-colorful"
)

// DBusConfig describes a dbus action.
Expand Down Expand Up @@ -51,11 +51,18 @@
// Keys is a slice of keys.
type Keys []KeyConfig

type WindowConfig struct {

Check warning on line 54 in config.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported type WindowConfig should have comment or be unexported (revive)
Resource string `toml:"resource,omitempty"`
Title string `toml:"title,omitempty"`
Keys Keys `toml:"keys"`
}

// DeckConfig is the central configuration struct.
type DeckConfig struct {
Background string `toml:"background,omitempty"`
Parent string `toml:"parent,omitempty"`
Keys Keys `toml:"keys"`
Background string `toml:"background,omitempty"`
Parent string `toml:"parent,omitempty"`
Windows []WindowConfig `toml:"window,omitempty"`
Keys Keys `toml:"keys"`
}

// MergeDeckConfig merges key configuration from multiple configs.
Expand All @@ -77,7 +84,9 @@
if background == "" {
background = parent.Background
}
return DeckConfig{background, base.Parent, keys}

windows := append(base.Windows, parent.Windows...)
return DeckConfig{background, base.Parent, windows, keys}
}

// LoadConfigFromFile loads a DeckConfig from a file while checking for circular
Expand All @@ -98,12 +107,14 @@
}
}

file, err := ioutil.ReadFile(filename)
file, err := os.ReadFile(filename)
if err != nil {
return config, err
}

_, err = toml.Decode(string(file), &config)
if _, err = toml.Decode(string(file), &config); err != nil {
return config, err

Check failure on line 116 in config.go

View workflow job for this annotation

GitHub Actions / lint-soft

error returned from external package is unwrapped: sig: func github.com/BurntSushi/toml.Decode(data string, v any) (github.com/BurntSushi/toml.MetaData, error) (wrapcheck)
}
if config.Parent != "" {
parent, err := LoadConfigFromFile(base, config.Parent, append(files, filename))
if err != nil {
Expand Down Expand Up @@ -133,7 +144,7 @@
return err
}

return ioutil.WriteFile(filename, b.Bytes(), 0600)
return os.WriteFile(filename, b.Bytes(), 0600)

Check failure on line 147 in config.go

View workflow job for this annotation

GitHub Actions / lint-soft

error returned from external package is unwrapped: sig: func os.WriteFile(name string, data []byte, perm os.FileMode) error (wrapcheck)
}

// ConfigValue tries to convert an interface{} to the desired type.
Expand Down
59 changes: 59 additions & 0 deletions dbus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package main

import (
"github.com/godbus/dbus/v5"
"github.com/godbus/dbus/v5/introspect"
)

const (
dbusInterface = "io.github.muesli.DeckMaster"
dbusMonitorPath = "/Monitor"
introInterface = "org.freedesktop.DBus.Introspectable"
intro = `<node>
<interface name="` + dbusInterface + `">
<method name="ActiveWindowChanged">
<arg direction="in" type="s" />
<arg direction="in" type="s" />
</method>
</interface>` + introspect.IntrospectDataString + "<node>"
)

type ActiveWindow struct {

Check warning on line 21 in dbus.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported type ActiveWindow should have comment or be unexported (revive)
resource string
title string
id string
}

type WindowChannel struct {
channel chan ActiveWindow
}

func (w *WindowChannel) ActiveWindowChanged(class, title, id string) *dbus.Error {
w.channel <- ActiveWindow{class, title, id}
return nil
}

func MonitorActiveWindowChanged() <-chan ActiveWindow {
w := WindowChannel{make(chan ActiveWindow)}
cnn, _ := dbus.SessionBus()
_ = cnn.Export(&w, dbusMonitorPath, dbusInterface)

introspectable := introspect.Introspectable(intro)
_ = cnn.Export(introspectable, dbusMonitorPath, introInterface)

reply, e := cnn.RequestName(dbusInterface, dbus.NameFlagDoNotQueue)
if e != nil {
errorLog(e, "failed to request name on active window changed")
}
if reply != dbus.RequestNameReplyPrimaryOwner {
errorLogF("service '%s' already running", dbusInterface)
}
return w.channel
}

func CallDBus(object, path, method string, args ...interface{}) error {
cnn, _ := dbus.SessionBus()

o := cnn.Object(object, dbus.ObjectPath(path))
return o.Call(method, 0, args...).Err
}
Loading
Loading