Skip to content

Commit

Permalink
Finally, fix bug with audio
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor committed Feb 23, 2019
1 parent ee4c483 commit a2d3c2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
. "github.com/gvalkov/golang-evdev"
)

// TODO: fix volume in systemctl

func main() {
if os.Getuid() != 0 {
log.Print("Funcd must be started from root user.")
Expand Down
3 changes: 3 additions & 0 deletions volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package main

import (
"errors"
"fmt"
"os"
"os/exec"
"syscall"
)
Expand All @@ -15,6 +17,7 @@ func runUser(command string, args ...string) error {

user := users[0]
cmd := exec.Command(command, args...)
cmd.Env = append(os.Environ(), fmt.Sprint("XDG_RUNTIME_DIR=/run/user/", user.Uid))
cmd.SysProcAttr = &syscall.SysProcAttr{}
cmd.SysProcAttr.Credential = &syscall.Credential{Uid: user.Uid, Gid: user.Gid}
return cmd.Run()
Expand Down

0 comments on commit a2d3c2d

Please sign in to comment.