首頁 > 軟體

安裝Elementary OS Freya 要做的一些設定

2020-06-16 18:08:49

買沙發的時候首要考慮的是尺寸(能放下不、能躺的直不),其次才是品質、牌子、觀感……,功能是首要的,擴充套件功能也是必須的,我就會把各種大小、厚薄、的靠枕、抱枕在沙發上堆成一個窩然後躺在裡面看書。因為常躺於是自己做(自己選材,自己剪裁,自己製作)了兩套沙發套,便於換洗。現今電腦可能是僅次於手機的高頻使用的資訊媒介(對於我來說書比手機頻率高)了,怎麼用,用的爽不爽只有自己知道,習慣、品味……等各種因素摻雜其間。裸機裝完作業系統,多少會做些設定——安裝喜歡的軟體、加快捷方式、設桌布、設屏保……。

用Elementary OS freya半年了,各種日常遇到的問題解決後,發現做個簡單的總結很有必要(有些解決方法快忘了)。

在Elementary OS 0.3下用WPS  http://www.linuxidc.com/Linux/2014-11/109976.htm

1、關閉lightdm的訪客對談
方法不止一個,我個人傾向於這個方案顯得更乾淨,從askUbuntu上看到的。

sudo sh -c 'printf "[SeatDefaults]nallow-guest=falsen" >/usr/share/lightdm/lightdm.conf.d/50-no-guest.conf'

2、plank設定
 就是那個docker了,寬屏顯示器下應該有不少人會把啟動器放在邊上,我就放在左邊(不管Linux還是Windows,不管Unity還是Plank)我也看到過有人用MAC也把dock放左邊。如果不喜歡預設的GTK主題可以考慮預設安裝的三個主題,我喜歡透明的(儘管預設的那個主題功能性更好),如果愛折騰還有第三方的主題可用。
 主題就放在/usr/share/plank/theme下,目錄名就是主題名。主題設定以前是可以在系統設定中設定的,後面升級後設定介面沒了。可以手工修改組態檔。


#The position for the dock on the monitor. If 0, left. If 1, right. If 2, top. If 3, bottom.
 Position=0
 #The name of the dock’s theme to use.
 Theme=Transparent

3、熱區設定
 這是我覺得gnome應該有的功能(KDE裡好像也有),我通常會設定兩個下角熱區。

4、完成完整語言套件的安裝
 安裝時在啟動選單出來前選擇中文,安裝過程中會顯示下載語言套件,但結果還是不完整。在系統設定中”區域和語言“部分可以根據提示完成語言支援的安裝。但有時翻譯還是不夠完整,我的方法是解除安裝language-pack-gnome-zh-hans再安裝。

sudo apt-get remove language-pack-gnome-zh-hans
sudo apt-get install language-pack-gnome-zh-hans

順便提一下:
 如果從beta2映象安裝,托盤上有可能看不到輸入法指示器,也呼不出輸入法。執行ibus-setup設定一下就可以輸入了,指示器不一定會出來。
”區域和語言“中那個“應用於登陸視窗、訪客賬戶及新使用者”不要點,如果不慎點了,恢復/etc/default下的keyboard和locale即可。

5、安裝慣用軟體——瀏覽器、編輯器等
 我是重度瀏覽器使用者所以不用系統的預設瀏覽器,用firefox還是chromium看個人喜好和需求,我依賴ff的一些外掛且有開啟60個以上分頁的習慣,所以使用firefox並將”啟動Firefox時(S)“設定成”顯示上次開啟的視窗和分頁“

sudo apt-get install firefox firefox-locale-zh-hans
sudo apt-get install chromium-browser chromium-browser-l10n

最近系統升級後firefox位址列中輸入中文會有奇怪的現象(比如用滑鼠選擇位址列中內容時成了刪除這些內容)甚至導致firefox僵死,解決辦法是在位址列輸入時切換到非拼音(pinyin)輸入法比如sunpinyin或英文。後來決定反正要用sublime text所以安裝搜狗拼音。安裝方法可參考:
 系統沒帶office軟體,如果有需要安裝wps也不錯。安裝方法可參考:在elementary OS 0.3下用WPS

預設編輯器scratch支援utf8中文,但輸入不了中文,沒細研究反正要寫些程式碼就安裝了sublime text 3
 sublime text 中文輸入參考了官方論壇的方法

