diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2024-09-28 21:10:11 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2024-09-28 21:10:11 +0200 |
| commit | afc33e0e043f28bc1678c27e875c4c84ffef83bd (patch) | |
| tree | 4982a261cabeb76c17364b8391d2d5ddd774f260 | |
| parent | 22049ae6f988b143f74d7e022589222b3b060141 (diff) | |
| download | dotfiles-afc33e0e043f28bc1678c27e875c4c84ffef83bd.tar.gz dotfiles-afc33e0e043f28bc1678c27e875c4c84ffef83bd.tar.bz2 dotfiles-afc33e0e043f28bc1678c27e875c4c84ffef83bd.zip | |
Add translate-prompt script
| -rw-r--r-- | config/alacritty/alacritty.linux.toml | 2 | ||||
| -rw-r--r-- | config/fish/config.fish | 2 | ||||
| -rw-r--r-- | config/xmonad/xmonad.hs | 2 | ||||
| -rwxr-xr-x | local/bin/translate-prompt | 40 |
4 files changed, 44 insertions, 2 deletions
diff --git a/config/alacritty/alacritty.linux.toml b/config/alacritty/alacritty.linux.toml index 2bb62cb..f4df8ab 100644 --- a/config/alacritty/alacritty.linux.toml +++ b/config/alacritty/alacritty.linux.toml @@ -3,7 +3,7 @@ TERM = "xterm-256color" WINIT_X11_SCALE_FACTOR = "1" [font] -size = 9.0 +size = 11.0 offset = { x = 0, y = 0 } normal = { family = "Fira Code", style = "Regular" } bold = { family = "Fira Code", style = "Bold" } diff --git a/config/fish/config.fish b/config/fish/config.fish index acb8634..9368887 100644 --- a/config/fish/config.fish +++ b/config/fish/config.fish @@ -1,5 +1,5 @@ if [ "$(uname)" = 'Linux' ] - set -gx PATH "/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin" + set -gx PATH "/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/usr/bin/vendor_perl" set -gx MAIL 'me@cacharle.xyz' set -gx SUDO 'doas' else if [ "$(uname)" = 'Darwin' ] diff --git a/config/xmonad/xmonad.hs b/config/xmonad/xmonad.hs index c169e2b..963acdb 100644 --- a/config/xmonad/xmonad.hs +++ b/config/xmonad/xmonad.hs @@ -72,6 +72,7 @@ manageHook' = composeAll , willFloat --> insertPosition Above Newer -- insert little pop up windows above all the rest , className =? "Anki" --> doFloat , className =? "Steam" --> doFloat + , className =? "CustomFloating" --> doFloat -- , className =? "Gimp" --> doFloat -- , className =? "OBS" --> doFloat , isDialog --> doF swapUp @@ -97,6 +98,7 @@ keys' = [ ("<XF86AudioLowerVolume>", spawn "pulseaudio-ctl down") , ("M-s-w", spawn "rofi -show window") , ("M-i", spawn "insert-special-character") , ("M-S-i", spawn "insert-special-character copy") + , ("M-S-t", spawn "translate-prompt") , ("M-S-d", spawn "notify-send -i x-office-calendar \"$(date +\"%H:%M %A %d/%m/%Y %B\")\"") , ("M-S-b", spawn $ "notify-send --hint=int:transient:1 " ++ "--hint=int:value:\"$(cat /sys/class/power_supply/BAT0/capacity)\" " ++ diff --git a/local/bin/translate-prompt b/local/bin/translate-prompt new file mode 100755 index 0000000..9419f2a --- /dev/null +++ b/local/bin/translate-prompt @@ -0,0 +1,40 @@ +#!/bin/sh + +command -v trans > /dev/null || + { echo "translate-shell not installed" ; exit 1 ; } +command -v rofi > /dev/null && + menu_exec='rofi -dmenu' || + menu_exec='dmenu' + +choice="$( +$menu_exec <<EOF +From Clipboard +Open Editor +EOF +)" + +# TODO: alacritty --class CustomFloating when I figure out how to center floating windows + +text_file="$(mktemp /tmp/translate_prompt_text_XXXXXX)" + +case "$choice" in + 'From Clipboard') + xclip -out -selection clipboard > "$text_file" + ;; + 'Open Editor') + text_file="$(mktemp /tmp/translate_prompt_text_XXXXXX)" + "$TERMINAL" -e "$EDITOR" "$text_file" + ;; + *) + echo -n "$choice" > "$text_file" + ;; +esac + +brief=-brief +if [ "$(head -c1 "$text_file")" = '#' ] +then + brief='' + sed -i '1 s/^#//' "$text_file" +fi + +"$TERMINAL" -e trans $brief -view -input "$text_file" |
