opensuse sublime 配置
fcitx输入法支持:
准备文件sublime-imfix.c:
/*
sublime-imfix.c
Use LD_PRELOAD to interpose some function to fix sublime input method support for linux.
By Cjacker Huang gcc -shared -o libsublime-imfix.so sublime-imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC
LD_PRELOAD=./libsublime-imfix.so subl
*/
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
typedef GdkSegment GdkRegionBox; struct _GdkRegion
{
long size;
long numRects;
GdkRegionBox *rects;
GdkRegionBox extents;
}; GtkIMContext *local_context; 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 = ;
rect.height = rectangle->height;
//The caret width is 2;
//Maybe sometimes we will make a mistake, but for most of the time, it should be the caret.
if(rectangle->width == && 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); 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 != && height !=) {
gtk_im_context_focus_in(context);
local_context = context;
}
gdk_window_add_filter (window, event_filter, context);
}
编译:
gcc -shared -o libsublime-imfix.so sublime-imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC
需要预装gtk-devel:
sudo zypper in gtk-devel gtk2-devel gtk3-devel
配置sublime_text.desktop(注意修改相关路径)
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=bash -c 'LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so /opt/sublime_text/sublime_text %F'
Terminal=false
MimeType=text/plain;
Icon=/opt/sublime_text/Icon/sublime-text.png
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document; [Desktop Action Window]
Name=New Window
Exec=env LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so /opt/sublime_text/sublime_text -n
OnlyShowIn=Unity; [Desktop Action Document]
Name=New File
Exec=env LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so /opt/sublime_text/sssublime_text --command new_file
OnlyShowIn=Unity;
当然Unity的选项是用不到的,这里借鉴Ubuntu中的方法。
将sublime_text.desktop放在/usr/share/applications/中。
为了添加到系统执行目录中 ,新建文件/usr/bin/sublime,并添加可执行权限:chmod +x /usr/bin/sublime
#!/bin/bash
bash -c 'LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so /opt/sublime_text/sublime_text'
opensuse sublime 配置的更多相关文章
- Sublime 配置&插件推荐
sublime 配置&插件推荐 Sublime编辑器的新鲜特性同时选中多个 先选中一个 再Command + D Command + P @搜索函数 #搜索关键字迷你地图 安装package ...
- Ubuntu Sublime 配置
p { margin-bottom: 0.25cm; line-height: 120% } a:link { } 2018.4.14 Ubuntu Sublime 配置 承 Ubuntu Apach ...
- OSX系统的sublime配置php执行编译
OSX系统的sublime配置php执行编译 1).进入如下菜单 2)弹出内容如下: { "cmd": ["make"] } 修改为: { "cmd& ...
- sublime 配置 anaconda 环境
安装清单: 软件列表: anaconda sublime text sublime插件列表: package control Conda 安装 anaconda https://www.continu ...
- sublime配置java环境
今天突然不想用eclipse编写java了,觉得sublime挺好用,就想用sublime配置java环境,以下是过程以及出现的问题. 一.配置Java环境 1.打开我的电脑–属性–高级–环境变量 2 ...
- Ubuntu 16.04 Go环境搭建 Go环境+Sublime配置
Ubuntu 16.04 Go环境搭建 Go环境+Sublime配置 1. 安装Go 下载地址https://golang.org/dl/ (需要翻下) 下载到类似go1.8.3.linux-amd6 ...
- sublime配置python环境及快捷键
sublime配置python环境 参考链接:https://blog.csdn.net/VertigozZ/article/details/54574006 快捷键的配置:https://www.c ...
- Sublime配置与各种插件
Sublime Text 3 安装Package Control 点击View -> Show Console 在下方命令行内,输入以下命令. import urllib.request,os; ...
- sublime配置java编译环境
Windows下配置Sublime Text3的Java环境 字数507 阅读2301 评论2 喜欢2 Sublime Text3是一个比较好用的IDE.截图如下: java环境截图 下面就简单介绍下 ...
随机推荐
- 20169212《Linux内核原理与分析》第十一周作业
缓冲区溢出漏洞实验 缓冲区溢出漏洞:缓冲区溢出是指程序试图向缓冲区写入超出预分配固定长度数据的情况.这一漏洞可以被恶意用户利用来改变程序的流控制,甚至执行代码的任意片段.这一漏洞的出现是由于数据缓冲器 ...
- hexo 本地local4000打不开解决方法
错误:Cannot GET /spadesq.github.io/ (注:spadesq.github.io是原来放hexo文件夹的名字) 由于我后来把hexo文件夹搬迁到别处,但我发现打开本地,地址 ...
- spring.net 配置文件需要注意换行问题
今天在做Spring.NET Demo时写配置文件写ObjectNames 节点的Value成这样 <object id="ProxyCreator" type=" ...
- ArcMap Add-in插件开发中解决VS调试时断点不会命中的问题
在VS2010中进行ArcMap Add-in插件开发(ArcEngine10.1,ArcGIS10.1),运行时为.NET4.0,在程序中设置了断点进行调试,但是运行后程序并不会在断点处停止,且原来 ...
- Custom Web Servic In MOSS 2007
Tools: Visual Studio 2008,Visual Studio 2008 Command Prompt, Sharepoint Server 2007 Generate .disco ...
- win7/8/10安装过程中将动态磁盘转为basic
在分区界面运行Shift+F10 在命令窗口运行Diskpart list diskpart select disk n(n为磁盘号) clean convert xxx PS:xxx代表要转换的结果 ...
- CentOS下升级python2.7.10过程记录
1.准备好一份Python2.7.10源码包,下载地址: http://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz 2.安装Python2.7 ...
- mysql 查询当天、本周,本月,上一个月的数据
今天 select * from 表名 where to_days(时间字段名) = to_days(now()); 昨天 近7天 DAY) <= date(时间字段名) 近30天 DAY) & ...
- js关闭子窗口,刷新父窗口
父页面js:function btnAdd_onclick() {window.open("xxx.jsp", "","height=600, wid ...
- 转-Apache的Order Allow,Deny 详解
Allow和Deny可以用于apache的conf文件或者.htaccess文件中(配合Directory, Location, Files等),用来控制目录和文件的访问授权. 所以,最常用的是:Or ...