Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define-configuration/no-serialization interception-tools-configuration
- (package
- (file-like interception-tools)
- "The interception-tools package to use.")
- (udevmon-jobs
- (list-of-strings '())
- "The jobs that the udevmon daemon should be configured to run."))
- (define (interception-tools-shepherd-service config)
- (list
- (shepherd-service
- (documentation "Run interception-tools udevmon daemon.")
- (provision '(interception-tools))
- (requirement '(user-processes))
- (start #~(make-forkexec-constructor
- (list #$(file-append coreutils "/bin/nice") "-n" "-20"
- #$(file-append interception-tools "/bin/udevmon") "-c" "/etc/interception/udevmon.yml")
- #:log-file "/var/log/interception-tools.log"))
- (stop #~(make-kill-destructor)))))
- (define (interception-tools-config-file config)
- "Return the udevmon configuration file corresponding to CONFIG."
- (list
- (list
- "interception/udevmon.yml"
- (computed-file "udevmon.yml"
- #~(begin
- (call-with-output-file #$output
- (lambda (port)
- (display "# Generated by 'interception-tools-service'.\n" port)
- (for-each (lambda (job) (format port "~a\n" job))
- '#$(interception-tools-configuration-udevmon-jobs config)))))))))
- (define (interception-tools-profile config)
- (list (interception-tools-configuration-package config)))
- (define interception-tools-service-type
- (service-type
- (name 'interception-tools)
- (description
- "Run @command{udevmon} daemon.")
- (extensions
- (list
- (service-extension shepherd-root-service-type interception-tools-shepherd-service)
- (service-extension etc-service-type interception-tools-config-file)
- (service-extension profile-service-type interception-tools-profile)))
- (compose concatenate)
- (extend
- (lambda (config udevmon-jobs)
- (interception-tools-configuration
- (inherit config)
- (udevmon-jobs (append (interception-tools-configuration-udevmon-jobs config) udevmon-jobs)))))
- (default-value (interception-tools-configuration))))
- (define-configuration/no-serialization interception-dual-function-keys-configuration
- (package
- (file-like interception-dual-function-keys)
- "The interception-dual-function-keys package to use.")
- (mappings
- (list-of-strings '())
- "The mappings that dual-function-keys should be configured to run.")
- (keys
- (string "")
- "The keys for which the udevmon job should be triggered."))
- (define (interception-dual-function-keys-config-file config)
- "Return the dual-function-keys configuration file corresponding to CONFIG."
- (list
- (list
- "interception/dual-function-keys.yml"
- (computed-file "dual-function-keys.yml"
- #~(begin
- (call-with-output-file #$output
- (lambda (port)
- (display "# Generated by 'interception-dual-function-keys-service'.\n" port)
- (for-each (lambda (mapping) (format port "~a\n" mapping))
- '#$(interception-dual-function-keys-configuration-mappings config)))))))))
- (define (interception-dual-function-keys-job config)
- (list
- (string-append
- "- JOB: \"" "/run/current-system/profile/bin/intercept" " -g $DEVNODE | "
- "/run/current-system/profile/bin/dual-function-keys"
- " -c /etc/interception/dual-function-keys.yml | "
- "/run/current-system/profile/bin/uinput"" -d $DEVNODE\"
- DEVICE:
- EVENTS:
- EV_KEY: \"" (interception-dual-function-keys-configuration-keys config) "\"")))
- (define (interception-dual-function-keys-profile config)
- (list (interception-dual-function-keys-configuration-package config)))
- (define interception-dual-function-keys-service-type
- (service-type
- (name 'interception-dual-function-keys)
- (description
- "Run @command{dual-function-keys} via @command{udevmon} daemon.")
- (extensions
- (list
- (service-extension interception-tools-service-type interception-dual-function-keys-job)
- (service-extension etc-service-type interception-dual-function-keys-config-file)
- (service-extension profile-service-type interception-dual-function-keys-profile)))))
- (define dual-function-key-setup
- (interception-dual-function-keys-configuration
- (mappings '("\
- TIMING:
- TAP_MLLISEC: 400
- DOUBLE_TAP_MILLISEC: 0
- MAPPINGS:
- - KEY: KEY_CAPSLOCK
- TAP: KEY_ESC
- HOLD: KEY_LEFTCTRL"))
- (keys "[KEY_CAPSLOCK]")))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement