Ubuntu 17.10 推出 [論壇 - Ubuntu 與 GNOME]


正在瀏覽:   1 名遊客


 到底部   前一個主題   下一個主題  [無發表權] 請登錄或者註冊

« 1 2 3 (4) 5 6 »


回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引]

================================================================================

# 關於「Gnome Shell」的「Looking Glass」操作使用

================================================================================

我在複習之前寫的「文章」,一些基礎的概念,大部分都適用目前的版本,只有一些小細節,有差異。

上面的連結,以前有紀錄在「如何撰寫Gnome Shell Extension」這篇討論串。

而以下則是「溫故知新」後的紀錄。

================================================================================

## 測試環境

執行


$ gnome-shell --version



顯示


GNOME Shell 3.26.1



================================================================================

## 文件

* https://wiki.gnome.org/Projects/GnomeShell/LookingGlass
* https://wiki.gnome.org/Projects/GnomeShell/CheatSheet#Developer_tools


================================================================================

## 基本技巧


### 呼叫出「Looking Glass

* 鍵盤按下「<Alt> + F2」,呼叫出「Command輸入視窗」。
* 然後輸入「lg」,鍵盤按下「Enter」,執行呼叫出「Looking Glass」。

### 重新啟動「gnome-shell」

* 鍵盤按下「<Alt> + F2」,呼叫出「Command輸入視窗」。
* 然後輸入「r」,不登出,重新啟動「gnome-shell」。(不過這個在「Waylan Session」無法重新啟動)

================================================================================

## 測試「Main.notify()」和「Main.notifyError()」這兩個「function(method)」。

1. 呼叫出「Looking Glass」,然後在「Evaluator」這一分頁。

輸入「Main.notify("This is notify message")

就會發現,會跳出訊息視窗。

2. 呼叫出「Looking Glass」,然後在「Evaluator」這一分頁,

輸入「Main.notifyError("This is notifyError message")」。

就會發現,會跳出訊息視窗。

然後在訊息視窗還沒消失,在畫面上方的「TopBar」中間有一個日期,按下之後,會下拉一個選單,
下拉選單右方是日曆,左方則會有一筆剛剛的訊息。

然後在「/var/log/syslog」這個檔案,也可以找到紀錄。

執行下面指令,


$ grep 'gnome-shell\[' /var/log/syslog | tail



就可以看到其中有一行如下



Oct 28 14:13:35 my-host gnome-shell[908]: error: This is notifyError message



3. 呼叫出「Looking Glass」,然後在「Evaluator」這一分頁,

輸入「Main」,就會看到「r(3) = [object GjsModule ui.main]」,

可以用滑鼠點「[object GjsModule ui.main]」,就會出現另一個對話框。

可以了解到「Main」這個物件,有哪些「Property」和「Methond」。

您可以看到其中有兩行如下


nofity:<js function>
notifyError:<js function>



================================================================================

## 測試「global.log()」和「global.logError()」這兩個「function(method)」。

1. 呼叫出一個您慣用的「Terminal」起來,然後執行下面的指令。


$ tail -f /var/log/syslog



2. 呼叫出「Looking Glass」,然後在「Evaluator」這一分頁,

輸入「global.log("This is global.log message")」,

就可以看到下面這一行,出現在剛剛「Terminal」的最後一行。


Oct 28 14:33:21 my-host gnome-shell[908]: This is global.log message




3. 呼叫出「Looking Glass」,然後在「Evaluator」這一分頁,

輸入「global.logError("This is global.logError message")」,

就可以看到下面這一行,出現在剛剛「Terminal」的最後一行。


Oct 28 14:35:56 my-host gnome-shell[908]: This is global.logError message




3. 呼叫出「Looking Glass」,然後在「Evaluator」這一分頁,

輸入「global」,就會看到「r(6) = [object instance proxy GIName:Shell.Global jsobj@0x7f3308263820 native@0xb684d0]」,

可以用滑鼠點「[object instance proxy GIName:Shell.Global jsobj@0x7f3308263820 native@0xb684d0]」,就會出現另一個對話框。

可以了解到「global」這個物件,有哪些「Property」和「Methond」。

您可以看到其中有兩行如下


log:<js function>
logError:<js function>



================================================================================

## this

1. 呼叫出「Looking Glass」,然後在「Evaluator」這一分頁,

輸入「this」,就會看到「r(8) = [object LookingGlass]」,

可以用滑鼠點「[object LookingGlass]」,就會出現另一個對話框。

可以了解到「this」這個物件,有哪些「Property」和「Methond」。

您可以看到其中有一行如下


close:<js function>

toggle:<js function>


然後按下鍵盤「Esc」鍵,關閉剛剛的「inpecting」對話框。

然後在「Evaluator」這一分頁,

輸入「this.toggle()」或是「this.close()」,就會關閉「Looking Glass」。

當然也可以鍵盤「Esc」鍵,關閉「Looking Glass」。


================================================================================

## window

1. 呼叫出「Looking Glass」,然後在「Evaluator」這一分頁,

輸入「window」,就會看到「r(7) = [object GjsGlobal]」,

可以用滑鼠點「[object GjsGlobal]」,就會出現另一個對話框。

可以了解到「window」這個物件,有哪些「Property」和「Methond」。

您可以看到


inspecting: object: [object GjsGlobal]

C_: <js function>
N_: <js function>
_: <js function>
__caller__: undefined
global: [object instance proxy GIName:Shell.Global jsobj@0x7fb40839ea60 native@0x55f1636bdcc0]



表示「window」這個物件底下,可以參考到剛剛的「global」物件。

然後按下鍵盤「Esc」鍵,關閉剛剛的「inpecting」對話框。

然後在「Evaluator」這一分頁,

先輸入「window.」,然後連續按兩下鍵盤「Tab」鍵,也會出現很多「window」這個物件底下的「member」。

顯示如下的資訊


Array, ArrayBuffer, Boolean, C_, DataView, Date, Debugger, Error, EvalError, Float32Array, Float64Array, Function, GIRepository, GIRepositoryFunction, GIRepositoryGType, GIRepositoryNamespace, GjsFileImporter, Infinity, Int16Array, Int32Array, Int8Array, InternalError, Intl, Iterator, JSON, Map, Math, N_, NaN, Number, Object, Promise, Proxy, RangeError, ReferenceError, Reflect, RegExp, Set, StopIteration, String, Symbol, SyntaxError, TypeError, URIError, Uint16Array, Uint32Array, Uint8Array, Uint8ClampedArray, WeakMap, WeakSet, _, __caller__, __defineGetter__, __defineSetter__, __lookupGetter__, __lookupSetter__, constructor, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, escape, eval, global, hasOwnProperty, imports, isFinite, isNaN, isPrototypeOf, log, logError, ngettext, parseFloat, parseInt, print, printerr, propertyIsEnumerable, toLocaleString, toSource, toString, undefined, unescape, uneval, unwatch, valueOf, watch, window



可以看到「window」也有「log」和「logError」。

上面這一段,也可以在「Evaluator」這一分頁輸入下面這一行指令,


global.log('msg: ' + JsParse.getCompletions('window.', imports.ui.lookingGlass.commandHeader, AUTO_COMPLETE_GLOBAL_KEYWORDS));



就可以在「/var/log/syslog」找到如下的訊息


Oct 28 16:11:44 my-host gnome-shell[908]: msg: Array, ArrayBuffer, Boolean, C_, DataView, Date, Debugger, Error, EvalError, Float32Array, Float64Array, Function, GIRepository, GIRepositoryFunction, GIRepositoryGType, GIRepositoryNamespace, GjsFileImporter, Infinity, Int16Array, Int32Array, Int8Array, InternalError, Intl, Iterator, JSON, Map, Math, N_, NaN, Number, Object, Promise, Proxy, RangeError, ReferenceError, Reflect, RegExp, Set, StopIteration, String, Symbol, SyntaxError, TypeError, URIError, Uint16Array, Uint32Array, Uint8Array, Uint8ClampedArray, WeakMap, WeakSet, _, __caller__, __defineGetter__, __defineSetter__, __lookupGetter__, __lookupSetter__, constructor, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, escape, eval, global, hasOwnProperty, imports, isFinite, isNaN, isPrototypeOf, log, logError, ngettext, parseFloat, parseInt, print, printerr, propertyIsEnumerable, toLocaleString, toSource, toString, undefined, unescape, uneval, unwatch, valueOf, watch, window,



我是參考「gnome-shell」的原始碼,
在「gnome-shell/js/ui/lookingGlass.js」這個路徑,可以找到下面這一行,然後再修改成上面的指令。


let [completions, attrHead] = JsParse.getCompletions(text, commandHeader, AUTO_COMPLETE_GLOBAL_KEYWORDS);



================================================================================

## Expression

1. 呼叫出「Looking Glass」,然後在「Evaluator」這一分頁,

輸入「a = 1」,按下鍵盤「Enter」鍵,

會顯示


r(10) = 1;



接著輸入「a」,按下鍵盤「Enter」鍵,

會顯示


r(11) = 1;



接著輸入「window.a」,按下鍵盤「Enter」鍵,

會顯示


r(12) = 1;



接著輸入「window」,就會看到「r(13) = [object GjsGlobal]」,

可以用滑鼠點「[object GjsGlobal]」,就會出現另一個對話框。


inspecting: object: [object GjsGlobal]

C_: <js function>
N_: <js function>
_: <js function>
__caller__: undefined
a: 1
global: [object instance proxy GIName:Shell.Global jsobj@0x7fb40839ea60 native@0x55f1636bdcc0]



可以看到其中有一行「a: 1」。

接著輸入「window.」,然後連續按兩下鍵盤「Tab」鍵,

就會看到如下的訊息


Array, ArrayBuffer, Boolean, C_, DataView, Date, Debugger, Error, EvalError, Float32Array, Float64Array, Function, GIRepository, GIRepositoryFunction, GIRepositoryGType, GIRepositoryNamespace, GjsFileImporter, Infinity, Int16Array, Int32Array, Int8Array, InternalError, Intl, Iterator, JSON, Map, Math, N_, NaN, Number, Object, Promise, Proxy, RangeError, ReferenceError, Reflect, RegExp, Set, StopIteration, String, Symbol, SyntaxError, TypeError, URIError, Uint16Array, Uint32Array, Uint8Array, Uint8ClampedArray, WeakMap, WeakSet, _, __caller__, __defineGetter__, __defineSetter__, __lookupGetter__, __lookupSetter__, a, constructor, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, escape, eval, global, hasOwnProperty, imports, isFinite, isNaN, isPrototypeOf, log, logError, ngettext, parseFloat, parseInt, print, printerr, propertyIsEnumerable, toLocaleString, toSource, toString, undefined, unescape, uneval, unwatch, valueOf, watch, window



也會出現「a」。


接著輸入「delete a」,按下鍵盤「Enter」鍵,

會顯示


r(14) = true



接著輸入「a」,按下鍵盤「Enter」鍵,

會顯示


r(15) = <exception ReferenceError: a is not defined>



接著輸入「a」,按下鍵盤「Enter」鍵,


r(16) = undefined



然後在「window」的「inspect」視窗,也看不到「a: 1」。
而輸入「window.」,連續按兩下鍵盤「Tab」鍵,也看不到「a」的蹤跡了。


接著輸入「say = function() {return 9}」,然後按下「Enter」鍵,

會顯示


r(20) = <js function>



接著輸入「say」,然後按下「Enter」鍵,

會顯示


r(21) = <js function>



接著輸入「say()」,然後按下「Enter」鍵,

會顯示


r(22) = 9




接著輸入「say = function() {log('say hello')}」,然後按下「Enter」鍵,

會顯示


r(23) = <js function>



接著輸入「say()」,然後按下「Enter」鍵,

會顯示


r(24) = undefined



也可以在「/var/log/syslog」找到下面這一行紀錄。


Oct 28 17:44:15 my-host gnome-shell[5790]: say hello




同理,在「window」也可以找到「say」的蹤跡,

輸入「window.say」,然後按下「Enter」鍵,

會顯示


r(25) = <js function>




================================================================================

執行


$ apt-get source gnome-shell



會下載下面三個檔案

* gnome-shell_3.26.1-0ubuntu5.debian.tar.xz
* gnome-shell_3.26.1-0ubuntu5.dsc
* gnome-shell_3.26.1.orig.tar.xz

並且解開到「gnome-shell-3.26.1」這個資料夾。


執行下面指令,找尋跟「Inspecting」相關的檔案。


