Automate Nvidia TwinWiew on HDMI insert

I keep repeating same actions every day, sometimes more than once, when I want to watch a movie from laptop to TV:
  1. Insert HDMI cable
  2. start nvidia-settings by clicking launcher icon
  3. click a few times inside x11/nvidia-settings in order to get extended desktop on my TV
  4. type xset s off in console (as multimedia/vlc does not prevent screen from blanking)

Later on, when I want to unplug TV and restore screensaver I need to:
  • start nvidia-settings by clicking launcher icon
  • click a few times inside x11/nvidia-settings in order to set single screen
  • type xset s on in console
  • Remove HDMI cable

While for now I know I can't automate inserting and removal of HDMI cable, I think it is possible to automate the software part (autosetting extended desktop and disabling screensaver on HDMI insert, reverting to single screen and enabling screensaver on HDMI removal).

Anyone willing to point me in the right direction, or - even better - paste the script?
 
Running ~/disper/src/disper.py dumps python2.7.core.
Running gdb /usr/local/bin/python2.7 python2.7.core ends with:
Code:
#0  0x0000000804c6b5a8 in XQueryExtension () from /usr/local/lib/libX11.so.6
[New Thread 801407400 (LWP 100390/python2.7)]
This is 9.1-RELEASE-p3 amd64, video card is Nvidia GeForce 425M, all freshly compiled ports.
 
For me it works well:
Code:
[CMD]# python2.7 disper.py[/CMD]
Usage: disper.py [options] (-l|-s|-c|-e|-p|-i)

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -v, --verbose         show what's happening
  -q, --quiet           be quiet and only show errors
  -r RESOLUTION, --resolution=RESOLUTION
                        set resolution, e.g. "800x600", or "auto" to detect
                        the display's preferred resolution, "max" to use the
                        maximum resolution advertised, or "off" to disable the
                        display entirely. For extend it is possible to enter a
                        single resolution for all displays or a comma-
                        separated list of resolutions (one for each display).
                        Beware that many displays advertise resolutions they
                        can not fully show, so "max" is not advised.
  -d DISPLAYS, --displays=DISPLAYS
                        comma-separated list of displays to operate on, or
                        "auto" to detect; the first is the primary display.
  -t DIRECTION, --direction=DIRECTION
                        where to extend displays: "left", "right", "top", or
                        "bottom"
  --scaling=SCALING     flat-panel scaling mode: "default", "native",
                        "scaled", "centered", or "aspect-scaled"
  --plugins=PLUGINS     comma-separated list of plugins to enable. Special
                        names: "user" for all user plugins in
                        ~/.config/disper/hooks; "all" for all plugins found;
                        "none" for no plugins.
  --cycle-stages=CYCLE_STAGES
                        colon-separated list command-line arguments to cycle
                        through; "-S:-c:-s" by default

  Actions:
    Select exactly one of the following actions

    -l, --list          list the attached displays
    -s, --single        only enable the primary display
    -S, --secondary     only enable the secondary display
    -c, --clone         clone displays
    -e, --extend        extend displays
    -p, --export        export current settings to standard output
    -i, --import        import current settings from standard input
    -C, --cycle         cycle through the list of cycle stages

pacija said:
Running ~/disper/src/disper.py dumps python2.7.core.
Running gdb /usr/local/bin/python2.7 python2.7.core ends with:
Code:
#0  0x0000000804c6b5a8 in XQueryExtension () from /usr/local/lib/libX11.so.6
[New Thread 801407400 (LWP 100390/python2.7)]
This is 9.1-RELEASE-p3 amd64, video card is Nvidia GeForce 425M, all freshly compiled ports.

For the backtrace gives useful information, you need to build with debug symbols lang/python27 and x11/libX11.

# make WITH_DEBUG=yes install clean
 
Back
Top