Quantcast
Channel: linux – Carlos García Argos
Viewing all articles
Browse latest Browse all 9

Switching between screen inputs without a switch

$
0
0

At my office I have two computers: a Linux desktop and a laptop running Linux and Windows. I have a dock station for the laptop, plugged to the two screens that I also use with the desktop computer, in alternate inputs (DVI/VGA). Changing the inputs in these screens is a bit of a hassle, because they are not the “one-click-switch” type. I need to go into the menus and browse through the options.

As I have enough with changing the USB connectors for the mouse and the keyboard, I found out a “hack” to disable the video output of the desktop. This way, when I turn on the laptop the two screens automatically search for the next available input.

The trick consists in using FrameBuffer suspend mode, manipulating the contents of /sys/class/graphics/fb0/blank. I use these two scripts:

screen_on.sh


#!/bin/sh
echo 0 > /sys/class/graphics/fb0/blank

screen_off.sh


#!/bin/sh
echo 1 > /sys/class/graphics/fb0/blank

I left them in my home directory: /home/user/bin/

Since writing to /sys/class/graphics/fb0/blank requires root permissions, I edited /etc/sudoers and added the following two lines:


usuario ALL=(root) NOPASSWD: /home/usuario/bin/screen_off.sh
usuario ALL=(root) NOPASSWD: /home/usuario/bin/screen_on.sh

The last step is to add two key bindings in KDE:

  1. Create a new group, named “Screen”.
  2. Create two new bindings: “On” y “Off”.
  3. I assigned two keys I never used in my keyboard (this one has multiple media shortcuts, mail, home, etc.). You can also use combinations such as “Ctrl+Alt+whatever“.
  4. In “Action”, just enter the path to the scripts using sudo::
    sudo /home/user/bin/screen_off.sh
    sudo /home/user/bin/screen_on.sh
keybinding

This is working in Debian Wheezy with a dedicated graphics card.


Viewing all articles
Browse latest Browse all 9

Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Trending Articles


Ang Nobela sa “From Darna to ZsaZsa Zaturnnah: Desire and Fantasy, Essays on...


Lola Bunny para colorear


Dino Rey para colorear


Girasoles para colorear


Dibujos de animales para imprimir


Renos para colorear


Dromedario para colorear


The business quotes | Inspirational and Motivational Quotes for you


Love Quotes Tagalog


RE: Mutton Pies (mely)


Gwapo Quotes : Babaero Quotes


Kung Fu Panda para colorear


Libros para colorear


Mandalas de flores para colorear


Dibujos para colorear de perros


Toro para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Long Distance Relationship Tagalog Love Quotes


Tropa Quotes


Mga Tala sa “Unang Siglo ng Nobela sa Filipinas” (2009) ni Virgilio S. Almario





Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC