Use Xlib code to find a keyboard instead of relying on user config
This commit is contained in:
parent
9ca48b7bf8
commit
56b65b8449
@ -1,12 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"kdelsd/afterlock"
|
"kdelsd/afterlock"
|
||||||
"kdelsd/config"
|
"kdelsd/config"
|
||||||
"kdelsd/lockfile"
|
"kdelsd/lockfile"
|
||||||
"kdelsd/xdg/display"
|
"kdelsd/xdg/display"
|
||||||
"kdelsd/xdg/keypressdetector"
|
"kdelsd/xdg/keypressdetector"
|
||||||
"kdelsd/xdg/lockscreen"
|
"kdelsd/xdg/lockscreen"
|
||||||
|
"kdelsd/xdg/xinput_devnodes"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -18,7 +20,6 @@ import (
|
|||||||
type afterLockConfig struct {
|
type afterLockConfig struct {
|
||||||
INITIAL_DELAY int
|
INITIAL_DELAY int
|
||||||
LOOP_DELAY int
|
LOOP_DELAY int
|
||||||
DEV_NODE string
|
|
||||||
LOCK_PATH string
|
LOCK_PATH string
|
||||||
LOG_PATH string
|
LOG_PATH string
|
||||||
PRINT_STACKTRACES bool
|
PRINT_STACKTRACES bool
|
||||||
@ -99,11 +100,19 @@ func initCleanup(lock *lockfile.Lockfile, logfile *os.File) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func buildAfterlock() *afterlock.AfterLock {
|
func buildAfterlock() *afterlock.AfterLock {
|
||||||
al := afterlock.New(configuration.DEV_NODE)
|
al := afterlock.New(getKeyboardDevNode())
|
||||||
al.InitialDelay = uint(configuration.INITIAL_DELAY)
|
al.InitialDelay = uint(configuration.INITIAL_DELAY)
|
||||||
al.LoopDelay = uint(configuration.LOOP_DELAY)
|
al.LoopDelay = uint(configuration.LOOP_DELAY)
|
||||||
al.Display = display.Xset{}
|
al.Display = display.Xset{}
|
||||||
al.LockScreen = lockscreen.XDG{}
|
al.LockScreen = lockscreen.XDG{}
|
||||||
al.KeypressDetector = keypressdetector.Evdev{}
|
al.KeypressDetector = keypressdetector.Evdev{}
|
||||||
return al
|
return al
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getKeyboardDevNode() string {
|
||||||
|
devNode := xinput_devnodes.FindKeyboardDevNode()
|
||||||
|
if devNode == "" {
|
||||||
|
panic(errors.New("unable to find keyboard device node"))
|
||||||
|
}
|
||||||
|
return devNode
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user