From 81047cfcd7e527722a32dc7987cfb0e288ddd1eb Mon Sep 17 00:00:00 2001 From: Aspen Smith Date: Mon, 6 Nov 2023 10:39:39 -0500 Subject: feat(grfn/system): Command to edit the current text input in emacs 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 Autosubmit: grfn Tested-by: BuildkiteCI --- users/grfn/system/home/modules/desktop.nix | 17 +++++++++++++++++ users/grfn/system/home/modules/i3.nix | 3 +++ 2 files changed, 20 insertions(+) (limited to 'users/grfn') 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"; -- cgit 1.4.1