$ grep 'Inspecting' gnome-shell-3.26.1/* -R -n



顯示


gnome-shell-3.26.1/js/ui/lookingGlass.js:395:        let label = new St.Label({ text: 'Inspecting: %s: %s'.format(typeof(obj),



執行下面指令,找尋跟「js function」相關的檔案。


$ grep 'js function' gnome-shell-3.26.1/* -R -n



顯示


gnome-shell-3.26.1/js/ui/lookingGlass.js:260:        return '<js function>';



執行


$ grep 'global\.log' gnome-shell-3.26.1/* -R -n



顯示


gnome-shell-3.26.1/js/ui/main.js:113:    global.logError = window.log;
gnome-shell-3.26.1/js/ui/main.js:114:    global.log = window.log;
gnome-shell-3.26.1/NEWS:2694:* Don't use global.log() [Jasper; #675790]



執行


$ grep 'global\.logError' gnome-shell-3.26.1/* -R -n



顯示


gnome-shell-3.26.1/js/ui/main.js:113:    global.logError = window.log;




執行下面指令,找尋跟「windowlo.global」相關的檔案。


$ grep 'window\.global' gnome-shell-3.26.1/* -R -n



顯示


gnome-shell-3.26.1/js/extensionPrefs/main.js:380:    window.global = {
gnome-shell-3.26.1/js/ui/environment.js:84:    window.global = Shell.Global.get();
gnome-shell-3.26.1/src/shell-global.c:545: * it's available as window.global inside JS.)



執行


$ grep 'function notify' gnome-shell-3.26.1/* -R -n



執行下面指令,找尋跟「function notify」相關的檔案。

顯示


gnome-shell-3.26.1/js/ui/main.js:336:function notify(msg, details) {
gnome-shell-3.26.1/js/ui/main.js:351:function notifyError(msg, details) {



執行


$ grep 'function log' gnome-shell-3.26.1/* -R -n



顯示


gnome-shell-3.26.1/js/ui/extensionSystem.js:139:function logExtensionError(uuid, error) {



執行


$ grep 'log: function' gnome-shell-3.26.1/* -R -n



顯示


gnome-shell-3.26.1/js/extensionPrefs/main.js:381:        log: function() {
gnome-shell-3.26.1/js/ui/workspaceThumbnail.js:148:    addAttachedDialog: function(win) {
gnome-shell-3.26.1/js/ui/workspaceThumbnail.js:152:    _doAddAttachedDialog: function(metaDialog, realDialog) {
gnome-shell-3.26.1/js/ui/dialog.js:32:    _createDialog: function () {
gnome-shell-3.26.1/js/ui/screenShield.js:630:    _maybeCancelDialog: function() {
gnome-shell-3.26.1/js/ui/screenShield.js:907:    showDialog: function() {
gnome-shell-3.26.1/js/ui/screenShield.js:967:    _ensureUnlockDialog: function(onPrimary, allowCancel) {
gnome-shell-3.26.1/js/ui/workspace.js:205:    addAttachedDialog: function(win) {
gnome-shell-3.26.1/js/ui/workspace.js:215:    _doAddAttachedDialog: function(metaWin, realWin) {
gnome-shell-3.26.1/js/ui/shellMountOperation.js:128:    _closeExistingDialog: function() {
gnome-shell-3.26.1/js/ui/shellMountOperation.js:230:    borrowDialog: function() {
gnome-shell-3.26.1/js/ui/shellMountOperation.js:530:    _closeDialog: function() {
gnome-shell-3.26.1/js/ui/modalDialog.js:260:    _fadeOutDialog: function(timestamp) {
gnome-shell-3.26.1/js/ui/closeDialog.js:51:    _initDialog: function () {
gnome-shell-3.26.1/js/ui/windowManager.js:1986:    _createCloseDialog: function (shellwm, window) {
gnome-shell-3.26.1/js/ui/windowManager.js:1990:    _createInhibitShortcutsDialog: function (shellwm, window) {
gnome-shell-3.26.1/js/ui/status/network.js:1267:    _showDialog: function() {
gnome-shell-3.26.1/js/ui/status/location.js:329:    _showAppAuthDialog: function(name, reason) {
gnome-shell-3.26.1/js/ui/components/networkAgent.js:499:    _showNewStyleDialog: function() {



執行


$ grep 'logError: function' gnome-shell-3.26.1/* -R -n



顯示


gnome-shell-3.26.1/js/extensionPrefs/main.js:385:        logError: function(s) {



執行


$ grep 'notify: function' gnome-shell-3.26.1/* -R -n



顯示


gnome-shell-3.26.1/js/ui/messageTray.js:802:    notify: function(notification) {
gnome-shell-3.26.1/js/ui/status/network.js:1739:    _notify: function(iconName, title, text, urgency) {
gnome-shell-3.26.1/js/ui/components/telepathyClient.js:591:    notify: function() {
gnome-shell-3.26.1/src/shell-perf-log.c:589: * @notify: function to call when @user_data is no longer needed
gnome-shell-3.26.1/src/shell-global.c:1679: * @notify: function to call to free @user_data





執行


$ grep 'notifyError: function' gnome-shell-3.26.1/* -R -n



沒有顯示

================================================================================

# Picker 按鈕

在「Looking Glass」左上方有兩個按鈕,左方數來第一個按鈕,按下後,
可以在畫面點選某物件,就會出現在「Evaluator」,
然後就可以「inpect」該物件。

================================================================================

接下來在另一篇介紹「import.searchPath」。

================================================================================

[回到索引]

2017/10/30 21:23
應用擴展 工具箱
回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引]

================================================================================

# 關於「imports.searchPath」

================================================================================

## 文件

* https://wiki.gnome.org/Projects/Gjs/StyleGuide#Imports
* https://wiki.gnome.org/Projects/GnomeShell/Gjs_StyleGuide#Imports

================================================================================

## gjs

在「Terminal」下,

產生一個檔「test.js」,內容如下



#!/usr/bin/env gjs

print(imports.searchPath.length);

for (let path of imports.searchPath) {
	print(path);
}




然後執行


$ gjs test.js



顯示


resource:///org/gnome/gjs/modules/
/usr/share/ubuntu-xorg/gjs-1.0
/usr/share/ubuntu-xorg/gjs-1.0
/home/user/.local/share/flatpak/exports/share/gjs-1.0
/var/lib/flatpak/exports/share/gjs-1.0
/usr/local/share/gjs-1.0
/usr/share/gjs-1.0
/var/lib/snapd/desktop/gjs-1.0
/usr/share/gjs-1.0



或是也可以先執行「chmod u+x test.js」,然後再執行「./test.js」也會出現上面的結果。


================================================================================

## Looking Glass

在「Looking Glass / Evaluator」,

執行下面指令



for (let path of imports.searchPath) {
	log(path);
}





執行


$ tail /var/log/syslog -n 50



就可以在「/var/log/syslog」找到如下的訊息


Oct 30 09:35:25 my-host gnome-shell[865]: resource:///org/gnome/shell
Oct 30 09:35:25 my-host gnome-shell[865]: resource:///org/gnome/gjs/modules/
Oct 30 09:35:25 my-host gnome-shell[865]: /usr/share/ubuntu-xorg/gjs-1.0
Oct 30 09:35:25 my-host gnome-shell[865]: /usr/share/ubuntu-xorg/gjs-1.0
Oct 30 09:35:25 my-host gnome-shell[865]: /home/user/.local/share/flatpak/exports/share/gjs-1.0
Oct 30 09:35:25 my-host gnome-shell[865]: /var/lib/flatpak/exports/share/gjs-1.0
Oct 30 09:35:25 my-host gnome-shell[865]: /usr/local/share/gjs-1.0
Oct 30 09:35:25 my-host gnome-shell[865]: /usr/share/gjs-1.0
Oct 30 09:35:25 my-host gnome-shell[865]: /var/lib/snapd/desktop/gjs-1.0
Oct 30 09:35:25 my-host gnome-shell[865]: /usr/share/gjs-1.0




因為呼叫log,換行會被改寫成「#012」,
可以測試「log("-\n-")」,
在「/var/log/syslog」看到「Oct 30 09:54:49 my-host gnome-shell[865]: -#012-」


所以改寫一下程式



var list = '';
for (let path of imports.searchPath) {
	list += path;
	list += "\n";
}

imports.gi.GLib.file_set_contents("/tmp/lg-search-path.log", list);




執行


$ cat /tmp/lg-search-path.log



顯示


resource:///org/gnome/shell
resource:///org/gnome/gjs/modules/
/usr/share/ubuntu-xorg/gjs-1.0
/usr/share/ubuntu-xorg/gjs-1.0
/home/user/.local/share/flatpak/exports/share/gjs-1.0
/var/lib/flatpak/exports/share/gjs-1.0
/usr/local/share/gjs-1.0
/usr/share/gjs-1.0
/var/lib/snapd/desktop/gjs-1.0
/usr/share/gjs-1.0



執行



log('lg-search-path: ' + JsParse.getCompletions('imports.searchPath.', imports.ui.lookingGlass.commandHeader, AUTO_COMPLETE_GLOBAL_KEYWORDS));





Oct 30 10:06:25 my-host gnome-shell[865]: lg-search-path: __defineGetter__, __defineSetter__, __lookupGetter__, __lookupSetter__, concat, constructor, copyWithin, entries, every, fill, filter, find, findIndex, forEach, hasOwnProperty, includes, indexOf, isPrototypeOf, join, keys, lastIndexOf, length, map, pop, propertyIsEnumerable, push, reduce, reduceRight, reverse, shift, slice, some, sort, splice, toLocaleString, toSource, toString, unshift, unwatch, valueOf, watch,




關於「imports.searchPath」應該是「Array」,

參考「MDN / javscript / typeof (中文)」裡面的說明,


在「Looking Glass / Evaluator」,

執行


typeof imports.searchPath



會得到


r(15) = object



執行


Array.isArray(imports.searchPath)



會得到


r(16) = true



執行


Object.prototype.toString.call(imports.searchPath)



會得到


r(17) = [object Array]



所以「imports.searchPath」的用法,就可以參考「MDN / Javascript / Array(中文)」。

實作的原始碼,應該是要從「gjs/gjs/importer.cpp」探索起。

================================================================================


## 範例一

在「Terminal」,

執行下面指令,產生「/tmp/js/lg」這個資料夾。


$ mkdir /tmp/js/lg -p



執行下面指令,產生「/tmp/js/lg/agent.js」這個檔案。



cat > /tmp/js/lg/agent.js <<EOF

const Main = imports.ui.main;

function hi() {
    Main.notify("Hello!");
}

EOF




執行下面指令,觀看「/tmp/js/lg/agent.js」這個檔案的內容


$ cat /tmp/js/lg/agent.js



顯示



const Main = imports.ui.main;

function hi() {
    Main.notify("Hello!");
}





================================================================================

在「Looking Glass / Evaluator」,

執行下面指令


imports.searchPath.push('/tmp/js/lg');



顯示


r(20) = 11



執行下面指令


imports.agent.hi();



在「Evaluator Pane」會顯示


r(21) = undefined



在畫面上方中間,則會跳出一個提示訊息對話框,顯示「Hello」。

然後可以先輸入「imports.agent.」,再連續按下兩次「Tab」鍵,就會看到如下的資訊


__defineGetter__, __defineSetter__, __file__, __lookupGetter__, __lookupSetter__, __moduleName__, __modulePath__, __parentModule__, constructor, hasOwnProperty, hi, isPrototypeOf, propertyIsEnumerable, toLocaleString, toSource, toString, unwatch, valueOf, watch,



上面資訊,可以執行下面指令獲得。


log('lg-agent: ' + JsParse.getCompletions('imports.agent.', imports.ui.lookingGlass.commandHeader, AUTO_COMPLETE_GLOBAL_KEYWORDS));



接著繼續在「Looking Glass / Evaluator」執行下面指令


imports.agent.__file__;



顯示


r(23) = /tmp/js/lg/agent.js



執行下面指令


imports.agent.__moduleName__;



顯示


r(24) = agent



執行下面指令


imports.agent.__modulePath__;



顯示


r(25) = agent



================================================================================

## 範例二


在「Terminal」,

執行下面指令,產生「/tmp/js/gjs/lib」這個資料夾。


$ mkdir /tmp/js/gjs/lib -p



執行下面指令,產生「/tmp/js/gjs/lib/agent.js」這個檔案。



cat > /tmp/js/gjs/lib/agent.js <<EOF

const Notify = imports.gi.Notify;

function hi() {

    Notify.init('Hello world');

    let notify = new Notify.Notification({
        summary: 'Hello world!',
        body: 'This is an example of notifications.',
        'icon-name': 'dialog-information'
	});

	notify.show();

}

EOF





執行下面指令,觀看「/tmp/js/gjs/lib/agent.js」這個檔案的內容


$ cat /tmp/js/gjs/lib/agent.js



顯示



const Notify = imports.gi.Notify;

function hi() {

    Notify.init('Hello world');

    let notify = new Notify.Notification({
        summary: 'Hello world!',
        body: 'This is an example of notifications.',
        'icon-name': 'dialog-information'
	});

	notify.show();

}





上面程式碼,是參考自

* https://wiki.archlinux.org/index.php/Desktop_notifications#Usage_in_programming


================================================================================

接下來,要來測試載入剛剛產生的模組「/tmp/js/gjs/lib/agent.js」。

在「Terminal」,

執行下面指令,產生「/tmp/js/gjs/lib」這個資料夾。


$ mkdir /tmp/js/gjs/lib -p



執行下面指令,產生「/tmp/js/gjs/main.js」這個檔案。



cat > /tmp/js/gjs/main.js <<EOF
#!/usr/bin/env gjs

imports.searchPath.push('/tmp/js/gjs/lib');

imports.agent.hi();

EOF




執行下面指令,觀看「/tmp/js/gjs/main.js」這個檔案的內容


$ cat /tmp/js/gjs/main.js



顯示



#!/usr/bin/env gjs

imports.searchPath.push('/tmp/js/gjs/lib');

imports.agent.hi();




直接執行


$ gjs /tmp/js/gjs/main.js



或是執行下面指令,更改成可執行


$ chmod u+x /tmp/js/gjs/main.js



然後就可以執行下面指令


$ /tmp/js/gjs/main.js




就會在畫面上方中間,出現一個提示訊息對話框。

================================================================================

## 範例三

接續著「範例二」,除了可以使用「imports.searchPath」,還有一個環境變數「GJS_PATH」可以善用。
關於「GJS_PATH」可以在「gjs/gjs/importer.cpp」找到相關的實作。


執行下面指令,產生「/tmp/js/gjs/call.js」這個檔案。



cat > /tmp/js/gjs/call.js <<EOF
#!/usr/bin/env gjs

imports.agent.hi();

EOF




執行下面指令,觀看「/tmp/js/gjs/call.js」這個檔案的內容


$ cat /tmp/js/gjs/call.js



顯示



#!/usr/bin/env gjs

imports.agent.hi();




直接執行


$ gjs /tmp/js/gjs/call.js



顯示


(gjs:2632): Gjs-WARNING **: JS ERROR: ImportError: No JS module 'agent' found in search path
@/tmp/js/gjs/call.js:3:1

JS_EvaluateScript() failed



加上「GJS_PATH」這個環境變數。

執行下面指令


$ GJS_PATH=/tmp/js/gjs/lib gjs /tmp/js/gjs/call.js



這樣就會正常運作了,也就是畫面上方會出現提示訊息對話框。

下面兩種寫法也可以


$ env GJS_PATH=/tmp/js/gjs/lib gjs /tmp/js/gjs/call.js






$ /usr/bin/env GJS_PATH=/tmp/js/gjs/lib gjs /tmp/js/gjs/call.js



接著一樣把「/tmp/js/gjs/call.js」改為可執行

執行下面指令


$ chmod u+x /tmp/js/gjs/call.js



一樣直接執行


$ /tmp/js/gjs/call.js



會顯示


(gjs:2703): Gjs-WARNING **: JS ERROR: ImportError: No JS module 'agent' found in search path
@/tmp/js/gjs/call.js:3:1

JS_EvaluateScript() failed



加上環境變數


GJS_PATH=/tmp/js/gjs/lib /tmp/js/gjs/call.js



就會正常運作了

下面兩種寫法,一樣可行


env GJS_PATH=/tmp/js/gjs/lib /tmp/js/gjs/call.js






/usr/bin/env GJS_PATH=/tmp/js/gjs/lib /tmp/js/gjs/call.js



接下來,不想一直重複輸入那麼長的指令,也可以把剛剛的指令寫在「shell script」裡。

執行下面指令,產生一個檔案「/tmp/js/gjs/call.sh」


cat > /tmp/js/gjs/call.sh <<EOF
#!/usr/bin/env bash

GJS_PATH=/tmp/js/gjs/lib /tmp/js/gjs/call.js

EOF



執行下面指令,將「/tmp/js/gjs/call.sh」設定為可執行。


$ chmod u+x /tmp/js/gjs/call.sh



接著就可以執行


$ /tmp/js/gjs/call.sh




接下來,除了可以將「/tmp/js/gjs/」附加到「PATH」的環境變數的作法。
可以在「/etc/environment」修改。

也可以作一個「symbolic link」連到「/tmp/js/gjs/call.sh」
將該「symbolic link」放在「PATH」這個環境變數包含的路徑裡,

執行


$ echo $PATH



顯示


/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin



第一個「/home/user/bin」應該是在「~/.profile」附加的,
其餘後面的則是在「/etc/environment」,
若是有其他的,就要看您的環境,在何處有再額外設定PATH這個環境變數了。

建議放置的地方,有下面兩個

* 個人區域:「~/bin」
* 系統全域:「/usr/local/bin」


以放在「~/bin」為例,


執行下面指令,產生「~/bin/demo」


$ ln -s /tmp/js/gjs/call.sh ~/bin/demo



執行下面指令確認(這個步驟不是非必須)


$ file ~/bin/demo



顯示


/home/user/bin/demo: symbolic link to /tmp/js/gjs/call.sh



這時候我們就可以直接執行下面指令


$ demo



就會出現提示訊息對話框。

整個流程,順序就是「dmeo」 -> 「~/bin/dmeo」-> 「/tmp/js/gjs/call.sh」-> 「/tmp/js/gjs/call.js」->「/tmp/js/gjs/lib/agent.js」。

接著將「~/bin/demo」刪除,


$ rm ~/bin/demo



然後以放在「/usr/local/bin」為例

執行下面指令,產生「/usr/local/bin/demo」


$ sudo ln -s /tmp/js/gjs/call.sh /usr/local/bin/demo



執行下面指令確認(這個步驟不是非必須)


$ file /usr/local/bin/demo



顯示


/usr/local/bin/demo: symbolic link to /tmp/js/gjs/call.sh



這時候就可以執行下面指令


$ demo



就會出現提示訊息對話框。

整個流程,順序就是「dmeo」 -> 「/usr/local/bin/demo」-> 「/tmp/js/gjs/call.sh」-> 「/tmp/js/gjs/call.js」->「/tmp/js/gjs/lib/agent.js」。


在進一步,也可以產生「Desktop Entry」。

建議放置為的資料夾如下

* 個人區域: ~/.local/share/applications
* 系統全域: /usr/share/applications

執行下面指令,產生「~/.local/share/applications/demo.desktop」



mkdir ~/.local/share/applications -p

cat > ~/.local/share/applications/demo.desktop <<EOF
[Desktop Entry]
Type=Application
Name=Demo
Comment=Demo Desktop Application
Exec=demo
Icon=application-x-executable
Terminal=false

EOF




然後在「Activities / Search」或是「Activities / All Applications」那裡就可以找到「啟動圖示」。

整個流程,順序就是「~/.local/share/applications/demo.desktop」 -> 「dmeo」 -> 「~/bin/dmeo」-> 「/tmp/js/gjs/call.sh」-> 「/tmp/js/gjs/call.js」->「/tmp/js/gjs/lib/agent.js」。


================================================================================

執行


$ apt-get download gnome-shell



執行


$ dpkg -x gnome-shell_3.26.1-0ubuntu5_amd64.deb gnome-shell




執行


$ grep 'resource:///org/gnome/shell' gnome-shell/* -R



顯示


Binary file gnome-shell/usr/lib/gnome-shell/libgnome-shell.so matches
Binary file gnome-shell/usr/lib/gnome-shell/gnome-shell-portal-helper matches
Binary file gnome-shell/usr/bin/gnome-shell-extension-prefs matches



可以執行「vi /usr/lib/gnome-shell/libgnome-shell.so」然後捲到下方,就可以看到一些「javascript」的「code」。
其他兩個檔案也是如此。

================================================================================


執行


$ apt-get source gnome-shell



執行


$ grep 'resource:///org/gnome/shell' gnome-shell-3.26.1/* -R -n



顯示


...略...
gnome-shell-3.26.1/debian/ubuntu-session-mods/ubuntu.css:1788:  background: #2c001e url(resource:///org/gnome/shell/theme/noise-texture.png);
gnome-shell-3.26.1/js/gdm/authPrompt.js:132:        let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
gnome-shell-3.26.1/js/ui/calendar.js:1063:        let todayFile = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/no-notifications.svg');
gnome-shell-3.26.1/js/ui/calendar.js:1064:        let otherFile = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/no-events.svg');
gnome-shell-3.26.1/js/ui/background.js:500:        let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/noise-texture.png');
gnome-shell-3.26.1/js/ui/padOsd.js:308:        let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/pad-osd.css');
gnome-shell-3.26.1/js/ui/main.js:243:    stylesheet = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/' + name);
gnome-shell-3.26.1/js/ui/status/network.js:899:        let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
gnome-shell-3.26.1/js/ui/components/polkitAgent.js:115:        let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
gnome-shell-3.26.1/js/ui/components/keyring.js:117:            let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
gnome-shell-3.26.1/src/gnome-shell-extension-prefs.c:12:  const char *search_path[] = { "resource:///org/gnome/shell", NULL };
gnome-shell-3.26.1/src/gnome-shell-portal-helper.c:12:  const char *search_path[] = { "resource:///org/gnome/shell", NULL };
gnome-shell-3.26.1/src/shell-global.c:323:      search_path[0] = g_strdup ("resource:///org/gnome/shell");




執行


$ grep 'resource:///org/gnome/shell' gnome-shell-3.26.1/src/shell-global.c -n -A 9 -B 91



* https://github.com/GNOME/gnome-shell/blob/master/src/shell-global.c#L323

================================================================================

執行


$ tree gnome-shell-3.26.1/js/



顯示


gnome-shell-3.26.1/js/
├── extensionPrefs
│   └── main.js
├── gdm
│   ├── authPrompt.js
│   ├── batch.js
│   ├── fingerprint.js
│   ├── loginDialog.js
│   ├── oVirt.js
│   ├── realmd.js
│   └── util.js
├── js-resources.gresource.xml
├── meson.build
├── misc
│   ├── config.js.in
│   ├── desktop.js
│   ├── extensionUtils.js
│   ├── fileUtils.js
│   ├── gnomeSession.js
│   ├── history.js
│   ├── ibusManager.js
│   ├── jsParse.js
│   ├── keyboardManager.js
│   ├── loginManager.js
│   ├── meson.build
│   ├── modemManager.js
│   ├── objectManager.js
│   ├── params.js
│   ├── permissionStore.js
│   ├── smartcardManager.js
│   ├── systemActions.js
│   ├── util.js
│   └── weather.js
├── perf
│   ├── core.js
│   └── hwtest.js
├── portalHelper
│   └── main.js
└── ui
    ├── accessDialog.js
    ├── altTab.js
    ├── animation.js
    ├── appDisplay.js
    ├── appFavorites.js
    ├── audioDeviceSelection.js
    ├── background.js
    ├── backgroundMenu.js
    ├── boxpointer.js
    ├── calendar.js
    ├── checkBox.js
    ├── closeDialog.js
    ├── components
    │   ├── automountManager.js
    │   ├── autorunManager.js
    │   ├── __init__.js
    │   ├── keyring.js
    │   ├── networkAgent.js
    │   ├── polkitAgent.js
    │   └── telepathyClient.js
    ├── ctrlAltTab.js
    ├── dash.js
    ├── dateMenu.js
    ├── dialog.js
    ├── dnd.js
    ├── edgeDragAction.js
    ├── endSessionDialog.js
    ├── environment.js
    ├── extensionDownloader.js
    ├── extensionSystem.js
    ├── focusCaretTracker.js
    ├── grabHelper.js
    ├── ibusCandidatePopup.js
    ├── iconGrid.js
    ├── inhibitShortcutsDialog.js
    ├── keyboard.js
    ├── layout.js
    ├── lightbox.js
    ├── lookingGlass.js
    ├── magnifierDBus.js
    ├── magnifier.js
    ├── main.js
    ├── messageList.js
    ├── messageTray.js
    ├── modalDialog.js
    ├── mpris.js
    ├── notificationDaemon.js
    ├── osdMonitorLabeler.js
    ├── osdWindow.js
    ├── overviewControls.js
    ├── overview.js
    ├── padOsd.js
    ├── panel.js
    ├── panelMenu.js
    ├── pointerWatcher.js
    ├── popupMenu.js
    ├── remoteMenu.js
    ├── remoteSearch.js
    ├── runDialog.js
    ├── screencast.js
    ├── screenShield.js
    ├── screenshot.js
    ├── scripting.js
    ├── search.js
    ├── sessionMode.js
    ├── shellDBus.js
    ├── shellEntry.js
    ├── shellMountOperation.js
    ├── slider.js
    ├── status
    │   ├── accessibility.js
    │   ├── bluetooth.js
    │   ├── brightness.js
    │   ├── keyboard.js
    │   ├── location.js
    │   ├── network.js
    │   ├── nightLight.js
    │   ├── power.js
    │   ├── rfkill.js
    │   ├── screencast.js
    │   ├── system.js
    │   └── volume.js
    ├── switcherPopup.js
    ├── switchMonitor.js
    ├── tweener.js
    ├── unlockDialog.js
    ├── userWidget.js
    ├── viewSelector.js
    ├── windowAttentionHandler.js
    ├── windowManager.js
    ├── windowMenu.js
    ├── workspace.js
    ├── workspacesView.js
    ├── workspaceSwitcherPopup.js
    ├── workspaceThumbnail.js
    └── xdndHandler.js

8 directories, 126 files




================================================================================

在「Looking Glass / Evaluator」,

執行下面指令


imports.ui.main.__file__



顯示


r(30) = resource:///org/gnome/shell/ui/main.js



其他的依此類推


* imports.ui.main.__file__ <=> resource:///org/gnome/shell/ui/main.js
* imports.ui.environment.__file__ <=> resource:///org/gnome/shell/ui/environment.js
* imports.ui.lookingGlass.__file__ <=> resource:///org/gnome/shell/ui/lookingGlass.js
* imports.ui.runDialog.__file__ <=> resource:///org/gnome/shell/ui/runDialog.js
* imports.misc.fileUtils.__file__ <=> resource:///org/gnome/shell/misc/fileUtils.js

然後對到「gnome-shell」的「Source Package」。

* imports.ui.main <=> gnome-shell-3.26.1/js/ui/main.js
* imports.ui.environment <=> gnome-shell-3.26.1/js/ui/environment.js
* imports.ui.lookingGlass <=> gnome-shell-3.26.1/js/ui/lookingGlass.js
* imports.ui.runDialog <=> gnome-shell-3.26.1/js/ui/runDialog.js
* imports.misc.fileUtils <=> gnome-shell-3.26.1/js/misc/fileUtils.js


舉例來說

在「Looking Glass / Evaluator」執行,


imports.ui.main.openRunDialog()



就會顯示一個對話框,這個對話框,跟按下「<Alt>+F2」出現的對話框是一樣的。

從上面歸納的「imports.ui.main <=> gnome-shell-3.26.1/js/ui/main.js」。

在「Terminal」,執行下面指令,


$ grep 'function openRunDialog' gnome-shell-3.26.1/js/ui/main.js -A 5



顯示


function openRunDialog() {
    if (runDialog == null) {
        runDialog = new RunDialog.RunDialog();
    }
    runDialog.open();
}



執行


$ grep 'const RunDialog' gnome-shell-3.26.1/js/ui/main.js



顯示


const RunDialog = imports.ui.runDialog;




執行


$ grep 'var RunDialog' gnome-shell-3.26.1/js/ui/runDialog.js -n -A 5



顯示


33:var RunDialog = new Lang.Class({
34- Name: 'RunDialog',
35- Extends: ModalDialog.ModalDialog,
36-
37- _init : function() {
38- this.parent({ styleClass: 'run-dialog',




* https://github.com/GNOME/gjs/blob/master/modules/lang.js
* https://github.com/GNOME/gjs/blob/master/modules/_legacy.js
關於「Lang.Class」請見下方的「## imports.lang」。


================================================================================

另外一個例子,


在「Looking Glass / Evaluator」,

執行下面指令



imports.ui.main.createLookingGlass().toggle()



就會將「Looking Glass」關閉。


在「Terminal」,執行下面指令,


$ grep 'function createLookingGlass' gnome-shell-3.26.1/js/ui/main.js -A 5



顯示


function createLookingGlass() {
    if (lookingGlass == null) {
        lookingGlass = new LookingGlass.LookingGlass();
    }
    return lookingGlass;
}




執行


$ grep 'const LookingGlass' gnome-shell-3.26.1/js/ui/main.js



顯示


const LookingGlass = imports.ui.lookingGlass;



執行


$ grep 'var LookingGlass' gnome-shell-3.26.1/js/ui/lookingGlass.js -n -A 5



顯示


777:var LookingGlass = new Lang.Class({
778-    Name: 'LookingGlass',
779-
780-    _init : function() {
781-        this._borderPaintTarget = null;
782-        this._redBorderEffect = new RedBorderEffect();




* https://github.com/GNOME/gjs/blob/master/modules/lang.js
* https://github.com/GNOME/gjs/blob/master/modules/_legacy.js
關於「Lang.Class」請見下方的「## imports.lang」。

另外一個額外的發現

在「Terminal」,執行下面指令,


$ grep 'createLookingGlass' gnome-shell-3.26.1/js/* -R -n



顯示


gnome-shell-3.26.1/js/ui/main.js:510:function createLookingGlass() {
gnome-shell-3.26.1/js/ui/runDialog.js:50:                                       Main.createLookingGlass().open();




執行


$ grep 'createLookingGlass' gnome-shell-3.26.1/js/ui/runDialog.js -A 18 -B 3



顯示


        this._internalCommands = { 'lg':
                                   Lang.bind(this, function() {
                                       Main.createLookingGlass().open();
                                   }),

                                   'r': Lang.bind(this, this._restart),

                                   // Developer brain backwards compatibility
                                   'restart': Lang.bind(this, this._restart),

                                   'debugexit': Lang.bind(this, function() {
                                       Meta.quit(Meta.ExitCode.ERROR);
                                   }),

                                   // rt is short for "reload theme"
                                   'rt': Lang.bind(this, function() {
                                       Main.reloadThemeResource();
                                       Main.loadTheme();
                                   })
                                 };




還記得

* 按下「<Alt>+F2」,然後輸入「lg」,呼叫起「Looking Glass」。
* 按下「<Alt>+F2」,然後輸入「r」,重新啟動「gnome-shell」。


================================================================================

額外一提一個例子,這也是我開始寫這麼多篇的契機。


$ grep 'ibus-daemon' gnome-shell-3.26.1/* -R



顯示


gnome-shell-3.26.1/js/misc/ibusManager.js: Gio.Subprocess.new(['ibus-daemon', '--xim', '--panel', 'disable'],
gnome-shell-3.26.1/js/misc/ibusManager.js: log('Failed to launch ibus-daemon: ' + e.message);



================================================================================

接下來拉回正題

執行


$ apt-get download gjs



執行


$ dpkg -x gjs_1.50.1-1_amd64.deb gjs



執行


$ tree gjs



顯示


gjs
└── usr
    ├── bin
    │   ├── gjs -> gjs-console
    │   └── gjs-console
    └── share
        └── doc
            └── gjs
                ├── changelog.Debian.gz -> ../libgjs0g/changelog.Debian.gz
                ├── copyright
                ├── NEWS.gz
                └── README

5 directories, 6 files



執行


$ grep 'GJS_PATH' gjs/* -R



顯示


grep: gjs/usr/share/doc/gjs/changelog.Debian.gz: No such file or directory
Binary file gjs/usr/bin/gjs matches
Binary file gjs/usr/bin/gjs-console matches



執行


$ apt-cache showsrc gjs | grep '^Binary:' -B 3



顯示


Package: gjs
Format: 3.0 (quilt)
Binary: gjs, gjs-tests, libgjs0g, libgjs-dev



執行


$ apt-cache show gnome-shell | grep libgjs



顯示


Depends: libasound2 (>= 1.0.16), libatk-bridge2.0-0 (>= 2.5.3), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.14), libcairo2 (>= 1.14.0), libcanberra-gtk3-0 (>= 0.25), libcanberra0 (>= 0.2), libcroco3 (>= 0.6.2), libdbus-glib-1-2 (>= 0.78), libecal-1.2-19 (>= 3.17), libedataserver-1.2-22 (>= 3.17.2), libgcr-base-3-1 (>= 3.8.0), libgdk-pixbuf2.0-0 (>= 2.22.0), libgirepository-1.0-1 (>= 1.35.9), libgjs0-libmozjs-52-0, libgjs0g (>= 1.50.1), libglib2.0-0 (>= 2.53.0), libgstreamer1.0-0 (>= 1.4.0), libgtk-3-0 (>= 3.21.6), libical2 (>= 2.0.0), libjson-glib-1.0-0 (>= 0.13.2), libmutter-1-0 (>= 3.25.90), libnm-glib4 (>= 0.8.998), libnm-util2 (>= 0.8.998), libpango-1.0-0 (>= 1.14.0), libpangocairo-1.0-0 (>= 1.14.0), libpolkit-agent-1-0 (>= 0.99), libpolkit-gobject-1-0 (>= 0.94), libpulse-mainloop-glib0 (>= 0.99.1), libpulse0 (>= 0.99.1), libsecret-1-0 (>= 0.7), libstartup-notification0 (>= 0.11), libsystemd0, libx11-6, libxfixes3, caribou (>= 0.4.8), evolution-data-server (>= 3.17.2), gir1.2-accountsservice-1.0, gir1.2-atspi-2.0 (>= 2.9.91), gir1.2-caribou-1.0 (>= 0.4.8), gir1.2-freedesktop, gir1.2-gdesktopenums-3.0 (>= 3.12), gir1.2-geoclue-2.0, gir1.2-gcr-3 (>= 3.7.5), gir1.2-gdm-1.0 (>= 3.18.2), gir1.2-glib-2.0 (>= 1.45.3), gir1.2-gnomebluetooth-1.0 (>= 3.12.0), gir1.2-gnomedesktop-3.0 (>= 3.12.0), gir1.2-gtk-3.0 (>= 3.16), gir1.2-gweather-3.0, gir1.2-ibus-1.0 (>= 1.5.2), gir1.2-mutter-1 (>= 3.26.0), gir1.2-networkmanager-1.0, gir1.2-nmgtk-1.0 (>= 0.9.8), gir1.2-pango-1.0, gir1.2-polkit-1.0, gir1.2-rsvg-2.0, gir1.2-soup-2.4 (>= 2.40.1), gir1.2-upowerglib-1.0 (>= 0.99), gjs (>= 1.47.90), gnome-settings-daemon (>= 3.16.0), gnome-shell-common (= 3.26.1-0ubuntu5), ubuntu-wallpapers, gsettings-desktop-schemas (>= 3.21.3), mutter (>= 3.26.1-2ubuntu2~), python3, libglib2.0-bin (>= 2.53.0)



執行


$ dpkg -l libgjs0g



顯示


Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-======================================-========================-========================-======
ii libgjs0g 1.50.1-1 amd64 Mozilla-based javascript bindings for the GNOME platform



執行


$ dpkg -l libgjs0-libmozjs-52-0



顯示


Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-======================================-========================-========================-======
un libgjs0-libmozjs-52-0 <none> <none> (no description available)



執行


$ apt-cache show libgjs0-libmozjs-52-0



顯示


N: Can't select versions from package 'libgjs0-libmozjs-52-0' as it is purely virtual
N: No packages found



執行


$ apt-cache show libgjs0g



顯示


Package: libgjs0g
Architecture: amd64
Version: 1.50.1-1
Priority: optional
Section: libs
Source: gjs
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 878
Provides: libgjs0-libmozjs-52-0
Depends: libc6 (>= 2.14), libcairo-gobject2 (>= 1.10.0), libcairo2 (>= 1.10.0), libffi6 (>= 3.0.4), libgcc1 (>= 1:3.0), libgirepository-1.0-1 (>= 1.41.4), libglib2.0-0 (>= 2.50.0), libgtk-3-0 (>= 3.0.0), libmozjs-52-0, libreadline7 (>= 6.0), libstdc++6 (>= 5), libx11-6, gir1.2-glib-2.0, gir1.2-gtk-3.0
Conflicts: libgjs0, libgjs0a, libgjs0b, libgjs0c, libgjs0d, libgjs0e, libgjs0f
Replaces: libgjs0, libgjs0a, libgjs0b, libgjs0c, libgjs0d, libgjs0e, libgjs0f
Filename: pool/main/g/gjs/libgjs0g_1.50.1-1_amd64.deb
Size: 233604
MD5sum: 4b03f8fbc9e40d3a5bb76edee67d95c2
SHA1: 39ad13dc16071271cc68ff8fe79c3163b310b7fd
SHA256: 53fd24534080f0a860161c1d7be0697b021c12e1abc684357ff33bd6bdbe41c0
Homepage: https://wiki.gnome.org/Projects/Gjs
Description-en: Mozilla-based javascript bindings for the GNOME platform
Makes it possible for applications to use all of GNOME's platform
libraries using the JavaScript language. It's mainly based on the
Mozilla JavaScript engine and the GObject introspection framework.
.
This is the shared library applications link to.
Description-md5: 5fbf598c66bb05089d9f63d63e1412ff
Task: ubuntu-desktop, ubuntu-usb, edubuntu-desktop, edubuntu-usb, ubuntu-gnome-desktop, ubuntu-budgie-desktop
Supported: 9m





================================================================================

執行


$ apt-get download libgjs0g



執行


$ dpkg -x libgjs0g_1.50.1-1_amd64.deb libgjs0g



執行


$ tree libgjs0g



顯示


libgjs0g
└── usr
    ├── lib
    │   ├── gjs
    │   │   └── girepository-1.0
    │   │       └── GjsPrivate-1.0.typelib
    │   ├── libgjs.so.0 -> libgjs.so.0.0.0
    │   └── libgjs.so.0.0.0
    └── share
        └── doc
            └── libgjs0g
                ├── changelog.Debian.gz
                └── copyright

7 directories, 5 files




執行


$ grep 'GJS_PATH' libgjs0g/* -R



顯示


Binary file libgjs0g/usr/lib/libgjs.so.0.0.0 matches
Binary file libgjs0g/usr/lib/libgjs.so.0 matches



================================================================================


執行


$ apt-get source gjs



執行


$ grep 'GJS_PATH' gjs-1.50.1/* -R -n



顯示


gjs-1.50.1/gjs/importer.cpp:906:        /* $GJS_PATH */
gjs-1.50.1/gjs/importer.cpp:907:        envstr = g_getenv("GJS_PATH");
gjs-1.50.1/gjs/console.cpp:133:                  "the GJS_PATH environment variable.");
gjs-1.50.1/Makefile.in:1349:# GJS_PATH is empty here since we want to force the use of our own
gjs-1.50.1/Makefile.in:1354:	export GJS_PATH=;				\
gjs-1.50.1/Makefile-test.am:298:# GJS_PATH is empty here since we want to force the use of our own
gjs-1.50.1/Makefile-test.am:303:	export GJS_PATH=;				\
gjs-1.50.1/NEWS:661:  the search path, then you should either reorder those arguments, use GJS_PATH,




