Skip to content

Instantly share code, notes, and snippets.

@dylanschmittle
Created September 3, 2021 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dylanschmittle/5f04ba95b0490046d4ab56f7791793dd to your computer and use it in GitHub Desktop.
Save dylanschmittle/5f04ba95b0490046d4ab56f7791793dd to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Set some X11 configurations independent from Desktop and Windows Manager.
# By A.C.
# Needs the Arch/Artix package 'xorg-xwininfo' (Debian: x11-utils) for the X11 appearance check.
# Verify settings with: xrdb -query -all
# Script should be put in /usr/local/bin/configmyx11.sh and run by the Desktop Autorun.
# Probably: ~/.config/autostart/configmyx11.desktop
# [Desktop Entry]
# Type=Application
# Exec=/usr/local/bin/configmyx11.sh
# Hidden=false
# X-MATE-Autostart-enabled=true
# Name=ConfigMyX11
# Comment=Config X11 my way
#
# Set my favorite (downloaded) mouse-cursors
MYXCURSORTHEME=cz-Viator-Black-Hourglass
MYXCURSORPATH=~/.icons/cz-Viator-Black-Hourglass
# Or set the most common mouse-cursors
# MYXCURSORTHEME=Adwaita
# MYXCURSORPATH=/usr/share/icons/Adwaita
# Good xmouse cursor size for high-dpi displays
MYXCURSORSIZE=48
#
# Get sure we parse english output
LANG=C
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_MESSAGES="C"
#
# Set my favorite TouchPad properties
/usr/bin/xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Tapping Enabled' 1 &
/usr/bin/xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Accel Speed' 0.5 &
/usr/bin/xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Tapping Drag Enabled' 0 &
# If Xcursor config file not exist, make it
if ! [ -s ~/.Xcursor ]; then
touch ~/.Xcursor ; chown 1000:users ~/.Xcursor ; chmod 0644 ~/.Xcursor
echo "Xcursor.size: $MYXCURSORSIZE" >~/.Xcursor
echo "Xcursor.theme: $MYXCURSORTHEME" >>~/.Xcursor
echo 'Xcursor.theme_core: true' >>~/.Xcursor
fi
# If Xkeybord config file not exist, make it
# Change the CAPS-LOCK key to a Shift left
if ! [ -s ~/.Xmodmap ]; then
touch ~/.Xmodmap ; chown 1000:users ~/.Xmodmap ; chmod 0644 ~/.Xmodmap
echo 'clear lock' >~/.Xmodmap
echo 'clear shift' >>~/.Xmodmap
echo 'keycode 66 = Shift_L' >>~/.Xmodmap
echo 'add shift = Shift_L Shift_R' >>~/.Xmodmap
fi
/usr/bin/xrdb ~/.Xcursor &
/usr/bin/xsetroot -xcf $MYXCURSORPATH/cursors/left_ptr $MYXCURSORSIZE &
/usr/bin/xmodmap ~/.Xmodmap &
# Bug in LXQT: xcursor size only set correctly after lxqt-config-appearance is run.
/usr/bin/lxqt-config-appearance &
LXQTCAPID=$!
LXQTACTIV=0
QTO=0
while [ $QTO -lt 33 ]; do # 10 sec. timeout
sleep 0.3 # Check every 300ms for appearance
LXQTACTIV=$(/usr/bin/xwininfo -name 'LXQt Appearance Configuration' 2>&1 | grep -scie 'Map State: IsViewable')
if [ $LXQTACTIV -gt 0 ]; then
kill $LXQTCAPID 2>&1 >/dev/null
break
fi
((QTO++))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment