config/modules/gui/clipboard.nix
2022-05-15 16:11:41 +02:00

33 lines
659 B
Nix

{ config, lib, pkgs, ... }:
(lib.mkIf (config.riley.gui) {
# Add some shell scripts that abstract away the
# horrible reality that the clipboard is managed by
# the display server.
users.users."riley".packages = with pkgs; [
(writeShellApplication {
name = "c";
runtimeInputs = [ xclip ];
text = "xclip -sel clip -i";
})
(writeShellApplication {
name = "p";
runtimeInputs = [ xclip ];
text = "xclip -sel clip -o";
})
(writeShellApplication {
name = "sc";
runtimeInputs = [ xclip scrot ];
text = ''
scrot -zso /tmp/sc.png
xclip -t "image/png" -sel clip -i < /tmp/sc.png
'';
})
];
})