SlideShare a Scribd company logo
1 of 54
Download to read offline
GNOME3 延伸套件教學
講者
●   Yuren Ju <yurenju@gmail.com>
●   Blog: Yuren's Info Area
●   社群:
    ●   Hacking Thursday
    ●   KaLUG
Agenda
●   GNOME3 架構介紹
●   Clutter 介紹
●   GNOME3 延伸套件開發
GNOME3
如何撰寫
GNOME 軟體?
C 語言
Language binding for GNOME




          Vala
Important!
New language binding for GNOME platform

                     Javascript!
https://gist.github.com/986247
Javascript 很酷,但?
GNOME3 的 UI 部分全部採用 Javascript 撰寫
很像 Firefox 吧?
GNOME3 extension
●   採用 Javascript 撰寫
●   可在 runtime 存取 GNOME 原有 UI 元件
    ●   刪除、隱藏、變更等
Shell Toolkit - ST
GNOME3 主要使用的 UI Toolkit


  let label = new St.Label({ text: _("Activities") });
Architecture

                              gnome-shell

                                  Desktop          其他 GNOME
                                components           軟體
                 Javascript
                  C 語言
                              Shell-Toolkit (ST)     GTK+

Only available
in gnome-shell
                                   Clutter

                                繼承

                                  GObject
Clutter
比較


               GTK+

Backend
Clutter Example (1/2)
Clutter Example (2/2)




               https://gist.github.com/984596
Clutter/GObject
●   Introduction
●   Properties
●   Event handler
●   Tweener
Basics
●   所有的 Clutter Application 都包含至少一個
    Stage 物件
    ●   Object: Clutter.Stage
●   Clutter.init()
●   Clutter.main()
●   Every node on the Clutter scene graph is
    an actor.
Basic
Properties

1.




2.

     texture.filename = '<FILENAME>'; //write
     print (texture.reactive);        //read/write




http://docs.clutter-project.org/docs/clutter/stable/ClutterActor.html
Event handler

              actor.connect('signal-name', callback);




http://docs.clutter-project.org/docs/clutter/stable/ClutterActor.html
Tweener
effect properties
●   x, y
●   scale_x, scale_y
●   rotation_angle_
    ●   x, y, z
●   opacity
tweener-example.js




             https://gist.github.com/996712
delay/onComplete




           https://gist.github.com/996736
transition




http://docs.clutter-project.org/docs/clutter/stable/clutter-Implicit-Animations.html
transition




https://gist.github.com/996839
重閱。
gnome-shell
+
GNOME3 Ui 均採用 Javascript 撰寫
好用指令
●   alt + F2, r: 重開 gnome-shell
●   alt + F2, lg: 叫出作弊 console
作弊 console 之 inspector




之後可以用 r(13)
呼叫此物件
作弊之一:觀看 object method
當然,可以看就可以執行 ...
 比如: r(13).set_text("I don't care")
還記得怎麼修改 Clutter properties 吧?
        r(13).rotation_angle_z = 20
建立新的 gnome-shell extension




  gnome-shell-extension-tool --create-extension
三個問題
●   application's...
    ●   name
    ●   description
    ●   uuid
default gnome-shell ext.




                https://gist.github.com/996870
Default extension
    Click panel




 Show Hello world, and destroy after 3sec
Stylesheet – CSS!




但目前並不了解 CSS 支援程度
可參考 /usr/share/gnome-shell/theme/gnome-shell.css
add label to panel




  https://gist.github.com/997093
add button to panel




  https://gist.github.com/997104
PanelButton/PanelMenu
注意!
●   PanelButton, PanelMenu 並不是 Clutter
    Actor
●   而是包裝了 actor 的 button/menu 物件
PanelButton
                                             St.Label
●   prototype 繼承自 Panel.Button
●   宣告要放置於 panel 的物件
                                                    set_child()
    ●   以我們的例子是一個 St.Label
●   在 panelButton 內使用
    this.actor.set_child() 將上述的物           PanelButton
    件嵌入 PanelButton
●   最後創建一個新的物件,將此物件
    加入 Panel 中

                                             St.Label


                                                   add()


                                   panel
PanelButton
PanelMenu
●   建立一個 BoxLayout
●   把 PopupMenuItem 放入 Box 裡面
PanelMenu



https://gist.github.com/997127
End

More Related Content

Similar to GNOME3 延伸套件教學

版本控制 使用Git & git hub
版本控制   使用Git & git hub版本控制   使用Git & git hub
版本控制 使用Git & git hub維佋 唐
 
Gobject - Inherit (Chinese)
Gobject - Inherit (Chinese)Gobject - Inherit (Chinese)
Gobject - Inherit (Chinese)Kai-Feng Chou
 
Git 入门实战
Git 入门实战Git 入门实战
Git 入门实战icy leaf
 
Git 入門與實作
Git 入門與實作Git 入門與實作
Git 入門與實作奕浦 郭
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshellNelson Tai
 
容器與 Gitlab CI 應用
容器與 Gitlab CI 應用容器與 Gitlab CI 應用
容器與 Gitlab CI 應用Philip Zheng
 
看日記學Git
看日記學Git看日記學Git
看日記學GitStanley Ho
 
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹PingLun Liao
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to gitBo-Yi Wu
 
