mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
X11, dpi: reliably set xcursor size
Other minor tweaks to the dpi script to ensure everything gets updated correctly. Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
parent
650eb08a80
commit
5035afc8b4
@ -36,4 +36,5 @@ Xft.hinting: true
|
|||||||
Xft.hintstyle: hintfull
|
Xft.hintstyle: hintfull
|
||||||
Xft.lcdfilter: lcddefault
|
Xft.lcdfilter: lcddefault
|
||||||
|
|
||||||
|
Xcursor.size: 16
|
||||||
Xcursor.theme: Breeze_Obsidian
|
Xcursor.theme: Breeze_Obsidian
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
gtk-theme-name="Arc-Dark"
|
gtk-theme-name="Arc-Dark"
|
||||||
gtk-icon-theme-name="Xenlism-Wildfire"
|
gtk-icon-theme-name="Xenlism-Wildfire"
|
||||||
gtk-font-name="Noto Sans 9"
|
gtk-font-name="sans 9"
|
||||||
gtk-cursor-theme-name="Breeze_Obsidian"
|
gtk-cursor-theme-name="Breeze_Obsidian"
|
||||||
gtk-cursor-theme-size=0
|
gtk-cursor-theme-size=16
|
||||||
gtk-toolbar-style=GTK_TOOLBAR_BOTH
|
gtk-toolbar-style=GTK_TOOLBAR_BOTH
|
||||||
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||||
gtk-button-images=1
|
gtk-button-images=1
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
gtk-theme-name=Arc-Dark
|
gtk-theme-name=Arc-Dark
|
||||||
gtk-icon-theme-name=Xenlism-Wildfire
|
gtk-icon-theme-name=Xenlism-Wildfire
|
||||||
gtk-application-prefer-dark-theme=true
|
gtk-application-prefer-dark-theme=true
|
||||||
gtk-font-name=Noto Sans 9
|
gtk-font-name=sans 9
|
||||||
gtk-cursor-theme-name=Breeze_Obsidian
|
gtk-cursor-theme-name=Breeze_Obsidian
|
||||||
gtk-cursor-theme-size=0
|
gtk-cursor-theme-size=16
|
||||||
gtk-toolbar-style=GTK_TOOLBAR_BOTH
|
gtk-toolbar-style=GTK_TOOLBAR_BOTH
|
||||||
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||||
gtk-button-images=1
|
gtk-button-images=1
|
||||||
|
44
scripts/dpi
44
scripts/dpi
@ -9,43 +9,57 @@ xrdbget() {
|
|||||||
xrdb -query | grep -i -m1 "$1" | sed 's/^.*:\s//g' || echo "$2"
|
xrdb -query | grep -i -m1 "$1" | sed 's/^.*:\s//g' || echo "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
dpi=$1
|
xsetting_bool() {
|
||||||
|
case "$1" in
|
||||||
|
true) echo 1;;
|
||||||
|
false) echo 0;;
|
||||||
|
default) echo -1;;
|
||||||
|
*) echo -1;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
>&2 printf "Usage\n\t%s: <dpi>" "$(basename "$0")"
|
if [ -z "$1" ] || [ "$1" -gt 200 ] || [ "$1" -lt 96 ]; then
|
||||||
|
>&2 printf "Usage\n\t%s: value\n\n value\t Value must be within 96-200 inclusive\n" "$(basename "$0")"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update picom and xorg
|
dpi=$1
|
||||||
sed -i "s/strength =.*$/strength = $(( dpi*8/96 ));/" "$CONF_DIR/picom/picom.conf" &
|
|
||||||
xrandr --dpi "$dpi" &
|
|
||||||
|
|
||||||
scale=$(( dpi/96 ))
|
scale=$(( dpi/96 ))
|
||||||
cursor=$(( dpi/6 ))
|
cursor=$(( dpi/6 ))
|
||||||
|
|
||||||
|
# Update picom scale
|
||||||
|
sed -i -e "s/strength =.*$/strength = $(( dpi*8/96 ));/" \
|
||||||
|
-e "s/corner-radius =.*$/corner-radius = $(( dpi/13 ));/" \
|
||||||
|
"$CONF_DIR/picom/picom.conf" &
|
||||||
|
|
||||||
# Build xsettingsd.conf
|
# Build xsettingsd.conf
|
||||||
mkdir -p "$CONF_DIR/xsettingsd"
|
mkdir -p "$CONF_DIR/xsettingsd"
|
||||||
{
|
{
|
||||||
cat "$CONF_DIR/xsettingsd.local" 2>/dev/null || true
|
cat "$CONF_DIR/xsettingsd.local" 2>/dev/null || :
|
||||||
echo "Xcursor/size $cursor"
|
echo "Xcursor/size $cursor"
|
||||||
echo "Gtk/CursorThemeSize $cursor"
|
echo "Gtk/CursorThemeSize $cursor"
|
||||||
echo "Gtk/CursorThemeName \"$(xrdbget Xcursor.theme Adwaita)\""
|
echo "Gtk/CursorThemeName \"$(xrdbget Xcursor.theme Adwaita)\""
|
||||||
echo "Xft/HintStyle \"$(xrdbget Xft.hintstyle hintfull)\""
|
echo "Xft/HintStyle \"$(xrdbget Xft.hintstyle hintfull)\""
|
||||||
echo "Xft/Hinting \"$(xrdbget Xft.hinting -1)\""
|
echo "Xft/Hinting $(xsetting_bool "$(xrdbget Xft.hinting default)")"
|
||||||
echo "Xft/RGBA \"$(xrdbget Xft.rgba rgb)\""
|
echo "Xft/RGBA \"$(xrdbget Xft.rgba rgb)\""
|
||||||
echo "Xft/DPI $(( dpi*1024 ))"
|
echo "Xft/DPI $(( dpi*1024 ))"
|
||||||
echo "Gdk/WindowScalingFactor $scale"
|
echo "Gdk/WindowScalingFactor $scale"
|
||||||
echo "Gdk/UnscaledDPI $(( dpi*1024/scale ))"
|
echo "Gdk/UnscaledDPI $(( dpi*1024/scale ))"
|
||||||
} > "$CONF_DIR/xsettingsd/xsettingsd.conf"
|
} > "$CONF_DIR/xsettingsd/xsettingsd.conf"
|
||||||
|
|
||||||
{
|
xrdb -merge <<EOF &
|
||||||
echo "Xft.dpi: $dpi"
|
Xft.dpi: $dpi
|
||||||
echo "Xcursor.size: $cursor"
|
Xcursor.size: $cursor
|
||||||
} | xrdb -merge &
|
EOF
|
||||||
|
xrandr --dpi "$dpi" &
|
||||||
systemctl --user reload-or-restart xsettingsd &
|
systemctl --user reload-or-restart xsettingsd &
|
||||||
wait
|
wait
|
||||||
|
|
||||||
systemctl --user reload \
|
systemctl --user reload \
|
||||||
i3 \
|
i3 \
|
||||||
polybar@i3bar
|
polybar@i3bar &
|
||||||
|
systemctl --user restart \
|
||||||
|
dunst &
|
||||||
|
|
||||||
|
wait
|
||||||
|
Loading…
Reference in New Issue
Block a user