Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dbus method for getting handler thumbnail #14

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
1442efb
Merge pull request #1 from unix-streamdeck/configStruct
The-Jonsey Jul 27, 2020
bdbf743
Updated streamdeck lib dep
The-Jonsey Jul 27, 2020
a19fcd3
Stopped text clearing image behind text
The-Jonsey Jul 27, 2020
6bafa7e
WIP
The-Jonsey Jul 30, 2020
b4af427
Added dbus interface
The-Jonsey Aug 11, 2020
54ba770
Added DBus to docs
The-Jonsey Aug 13, 2020
27e9350
Fixed for new packages, and PR gripes
The-Jonsey Aug 17, 2020
c15b932
Handled removing of pointers from and in config
The-Jonsey Aug 18, 2020
a88c0f1
Fixed build and returning error from dbus
The-Jonsey Aug 18, 2020
ec30b9d
removed duplicated deps in go.sum
The-Jonsey Aug 18, 2020
a112126
Fixed returning error in dbus
The-Jonsey Aug 18, 2020
1031ba4
Merge pull request #2 from unix-streamdeck/feat/handlers
The-Jonsey Aug 19, 2020
2eba53d
Fixed crash on image failing to open
The-Jonsey Aug 24, 2020
6ed53fc
WIP: Hotplug support
The-Jonsey Aug 24, 2020
8e9f444
Create LICENSE
The-Jonsey Aug 25, 2020
f7d731f
Refactored resizing of frames to happen before loop
The-Jonsey Aug 25, 2020
e3ceae0
Added semaphore lock around SetImage to prevent handlers running on o…
The-Jonsey Aug 25, 2020
40f83f8
Refactored SetPage so all keys on page are rendered on seperate threa…
The-Jonsey Aug 25, 2020
c7f9a0f
Update README.md
The-Jonsey Aug 25, 2020
ec65c18
Update README.md
The-Jonsey Aug 25, 2020
57294fe
added semaphores around disconnect and reconnect to prevent crash due…
The-Jonsey Aug 26, 2020
928b48d
Factor handlers out into their own package
okratitan Aug 27, 2020
510de49
Merge branch 'master' of github.com:unix-streamdeck/streamdeckd into …
The-Jonsey Aug 27, 2020
7c928d8
Merge pull request #4 from unix-streamdeck/handlerPackage
The-Jonsey Aug 27, 2020
88f86cb
Merge branch 'master' of github.com:unix-streamdeck/streamdeckd into …
The-Jonsey Aug 27, 2020
1c2a5bb
Merged origin master into feat/optimizations
The-Jonsey Aug 27, 2020
c97fe8f
Merge branch 'master' of github.com:unix-streamdeck/streamdeckd into …
The-Jonsey Aug 27, 2020
e5df054
Sorted imports
The-Jonsey Aug 27, 2020
22ebe71
Merge pull request #3 from unix-streamdeck/feat/optimizations
The-Jonsey Aug 27, 2020
6e32073
Merged origin staging into feat/hotplug
The-Jonsey Aug 27, 2020
2ea599d
Merge pull request #5 from unix-streamdeck/feat/hotplug
The-Jonsey Aug 27, 2020
250a249
Refactored handlers
The-Jonsey Aug 27, 2020
d67c565
Removed key pointer in handlers
The-Jonsey Aug 27, 2020
7737f25
Refactored remounting handlers
The-Jonsey Aug 27, 2020
1b17e17
Updated unix-streamdeck/api version
The-Jonsey Aug 28, 2020
4421242
Merge pull request #6 from unix-streamdeck/staging
The-Jonsey Aug 28, 2020
5e9da7d
Fixed dbus info not being set
The-Jonsey Aug 31, 2020
a254079
Refactored to use api text methods
The-Jonsey Sep 5, 2020
d60d045
Reverted pushing spotify handler
The-Jonsey Sep 6, 2020
eea7eec
Reverted pushing spotify handler
The-Jonsey Sep 6, 2020
c2ed21a
Updated unix-streamdeck/api version
The-Jonsey Sep 7, 2020
264a4ad
Merge pull request #7 from unix-streamdeck/feat/use-api-text-methods
The-Jonsey Sep 7, 2020
eec457a
Fixed bug with nil config on dbus config upload
The-Jonsey Oct 1, 2020
a45e482
Fixed bug with duplicated gif handler after suspend
The-Jonsey Nov 1, 2020
997361a
Added text alignment and size override
The-Jonsey Nov 7, 2020
e6dbd19
Modules loading, and dbus method for module info
The-Jonsey Nov 10, 2020
238ea9e
Merge pull request #9 from unix-streamdeck/feat/modules
The-Jonsey Dec 23, 2020
724cea9
Fixed const set streamdeckd icon size
The-Jonsey Dec 28, 2020
575e672
Updated fields on gif
The-Jonsey Dec 28, 2020
334aaca
Added support for multiple streamdecks
The-Jonsey May 13, 2021
b89d29e
Added config auto migrator
The-Jonsey May 15, 2021
fc899df
Fixed api version in go.mod
The-Jonsey May 17, 2021
3a7b55c
Added time delay in attemptConnection
The-Jonsey May 30, 2021
d51855c
Stopped child processes being killed when streamdeckd is stopped/rest…
The-Jonsey Jul 21, 2021
3432a18
Updated api
The-Jonsey Jul 21, 2021
35d8bfc
Enabled module stopping between pages
The-Jonsey Aug 23, 2021
54656a4
Fixed handlers on home page not restarting after disconnect on page o…
The-Jonsey Aug 29, 2021
81fb063
Added 'press button' dbus method'
The-Jonsey Sep 10, 2021
92e36a9
Updated README
The-Jonsey Sep 10, 2021
051e514
Updated README
The-Jonsey Sep 10, 2021
acfb945
Updated api version
The-Jonsey Sep 12, 2021
9868442
Prevented crash if deck not found on HandleInput
The-Jonsey Sep 12, 2021
48b6c61
Merge pull request #10 from unix-streamdeck/feat/multiple-deck-support
The-Jonsey Sep 12, 2021
f9761e9
Added dbus method for getting handler thumbnail
Louis-Jones-Evri Oct 9, 2021
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
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2020, unix-streamdeck
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
135 changes: 111 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Streamdeckd
# Streamdeckd

### Installation

- create the file `/etc/udev/rules.d/50-elgato.rules` with the following config

### Installation

- create the file `/etc/udev/rules.d/50-elgato.rules` with the following config
```
SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", MODE:="666", GROUP="plugdev"
```

- run `sudo udevadm control --reload-rules` to reload the udev rules

Then xdotool will be required to simulate keypresses, to install this run:

#### Arch

`sudo pacman -S xdotool`

#### Debian based

`sudo apt install xdotool`

- run `sudo udevadm control --reload-rules` to reload the udev rules

Then xdotool will be required to simulate keypresses, to install this run:

#### Arch

`sudo pacman -S xdotool`

#### Debian based

`sudo apt install xdotool`

### Configuration

Expand All @@ -34,18 +34,30 @@ An example config would be something like:

```json
{
"pages": [
[
{
"switch_page": 1,
"icon": "~/icon.png"
}
]
"modules": [
"/home/user/module.so"
],
"decks": [
{
"serial": "AB12C3D45678",
"pages": [
[
{
"switch_page": 1,
"icon": "~/icon.png"
}
]
]
}
]
}
```

The outer array is the list of pages, the inner array is the list of button on that page, with the buttons going in a right to left order.
At the top is the list of custom modules, these are go plugins in the .so format, following that is the list of deck
objects, each represents a different streamdeck device, and contains its serial, and its list of pages

The outer array in a deck is the list of pages, the inner array is the list of button on that page, with the buttons
going in a right to left order.

The actions you can have on a button are:

Expand All @@ -54,3 +66,78 @@ The actions you can have on a button are:
- `url`: opens a url in your default browser via xdg
- `brightness`: set the brightness of the streamdeck as a percentage
- `switch_page`: change the active page on the streamdeck

### D-Bus

There is a D-Bus interface built into the daemon, the service name and interface for D-Bus
are `com.unixstreamdeck.streamdeckd` and `com/unixstreamdeck/streamdeckd` respectively, and is made up of the following
methods/signals

#### Methods

- GetConfig - returns the current running config
- SetConfig - sets the config, without saving to disk, takes in Stringified json, returns an error if anything breaks
- ReloadConfig - reloads the config from disk
- GetDeckInfo - Returns information about all the active streamdecks in the format of

```json
[
{
"icon_size": 72,
"rows": 3,
"cols": 5,
"page": 0,
"serial": "AB12C3D45678"
}
]
```

- SetPage - Set the page on the streamdeck to the number passed to it, returns an error if anything breaks
- CommitConfig - Commits the currently active config to disk, returns an error if anything breaks
- GetModules - Get the list of loaded modules, and the config fields those modules use
- PressButton - Simulates a button press on the streamdeck device, consumes a device serial, and a key index


#### Signals

- Page - sends the number of the page switched to on the StreamDeck

### Custom Modules

To create custom modules, I suggest looking at the gif, counter, and time modules in the example handlers package in streamdeckd, they should be in a file with the GetModule method as shown below

#### Loading Modules into streamdeckd

Modules require a method on them in the main package called "GetModule" that returns an instance of [handler.Module](https://github.com/unix-streamdeck/streamdeckd/blob/575e672c26f275d35a016be6406ceb8480ccfff5/handlers/handlers.go#L9) e.g

```go
package main

type CustomIconHandler struct {

}
...

type CustomKeyHandler struct {

}
...

func GetModule() handlers.Module {
return handlers.Module{
Name: "CustomModule", // the name that will be used in the icon_handler/key_handler field in the config, and that will be shown in the handler dropdown in streamdeckui
NewIcon: func() api.IconHandler { return &CustomerIconHandler{}}, // Method to create a new instance of the Icon handler, if left empty, streamdeckui will not include it in the icon handler fields
NewKey: func() api.KeyHandler { return &CustomerKeyHandler{}}, // Method to create a new instance of the Key Handler, if left empty, streamdeckui will not include it in the key handler fields
IconFields: []api.Field{ // list of fields to be shown in streamdeckui when the icon handler is selected
{
Title: "Icon", // name of field to show in UI
Name: "icon", // name of field that will be included in the iconHandlerFields map
Type: "File" // type of input to show on streamdeckui, options are Text, File, TextAlignment, and Number
FileTypes: []string{".png", ".jpg"} // Allowed file types if a File input type is used
}
},
KeyFields: []api.Field{}, // Same as IconFields
}
}

```
20 changes: 0 additions & 20 deletions config.go

This file was deleted.

Loading