https://github.com/andis-sprinkis/swayscale
Per-application display scaling on Linux using the Sway WM instances
https://github.com/andis-sprinkis/swayscale
display dpi font-resolution forced-scaling linux per-application-scaling resolution scaling sway wayland wlroots x11
Last synced: 24 days ago
JSON representation
Per-application display scaling on Linux using the Sway WM instances
- Host: GitHub
- URL: https://github.com/andis-sprinkis/swayscale
- Owner: andis-sprinkis
- License: mit
- Created: 2024-12-05T21:19:27.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-20T15:31:43.000Z (over 1 year ago)
- Last Synced: 2025-06-14T09:06:38.979Z (12 months ago)
- Topics: display, dpi, font-resolution, forced-scaling, linux, per-application-scaling, resolution, scaling, sway, wayland, wlroots, x11
- Language: Shell
- Homepage:
- Size: 64.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Per-application display scaling on Linux using the Sway WM instances
A demonstration of a bit hacky, but simple method for getting **per-application display scaling** on Linux desktop.
Purpose of this is to better display the user interfaces of older applications, that do not normally scale up to the modern screen resolutions and therefore appear tiny.
It is done by containing the target application windows in a [Sway window manager](https://swaywm.org/) instance virtual display window, with a custom output scale applied.
**Running Sway as the host graphical environment is not required.** Sway can be launched in a window under X11 and Wayland. This is why I think this solution should work OK in most Linux GUI environments.
This repository is not a library, so just copy and modify these files to suit your needs.
## Usage
To launch application `ddd` at the display output scale multiplied by `1.25`:
```sh
swayscale "1.25" "ddd"
```
## Setup
1. Install `sway`, `xorg-xwayland`.
1. Copy the repository files under the respective locations in your `$HOME` directory.
```sh
git clone "https://github.com/andis-sprinkis/swayscale"
cd "./swayscale"
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/sway" "$HOME/.local/bin"
cp ".local/bin/swayscale" "$HOME/.local/bin/swayscale"
cp ".config/sway/custom_scale" "${XDG_CONFIG_HOME:-$HOME/.config}/sway/custom_scale"
chmod +x "$HOME/.local/bin/swayscale"
```
1. Ensure that the directory path `$HOME/.local/bin/` is in the `$PATH` variable.
Add the line to `.profile` / `.bash_profile` / `.zshenv` and re-login:
```sh
export PATH="$HOME/.local/bin:$PATH"
```
You may have to update `font sans-serif medium` in the `exec` line at the bottom of `.config/sway/custom_scale` to a font identifier that actually exists on the system (run `fc-list`).
## Desktop files
To launch the upscaled application from the application launcher of a Linux desktop environment, a Desktop file can be created in `${XDG_DATA_HOME:-$HOME/.local/share}/applications/` directory.
See the example [`ddd_upscaled.desktop`](./.local/share/applications/ddd_upscaled.desktop) file.
Related specifications: ["Desktop Entry Specification"](https://specifications.freedesktop.org/desktop-entry-spec/latest/), ["Association between MIME types and applications"](https://specifications.freedesktop.org/mime-apps-spec/latest/).