如何在重新開啟檔案/應用程式時恢復遺失的忙碌遊標?

如何在重新開啟檔案/應用程式時恢復遺失的忙碌遊標?

有一個關於此的錯誤報告https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/862662,儘管最近我開始不確定這是否真的是 Nautilus bug。在安裝Precise之前,我透過安裝PCManFM來測試它,看看在等待時開啟檔案是否顯示忙碌遊標,但忙遊標仍然不顯示。

繁忙的遊標在 Oneiric 和 Precise Live USB 中都可以使用,在我之前使用 Oneiric 時,它也可以使用。然後,我安裝了 Precise,未格式化我的主資料夾,但問題仍然存在。我還嘗試刪除我的主資料夾中的配置資料夾和檔案(實際上是將其移動到一個資料夾以便可以恢復),註銷並重新登錄,但問題仍然存在(在Oneiric中,我創建了一個新的用戶查看是否是配置問題,但也無濟於事)。

因此,考慮到繁忙的遊標在實時會話中工作,有什麼方法可以讓繁忙的遊標在已安裝的系統中正常運作(例如編輯一些系統配置)?

這是一個常見問題還是僅發生在特定硬體上?

答案1

此錯誤的兩種可能的解決方法:

  • 安裝“gdm”包。安裝程式將詢問您首選的登入管理員是什麼,選擇“gdm”而不是“lightdm”。
  • 堅持使用 lightdm,但要設定您的帳戶,這樣您就不必輸入密碼即可登入。如果沒有,請啟動系統設定面板的「使用者帳戶」部分下的「自動登入」選項。

請注意,此解決方案並不完美。只有 GTK 應用程式在啟動時才會有繁忙的遊標。 Qt 和其他軟體(例如 VLC 和 Libreoffice)仍然不會。

答案2

很快,另一種可能的解決方法:

查看/doc/startup-notification-devel-0.12/examples 的索引並得到test-monitor.c;修改檔案使其匹配:

...
//#include <config.h>
#ifndef SN_API_NOT_YET_FROZEN
#define SN_API_NOT_YET_FROZEN
#endif
#include <libsn/sn.h>
...
int
main (int argc, char **argv)
{
  Display *xdisplay;
  SnDisplay *display;
  SnMonitorContext *context;

  setbuf (stdout, NULL);

  xdisplay = XOpenDisplay (NULL);
...

建構:

sudo apt-get install libstartup-notification0-dev
gcc -I/usr/include/startup-notification-1.0 test-monitor.c -o test-monitor -lX11 -lstartup-notification-1

然後:

$ sudo apt-get install python-osd
$ cat > osd.py <<"EOF" 
import pyosd # XOSD
import time
import sys
import os

# default_font="-*-helvetica-medium-r-normal-*-*-360-*-*-p-*-*-*"
# xlsfonts | less # to find fonts, say
# -misc-fixed-bold-r-normal--0-0-75-75-c-0-iso10646-1:
tfont="-*-fixed-bold-r-normal--*-*-100-*-c-*-*-*"
osd = pyosd.osd(font=tfont, colour='#FF0000', lines=3)
osd.set_align(pyosd.ALIGN_CENTER)
osd.set_pos(pyosd.POS_MID)
display = osd.display
osd.set_timeout(1)
# display will last as long the python program hasn't exited!
#display("Hello") 
#display(50, type=pyosd.TYPE_SLIDER, line=0) 

display("Hello from pyosd/XOSD", line=1)


# disable stdin buffering (ok on Python 2.7)
ttfo = os.fdopen(sys.stdin.fileno(), 'r', 0)

while 1:
  try:
    inline = ttfo.readline().rstrip()
  except KeyboardInterrupt:
    break
  if not inline:
    break
  print(inline)
  for ix in range(0,50):
    display(ix, type=pyosd.TYPE_PERCENT, line=0) 
    display(inline, line=1)
    display(ix, type=pyosd.TYPE_PERCENT, line=2) 
    time.sleep(0.02)
  time.sleep(1)
EOF

....並測試:

./test-monitor | stdbuf -oL grep description | python osd.py

添加/etc/lightdm/lightdm.conf;session-setup-script=/path/to/mylightdm-startup.sh並在 mylightdm-startup.sh` 中:

SND=/path/to/folder
($SND/test-monitor | stdbuf -oL grep description | python $SND/osd.py) &

這應該會給你一個簡單的螢幕顯示通知;另一種(更複雜的)可能性是使用Ghosd-具有透明度的螢幕顯示 (OSD)(也這裡)。

答案3

如果您使用 lightdm 登入管理員,則會發生此錯誤。該錯誤是由 lightdm、GDK3 和 Xorg 的規範協調的,詳細資訊請參閱啟動板錯誤 #1024482

要修復它,您必須設定GDK_CORE_DEVICE_EVENTS環境變量,這使得 GDK3 不會錯誤地使用 Xorg 呼叫。

echo "GDK_CORE_DEVICE_EVENTS=true" | sudo tee ~lightdm/.pam_environment

相關內容