安装 elementary os freya 后我会做的设置

买沙发的时候首要考虑的是尺寸(能放下不、能躺的直不),其次才是质量、牌子、观感……,功能是首要的,扩展功能也是必须的,我就会把各种大小、厚薄、的靠枕、抱枕在沙发上堆成一个窝然后躺在里面看书。因为常躺于是自己做(自己选材,自己剪裁,自己制作)了两套沙发套,便于换洗。现今电脑可能是仅次于手机的高频使用的信息媒介(对于我来说书比手机频率高)了,怎么用,用的爽不爽只有自己知道,习惯、品味……等各种因素掺杂其间。裸机装完操作系统,多少会做些设置——安装喜欢的软件、加快捷方式、设壁纸、设屏保……。
用Elementary OS freya半年了,各种日常遇到的问题解决后,发现做个简单的总结很有必要(有些解决方法快忘了)。
1、关闭lightdm的访客会话
方法不止一个,我个人倾向于这个方案显得更干净,从askubuntu上看到的。
原文链接
sudo sh -c 'printf "[SeatDefaults]nallow-guest=false\n" >/usr/share/lightdm/lightdm.conf.d/50-no-guest.conf'

2、plank设置
就是那个docker了,宽屏显示器下应该有不少人会把启动器放在边上,我就放在左边(不管Linux还是Windows,不管Unity还是Plank)我也看到过有人用MAC也把dock放左边。如果不喜欢缺省的GTK主题可以考虑缺省安装的三个主题,我喜欢透明的(尽管缺省的那个主题功能性更好),如果爱折腾还有第三方的主题可用。
主题就放在/usr/share/plank/theme下,目录名就是主题名。主题设置以前是可以在系统设置中设置的,后面升级后设置界面没了。可以手工修改配置文件(~/.config/plank/dock1/settings)。

#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

2015-02-11 09:54:01屏幕截图
2015-02-12 14:57:01屏幕截图
3、热区设置
这是我觉得gnome应该有的功能(KDE里好像也有),我通常会设定两个下角热区。
2015-02-11 09:59:14屏幕截图

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设置一下就可以输入了,指示器不一定会出来。
如果在”区域和语言“中指定了输入法(勾选),且输入法是缺省的ibus的话,输入法指示器就消失。而不指定则在进入“键盘”设置是会宕出去。
”区域和语言“中那个“应用于登陆窗口、访客账户及新用户”不要点,如果不慎点了,恢复/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所以安装搜狗拼音。安装方法可参考:elementary os Freya Beta 2 发布了!
系统没带office软件,如果有需要安装wps也不错。安装方法可参考:在elementary OS 0.3下用WPS
系统自带的视频播放器audience挺不错,我到目前还没想去装mpv。
缺省编辑器scratch支持utf8中文,但输入不了中文,官方Bug报告里有讨论如下方法:GTK_IM_MODULE=xim scratch-text-editor 经验证fcitx、ibus下都可用(只是ibus不光标跟随),没细研究反正要写些代码就安装了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);
}

编译
gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC

kai@EOSFreya:~$ cat /usr/share/applications/sublime-text.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/usr/bin/subl %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;Utility;
StartupNotify=true
Actions=Window;Document;

X-Desktop-File-Install-Version=0.22

[Desktop Action Window]
Name=New Window
Exec=/usr/bin/subl -n
OnlyShowIn=Unity;

[Desktop Action Document]
Name=New File
Exec=/usr/bin/subl –command new_file
OnlyShowIn=Unity;
kai@EOSFreya:~$ cat /usr/bin/subl
#!/bin/sh
LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text “$@”
kai@EOSFreya:~$

2015-02-12 14:46:43屏幕截图
2015-02-11 12:44:41屏幕截图
2015-02-11 14:56:42屏幕截图
6、系统设置中键盘设置crash的问题
其实挺简单,在”区域和语言“中设置勾选”键盘输入“—— ”汉语“即可(单这样会导致键盘指示器消失)。如果你喜欢键控或查看有哪些快捷键可用的话。
2015-02-11 12:37:20屏幕截图2015-02-11 10:09:29屏幕截图

投稿作者 作者网站


为您推荐

说点什么

10 评论 在 "安装 elementary os freya 后我会做的设置"

avatar
  Subscribe  
最新 最旧 得票最多
提醒
艾叶
游客

挺好的

Zonek
游客

不知道正式版什么时候发布

imcnmi
游客

请问让默认浏览器的默认网页字体是自带的droid sans 的css样式表如何写,我试了不同的字体名称,均为无效。

wzs
游客

五笔怎么设置?

Handsome One
游客

‘”区域和语言“中那个“应用于登陆窗口、访客账户及新用户”不要点,如果不慎点了,恢复/etc/default下的keyboard和locale即可。’Please tell me how? Sorry wo shou jian le, xian zai si huo she zhi bu liao shu ru fa.

Gowe
游客

求博主帮助:
之前点了N次,我现在应该怎么才能恢复啊?
该从ISO镜像的哪里找?

现在在用Chrome的Google Input插件撑着

Gowe
游客

原来没输入法这个原因!

好事者
游客

哈哈哈笑死我了 我也手贱了 。。。

kaiman
游客

安装镜像里有。

神奇的游客
游客

博主我安装的最新的9月份的freya,结果发现ibus开不了,用dconf-editor强行修改input-source后变得很奇葩,什么语言下都激活ibus。真是蛋疼。