From 3f14cee31f7c970620c9b65d4a7310d8dd35e45b Mon Sep 17 00:00:00 2001 From: Deven Blake Date: Thu, 6 Jan 2022 22:50:50 -0500 Subject: [PATCH] some fun --- dotfiles-old/bin/autotranslate | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 dotfiles-old/bin/autotranslate diff --git a/dotfiles-old/bin/autotranslate b/dotfiles-old/bin/autotranslate new file mode 100755 index 0000000..7d7bdc3 --- /dev/null +++ b/dotfiles-old/bin/autotranslate @@ -0,0 +1,11 @@ +#!/bin/sh + +[ -n "$dmenu" ] || dmenu=dmenu + +lang="$LANG" +# lots of potentially wrong assumptions here +printf "%s\n" "$lang" | grep "_" >/dev/null 2>&1 \ + && lang="$(printf "%s\n" "$lang" | cut -d '_' -f 1)" \ + || lang=en + +printf "%s\n" "$(xclip -o)" | translate auto $lang | "$($dmenu -p "Press Enter to dismiss.")"