You are not logged in.

#1 2017-07-07 20:26:25

emptyz
New Member
Registered: 2017-07-07
Posts: 3

xrandr/arandr and external monitor

Hello everyone!

Is there any way to create keybind/menu item that checks if there is an monitor connected to the HDMI port and then executes script? Or is it possible to have many different action entries for a keybind? (Like in windows laptops there are fn+projector button for switching different monitor modes if there is many monitors.)

Also i have some issues with the xrandr monitor switching. Sometimes the cursor disappears after doing monitor switch (like: "xrandr --output eDP --off --output HDMI-0 --auto --primary") and sometimes the screen goes messy and i have to reboot my laptop to restore it.

Anybody got any good ideas how to make using external monitor easier? (I like to watch movies from my televisions HDMI.)

Offline

#2 2017-07-07 20:54:02

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: xrandr/arandr and external monitor

It is very easy to create a keybind or menu item to run a script. The tricky bit is writing the script wink (Lots of hits if you google with eg  "linux check if monitor connected to hdmi")

Keybinds are in '~/.config/openbox/rc.xml', and the menu is in '~/.config/openbox/menu.xml'

Menu -> Help & Resources -> Openbox

Did you read Introduction to the BunsenLabs Desktop?

Last edited by damo (2017-07-07 20:57:17)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2017-07-07 21:03:03

emptyz
New Member
Registered: 2017-07-07
Posts: 3

Re: xrandr/arandr and external monitor

Yeah i already made some scripts and menu items.

Like:

             <menu id="screenChanger" label="NÄYTTÖ">
            <item label="Tv off">
                <action name="Execute">
                    <command>
                        xrandr --output HDMI-0 --off
                    </command>
                </action>
            </item>
            <item label="Tv off">
                <action name="Execute">
                    <command>
                        xrandr --output HDMI-0 --auto
                    </command>
                </action>
            </item>
            <separator/>
                        <item label="Laptop on">
                <action name="Execute">
                    <command>
                        xrandr --output eDP --auto
                    </command>
                </action>
            </item>
                        <item label="Laptop off">
                <action name="Execute">
                    <command>
                        xrandr --output eDP --off
                    </command>
                </action>
            </item>
        </menu>

But is there any way to have one button for laptop and one button for tv screen? That runs command and greps something and has "if else" to to run the command?


E: I managed to do script to check if the monitor is connected. But is there an way to check if the screen is not "--off"? Also the issue with the cursor is a bit weird. If i set my laptops screen --off and use only external screen, the mouse cursor disappears. I can see it hovering over links etc.


E: I actually found this shell script from here: https://wiki.archlinux.org/index.php/xrandr (example 3) It works, but the mouse cursor always disappears which is pretty weird.

Last edited by emptyz (2017-07-07 21:42:02)

Offline

#4 2017-07-07 21:44:02

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: xrandr/arandr and external monitor

emptyz wrote:

...

But is there any way to have one button for laptop and one button for tv screen? That runs command and greps something and has "if else" to to run the command?

...

Like I said, set keybinds in rc.xml to run scripts containing the tests and commands you want.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#5 2017-07-07 21:45:22

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: xrandr/arandr and external monitor

emptyz wrote:

...

E: I actually found this shell script from here: https://wiki.archlinux.org/index.php/xrandr (example 3) It works, but the mouse cursor always disappears which is pretty weird.

Do you need to restart the compositor?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#6 2017-07-07 22:20:19

emptyz
New Member
Registered: 2017-07-07
Posts: 3

Re: xrandr/arandr and external monitor

damo wrote:
emptyz wrote:

...

E: I actually found this shell script from here: https://wiki.archlinux.org/index.php/xrandr (example 3) It works, but the mouse cursor always disappears which is pretty weird.

Do you need to restart the compositor?

I tried openbox --restart and compositor restart, didn't help.

Offline

#7 2017-07-07 22:23:25

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: xrandr/arandr and external monitor

^ There is an old *buntu bug that keeps coming back from the dead, it may be related:

https://bugs.launchpad.net/ubuntu/+sour … bug/492782

Offline

Board footer

Powered by FluxBB