Xfce Forum

Sub domains
 

You are not logged in.

#1 2014-07-26 22:51:47

33333
Member
Registered: 2014-07-26
Posts: 5

Duel monitor panel preferences auto preferred?

Hi,

I have two monitors, the laptop's monitor and an attached HDMI monitor. I have setup duel screen and it is working. However, I want my panels to automatically attach to the laptop monitor when I detach the HDMI monitor and reattach to the HDMI monitor when I reattach it. When I set the panel preference to "auto" they always attach to the laptop monitor. I have tried `xrandr --auto`, and using `xrandr` to set the preferred monitor to the HDMI monitor. For reference this is the script I have in my startup:

    xrandr --output LVDS1 --left-of HDMI1 --output HDMI1 --primary --preferred --auto

Thanks for any help.

Offline

#2 2014-07-27 00:16:20

ToZ
Moderator
From: Toronto, Canada
Registered: 2011-06-02
Posts: 2,990

Re: Duel monitor panel preferences auto preferred?

Right now, I also manually run a script to reset the displays when I connect or disconnect an external monitor at work. I've been meaning to automate such a process myself, but haven't gotten around to it yet. I did manage to find some information on automating this via udev or inotifywait. Here are the links:

- via udev
- via inotifywait

I won't be able to look at this further until I'm back at the office, but perhaps they can be of some assistance to you. If you get it to work, please post back your solution.


How To Ask For Help           Xfce FAQ                            Xfce Release Information
The Xfce Community          Xfce Tips and Tricks

Offline

#3 2014-07-27 06:48:29

33333
Member
Registered: 2014-07-26
Posts: 5

Re: Duel monitor panel preferences auto preferred?

OK got a hack fix for it. I had not got desperate enough to start looking at udev. The udev rules, and general method in the link you posted work for me. Thanks for that. As far as I know there is no CLI interface to XFCE4 panels, but there is a DBus interface (there probably is a CLI interface now that I think about it). The following adaption works with dbus to talk to xfce4 panels. Still, XFCE4 struggles to reposition the windows exactly right on my system, but at least the panels problem is hack fixed. Cheers!

#!/bin/bash -e
PRIMARY_SCREEN_NAME=HDMI1
SECONDARY_SCREEN_NAME=LVDS1
PANELS=(0 1)

XUSER=`w -h -s|awk '$3~"^:0"{print $1; exit 0}'`
if [ -z "$XUSER" ]; then
	echo "No one logged in, exiting."
	exit 0;
fi

XHOMEDIR=`getent passwd $XUSER|cut -d: -f6`
export DISPLAY=":0"
export XAUTHORITY="$XHOMEDIR/.Xauthority"

PANEL_SCREEN=${SECONDARY_SCREEN_NAME}
if xrandr | egrep -q "^${PRIMARY_SCREEN_NAME} connected"; then
  PANEL_SCREEN=${PRIMARY_SCREEN_NAME};
fi

echo "Switching panels ${PANELS[*]} to display ${PANEL_SCREEN} for ${XHOMEDIR}/.Xauthority"

for i in ${PANELS[*]}; do
  su ${XUSER} -c "dbus-send --type=method_call --print-reply --dest=org.xfce.Xfconf /org/xfce/Xfconf org.xfce.Xfconf.SetProperty string:xfce4-panel string:/panels/panel-${i}/output-name variant:string:${PANEL_SCREEN}"
done

Last edited by 33333 (2014-07-27 12:53:21)

Offline

Board footer

Powered by FluxBB