-
Notifications
You must be signed in to change notification settings - Fork 6
/
resolution
executable file
·26 lines (19 loc) · 1 KB
/
resolution
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
# Display name (as reported by `xrandr`).
display="DP-0"
# Default screen resolution.
screen_width="3440"
screen_height="1440"
if [ "$#" -ne 2 ]; then
echo "Resetting ${display} screen resolution to ${screen_width}x${screen_height}."
/usr/bin/nvidia-settings --assign "CurrentMetaMode=${display}: nvidia-auto-select @${screen_width}x${screen_height} +0+0 {ViewPortIn=${screen_width}x${screen_height}, ViewPortOut=${screen_width}x${screen_height}+0+0}"
exit 0
fi
new_width="$1"
new_height="$2"
padding_width=$(((screen_width - new_width) / 2))
padding_height=$(((screen_height - new_height) / 2))
echo "Original screen resolution: ${screen_width}x${screen_height}"
echo "New screen resolution: ${new_width}x${new_height}"
echo "Padding with ${padding_width}x${padding_height}"
/usr/bin/nvidia-settings --assign "CurrentMetaMode=${display}: nvidia-auto-select @${new_width}x${new_height} +0+0 {ViewPortIn=${new_width}x${new_height}, ViewPortOut=${new_width}x${new_height}+${padding_width}+${padding_height}}"