Add dictionary to zathura

Made a bash script and used dwn to set the keybind for it. dictd for the
dictionary. WordNet for the database. st for the ui
This commit is contained in:
mintycube 2024-04-30 17:50:22 +05:00
parent 54c7a2c8b4
commit 3c433a3457
3 changed files with 20 additions and 0 deletions

View File

@ -111,6 +111,7 @@ static const Rule rules[] = {
RULE(.class = "Qalculate-gtk", .tags = SPTAG(2), .isfloating = 1)
RULE(.instance = "spmusic", .tags = SPTAG(3), .isfloating = 1)
RULE(.instance = "spnotes", .tags = SPTAG(4), .isfloating = 1)
RULE(.instance = "dictionary", .isfloating = 1)
RULE(.class = "volume-ui", .isfloating = 1)
};
@ -221,6 +222,7 @@ static const Key keys[] = {
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ ALTKEY, XK_h, spawn, {.v = (const char*[]){ "dmenuhandler", NULL } } },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ ALTKEY, XK_l, spawn, {.v = (const char*[]){"dictionary", NULL } } },
{ MODKEY|ShiftMask, XK_apostrophe, togglescratch, {.ui = 2 } },
{ MODKEY, XK_apostrophe, togglescratch, {.ui = 1 } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
@ -263,6 +265,7 @@ static const Button buttons[] = {
{ ClkStatusText, 0, Button4, sigstatusbar, {.i = 4} },
{ ClkStatusText, 0, Button5, sigstatusbar, {.i = 5} },
{ ClkStatusText, ShiftMask, Button1, sigstatusbar, {.i = 6} },
{ ClkClientWin, 0, Button2, spawn, {.v = (const char*[]){ "dictionary", NULL } } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },

14
.local/bin/dictionary Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
word=$(xclip -o -selection "clipboard")
if [ -z "$word" ]; then
notify-send "No query."
exit 1
fi
st \
-n "dictionary" \
-g 74x20+800 \
-f "JetBrainsMono Nerd Font:size=12" \
sh -c "dict -d wn \"$word\" | colorit | sed -e '1,3d' -e 's/\[34;47m//g' | bat --style=plain --paging=always";

View File

@ -36,7 +36,9 @@ mod-o, increase master windows, master
mod-shift-o, decrease master windows, master
mod-f, fake fullscreen, maximize
mod-h, adjust master/stack ratio, resize
alt-h, dmenuhandler, link
mod-l, adjust master/stack ratio, resize
alt-l, dictionary, define meaning thesaurus, synonym
mod-', calculator, apostrophe qalculate math
mod-b, toggle statusbar, dwmblocks hide
mod-shift-b, add bookmark, dmenuweb
@ -57,3 +59,4 @@ mod-[1-9], change tag, switch workspaces 123456789
mod-0, toggle all-tag, all workspaces
mod-scroll, resize floating windows, client
F7, clipboard manager, clipmenu copy paste
3-f-tap, dictionary, define, meaning, thesaurus, synonym