You are not logged in.

#1 2014-04-22 10:23:32

lucacerone
Member
From: Spain
Registered: 2012-05-04
Posts: 144
Website

Create profile for external monitors and shortcut to switch among them

Dear all,
on my laptop I use Arch Linux with MATE DE.

When I connect my laptop to an external monitor or projector (using HDMI):

1. the sound card does not automatically switch to use the HDMI and I have to set this manually;
2. I am unable to switch among different monitor configuration (e.g. redirect video to monitor only, duplicate the screen and so on)
-- this is due to the fact that the function keys on my laptop do not work properly (my laptop is a Samsung N345V, and I have had the
same issue with other linux distributions too--

However if I set things manually using "Sound preferences" and changing the configuration in "Monitors" everything works fine.

I have no idea where to start trying to fix these issues. Can you point me to some resources to define different profiles
(e.g. redirect video and audio to the external monitor, when using hdmi), and create a shortcut to switch among them?

Thanks a lot in advance for the help,
Luca

Offline

#2 2014-04-23 03:41:42

schnoopay
Member
From: USA
Registered: 2014-03-09
Posts: 22

Re: Create profile for external monitors and shortcut to switch among them

To make such a script you would use the xrandr command to change the screen and, if you're using pulseaudio, pacmd or pactl to change the default audio output. Something similar to this:

#!/bin/bash
xrandr --output LCDSCREEN --off
xrandr --output HDMISCREEN --auto
pactl set-default-sink HDMIAUDIO

Naturally you'd need to replace the all caps parts with the proper device names, and make a similar script to change back to the LCD. "xrandr -q" will give you the device names for the screen and "pactl list short sinks" would give you your audio device names.

I have no idea how to set a hotkey to execute the scripts using the MATE DE as I have no experience with it.

Offline

#3 2014-04-23 03:47:27

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Create profile for external monitors and shortcut to switch among them

schnoopay wrote:

I have no idea how to set a hotkey to execute the scripts using the MATE DE as I have no experience with it.

Stop depending on the DE to do everything for you and look into xbindkeys to handle keybindings smile


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#4 2014-04-23 07:58:20

lucacerone
Member
From: Spain
Registered: 2012-05-04
Posts: 144
Website

Re: Create profile for external monitors and shortcut to switch among them

Thanks Schnoopay and Inxsible smile
Unfortunately I no longer have a monitor available (I was home for vacation and have none where I live), so it will have to wait for a little bit.
Nevertheless I will go through the documentation for xrandr and xbindkeys to be prepared next time I am home!

Inxsible wrote:

Stop depending on the DE to do everything for you and look into xbindkeys to handle keybindings

You are totally right, I am an Arch newbie and while I am comfortable using the terminal I always relied on these GUI programs to set up my machine in the past.
If you could link me to a good guide (the wiki is done very well if you know what to look for, but I am looking for a good administration guide that is a bit more organic)
I would be more than happy to stop relying too much on the DE preferences smile

Thanks again for the help folks!

Offline

#5 2014-04-23 18:38:23

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Create profile for external monitors and shortcut to switch among them

Well the external monitors could be setup using xrandr
and the shortcuts can be setup using xbindkeys. So simply search for those terms in the wiki and you should be able to get to the information that you need.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#6 2014-04-23 22:08:40

lucacerone
Member
From: Spain
Registered: 2012-05-04
Posts: 144
Website

Re: Create profile for external monitors and shortcut to switch among them

Ahahah Inxsible, thanks I had figured that out smile
(I know I do silly questions, but I am not too dumb.. quite a bis yes, though)

I was wondering if you might advice me something more general than the wiki smile
I figure many of the things one need to know are more about Unix/Linux rather than Arch specific.
Maybe I can open an appropriate topic wink

I am sorry I am not able to fix the issue now, but I can mark the topic as solved if you prefer!

Thanks again for all the help!

Offline

#7 2014-04-24 03:42:37

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Create profile for external monitors and shortcut to switch among them

you can simply write a small script to use your projector as the monitor and set it a keybinding.

connect your projector and then run

xrandr

It will display all the connected monitors. Then in a bash script do something like

xrandr --auto --output DVI-0 --mode 1440x900

Make sure you use the correct name of the output name for the projector screen as obtained in the earlier output of xrandr. I am not sure what a projector will be listed as. Also make sure you use a resolution that is supported. If needed, you can switch off other monitors in the same script. Refer to

man xrandr

for more info

After that, make the script executable and put it somewhere in your $PATH. Assign a keybinding of your choice in xbindkeys* and profit.


*I will not go into detail about how to setup xbindkeys etc. since its already covered in the wiki.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#8 2014-04-24 07:41:20

lucacerone
Member
From: Spain
Registered: 2012-05-04
Posts: 144
Website

Re: Create profile for external monitors and shortcut to switch among them

Thanks Inxsible,
the fact is that at the moment I have neither a projector, nor a monitor to test smile
I posted when I was still at home for holidays, but now I left and won't be going back any time soon!
I'll keep this post in mind the next time I go back smile

Offline

Board footer

Powered by FluxBB