dotfiles/bin/rice-clip
Sarthak 7f41cf7a82 replace the old dotfiles with the sakura line rice
The bare $HOME repo is gone. This is now the rice: install.sh, rice-*
scripts in bin/, configs in home/ linked into $HOME, theme templates, st
and the particle wallpaper. Clone to ~/rice and run install.sh.
2026-09-14 19:44:44 +05:30

18 lines
624 B
Bash
Executable file

#!/usr/bin/env bash
# rice-clip copy|paste - one copy/paste shortcut for terminals and GUI apps.
# Terminals want Ctrl+Shift+C/V; everything else wants Ctrl+C/V.
set -uo pipefail
class=$(xdotool getactivewindow getwindowclassname 2>/dev/null)
case "${class,,}" in
st|st-256color|kitty|alacritty|xterm|urxvt|org.wezfurlong.wezterm|com.mitchellh.ghostty|rice-float|rice-scratchpad|rice-about)
mods=ctrl+shift ;;
*)
mods=ctrl ;;
esac
case "${1:-}" in
copy) xdotool key --clearmodifiers "$mods+c" ;;
paste) xdotool key --clearmodifiers "$mods+v" ;;
*) echo "usage: rice-clip copy|paste" >&2; exit 2 ;;
esac