summarylogtreecommitdiffstats
path: root/microsip
diff options
context:
space:
mode:
authorOleksandr Natalenko2018-09-22 13:27:24 +0200
committerOleksandr Natalenko2018-09-22 13:27:24 +0200
commite9cddd03e57c63ac3e937b3b4c897ec61ca69637 (patch)
tree6ed3e0f409639ff27fb07dd8ea690f5fb7aa1bad /microsip
parent337d60a2448f0e60921dcce52c72890afcd02a4d (diff)
downloadaur-e9cddd03e57c63ac3e937b3b4c897ec61ca69637.tar.gz
store user-specific data in XDG folders, detect DPI automatically
Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Diffstat (limited to 'microsip')
-rwxr-xr-xmicrosip23
1 files changed, 23 insertions, 0 deletions
diff --git a/microsip b/microsip
index 16bf3f701c7..c55fc9e0da1 100755
--- a/microsip
+++ b/microsip
@@ -3,6 +3,12 @@
__APPNAME=$(basename $0)
__WINEPREFIX="${XDG_DATA_HOME:-$HOME/.local}/wine/${__APPNAME}"
__APPDIR="${__WINEPREFIX}/dosdevices/c:/${__APPNAME}"
+__APPCFG="${XDG_CONFIG_HOME:-$HOME/.config}/${__APPNAME}"
+__APPLOG="${XDG_CACHE_HOME:-$HOME/.cache}/${__APPNAME}"
+__REGFILE="${__APPDIR}/${__APPNAME}.reg"
+__TMPREGFILE=$(mktemp)
+__DPI=$(xdpyinfo -display $DISPLAY | grep -A 2 "screen #0:" | grep "resolution:" | grep -oE '[0-9]+x[0-9]+' | cut -d 'x' -f 1)
+__DPIX=$(printf %08x ${__DPI})
__symlink() {
ln -sf "$1" "${__APPDIR}/${1##*/}"
@@ -25,5 +31,22 @@ __symlink "/usr/lib/${__APPNAME}/avutil-55.dll"
__symlink "/usr/lib/${__APPNAME}/microsip.exe"
__symlink "/usr/lib/${__APPNAME}/swscale-4.dll"
+cp "/usr/share/${__APPNAME}/${__APPNAME}.reg" "${__TMPREGFILE}"
+sed -i "s/{DPI}/${__DPIX}/g" "${__TMPREGFILE}"
+iconv -f utf-8 -t utf-16le "${__TMPREGFILE}" >"${__REGFILE}"
+rm -f "${__TMPREGFILE}"
+WINEPREFIX="${__WINEPREFIX}" regedit "${__REGFILE}"
+rm -f "${__REGFILE}"
+
+mkdir -p "${__APPCFG}"
+touch "${__APPCFG}/Contacts.xml"
+touch "${__APPCFG}/microsip.ini"
+__symlink "${__APPCFG}/Contacts.xml"
+__symlink "${__APPCFG}/microsip.ini"
+
+mkdir -p "${__APPLOG}"
+touch "${__APPLOG}/microsip_log.txt"
+__symlink "${__APPLOG}/microsip_log.txt"
+
WINEPREFIX="${__WINEPREFIX}" wine "${__APPDIR}/microsip.exe"