
這個問題有兩個部分:
如何透過 bash shell 腳本在 Ubuntu 中安裝 x-cursor-theme。遊標主題預計不會出現在儲存庫中。
如何真正讓新主題充分活躍。 Ubuntu 中存在一個錯誤,其中(選擇 GUI 的)x 遊標主題將不會用於 Java 應用程式(和其他特殊應用程式),除非透過以下方式執行選擇主題的附加步驟:
更新替代方案 --config x-cursor-theme
理想情況下,也希望編寫該步驟的腳本,以便流程完全自動化。
例如,我想透過腳本安裝不透明的 comix 遊標主題。我需要這兩個文件才能開始:
wget -O /tmp/ComixCursors-0.7.3.tar.bz2 http://www.limitland.de/comixcursors/ComixCursors-0.7.3.tar.bz2
wget -O /tmp/ComixCursors-Opaque-0.7.3.tar.bz2 http://www.limitland.de/comixcursors/ComixCursors-Opaque-0.7.3.tar.bz2
接下來是什麼?
請注意,gnome-look.org 提供的安裝說明不適用於 Ubuntu/Mint/Debian。我將把它們貼在下面。但我想在 Ubuntu 上以正確的方式做到這一點,據我所知,它將使用主題檔案和符號連結(我還沒有弄清楚其中的細節)。
非Ubuntu系統安裝
對於系統範圍的安裝,您需要將遊標目錄複製到 X11 lib 目錄。發出這些命令::
$ whereis X11 $ man 3 xcursor $ cd /usr/share/icons $ sudo cp -r ~/.icons/ComixCursors* 。
現在,這將幹擾 ~/.icons 目錄中的遊標主題,該目錄將具有優先權。您將需要重命名遊標目錄並編輯其中的index.theme 檔案。
如果您想讓主題成為系統範圍的預設主題,請編輯檔案 /etc/sysconfig/windowmanager 以讀取:
X_MOUSE_CURSOR="ComixCursors-White-Regular-Slim" 或任何您的(自訂)遊標目錄的名稱。
答案1
這是我經過一系列嘗試和錯誤以及其他人的幫助後最終想出的可行解決方案。該腳本中有一些內容可能看起來不必要,但測試表明它們是完整工作解決方案所必需的。下一步將是允許選擇遊標,而不是對“不透明紅色巨大”選擇進行硬編碼。然而,此時這對我來說並不是一個要求。
#!/bin/sh
#2012.02.02 this is the working version for Mint 9 and Ubuntu 10.04. It should work in other versions too.
wget -O /tmp/ComixCursors-0.7.3.tar.bz2 http://www.limitland.de/comixcursors/ComixCursors-0.7.3.tar.bz2
wget -O /tmp/ComixCursors-Opaque-0.7.3.tar.bz2 http://www.limitland.de/comixcursors/ComixCursors-Opaque-0.7.3.tar.bz2
tar -C /usr/share/icons/ -xjvf /tmp/ComixCursors-0.7.3.tar.bz2
tar -C /usr/share/icons/ -xjvf /tmp/ComixCursors-Opaque-0.7.3.tar.bz2
rm /tmp/ComixCursors-0.7.3.tar.bz2
rm /tmp/ComixCursors-Opaque-0.7.3.tar.bz2
cat <<MYEOF > /usr/share/icons/ComixCursors-Opaque-Red-Huge/index.theme
[Icon Theme]
Name = Comix Cursor opaque Red Huge Bold
Comment = The opaque Comix Cursors - Red Huge Bold
Example = default
Inherits = ComixCursors-Opaque-Red-Huge
MYEOF
update-alternatives --install /usr/share/icons/default/index.theme x-cursor-theme /usr/share/icons/ComixCursors-Opaque-Red-Huge/index.theme 51
update-alternatives --set x-cursor-theme /usr/share/icons/ComixCursors-Opaque-Red-Huge/index.theme
echo "The ComixCursors-Opaque-Red-Huge theme should be active after you log out and log back in"
exit 0
如果您複製並貼上此程式碼,請注意此處文件的終止符無法縮排。其縮排僅用於 StackOverflow 格式化目的。
答案2
您下載的檔案不是實際的遊標,而是遊標來源,您必須先建立遊標。透過解壓縮原始碼、cd 到該目錄並發出以下命令來完成此操作:
$ ./bin/build-cursors
$ make
$ make install
還有各種其他選項,請參閱文件 INSTALL。現在您已經建立了遊標主題 ~/.icons/ComixCursors.custom。遊標主題應該是 ~/.icons(每個使用者安裝)或 /usr/share/icons(系統安裝)的子目錄。您也可以將其移動到任何地方,並將其連結到 ~/.icons 或 /usr/share /icons 。
其他主題不需要構建,而是作為一個目錄,其中包含目錄“cursors”(實際的 X11 遊標和符號連結)和一個 index.theme 檔案。
在腳本中包含該建置過程或使用/連結預先建置遊標。