From a568a964fd6a9efba388b2b4919339c0b7dfe51d Mon Sep 17 00:00:00 2001 From: venomade Date: Mon, 16 Feb 2026 17:31:16 +0000 Subject: MacOS Nix Asahi is just not perfectly usable yet. Moved stuff, went nix. --- .local/bin/rofi-translate | 60 ----------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100755 .local/bin/rofi-translate (limited to '.local/bin/rofi-translate') diff --git a/.local/bin/rofi-translate b/.local/bin/rofi-translate deleted file mode 100755 index f71557d..0000000 --- a/.local/bin/rofi-translate +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env lua - -local function rofi(prompt, lines) - local cmd = string.format( - 'printf "%s" | rofi -dmenu -i -p "%s"', - table.concat(lines, "\n"), - prompt - ) - local handle = io.popen(cmd) - local selection = handle:read("*a") - handle:close() - selection = selection:gsub("%s+$", "") - if selection == "" then return nil end - return selection -end - -local function contains(tbl, val) - for _, v in pairs(tbl) do - if v == val then - return true - end - end - return false -end - -local directions = { - "English → Portuguese", - "Portuguese → English" -} - -local choice = rofi("Translate:", directions) -if (not choice) or (not contains(directions,choice)) then os.exit() end - -local lang_pair = { - ["English → Portuguese"] = "en:pt", - ["Portuguese → English"] = "pt:en" -} -local pair = lang_pair[choice] - -local text = rofi("󰗊", { "" }) -if not text then os.exit() end - -local trans_cmd = string.format('trans -b %s "%s"', pair, text:gsub('"', '\\"')) -local trans_handle = io.popen(trans_cmd) -local translation = trans_handle:read("*a") -trans_handle:close() -translation = translation:gsub("%s+$", "") - -if translation == "" then - translation = "(no translation returned)" -else - io.popen("wl-copy " .. translation) -end - -local notify_cmd = string.format( - 'notify-send -- "Translation (%s)" "%s"', - choice, - translation:gsub('"', '\\"') -) -os.execute(notify_cmd) -- cgit 1.4.1-2-gfad0