Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 13031  / 2 Years ago, mon, january 10, 2022, 3:51:25

How to use shortcuts to switch between displays in LXDE?
I mean to switch between the laptop monitor and an external display.



I edited /home/user/.config/openbox/lubuntu-rc.xml file to set shortcuts but how to do it for this specific purpose?


More From » display

 Answers
6

The idea is to use xrandr commands. But how to find the proper commands?



I have found a simple solution as a result of this answer.



Simpler, because involves using the LXDE default display manager, LXRandr, without the need of scripts.



It can save configurations (which are xrandr configurations).



enter image description here



When it saves the present configuration the older one is overwritten. But finding them and using them as shortcuts is a nice way to achieve what we want here.



The save is in ~/.config/autostart/lxrandr-autostart.desktop.



The file looks like



[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR
Exec=xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --off
OnlyShowIn=LXDE


So, to save a certain configuration, open that file in a text editor like gedit




gedit ~/.config/autostart/lxrandr-autostart.desktop




and save the line after Exec=, which is a command to be run with a shortkey.



Creating shortcuts in LXDE is presented in the other answer, that is by editing the file ~/.config/openbox/lubuntu-rc.xml.



For example, in order to run the command above with the shortkey Ctrl-M , the edit should be like so:



<!-- Internal monitor only -->
<keybind key="C-m">
<action name="Execute">
<command>xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --off</command>
</action>
</keybind>


For each computer and its specific internal+external display there should be three basic configurations (internal display only, external only, and both on); and others more only in case of various resolution settings for each of these three.






I found here that in order to have extended monitor (which is outside the capabilities of LXRandr) the command should be something like



xrandr --output VGA-0 --auto --left-of LVDS


(VGA-0 and LDTS are variables, look in ~/.config/autostart/lxrandr-autostart.desktop to see what you have, or run xrandr -q.)


[#36952] Monday, January 10, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
issfullus

Total Points: 264
Total Questions: 126
Total Answers: 107

Location: Comoros
Member since Mon, Dec 19, 2022
1 Year ago
;