/*
sublime-imfix.c
 Use LD_PRELOAD to interpose some function to fix sublime input method support for linux.
 By Cjacker Huang
 By whitequark@whitequark.org

How to compile:
 gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config –libs –cflags gtk+-2.0` -fPIC
 How to use:
 LD_PRELOAD=./libsublime-imfix.so sublime_text

Changes:
 2014 06-09
 1, Fix cursor position update for sublime text 3.
 2, Combine the codes from whitequark(fix for xim immodule) and add cursor update support for XIM immodule.
 */

/*for RTLD_NEXT*/
 #define _GNU_SOURCE

#include
 #include
 #include
 #include
 #include
 #include
 #include
 #include
 #include

#ifdef VERBOSE
 #define DEBUG(fmt, …) do {
 FILE* err = fopen(“/tmp/libsublime-immethod-fix.log”, “a”);
if (err) {
 fprintf(err, fmt, __VA_ARGS__);
 fclose(err);
 }
 } while(0)
 #else
 #define DEBUG(fmt, …)
 #endif

typedef GdkSegment GdkRegionBox;

struct _GdkRegion
 {
 long size;
 long numRects;
 GdkRegionBox *rects;
 GdkRegionBox extents;
 };

GtkIMContext *local_context;

//this func is interposed to support cursor position update.
 void
 gdk_region_get_clipbox (const GdkRegion *region,
 GdkRectangle *rectangle)
 {
 g_return_if_fail (region != NULL);
 g_return_if_fail (rectangle != NULL);

rectangle->x = region->extents.x1;
 rectangle->y = region->extents.y1;
 rectangle->width = region->extents.x2 – region->extents.x1;
 rectangle->height = region->extents.y2 – region->extents.y1;
 GdkRectangle rect;
 rect.x = rectangle->x;
 rect.y = rectangle->y;
 rect.width = 0;
 rect.height = rectangle->height;
 //The caret width is 2 in sublime text 2
 //And is 1 in sublime text 3.
 //Maybe sometimes we will make a mistake, but for most of the time, it should be the caret.
 if((rectangle->width == 2 || rectangle->width == 1) && GTK_IS_IM_CONTEXT(local_context)) {
 gtk_im_context_set_cursor_location(local_context, rectangle);
 }
 }

//this is needed, for example, if you input something in file dialog and return back the edit area
 //context will lost, so here we set it again.
 static GdkFilterReturn event_filter (GdkXEvent *xevent, GdkEvent *event, gpointer im_context)
 {
 XEvent *xev = (XEvent *)xevent;
 if(xev->type == KeyRelease && GTK_IS_IM_CONTEXT(im_context)) {
 GdkWindow * win = g_object_get_data(G_OBJECT(im_context),”window”);
if(GDK_IS_WINDOW(win))
 gtk_im_context_set_client_window(im_context, win);
 }
 return GDK_FILTER_CONTINUE;
 }

void gtk_im_context_set_client_window (GtkIMContext *context,
 GdkWindow *window)
 {
 GtkIMContextClass *klass;
 g_return_if_fail (GTK_IS_IM_CONTEXT (context));
 klass = GTK_IM_CONTEXT_GET_CLASS (context);
 if (klass->set_client_window)
 klass->set_client_window (context, window);

//below is our interposed codes to save the context to local_context.
 if(!GDK_IS_WINDOW (window))
 return;
 g_object_set_data(G_OBJECT(context),”window”,window);
 int width = gdk_window_get_width(window);
 int height = gdk_window_get_height(window);
 if(width != 0 && height !=0) {
 gtk_im_context_focus_in(context);
 local_context = context;
 }
 //only add this event_filter when using ‘fcitx’ immodule.
 //for xim immodule, this function is as same as original from gtk2.
 const gchar * immodule = g_getenv(“GTK_IM_MODULE”);
if(immodule && !strcmp(immodule, “fcitx”)) {
gdk_window_add_filter (window, event_filter, context);
 }
 }

/*below codes is from whitequark, fix for xim immodule*/

/* See gtkimcontextxim.c */
 GType gtk_type_im_context_xim = 0;

#define GTK_TYPE_IM_CONTEXT_XIM (gtk_type_im_context_xim)
 #define GTK_IM_CONTEXT_XIM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT_XIM, GtkIMContextXIM))
 #define GTK_IM_CONTEXT_XIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT_XIM, GtkIMContextXIMClass))
 #define GTK_IS_IM_CONTEXT_XIM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IM_CONTEXT_XIM))
 #define GTK_IS_IM_CONTEXT_XIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT_XIM))
 #define GTK_IM_CONTEXT_XIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT_XIM, GtkIMContextXIMClass))

