amir1376 / amir1376/ab-download-manager

Suggestion: app scaling fix for wayland

Open
#1,327 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
17.9k
Forks
913
Avg merge
7h 1m
Merged PRs (30d)
7

Description

## Description

On Linux under a Wayland session, AB Download Manager appears to run through XWayland and does not follow the desktop’s configured display scaling. As a result, the UI appears significantly smaller than expected on HiDPI displays.

In my testing, `-Dsun.java2d.uiScale` did not change the application’s UI scale. This may be because the Compose/Skiko rendering path does not use the standard Java2D UI-scaling mechanism.

## Workaround

Launching the app with an appropriate combination of `GDK_SCALE` and `GDK_DPI_SCALE` produces correct scaling:

```bash
env GDK_SCALE= GDK_DPI_SCALE= "$HOME/.local/ABDownloadManager/bin/ABDownloadManager"
```

For my display configuration, the following values produce a scaled app on par with the Windows version:

```bash
env GDK_SCALE=2 GDK_DPI_SCALE=1 \
"$HOME/.local/ABDownloadManager/bin/ABDownloadManager"
```

## Suggested improvements

Possible solutions could include:

- Automatically following the effective desktop or monitor scale on Linux.
- Improving scale detection and handling under XWayland.
- Supporting native Wayland when supported by the bundled runtime and Compose/Skiko versions, allowing the compositor to provide per-monitor scaling.
- Providing a documented and persistent Linux-specific UI-scale override.

As a secondary improvement, the installation/update script could preserve user modifications to the `.desktop` file or provide a supported location for custom environment variables.

## Replicating the workaround

### 1. Find suitable scaling values

Fully quit the, then test different values. For example:

```bash
env GDK_SCALE=1 GDK_DPI_SCALE=1.5 "$HOME/.local/ABDownloadManager/bin/ABDownloadManager"
```

> The app must be fully terminated—including its tray/background process—before testing another scaling combination. Otherwise, a new command may only activate the existing process, which retains its original environment.

### 2. Create a wrapper script

For example, save the following as:

```text
~/.local/bin/abdownloadmanager-scaled
```

```sh
#!/bin/sh
export GDK_SCALE=2
export GDK_DPI_SCALE=1
exec "$HOME/.local/ABDownloadManager/bin/ABDownloadManager" "$@"
```

Make it executable:

```bash
chmod +x "$HOME/.local/bin/abdownloadmanager-scaled"
```

### 3. Update the desktop entry

Edit:

```text
~/.local/share/applications/com.abdownloadmanager.desktop
```

Change its `Exec=` line to point to the wrapper script, using an absolute path:

```ini
Exec=/home/USERNAME/.local/bin/abdownloadmanager-scaled
```

> Replace `USERNAME` with your actual username.

## Environment

- **OS:** Ubuntu 26.04
- **Session type:** Wayland
- **Installation method:** Installation script
- **Version:** 1.9.2

----

I opened a new issue because the following search did not return a relevant open report:

```text
is:issue state:open wayland AND (dpi OR scale OR hidpi)
```

Please mark this as a duplicate if I missed an existing issue.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing on Linux Wayland with the installed ABDownloadManager launcher and the GDK_SCALE/GDK_DPI_SCALE workaround from the issue. Then inspect the Linux launch/installation path, especially how the desktop entry and environment are created. Done means the app has a supported way to scale correctly on Wayland/HiDPI or persist a Linux-specific scale override.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, linux, shell
Domain
desktop, desktop-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.