執行


$ grep '"GJS_PATH"' gjs-1.50.1/gjs/importer.cpp -n -A 43 -B 19



顯示



888-
889-static G_CONST_RETURN char * G_CONST_RETURN *
890-gjs_get_search_path(void)
891-{
892-    char **search_path;
893-
894-    /* not thread safe */
895-
896-    if (!gjs_search_path) {
897-        G_CONST_RETURN gchar* G_CONST_RETURN * system_data_dirs;
898-        const char *envstr;
899-        GPtrArray *path;
900-        gsize i;
901-
902-        path = g_ptr_array_new();
903-
904-        /* in order of priority */
905-
906-        /* $GJS_PATH */
907:        envstr = g_getenv("GJS_PATH");
908-        if (envstr) {
909-            char **dirs, **d;
910-            dirs = g_strsplit(envstr, G_SEARCHPATH_SEPARATOR_S, 0);
911-            for (d = dirs; *d != NULL; d++)
912-                g_ptr_array_add(path, *d);
913-            /* we assume the array and strings are allocated separately */
914-            g_free(dirs);
915-        }
916-
917-        g_ptr_array_add(path, g_strdup("resource:///org/gnome/gjs/modules/"));
918-
919-        /* $XDG_DATA_DIRS /gjs-1.0 */
920-        system_data_dirs = g_get_system_data_dirs();
921-        for (i = 0; system_data_dirs[i] != NULL; ++i) {
922-            char *s;
923-            s = g_build_filename(system_data_dirs[i], "gjs-1.0", NULL);
924-            g_ptr_array_add(path, s);
925-        }
926-
927-        /* ${datadir}/share/gjs-1.0 */
928-#ifdef G_OS_WIN32
929-        extern HMODULE gjs_dll;
930-        char *basedir = g_win32_get_package_installation_directory_of_module (gjs_dll);
931-        char *gjs_data_dir = g_build_filename (basedir, "share", "gjs-1.0", NULL);
932-        g_ptr_array_add(path, g_strdup(gjs_data_dir));
933-        g_free (gjs_data_dir);
934-        g_free (basedir);
935-#else
936-        g_ptr_array_add(path, g_strdup(GJS_JS_DIR));
937-#endif
938-
939-        g_ptr_array_add(path, NULL);
940-
941-        search_path = (char**)g_ptr_array_free(path, false);
942-
943-        gjs_search_path = search_path;
944-    } else {
945-        search_path = gjs_search_path;
946-    }
947-
948-    return (G_CONST_RETURN char * G_CONST_RETURN *)search_path;
949-}
950-




