Skip to content

Commit 41a478b

Browse files
added code xhidpi transition
1 parent f1634fe commit 41a478b

File tree

5 files changed

+117
-4
lines changed

5 files changed

+117
-4
lines changed

etc/proot-env/Hidpi/app.desktop

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Name=Hippo HiDPI Mode
3+
Exec=hippo-hidpi-mode
4+
Terminal=false
5+
Type=Application
6+
Icon=/usr/share/hippo/hidpi-logo.png
7+
OnlyShowIn=XFCE
8+
Keyboards=display;screen;hidpi;hippo;

etc/proot-env/Hidpi/app.sh

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

etc/proot-env/Hidpi/install.sh

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 $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..."

etc/proot-env/Hidpi/logo.png

325 Bytes
Loading

etc/scripts/hippo/hippo.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ INSTALL_FOLDER="${TPREFIX}/usr/var/lib/proot-distro/installed-rootfs"
1212
HIPPO_DIR="${INSTALL_FOLDER}/hippo"
1313
HIPPO_SCRIPT_FILE="${SCRIPT_DIR}/hippo.sh"
1414

15-
SOCIAL_PLATFORM="https://discord.gg/TAqaG5sEfW"
15+
SOCIAL_PLATFORM="\e[1;34mhttps://discord.gg/TAqaG5sEfW\e[0m"
1616

1717
# HIPPO_DIR = "${INSTALL_FOLDER}/${HIPPO_DEFAULT}"
1818
# HIPPO_SCRIPT_FILE="${SCRIPT_DIR}/hippo.sh"
@@ -109,7 +109,8 @@ function _lauch_or_install()
109109
# echo -e "use hippo --help for more option and comming up features"
110110
fi
111111
else
112-
#@GxmerSam Sam Alarie
112+
#######################################################################################################
113+
# Thanks to @GxmerSam Sam Alarie, @mizzunet, @Andre-cmd-rgb for the issues randome ideas and suggestion
113114
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 >> /dev/null
114115
if [ -f "{CACHE_ROOT}"/ubuntu-on-android/etc/scripts/vncserver/startvnc.sh ] && [ ! -f ${HIPPO_DIR}/bin/startvnc ]; then
115116
DIR="{CACHE_ROOT}/ubuntu-on-android/etc/scripts/vncserver/startvnc.sh"
@@ -186,8 +187,8 @@ if [ $# -ge 1 ]; then
186187
echo -e "\e[32mError:\e[0m Hippo not found"
187188
fi
188189
;;
189-
*) _lauch_or_install;;
190+
*) _lauch_or_install "$@";;
190191
esac
191192
else
192-
_lauch_or_install
193+
_lauch_or_install "$@"
193194
fi

0 commit comments

Comments
 (0)