Looking for an elegant dual monitor auto-configure solution (SOLVED)

I am currently using XFCE becuase Gnome and KDE are both too heavy for my weak little laptop with intel onboard graphics.  The number one thing I miss is auto-detect and configuration when I plug or unplug my monitor.
I can't find anything that works automatically in an elegant way, the only thing I can do is poll the system every second.  There appears to be a way to make a udev rule but that is a little bit out of my depth.
My current solution is below, does anybody have a suggestion for something more elegant?  It would be awesome if there was something in the AUR.
#!/bin/bash
#inspired of:
# http://unix.stackexchange.com/questions/4489/a-tool-for-automatically-applying-randr-configuration-when-external-display-is-p
# http://ozlabs.org/~jk/docs/mergefb/
dmode="$(cat /sys/class/drm/card0-VGA-1/status)"
export DISPLAY=:0
export XAUTHORITY=~/.Xauthority
# actual script
while true
do
if [ "${dmode}" = disconnected ]; then
/usr/bin/xrandr --auto
elif [ "${dmode}" = connected ];then
/usr/bin/xrandr --output VGA1 --auto --right-of LVDS1
else /usr/bin/xrandr --auto
fi
sleep 1s
done
SOLVED using inotify see below and thanks for all the help
#!/bin/bash
#inspired of:
# http://unix.stackexchange.com/questions/4489/a-tool-for-automatically-applying-randr-configuration-when-external-display-is-p
# http://ozlabs.org/~jk/docs/mergefb/
# http://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes/181543#181543
export MONITOR2=/sys/class/drm/card0-VGA-1/status
while inotifywait -e modify,create,delete,open,close,close_write,access $MONITOR2;
dmode="$(cat $MONITOR2)"
do
if [ "${dmode}" = disconnected ]; then
/usr/bin/xrandr --auto
echo "${dmode}"
elif [ "${dmode}" = connected ];then
/usr/bin/xrandr --output VGA1 --auto --right-of LVDS1
echo "${dmode}"
else /usr/bin/xrandr --auto
echo "${dmode}"
fi
done
Last edited by originalsurfmex (2013-10-28 20:51:45)

Thanks very much for pointing me to inotify.  This is exactly the type of solution I was looking for!  I wasn't too excited about creating some udev tool.  Here is the script using inotify:
#!/bin/bash
#inspired of:
# http://unix.stackexchange.com/questions/4489/a-tool-for-automatically-applying-randr-configuration-when-external-display-is-p
# http://ozlabs.org/~jk/docs/mergefb/
# http://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes/181543#181543
export MONITOR2=/sys/class/drm/card0-VGA-1/status
while inotifywait -e modify,create,delete,open,close,close_write,access $MONITOR2;
dmode="$(cat $MONITOR2)"
do
if [ "${dmode}" = disconnected ]; then
/usr/bin/xrandr --auto
echo "${dmode}"
elif [ "${dmode}" = connected ];then
/usr/bin/xrandr --output VGA1 --auto --right-of LVDS1
echo "${dmode}"
else /usr/bin/xrandr --auto
echo "${dmode}"
fi
done
I am marking this as solved.  If you have more critique or suggestions I'd be open to improve the script.

