Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions pkgs/tools/games/scarab/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
lib,
bc,
buildDotnetModule,
fetchFromGitHub,
glibc,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing these is good if they aren't needed, but I think it should be a separate commit from the wrapper, in case we need to bisect/revert.

zlib,
gtk3,
copyDesktopItems,
icoutils,
wrapGAppsHook3,
makeDesktopItem,
}:

Expand All @@ -34,19 +31,12 @@ buildDotnetModule rec {
'';

runtimeDeps = [
glibc
zlib
gtk3
];

buildInputs = [
gtk3
bc
];

nativeBuildInputs = [
copyDesktopItems
icoutils
wrapGAppsHook3
];

doCheck = true;
Expand All @@ -60,6 +50,8 @@ buildDotnetModule rec {
size=''${sizes[$i]}x''${sizes[$i]}
install -D omegamaggotprime_''$((i+1))_''${size}x32.png $out/share/icons/hicolor/$size/apps/scarab.png
done

wrapProgram "$out/bin/Scarab" --run '. ${./scaling-settings.bash}'
'';

desktopItems = [
Expand Down
24 changes: 24 additions & 0 deletions pkgs/tools/games/scarab/scaling-settings.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Keep existing value if it is already non-empty
if [[ -z "${AVALONIA_GLOBAL_SCALE_FACTOR-}" ]] && command -v gsettings >/dev/null; then
echo 'Attempting to get GNOME desktop interface scaling factor' >&2
AVALONIA_GLOBAL_SCALE_FACTOR="$(gsettings get org.gnome.desktop.interface scaling-factor)"
AVALONIA_GLOBAL_SCALE_FACTOR="${AVALONIA_GLOBAL_SCALE_FACTOR##* }"
fi

if [[ "${AVALONIA_GLOBAL_SCALE_FACTOR-}" == "0" ]]; then
echo 'Unset invalid scaling value' >&2
unset AVALONIA_GLOBAL_SCALE_FACTOR
fi

if [[ -z "${AVALONIA_GLOBAL_SCALE_FACTOR-}" ]] && command -v xrdb >/dev/null; then
echo 'Attempting to get scaling factor from X FreeType DPI setting' >&2
dpi="$(xrdb -get Xft.dpi)"
if [[ -n "${dpi}" ]]; then
AVALONIA_GLOBAL_SCALE_FACTOR=$(echo "scale=2; ${dpi}/96" | bc)
fi
fi

if [[ -n "${AVALONIA_GLOBAL_SCALE_FACTOR-}" ]]; then
echo "Applying scale factor: ${AVALONIA_GLOBAL_SCALE_FACTOR}" >&2
export AVALONIA_GLOBAL_SCALE_FACTOR
fi