* https://github.com/GNOME/gjs/blob/master/gjs/importer.cpp#L907

================================================================================

## imports.lang

執行


$ find gjs-1.50.1/ -name lang.js



顯示


gjs-1.50.1/modules/lang.js



執行


$ grep 'Class' gjs-1.50.1/modules/lang.js -n



顯示


2:/* exported Class, Interface, bind, copyProperties, copyPublicProperties,
26:var {Class, Interface, getMetaClass} = imports._legacy;




執行


$ ls gjs-1.50.1/modules/*.js -1



顯示


gjs-1.50.1/modules/cairo.js
gjs-1.50.1/modules/coverage.js
gjs-1.50.1/modules/format.js
gjs-1.50.1/modules/gettext.js
gjs-1.50.1/modules/jsUnit.js
gjs-1.50.1/modules/lang.js
gjs-1.50.1/modules/_legacy.js
gjs-1.50.1/modules/mainloop.js
gjs-1.50.1/modules/package.js
gjs-1.50.1/modules/signals.js



執行


$ grep 'Class' gjs-1.50.1/modules/_legacy.js -n



### Class 相關文件

* https://wiki.gnome.org/Projects/Gjs/StyleGuide#Classes
* https://wiki.gnome.org/Projects/GnomeShell/Gjs_StyleGuide#Classes

### GObject

* https://wiki.gnome.org/Projects/Gjs/StyleGuide#GObject_Introspection
* https://wiki.gnome.org/Projects/Gjs/Mapping

### MDN

* JavaScript Guide / Working with objects

### Gjs

* https://wiki.gnome.org/Projects/Gjs
* https://wiki.gnome.org/Projects/Gjs/StyleGuide
* https://wiki.gnome.org/Projects/Gjs/Documentation
* https://github.com/GNOME/gjs/tree/master/examples
* https://github.com/GNOME/gjs/tree/master/modules
* https://github.com/GNOME/gjs/blob/master/modules/lang.js
* https://github.com/GNOME/gjs/blob/master/modules/_legacy.js

### API

* https://people.gnome.org/~gcampagna/docs/
* http://devdocs.baznga.org/

================================================================================

[回到索引]

2017/10/30 21:42
應用擴展 工具箱
回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引]

================================================================================

# 如何開發「gnome-extension」

================================================================================

## 路徑

* /usr/share/gnome-shell/extensions/
* ~/.local/share/gnome-shell/extensions/

## 工具

* gnome-shell-extension-tool
* gnome-shell-extension-prefs
* gnome-tweak-tool
* gnome-shell

## 文件

* https://wiki.gnome.org/Projects/GnomeShell/Extensions
* https://wiki.gnome.org/Projects/GnomeShell/LookingGlass

## 相關討論

* 如何撰寫Gnome Shell Extension。
* Cinnamon Develop Extension Start (#8 回覆: [分享] Cinnamon 的 使用心得)

================================================================================

## gnome-shell-extension-tool

執行


$ gnome-shell-extension-tool -h




顯示


Usage: gnome-shell-extension-tool [options]

Options:
  -h, --help            show this help message and exit
  -d DISABLE, --disable-extension=DISABLE
                        Disable a GNOME Shell extension
  -e ENABLE, --enable-extension=ENABLE
                        Enable a GNOME Shell extension
  -c, --create-extension
                        Create a new GNOME Shell extension
  -r RELOAD, --reload-extension=RELOAD
                        Reload a GNOME Shell extension




執行


$ gnome-shell-extension-tool -c



會先詢問「Name」


Name should be a very short (ideally descriptive) string.
Examples are: "Click To Focus", "Adblock", "Shell Window Shrinker".

Name: demo




會先詢問「Description」


Description is a single-sentence explanation of what your extension does.
Examples are: "Make windows visible on click", "Block advertisement popups"
"Animate windows shrinking on minimize"

Description: "Uuid"



會先詢問「Uuid」


Uuid is a globally-unique identifier for your extension.
This should be in the format of an email address (foo.bar@extensions.example.com), but
need not be an actual email address, though it's a good idea to base the uuid on your
email address. For example, if your email address is janedoe@example.com, you might
use an extension title clicktofocus@janedoe.example.com.
Uuid [demo@my-host]: demo@home



最後產生


Created extension in '/home/user/.local/share/gnome-shell/extensions/demo@home'




================================================================================


## demo@home

執行下面指令,觀看「~/.local/share/gnome-shell/extensions/demo@home」這個資料夾結構


$ tree ~/.local/share/gnome-shell/extensions/demo@home



顯示


/home/user/.local/share/gnome-shell/extensions/demo@home
├── extension.js
├── metadata.json
└── stylesheet.css

0 directories, 3 files



================================================================================

## metadata.json

執行下面指令,觀看「~/.local/share/gnome-shell/extensions/demo@home/metadata.json」這個檔案的內容


$ cat ~/.local/share/gnome-shell/extensions/demo@home/metadata.json && echo



顯示


{"name": "demo", "description": "\"Demo Extension\"", "uuid": "demo@home", "shell-version": ["3.26.1"]}




================================================================================

## extension.js

執行


$ cat ~/.local/share/gnome-shell/extensions/demo@home/extension.js



顯示



const St = imports.gi.St;
const Main = imports.ui.main;
const Tweener = imports.ui.tweener;

let text, button;

function _hideHello() {
    Main.uiGroup.remove_actor(text);
    text = null;
}

function _showHello() {
    if (!text) {
        text = new St.Label({ style_class: 'helloworld-label', text: "Hello, world!" });
        Main.uiGroup.add_actor(text);
    }

    text.opacity = 255;

    let monitor = Main.layoutManager.primaryMonitor;

    text.set_position(monitor.x + Math.floor(monitor.width / 2 - text.width / 2),
                      monitor.y + Math.floor(monitor.height / 2 - text.height / 2));

    Tweener.addTween(text,
                     { opacity: 0,
                       time: 2,
                       transition: 'easeOutQuad',
                       onComplete: _hideHello });
}

function init() {
    button = new St.Bin({ style_class: 'panel-button',
                          reactive: true,
                          can_focus: true,
                          x_fill: true,
                          y_fill: false,
                          track_hover: true });
    let icon = new St.Icon({ icon_name: 'system-run-symbolic',
                             style_class: 'system-status-icon' });

    button.set_child(icon);
    button.connect('button-press-event', _showHello);
}

function enable() {
    Main.panel._rightBox.insert_child_at_index(button, 0);
}

function disable() {
    Main.panel._rightBox.remove_child(button);
}




================================================================================

## stylesheet.css

執行


$ cat ~/.local/share/gnome-shell/extensions/demo@home/stylesheet.css



顯示


.helloworld-label {
    font-size: 36px;
    font-weight: bold;
    color: #ffffff;
    background-color: rgba(10,10,10,0.7);
    border-radius: 5px;
    padding: .5em;
}



================================================================================

## 如何啟用

執行


$ gnome-shell-extension-tool -e demo@home



顯示


'demo@home' is now enabled.




然後需要重新啟動「gnome-shell」,下面提供三種方式。

* 第一種方式,只要鍵盤按下「<Alt>+<F2>」,然後再輸入「r」,按下鍵盤「Enter」。

* 第二種方式,就是在「Terminal」,執行「gnome-shell -r」。

* 第三種方式,登出系統,然後再登入系統。

註:

* 第一種方式,在「Wayland Session」無法有作用,會出現「Restart is not available on Wayland」這樣的提示訊息。
所以建議要測試時,可以在登入的時候,「Session」選擇「Ubuntu on Xorg」。
* 第二種方式,在「Wayland Session」,則為顯示「(gnome-shell:2789): mutter-WARNING **: Can't initialize KMS backend: Could not get session ID: No such file or directory」這樣的提示訊息。
* 有一種方式,我測試「gnome-shell-extension-tool -r demo@home」目前發現沒作用,這部份尚未再去深究。

================================================================================

除了使用「gnome-shell-extension-tool」這個工具來「啟用」「停用」「extension」

也可以改用「gnome-shell-extension-prefs」或是「gnome-tweak-tools」來「啟用」「停用」「extension」。

================================================================================

當啟用「demo@home」成功後,

就會在「Top Bar」看到一個設定圖示的按鈕,按了之後,
就會在畫面的正中間,顯示「Hello, world!」的提示訊息。


================================================================================

## 進一步測試

執行下面的指令,修改「~/.local/share/gnome-shell/extensions/demo@home/extension.js」的內容。



cat > ~/.local/share/gnome-shell/extensions/demo@home/extension.js <<EOF

const Main = imports.ui.main;

log("demo@home load");
Main.notify("demo@home load");

function init() {
    log("demo@home init");
    Main.notify("demo@home init");
}

function enable() {
    log("demo@home enable");
    Main.notify("demo@home enable");
}

function disable() {
    log("demo@home disable");
    Main.notify("demo@home disable");
}

EOF




執行下面指令,觀看更改後的內容


$ cat ~/.local/share/gnome-shell/extensions/demo@home/extension.js



顯示



const Main = imports.ui.main;

log("demo@home load");
Main.notify("demo@home load");

function init() {
    log("demo@home init");
    Main.notify("demo@home init");
}

function enable() {
    log("demo@home enable");
    Main.notify("demo@home enable");
}

function disable() {
    log("demo@home disable");
    Main.notify("demo@home disable");
}





================================================================================

## 測試

### 重新啟動「gnome-shell」

接著一樣要重新啟動「gnome-shell」,採用第一種方式「<Alt>+F2」,然後輸入「r」。(我在「Ubuntu on Xorg」的環境測試)

重新啟動後,

就會先看到「demo@home load」的提示對話框,按下關閉後,

接著就會看到「demo@home init」的提示對話框,按下關閉後,

接著就會看到「demo@home enable」的提示對話框,按下關閉。

### 測試「disable」

執行


$ gnome-shell-extension-tool -d demo@home



在「Terminal」會顯示「'demo@home' is now disabled.」。
在畫面上方中間會出現「demo@home disable」的提示對話框。


### 測試「enable」

執行


$ gnome-shell-extension-tool -e demo@home



在「Terminal」會顯示「'demo@home' is now enabled.」。
在畫面上方中間會出現「demo@home enable」的提示對話框。

### 測試「reload」

執行


$ gnome-shell-extension-tool -r demo@home



會有反應,
但是若是先改了「extension.js」原始碼的訊息內容,然後再執行上面的指令,雖然會有反應
但是顯示提示的訊息,並沒有改變,感覺只是重新載入舊的。

所以在「reload」這個動作,我目前都還是執行「<Alt>+<F2>」,然後輸入「r」來達成。

經驗裡,有時候在測的時候,系統好像會錯亂,導致有些不是預期的狀況發生,
所以有時候我就會登出登入,再測看看,
再不然就是重新開機。
當然有時候是自己的Code寫錯導致的,寫的邏輯不是預期的。
所以要耐心地去釐清出錯的關鍵點在何處。


================================================================================

然後剛剛的測試,也可以在「/var/log/syslog」這個檔案,看到相關的「log」紀錄,

可以執行下面的指令觀看。


$ grep 'demo@home' /var/log/syslog



================================================================================

以上只是提供入門,因為我也只有研究到這裡了 :p

其他的就要參考其他人寫好的「extension」了。
在「#34」,有套件列表,是套件庫預設有提供的。

也許可以從「gnome-shell-extension-tilix-dropdown(GitHub)」這個套件探索起,下面的「#40」會提到這個套件。


其餘的就可從下面的網址開始找起。

### gnome-shell-extensions

* https://extensions.gnome.org/
* https://github.com/GNOME/gnome-shell-extensions
* https://github.com/gcampax/gnome-shell-extensions
* https://packages.ubuntu.com/artful/gnome-shell-extensions

### 文件

* https://wiki.gnome.org/Projects/GnomeShell/Extensions
* https://wiki.gnome.org/Projects/GnomeShell/LookingGlass

### gnome-shell

* https://github.com/GNOME/gnome-shell/tree/master/js

### gjs

* https://github.com/GNOME/gjs/tree/master/modules
註: 關於「gjs」,我在「#32」的下方,有列一些參考連結。

### cinnamon

* https://cinnamon-spices.linuxmint.com/extensions
* https://github.com/linuxmint

================================================================================

接下來要探索『如何透過安裝套件的方式,安裝額外的「gnome-extension」』。

================================================================================

[回到索引]

2017/10/30 21:52
應用擴展 工具箱
回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引]

================================================================================

# 如何透過安裝套件的方式,安裝額外的「gnome-shell-extension」

================================================================================

## 探索開始

執行


$ apt-cache search gnome-shell-extension



顯示


gnome-shell-extension-appindicator - App indicators for GNOME Shell
gnome-shell-extension-ubuntu-dock - Ubuntu Dock for GNOME Shell
gnome-shell-extension-autohidetopbar - GNOME shell automatic topbar hider
gnome-shell-extension-better-volume - GNOME Shell extension that improves volume control
gnome-shell-extension-caffeine - GNOME Shell extension to keep your computer awake
gnome-shell-extension-dash-to-panel - combines the dash and the GNOME main panel into a single panel
gnome-shell-extension-dashtodock - dash-to-dock extension for GNOME shell
gnome-shell-extension-disconnect-wifi - disconnect wifi extension for GNOME shell
gnome-shell-extension-hard-disk-led - Shows harddisk activity (IO speed read/write and LED) in GNOME Shell
gnome-shell-extension-hide-activities - GNOME shell extension that hides the activities button
gnome-shell-extension-impatience - speed up the gnome-shell animation speed
gnome-shell-extension-log-out-button - Adds a log out button to the system action list in GNOME Shell
gnome-shell-extension-mediaplayer - GNOME Shell extension to control media players
gnome-shell-extension-move-clock - move clock extension for GNOME shell
gnome-shell-extension-multi-monitors - Better support for additional monitors in GNOME shell
gnome-shell-extension-onboard - GNOME Shell extension for the on-screen keyboard Onboard
gnome-shell-extension-pixelsaver - pixel saver extension for GNOME shell
gnome-shell-extension-redshift - redshift extension for GNOME Shell
gnome-shell-extension-remove-dropdown-arrows - removes drop down arrows from panel on GNOME shell
gnome-shell-extension-shortcuts - Creates a shortcuts help pop-up in GNOME Shell
gnome-shell-extension-show-ip - Shows the current private or public IP address
gnome-shell-extension-suspend-button - Gnome-shell extension to modify the suspend/shutdown buttons
gnome-shell-extension-system-monitor - Display system information in GNOME Shell status bar
gnome-shell-extension-taskbar - TaskBar Extension for GNOME Shell
gnome-shell-extension-tilix-dropdown - launch tilix in quake-mode from gnome-shell
gnome-shell-extension-top-icons-plus - GNOME Shell extension to move system tray icons to top bar
gnome-shell-extension-trash - trash applet for GNOME shell
gnome-shell-extension-weather - weather extension for GNOME Shell
gnome-shell-extensions - Extensions to extend functionality of GNOME Shell
gnome-shell-extensions-gpaste - GPaste extension for GNOME Shell
variety - Wallpaper changer, downloader and manager




執行


$ apt-cache search gnome-shell-extension | cut -d ' ' -f 1 | grep gnome-shell-extension



顯示


gnome-shell-extension-appindicator
gnome-shell-extension-ubuntu-dock
gnome-shell-extension-autohidetopbar
gnome-shell-extension-better-volume
gnome-shell-extension-caffeine
gnome-shell-extension-dash-to-panel
gnome-shell-extension-dashtodock
gnome-shell-extension-disconnect-wifi
gnome-shell-extension-hard-disk-led
gnome-shell-extension-hide-activities
gnome-shell-extension-impatience
gnome-shell-extension-log-out-button
gnome-shell-extension-mediaplayer
gnome-shell-extension-move-clock
gnome-shell-extension-multi-monitors
gnome-shell-extension-onboard
gnome-shell-extension-pixelsaver
gnome-shell-extension-redshift
gnome-shell-extension-remove-dropdown-arrows
gnome-shell-extension-shortcuts
gnome-shell-extension-show-ip
gnome-shell-extension-suspend-button
gnome-shell-extension-system-monitor
gnome-shell-extension-taskbar
gnome-shell-extension-tilix-dropdown
gnome-shell-extension-top-icons-plus
gnome-shell-extension-trash
gnome-shell-extension-weather
gnome-shell-extensions
gnome-shell-extensions-gpaste



或是也可以執行「$ apt-cache pkgnames gnome-shell-extension


================================================================================

## 套件列表

* gnome-shell-extension-appindicator
* gnome-shell-extension-ubuntu-dock
* gnome-shell-extension-autohidetopbar
* gnome-shell-extension-better-volume
* gnome-shell-extension-caffeine
* gnome-shell-extension-dash-to-panel
* gnome-shell-extension-dashtodock
* gnome-shell-extension-disconnect-wifi
* gnome-shell-extension-hard-disk-led
* gnome-shell-extension-hide-activities
* gnome-shell-extension-impatience
* gnome-shell-extension-log-out-button
* gnome-shell-extension-mediaplayer
* gnome-shell-extension-move-clock
* gnome-shell-extension-multi-monitors
* gnome-shell-extension-onboard
* gnome-shell-extension-pixelsaver
* gnome-shell-extension-redshift
* gnome-shell-extension-remove-dropdown-arrows
* gnome-shell-extension-shortcuts
* gnome-shell-extension-show-ip
* gnome-shell-extension-suspend-button
* gnome-shell-extension-system-monitor
* gnome-shell-extension-taskbar
* gnome-shell-extension-tilix-dropdown
* gnome-shell-extension-top-icons-plus
* gnome-shell-extension-trash
* gnome-shell-extension-weather
* gnome-shell-extensions
* gnome-shell-extensions-gpaste


上面列表的BBCode原始碼,是執行下面指令產生的。


$ apt-cache search gnome-shell-extension | awk -F ' - ' '{printf "* %s\n", $1, $1}'



或是也可以執行下面指令產生


#!/usr/bin/env bash

for PACKAGE in $(apt-cache search gnome-shell-extension | cut -d ' ' -f 1 | grep gnome-shell-extension) ; do 
	#echo $PACKAGE
	echo "* $PACKAGE"
done




================================================================================

也可以執行下面的指令


$ apt-cache search gnome-shell-extension | awk -F ' - ' '{printf "$ sudo apt-get install %s\n", $1}'



或是執行下面的指令


#!/usr/bin/env bash

for PACKAGE in $(apt-cache search gnome-shell-extension | cut -d ' ' -f 1 | grep gnome-shell-extension) ; do 
	#echo $PACKAGE
	echo "$ sudo apt-get install $PACKAGE"
done



產生下面的列表


$ sudo apt-get install gnome-shell-extension-appindicator
$ sudo apt-get install gnome-shell-extension-ubuntu-dock
$ sudo apt-get install gnome-shell-extension-autohidetopbar
$ sudo apt-get install gnome-shell-extension-better-volume
$ sudo apt-get install gnome-shell-extension-caffeine
$ sudo apt-get install gnome-shell-extension-dash-to-panel
$ sudo apt-get install gnome-shell-extension-dashtodock
$ sudo apt-get install gnome-shell-extension-disconnect-wifi
$ sudo apt-get install gnome-shell-extension-hard-disk-led
$ sudo apt-get install gnome-shell-extension-hide-activities
$ sudo apt-get install gnome-shell-extension-impatience
$ sudo apt-get install gnome-shell-extension-log-out-button
$ sudo apt-get install gnome-shell-extension-mediaplayer
$ sudo apt-get install gnome-shell-extension-move-clock
$ sudo apt-get install gnome-shell-extension-multi-monitors
$ sudo apt-get install gnome-shell-extension-onboard
$ sudo apt-get install gnome-shell-extension-pixelsaver
$ sudo apt-get install gnome-shell-extension-redshift
$ sudo apt-get install gnome-shell-extension-remove-dropdown-arrows
$ sudo apt-get install gnome-shell-extension-shortcuts
$ sudo apt-get install gnome-shell-extension-show-ip
$ sudo apt-get install gnome-shell-extension-suspend-button
$ sudo apt-get install gnome-shell-extension-system-monitor
$ sudo apt-get install gnome-shell-extension-taskbar
$ sudo apt-get install gnome-shell-extension-tilix-dropdown
$ sudo apt-get install gnome-shell-extension-top-icons-plus
$ sudo apt-get install gnome-shell-extension-trash
$ sudo apt-get install gnome-shell-extension-weather
$ sudo apt-get install gnome-shell-extensions



================================================================================

## 單一安裝

以安裝「gnome-shell-extension-shortcuts」這個套件為例。


$ sudo apt-get install gnome-shell-extension-shortcuts



================================================================================

## 全部安裝

執行下面指令


$ sudo apt-get install $(apt-cache search gnome-shell-extension | cut -d ' ' -f 1 | grep gnome-shell-extension)




================================================================================

## 選用安裝

先執行下面指令,產生一個檔案「package.list」


$ apt-cache search gnome-shell-extension | cut -d ' ' -f 1 | grep gnome-shell-extension > package.list



然後執行下面指令,編輯「package.list」


$ vi package.list



刪除不想安裝套件的那行。

最後再執行下面指令安裝。


$ sudo apt-get install $(cat package.list)




================================================================================

## 安裝完後套件,如何確認是否已經安裝

以安裝「gnome-shell-extension-shortcuts」這個套件為例。

執行下面指令,安裝「gnome-shell-extension-shortcuts」這個套件。


$ sudo apt-get install gnome-shell-extension-shortcuts



安裝完畢後,可以執行下面指令確認


$ dpkg -l gnome-shell-extension-shortcuts



顯示


Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/[/color] Name                                   Version                  Architecture             Description
+++-======================================-========================-========================-======
ii  gnome-shell-extension-shortcuts        1.1.0-1                  all                      Creates a shortcuts help pop-up in GNOME Shell



或是也可以執行下面指令確認


$ dpkg --get-selections | grep gnome-shell-extension-shortcuts



若是已經安裝,會顯示如下


gnome-shell-extension-shortcuts install



然後可以執行下面指令,了解到這個套件有安裝那些檔案在系統上


$ dpkg -L gnome-shell-extension-shortcuts



顯示


/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/gnome-shell-extension-shortcuts
/usr/share/doc/gnome-shell-extension-shortcuts/changelog.Debian.gz
/usr/share/doc/gnome-shell-extension-shortcuts/copyright
/usr/share/gnome-shell
/usr/share/gnome-shell/extensions
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/convenience.js
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/extension.js
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/locale
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/locale/LINGUAS
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/locale/Shortcuts.pot
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/locale/af
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/locale/af/LC_MESSAGES
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/locale/af/LC_MESSAGES/af.mo
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/locale/af/LC_MESSAGES/af.po
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/metadata.json
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/prefs.js
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/schemas
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/schemas/gschemas.compiled
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/shortcuts.json
/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za/stylesheet.css



可以了解到「gnome-shell-extension-shortcuts」這個套件,裡面包含的「gnome extension」,
安裝在「/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za」這個資料夾。

執行


$ tree /usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za



顯示


/usr/share/gnome-shell/extensions/Shortcuts@kyle.aims.ac.za
├── convenience.js
├── extension.js
├── locale
│ ├── af
│ │ └── LC_MESSAGES
│ │ ├── af.mo
│ │ └── af.po
│ ├── LINGUAS
│ └── Shortcuts.pot
├── metadata.json
├── prefs.js
├── schemas
│ └── gschemas.compiled
├── shortcuts.json
└── stylesheet.css

4 directories, 11 files




================================================================================

上面列的套件,裡面包含的「gnome extension」,
應該都是安裝在「/usr/share/gnome-shell/extensions」這個資料夾。

可以執行下面指令,觀看「/usr/share/gnome-shell/extensions」這個資料夾。


$ ls /usr/share/gnome-shell/extensions -1



================================================================================

安裝完畢後,

鍵盤按下「<Alt>+<F2>」,會跳出一個「Enter Command」的對話框,

然後在該對話框,輸入「r」,重新啟動「gnome-shell」。

上面這個方式在,「Wayland Session」是無效的。

所以就必須要「登出系統」再「登入」。

接著可以透過「gnome-shell-extension-prefs」這個工具來「啟用」或「停用」「Extension」。

若有安裝「gnome-tweak-tool」這個套件,
執行「gnome-tweak-tool」,在「Extensions」那個頁簽,也會顯示「gnome-shell-extension-prefs」的畫面。

執行「gnome-shell-extension-prefs」的方式,

一種方式,可以先開啟「Terminal」,快速鍵是「<Ctrl>+<Alt>+T」,然後就可以輸入「gnome-shell-extension-prefs」,接著鍵盤按下「Enter」。

另一種方式,鍵盤按下「<Alt>+<F2>」,會跳出一個「Enter Command」的對話框,然後輸入「gnome-shell-extension-prefs」,接著鍵盤按下「Enter」。


在「Activities / Search」那無法搜尋到。

原因出在「/usr/share/applications/gnome-shell-extension-prefs.desktop」這個檔案的設定,


執行


$ grep NoDisplay /usr/share/applications/gnome-shell-extension-prefs.desktop -B 1



顯示


OnlyShowIn=GNOME;
NoDisplay=true




可以執行下面指令,將「/usr/share/applications/gnome-shell-extension-prefs.desktop」
複製到「~/.local/share/applications/gnome-shell-extension-prefs.desktop 」,然後修改。


mkdir ~/.local/share/applications/ -p
cp /usr/share/applications/gnome-shell-extension-prefs.desktop ~/.local/share/applications/
sed -i 's/NoDisplay=true/NoDisplay=false/g' ~/.local/share/applications/gnome-shell-extension-prefs.desktop



執行下面指令,確認是否修改了「~/.local/share/applications/gnome-shell-extension-prefs.desktop 」


$ grep NoDisplay ~/.local/share/applications/gnome-shell-extension-prefs.desktop



顯示


OnlyShowIn=GNOME;
NoDisplay=false



這樣就可以在在「Activities / Search」那輸入「Shell」那關鍵字,就可以找到「gnome-shell-extension-prefs」的「啟動圖示」。

================================================================================

關於「gnome-shell-extension-prefs」是屬於「gnome-shell」這個套件。

執行


$ dpkg -L gnome-shell | grep gnome-shell-extension-prefs



顯示


/usr/bin/gnome-shell-extension-prefs
/usr/share/applications/gnome-shell-extension-prefs.desktop



執行


$ dpkg -S gnome-shell-extension-prefs



顯示


gnome-shell: /usr/bin/gnome-shell-extension-prefs
gnome-shell: /usr/share/applications/gnome-shell-extension-prefs.desktop



或是也可以執行


$ apt-file search gnome-shell-extension-prefs



顯示


app-install-data: /usr/share/app-install/desktop/gnome-shell:gnome-shell-extension-prefs.desktop
gnome-shell: /usr/bin/gnome-shell-extension-prefs
gnome-shell: /usr/share/applications/gnome-shell-extension-prefs.desktop
...略...




================================================================================

## 我目前安裝的套件

執行


$ dpkg -l '*gnome-shell-extension*' | grep '^ii'



顯示


ii  gnome-shell-extension-appindicator   17.10.1                 all          App indicators for GNOME Shell
ii  gnome-shell-extension-shortcuts      1.1.0-1                 all          Creates a shortcuts help pop-up in GNOME Shell
ii  gnome-shell-extension-system-monitor 32-3                    all          Display system information in GNOME Shell status bar
ii  gnome-shell-extension-taskbar        56.0-1                  all          TaskBar Extension for GNOME Shell
ii  gnome-shell-extension-tilix-dropdown 5.1-1                   all          launch tilix in quake-mode from gnome-shell
ii  gnome-shell-extension-ubuntu-dock    0.7                     all          Ubuntu Dock for GNOME Shell
ii  gnome-shell-extension-weather        0~20170402.git34506a6-1 all          weather extension for GNOME Shell
ii  gnome-shell-extensions               3.26.1-1                all          Extensions to extend functionality of GNOME Shell



執行


$ dpkg -l '*gnome-shell-extension*' | grep '^ii' | cut -d ' ' -f 3



顯示


gnome-shell-extension-appindicator
gnome-shell-extension-shortcuts
gnome-shell-extension-system-monitor
gnome-shell-extension-taskbar
gnome-shell-extension-tilix-dropdown
gnome-shell-extension-ubuntu-dock
gnome-shell-extension-weather
gnome-shell-extensions



上面列表的BBCode原始碼,是執行下面指令產生的。


#!/usr/bin/env bash

for PACKAGE in $(dpkg -l '*gnome-shell-extension*' | grep '^ii' | cut -d ' ' -f 3) ; do 
	#echo $PACKAGE
	echo "$PACKAGE"
done



也可以執行下面指令產生


$ dpkg -l '*gnome-shell-extension*' | grep '^ii' | awk -F ' ' '{printf "%s\n", $2, $2}'




================================================================================

## gnome-shell-extensions


要注意,關於「gnome-shell-extensions」這個套件,裡面包含了多個套件。

在還沒安裝之前,可以下載「deb檔」下來,先解開來探索。
或是到「GitHub」上觀看。

執行


$ apt-get download gnome-shell-extensions



會下載一個檔案「gnome-shell-extensions_3.26.1-1_all.deb」。

執行下面指令解開


$ dpkg -x gnome-shell-extensions_3.26.1-1_all.deb gnome-shell-extensions



會產生一個資料夾「gnome-shell-extensions」。


執行


$ ls gnome-shell-extensions/usr/share/gnome-shell/extensions/ -1



顯示


alternate-tab@gnome-shell-extensions.gcampax.github.com
apps-menu@gnome-shell-extensions.gcampax.github.com
auto-move-windows@gnome-shell-extensions.gcampax.github.com
drive-menu@gnome-shell-extensions.gcampax.github.com
launch-new-instance@gnome-shell-extensions.gcampax.github.com
native-window-placement@gnome-shell-extensions.gcampax.github.com
places-menu@gnome-shell-extensions.gcampax.github.com
screenshot-window-sizer@gnome-shell-extensions.gcampax.github.com
user-theme@gnome-shell-extensions.gcampax.github.com
window-list@gnome-shell-extensions.gcampax.github.com
windowsNavigator@gnome-shell-extensions.gcampax.github.com
workspace-indicator@gnome-shell-extensions.gcampax.github.com



上面列表的BBCode原始碼,是執行下面指令產生的。


#!/usr/bin/env bash

for PACKAGE in $(ls gnome-shell-extensions/usr/share/gnome-shell/extensions/ -1) ; do 
	##echo $PACKAGE
	PAK_NAME=$(echo $PACKAGE | cut -d '@' -f 1)
	PAK_VENDOR=$(echo $PACKAGE | cut -d '@' -f 2)
	PAK_FULLNAME="$PAK_NAME@$PAK_VENDOR"
	echo "$PAK_FULLNAME"
done



或是執行下面指令產生


$ ls gnome-shell-extensions/usr/share/gnome-shell/extensions/ -1 | awk -F '@' '{printf "%s@%s\n", $1, $2}'



執行下面指令,則是可以觀看「gnome-shell-extensions/usr/share/gnome-shell/extensions/」的資料夾結構。


$ tree gnome-shell-extensions/usr/share/gnome-shell/extensions/



顯示


gnome-shell-extensions/usr/share/gnome-shell/extensions/
├── alternate-tab@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ ├── prefs.js
│ └── stylesheet.css
├── apps-menu@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ └── stylesheet.css
├── auto-move-windows@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ ├── prefs.js
│ └── stylesheet.css
├── drive-menu@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ └── stylesheet.css
├── launch-new-instance@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ └── stylesheet.css
├── native-window-placement@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ └── stylesheet.css
├── places-menu@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ ├── placeDisplay.js
│ └── stylesheet.css
├── screenshot-window-sizer@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ └── stylesheet.css
├── user-theme@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ └── stylesheet.css
├── window-list@gnome-shell-extensions.gcampax.github.com
│ ├── classic.css
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ ├── prefs.js
│ └── stylesheet.css
├── windowsNavigator@gnome-shell-extensions.gcampax.github.com
│ ├── convenience.js
│ ├── extension.js
│ ├── metadata.json
│ └── stylesheet.css
└── workspace-indicator@gnome-shell-extensions.gcampax.github.com
├── convenience.js
├── extension.js
├── metadata.json
├── prefs.js
└── stylesheet.css

12 directories, 54 files



================================================================================

[回到索引]

2017/10/30 22:04
應用擴展 工具箱
回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引] - [備份連結]

================================================================================

# 如何查詢「gedit」的快速鍵

================================================================================

先執行「gedit」,

然後在系統的上方「TopBar」,點選「gedit」的「Applicaion Menu」,會出現一個下拉選單,

有一個選項「Keyboard Shortcuts」,點選它,

就會出現一個標題為「Shortcuts」的視窗。

下方有三個按鈕「1」,「2」,「3」,按下可以切換不同頁面。

左上方有一個「搜尋圖示」的按鈕,按下後,就會出現一個「文字輸入框」,在那輸入關鍵字,就會顯示相關的。

================================================================================

[回到索引] - [備份連結]

2017/10/30 22:06
應用擴展 工具箱
回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引] - [備份連結]

================================================================================

# 如何透過安裝套件的方式,安裝額外的「gedit-plugin」

================================================================================

## 測試環境

執行


$ gedit --version



顯示


gedit - Version 3.22.1



執行


$ dpkg -l gedit



顯示


Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-======================================-========================-========================-=====
ii gedit 3.22.1-1ubuntu1 amd64 official text editor of the GNOME desktop environment



================================================================================

## 探索起點

執行


$ apt-cache search gedit-plugin



顯示


gedit-plugin-bookmarks - Bookmarks plugin for gedit
gedit-plugin-bracket-completion - Bracket Completion plugin for gedit
gedit-plugin-character-map - Character Map plugin for gedit
gedit-plugin-code-comment - Code Comment plugin for gedit
gedit-plugin-color-picker - Color Picker plugin for gedit
gedit-plugin-color-schemer - Color Schemer plugin for gedit
gedit-plugin-commander - Commander plugin for gedit
gedit-plugin-dashboard - Dashboard plugin for gedit
gedit-plugin-draw-spaces - Draw Spaces plugin for gedit
gedit-plugin-find-in-files - Find in Files plugin for gedit
gedit-plugin-git - Git plugin for gedit
gedit-plugin-join-lines - Join/Split Lines plugin for gedit
gedit-plugin-multi-edit - Multi Edit plugin for gedit
gedit-plugin-smart-spaces - Smart Spaces plugin for gedit
gedit-plugin-synctex - SyncTex plugin for gedit
gedit-plugin-terminal - Terminal plugin for gedit
gedit-plugin-text-size - Text Size plugin for gedit
gedit-plugin-word-completion - Word Completion plugin for gedit
gedit-plugin-zeitgeist - Zeitgeist plugin for gedit
gedit-plugins - set of plugins for gedit
gedit-plugins-common - common files for gedit-plugins



================================================================================

## 單一安裝

舉例

執行下面指令安裝「gedit-plugin-find-in-files


$ sudo apt-get install gedit-plugin-find-in-files



然後在系統的上方「TopBar」,點選「gedit」的「Applicaion Menu」,會出現一個下拉選單,

有一個選項「Preferences」,點選它,

就會出現一個標題為「Preferences」的設定視窗,有四個頁簽(tab),分別是


* View
* Editor
* Font & Colors
* Plugins

選「Plugins」,切換到該頁簽的內容,

就可以找到一個選項

標題:「Find in Files」
簡述:「Find text in all files of a folder」

勾選這個選項,就可以啟用「gedit-plugin-find-in-files (Find in Files)」這個「gedit-plugin」。

接著請把「Preferences」這個視窗關閉。

然後在「gedit」的主視窗,右上方,有一個「三條橫槓」圖示的「按鈕」,
按下後,就會出現一個下拉選單,可以看到其中有一個選項「Find in Files...」,
點選「Find in Files...」這個選項,就會跳出一個標題為「Find in Files...」的對話框。

================================================================================

## 全部安裝


執行下面指令


$ sudo apt-get install gedit-plugins



安裝「gedit-plugins」這套件,就會安裝所有的「gedit-plugin」。

可以執行下面指令,就可以了解到會安裝那些「gedit-plugin」。


$ apt-cache show gedit-plugins | grep '^Depends:'



顯示


Depends: gedit-plugin-bookmarks, gedit-plugin-bracket-completion, gedit-plugin-character-map, gedit-plugin-code-comment, gedit-plugin-color-picker, gedit-plugin-color-schemer, gedit-plugin-commander, gedit-plugin-dashboard, gedit-plugin-draw-spaces, gedit-plugin-find-in-files, gedit-plugin-git, gedit-plugin-join-lines, gedit-plugin-multi-edit, gedit-plugin-smart-spaces, gedit-plugin-synctex, gedit-plugin-terminal, gedit-plugin-word-completion, gedit-plugin-zeitgeist



執行下面指令,拆成列表來觀看


$ apt-cache show gedit-plugins | grep '^Depends:' | awk -F ': ' '{print $2}' | sed 's/, /\n/g'



顯示


gedit-plugin-bookmarks
gedit-plugin-bracket-completion
gedit-plugin-character-map
gedit-plugin-code-comment
gedit-plugin-color-picker
gedit-plugin-color-schemer
gedit-plugin-commander
gedit-plugin-dashboard
gedit-plugin-draw-spaces
gedit-plugin-find-in-files
gedit-plugin-git
gedit-plugin-join-lines
gedit-plugin-multi-edit
gedit-plugin-smart-spaces
gedit-plugin-synctex
gedit-plugin-terminal
gedit-plugin-word-completion
gedit-plugin-zeitgeist



上面連結列表的原始碼,則是執行下面指令產生的。



$ apt-cache show gedit-plugins | grep '^Depends:' | awk -F ': ' '{print $2}' | sed 's/, /\n/g' | awk '{printf "%s\n", $1, $1}'



或是執行下面指令


#!/usr/bin/env bash

for PACKAGE in $(apt-cache show gedit-plugins | grep '^Depends:' | awk -F ': ' '{print $2}' | sed 's/, /\n/g'); do 
	#echo $PACKAGE
	echo "$PACKAGE"
done



================================================================================

## Source Package: gedit-plugins

執行


$ apt-cache showsrc gedit-plugin-find-in-files | grep '^Binary:' -B 2



顯示


Package: gedit-plugins
Format: 3.0 (quilt)
Binary: gedit-plugins, gedit-plugins-common, gedit-plugin-bookmarks, gedit-plugin-bracket-completion, gedit-plugin-character-map, gedit-plugin-code-comment, gedit-plugin-color-picker, gedit-plugin-color-schemer, gedit-plugin-commander, gedit-plugin-dashboard, gedit-plugin-draw-spaces, gedit-plugin-find-in-files, gedit-plugin-git, gedit-plugin-join-lines, gedit-plugin-multi-edit, gedit-plugin-smart-spaces, gedit-plugin-synctex, gedit-plugin-terminal, gedit-plugin-text-size, gedit-plugin-word-completion, gedit-plugin-zeitgeist



可以了解到這些單一套件,都是來自於「gedit-plugins」這個「Source Package」。

================================================================================

## Package: gedit-plugins-common

而其中有一個套件「gedit-plugins-common」,當安裝這些單一套件,就會一併安裝。


$ apt-cache show gedit-plugin-find-in-files | grep '^Depends:'



顯示


Depends: libc6 (>= 2.14), libglib2.0-0 (>= 2.35.9), libgtk-3-0 (>= 3.11.5), libgtksourceview-3.0-1 (>= 3.21.3), libpeas-1.0-0 (>= 1.7.0), gedit (>= 3.22), gedit-plugins-common (>= 3.22.0-2)



執行


$ apt-cache rdepends gedit-plugins-common



顯示


gedit-plugins-common
Reverse Depends:
  gedit-plugin-bookmarks
  gedit-plugin-zeitgeist
  gedit-plugin-word-completion
  gedit-plugin-text-size
  gedit-plugin-terminal
  gedit-plugin-synctex
  gedit-plugin-smart-spaces
  gedit-plugin-multi-edit
  gedit-plugin-join-lines
  gedit-plugin-git
  gedit-plugin-find-in-files
  gedit-plugin-draw-spaces
  gedit-plugin-dashboard
  gedit-plugin-commander
  gedit-plugin-color-schemer
  gedit-plugin-color-picker
  gedit-plugin-code-comment
  gedit-plugin-character-map
  gedit-plugin-bracket-completion




================================================================================

## Package: gedit-plugin-find-in-files

以安裝「gedit-plugin-find-in-files」為例。

執行


$ dpkg -L gedit-plugin-find-in-files



顯示


/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/gedit
/usr/lib/x86_64-linux-gnu/gedit/plugins
/usr/lib/x86_64-linux-gnu/gedit/plugins/findinfiles.plugin
/usr/lib/x86_64-linux-gnu/gedit/plugins/libfindinfiles.so
/usr/share
/usr/share/doc
/usr/share/doc/gedit-plugin-find-in-files
/usr/share/doc/gedit-plugin-find-in-files/copyright
/usr/share/metainfo
/usr/share/metainfo/gedit-findinfiles.metainfo.xml
/usr/share/doc/gedit-plugin-find-in-files/changelog.Debian.gz




可以注意到三個檔案路徑

* /usr/lib/x86_64-linux-gnu/gedit/plugins/findinfiles.plugin
* /usr/lib/x86_64-linux-gnu/gedit/plugins/libfindinfiles.so
* /usr/share/metainfo/gedit-findinfiles.metainfo.xml

和注意到兩個資料夾路徑

* /usr/lib/x86_64-linux-gnu/gedit/plugins
* /usr/share/metainfo


執行


$ cat /usr/lib/x86_64-linux-gnu/gedit/plugins/findinfiles.plugin



顯示


[Plugin]
Module=findinfiles
IAge=3
Name=Find in Files
Name[ar]=ابحث في الملفات
Name[ca]=Cerca als fitxers
Name[cs]=Hledat v souborech
Name[de]=In Dateien suchen
Name[el]=Εύρεση σε αρχεία
Name[es]=Buscar en archivos
Name[he]=חיפוש בקבצים
Name[hu]=Keresés fájlokban
Name[id]=Cari dalam Berkas
Name[it]=Cerca nei file
Name[ko]=파일에서 찾기
Name[lt]=Rasti failuose
Name[lv]=Meklēt datnēs
Name[pl]=Wyszukiwanie w plikach
Name[pt]=Localizar em ficheiros
Name[pt_BR]=Localizar no Arquivos
Name[sk]=Nájdenie v súboroch
Name[sr]=Пронађи у датотекама
Name[sr@latin]=Pronađi u datotekama
Name[sv]=Sök i filer
Name[th]=หาในแฟ้ม
Name[tr]=Dosyalarda Bul
Name[zh_CN]=在文件中查找
Description=Find text in all files of a folder.
Description[ar]=ابحث عن نص في كل الملفات في مجلد.
Description[ca]=Cerca text en tots els fitxers d'una carpeta.
Description[cs]=Hledá text ve všech souborech ve složce.
Description[de]=Text in allen Dateien eines Ordners suchen.
Description[el]=Εύρεση κειμένου σε όλα τα αρχεία ενός φακέλου.
Description[es]=Buscar texto en todos los archivos o en un carpeta.
Description[he]=מציאת טקסט בכל הקבצים בתיקייה.
Description[hu]=Szöveg keresése egy mappa minden fájljában.
Description[id]=Cari teks dalam semua berkas pada suatu folder.
Description[it]=Cerca il testo in tutti i file di una cartella.
Description[ko]=폴더의 모든 파일에서 문자열 찾기
Description[lt]=Rasti tekstą visuose aplanko failuose.
Description[lv]=Meklēt tekstu visās datnēs un mapēs.
Description[pl]=Wyszukiwanie tekstu we wszystkich plikach w katalogu.
Description[pt]=Localizar texto em todos os ficheiros de uma pasta.
Description[pt_BR]=Localizar texto em todos os arquivos de uma pasta.
Description[sk]=Nájde text vo všetkých súboroch priečinka.
Description[sr]=Пронађите текст у свим датотекама у фасцикли.
Description[sr@latin]=Pronađite tekst u svim datotekama u fascikli.
Description[sv]=Sök text i alla filer för en mapp.
Description[th]=หาข้อความในแฟ้มทั้งหมดของโฟลเดอร์
Description[tr]=Klasörün bütün dosyalarında metin bul.
Description[zh_CN]=在文件夹的所有文件查找文本
Authors=The Lemon Man <thatlemon at google's mail service dot com>
Copyright=Copyright © 2015 The Lemon Man
Website=http://www.gedit.org
Version=3.22.0



執行


$ cat /usr/share/metainfo/gedit-findinfiles.metainfo.xml



顯示


<?xml version="1.0" encoding="UTF-8"?>
<component type="addon">
  <id>gedit-findinfiles</id>
  <extends>org.gnome.gedit.desktop</extends>
  <name>Find in Files</name>
  <summary>Find text in all files of a folder</summary>
  <url type="homepage">https://wiki.gnome.org/Apps/Gedit/ShippedPlugins</url>
  <url type="bugtracker">https://bugzilla.gnome.org/enter_bug.cgi?product=gedit&component=Plugins</url>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>GPL-2.0+</project_license>
  <updatecontact>i.gnatenko.brain@gmail.com</updatecontact>
</component>




執行


$ file /usr/lib/x86_64-linux-gnu/gedit/plugins/libfindinfiles.so



顯示


/usr/lib/x86_64-linux-gnu/gedit/plugins/libfindinfiles.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=e3fe6eba2c6da9d4f9cb897ae8f7670a844415b6, stripped




$ ls /usr/lib/x86_64-linux-gnu/gedit/plugins
$ ls /usr/share/metainfo


執行


$ dpkg -S /usr/lib/x86_64-linux-gnu/gedit/plugins



顯示


gedit-plugin-zeitgeist, gedit-plugin-terminal, gedit-plugin-smart-spaces, gedit-plugin-multi-edit, gedit-plugin-join-lines, gedit-plugin-git, gedit-plugin-draw-spaces, gedit-plugin-commander, gedit, gedit-plugin-word-completion, gedit-plugin-synctex, gedit-plugin-find-in-files, gedit-plugin-dashboard, gedit-plugin-color-schemer, gedit-plugin-color-picker, gedit-plugin-bracket-completion, gedit-plugin-bookmarks, gedit-plugins-common, gedit-plugin-code-comment, gedit-plugin-character-map: /usr/lib/x86_64-linux-gnu/gedit/plugins


可以了解到有那些套件,安裝在「/usr/lib/x86_64-linux-gnu/gedit/plugins」這個資料夾。

================================================================================

[回到索引] - [備份連結]

2017/10/30 22:11
應用擴展 工具箱
回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引] - [備份連結]

================================================================================

# 設定讓「gedit」,可以辨識「big5編碼的檔案」

================================================================================

## 相關討論

* #2 回覆: gedit 亂碼問題
* #3 回覆: GEDIT復製WIN7的TXT檔案打開後變亂碼 (16.04)

## 相關索引

* [索引] 文件編碼

================================================================================

以下測試環境

* gedit: 3.22.1
* gsettings: 2.54.1

================================================================================

## 初步探索

執行


$ gsettings list-recursively | grep gedit | grep encodings



顯示



org.gnome.gedit.preferences.encodings candidate-encodings ['']
org.gnome.gedit.preferences.encodings candidate-encodings ['']
org.gnome.gedit.preferences.encodings candidate-encodings ['']



================================================================================

## get

執行下面指令,觀看「candidate-encodings」目前的設定值


$ gsettings get org.gnome.gedit.preferences.encodings candidate-encodings



顯示


['']




================================================================================

## set

執行下面指令,設定「candidate-encodings」的值


$ gsettings set org.gnome.gedit.preferences.encodings candidate-encodings "['UTF-8', 'BIG5', 'BIG5-HKSCS', 'EUC-TW', 'GB18030', 'GB2312', 'GBK', 'CURRENT', 'ISO-8859-15', 'UTF-16']"




執行下面指令,觀看「candidate-encodings」目前的設定值


$ gsettings get org.gnome.gedit.preferences.encodings candidate-encodings



顯示


['UTF-8', 'BIG5', 'BIG5-HKSCS', 'EUC-TW', 'GB18030', 'GB2312', 'GBK', 'CURRENT', 'ISO-8859-15', 'UTF-16']



================================================================================

## reset

執行下面指令,恢復「candidate-encodings」的預設值


$ gsettings reset org.gnome.gedit.preferences.encodings candidate-encodings




執行下面指令,觀看「candidate-encodings」目前的設定值


$ gsettings get org.gnome.gedit.preferences.encodings candidate-encodings



顯示


['']



================================================================================

關於「candidate-encodings」的預設值,可以在「/usr/share/glib-2.0/schemas/org.gnome.gedit.gschema.xml」這個檔案找到。

執行


$ grep 'candidate-encodings' /usr/share/glib-2.0/schemas/org.gnome.gedit.gschema.xml -B 1 -A 7



顯示


  <schema gettext-domain="gedit" id="org.gnome.gedit.preferences.encodings" path="/org/gnome/gedit/preferences/encodings/">
    <key name="candidate-encodings" type="as">
      <default>['']</default>
      <summary>Candidate Encodings</summary>
      <description>List of candidate encodings shown in the Character Encoding menu in the open/save file chooser.
      "CURRENT" represents the current locale encoding. Only recognized encodings are used.
      The default value is the empty list, in which case gedit will choose good defaults depending on the country and language.</description>
    </key>
  </schema>



若要得到「default value」,除了上面可以「reset」再「get」。

也可以執行下面指令,直接從「/usr/share/glib-2.0/schemas/org.gnome.gedit.gschema.xml」撈取出來。


$ grep 'candidate-encodings' /usr/share/glib-2.0/schemas/org.gnome.gedit.gschema.xml -B 1 -A 7 | grep '<default>' | cut -d '>' -f 2 | cut -d '<' -f 1



顯示


['']



或是執行下面指令,直接從「/usr/share/glib-2.0/schemas/org.gnome.gedit.gschema.xml」撈取出來。


$ grep 'candidate-encodings' /usr/share/glib-2.0/schemas/org.gnome.gedit.gschema.xml -B 1 -A 7 | grep '<default>' | awk -F '<default>' '{print $2}' | awk -F '</default>' '{print $1}'



顯示


['']




================================================================================

上面是透過下指令的方式,來設定「gsettings」。

也可以透過圖形工具來操作,可以透過「dconf-editor」來設定
而「dconf-editor」是屬於「dconf-editor」這個套件。

執行


$ sudo apt-get install dconf-tools



或是執行


$ sudo apt-get install dconf-editor



然後執行「dconf-editor」,使用「candidate-encodings」當關鍵字查詢,就可以找到該筆資料,來維護。

================================================================================

另外在「gedit」那也可以設定,

在「gedit」的主視窗,右上方,有一個「三條橫槓」圖示的「按鈕」,
按下後,就會出現一個下拉選單,可以看到其中有一個選項「Save As...」,
點選「Save As...」這個選項,就會跳出一個對話框。

在對話框左下方有一個選項,「Character Encoding:」,
請先下拉選單,
然後捲動到最下方,會有一個選項「Add or Remove...」,
點選它,就會出現另一個標題為「Character Encoding」的對話框,
在這個對話框,就可以維護(新增,刪除,排序)。


在「gedit」的主視窗,左上方有一個按鈕「Open」,按下後,會出現一個下拉選單,
在下拉選單下方,有一個按鈕「Other Documents...」,按下後,會出現一個標題為「Open」的對話框,
或是也可以直接使用快速鍵「<Ctrl>+o」,一樣會出現標題為「Open」的對話框,
再來的操作步驟,就如同剛剛上面介紹的。

================================================================================

## 測試步驟

執行下面指令,先產生一個檔案「utf-8.txt」。


cat > utf-8.txt <<EOF
測試
中文檔案內容

EOF



執行下面指令,觀看「utf-8.txt」的檔案內容


$ cat utf-8.txt



顯示


測試
中文檔案內容



執行


$ file utf-8.txt



顯示


utf-8.txt: UTF-8 Unicode text




執行下面指令,將「utf-8.txt」的檔案內容,轉成「big5」編碼,並且輸出到「big5.txt」


$ iconv -f utf-8 -t big5 -o big5.txt utf-8.txt



執行下面指令,觀看「big5.txt」的檔案內容


$ cat big5.txt



顯示(亂碼)


����
�����ɮפ��e



執行


$ file big5.txt



顯示


big5.txt: ISO-8859 text



執行


$ sudo apt-get install uchardet python3-chardet



執行


$ uchardet big5.txt



顯示


BIG5



執行


$ chardet3 big5.txt



顯示


big5.txt: Big5 with confidence 0.99



這些工具有紀錄在「[索引] 文件編碼」。

回到正題,

直接點選「big5.txt」用「gedit」打開,可以看到正常顯示,不會出現亂碼
或是也可以直接執行「$ gedit big5.txt」,一樣會用「gedit」開啟「big5.txt」。

================================================================================

[回到索引] - [備份連結]

2017/10/30 22:15
應用擴展 工具箱
回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引] - [備份連結]

================================================================================

# 關於「gedit」的「color scheme」

================================================================================

## 如何找到「org.gnome.gedit.preferences.editor scheme」

執行


$ gsettings list-recursively | grep gedit | grep scheme



顯示


org.gnome.gedit.preferences.editor scheme 'classic'



================================================================================

## get

執行


$ gsettings get org.gnome.gedit.preferences.editor scheme



================================================================================

## set

執行


$ gsettings set org.gnome.gedit.preferences.editor scheme 'oblivion'



我是設定「oblivion」,

也可以透過「Gedit / Application Menu / Preferences / 」的「Font & Colors / Color Scheme」那來設定。

另外下面會有更多的說明,說明如何找到『可用「color scheme」列表』。

================================================================================

## reset

執行


$ gsettings reset org.gnome.gedit.preferences.editor scheme



================================================================================

## 預設值定義

執行


$ grep 'scheme' /usr/share/glib-2.0/schemas/org.gnome.gedit.gschema.xml -A 4



顯示


    <key name="scheme" type="s">
      <default>'classic'</default>
      <summary>Style Scheme</summary>
      <description>The ID of a GtkSourceView Style Scheme used to color the text.</description>
    </key>



================================================================================

## 如何找到「color scheme」的定義檔。

若有安裝「gnome-builder」這個套件,

在「gedit」的「color scheme」也可以設定「builder-dark」或是「builder」。

執行下面指令,設定「builder-dark」。


$ gsettings set org.gnome.gedit.preferences.editor scheme 'builder-dark'



執行下面指令,設定「builder」。


$ gsettings set org.gnome.gedit.preferences.editor scheme 'builder-dark'



回到原本要討論的,如何找到「color scheme」的定義檔。

執行


$ dpkg -L gnome-builder | grep builder-dark



顯示


/usr/share/gtksourceview-3.0/styles/builder-dark.xml



可以找到「/usr/share/gtksourceview-3.0/styles/」這個資料夾

執行


$ ls /usr/share/gtksourceview-3.0/styles/ -1



顯示


builder-dark.xml
builder.xml
classic.xml
cobalt.xml
kate.xml
oblivion.xml
solarized-dark.xml
solarized-light.xml
styles.rng
tango.xml



執行下面指令,了解「/usr/share/gtksourceview-3.0/styles」裡面的檔案,是來自於那些套件。


$ dpkg -S /usr/share/gtksourceview-3.0/styles



顯示


gnome-builder, libgtksourceview-3.0-common: /usr/share/gtksourceview-3.0/styles



表示「/usr/share/gtksourceview-3.0/styles」裡面的檔案,是來自「gnome-builder」和「libgtksourceview-3.0-common」這兩個套件。


執行


$ dpkg -L libgtksourceview-3.0-common | grep styles



顯示


/usr/share/gtksourceview-3.0/styles
/usr/share/gtksourceview-3.0/styles/classic.xml
/usr/share/gtksourceview-3.0/styles/cobalt.xml
/usr/share/gtksourceview-3.0/styles/kate.xml
/usr/share/gtksourceview-3.0/styles/oblivion.xml
/usr/share/gtksourceview-3.0/styles/solarized-dark.xml
/usr/share/gtksourceview-3.0/styles/solarized-light.xml
/usr/share/gtksourceview-3.0/styles/styles.rng
/usr/share/gtksourceview-3.0/styles/tango.xml




所以可以找到「libgtksourceview-3.0-common」這個套件。

因為我一開始在「gedit」和「gedit-common」這兩個套件找尋,並沒有找到「color scheme」的定義檔。

================================================================================

## 可用「color scheme」列表

執行


$ ls /usr/share/gtksourceview-3.0/styles -1 | cut -d '.' -f 1



顯示


builder-dark
builder
classic
cobalt
kate
oblivion
solarized-dark
solarized-light
styles




執行下面指令


$ ls /usr/share/gtksourceview-3.0/styles -1 | awk -F '.' '{printf "$ gsettings set org.gnome.gedit.preferences.editor scheme \x27%s\x27\n", $1}'



或是執行下面指令


#!/usr/bin/env bash

for SCHEME in $(ls /usr/share/gtksourceview-3.0/styles -1 | cut -d '.' -f 1) ; do 
	#echo $SCHEME
	echo '$' "gsettings set org.gnome.gedit.preferences.editor scheme '$SCHEME'"
done



顯示


$ gsettings set org.gnome.gedit.preferences.editor scheme 'builder-dark'
$ gsettings set org.gnome.gedit.preferences.editor scheme 'builder'
$ gsettings set org.gnome.gedit.preferences.editor scheme 'classic'
$ gsettings set org.gnome.gedit.preferences.editor scheme 'cobalt'
$ gsettings set org.gnome.gedit.preferences.editor scheme 'kate'
$ gsettings set org.gnome.gedit.preferences.editor scheme 'oblivion'
$ gsettings set org.gnome.gedit.preferences.editor scheme 'solarized-dark'
$ gsettings set org.gnome.gedit.preferences.editor scheme 'solarized-light'
$ gsettings set org.gnome.gedit.preferences.editor scheme 'styles'
$ gsettings set org.gnome.gedit.preferences.editor scheme 'tango'



================================================================================

[回到索引] - [備份連結]

2017/10/30 22:19
應用擴展 工具箱
回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引]

================================================================================

# gnome-builder

================================================================================

## 安裝

執行下面指令,安裝「gnome-builder


$ sudo apt-get install gnome-builder



================================================================================

[回到索引]

2017/10/30 22:22
應用擴展 工具箱
回覆: Ubuntu 17.10 推出
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30217
EXP: 23
離線
[回到索引]

================================================================================

# 關於「tilix」

================================================================================

發現到在「17.04」的套件庫,預設有提供「tilix (GitHub)」了 。


執行下面指令,安裝「tilix」這個套件。



$ sudo apt-get install tilix




================================================================================

並且還有發現一個「gnome-shell-extension」,套件是「gnome-shell-extension-tilix-dropdown」。

執行


$ apt-cache search tilix



顯示


budgie-desktop-environment - Desktop environment customisation for Ubuntu Budgie
gnome-shell-extension-tilix-dropdown - launch tilix in quake-mode from gnome-shell
terminix - Transitional package (terminix -> tilix)
tilix - Tiling terminal emulator for GNOME
tilix-common - Tiling terminal emulator - data files




執行下面指令,安裝「gnome-shell-extension-tilix-dropdown」這個套件。


$ sudo apt-get install gnome-shell-extension-tilix-dropdown



至於如何啟用新的「Extension」,請參考上面的「#33」和「#34


啟用後,「TopBar」會有一個按鈕,可以呼叫出「Tilix」的「quake」模式。

也可以使用快速鍵,預設應該是「F10」,可以自訂,
可以執行「gnome-tewak-tool」或「gnome-shell-extension-prefs」
找到「Tilix dropdown」,在那有一個設定按鈕,按下之後,就會出現一個新的對話框,在那裡就可以設定。


================================================================================

關於「Tilix」的「quake」模式,只是執行「tilix --quake」這個指令,就會作切換了,
在別的桌面環境,可以設定快速鍵來對應

若沒有安裝「gnome-shell-extension-tilix-dropdown」這個套件。

可以採用這個方式,到「Settings / Keyboard」那設定。

啟動「Settings / Keyboard」的方式如下:

* 方式一: 按下鍵盤「<Super>」鍵,或是左上方的「Activities」按鈕,就會進到「Overview」,
         在「Type to search...」那輸入「keyboard」,就會找到「Settings / Keyboard」的「啟動圖示」。

* 方式二: 按下鍵盤「<Alt>+F2」,會出現「Run Command」對話框,輸入「gnome-control-center keyboard」,
         就會跳出「Keyboard 設定視窗」。

* 方式三: 在「Terminal」執行「$ gnome-control-center keyboard」,就會跳出「Keyboard 設定視窗」。


跳出「Keyboard 設定視窗」後,捲動到最下方,
會有一個「+」的圖示按鈕,按下後,會跳出另一個標題為「Add Custom Shortcut」的對話框。

有兩個欄位可以輸入

* Name: Tilix
* Command: tilix --quake

然後按下「Set Shortcut..」,會切換到另一個畫面「Enter the new shortcut」,按下「F10」,就會回到剛剛輸入欄位的畫面,

就會在「Shortcut」這個欄位,變成「Shortcut: F10」。

然後按下右上角的「Add」按鈕,就會新增一筆設定,在最下方的「Cuttom Shortcuts」。

這時候按下「F10」,就可以測試「tilix --quake」是否會出現。


註: 我個人是設定「F9」。

================================================================================

## Homepage

執行


$ apt-cache show gnome-shell-extension-tilix-dropdown | grep '^Homepage:' | cut -d ' ' -f 2



顯示


https://github.com/ivoarch/gnome-shell-TilixDropdown



執行


$ grep 'url' $(dpkg -L gnome-shell-extension-tilix-dropdown | grep metadata.json) | cut -d ' ' -f 4 | cut -d '"' -f 2



顯示


https://github.com/ivoarch/gnome-shell-TilixDropdown



================================================================================

## Quake

可以參考「Tilix / Documentation / Quake」。

探索「gnome-shell-extension-tilix-dropdown」這個套件。

執行


$ grep 'tilix --quake' $(dpkg -L gnome-shell-extension-tilix-dropdown | grep extension.js) -A 5 -B 3 -n



顯示



40-
41-function _startTilix() {
42-    try {
43:        Main.Util.trySpawnCommandLine('tilix --quake');
44-    } catch(err) {
45-        Main.notify("Couldn't start tilix, is it installed?");
46-    }
47-}
48-





## 快速鍵 (F10)


$ grep 'F10' $(dpkg -L gnome-shell-extension-tilix-dropdown | grep 'schemas\/')



顯示


Binary file /usr/share/gnome-shell/extensions/TilixDropdown@ivkuzev@gmail.com/schemas/gschemas.compiled matches
/usr/share/gnome-shell/extensions/TilixDropdown@ivkuzev@gmail.com/schemas/org.gnome.shell.extensions.tilix-dropdown.gschema.xml: <default><![CDATA[['F10']]]></default>



================================================================================

## integrate with Nautilus

執行


$ dpkg -L tilix-common | grep '\.py$'



顯示


/usr/share/nautilus-python/extensions/open-tilix.py



因為看到了「/usr/share/nautilus-python/extensions/open-tilix.py」這個檔案,但發現好像沒有作用。
所以稍微研究了一下。

執行


$ apt-cache show tilix | grep python



顯示


Suggests: python-nautilus



執行


$ dpkg -l python-nautilus



顯示


Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                   Version                  Architecture             Description
+++-======================================-========================-========================-======
un  python-nautilus                        <none>                   <none>                   (no description available)



發現到「python-nautilus」尚未安裝在系統上。

執行下面指令,觀看「python-nautilus」這個套件相關的資訊。


$ apt-cache show python-nautilus



顯示


Package: python-nautilus
Architecture: amd64
Version: 1.1-4ubuntu1
Priority: optional
Section: universe/gnome
Source: nautilus-python
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 69
Depends: libc6 (>= 2.4), libglib2.0-0 (>= 2.16.0), libgtk-3-0 (>= 3.0.0), libnautilus-extension1a (>= 3.14.1), libpython2.7 (>= 2.7), python-gi (>= 3.0), gir1.2-nautilus-3.0
Filename: pool/universe/n/nautilus-python/python-nautilus_1.1-4ubuntu1_amd64.deb
Size: 17134
MD5sum: 47f85b6ee7ffb185fccaf1391d921ea4
SHA1: a1b762a8a40b68961858191fad70ddef902b1ca0
SHA256: ca846c2a2ece753f18a1fcd95d72e560b359f11b13e64288a52388205e2c0809
Description-en: Python binding for Nautilus components
Python binding for Nautilus, to allow Nautilus property page and menu item
extensions to be written in Python.
Description-md5: 9d9523fc8773b4a14739bb93bd813d94
Task: ubuntu-budgie-desktop



執行下面指令,安裝「python-nautilus」這個套件。


$ sudo apt-get install python-nautilus



然後開啟「nautilus」,在資料夾(目前開啟的,或是資料夾圖示),按下右鍵,出現一個選單,
就會出現「Open Tilix Here」的選項。
點選之後,就會開啟「tilix」,並且切換到該資料夾。

================================================================================

另外額外一提的,我有稍微測試過「Ubuntu Budgie 17.10」,發現預設的「Terminal」是採用「Tilix」。

從上面的「apt-cache search tilix」,
第一筆是「budgie-desktop-environment - Desktop environment customisation for Ubuntu Budgie」

然後再執行


$ apt-cache show budgie-desktop-environment



顯示


Package: budgie-desktop-environment
Architecture: all
Version: 0.8.5
Priority: optional
Section: universe/metapackages
Origin: Ubuntu
Maintainer: David Mohammed <fossfreedom@ubuntu.com>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 118
Depends: budgie-desktop-common, dconf-gsettings-backend | gsettings-backend
Breaks: budgie-desktop-common (<= 0.4.15)
Replaces: budgie-desktop-common
Filename: pool/universe/b/budgie-desktop-environment/budgie-desktop-environment_0.8.5_all.deb
Size: 55150
MD5sum: c238834f68b454355f02cb026e2df92a
SHA1: 8fa3f0102f6aedd63708deec2982e419e964bfff
SHA256: 29c03c54db79dfa13f97ba85c8fdb2e35544ba785dac8a45fb78776fdf104d6e
Homepage: https://github.com/UbuntuBudgie
Description-en: Desktop environment customisation for Ubuntu Budgie
 Installs all Ubuntu Budgie packages, both essential dependencies
 as well as recommended packages and applications.
 Installs:
   Ubuntu Budgie panel configuration
   plank dock customisation
   gsettings overrides
   totem thumbnailer config using ffmpegthumbnailer
   Tilix integration
Description-md5: dfa589b2c807e8746b4856aedb88bee1
Task: ubuntu-budgie-desktop



================================================================================

## 相關文章

* The D Blog / On Tilix and D: An Interview with Gerald Nunn
* Why D is the Perfect Fit for Building GTK Applications (影片) (投影片)
* Learning D and GTK
* Creating Complex Popovers in D and GtkD
* GtkD and Localization
* Using the GAction Framework
* https://gnunn1.github.io/tilix-web/manual/vteconfig/

================================================================================

[回到索引]

2017/10/30 22:48
應用擴展 工具箱

« 1 2 3 (4) 5 6 »

 [無發表權] 請登錄或者註冊


可以查看帖子.
不可發帖.
不可回覆.
不可編輯自己的帖子.
不可刪除自己的帖子.
不可發起投票調查.
不可在投票調查中投票.
不可上傳附件.
不可不經審核直接發帖.