From 171d56150dee55e6c6c5b6f7d7697e5cea1dda0e Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Thu, 12 Dec 2024 19:24:39 +0100 Subject: [PATCH] Migrate 'dmenu-trans' to rofi --- .bin/dmenu-trans | 9 --------- .bin/rofi-trans | 13 +++++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) delete mode 100755 .bin/dmenu-trans create mode 100755 .bin/rofi-trans diff --git a/.bin/dmenu-trans b/.bin/dmenu-trans deleted file mode 100755 index 6ce20ea..0000000 --- a/.bin/dmenu-trans +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -options="nl:en\nen:nl\nnl:fr\nfr:nl\nen:fr\nfr:en\nnl:de\nde:nl" - -selected=$(echo -e "$options" | dmenu -p "s?:t?" -i -l 0) - -notify-send --app-name= -t 3000 "$(trans "$selected" -b "$(dmenu -p "$selected" &)" \ - | tr -d '\n' \ - | xclip -sel clip -f)" diff --git a/.bin/rofi-trans b/.bin/rofi-trans new file mode 100755 index 0000000..acdc6ea --- /dev/null +++ b/.bin/rofi-trans @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +options="nl:en\nen:nl\nnl:fr\nfr:nl\nen:fr\nfr:en\nnl:de\nde:nl" + +selected=$(echo -en "$options" | rofi -dmenu -p "source?:target?" -i) + +# notify-send --app-name= -t 3000 "$(trans "$selected" -b "$(rofi -dmenu -p "$selected" &)" \ +# | tr -d '\n' \ +# | xclip -sel clip -f)" + +translation="$(trans "$selected" -b "$(rofi -dmenu -p "$selected" &)" | tr -d '\n')" + +echo -e "Copy" | rofi -p "translation" -dmenu -i -mesg "$translation" | xargs -I{} echo -n "$translation" | xclip -selection clipboard