Skip to content

Commit

Permalink
scarab: Apply scaling factor in Wayland
Browse files Browse the repository at this point in the history
Sets `AVALONIA_GLOBAL_SCALE_FACTOR` to the GNOME desktop scaling factor
based on
<AvaloniaUI/Avalonia#9390 (comment)>.
  • Loading branch information
l0b0 committed Oct 14, 2024
1 parent b1ea4a3 commit f8e3b37
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkgs/tools/games/scarab/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
lib,
buildDotnetModule,
fetchFromGitHub,
glib,
glibc,
zlib,
gtk3,
copyDesktopItems,
icoutils,
wrapGAppsHook3,
writeText,
makeDesktopItem,
}:

Expand Down Expand Up @@ -51,6 +53,12 @@ buildDotnetModule rec {

doCheck = true;

scalingSettings = writeText "scalingSettings" ''
AVALONIA_GLOBAL_SCALE_FACTOR="$(${glib}/bin/gsettings get org.gnome.desktop.interface scaling-factor | cut --delimiter=' ' --fields=2)"
AVALONIA_GLOBAL_SCALE_FACTOR="''${AVALONIA_GLOBAL_SCALE_FACTOR:-1}"
export AVALONIA_GLOBAL_SCALE_FACTOR
'';

postFixup = ''
# Icons for the desktop file
icotool -x $src/Scarab/Assets/omegamaggotprime.ico
Expand All @@ -60,6 +68,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 '. ${scalingSettings}'
'';

desktopItems = [
Expand Down

0 comments on commit f8e3b37

Please sign in to comment.