Skip to content

Commit b4eca31

Browse files
committed
feat(clipboard): add cross-platform clipboard support
Install `wl-clipboard` on NixOS for Wayland clipboard integration. Implement a platform-aware clipboard command, using `pbcopy` on macOS and `wl-copy` on Linux. Update `lumen` commands to utilize this new cross-platform clipboard logic.
1 parent 91998ac commit b4eca31

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

common/hosts/nixos/misc.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
lib,
33
config,
4+
pkgs,
45
...
56
}: let
67
inherit (lib) mkDefault;
@@ -18,4 +19,12 @@ in {
1819
isNormalUser = true;
1920
};
2021
};
22+
23+
environment.systemPackages = lib.attrsets.attrValues {
24+
inherit
25+
(pkgs)
26+
bluez # bluetooth protocol
27+
wl-clipboard
28+
;
29+
};
2130
}

home/tty/vcs/git/ancillary.nix

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
pkgs,
33
config,
44
lib,
5+
hostPlatform,
56
...
6-
}: {
7+
}: let
8+
clipboardCmd =
9+
if hostPlatform.isDarwin
10+
then "pbcopy"
11+
else if hostPlatform.isLinux
12+
then "${pkgs.wl-clipboard}/bin/wl-copy"
13+
else "cat >/dev/null";
14+
in {
715
home.packages = lib.attrsets.attrValues {
816
inherit
917
(pkgs)
@@ -137,14 +145,14 @@
137145
{
138146
key = "<c-l>";
139147
context = "files";
140-
command = "lumen draft | tee >(pbcopy)";
148+
command = "lumen draft | tee /dev/tty | ${clipboardCmd}";
141149
loadingText = "Generating message...";
142150
outupt = "popup";
143151
}
144152
{
145153
key = "<c-k>";
146154
context = "files";
147-
command = ''lumen draft -c {{.Form.Context | quote}} | tee >(pbcopy)'';
155+
command = "lumen draft -c {{.Form.Context | quote}} | tee /dev/tty | ${clipboardCmd}";
148156
loadingText = "Generating message...";
149157
outupt = "popup";
150158
prompts = [

0 commit comments

Comments
 (0)