Similar Messages

  • What to look for in an external monitor

    I am in the process of changing my editing system to handle hd. I am using a 24" imac 2.4 Intel Core 2 Duo. With my sd set up I used a Sony dv/dvcam deck and a JVC professional 13" Monitor. I am purchasing the new JVC gy-hm100u camcorder when it is released in April. I am somewhat confused about having an external monitor hooked up to my system for viewing my FCP projects. (1) What should I look for in the external monitor. Do I want a computer monitor or an HD TV? Once I purchase the external monitor/tv can I get rid of my SD JVC monitor all together. I don't want to spend a lot but I want to make sure I get a monitor with the right specs. (2) What happens if I want to use past dv footage in a new project shot in hd. I do a lot of corporate projects which require the use of old interviews as part of the new productions. Am I going to have an issue doing this? Thanks in advance for any help.
    Message was edited by: Erik Seel

    To view HD variants, you'll need a 3rd party card.
    You are severely limited with an iMac. Your only real choice is a Matrox MXO driving a 24" Dell or older 23" Apple Cinema Display.
    While you can use an AJA ioHD to drive a HDTV, you'll need to connect it via FW800. This is a problem as no other devices can be on the same bus and, since all firewire ports on an iMac are on the same bus, it won't work.
    I would not dispose of the Standard Def monitor. If you work with SD material, you'll still need it. HDtvs are lousy devices for monitoring SD.
    x

  • Looking for a way to monitor forums for a text string.

    Hi as the subject says I'm looking for a way to monitor various forums for a list of text strings and give me a link to the post. I'm have tried googling but cant find anything specific enough I've tried looking at methabot but am unsure as to if this is the right sort of program, anyone with any experience or ideas in this area would be much appreciated.
    thanks in advance.

    you could write a daemon method which would, every so often, search the forums for the keyword.
    Better yet, you can use google's "site: bbs.archlinux.org keyword format to do your search.
    But, be sure not to do it too often. If you keep banging a particular forum website too often, your ip might get banned.

  • Looking for a way to monitor continous queries

    Hi, I am looking for a way to monitor my continous query cache such that i do not expose coherence libraries to the calling programs. So i need an abstraction of the listener and the returned value(in this case the MapEvent) so that the calling program does not have any knowledge of coherence behind the hoods. So, i need to do this in java(using the likes of observer/event listener etc) Any help in this regard is appreciated. Thanks.

    you could write a daemon method which would, every so often, search the forums for the keyword.
    Better yet, you can use google's "site: bbs.archlinux.org keyword format to do your search.
    But, be sure not to do it too often. If you keep banging a particular forum website too often, your ip might get banned.

  • My operating system is OS X Yosemite 10.10.2  Suddenly one (only) of my email accounts is not pulling in new emails.  I ran the Connection Doctor which indicated all connections are ok.  I am looking for another way to troubleshoot or a solution.

    My operating system is OS X Yosemite 10.10.2  Suddenly one (only) of my email accounts is not pulling in new emails.  I ran the Connection Doctor which indicated all connections are ok.  I am looking for another way to troubleshoot or a solution.

    Mail troubleshooting - Yosemite
    Mail (Yosemite): If you can’t receive messages
    Troubleshooting sending and receiving email messages

  • Looking for Quality 3rd Party Monitors

    We have an office of 15 or so Macs and are slowly moving to dual display.
    We are replacing our 27 inch Macs with 21.5 inch - then with a 2nd monitor.
    Can anybody recommend any top quality third party monitors?
    a)  That have a resolution that doesn't look average next to a Mac
    and
    b)  The actual look and athsetics of the monitor doesn't look crappy next to a Mac
    (I guess "a" is probably slightly more important than "b")
    Am looking for an external monitor of around 21, 22, 23 or 24 inch
    Thanks guys

    Hi
    Camcorders http://www.apple.com/macosx/upgrade/camcorders.html
    Use the URL in the first paragraph of this link http://www.apple.com/downloads/macosx/drivers/firewirewebcamdriver.html for Firewire Webcam. Actually many in this list will work with out this driver install. Regard it as a list only
    This Add-On http://www.ecamm.com/mac/ichatusbcam/ and their list of cameras.
    Ralph

  • Looking for an odd SP 2013 farm configuration

    I am in the process of setting up a proof of concept 2013 farm,
    to determine issues such as:
    1. what steps are needed to create the farm?
    2. what steps are needed to move data from 2010 to 2013?
    3. what steps are needed to make 2013's social networking features available?
    One of the unique things that is being considered is this. Management has asked that we bring over the SP 2010 content, but keep the SP 2010 interface, not SP 2013. That is, the 2010 ribbon should remain as the user interface. The environment that the content is used should remain in the SP 2013 "SP 2010 compatibility" mode. We should continue using NTLM as the authentication protocol.Basically, run the content as if it were SP 2010, only on the SP 2013 server.
    I have installed the pre-request, 2013 binaries, SP 1 and july 2014 cumulative updates to a new server.
    I have completed the configuration wizard.
    I am trying to determine what steps I need to take so that I can create a SP 2013 "farm" that is using the SP 2010 functions and features.
    Also, when we do this, will we be able to turn on SP 2013 social features (at least on new site collections), or will the decisions to keep NTLM authentication, etc. make that difficult?
    I am looking for ideas on how to proceed. I have read a lot of TechNet but have notfound anything on these topics.Thank you for your ideas.

    If you do a standard Database Attach upgrade to your new 2013 farm the site collections that come across will all be in 2010 mode.  If you don't let site collection administrator's update their site collections then the 2010 mode will be maintained.
     But if you do that then you will also be limited to the 2010 feature set.  You will not have access to the new 2013 social functionality.  New site collections can also be created in 2010 mode using a dropdown when they are created.  Here's
    a site that has information on how to upgrade from 2010 to 2013.
    But I really don't recommend running in 2010 mode for an extended length of time.  The feature set will be limited and upgrading to the next version or service pack will be even more difficult.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Looking for OSX (1) or Third Party (2) Solution to tag Audio Files

    Hey all,
    I'm new here. I've signed up, because I'm looking for a way to Tag Audio Files. I've been doing Audio Diary over the years. Now instead of converting the Audio to Text, I'm looking for a way to identify Audio entries by adding Tags to them. I'm a little reluctant to use third party. you never now how long they survive. and tagging the files will be quite some work.
    so my question to you is: 1) Is there a way to tag and locate audio Files using the OS X (primary) or third Party (secondary?)
    thx
    Jazz
    ps: I know you can use the Command-I to add Spotlight Comments, but I've had some Issues that Spotlight sometimes does not locate the Files by the added Comment. further on I read about these problems in several Forums too.

    Hey Jazz. you can start by locating the files by doing a Find search - NOT Spotlight - and using the filetype. That will locate all the .mp3 or .ogg or whatever filetype they are and round them up for you.
    Once you do that, and you know how to quickly find them all, you can then get a script to batch process those files. You can use the Automator application to do that, so your next best bet would be to start dabbling with it, and see if there's any scripts available. (Im SURE there are.. there has to be..)
    I think you'll have success on the OSX Technologies threads.. the Automator and scripting stuff is there.

  • Which video card for Aperture and dual monitors?

    I have a G5 dual 2.0 with a GeForce FX 5200 video card that is driving one 23" Cinema display. I need to upgrade my card per the specs to run Aperture. I have also been thinking of getting a second 23" display. Can someone recommend the best video card for me. I know very little about video cards and have been reading a lot this morning. Thanks,
    Dave

    Hi Dave;
    No. PCIx and PCIe or PCI Express are not the same thing.
    PCIx is an extended or slight sped up version of PCI. While PCIe is a switched bus structure instead.
    Hence they are not the same. That is what all of the big news is about Apple has made the leap over to PCI Express.
    Allan

  • Looking for an internal traffic monitor for a RV042

    I have an RV042 router and I'm looking to monitor the total upstream and downstream traffic from within the router. I know there is tons of software that I can put on a network computer to monitor traffic, but is there any software that I can put on the router itself that will monitor the traffic from within the router?                  

    James,
    This doesn't reside on the RV042, but I think its as close as you're going to get. Check out these threads:
    http://www.dslreports.com/forum/remark,16725884
    http://forums.cacti.net/about35626.html
    Another popular one is Kiwi (Solarwinds now)
    There are also many other SNMP monitoring tools you could use.
    Best,
    David
    Please rate helpful posts and identify correct answers.

  • Looking for Workflow Service URL in RAR Configuration

    We are configuring RAR and are at Workflow step.
    Workflow contains four sections:
    1. Risk maintenance
    2. Mitigation Control Maitenance
    3. Mitigation
    4. Workflow Service URL.
    We are stuck at the fourth step, Workflow Service URL (This Web service URL is used to submit workflow requests to Compliant User Provisioning) and are not able to trace the URL in configuration guide.
    Can anyone help me in providing the link for the URL
    Regards-
    Shubhi

    Hi,
    It's correct that the WS is the same for both 5.2 and 5.3.
    You can get the URL by opening http://host:port/wsnavigator.
    Expand AEWFRequestSubmissionService_5_2 and click on document.
    //Vit

  • Looking for reliable programs to monitor performance

    Any suggestions for managing the Mac-Pros performance?

    Hi, not sure of Managing, but for Monitoring...
    Open Activity Monitor, Show:>All Processes, sort on CPU%, see if anything using too much CPU% when this happens, click on Memory tab, do you have many Pageouts? Many tabs there to Monitor things.
    Also, Open Console in Applications>Utilities & see if there are any clues or repeating messages.

  • Looking for the list of maintaining and configuring tasks on Core switch.

    I have some experiences DMS switches, things like setting up zone, alias, zoneset etc, but never have any experiences on core switches or something between core and edge switches since the SAN environment here has not reached that scale.
    Would you please list those tasks that needs to be done in daily maintenance, and required configurations? or some related documents? including those on core switches or something between core and edge switches?
    Thank you very much for your ideas.

    Hello ciscomagic1,
    The definition of core and edge swicthes in a FC architecture is related the topology point of view.
    The core could be NPIV enabled switche and all edges running as NPV mode.
    Also the core could be the switch that will make the translation of FC to another protocol as FCoE, FCIP or iSCSI and should be licensed to those protocols.
    Normally the core is the more centralized switch in the entire fabric, with more backplane capacity, redundancy and high port density. Of course this is not a rule at all.
    Essentially the core and edge switches can perform the same tasks and have the same functionality, the point is how them will be better availed in a design.

  • Security/Firewall recommendations for DirectAccess 2012 (Dual-NIC Edge Configuration)

    Hello all,
    We have installed and configured DirectAccess 2012 with the Edge Configuration with the thought that we would be able to install TMG directly on this server (as we did with the original 2008 DirectAccess/UAG). It appears that we cannot install TMG on Server
    2012 R2, so now we have a server directly connected to the outside world with public IP's assigned to it and no firewall other than Windows Firewall. I know that most organizations choose to configure DirectAccess behind an Edge device (hindsight being perfect,
    we should have as well) however we did not and it appears that we can't easily change this without completely reconfiguring DirectAccess (which took several days to get it right).
    So my question: What are the security/firewall recommendations for a DirectAccess server in an Edge scenario? I've Googled this and have not found much. Thanks in advance,
    Brad
    -Brad

    Its always good to have a Firewall infront of a domain joined machine and of course DA Server is not an exception.
    Server 2012 can work behind a Firewall with NAT functionality enabled or disabled.
    if you have a fully functional DA with EDGE profile enabled, still you can configue any firewall(without NATing functionality) without changing the configuration settings in DA.
    Also you can have TMG protecting your existing DA setup. Below is the link for it.
    http://www.isaserver.org/articles-tutorials/general/implementing-windows-server-2012-directaccess-behind-forefront-tmg-part1.html
    Please let me know, how it goes.

  • Looking for anyone with the Belkin Auto Kit for iPod...

    I am having trouble with this auto adapter in that when I play throough the audio jack on the charger, I get skipping/clipping of my music. If I plug directly into my in dash unit and bypass the audio of the Belkin unit, it plays fine. I have already exchanged the Belkin unit once...
    Anyone else experience this?

    returned second Belkin unit and went with a different brand - No Problems!

