Skip to content

Instantly share code, notes, and snippets.

@shellexy
shellexy / gtkswitchbutton.py
Last active August 29, 2015 14:03
GtkSwitch for PyGtk2
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
'''GtkSwitch for PyGtk2
@author: Shellexy <shellexywang@gmail.com>
@license: LGPLv3+
@see:
'''
import gtk, gobject
@shellexy
shellexy / .conf
Last active August 29, 2015 14:06
openvpn 和 anyconnect 所用路由
## openvpn 路由 ##
server 10.168.2.0 255.255.255.0 #客户端使用的IP段,不要与你本机的网段冲突#
;push "redirect-gateway"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "route 172.68.2.0 255.255.255.0 vpn_gateway"
push "route 3.0.0.0 255.0.0.0 vpn_gateway"
push "route 4.0.0.0 255.0.0.0 vpn_gateway"
push "route 8.0.0.0 255.0.0.0 vpn_gateway"
@shellexy
shellexy / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@shellexy
shellexy / 谷歌拼音最大输入长度.diff
Created September 4, 2011 12:22
ibus-googlepinyin 输入词的最大长度由 9 改为 16
diff --git a/include/spellingtrie.h b/include/spellingtrie.h
--- a/include/spellingtrie.h
+++ b/include/spellingtrie.h
@@ -30,8 +30,8 @@ struct SpellingNode {
SpellingNode *first_son;
// The spelling id for each node. If you need more bits to store
// spelling id, please adjust this structure.
- uint16 spelling_idx:11;
- uint16 num_of_son:5;
+ uint16 spelling_idx;
@shellexy
shellexy / 页面导航栏 bookmarklet.js
Created September 30, 2011 12:46
页面导航栏 bookmarklet
javascript: (function() {
NodeList.prototype.forEach = Array.prototype.forEach;
var navId = 'shellexy_html5nav_bar';
if (nav = document.getElementById(navId)) {
document.body.style.marginLeft = document.body.getAttribute('marginLeft');
return nav.parentElement.removeChild(nav);
}
if (!document.styleSheets.length) {
document.body.appendChild(document.createElement('style'));
}
@shellexy
shellexy / altTheme.tcl
Created October 2, 2011 09:52
修改后的 Tk ttk 主题颜色
#
# $Id: altTheme.tcl,v 1.6.2.1 2010/08/26 02:06:10 hobbs Exp $
#
# Ttk widget set: Alternate theme
#
namespace eval ttk::theme::alt {
variable colors
array set colors {
@shellexy
shellexy / gitg-0.2.5-new-ui.diff
Created October 8, 2011 15:20
gitg 界面补丁,将标签栏移至左侧,调整控件边距,让详情栏随 diff 栏滚动以增大可视面积(更新到 gitg 0.2.5
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index fa30e52..6e2b0e1 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -297,6 +297,7 @@ add_revision_panel (GitgWindow *window,
label = gitg_revision_panel_get_label (panel);
label_widget = gtk_label_new (label);
+ gtk_label_set_angle (GTK_LABEL(label_widget), 90);
gtk_widget_show (label_widget);
@shellexy
shellexy / Ambiance.diff
Created October 15, 2011 12:59
给 11.10 的 Ambiance 主题加上浅黄色
diff --git a/Ambiance/gtk-2.0/gtkrc b/Ambiance/gtk-2.0/gtkrc
--- a/Ambiance/gtk-2.0/gtkrc
+++ b/Ambiance/gtk-2.0/gtkrc
@@ -1,4 +1,4 @@
-gtk-color-scheme = "base_color:#ffffff\nfg_color:#4c4c4c\ntooltip_fg_color:#ffffff\nselected_bg_color:#f07746\nselected_fg_color:#FFFFFF\ntext_color:#3C3C3C\nbg_color:#F2F1F0\ntooltip_bg_color:#000000\nlink_color:#DD4814"
+gtk-color-scheme = "base_color:#f5f5f5f5b5b5\nfg_color:#4c4c4c\ntooltip_fg_color:#ffffff\nselected_bg_color:#f07746\nselected_fg_color:#FFFFFF\ntext_color:#3C3C3C\nbg_color:#F2F1F0\ntooltip_bg_color:#000000\nlink_color:#DD4814"
gtk-icon-sizes = "panel-menu=22,22:gtk-button=16,16"
diff --git a/Ambiance/gtk-3.0/settings.ini b/Ambiance/gtk-3.0/settings.ini
@shellexy
shellexy / stardict 的 GtkStatusIcon 系统托盘.diff
Created October 16, 2011 13:19
让 stardict 用 GtkStatusIcon 代替 EggTrayIcon 作为系统托盘图标
diff --git a/stardict-3.0.1/src/docklet.cpp b/stardict-3.0.1/src/docklet.cpp
--- a/stardict-3.0.1/src/docklet.cpp
+++ b/stardict-3.0.1/src/docklet.cpp
@@ -24,30 +24,12 @@ DockLet::DockLet(GtkWidget *mainwin, boo
void DockLet::create_docklet()
{
- docklet_ = egg_tray_icon_new("StarDict");
- box_ = gtk_event_box_new();
- if (is_hide_state()) {
@shellexy
shellexy / nautilus 不显示桌面菜单栏.diff
Created October 26, 2011 13:53
让 nautilus 在桌面没有使用 appmenu 时不要显示多余的屏幕顶部菜单栏
diff --git a/nautilus-3.2.0/src/nautilus-desktop-window.c b/nautilus-3.2.0/src/nautilus-desktop-window.c
--- a/nautilus-3.2.0/src/nautilus-desktop-window.c
+++ b/nautilus-3.2.0/src/nautilus-desktop-window.c
@@ -246,6 +246,11 @@ nautilus_desktop_window_constructed (GOb
g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
G_CALLBACK (nautilus_desktop_window_update_directory),
window);
+
+ GtkWidget * menubar_parent = gtk_widget_get_parent (NAUTILUS_WINDOW (window)->details->menubar);
+ GtkWidget * menubar_viewport = gtk_viewport_new (NULL, NULL);