apache / apache/netbeans

Don't override GDK_SCALE if already set

Open
#6,185 0 comments 1 reaction 0 assignees View on GitHub
kind:feature os:linux UI
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Description

Currently Netbeans does GDK_SCALE=2 if a DPI above 192 is detected. On my system, this leads to really large fonts and windows. I have set GDK_SCALE=1 which makes the size of NetBeans equal to all other gui components in size (Using Gnome 44 desktop on Arch).

What I have in mind in the /usr/bin/netbeans shell script:

```shell
# First check if GDB_SCALE was set. If the xrdb command does not exist, no action will be taken.
if [ -n "$GDK_SCALE" ];
then
echo "GDK_SCALE was set, not overriding: GDK_SCALE=$GDK_SCALE"
elif [ "`command xrdb -query 2> /dev/null | grep Xft.dpi | cut -d ':' -f2 | xargs`" = 192 ]
then
echo "Detected 2x HiDPI scaling in Xft.dpi setting; setting GDK_SCALE=2"
export GDK_SCALE=2
fi
```

### Use case/motivation

This change allows you to pre-configure a local preference, without forcefully overriding GDK_SCALE.

### Related issues

https://github.com/apache/netbeans/pull/3113

### Are you willing to submit a pull request?

Yes

Contributor guide

Open the contributing guide

Research direction

Start with the /usr/bin/netbeans shell script and inspect the existing GDK_SCALE assignment and xrdb-based DPI detection. Verify that an existing GDK_SCALE value is preserved, automatic scaling still occurs when it is unset, and the script remains valid with or without xrdb.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
desktop
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.