script to toggle two zathura themes
zathura allows you to define your own color scheme to display documents with and toggle the document's true colors back on. this is nice and functional, but not stylish enough! this script allows toggling between two different themes by overwriting the config file zathura actually reads from.
dark recolor, light recolor and true colors
first, make your different config files and give them names other than the default zathurarc. include the comment # dark mode true
in the dark mode config. it serves as the trigger for the toggle.
zathurarc zathurarc-dark zathurarc-light
now create a script in your ~/.local/bin
(or wherever you prefer).
#!/bin/bash
switch_to_light_mode() {
cp $HOME/.config/zathura/zathurarc-light $HOME/.config/zathura/zathurarc
}
switch_to_dark_mode() {
cp $HOME/.config/zathura/zathurarc-dark $HOME/.config/zathura/zathurarc
}
if [[ $(grep -ic '# dark mode true' $HOME/.config/zathura/zathurarc) -eq 1 ]]; then
switch_to_light_mode
else
switch_to_dark_mode
fi
switch_to_light_mode() {
cp $HOME/.config/zathura/zathurarc-light $HOME/.config/zathura/zathurarc
}
switch_to_dark_mode() {
cp $HOME/.config/zathura/zathurarc-dark $HOME/.config/zathura/zathurarc
}
if [[ $(grep -ic '# dark mode true' $HOME/.config/zathura/zathurarc) -eq 1 ]]; then
switch_to_light_mode
else
switch_to_dark_mode
fi
you can make an open instance of zathura reload its config file without having to close the program with the :source
command.