Skip to content

Commit 7da717a

Browse files
added 1.5x and 2x hidpi modes
xhidpi -> 1.5x hidpi -> 2x
1 parent 41a478b commit 7da717a

File tree

9 files changed

+143
-25
lines changed

9 files changed

+143
-25
lines changed

etc/proot-env/Hidpi/hidpi/app.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/env bash
2+
3+
SETTINGS_DIR=~/.config/hippo-HiDPI/
4+
DESKTOP="$XDG_CURRENT_DESKTOP"
5+
6+
case "$DESKTOP" in
7+
XFCE)
8+
;;
9+
*)
10+
echo 'ERROR: HiDPI mode only works on Xfce desktop' >&2
11+
notify-send -i dialog-warning 'ERROR: HiDPI mode only works on Xfce desktop'
12+
exit 1
13+
;;
14+
esac
15+
16+
mkdir -p "$SETTINGS_DIR"
17+
grep -q "$SETTINGS_DIR" ~/.xsessionrc 2>/dev/null || \
18+
echo "[ -r ${SETTINGS_DIR}xsession-settings ] && . ${SETTINGS_DIR}xsession-settings" >> ~/.xsessionrc
19+
20+
enable_hidpi() {
21+
cat > "${SETTINGS_DIR}xsession-settings" <<-EOF
22+
export QT_SCALE_FACTOR=2
23+
export XCURSOR_SIZE=48
24+
export GDK_SCALE=2
25+
EOF
26+
27+
. "${SETTINGS_DIR}xsession-settings"
28+
29+
case "$DESKTOP" in
30+
XFCE)
31+
xfconf-query -c xfwm4 -p /general/theme -s WhiteSur-light-hdpi
32+
xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -n -t 'int' -s 2
33+
;;
34+
esac
35+
}
36+
37+
disable_hidpi()
38+
{
39+
export QT_SCALE_FACTOR=1
40+
export XCURSOR_SIZE=
41+
export GDK_SCALE=1
42+
43+
rm "${SETTINGS_DIR}xsession-settings"
44+
45+
case "$DESKTOP" in
46+
XFCE)
47+
xfconf-query -c xfwm4 -p /general/theme -s WhiteSur-light
48+
xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 1
49+
;;
50+
esac
51+
}
52+
53+
toggle_hidpi() {
54+
if [ -r "${SETTINGS_DIR}xsession-settings" ]
55+
then
56+
disable_hidpi
57+
{ sleep 5 && notify-send -i dialog-information 'HiDPI mode disabled'; } &
58+
else
59+
enable_hidpi
60+
{ sleep 5 && notify-send -i dialog-information 'HiDPI mode enabled'; } &
61+
fi
62+
63+
if [ "$DESKTOP" = 'XFCE' ]
64+
then
65+
killall xfce4-notifyd 2> /dev/null # Hide existing notifications
66+
for process in xfsettingsd xfce4-panel xfdesktop
67+
do
68+
killall -9 $process
69+
$process >/dev/null 2>&1 &
70+
done
71+
fi
72+
}
73+
74+
toggle_hidpi
75+
zenity --question --title='hippo HiDPI mode(experimental)' --text 'Do you want to keep this window-scaling mode?\n(prefer no if things look bad)' --timeout=15 --width=200 || \
76+
toggle_hidpi
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
ICONDIR="/usr/share/hippo"
4+
5+
if [ -f app.sh ]; then
6+
cp app.sh /bin/hippo-hidpi-mode
7+
chmod 775 /bin/hippo-hidpi-mode
8+
fi
9+
10+
if [ -f logo.png ]; then
11+
12+
if ! [ -d $ICONDIR ]; then
13+
mkdir -p $ICONDIR
14+
fi
15+
16+
cp logo.png $ICONDIR/hidpi-logo.png
17+
18+
fi
19+
20+
if [ -f app.desktop ]; then
21+
if [ -d /usr/share/applications ]; then
22+
cp app.desktop /usr/share/applications/hippo-hidpi-mode.desktop
23+
fi
24+
fi
25+
26+
echo "Done..."

etc/proot-env/Hidpi/hidpi/logo.png

445 Bytes
Loading

etc/proot-env/Hidpi/install.sh

100755100644
Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
11
#!/usr/bin/env bash
22

3-
ICONDIR="/usr/share/hippo"
4-
5-
if [ -f app.sh ]; then
6-
cp app.sh /bin/hippo-hidpi-mode
7-
chmod 775 /bin/hippo-hidpi-mode
3+
if [ -d hidpi ] && [ -f hidpi/install.sh ]; then
4+
cd hidpi || exit 1
5+
bash install.sh
86
fi
9-
10-
if [ -f logo.png ]; then
11-
12-
if ! [ -d $ICONDIR ]; then
13-
mkdir $ICONDIR
14-
fi
15-
16-
cp logo.png $ICONDIR/hidpi-logo.png
17-
18-
fi
19-
20-
if [ -f app.desktop ]; then
21-
if [ -d /usr/share/applications ]; then
22-
cp app.desktop /usr/share/applications
23-
fi
24-
fi
25-
26-
echo "Done..."
7+
if [ -d xhidpi ] && [ -f xhidpi/install.sh ]; then
8+
cd hidpi || exit 1
9+
bash install.sh
10+
fi
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Name=Hippo XHiDPI Mode
3+
Exec=hippo-xhidpi-mode
4+
Terminal=false
5+
Type=Application
6+
Icon=/usr/share/hippo/xhidpi-logo.png
7+
OnlyShowIn=XFCE
8+
Keyboards=display;screen;hidpi;hippo;
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env bash
22

3-
## Inspired from Kali
4-
53
SETTINGS_DIR=~/.config/hippo-HiDPI/
64
DESKTOP="$XDG_CURRENT_DESKTOP"
75

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
ICONDIR="/usr/share/hippo"
4+
5+
if [ -f app.sh ]; then
6+
cp app.sh /bin/hippo-xhidpi-mode
7+
chmod 775 /bin/hippo-xhidpi-mode
8+
fi
9+
10+
if [ -f logo.png ]; then
11+
12+
if ! [ -d $ICONDIR ]; then
13+
mkdir -p $ICONDIR
14+
fi
15+
16+
cp logo.png $ICONDIR/xhidpi-logo.png
17+
18+
fi
19+
20+
if [ -f app.desktop ]; then
21+
if [ -d /usr/share/applications ]; then
22+
cp app.desktop /usr/share/applications/hippo-xhidpi-mode.desktop
23+
fi
24+
fi
25+
26+
echo "Done..."

0 commit comments

Comments
 (0)