typedef struct _GtkIMContextXIM GtkIMContextXIM;
 typedef struct _GtkIMContextXIMClass GtkIMContextXIMClass;

struct _GtkIMContextXIMClass
 {
 GtkIMContextClass parent_class;
 };

typedef struct _StatusWindow StatusWindow;
 typedef struct _GtkXIMInfo GtkXIMInfo;

struct _GtkIMContextXIM
 {
 GtkIMContext object;

GtkXIMInfo *im_info;

gchar *locale;
 gchar *mb_charset;

GdkWindow *client_window;
 GtkWidget *client_widget;

/* The status window for this input context; we claim the
 * * status window when we are focused and have created an XIC
 * */
 StatusWindow *status_window;

gint preedit_size;
 gint preedit_length;
 gunichar *preedit_chars;
 XIMFeedback *feedbacks;

gint preedit_cursor;

XIMCallback preedit_start_callback;
 XIMCallback preedit_done_callback;
 XIMCallback preedit_draw_callback;
 XIMCallback preedit_caret_callback;

XIMCallback status_start_callback;
 XIMCallback status_done_callback;
 XIMCallback status_draw_callback;

XIMCallback string_conversion_callback;

XIC ic;

guint filter_key_release : 1;
 guint use_preedit : 1;
 guint finalizing : 1;
 guint in_toplevel : 1;
 guint has_focus : 1;
 };

static GClassInitFunc orig_gtk_im_context_xim_class_init;
 static GType (*orig_g_type_module_register_type)(GTypeModule *,
 GType, const gchar *,
 const GTypeInfo *, GTypeFlags);
 static gboolean (*orig_gtk_im_context_xim_filter_keypress)(GtkIMContext *context,
 GdkEventKey *event);

static gboolean
 hook_gtk_im_context_xim_filter_keypress(GtkIMContext *context, GdkEventKey *event) {
 GtkIMContextXIM *im_context_xim = GTK_IM_CONTEXT_XIM(context);
 if (!im_context_xim->client_window) {
 DEBUG(“im_context_xim == %pn”, im_context_xim);
 DEBUG(“event->window == %pn”, event->window);

gtk_im_context_set_client_window(context, event->window);
 }

return orig_gtk_im_context_xim_filter_keypress(context, event);
 }

static void
 hook_gtk_im_context_xim_class_init (GtkIMContextXIMClass *class) {
 orig_gtk_im_context_xim_class_init(class, NULL); /* wat? */

GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (class);

assert(!orig_gtk_im_context_xim_filter_keypress);
 orig_gtk_im_context_xim_filter_keypress = im_context_class->filter_keypress;
 im_context_class->filter_keypress = hook_gtk_im_context_xim_filter_keypress;
 DEBUG(“orig_gtk_im_context_xim_filter_keypress: %pn”,
orig_gtk_im_context_xim_filter_keypress);
 }

GType
 g_type_module_register_type (GTypeModule *module,
 GType parent_type,
 const gchar *type_name,
 const GTypeInfo *type_info,
 GTypeFlags flags) {
 if (!orig_g_type_module_register_type) {
 orig_g_type_module_register_type = dlsym(RTLD_NEXT, “g_type_module_register_type”);
assert(orig_g_type_module_register_type);
 }

if (type_name && !strcmp(type_name, “GtkIMContextXIM”)) {
assert(!orig_gtk_im_context_xim_class_init);
 orig_gtk_im_context_xim_class_init = type_info->class_init;

assert(sizeof(GtkIMContextXIM) == type_info->instance_size);

const GTypeInfo hook_im_context_xim_info =
 {
 type_info->class_size,
 type_info->base_init,
 type_info->base_finalize,
 (GClassInitFunc) hook_gtk_im_context_xim_class_init,
 type_info->class_finalize,
 type_info->class_data,
 type_info->instance_size,
 type_info->n_preallocs,
 type_info->instance_init,
 };

DEBUG(“orig_gtk_im_context_xim_class_init: %pn”, orig_gtk_im_context_xim_class_init);

gtk_type_im_context_xim =
 orig_g_type_module_register_type(module, parent_type, type_name,
 &hook_im_context_xim_info, flags);

return gtk_type_im_context_xim;
 }

return orig_g_type_module_register_type(module, parent_type, type_name, type_info, flags);
 }

更多詳情見請繼續閱讀下一頁的精彩內容http://www.linuxidc.com/Linux/2015-02/113243p2.htm


IT145.com E-mail:sddin#qq.com