From 827aa96d9dfbbf06b425ff85e71efbc8a211b418 Mon Sep 17 00:00:00 2001 From: crschnick Date: Tue, 20 Jun 2023 12:49:13 +0000 Subject: [PATCH] Linux font fixes --- .../main/java/io/xpipe/app/core/AppFont.java | 6 ++- .../java/io/xpipe/app/prefs/AppPrefs.java | 3 -- get-xpipe.sh | 53 +++++++++++-------- 3 files changed, 36 insertions(+), 26 deletions(-) mode change 100644 => 100755 get-xpipe.sh diff --git a/app/src/main/java/io/xpipe/app/core/AppFont.java b/app/src/main/java/io/xpipe/app/core/AppFont.java index 3ebc901fe..dd9827955 100644 --- a/app/src/main/java/io/xpipe/app/core/AppFont.java +++ b/app/src/main/java/io/xpipe/app/core/AppFont.java @@ -2,6 +2,7 @@ package io.xpipe.app.core; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; +import io.xpipe.core.process.OsType; import javafx.css.Size; import javafx.css.SizeUnits; import javafx.scene.Node; @@ -25,7 +26,7 @@ public class AppFont { } public static double getPixelSize(int off) { - var baseSize = AppPrefs.get() != null ? AppPrefs.get().fontSize.getValue() : 12; + var baseSize = OsType.getLocal() == OsType.LINUX ? 11 : 12; return new Size(baseSize + off, SizeUnits.PT).pixels(); } @@ -54,7 +55,8 @@ public class AppFont { return; } - var baseSize = AppPrefs.get() != null ? AppPrefs.get().fontSize.getValue() : 12; + // Somehow the font is bigger on Linux + var baseSize = OsType.getLocal() == OsType.LINUX ? 11 : 12; node.setStyle(node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;"); } diff --git a/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java b/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java index f66469dce..863150576 100644 --- a/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java +++ b/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java @@ -98,9 +98,6 @@ public class AppPrefs { public final ReadOnlyBooleanProperty useSystemFont = useSystemFontInternal; private final IntegerProperty tooltipDelayInternal = typed(new SimpleIntegerProperty(1000), Integer.class); - private final IntegerProperty fontSizeInternal = typed(new SimpleIntegerProperty(12), Integer.class); - public final ReadOnlyIntegerProperty fontSize = fontSizeInternal; - private final BooleanProperty saveWindowLocationInternal = typed(new SimpleBooleanProperty(false), Boolean.class); public final ReadOnlyBooleanProperty saveWindowLocation = saveWindowLocationInternal; diff --git a/get-xpipe.sh b/get-xpipe.sh old mode 100644 new mode 100755 index 161a4b227..5d4780a30 --- a/get-xpipe.sh +++ b/get-xpipe.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash release_url() { - if [[ $# -eq 0 ]] ; then - echo "https://github.com/xpipe-io/xpipe/releases/latest/download" + local repo="$1" + local version="$2" + if [[ -z "$version" ]] ; then + echo "$repo/releases/latest/download" else - local version="$1" - echo "https://github.com/xpipe-io/xpipe/releases/download/$version" + echo "$repo/releases/download/$version" fi } @@ -31,15 +32,12 @@ get_file_ending() { download_release_from_repo() { local os_info="$1" local tmpdir="$2" + local repo="$3" + local version="$4" + local ending=$(get_file_ending) local arch="$(uname -m)" - local release_url - - if [[ $# -eq 3 ]] ; then - release_url=$(release_url "$3") - else - release_url=$(release_url) - fi + local release_url=$(release_url "$repo" "$version") local filename="xpipe-installer-$os_info-$arch.$ending" local download_file="$tmpdir/$filename" @@ -158,11 +156,9 @@ download_release() { # store the downloaded archive in a temporary directory local download_dir="$(mktemp -d)" - if [[ $# -eq 1 ]] ; then - download_release_from_repo "$os_info" "$download_dir" "$1" - else - download_release_from_repo "$os_info" "$download_dir" - fi + local repo="$1" + local version="$2" + download_release_from_repo "$os_info" "$download_dir" "$repo" "$version" } check_architecture() { @@ -190,12 +186,27 @@ return 0 2>/dev/null check_architecture "$(uname -m)" || exit 1 +repo="https://github.com/xpipe-io/xpipe" +version= +while getopts 'sv:' OPTION; do + case "$OPTION" in + s) + repo="https://github.com/xpipe-io/xpipe_staging" + ;; + + v) + version="$OPTARG" + ;; + + ?) + echo "Usage: $(basename $0) [-s] [-v ]" + exit 1 + ;; + esac +done + download_archive="$( - if [[ $# -eq 1 ]] ; then - download_release "$1" - else - download_release - fi + download_release "$repo" "$version" exit "$?" )" exit_status="$?"