Maybe you are looking for

  • "Line Spacing" vs. leading

    How does "Line Spacing" in static or dynamic text fields (explicitliy set in the "Formatting Options" window) compare w/ "leading" when creating a text field w/ AS? Is a "Line Spacing" setting of 10 the same as my_fmt.leading = 10;? In a Flash 7 file

  • Custom search help tab for "Material" in ME21N...

    Experts, I have a requirement to create a separate tab in the standard collective search help that is triggered in F4 at the Material field in PO items for ME21N to add an additional search criterion for Materials by Material Group, there by reducing

  • ATV - TC

    Hi! I have some questions related with the ATV. 1-Can I streaming movies,music,photos from my Time capsule to the apple tv wireless? (In case yes, how slow is?) 2-Can I transfer movies from the computer to the apple tv hard drive? 3-What type of hard

  • Script for creating ALL_OLAP2_CUBE_MEASURES and MRV_OLAP2_AW_CUBE_MEASURES

    Hi Would someone please kindly tell me the script used to create the views ALL_OLAP2_CUBE_MEASURES and MRV_OLAP2_AW_CUBE_MEASURES. Many thanks. alfchan

  • Error '800a0411'  Name redefined (ASP VBScript)

    Hello, I am new in trying to program and I have this problem when I am trying to test my Login page built in Dreamweaver CS4 and my database is in Microsoft Access. The error message is the following: Microsoft VBScript compilation error '800a0411' N