拔下外接显示器后 Xubuntu 菜单栏消失

拔下外接显示器后 Xubuntu 菜单栏消失

我搜索过类似问题,但没找到。如果重复,我深表歉意。

我正在尝试将 Xubuntu 安装在我的 Ubuntu 13.10 上。我一直在尝试连接外接显示器并扩展桌面。它成功了,没有任何问题。这是结果(左:笔记本电脑 - 右:24 英寸 VGA 外接显示器):

https://i.stack.imgur.com/kXcAs.png

但是,当我返回笔记本电脑屏幕时,只有菜单栏消失了,如下一张屏幕截图所示:

https://i.stack.imgur.com/d7ysw.png

如果我再次插入/激活外部显示器,它就会恢复正常工作,如前所示。

更新:

按要求输出 xrandr(无外部监视器)

Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 32767 x 32767
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 277mm x 156mm
   1366x768       60.0*+
   1360x768       59.8     60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 disconnected 1920x1080+1366+0 (normal left inverted right x axis y axis) 0mm x 0mm
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
HDMI3 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
  1920x1080 (0x4d)  148.5MHz
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock   67.5KHz
        v: height 1080 start 1084 end 1089 total 1125           clock   60.0Hz

外接显示器已插入:

Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 32767 x 32767
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 277mm x 156mm
   1366x768       60.0*+
   1360x768       59.8     60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 connected 1920x1080+1366+0 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080      60.0*+
   1600x1200      60.0  
   1680x1050      60.0  
   1280x1024      75.0     60.0  
   1440x900       59.9  
   1280x960       60.0  
   1152x864       75.0  
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        75.0     72.8     66.7     60.0  
   720x400        70.1  
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
HDMI3 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

答案1

好的,问题是,当您拔下显示器时,您的桌面设置不会刷新,系统仍然认为它已连接第二台显示器。这可能可以通过udev规则来解决,但对于这种事情,它们可能会变得复杂。我编写了一个刷新桌面的小脚本,并将其映射到快捷键,以便我可以轻松运行它并修复此类问题。我已根据您的输出对其进行了修改,以匹配您的设置xrandr

#!/usr/bin/env bash


## If the VGA1 screen is currenlty connected  
if ( xrandr | grep VGA1 | grep -qw connected )
then
    ## print a pretty message
    notify-send "Extending desktop to screen VGA1"

    ## extend the desktop to the external screen. If you want your panel
    ## to appear on the right hand screen move the '--primary' flag to
    ## the VGA1: --output VGA1 --primary ...
    xrandr --output LVDS1 --auto  --primary --output VGA1 --auto --right-of LVDS1
else

    ## If the external screen is not connected, refresh the desktop and
    ## make everything appear on the laptop's
    xrandr --output LVDS1 --auto --primary --output VGA1 --off

fi

将此脚本另存为~/screen_switch.sh,使其可执行(chmod +x ~/screen_switch.sh),然后使用系统设置设置运行它的键盘快捷键。现在您可以使用快捷方式来解决问题。

相关内容