Last active
March 27, 2024 07:03
-
-
Save egrath/85cadf516d90eddb0cbc25762357fb80 to your computer and use it in GitHub Desktop.
Set the Cursor Theme and Size for GTK, GNOME and Xorg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo usage: $(basename $0) icon-name | |
exit 0 | |
fi | |
THEME=${1} | |
SIZE=36 | |
echo Setting for GNOME ... | |
gsettings set org.gnome.desktop.interface cursor-theme "${THEME}" | |
gsettings set org.gnome.desktop.interface cursor-size ${SIZE} | |
## Only for Deepin Linux | |
cat /etc/lsb-release | grep -i Deepin 2>/dev/null 1>&2 | |
if [ $? -eq 0 ]; then | |
gsettings set com.deepin.wrap.gnome.desktop.interface cursor-size ${SIZE} | |
gsettings set com.deepin.xsettings gtk-cursor-theme-size ${SIZE} | |
gsettings set com.deepin.wrap.gnome.desktop.interface cursor-theme ${THEME} | |
gsettings set com.deepin.xsettings gtk-cursor-theme-name ${THEME} | |
gsettings set com.deepin.dde.appearance cursor-theme ${THEME} | |
fi | |
if [ -f ~/.icons/default/index.theme ]; then | |
rm ~/.icons/default/index.theme | |
fi | |
if [ ! -d ~/.icons/default ]; then | |
mkdir -p ~/.icons/default | |
fi | |
echo \[icon theme\] >> ~/.icons/default/index.theme | |
echo Inherits=${THEME} >> ~/.icons/default/index.theme | |
echo Setting for GTK-3.0 ... | |
if [ -f ~/.config/gtk-3.0/settings.ini ]; then | |
rm ~/.config/gtk-3.0/settings.ini | |
fi | |
if [ ! -d ~/.config/gtk-3.0 ]; then | |
mkdir ~/.config/gtk-3.0 | |
fi | |
echo \[Settings\] >> ~/.config/gtk-3.0/settings.ini | |
echo gtk-cursor-theme-name=${THEME} >> ~/.config/gtk-3.0/settings.ini | |
echo Setting for Legacy X ... | |
if [ -f ~/.xinitrc ]; then | |
sed -i '/.*XCURSOR_THEME.*/Id' ~/.xinitrc | |
sed -i '/.*XCURSOR_SIZE.*/Id' ~/.xinitrc | |
fi | |
echo XCURSOR_SIZE=${SIZE} >> ~/.xinitrc | |
echo XCURSOR_THEME=${THEME} >> ~/.xinitrc | |
if [ -f ~/.Xresources ]; then | |
sed -i '/.*xcursor.size.*/Id' ~/.Xresources | |
sed -i '/.*xcursor.theme.*/Id' ~/.Xresources | |
fi | |
echo Xcursor.size=${SIZE} >> ~/.Xresources | |
echo Xcursor.theme=${THEME} >> ~/.Xresources |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment