about summary refs log tree commit diff
path: root/users/grfn/system/home
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2023-11-06T15·39-0500
committerclbot <clbot@tvl.fyi>2023-11-06T15·46+0000
commit81047cfcd7e527722a32dc7987cfb0e288ddd1eb (patch)
tree0dc1e669c06f493ca7e63c23b1b6cb69dd1982c4 /users/grfn/system/home
parent7c32d85455387ffdf89387aaa9b51b0edaf16a87 (diff)
feat(grfn/system): Command to edit the current text input in emacs r/6964
First pass at an xdotool-based command to edit the current text input in
emacs

Change-Id: I1e04612478292fe83083d197d481e034a9fce97f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9971
Reviewed-by: grfn <grfn@gws.fyi>
Autosubmit: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/grfn/system/home')
-rw-r--r--users/grfn/system/home/modules/desktop.nix17
-rw-r--r--users/grfn/system/home/modules/i3.nix3
2 files changed, 20 insertions, 0 deletions
diff --git a/users/grfn/system/home/modules/desktop.nix b/users/grfn/system/home/modules/desktop.nix
index fed3cb47a48f..cab3b658e031 100644
--- a/users/grfn/system/home/modules/desktop.nix
+++ b/users/grfn/system/home/modules/desktop.nix
@@ -14,6 +14,23 @@
       # Slack support is broken as of 2023-06-15
       withSlack = false;
     })
+    (writeShellApplication {
+      name = "edit-input";
+
+      runtimeInputs = [ xdotool xclip ];
+      text = ''
+        set -euo pipefail
+
+        sleep 0.2
+        xdotool key ctrl+a ctrl+c
+        xclip -out -selection clipboard > /tmp/EDIT
+        emacsclient -c /tmp/EDIT
+        xclip -in -selection clipboard < /tmp/EDIT
+        sleep 0.2
+        xdotool key ctrl+v
+        rm /tmp/EDIT
+      '';
+    })
   ];
 
   services.syncthing.tray.enable = true;
diff --git a/users/grfn/system/home/modules/i3.nix b/users/grfn/system/home/modules/i3.nix
index 311ccd94b49a..1ce842af20e6 100644
--- a/users/grfn/system/home/modules/i3.nix
+++ b/users/grfn/system/home/modules/i3.nix
@@ -149,6 +149,9 @@ in
                   # Passwords
                   "${mod}+p" = "exec rofi-pass -font '${decorationFont}'";
 
+                  # Edit current buffer
+                  "${mod}+v" = "exec edit-input";
+
                   # Media
                   "XF86AudioPlay" = "exec playerctl -p spotify play-pause";
                   "XF86AudioNext" = "exec playerctl -p spotify next";