aboutsummaryrefslogtreecommitdiffstats
path: root/oni
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-04-02 00:29:25 -0700
committerGravatar Tom Willemse2022-04-02 00:29:25 -0700
commit8713e5c421a4ea039f88ea7b123482cf0561f3b7 (patch)
tree5ec2f31b94339789621b56a6ab3abb22eb209232 /oni
parent235403c236d48e89d3068d7b3d60555af3db926d (diff)
downloadnew-dotfiles-8713e5c421a4ea039f88ea7b123482cf0561f3b7.tar.gz
new-dotfiles-8713e5c421a4ea039f88ea7b123482cf0561f3b7.zip
Add Xmodmap config
Diffstat (limited to 'oni')
-rw-r--r--oni/home/data/config.scm12
-rw-r--r--oni/home/services/xmodmap.scm45
2 files changed, 55 insertions, 2 deletions
diff --git a/oni/home/data/config.scm b/oni/home/data/config.scm
index 9757760..bb43d7b 100644
--- a/oni/home/data/config.scm
+++ b/oni/home/data/config.scm
@@ -7,7 +7,8 @@
#:use-module (gnu packages)
#:use-module (gnu packages admin)
#:use-module (guix gexp)
- #:use-module (oni home services xdisorg))
+ #:use-module (oni home services xdisorg)
+ #:use-module (oni home services xmodmap))
(home-environment
(packages (list (specification->package+output "glibc-locales")))
@@ -44,4 +45,11 @@
((text-color . "#bfbfbf")))
(element-text
((background-color . "#222424")
- (text-color . "#bfbfbf"))))))))))
+ (text-color . "#bfbfbf")))))))
+
+ (service home-xmodmap-service-type
+ (home-xmodmap-configuration
+ (pointer '(3 2 1))
+ (extra '("remove Mod5 = ISO_Level3_Shift"
+ "keycode 108 = Alt_L"
+ "add Mod1 = Alt_L")))))))
diff --git a/oni/home/services/xmodmap.scm b/oni/home/services/xmodmap.scm
new file mode 100644
index 0000000..53df3e5
--- /dev/null
+++ b/oni/home/services/xmodmap.scm
@@ -0,0 +1,45 @@
+(define-module (oni home services xmodmap)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu packages xorg)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services utils)
+ #:use-module (guix packages)
+ #:use-module (guix gexp)
+
+ #:export (home-xmodmap-service-type
+ home-xmodmap-configuration))
+
+(define-configuration/no-serialization home-xmodmap-configuration
+ (package
+ (package xmodmap)
+ "Package to use for setting Xmodmap")
+ (pointer
+ (list '())
+ "List of numbers indicating the order of numbers")
+ (extra
+ (text-config '())
+ "Any other configuration settings."))
+
+(define (serialize-xmodmap-config config)
+ (let ((pointer (home-xmodmap-configuration-pointer config)))
+ (string-append
+ (if pointer
+ (string-append "pointer = " (string-join (map number->string pointer) " ") "\n\n")
+ "")
+ (string-join (home-xmodmap-configuration-extra config) "\n" 'suffix))))
+
+(define (xmodmap-home-files config)
+ `(("Xmodmap" ,(mixed-text-file
+ "Xmodmap"
+ (serialize-xmodmap-config config)))))
+
+(define home-xmodmap-service-type
+ (service-type
+ (name 'home-xmodmap)
+ (extensions
+ (list (service-extension
+ home-files-service-type
+ xmodmap-home-files)))
+ (compose identity)
+ (default-value (home-xmodmap-configuration))
+ (description "Install and configure Xmodmap.")))