Skip to content

Commit a2edac1

Browse files
committedJul 27, 2020
Added URL opening and README
1 parent 0889e8b commit a2edac1

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
 

‎README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Streamdeckd
2+
3+
### Installation
4+
5+
As this uses the [Elgato Stream Deck Library](https://www.npmjs.com/package/elgato-stream-deck), you will need to follow
6+
the installation process for that, which includes taking steps to allow node to access the streamdeck via udev. these steps include:
7+
8+
- create the file `/etc/udev/rules.d/50-elgato.rules` with the following config
9+
```
10+
SUBSYSTEM=="input", GROUP="input", MODE="0666"
11+
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", MODE:="666", GROUP="plugdev"
12+
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", MODE:="666", GROUP="plugdev"
13+
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", MODE:="666", GROUP="plugdev"
14+
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", MODE:="666", GROUP="plugdev"
15+
```
16+
17+
- run `sudo udevadm control --reload-rules` to reload the udev rules
18+
19+
Then xdotool will be required to simulate keypresses, to install this run:
20+
21+
#### Arch
22+
23+
`sudo pacman -S xdotool`
24+
25+
#### Debian based
26+
27+
`sudo apt install xdotool`
28+
29+
30+
### Configuration
31+
32+
#### Manual configuration
33+
34+
The configuration file streamdeckd uses is a JSON file found at `~/.streamdeck-config.json`
35+
36+
An example config would be something like:
37+
38+
```json
39+
{
40+
"pages": [
41+
[
42+
{
43+
"switch_page": 1,
44+
"icon": "~/icon.png"
45+
}
46+
]
47+
]
48+
}
49+
```
50+
51+
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.
52+
53+
The actions you can have on a button are:
54+
55+
- `command`: runs a native shell command, something like `notify-send "Hello World"`
56+
- `keybind`: simulates the indicated keybind via xdtotool
57+
- `url`: opens a url in your default browser via xdg
58+
- `brightness`: set the brightness of the streamdeck as a percentage
59+
- `switch_page`: change the active page on the streamdeck

‎config.go

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type Pages [][] struct {
77
Keybind string `json:"keybind,omitempty"`
88
Command string `json:"command,omitempty"`
99
Brightness *int `json:"brightness,omitempty"`
10+
Url string `json:"url,omitempty"`
1011
}
1112

1213
type Config struct {
@@ -21,4 +22,5 @@ type Key struct {
2122
Keybind string `json:"keybind,omitempty"`
2223
Command string `json:"command,omitempty"`
2324
Brightness *int `json:"brightness,omitempty"`
25+
Url string `json:"url,omitempty"`
2426
}

‎main.go

+3
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ func handleInput(key Key) {
122122
if key.Brightness != nil {
123123
_ = dev.SetBrightness(uint8(*key.Brightness))
124124
}
125+
if key.Url != "" {
126+
runCommand("xdg-open " + key.Url)
127+
}
125128
}
126129

127130
func runCommand(command string) {

0 commit comments

Comments
 (0)
Please sign in to comment.