11

I have a Laptop with multiple outputs and use an external monitor pretty often. If I want to activate it, I have to go to system menu --> Displays and activate the external display. After using, I need to deactivate it with the same menu.

In Windows, I could do the same by simply pressing Win+P (Meta+P). Is there any hotkey or other way to achieve this behaviour in Unity (Ubuntu 11.04/11.10)? On a side-note, my laptop does have a button to switch output modes, but does not work (just opens the unity menu bar - I suspect it's a shortcut for Meta+P internally).

Addendum: The Laptop in question is a Dell Studio XPS 1640.

Addendum 2: I've did some more research. xev gives me the following statement when pressing the "change CRT/LCD"-Button:

KeymapNotify event, serial 33, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

In tty1, the command showkey gives me the following output:

key 125 pressed
key  25 pressed
key  25 released
key 125 released
key  28 pressed

Alternative output via showkey -s:

0xe0 0x5b 0x19 0x99 0xe0 0xdb
0x1c

The last line takes a second to show - I guess it refers to the enter-key. A quick look into dumpkeys|grep ^keycode reveals 125=ALT and 25=p. Looking in /lib/udev/keymaps/dell, the code for switching the video mode is set to 0x9B:

0x9B switchvideomode # Display Toggle button

Now, from what I see, the display-button is not mapped to a single key but to a key burst... any idea how to tackle the problem further is greatly appreciated.

3

If you have a Fn key on your keyboard, chances are good that some of the remotely intelligible glyphs in the same distinct color as the 'Fn' key already accomplish what you seek for, you'll just have to hold Fn and press F10.

For this to work, your laptop vendor must have its entry at /lib/udev/keymaps and udev must correctly detect your keyboard type.

For example, doing a grep -r switchvideomode there yields:


./module-lenovo:0x6 switchvideomode # Fn+F7
./acer:0xA9 switchvideomode # Fn+F5
./samsung-other:0x82 switchvideomode # Fn+F4 CRT/LCD (high keycode: "displaytoggle")
./fujitsu-amilo_pro_edition_v3505:0xA9 switchvideomode # Fn-F3
./fujitsu-esprimo_mobile_v5:0xA9 switchvideomode
./module-sony-vgn:0x11 switchvideomode # Fn+F7
./module-sony:0x0B switchvideomode # Fn+F7
./dell:0x8B switchvideomode # Fn+F8 CRT/LCD (high keycode: "displaytoggle")
./dell:0x8F switchvideomode # Fn+F7 aspect ratio
./dell:0x9B switchvideomode # Display Toggle button
./olpc-xo:0x69 switchvideomode # Brightness key
./module-ibm:0x06 switchvideomode # Fn+F7
./oqo-model2:0xF0 switchvideomode
./onkyo:0xF5 switchvideomode # Fn+E
./lenovo-thinkpad-usb-keyboard-trackpoint:0x90016 switchvideomode # Fn+F7
./zepto-znote:0x93 switchvideomode    # Fn+F3 Toggle Video Output
./ibm-thinkpad-usb-keyboard-trackpoint:0x900f2 switchvideomode
./fujitsu-amilo_pro_v3205:0xF7 switchvideomode # Fn+F3
./lenovo-3000:0x8B switchvideomode # Fn+F7 video
./hewlett-packard:0xEE switchvideomode # FnF4

Otherwise, you can write your own taking the nearest match as a template and maybe submit it to canonical's laptop testers for inclusion.

1
  • Thanks for the answer, but none of the Fn+XXX combinations did work in this case. I'll add my model to the question for clarification though.
    – Lars
    Sep 23 '11 at 15:17
3

Not sure if it's the same in Ubuntu, but in Debian KDE it goes like this:

System Settings -> Shortcuts & Gestures -> Global Keyboard Shortcuts -> KDE Daemon (from drop down list) -> Switch Display - map to Win + P or whatever you want.

1
  • Works like a charm on Kubuntu 16.04! Fixes the monitor switching hell I've had for a few months. Thanks @mrlynch Nov 28 '16 at 20:07
1

You can probably get your fn + display key to work if you boot with

acpi_osi=Linux

or

acpi_osi='Windows 2006'

Your BIOS probably thinks that you're running Windows 7, so it maps your fn + display key to Windows + P. With the above kernel parameter, you can tell the BIOS that you're running Linux or Windows Vista (which doesn't support Windows + P) and it hopefully won't map to Windows + P.

To do this, when you turn on your computer, press E. You will see a screen like this:

grub2

Press the down arrow until you reach the line that begins with "linux" then press the End key to put the cursor at the end of the line. Then type in either of the above parameters (not both).

If that works, then you can change the following line in /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi='The one you chose'"
1
  • Thanks for the suggestion - unfortunatly, it did not change the behaviour.
    – Lars
    Sep 23 '11 at 15:18
1

Long time no see.

With Ubuntu 13.10, the normal Switch Display button of my Dell Studio XPS 1640 does work out of the box, although some weird behaviour happens with the Keys sent by this command (e.g. a lot of enter keys and being unable to use the main system menu in the right upper corner).

Another solution I found is to map a key (e.g. Win+P) to xrandr --auto in the keyboard shortcuts of the system settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.