Ian 20150515 grunt
Ian 20150515 gruntIan 20150515 grunt
Ian 20150515 gruntLearningTech
 
张所勇:前端开发工具推荐
张所勇:前端开发工具推荐张所勇:前端开发工具推荐
张所勇:前端开发工具推荐zhangsuoyong
 
Node.js從無到有 基本課程
Node.js從無到有 基本課程Node.js從無到有 基本課程
Node.js從無到有 基本課程Simon Su
 
C++工程实践
C++工程实践C++工程实践
C++工程实践Shuo Chen
 
Clojure cnclojure-meetup
Clojure cnclojure-meetupClojure cnclojure-meetup
Clojure cnclojure-meetupsunng87
 
Git server account management
Git server account managementGit server account management
Git server account managementPingLun Liao
 
Jenkins x GitLab CI
Jenkins x GitLab CIJenkins x GitLab CI
Jenkins x GitLab CIYihsuan Chen
 
Introduction to Golang final
Introduction to Golang final Introduction to Golang final
Introduction to Golang final Paul Chao
 

Similar to GNOME3 延伸套件教學 (20)

Gtk to qt
Gtk to qtGtk to qt
Gtk to qt
 
版本控制 使用Git & git hub
版本控制   使用Git & git hub版本控制   使用Git & git hub
版本控制 使用Git & git hub
 
Gobject - Inherit (Chinese)
Gobject - Inherit (Chinese)Gobject - Inherit (Chinese)
Gobject - Inherit (Chinese)
 
Git 入门实战
Git 入门实战Git 入门实战
Git 入门实战
 
Git 入門與實作
Git 入門與實作Git 入門與實作
Git 入門與實作
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
容器與 Gitlab CI 應用
容器與 Gitlab CI 應用容器與 Gitlab CI 應用
容器與 Gitlab CI 應用
 
看日記學Git
看日記學Git看日記學Git
看日記學Git
 
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Ian 20150515 grunt
Ian 20150515 gruntIan 20150515 grunt
Ian 20150515 grunt
 
张所勇:前端开发工具推荐
张所勇:前端开发工具推荐张所勇:前端开发工具推荐
张所勇:前端开发工具推荐
 
Node.js從無到有 基本課程
Node.js從無到有 基本課程Node.js從無到有 基本課程
Node.js從無到有 基本課程
 
C++工程实践
C++工程实践C++工程实践
C++工程实践
 
Build Your Own Android Toolchain from scratch
Build Your Own Android Toolchain from scratchBuild Your Own Android Toolchain from scratch
Build Your Own Android Toolchain from scratch
 
Clojure cnclojure-meetup
Clojure cnclojure-meetupClojure cnclojure-meetup
Clojure cnclojure-meetup
 
Git server account management
Git server account managementGit server account management
Git server account management
 
Jenkins x GitLab CI
Jenkins x GitLab CIJenkins x GitLab CI
Jenkins x GitLab CI
 
Introduction to Golang final
Introduction to Golang final Introduction to Golang final
Introduction to Golang final
 
Using vim
Using vimUsing vim
Using vim
 

More from Yuren Ju

捷克之旅
捷克之旅捷克之旅
捷克之旅Yuren Ju
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Yuren Ju
 
Python and GObject Introspection
Python and GObject IntrospectionPython and GObject Introspection
Python and GObject IntrospectionYuren Ju
 
step by step to write a gnome-shell extension
step by step to write a gnome-shell extension step by step to write a gnome-shell extension
step by step to write a gnome-shell extension Yuren Ju
 
Python-GTK
Python-GTKPython-GTK
Python-GTKYuren Ju
 
Ibus pinyin
Ibus pinyinIbus pinyin
Ibus pinyinYuren Ju
 
Ibus pinyin
Ibus pinyinIbus pinyin
Ibus pinyinYuren Ju
 
Javascript in linux desktop (ICOS ver.)
Javascript in linux desktop (ICOS ver.)Javascript in linux desktop (ICOS ver.)
Javascript in linux desktop (ICOS ver.)Yuren Ju
 
Javascript in Linux Desktop
Javascript in Linux DesktopJavascript in Linux Desktop
Javascript in Linux DesktopYuren Ju
 

More from Yuren Ju (9)

捷克之旅
捷克之旅捷克之旅
捷克之旅
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)
 
Python and GObject Introspection
Python and GObject IntrospectionPython and GObject Introspection
Python and GObject Introspection
 
step by step to write a gnome-shell extension
step by step to write a gnome-shell extension step by step to write a gnome-shell extension
step by step to write a gnome-shell extension
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
 
Ibus pinyin
Ibus pinyinIbus pinyin
Ibus pinyin
 
Ibus pinyin
Ibus pinyinIbus pinyin
Ibus pinyin
 
Javascript in linux desktop (ICOS ver.)
Javascript in linux desktop (ICOS ver.)Javascript in linux desktop (ICOS ver.)
Javascript in linux desktop (ICOS ver.)
 
Javascript in Linux Desktop
Javascript in Linux DesktopJavascript in Linux Desktop
Javascript in Linux Desktop
 

GNOME3 延伸套件教學