Recipes - alex-courtis/way-displays GitHub Wiki
I'm using rofi (wiki), together with a customized rust program driving the interactive menu, displayed by rofi.
- I wrote this script using the example from i3_switch_workspace.sh
- It is relatively straight-forward to include other shortcuts to configure the display
- rofi has various themes, I included a screenshot of the default theme
#!/bin/sh
# Configure names of external and internal displays
EXTERNAL="HDMI-A-1"
INTERNAL="eDP-1"
function show() {
way-displays --delete DISABLED "$1" > /dev/null
}
function hide() {
way-displays -s DISABLED "$1" > /dev/null
}
OPT_INTERNAL="Internal display"
OPT_EXTERNAL="External display"
OPT_BOTH="Both displays"
function menu() {
echo "${OPT_INTERNAL}"
echo "${OPT_EXTERNAL}"
echo "${OPT_BOTH}"
}
OPTION=$( (menu) | rofi -dmenu -p "Configure displays")
# Invoke way-displays. Only hide a display if showing the other display
# succeeded. This reduces the chances to end up with both displays turned off,
# which is typically rather inconvenient.
if [ "${OPTION}" == "${OPT_INTERNAL}" ]
then
show "${INTERNAL}" && hide "${EXTERNAL}"
elif [ "${OPTION}" == "${OPT_EXTERNAL}" ]
then
show "${EXTERNAL}" && hide "${INTERNAL}"
elif [ "${OPTION}" == "${OPT_BOTH}" ]
then
show "${EXTERNAL}"
show "${INTERNAL}"
fi
X11 Applications And Games Are Blurry
Gamescope can be used to start an Xwayland session for an individual application, which will be rendered at 1:1 pixels.
This wrapper may be used to launch an X11 application at the first display's native resolution. Requires yq.
script: gamescope-run-native
#!/bin/bash
set -o pipefail
# fetch the first display
if ! VARS="$(way-displays -y -g | yq '.STATE.HEADS[0] | "NAME=\"" + .NAME + "\" DESCRIPTION=\"" + .DESCRIPTION + "\" WIDTH=" + .CURRENT.MODE.WIDTH + " HEIGHT=" + .CURRENT.MODE.HEIGHT')"; then
exit 1
fi
# extract info
eval "${VARS}"
printf "name: %s\ndesc: %s\nwidth: %d\nheight: %d\n" "${NAME}" "${DESCRIPTION}" "${WIDTH}" "${HEIGHT}"
# launch arguments with gamescope
gamescope \
--prefer-output "${NAME}" \
--output-width "${WIDTH}" --output-height "${HEIGHT}" \
--nested-width "${WIDTH}" --nested-height "${HEIGHT}" \
--adaptive-sync \
"${@}"
Omit -output-width
and --output-height
in the event of "source rectangle out of buffer bounds" and repeated "source rectangle out of buffer bounds" failures.
Adaptive sync may not function unless running gamescope as a tty session: https://github.com/ValveSoftware/gamescope/issues/975
gamescope-run-native -- glxgears -fullscreen
Using 2 xwayland instances allows the steam window itself to be resized.
gamescope-run-native --xwayland-count 2 --steam -- steam
Launch Options Command: mangohud gamescope-run-native --fullscreen -- %command%
For reference, the steam deck uses the following to launch steam:
ps
gamescope \
--generate-drm-mode fixed \
--xwayland-count 2 \
-w 1280 -h 800 \
--default-touch-mode 4 \
--hide-cursor-delay 3000 \
--max-scale 2 \
--fade-out-duration 200 \
-e \
-R /run/user/1000/gamescope.1zn7D7r/startup.socket \
-T /run/user/1000/gamescope.1zn7D7r/stats.pipe \
-O *,eDP-1 \
--cursor-hotspot 5,3 \
--cursor /usr/share/steamos/steamos-cursor.png