@@ -0,0 +1,9 @@ | |||||
# ln -s this /etc/X11/xorg.conf.d | |||||
Section "InputClass" | |||||
Identifier "Keyboard Defaults" | |||||
MatchIsKeyboard "yes" | |||||
# Option "XkbModel" "acer_laptop" | |||||
# Option "XkbLayout" "jp" | |||||
Option "XkbOptions" "ctrl:nocaps,ctrl:menu_rctrl" | |||||
EndSection |
@@ -1,13 +1,16 @@ | |||||
~/.xsessionrc <= graphical login | |||||
~/.bash_profile <= console login | |||||
| | | | ||||
`-- ~/.profile <= text login | |||||
| | |||||
|-- ~/.dotfiles/profile | |||||
| | |||||
* if shell is bash | |||||
| | |||||
`-- ~/.bashrc <= run bash | |||||
| | |||||
`-- ~/.dotfiles/bashrc | |||||
| | |||||
`-- /etc/bashrc | |||||
|--~/.dotfiles/profile | |||||
| | |||||
`--~/.bashrc | |||||
| | |||||
`--~/.dotfiles/bashrc | |||||
~/.xinitrc <= startx | |||||
| | |||||
`--openbox-session | |||||
| | |||||
|--~/.dotfiles/xprofile | |||||
| | |||||
`--~/.dotfiles/xprograms | |||||
@@ -27,27 +27,8 @@ function ignore(k, i) [k, null]; | |||||
//// firefox | //// firefox | ||||
// style.register("#bookmarksPanel > hbox,#history-panel > hbox {display: none !important;} //#urlbar-container{max-width: 500px !important;}"); | // style.register("#bookmarksPanel > hbox,#history-panel > hbox {display: none !important;} //#urlbar-container{max-width: 500px !important;}"); | ||||
util.setPrefs( | |||||
{ | |||||
"browser.tabs.loadDivertedInBackground": true, | |||||
"dom.disable_window_open_feature.location": false, | |||||
"dom.max_script_run_time": 30, | |||||
"browser.bookmarks.max_backups":0, | |||||
"browser.urlbar.autocomplete.enabled":false, | |||||
"browser.cache.memory.capacity":16384, | |||||
"browser.sessionhistory.max_total_viewers":8, | |||||
"browser.download.manager.closeWhenDone":true, | |||||
"browser.download.useDownloadDir":false, | |||||
"browser.tabs.closeWindowWithLastTab":false, | |||||
"network.dns.disableIPv6":true, | |||||
"browser.urlbar.trimURLs":false, | |||||
"browser.fullscreen.autohide":false, | |||||
"keyword.URL":"http://www.bing.com/search?q=", | |||||
} | |||||
); | |||||
/////////////////////////////////// | /////////////////////////////////// | ||||
//検索エンジン | |||||
//search engine | |||||
plugins.options["search-url-list"] = [ | plugins.options["search-url-list"] = [ | ||||
["bing","http://bing.com/search?q=%q"], | ["bing","http://bing.com/search?q=%q"], | ||||
["yatwitter search","http://yats-data.com/yats/search?query=%q"], | ["yatwitter search","http://yats-data.com/yats/search?query=%q"], | ||||
@@ -71,7 +52,7 @@ plugins.options["my-keysnail-bookmarks"] = [ | |||||
"twitter.com", | "twitter.com", | ||||
]; | ]; | ||||
// sitelocal | |||||
// sitelocal keymap | |||||
////////////////////////////////////////// | ////////////////////////////////////////// | ||||
// 2ch chaika | // 2ch chaika | ||||
@@ -96,7 +77,7 @@ local["^http://w2.p2.2ch.net/p2/read.php"] = [ | |||||
]; | ]; | ||||
///////////////////////////////////////// | ///////////////////////////////////////// | ||||
// feedly用マップ | |||||
// feedly | |||||
local["^http://www.feedly.com/"] = [ | local["^http://www.feedly.com/"] = [ | ||||
['d', null], | ['d', null], | ||||
['j', null], | ['j', null], | ||||
@@ -117,11 +98,11 @@ local["^http://www.feedly.com/"] = [ | |||||
]; | ]; | ||||
///////////////////////////////////////// | ///////////////////////////////////////// | ||||
//nicovideo用 | |||||
//nicovideo | |||||
local["http://(www|tw|es|de|)\.nicovideo\.jp\/(watch|playlist)/*"] = [ | local["http://(www|tw|es|de|)\.nicovideo\.jp\/(watch|playlist)/*"] = [ | ||||
["i", function (ev, arg) { ext.exec("nicoinfo", arg); }], | ["i", function (ev, arg) { ext.exec("nicoinfo", arg); }], | ||||
["p", function (ev, arg) { ext.exec("nicopause", arg); }], | ["p", function (ev, arg) { ext.exec("nicopause", arg); }], | ||||
["o", function (ev, arg) { ext.exec("nicommentvisible", arg); }], | |||||
// ["o", function (ev, arg) { ext.exec("nicommentvisible", arg); }], | |||||
["m", function (ev, arg) { ext.exec("nicomute", arg); }], | ["m", function (ev, arg) { ext.exec("nicomute", arg); }], | ||||
[".", function (ev, arg) { ext.exec("nicovolumeIncrement", arg); }], | [".", function (ev, arg) { ext.exec("nicovolumeIncrement", arg); }], | ||||
[",", function (ev, arg) { ext.exec("nicovolumeDecrement", arg); }], | [",", function (ev, arg) { ext.exec("nicovolumeDecrement", arg); }], | ||||
@@ -175,18 +156,128 @@ plugins.options["twitter_client.jmp_key"] = "R_c51f889a77cb4b4e993ed868f65083f5" | |||||
plugins.options["twitter_client.use_jmp"] = true; | plugins.options["twitter_client.use_jmp"] = true; | ||||
//////////////////////////////////////////// | //////////////////////////////////////////// | ||||
// エクステ | |||||
// my ext | |||||
ext.add("list-url", function(){ | |||||
var urls = []; | |||||
var aa = window.content.document.getElementsByTagName("a"); | |||||
var text = ""; | |||||
var alt = ""; | |||||
for (var i = 0; i < aa.length ; i++) { | |||||
if(aa[i].href == ""){ continue; } | |||||
if (aa[i].text == "" && aa[i].hasChildNodes() && aa[i].childNodes[0].nodeType == Node.ELEMENT_NODE){ | |||||
alt = aa[i].childNodes[0].getAttribute("alt"); | |||||
text = " " + aa[i].childNodes[0].nodeName + (alt ? ": " + alt : ""); | |||||
}else{ | |||||
text = aa[i].text; | |||||
} | |||||
urls.push([text, decodeURIComponent(aa[i].href)]); | |||||
} | |||||
if(urls.length == 0){ | |||||
display.echoStatusBar("No url found."); | |||||
}else{ | |||||
prompt.selector( | |||||
{ | |||||
message : "Select URL", | |||||
collection : urls, | |||||
width : [35, 65], | |||||
header : ["text", "url"], | |||||
callback : function (i) { | |||||
if (i >= 0) | |||||
openUILinkIn(urls[i][1], "tab"); // or current tabshifted window | |||||
} | |||||
} | |||||
); | |||||
} | |||||
}, "list url"); | |||||
ext.add("bookmark-delicious", function(){ | |||||
f= 'http://www.delicious.com/save?url=' + encodeURIComponent(window.content.location.href) + | |||||
'&title=' + encodeURIComponent(document.title) + | |||||
'¬es=' + encodeURIComponent('' + (window.getSelection ? | |||||
window.getSelection() : document.getSelection ? | |||||
document.getSelection() : document.selection.createRange().text)) + '&v=6&'; | |||||
a = function(){ | |||||
if(! window.open(f + 'noui=1&jump=doclose', 'deliciousuiv6', 'location=1,links=0,scrollbars=0,toolbar=0,width=710,height=660')){ | |||||
location.href = f + 'jump=yes'; | |||||
} | |||||
}; | |||||
if(/Firefox/.test(navigator.userAgent)){ | |||||
setTimeout(a,0); | |||||
}else{ | |||||
a(); | |||||
} | |||||
}, "bookmark delicious"); | |||||
ext.add('view-page-source', function(){ | |||||
window.content.location.href = "view-source:" + window.content.location.href; | |||||
}, 'view page source'); | |||||
ext.add('my-setpref', function(){ | |||||
util.setPrefs( | |||||
{ | |||||
"browser.bookmarks.max_backups":0, | |||||
"browser.cache.memory.capacity":16384, | |||||
"browser.download.manager.closeWhenDone":true, | |||||
"browser.download.useDownloadDir":false, | |||||
"browser.fullscreen.autohide":false, | |||||
"browser.search.openintab":true, | |||||
"browser.sessionhistory.max_total_viewers":8, | |||||
"browser.sessionstore.restore_on_demand":true, | |||||
"browser.tabs.closeWindowWithLastTab":false, | |||||
"browser.tabs.loadDivertedInBackground": true, | |||||
"browser.urlbar.autocomplete.enabled":false, | |||||
"browser.urlbar.trimURLs":false, | |||||
"dom.disable_window_open_feature.location": false, | |||||
"dom.max_script_run_time": 30, | |||||
"extensions.chaika.bbsmenu.open_new_tab":true, | |||||
"extensions.chaika.bbsmenu.open_single_click":false, | |||||
"extensions.chaika.board.open_new_tab":true, | |||||
"extensions.chaika.board.open_single_click":false, | |||||
"extensions.foxage2ch.openThreadInTab":true, | |||||
"extensions.saveimageinfolder.general-duplicatefilenamevalue":1, | |||||
"extensions.saveimageinfolder.general-fileprefixvalue":"%yyyy%%MM%%dd%-%hh%%mm%%ss%_", | |||||
"extensions.saveimageinfolder.usecache":true, | |||||
"extensions.tabutils.openTabNext":1, | |||||
"extensions.tabutils.styles.current":"{\"bold\":true,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#000000\",\"bgColor\":false,\"bgColorCode\":\"#000000\",\"outline\":false,\"outlineColorCode\":\"#000000\"}", | |||||
"extensions.tabutils.styles.unread":"{\"bold\":false,\"italic\":false,\"underline\":false,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#CC0000\",\"bgColor\":false,\"bgColorCode\":\"undefined\",\"outline\":false,\"outlineColorCode\":\"undefined\"}", | |||||
"extensions.yass.edgetype":0, | |||||
"extensions.yass.selectedpreset":"red", | |||||
"font.default.x-western":"sans-serif", | |||||
"general.warnOnAboutConfig":false, | |||||
"keyword.URL":"http://www.bing.com/search?q=", | |||||
"network.dns.disableIPv6":true, | |||||
"refcontrol.actions":"@DEFAULT=@FORGE www.heartrails.com=@NORMAL www.pixiv.net=@NORMAL", | |||||
"scrapbook.tabs.open":true | |||||
} | |||||
); | |||||
if(/^Linux/.test(navigator.platform)){ | |||||
util.setPrefs( | |||||
{ | |||||
"browser.cache.disk.parent_directory":"/tmp", | |||||
"browser.cache.disk.capacity":524288 | |||||
} | |||||
); | |||||
} | |||||
display.showPopup("Keysnail", "My prefs done."); | |||||
}, 'my setpref'); | |||||
ext.add('auto-install-plugins', function(ev, arg){ | ext.add('auto-install-plugins', function(ev, arg){ | ||||
var urls = [ | var urls = [ | ||||
'https://github.com/mooz/keysnail/raw/master/plugins/yet-another-twitter-client-keysnail.ks.js', | |||||
'https://github.com/mooz/keysnail/raw/master/plugins/site-local-keymap.ks.js', | |||||
'https://github.com/azu/KeySnail-Plugins/raw/master/JSReference/js-referrence.ks.js', | |||||
'https://raw.github.com/mooz/keysnail/master/plugins/yet-another-twitter-client-keysnail.ks.js', | |||||
'https://raw.github.com/mooz/keysnail/master/plugins/site-local-keymap.ks.js', | |||||
'https://raw.github.com/mooz/keysnail/master/plugins/hok.ks.js', | |||||
'https://raw.github.com/azu/KeySnail-Plugins/master/JSReference/js-referrence.ks.js', | |||||
'https://raw.github.com/gongo/keysnail_plugin/master/linksnail.ks.js', | 'https://raw.github.com/gongo/keysnail_plugin/master/linksnail.ks.js', | ||||
'https://github.com/tkosaka/keysnail-plugin/raw/master/nicontroller.ks.js', | |||||
'https://raw.github.com/tkosaka/keysnail-plugin/master/nicontroller.ks.js', | |||||
'https://raw.github.com/10sr/keysnail-plugin/master/shiitake.ks.js', | 'https://raw.github.com/10sr/keysnail-plugin/master/shiitake.ks.js', | ||||
'https://raw.github.com/10sr/keysnail-plugin/master/dig-url.ks.js', | 'https://raw.github.com/10sr/keysnail-plugin/master/dig-url.ks.js', | ||||
'https://raw.github.com/10sr/keysnail-plugin/master/instapaper.ks.js', | 'https://raw.github.com/10sr/keysnail-plugin/master/instapaper.ks.js', | ||||
'https://raw.github.com/10sr/keysnail-plugin/master/pixiv_autojump.ks.js', | |||||
'https://raw.github.com/gist/1976942/firefox-addon-manager.ks.js', | |||||
'https://raw.github.com/gist/1450594/mstranslator.ks.js' | |||||
]; | ]; | ||||
function inst(a){ | function inst(a){ | ||||
@@ -247,68 +338,13 @@ ext.add("close-and-next-tab", function (ev, arg) { | |||||
gBrowser.selectedTab = gBrowser.mTabs[n]; | gBrowser.selectedTab = gBrowser.mTabs[n]; | ||||
}, "close and focus to next tab"); | }, "close and focus to next tab"); | ||||
///////////////////////////////////// | |||||
// google itranslate | |||||
(function(){ | |||||
let targetLang = "ja"; // target lang to translate into | |||||
let alternativeLang = "en"; // if given word is in targetLang, use this instead as a target lang | |||||
function translate(word, target, next) { | |||||
next("", "", " getting..."); | |||||
const base = "https://www.googleapis.com/language/translate/v2?key=%s&q=%s&target=%s"; | |||||
const apikey = "AIzaSyBq48p8NhFgaJ1DfUJ5ltbwLxeXpjEL86A"; | |||||
let ep = util.format(base, apikey, encodeURIComponent(word), target); | |||||
util.httpGet(ep, false, function (res) { | |||||
if (res.status === 200) { | |||||
let json = decodeJSON(res.responseText); | |||||
let srclang = json.data.translations[0].detectedSourceLanguage; | |||||
if (target == srclang) { | |||||
lookupword(word, alternativeLang); | |||||
} else { | |||||
let result = json.data.translations[0].translatedText; | |||||
next(srclang, target, result); | |||||
} | |||||
} else { | |||||
next("", "", "ERROR!"); | |||||
} | |||||
}); | |||||
}; | |||||
function echo(srclang, from, tglang, to){ | |||||
display.echoStatusBar(srclang + " : " + from + " -> " + tglang + " : " + to); | |||||
}; | |||||
function decodeJSON(json) { | |||||
return util.safeEval("(" + json + ")"); | |||||
}; | |||||
function lookupword(word, target){ | |||||
translate(word, target, function (src, tg, translated) { | |||||
echo(src, word, tg, translated); | |||||
}); | |||||
}; | |||||
function read (aInitialInput) { | |||||
let prevText = ""; | |||||
prompt.reader({ | |||||
message : "word or sentence to translate:", | |||||
initialinput : aInitialInput, | |||||
onChange: function (arg) { | |||||
let word = arg.textbox.value; | |||||
if (word !== prevText) { | |||||
prevText = word; | |||||
lookupword(word, targetLang); | |||||
} | |||||
}, | |||||
callback: function (s){}, | |||||
}); | |||||
}; | |||||
ext.add("google-itranslate",function(){read(content.document.getSelection() || "");},"google itranslate"); | |||||
})(); | |||||
////////////////////////////////////// | ////////////////////////////////////// | ||||
// | // | ||||
ext.add("restart-firefox-add-menu", function(){ | ext.add("restart-firefox-add-menu", function(){ | ||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; | const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; | ||||
var cmdelm = document.createElementNS(XUL_NS, "command"); | var cmdelm = document.createElementNS(XUL_NS, "command"); | ||||
cmdelm.setAttribute("id", "my_cmd_restartFirefoxKs") | |||||
cmdelm.setAttribute("id", "my_cmd_restartFirefoxKs"); | |||||
cmdelm.setAttribute("oncommand", "ext.exec('restart-firefox');"); | cmdelm.setAttribute("oncommand", "ext.exec('restart-firefox');"); | ||||
var commandset = document.getElementById("mainCommandSet"); | var commandset = document.getElementById("mainCommandSet"); | ||||
// menu.insertBefore(elm, menu.getElementById("menu_FileQuitItem")); | // menu.insertBefore(elm, menu.getElementById("menu_FileQuitItem")); | ||||
@@ -316,7 +352,7 @@ ext.add("restart-firefox-add-menu", function(){ | |||||
var menuelm = document.createElementNS(XUL_NS, "menuitem"); | var menuelm = document.createElementNS(XUL_NS, "menuitem"); | ||||
menuelm.setAttribute("label", "Restart Firefox"); | menuelm.setAttribute("label", "Restart Firefox"); | ||||
menuelm.setAttribute("id", "my_menu_restartFirefoxKs") | |||||
menuelm.setAttribute("id", "my_menu_restartFirefoxKs"); | |||||
menuelm.setAttribute("command", "my_cmd_restartFirefoxKs"); | menuelm.setAttribute("command", "my_cmd_restartFirefoxKs"); | ||||
var menu = document.getElementById("menu_FilePopup"); | var menu = document.getElementById("menu_FilePopup"); | ||||
// menu.insertBefore(elm, menu.getElementById("menu_FileQuitItem")); | // menu.insertBefore(elm, menu.getElementById("menu_FileQuitItem")); | ||||
@@ -377,25 +413,25 @@ ext.add("copy-url", function () { | |||||
}, "Copy url or feed url of current page"); | }, "Copy url or feed url of current page"); | ||||
/////////////////////////////////////// | /////////////////////////////////////// | ||||
// 評価しちゃうっぽい とりあえずこんな感じで | |||||
// keysnail z menu | |||||
ext.add("keysnail-setting-menu",function(){ | ext.add("keysnail-setting-menu",function(){ | ||||
var settingmenulist = [["keysnail setting dialogue", function(){return function(){KeySnail.openPreference();};}], | var settingmenulist = [["keysnail setting dialogue", function(){return function(){KeySnail.openPreference();};}], | ||||
["keysnail plugin manager", function(){return function(){userscript.openPluginManager();}}], | |||||
["keysnail plugin manager", function(){return function(){userscript.openPluginManager();};}], | |||||
["firefox addon manager", function(){return function(){BrowserOpenAddonsMgr();};}], | ["firefox addon manager", function(){return function(){BrowserOpenAddonsMgr();};}], | ||||
["reload .keysnail.js", function(){return function() {userscript.reload();};}], | ["reload .keysnail.js", function(){return function() {userscript.reload();};}], | ||||
// ["check for plugins update", function(){return function(){ext.exec("check-for-plugins-update");};}], | // ["check for plugins update", function(){return function(){ext.exec("check-for-plugins-update");};}], | ||||
["restart firefox", function(){return function(){ext.exec("restart-firefox");};}], | |||||
["restart firefox", function(){return function(){ext.exec("restart-firefox");};}] | |||||
]; | ]; | ||||
prompt.selector( | prompt.selector( | ||||
{ | { | ||||
message : "open setting dialog", | message : "open setting dialog", | ||||
collection : settingmenulist, | collection : settingmenulist, | ||||
callback : function (i) { settingmenulist[i][1]()(); }, | |||||
callback : function (i) { settingmenulist[i][1]()(); } | |||||
}); | }); | ||||
},"open keysnail setting menu"); | },"open keysnail setting menu"); | ||||
//////////////////////// | //////////////////////// | ||||
//マルチプルタブハンドラ | |||||
// multiple tab handler | |||||
ext.add("multiple-tab-handler-close-selected-and-current-tabs", function () { | ext.add("multiple-tab-handler-close-selected-and-current-tabs", function () { | ||||
BrowserCloseTabOrWindow(); | BrowserCloseTabOrWindow(); | ||||
// if (MultipleTabService) { | // if (MultipleTabService) { | ||||
@@ -427,7 +463,7 @@ ext.add("query-then-engine", function () { | |||||
}, "enter search word and then select engine"); | }, "enter search word and then select engine"); | ||||
///////////////////////////////////// | ///////////////////////////////////// | ||||
// 閉じたタブリスト | |||||
// closed tab list | |||||
ext.add("list-closed-tabs", function () { | ext.add("list-closed-tabs", function () { | ||||
const fav = "chrome://mozapps/skin/places/defaultFavicon.png"; | const fav = "chrome://mozapps/skin/places/defaultFavicon.png"; | ||||
var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); | var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); | ||||
@@ -435,7 +471,7 @@ ext.add("list-closed-tabs", function () { | |||||
var closedTabs = [[tab.image || fav, tab.title, tab.url] for each (tab in json.decode(ss.getClosedTabData(window)))]; | var closedTabs = [[tab.image || fav, tab.title, tab.url] for each (tab in json.decode(ss.getClosedTabData(window)))]; | ||||
if (!closedTabs.length) | if (!closedTabs.length) | ||||
return void display.echoStatusBar("最近閉じたタブが見つかりませんでした", 2000); | |||||
return void display.echoStatusBar("No recently closed tab.", 2000); | |||||
prompt.selector( | prompt.selector( | ||||
{ | { | ||||
@@ -446,16 +482,16 @@ ext.add("list-closed-tabs", function () { | |||||
}); | }); | ||||
}, "List closed tabs"); | }, "List closed tabs"); | ||||
ext.add("echo-closed-tabs", function () { | |||||
var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); | |||||
var json = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON); | |||||
// var closedTabs = [[tab.image || fav, tab.title, tab.url] for each (tab in json.decode(ss.getClosedTabData(window)))]; | |||||
var lasttab = json.decode(ss.getClosedTabData(window))[0]; | |||||
dump = "" | |||||
for (var i in lasttab) { dump += lasttab[i] + "\n"; } | |||||
confirm(dump); | |||||
// ext.add("echo-closed-tabs", function () { | |||||
// var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); | |||||
// var json = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON); | |||||
// // var closedTabs = [[tab.image || fav, tab.title, tab.url] for each (tab in json.decode(ss.getClosedTabData(window)))]; | |||||
// var lasttab = json.decode(ss.getClosedTabData(window))[0]; | |||||
// dump = "" | |||||
// for (var i in lasttab) { dump += lasttab[i] + "\n"; } | |||||
// confirm(dump); | |||||
}, "List closed tabs"); | |||||
// }, "List closed tabs"); | |||||
/////////////////////////////// | /////////////////////////////// | ||||
// http://malblue.tumblr.com/post/349001250/tips-japanese-keysnail-github | // http://malblue.tumblr.com/post/349001250/tips-japanese-keysnail-github | ||||
@@ -497,8 +533,8 @@ ext.add("list-tab-history", function () { | |||||
// ========================= Special key settings ========================== // | // ========================= Special key settings ========================== // | ||||
key.quitKey = "<delete>"; | |||||
key.helpKey = "C-h"; | |||||
key.quitKey = "ESC"; | |||||
key.helpKey = "<f1>"; | |||||
key.escapeKey = "C-q"; | key.escapeKey = "C-q"; | ||||
key.macroStartKey = ""; | key.macroStartKey = ""; | ||||
key.macroEndKey = ""; | key.macroEndKey = ""; | ||||
@@ -510,11 +546,11 @@ key.suspendKey = "Not defined"; | |||||
// ================================= Hooks ================================= // | // ================================= Hooks ================================= // | ||||
hook.addToHook('KeySnailInitialized', function () { | |||||
hook.setHook('KeySnailInitialized', function () { | |||||
ext.exec("shiitake-enable-style"); | ext.exec("shiitake-enable-style"); | ||||
}); | }); | ||||
hook.addToHook('KeyBoardQuit', function (aEvent) { | |||||
hook.setHook('KeyBoardQuit', function (aEvent) { | |||||
ext.exec("hide-sidebar"); | ext.exec("hide-sidebar"); | ||||
let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); | let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); | ||||
gBrowser.focus(); | gBrowser.focus(); | ||||
@@ -540,16 +576,6 @@ hook.setHook('Unload', function () { | |||||
}); | }); | ||||
}); | }); | ||||
// hook.addToHook('LocationChange', function (aNsURI) { | |||||
// if(window.content.document.body){ | |||||
// display.prettyPrint(window.content.document.title); | |||||
// }else{ | |||||
// window.addEventListener("load", function(){ | |||||
// disp = display; | |||||
// disp.prettyPrint(window.content.document.title); | |||||
// }, false); | |||||
// } | |||||
// }); | |||||
// ============================= Key bindings ============================== // | // ============================= Key bindings ============================== // | ||||
@@ -579,7 +605,34 @@ key.setGlobalKey('C-<down>', function () { | |||||
} | } | ||||
}, '選択中のタブを左へ'); | }, '選択中のタブを左へ'); | ||||
key.setGlobalKey('M-:', function (ev) { | |||||
key.setGlobalKey('C-h', function (ev, arg) { | |||||
return; | |||||
}, 'ignore'); | |||||
key.setGlobalKey('<delete>', function (ev, arg) { | |||||
let (elem = document.commandDispatcher.focusedElement) elem && elem.blur(); | |||||
gBrowser.focus(); | |||||
content.focus(); | |||||
}, 'コンテンツへフォーカス', true); | |||||
key.setGlobalKey('C-p', function (ev, arg) { | |||||
return !document.getElementById("keysnail-prompt").hidden && | |||||
document.getElementById("keysnail-prompt-textbox").focus(); | |||||
}, 'KeySnail のプロンプトへフォーカス', true); | |||||
key.setViewKey('J', function (ev) { | |||||
getBrowser().mTabContainer.advanceSelectedTab(1, true); | |||||
}, 'ひとつ右のタブへ'); | |||||
key.setViewKey('K', function (ev) { | |||||
getBrowser().mTabContainer.advanceSelectedTab(-1, true); | |||||
}, 'ひとつ左のタブへ'); | |||||
key.setViewKey('o', function (ev, arg) { | |||||
ext.exec("hok-start-foreground-mode", arg, ev); | |||||
}, 'Start Hit a Hint foreground mode', true); | |||||
key.setViewKey('c', function (ev) { | |||||
command.interpreter(); | command.interpreter(); | ||||
}, 'JavaScript のコードを評価'); | }, 'JavaScript のコードを評価'); | ||||
@@ -605,9 +658,9 @@ key.setViewKey(['t', 'p'], function (ev, arg) { | |||||
ext.exec("twitter-client-tweet-this-page", arg, ev); | ext.exec("twitter-client-tweet-this-page", arg, ev); | ||||
}, 'このページのタイトルと URL を使ってつぶやく', true); | }, 'このページのタイトルと URL を使ってつぶやく', true); | ||||
key.setViewKey('u', function () { | |||||
undoCloseTab(); | |||||
}, '閉じたタブを元に戻す'); | |||||
key.setViewKey([['u'], ['<left>']], function (ev) { | |||||
goDoCommand("cmd_scrollPageUp"); | |||||
}, '一画面分スクロールアップ'); | |||||
key.setViewKey('g', function () { | key.setViewKey('g', function () { | ||||
goDoCommand("cmd_scrollTop"); | goDoCommand("cmd_scrollTop"); | ||||
@@ -625,12 +678,6 @@ key.setViewKey('m', function (ev, arg) { | |||||
_fi.toogle(); | _fi.toogle(); | ||||
}, 'fetchimiをトグル'); | }, 'fetchimiをトグル'); | ||||
key.setViewKey('d', function (ev, arg) { | |||||
if (window.loadURI) { | |||||
loadURI("javascript:(function(){f='http://www.delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'¬es='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=6&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv6','location=1,links=0,scrollbars=0,toolbar=0,width=550,height=585'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"); | |||||
} | |||||
}, 'deliciousでブックマーク'); | |||||
key.setViewKey('p', function (ev, arg) { | key.setViewKey('p', function (ev, arg) { | ||||
if (window.loadURI) { | if (window.loadURI) { | ||||
loadURI("javascript:var%20b=document.body;var%20POSTEROUS___bookmarklet_domain='http://posterous.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.type='text/javascript');void(z.src='http://posterous.com/javascripts/bookmarklet2.js');void(b.appendChild(z));}else{}"); | loadURI("javascript:var%20b=document.body;var%20POSTEROUS___bookmarklet_domain='http://posterous.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.type='text/javascript');void(z.src='http://posterous.com/javascripts/bookmarklet2.js');void(b.appendChild(z));}else{}"); | ||||
@@ -651,18 +698,10 @@ key.setViewKey('z', function (ev, arg) { | |||||
ext.exec("keysnail-setting-menu", arg, ev); | ext.exec("keysnail-setting-menu", arg, ev); | ||||
}, 'open keysnail setting menu', true); | }, 'open keysnail setting menu', true); | ||||
key.setViewKey('T', function (ev, arg) { | |||||
ext.exec("google-itranslate", arg, ev); | |||||
}, 'google itranslate', true); | |||||
key.setViewKey('C-SPC', function (ev, arg) { | key.setViewKey('C-SPC', function (ev, arg) { | ||||
MultipleTabService.toggleSelection(gBrowser.selectedTab); | MultipleTabService.toggleSelection(gBrowser.selectedTab); | ||||
}, 'タブの選択をトグル'); | }, 'タブの選択をトグル'); | ||||
key.setViewKey('U', function (ev, arg) { | |||||
ext.exec("list-closed-tabs", arg, ev); | |||||
}, 'List closed tabs', true); | |||||
key.setViewKey('e', function () { | key.setViewKey('e', function () { | ||||
command.focusElement(command.elementsRetrieverTextarea, 0); | command.focusElement(command.elementsRetrieverTextarea, 0); | ||||
}, '最初のインプットエリアへフォーカス', true); | }, '最初のインプットエリアへフォーカス', true); | ||||
@@ -677,10 +716,6 @@ key.setViewKey('!', function (ev, arg) { | |||||
shell.input(); | shell.input(); | ||||
}, 'Command system'); | }, 'Command system'); | ||||
key.setViewKey('b', function (ev, arg) { | |||||
BarTap.putOnTap(gBrowser.mCurrentTab, gBrowser); | |||||
}, 'bartab put on tab'); | |||||
key.setViewKey('R', function () { | key.setViewKey('R', function () { | ||||
BrowserReloadSkipCache(); | BrowserReloadSkipCache(); | ||||
}, '更新(キャッシュを無視)'); | }, '更新(キャッシュを無視)'); | ||||
@@ -709,11 +744,7 @@ key.setViewKey('a', function (ev, arg) { | |||||
allTabs.open(); | allTabs.open(); | ||||
}, 'alltabs.open'); | }, 'alltabs.open'); | ||||
key.setViewKey('<left>', function (ev) { | |||||
goDoCommand("cmd_scrollPageUp"); | |||||
}, '一画面分スクロールアップ'); | |||||
key.setViewKey('<right>', function (ev) { | |||||
key.setViewKey([['<right>'], ['d']], function (ev) { | |||||
goDoCommand("cmd_scrollPageDown"); | goDoCommand("cmd_scrollPageDown"); | ||||
}, '一画面スクロールダウン'); | }, '一画面スクロールダウン'); | ||||
@@ -722,16 +753,18 @@ key.setViewKey([['<prior>'], ['<next>']], function (ev, arg) { | |||||
}, 'ignore'); | }, 'ignore'); | ||||
key.setViewKey(':', function (ev, arg) { | key.setViewKey(':', function (ev, arg) { | ||||
return !document.getElementById("keysnail-prompt").hidden && document.getElementById("keysnail-prompt-textbox").focus(); | |||||
return !document.getElementById("keysnail-prompt").hidden && | |||||
document.getElementById("keysnail-prompt-textbox").focus(); | |||||
}, 'KeySnail のプロンプトへフォーカス', true); | }, 'KeySnail のプロンプトへフォーカス', true); | ||||
key.setViewKey('H', function (ev, arg) { | |||||
ext.exec("open-hatebu-comment", arg, ev); | |||||
}, 'hatebu', true); | |||||
key.setViewKey('l', function (ev) { | |||||
command.focusToById("urlbar"); | |||||
}, 'ロケーションバーへフォーカス', true); | |||||
key.setViewKey('H', function (ev) { | |||||
var browser = getBrowser(); | |||||
if (browser.mCurrentTab.previousSibling) { | |||||
browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos - 1); | |||||
} else { | |||||
browser.moveTabTo(browser.mCurrentTab, browser.mTabContainer.childNodes.length - 1); | |||||
} | |||||
}, '選択中のタブを左へ'); | |||||
key.setViewKey('0', function (ev) { | key.setViewKey('0', function (ev) { | ||||
BrowserCloseTabOrWindow(); | BrowserCloseTabOrWindow(); | ||||
@@ -745,14 +778,43 @@ key.setViewKey('C-<backspace>', function (ev, arg) { | |||||
ext.exec("list-tab-history", arg, ev); | ext.exec("list-tab-history", arg, ev); | ||||
}, 'List tab history', true); | }, 'List tab history', true); | ||||
key.setEditKey('C-<tab>', function (ev) { | |||||
command.walkInputElement(command.elementsRetrieverTextarea, true, true); | |||||
}, '次のテキストエリアへフォーカス'); | |||||
key.setViewKey('I', function (ev, arg) { | key.setViewKey('I', function (ev, arg) { | ||||
ext.exec('instapaper-post-page-with-comment', arg, ev); | |||||
ext.exec("instapaper-post-page-with-comment", arg, ev); | |||||
}, 'post page and comment', true); | }, 'post page and comment', true); | ||||
key.setViewKey('C-<backspace>', function (ev, arg) { | |||||
ext.exec('list-tab-history', arg, ev); | |||||
}, 'List tab history', true); | |||||
key.setViewKey('T', function (ev, arg) { | |||||
ext.exec("mstranslator-open-prompt", arg, ev); | |||||
}, 'MSTranslator - Open prompt', true); | |||||
key.setViewKey('j', function (ev) { | |||||
key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_DOWN, true); | |||||
}, '一行スクロールダウン'); | |||||
key.setViewKey('k', function (ev) { | |||||
key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_UP, true); | |||||
}, '一行スクロールアップ'); | |||||
key.setViewKey('l', function (ev) { | |||||
key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_RIGHT, true); | |||||
}, '右へスクロール'); | |||||
key.setViewKey('h', function (ev) { | |||||
key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_LEFT, true); | |||||
}, '左へスクロール'); | |||||
key.setViewKey('L', function (ev) { | |||||
var browser = getBrowser(); | |||||
if (browser.mCurrentTab.nextSibling) { | |||||
browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos + 1); | |||||
} else { | |||||
browser.moveTabTo(browser.mCurrentTab, 0); | |||||
} | |||||
}, '選択中のタブを右へ'); | |||||
key.setViewKey('U', function (ev) { | |||||
undoCloseTab(); | |||||
}, '閉じたタブを元に戻す'); | |||||
key.setEditKey('C-<tab>', function (ev) { | |||||
command.walkInputElement(command.elementsRetrieverTextarea, true, true); | |||||
}, '次のテキストエリアへフォーカス'); |
@@ -1,151 +1,225 @@ | |||||
#!/bin/bash | #!/bin/bash | ||||
test -r /etc/bashrc && . /etc/bashrc | |||||
########################## | ########################## | ||||
# system type | # system type | ||||
# $OSTYPEとか使えるのかな | |||||
if uname | grep -E "^MINGW32" >/dev/null 2>&1 | |||||
then | |||||
alias ismsys=true | |||||
else | |||||
alias ismsys=false | |||||
fi | |||||
alias ismsys=false | |||||
alias iscygwin=false | |||||
alias iswindows=false | |||||
alias isdarwin=false | |||||
alias islinux=false | |||||
if uname | grep -E "^CYGWIN" >/dev/null 2>&1 | |||||
then | |||||
alias iscygwin=true | |||||
else | |||||
alias iscygwin=false | |||||
fi | |||||
alias iswindows="iscygwin || ismsys" | |||||
case `uname` in | |||||
(MINGW*) alias ismsys=true ;; | |||||
(CYGWIN*) alias iscygwin=true ;; | |||||
(Darwin*) alias isdarwin=true ;; | |||||
(Linux*) alias islinux=true ;; | |||||
esac | |||||
if uname | grep -E 'Darwin' >/dev/null 2>&1 | |||||
then | |||||
alias isdarwin=true | |||||
else | |||||
alias isdarwin=false | |||||
fi | |||||
( ismsys || iscygwin ) && alias iswindows=true | |||||
########################################## | ########################################## | ||||
null(){ | null(){ | ||||
"$@" >/dev/null 2>&1 | "$@" >/dev/null 2>&1 | ||||
} | } | ||||
safe-cmd(){ | |||||
__try_exec(){ | |||||
type $1 >/dev/null 2>&1 && "$@" | type $1 >/dev/null 2>&1 && "$@" | ||||
} | } | ||||
replace-cmd(){ | |||||
type $1 1>/dev/null || alias $1=true | |||||
} | |||||
export PS1="\$(__my_prompt_function)\$ " | |||||
export PS1 # PS1 is defined later | |||||
# PROMPT_COMMAND=prompt_function | # PROMPT_COMMAND=prompt_function | ||||
if false # iswindows | |||||
if false iswindows | |||||
then | then | ||||
export PAGER='tr -d \\r | less' | export PAGER='tr -d \\r | less' | ||||
else | else | ||||
export PAGER="less" | export PAGER="less" | ||||
fi | fi | ||||
export LESS="-iRMXF" | |||||
if type vim >/dev/null 2>&1 | |||||
if null type vim | |||||
then | then | ||||
export EDITOR=vim | export EDITOR=vim | ||||
else | else | ||||
export EDITOR=vi | export EDITOR=vi | ||||
fi | fi | ||||
export LC_MESSAGES=C | |||||
# export CDPATH=".:~" | |||||
export VISUAL="$EDITOR" | export VISUAL="$EDITOR" | ||||
export LESS="-iRMX" | |||||
# export LC_MESSAGES="C" | |||||
# export LANG=ja_JP.UTF-8 | |||||
# export CDPATH=".:~" # 使い方がよく分からない | |||||
export GIT_PAGER="$PAGER" | export GIT_PAGER="$PAGER" | ||||
export GIT_EDITOR="$EDITOR" | export GIT_EDITOR="$EDITOR" | ||||
alias ls="ls -hCFG $(test "$TERM" == dumb || echo --color=auto) --time-style=long-iso" | |||||
! iswindows && null type stty && { | |||||
stty stop undef # unbind C-s to stop displaying output | |||||
# stty erase '^h' | |||||
} | |||||
if iswindows; then | |||||
# export TMP=/tmp | |||||
# export TEMP=/tmp | |||||
# export PS1=" \[\e[32m\]\u@\H \[\e[33m\]\w\[\e[0m\] \d \t\n\s \# \j \$ " | |||||
# export PS1=" [\[\e[33m\]\w\[\e[0m\]]\n\[\e[32m\]\u@\H\[\e[0m\] \d \t \s.\v\nhist:\# jobs:\j \$ " | |||||
export USER=$USERNAME | |||||
fi | |||||
mkdir -p "/tmp/${USER}-tmp" | |||||
####################### | |||||
iswindows && alias tty="echo cmd.exe" | |||||
uname -a | |||||
echo TERM $TERM connected to $(tty), running $BASH $BASH_VERSION | |||||
echo | |||||
################################### | |||||
# some aliases and functions | |||||
test "$TERM" == dumb || _coloroption=" --color=always" | |||||
iswindows || _timeoption=" --time-style=long-iso" | |||||
alias ls="ls -hCF${_coloroption}${_timeoption}" | |||||
# export GREP_OPTIONS="" | |||||
alias grep="grep -n${_coloroption}" | |||||
iswindows && alias grep="grep -n" | |||||
# alias ll="ls -l" | # alias ll="ls -l" | ||||
# alias la="ls -A" | # alias la="ls -A" | ||||
# alias lla="ls -Al" | # alias lla="ls -Al" | ||||
# alias less="" | # alias less="" | ||||
alias vl=/usr/share/vim/vimcurrent/macros/less.sh | |||||
alias em="emacs -nw" | alias em="emacs -nw" | ||||
# alias apt-get="sudo apt-get" | |||||
null type vim && alias vi=vim | |||||
alias pstree="LANG=C pstree" | |||||
alias cp="cp -v" | |||||
alias mv="mv -v" | |||||
alias psall="ps auxww" | |||||
alias q=exit | |||||
alias e3=e3em | |||||
alias dirs="dirs -v -l | \grep -v \$(printf '%s$' \$PWD)" | |||||
alias po=popd | |||||
alias pu=pushd | |||||
alias sudo="sudo " # use aliases through sudo | |||||
alias halt="sudo halt" | |||||
alias reboot="sudo reboot" | |||||
alias suspend="dbus-send --system --print-reply --dest=org.freedesktop.UPower \ | |||||
/org/freedesktop/UPower org.freedesktop.UPower.Suspend" | |||||
alias hibernate="dbus-send --system --print-reply --dest=org.freedesktop.UPower \ | |||||
/org/freedesktop/UPower org.freedesktop.UPower.Hibernate" | |||||
alias rand="echo \$RANDOM" | |||||
alias ut="ssh 6365454829@un001.ecc.u-tokyo.ac.jp" | |||||
alias xunp="file-roller -h" | |||||
alias pc="sudo \paco -D" | |||||
alias pcalc="python -i -c 'from math import *' " | |||||
alias py3=python3 | |||||
alias py2=python2 | |||||
alias _reloadrc="test -f ~/.bashrc && source ~/.bashrc" | |||||
# alias mytime="date +%Y%m%d-%H%M%S" | |||||
alias sh="ENV=$HOME/.shrc PS1=\$\ sh" | |||||
# type trash >/dev/null 2>&1 && alias rm=trash | |||||
alias mpg123="mpg123 -C -v --title" | |||||
export PLAYER="mpg123 -C -v --title" | |||||
alias wic=wicd-curses | |||||
alias wil="wicd-cli -y -l | head" | |||||
alias wicn="wicd-cli -y -c -n" | |||||
alias aptin="apt-get install" | alias aptin="apt-get install" | ||||
alias aptsearch="apt-cache search" | alias aptsearch="apt-cache search" | ||||
alias aptshow="apt-cache show" | alias aptshow="apt-cache show" | ||||
alias ut="ssh t110414@un001.ecc.u-tokyo.ac.jp" | |||||
alias rand="echo \$RANDOM" | |||||
alias xunp="file-roller -h" | |||||
alias pacome="sudo \paco -D" | |||||
alias destroy="rm -rf" | |||||
alias psall="ps auxww" | |||||
for f in /usr/share/vim/vimcurrent/macros/less.sh \ | |||||
/usr/share/vim/vim73/macros/less.sh | |||||
do | |||||
test -f $f && alias vl=$f && break | |||||
done | |||||
alias yt=yaourt | |||||
null type pacman-color && { | |||||
alias pacman=pacman-color | |||||
export pacman_program=pacman-color # used by pacmatic | |||||
export PACMAN=pacman-color # used by yaourt | |||||
} | |||||
null type pacmatic && { | |||||
alias pacman="pacmatic" | |||||
export PACMAN="pacmatic" | |||||
} | |||||
alias ubuntu-upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" | |||||
alias arch-upgrade="sudo pacman -Syu" | |||||
alias port-upgrade="port selfupdate && port sync && port upgrade installed" | |||||
if iscygwin; then | |||||
null type windate || alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'" | |||||
alias cygsu="cygstart /cygwinsetup.exe" | |||||
alias emacs="CYGWIN=tty emacs -nw" | |||||
alias ls="ls -CFG $(iswindows || test "$TERM" == dumb || echo --color=auto)" | |||||
fi | |||||
alias g=git | alias g=git | ||||
alias q=exit | |||||
alias p="$PAGER" | |||||
alias c=cat | |||||
alias pcalc="python -i -c 'from math import *' " | |||||
alias reloadrc="test -f ~/.bashrc && source ~/.bashrc" | |||||
alias sudo="sudo " # use aliases through sudo | |||||
alias e3=e3em | |||||
alias mytime="date +%Y%m%d-%H%M%S" | |||||
alias sh="ENV=$HOME/.shrc sh" | |||||
if isdarwin | |||||
if null type _git # enable programmable completion for g | |||||
then | then | ||||
alias upgrade="port selfupdate && port sync && port upgrade installed" | |||||
else | |||||
alias upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" | |||||
complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \ | |||||
|| complete -o default -o nospace -F _git g | |||||
fi | fi | ||||
# alias diff="$(type colordiff >/dev/null 2>&1 && test $TERM != dumb && echo color)diff -u" | |||||
# type trash >/dev/null 2>&1 && alias rm=trash | |||||
export __MYGITBAREREP="${HOME}/dbx/.git-bare" | |||||
git-make-bare-rep(){ | |||||
test $# -eq 0 && { | |||||
echo "specify repository name." 1>&2 | |||||
return 1 | |||||
} | |||||
__my_moc_state(){ | |||||
type mocp >/dev/null 2>&1 || return | |||||
test "`mocp -Q %state 2>/dev/null`" == PLAY || return | |||||
printf "$1" "`mocp -Q %title 2>/dev/null`" | |||||
} | |||||
dir="${__MYGITBAREREP}/$1.git" | |||||
mcrypt-stream(){ | |||||
test $# -eq 2 || return 1 | |||||
case $1 in | |||||
en) | |||||
mcrypt --key $2 | base64 ;; | |||||
de) | |||||
base64 -d | mcrypt -d --key $2 ;; | |||||
esac | |||||
} | |||||
if test -d "$dir" | |||||
then | |||||
echo "dir $dir already exist!" 1>&2 | |||||
else | |||||
mkdir -p "$dir" && | |||||
pushd "$dir" && | |||||
git init --bare --shared=all | |||||
popd | |||||
fi | |||||
gpg-stream(){ | |||||
test $# -eq 2 || return 1 | |||||
case $1 in | |||||
en) | |||||
gpg --passphrase $2 -c --batch |base64 ;; | |||||
de) | |||||
base64 -d|gpg --passphrase $2 -d --batch ;; | |||||
esac | |||||
} | } | ||||
git-add-bare-rep(){ | |||||
test $# -ne 2 && { | |||||
echo "specify repository name and shortname." 1>&2 | |||||
return 1 | |||||
} | |||||
alias enst="gpg-stream en" | |||||
alias dest="gpg-stream de" | |||||
showinfo(){ | |||||
echo "Japanese letters are 表示可能" | |||||
dir="${__MYGITBAREREP}/$2.git" | |||||
__try_exec diskinfo | |||||
# git-make-bare-rep $2 && | |||||
# git remote add $1 "$dir" | |||||
# git remote -v | |||||
! isdarwin && test -n "${DISPLAY}" && { | |||||
__try_exec xrandr | \grep --color=never ^Screen | |||||
} | |||||
if test -d "$dir" | |||||
then | |||||
git remote add $1 "$dir" | |||||
git remote -v | |||||
iswindows || __try_exec finger $USER | |||||
LANG=C __try_exec id | |||||
__try_exec xset q | |||||
} | |||||
x(){ | |||||
if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then | |||||
#mkdir -p ~/.my/log | |||||
# nohup startx >~/.my/log/xorg.log 2>&1 & | |||||
# exit | |||||
exec startx | |||||
else | else | ||||
echo "dir $dir does not exist!" 1>&2 | |||||
echo "X cant be started! Maybe another X is already running or something." 1>&2 | |||||
fi | fi | ||||
} | } | ||||
bak(){ | bak(){ | ||||
for file in "$@" | for file in "$@" | ||||
do | do | ||||
cp ${file} ${file}.bak | |||||
cp -v ${file} ${file}.bak | |||||
done | done | ||||
} | } | ||||
di(){ | di(){ | ||||
if type colordiff >/dev/null 2>&1 && test $TERM != dumb | if type colordiff >/dev/null 2>&1 && test $TERM != dumb | ||||
then | then | ||||
@@ -155,23 +229,20 @@ di(){ | |||||
fi | fi | ||||
${diffcmd} -u "$@" | ${PAGER} | ${diffcmd} -u "$@" | ${PAGER} | ||||
} | } | ||||
memo(){ | |||||
__MYMEMO="# $*\n" | |||||
} | |||||
rmmemo(){ | |||||
__MYMEMO="" | |||||
} | |||||
throw-away(){ | throw-away(){ | ||||
mkdir -p ~/bu/tb | |||||
mkdir -p ~/.my/tb | |||||
for file in "$@" | for file in "$@" | ||||
do | do | ||||
mv $file ~/bu/tb | |||||
mv $file ~/.my/tb | |||||
done | done | ||||
} | } | ||||
mkcd(){ | mkcd(){ | ||||
mkdir -p $1 | mkdir -p $1 | ||||
cd $1 | cd $1 | ||||
} | } | ||||
catclip(){ | catclip(){ | ||||
if iswindows | if iswindows | ||||
then | then | ||||
@@ -180,6 +251,7 @@ catclip(){ | |||||
xclip -o -selection "clipboard" | xclip -o -selection "clipboard" | ||||
fi | fi | ||||
} | } | ||||
setclip(){ | setclip(){ | ||||
if iswindows | if iswindows | ||||
then | then | ||||
@@ -198,62 +270,62 @@ setclip(){ | |||||
fi | fi | ||||
fi | fi | ||||
} | } | ||||
o(){ | |||||
if [ $# -eq 0 ] | |||||
then | |||||
local f=. | |||||
if iswindows; then | |||||
alias _open_file='cmd.exe //c start ""' | |||||
elif isdarwin; then | |||||
alias _open_file=open | |||||
elif islinux; then | |||||
if null type pcmanfm; then | |||||
alias _open_file="LC_MESSAGES= pcmanfm" | |||||
else | else | ||||
local f="$1" | |||||
alias _open_file="LC_MESSAGES= xdg-open" | |||||
fi | fi | ||||
if iswindows | |||||
then | |||||
cmd.exe //c start "" "$f" | |||||
elif isdarwin | |||||
else | |||||
alias _open_file=cat | |||||
fi | |||||
o(){ | |||||
if test $# -eq 0 | |||||
then | then | ||||
open "$f" | |||||
_open_file . >/dev/null 2>&1 & | |||||
else | else | ||||
xdg-open "$f" | |||||
for f in "$@" | |||||
do | |||||
if test -d $f | |||||
then | |||||
_open_file $f >/dev/null 2>&1 & | |||||
else | |||||
_open_file $f >/dev/null 2>&1 & | |||||
fi | |||||
done | |||||
fi | fi | ||||
} | } | ||||
convmv-sjis2utf8-test(){ | convmv-sjis2utf8-test(){ | ||||
convmv -r -f sjis -t utf8 * | convmv -r -f sjis -t utf8 * | ||||
} | } | ||||
convmv-sjis2utf8-notest(){ | convmv-sjis2utf8-notest(){ | ||||
convmv -r -f sjis -t utf8 * --notest | convmv -r -f sjis -t utf8 * --notest | ||||
} | } | ||||
_my-dl-init-files(){ | |||||
for file in .bashrc .vimrc .emacs | |||||
do | |||||
local flag=0 | |||||
if test -f ~/${file}.new | |||||
then | |||||
mv ~/${file}.new ~/${file}.old | |||||
echo "${file}.new already exist. Rename it to ${file}.old." | |||||
flag=1 | |||||
fi | |||||
wget https://dl.dropbox.com/u/1751156/${file} -O ~/${file}.new | |||||
local wgetreturn=$? | |||||
if test ${flag} -eq 1 -a ${wgetreturn} -eq 0 | |||||
then | |||||
rm ~/${file}.old | |||||
echo "${file}.old deleted." | |||||
fi | |||||
done | |||||
} | |||||
_mygitconfig(){ | |||||
_my_git_config(){ | |||||
git config --global user.name '10sr' | git config --global user.name '10sr' | ||||
git config --global user.email '8slashes+git@gmail.com' | git config --global user.email '8slashes+git@gmail.com' | ||||
git config --global core.autocrlf false | git config --global core.autocrlf false | ||||
git config --global core.excludesfile '~/.gitignore' | |||||
git config --global color.ui auto | git config --global color.ui auto | ||||
git config --global status.relativePaths false | git config --global status.relativePaths false | ||||
git config --global status.showUntrackedFiles normal | git config --global status.showUntrackedFiles normal | ||||
git config --global alias.graph "log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short" | |||||
git config --global alias.st "status -s" | |||||
git config --global log.date iso | |||||
git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=iso" | |||||
git config --global alias.st "status -s -b" | |||||
git config --global alias.b "branch" | git config --global alias.b "branch" | ||||
git config --global alias.ci "commit --verbose" | git config --global alias.ci "commit --verbose" | ||||
git config --global alias.co "checkout" | git config --global alias.co "checkout" | ||||
git config --global alias.cim "commit --verbose -m" | git config --global alias.cim "commit --verbose -m" | ||||
git config --global alias.di "diff" | |||||
git config --global alias.di "diff --color" | |||||
git config --global alias.me "merge --no-ff --stat -v" | git config --global alias.me "merge --no-ff --stat -v" | ||||
git config --global alias.ls "ls-files -v --full-name" | git config --global alias.ls "ls-files -v --full-name" | ||||
git config --global alias.sl "!sl" | git config --global alias.sl "!sl" | ||||
@@ -265,12 +337,6 @@ _mygitconfig(){ | |||||
fi | fi | ||||
} | } | ||||
if type _git >/dev/null 2>&1 # enable programmable completion of g | |||||
then | |||||
complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \ | |||||
|| complete -o default -o nospace -F _git g | |||||
fi | |||||
__my_parse_svn_branch() { | __my_parse_svn_branch() { | ||||
local LANG=C | local LANG=C | ||||
local svn_url=$(svn info 2>/dev/null | sed -ne 's#^URL: ##p') | local svn_url=$(svn info 2>/dev/null | sed -ne 's#^URL: ##p') | ||||
@@ -279,60 +345,13 @@ __my_parse_svn_branch() { | |||||
} | } | ||||
__my_svn_ps1(){ | __my_svn_ps1(){ | ||||
local svn_branch=$(__my_parse_svn_branch) | |||||
test -n "${svn_branch}" && printf "$1" "{$svn_branch}" | |||||
} | |||||
__my_prompt_function(){ # used by PS1 | |||||
local lastreturn=$? | |||||
if test "${TERM}" == dumb | |||||
if svn status >/dev/null 2>&1 | |||||
then | then | ||||
local c1= | |||||
local c2= | |||||
local c3= | |||||
local cdef= | |||||
else | |||||
local c1="\e[33m" | |||||
local c2="\e[36m" | |||||
local c3="\e[37m" | |||||
local cdef="\e[0m" | |||||
fi | |||||
if iswindows | |||||
then | |||||
local pwd=$PWD | |||||
local oldpwd=$OLDPWD | |||||
local jobnum= | |||||
if git branch >/dev/null 2>&1 | |||||
then | |||||
local git="[GIT]" | |||||
else | |||||
local git= | |||||
fi | |||||
local date=$(/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%') | |||||
: | |||||
else | |||||
local pwd=$(echo "${PWD}/" | sed -e "s#${HOME}#~#") | |||||
local oldpwd=$(echo "${OLDPWD}/" | sed -e "s#${HOME}#~#") | |||||
local jobnum=$(jobs | wc -l) | |||||
local git=$(safe-cmd __git_ps1 [GIT:%s]) | |||||
local date=$(LANG=C safe-cmd date +"%a, %d %b %Y %T %z") | |||||
local svn_branch=$(__my_parse_svn_branch) | |||||
test -n "${svn_branch}" && printf "$1" "{$svn_branch}" | |||||
fi | fi | ||||
local svn=$(type svn >/dev/null 2>&1 && safe-cmd __my_svn_ps1 [SVN:%s]) | |||||
printf "${_MEMO}" | |||||
printf "$(test -f ~/.prompt.sh && bash ~/.prompt.sh)\n" | |||||
printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}\n" | |||||
printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" | |||||
printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " | |||||
} | } | ||||
# type date >/dev/null 2>&1 || alias date=":" # "cmd /c echo %time%" | |||||
if [ "${EMACS}" = "t" ]; then # emacs shell用 | |||||
: export PS1="\u@\H \d \t \w\nemacs shell\$ " | |||||
elif echo "$EMACS" | grep term >/dev/null 2>&1; then # emacs term用 | |||||
echo "emacs term" | |||||
fi | |||||
#Change ANSI Colors | #Change ANSI Colors | ||||
_chengecolors(){ | _chengecolors(){ | ||||
echo -e \ | echo -e \ | ||||
@@ -356,36 +375,58 @@ _chengecolors(){ | |||||
# printf "\e]P7353535" \ | # printf "\e]P7353535" \ | ||||
_echocolors(){ | |||||
_colors(){ | |||||
echo -e \ | |||||
"\e[30mBlack" \ | |||||
"\e[31mRed" \ | |||||
"\e[32mGreen" \ | |||||
"\e[33mYellow" \ | |||||
"\e[34mBlue" \ | |||||
"\e[35mMagenta" \ | |||||
"\e[36mCyan" \ | |||||
"\e[37mWhite" | |||||
echo -e \ | echo -e \ | ||||
"\e[30mBlack\n" \ | |||||
"\e[31mRed\n" \ | |||||
"\e[32mGreen\n" \ | |||||
"\e[33mYellow\n" \ | |||||
"\e[34mBlue\n" \ | |||||
"\e[35mMagenta\n" \ | |||||
"\e[36mCyan\n" \ | |||||
"\e[37mWhite\n" \ | |||||
"\e[30;1mBright Black\n" \ | |||||
"\e[31;1mBright Red\n" \ | |||||
"\e[32;1mBright Green\n" \ | |||||
"\e[33;1mBright Yellow\n" \ | |||||
"\e[34;1mBright Blue\n" \ | |||||
"\e[35;1mBright Magenta\n" \ | |||||
"\e[36;1mBright Cyan\n" \ | |||||
"\e[30;1mBright Black" \ | |||||
"\e[31;1mBright Red" \ | |||||
"\e[32;1mBright Green" \ | |||||
"\e[33;1mBright Yellow" \ | |||||
"\e[34;1mBright Blue" \ | |||||
"\e[35;1mBright Magenta" \ | |||||
"\e[36;1mBright Cyan" \ | |||||
"\e[37;1mBright White\n" \ | "\e[37;1mBright White\n" \ | ||||
"\e[0m" | "\e[0m" | ||||
} | } | ||||
null type stty && { | |||||
stty stop undef # unbind C-s to stop displaying output | |||||
stty erase '^h' | |||||
_my_install_script(){ | |||||
mkdir -p "$HOME/bin/" | |||||
for f in "$@" | |||||
do | |||||
bn=$(basename "$f") | |||||
type $bn >/dev/null 2>&1 || { | |||||
if type wget >/dev/null 2>&1 | |||||
then | |||||
wget "$f" -P "$HOME/bin/" && | |||||
chmod u+x "$HOME/bin/${bn}" | |||||
elif type curl >/dev/null 2>&1 | |||||
then | |||||
curl --url "$f" --output "$HOME/bin/${bn}" && | |||||
chmod u+x "$HOME/bin/${bn}" | |||||
fi | |||||
} | |||||
done | |||||
} | } | ||||
_my_install_script http://www.frexx.de/xterm-256-notes/data/colortable16.sh http://www.frexx.de/xterm-256-notes/data/256colors2.pl | |||||
######################### | |||||
# for windose | |||||
_my_install_symlink_script(){ | |||||
mkdir -p "$HOME/bin/" | |||||
for f in "$@" | |||||
do | |||||
ln -s "$PWD/$f" "$HOME/bin/" | |||||
done | |||||
} | |||||
winln(){ | winln(){ | ||||
# for windose make link (actually junction) | |||||
if test $# -eq 0 | if test $# -eq 0 | ||||
then | then | ||||
{ | { | ||||
@@ -399,39 +440,121 @@ winln(){ | |||||
fi | fi | ||||
} | } | ||||
######################## | |||||
__my_battery_status(){ | |||||
local dir=/sys/class/power_supply/BAT0 | |||||
if test -d $dir | |||||
then | |||||
local st=$(cat $dir/status) | |||||
local full=$(cat $dir/charge_full) | |||||
local now=$(cat $dir/charge_now) | |||||
local rate=$(expr $now \* 100 / $full) | |||||
printf "$1" "${st}:${rate}%" | |||||
fi | |||||
} | |||||
alias bat='__my_battery_status %s\\n' | |||||
if iscygwin; then | |||||
alias cygsu="cygstart /cygwinsetup.exe" | |||||
alias emacs="CYGWIN=tty emacs -nw" | |||||
echo "cygwin bash" | |||||
fi | |||||
ip-address(){ | |||||
test type ifconfig >/dev/null 2>&1 || return 1 | |||||
local ip=$(LANG=C ifconfig | \grep --color=never "inet " | \grep --color=never -v "127.0.0.1" | awk '{print $2}') | |||||
test -n "$ip" && printf $1 $ip | |||||
} | |||||
if iswindows; then | |||||
# export TMP=/tmp | |||||
# export TEMP=/tmp | |||||
# export PS1=" \[\e[32m\]\u@\H \[\e[33m\]\w\[\e[0m\] \d \t\n\s \# \j \$ " | |||||
# export PS1=" [\[\e[33m\]\w\[\e[0m\]]\n\[\e[32m\]\u@\H\[\e[0m\] \d \t \s.\v\nhist:\# jobs:\j \$ " | |||||
alias ls="ls -CFG $(test "$TERM" == dumb || echo --color=auto)" | |||||
export USER=$USERNAME | |||||
__my_ps1_moc(){ | |||||
local last=$? | |||||
__my_moc_state "[MOC:%s]" | |||||
return $last | |||||
} | |||||
__my_ps1_git(){ | |||||
local last=$? | |||||
__try_exec __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]" | |||||
return $last | |||||
} | |||||
__my_ps1_ipaddr(){ | |||||
local last=$? | |||||
test -z "$DISPLAY" && ! iswindows && ip-address [Addr:%s] | |||||
return $last | |||||
} | |||||
__my_ps1_bttry(){ | |||||
local last=$? | |||||
local bst="/tmp/${USER}-tmp/batterystatus" | |||||
if test -z "$DISPLAY" && ! iswindows | |||||
then | |||||
test -f $bst && echo "[Battery:$(cat $bst)]" | |||||
__my_battery_status %s >$bst & | |||||
fi | |||||
return $last | |||||
} | |||||
__my_ps1_dirs(){ | |||||
dirs | wc -l | |||||
} | |||||
__my_ps1_jobs(){ | |||||
jobs | wc -l | |||||
} | |||||
if test "$TERM" != dumb | |||||
then | |||||
__my_c1="\[\e[1;31m\]" # color for PWD | |||||
__my_c2="\[\e[0;36m\]" # color for user | |||||
__my_c3="\[\e[1;30m\]" # color for OLDPWD | |||||
__my_c4="\[\e[1;32m\]" # color for :: | |||||
__my_cdef="\[\e[0m\]" | |||||
fi | fi | ||||
_PS1="\ | |||||
${__my_c4}:: ${__my_cdef}[${__my_c1}\w/${__my_cdef}<${__my_c3}\${OLDPWD}${__my_cdef}]\$(__my_ps1_git)\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\$(__my_ps1_moc)\n\ | |||||
${__my_c4}:: ${__my_c2}\u@\H${__my_cdef} \D{%a, %d %b %Y %T %z} ${SHELL} \V\n\ | |||||
${__my_c4}:: ${__my_cdef}shlv:${SHLVL} cnum:\# jobs:\j last:\$? \$ " | |||||
PS1=$_PS1 | |||||
__my_set_title(){ | |||||
title="$(echo $@)" | |||||
case $TERM in | |||||
(rxvt*|xterm*|aterm|screen*) | |||||
test -t 1 && | |||||
test -n "$DISPLAY" && | |||||
test -z "$EMACS" && | |||||
echo -n -e "\033]0;${title}\007" | |||||
;; | |||||
esac | |||||
} | |||||
export PROMPT_COMMAND="__my_set_title \${USER}@\${HOSTNAME}\ \${PWD};" | |||||
# copied from https://wiki.archlinux.org/index.php/X_resources | |||||
invader(){ | |||||
# ANSI color scheme script featuring Space Invaders | |||||
# | |||||
# Original: http://crunchbanglinux.org/forums/post/126921/#p126921 | |||||
# Modified by lolilolicon | |||||
# | |||||
f=3 b=4 | |||||
for j in f b; do | |||||
for i in {0..7}; do | |||||
printf -v $j$i %b "\e[${!j}${i}m" | |||||
done | |||||
done | |||||
bld=$'\e[1m' | |||||
rst=$'\e[0m' | |||||
####################### | |||||
cat << EOF | |||||
_testjp(){ | |||||
echo "Japanese letters are 表示可能" | |||||
} | |||||
_testjp | |||||
$f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst | |||||
$f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst | |||||
$f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst | |||||
$f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst | |||||
uname -a | |||||
test -f /etc/issue.net && cat /etc/issue.net | |||||
$bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst | |||||
$bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst | |||||
$bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst | |||||
$bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst | |||||
safe-cmd diskinfo | |||||
! isdarwin && test -n "${DESKTOP_SESSION}" && type xrandr >/dev/null 2>&1 && { | |||||
xrandr | grep --color=never ^Screen | |||||
} | |||||
$f7▌$rst | |||||
iswindows || safe-cmd finger $USER | |||||
LANG=C safe-cmd id | |||||
$f7▌$rst | |||||
$f7 ▄█▄ $rst | |||||
$f7▄█████████▄$rst | |||||
$f7▀▀▀▀▀▀▀▀▀▀▀$rst | |||||
EOF | |||||
} | |||||
#/etc/lsb-release |
@@ -0,0 +1,101 @@ | |||||
# ~/.conkyrc | |||||
# | |||||
double_buffer yes | |||||
background no | |||||
use_xft yes | |||||
xftfont DejaVu Sans Mono:size=10 | |||||
xftalpha 0.8 | |||||
update_interval 1.0 | |||||
total_run_times 0 | |||||
own_window yes | |||||
own_window_type desktop | |||||
own_window_transparent yes | |||||
own_window_colour hotpink | |||||
own_window_hints undecorated,below,skip_taskbar,sticky,skip_pager | |||||
minimum_size 200 | |||||
draw_shades no | |||||
draw_outline no | |||||
draw_borders no | |||||
stippled_borders 0 | |||||
border_width 1 | |||||
alignment top_right | |||||
gap_x 20 | |||||
gap_y 40 | |||||
default_color green # slategrey | |||||
default_shade_color lightgrey | |||||
default_outline_color black | |||||
color0 white # value | |||||
color1 white # vertical border | |||||
color2 green # name | |||||
color3 gray # displays | |||||
color4 888888 # border of netspeed graph | |||||
no_buffers yes | |||||
uppercase no | |||||
format_human_readable yes | |||||
if_up_strictness link | |||||
TEXT | |||||
${color0}${alignr}${sysname} ${kernel} (${machine}) | |||||
${color0}${alignr}${execi 30000 whoami}@${nodename} | |||||
${color0}${hr} | |||||
${color2}uptm ${color1}|${color0} ${uptime} | |||||
${color2}lgin ${color1}|${color0} ${uptime} | |||||
${color0}${stippled_hr} | |||||
${color2}cpu ${color1}|${color0} ${cpu}% ${cpubar} | |||||
${color2}freq ${color1}|${color0} ${freq 1}Mhz | ${freq 2}Mhz | |||||
${color2}temp ${color1}|${color0} ${acpitemp} °C | |||||
${color0}${hr} | |||||
${color2}ram ${color1}|${color0} ${mem} ${membar} | |||||
${color2}swap ${color1}|${color0} ${if_match "${swapperc}" == "No swap"}None${else}${swap} ${swapbar}${endif} | |||||
${color0}${stippled_hr} | |||||
${color2}root ${color1}|${color0} ${fs_used /} #/${fs_size /} | |||||
${fs_bar /} | |||||
${color2}/tmp ${color1}|${color0} ${fs_used /tmp} #/${fs_size /tmp} | |||||
${fs_bar /tmp} | |||||
${color2}i/o ${color1}|${color0} ${diskio} | |||||
${color0}${hr} | |||||
${if_up wlan0}\ | |||||
${color2}if ${color1}|${color0} wlan0:${addr wlan0} | |||||
${color2}ssid ${color1}|${color0} ${wireless_essid wlan0} ${wireless_link_qual_perc wlan0}% | |||||
${color0}${stippled_hr} | |||||
${color2}down ${color1}|${color0} ${downspeed wlan0}/s | |||||
${color4}${downspeedgraph wlan0 ff0000 0000ff} | |||||
${color2}up ${color1}|${color0} ${upspeed wlan0}/s | |||||
${color4}${upspeedgraph wlan0 0000ff ff0000} | |||||
${endif}\ | |||||
${if_up wlan2}\ | |||||
${color2}if ${color1}|${color0} wlan0:${addr wlan2} | |||||
${color2}ssid ${color1}|${color0} ${wireless_essid wlan2} ${wireless_link_qual_perc wlan2}% | |||||
${color0}${stippled_hr} | |||||
${color2}down ${color1}|${color0} ${downspeed wlan2}/s | |||||
${color4}${downspeedgraph wlan2 ff0000 0000ff} | |||||
${color2}up ${color1}|${color0} ${upspeed wlan2}/s | |||||
${color4}${upspeedgraph wlan2 0000ff ff0000} | |||||
${endif}\ | |||||
${if_up eth0}\ | |||||
${color2}if ${color1}|${color0} eth0:${addr eth0} | |||||
${color0}${stippled_hr} | |||||
${color2}down ${color1}|${color0} ${downspeed eth0}/s | |||||
${color4}${downspeedgraph eth0 ff0000 0000ff} | |||||
${color2}up ${color1}|${color0} ${upspeed eth0}/s | |||||
${color4}${upspeedgraph eth0 0000ff ff0000} | |||||
${endif}\ | |||||
${if_up eth2}\ | |||||
${color2}if ${color1}|${color0} eth2:${addr eth2} | |||||
${color0}${stippled_hr} | |||||
${color2}down ${color1}|${color0} ${downspeed eth2}/s | |||||
${color4}${downspeedgraph eth2 ff0000 0000ff} | |||||
${color2}up ${color1}|${color0} ${upspeed eth2}/s | |||||
${color4}${upspeedgraph eth2 0000ff ff0000} | |||||
${endif}\ | |||||
${color0}${alignr}conky ${conky_version} | |||||
${color0}${hr} | |||||
${color3}${alignr}${texeci 10 bash -c 'xrandr|grep " connected "|cut -f 1,3 -d " "'} |
@@ -0,0 +1,40 @@ | |||||
# ~/.conkyrc | |||||
# | |||||
double_buffer yes | |||||
background no | |||||
use_xft yes | |||||
xftfont DejaVu Sans Mono:size=10 | |||||
xftalpha 0.8 | |||||
update_interval 1.0 | |||||
total_run_times 0 | |||||
own_window yes | |||||
own_window_type desktop | |||||
own_window_transparent yes | |||||
own_window_colour hotpink | |||||
own_window_hints undecorated,below,skip_taskbar,sticky,skip_pager | |||||
minimum_size 200 | |||||
#maximum_width 2000 | |||||
draw_shades no | |||||
draw_outline no | |||||
draw_borders no | |||||
stippled_borders 0 | |||||
border_width 1 | |||||
default_color green # slategrey | |||||
default_shade_color lightgrey | |||||
default_outline_color black | |||||
alignment bottom_left | |||||
gap_x 20 | |||||
gap_y 20 | |||||
no_buffers yes | |||||
uppercase no | |||||
format_human_readable yes | |||||
TEXT | |||||
${color yellow}$$ tail -f -n 10 /var/log/everything.log | |||||
${color white}${tail /var/log/everything.log 10} | |||||
${time %b %_d %T} |
@@ -0,0 +1,32 @@ | |||||
<?xml version="1.0"?> | |||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |||||
<fontconfig> | |||||
<alias binding='strong'> | |||||
<family>serif</family> | |||||
<prefer> | |||||
<family>DejaVu Serif</family> | |||||
</prefer> | |||||
</alias> | |||||
<alias> | |||||
<family>serif</family> | |||||
<prefer> | |||||
<family>monapo</family> | |||||
</prefer> | |||||
</alias> | |||||
<alias binding='strong'> | |||||
<family>sans-serif</family> | |||||
<prefer> | |||||
<family>DejaVu Sans</family> | |||||
<family>monapo</family> | |||||
</prefer> | |||||
</alias> | |||||
<alias binding='strong'> | |||||
<family>monospace</family> | |||||
<prefer> | |||||
<family>DejaVu Sans Mono</family> | |||||
<family>monapo</family> | |||||
</prefer> | |||||
</alias> | |||||
</fontconfig> |
@@ -1,42 +1,39 @@ | |||||
#!/bin/sh | #!/bin/sh | ||||
env > $HOME/.env.txt | |||||
if [ -n "${DESKTOP_SESSION}" ]; then | |||||
xmodmap -e 'keycode 135 = Alt_R Meta_R' # menu key as alt | |||||
xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt | |||||
xmodmap -e 'remove Lock = Caps_Lock' | |||||
xmodmap -e 'add Control = Caps_Lock' | |||||
# ~/.dotfiles/profile | |||||
synclient VertEdgeScroll=0 | |||||
synclient HorizEdgeScroll=0 | |||||
synclient MaxTapTime=0 | |||||
synclient MaxSpeed=0.4 | |||||
synclient MinSpeed=0.2 | |||||
test -f "$HOME/.fehbg" && | |||||
type feh >/dev/null 2>&1 && | |||||
sh "$HOME/.fehbg" | |||||
else | |||||
export LANG=C | |||||
fi | |||||
type fortune >/dev/null 2>&1 && { | |||||
echo | |||||
fortune | |||||
echo | |||||
fortune -o | |||||
echo | |||||
} | |||||
# export PS1="\$ " | # export PS1="\$ " | ||||
# export LANG=ja_JP.UTF-8 | |||||
export LC_TIME=C | export LC_TIME=C | ||||
export TERMCAP="${TERMCAP}:vb=" | export TERMCAP="${TERMCAP}:vb=" | ||||
export HOSTNAME | export HOSTNAME | ||||
export BROWSER=firefox | |||||
export ENV=~/.shrc | |||||
export PYTHONDOCS=/usr/share/doc/python/html/ | |||||
# export TMP=/tmp | # export TMP=/tmp | ||||
# export TEMP=/tmp | # export TEMP=/tmp | ||||
test -f "${HOME}/.pythonrc" && export PYTHONSTARTUP="${HOME}/.pythonrc" | |||||
#export PYTHONPATH="~/.local/share/lib/python3.2/site-packages" | |||||
addtopath(){ | |||||
__add_to_path(){ | |||||
for p in "$@" | for p in "$@" | ||||
do | do | ||||
echo $PATH | grep -E "^$p:|:$p:|:$p$" >/dev/null 2>&1 || PATH="$p:${PATH}" | |||||
echo $PATH | grep -E "^$p:|:$p:|:$p$" >/dev/null 2>&1 || PATH="${PATH}:$p" | |||||
done | done | ||||
} | } | ||||
# export PATH="${PATH}:${HOME}/bin" | # export PATH="${PATH}:${HOME}/bin" | ||||
addtopath ${HOME}/bin | |||||
__add_to_path ${HOME}/bin /c/mingw/bin /c/mingw/msys/1.0/bin | |||||
test -f "${HOME}/.pythonrc" && export PYTHONSTARTUP="${HOME}/.pythonrc" | |||||
export PYTHONPATH=~/.py | |||||
type setterm >/dev/null 2>&1 && setterm -blank 30 -powersave on # -powerdown 10 | |||||
# in my environment powerdown does not work | |||||
mkdir -p ~/.my/log | |||||
mkdir -p "/tmp/$USER-tmp" | |||||
@@ -0,0 +1,118 @@ | |||||
# Tint2 config file | |||||
# Generated by tintwizard (http://code.google.com/p/tintwizard/) | |||||
# For information on manually configuring tint2 see http://code.google.com/p/tint2/wiki/Configure | |||||
# Background definitions | |||||
# ID 1 | |||||
rounded = 1 | |||||
border_width = 0 | |||||
background_color = #282828 100 | |||||
border_color = #000000 0 | |||||
# ID 2 | |||||
rounded = 1 | |||||
border_width = 1 | |||||
background_color = #CCCCCC 0 | |||||
border_color = #CCCCCC 45 | |||||
# ID 3 | |||||
rounded = 1 | |||||
border_width = 0 | |||||
background_color = #CCCCCC 20 | |||||
border_color = #CCCCCC 40 | |||||
# Panel | |||||
panel_monitor = all | |||||
panel_position = top center horizontal | |||||
panel_size = 100% 30 | |||||
panel_margin = 0 0 | |||||
panel_padding = 3 3 7 | |||||
panel_dock = 0 | |||||
wm_menu = 1 | |||||
panel_layer = top | |||||
panel_background_id = 1 | |||||
# Panel Autohide | |||||
autohide = 0 | |||||
autohide_show_timeout = 0.7 | |||||
autohide_hide_timeout = 1.5 | |||||
autohide_height = 2 | |||||
strut_policy = follow_size | |||||
# Taskbar | |||||
taskbar_mode = single_desktop | |||||
taskbar_padding = 0 0 0 | |||||
taskbar_background_id = 2 | |||||
taskbar_active_background_id = 2 | |||||
# Tasks | |||||
urgent_nb_of_blink = 7 | |||||
task_icon = 1 | |||||
task_text = 1 | |||||
task_centered = 0 | |||||
task_maximum_size = 200 34 | |||||
task_padding = 9 3 | |||||
task_background_id = 0 | |||||
task_active_background_id = 3 | |||||
task_urgent_background_id = 0 | |||||
task_iconified_background_id = 0 | |||||
# Task Icons | |||||
task_icon_asb = 100 0 0 | |||||
task_active_icon_asb = 100 0 0 | |||||
task_urgent_icon_asb = 100 0 0 | |||||
task_iconified_icon_asb = 100 0 0 | |||||
# Fonts | |||||
task_font = Sans 9 | |||||
task_font_color = #FFFFFF 60 | |||||
task_active_font_color = #FFFFFF 100 | |||||
task_urgent_font_color = #FFFFFF 60 | |||||
task_iconified_font_color = #FFFFFF 60 | |||||
font_shadow = 0 | |||||
# System Tray | |||||
systray = 1 | |||||
systray_padding = 0 0 5 | |||||
systray_sort = ascending | |||||
systray_background_id = 0 | |||||
systray_icon_size = 16 | |||||
systray_icon_asb = 100 0 0 | |||||
# Clock | |||||
time1_format = %a, %d %b %Y %H:%M:%S | |||||
time1_font = Sans 9 | |||||
clock_font_color = #FFFFFF 100 | |||||
clock_tooltip = | |||||
clock_padding = 1 0 | |||||
clock_background_id = 0 | |||||
clock_lclick_command = gsimplecal | |||||
clock_rclick_command = gsimplecal | |||||
# Tooltips | |||||
tooltip = 1 | |||||
tooltip_padding = 5 4 | |||||
tooltip_show_timeout = 0.8 | |||||
tooltip_hide_timeout = 0.3 | |||||
tooltip_background_id = 1 | |||||
tooltip_font = Sans 7 | |||||
tooltip_font_color = #FFFFFF 100 | |||||
# Mouse | |||||
mouse_middle = none | |||||
mouse_right = close | |||||
mouse_scroll_up = toggle | |||||
mouse_scroll_down = iconify | |||||
# Battery | |||||
battery = 1 | |||||
battery_low_status = 7 | |||||
battery_low_cmd = notify-send "battery low" | |||||
battery_hide = 0 | |||||
bat1_font = Monospace 9 | |||||
bat2_font = Sans 7 | |||||
battery_font_color = #FFFFFF 100 | |||||
battery_padding = 1 0 | |||||
battery_background_id = 0 | |||||
# End of config |
@@ -0,0 +1,13 @@ | |||||
unbind C-b | |||||
set -g prefix C-z | |||||
bind-key C-z send-prefix | |||||
bind-key C command-prompt "new-window '%%'" | |||||
set -g default-command /bin/bash | |||||
#set -g default-terminal screen-16color | |||||
set -g default-terminal screen-256color | |||||
#set -g status-left "" | |||||
#set -g status-right "#H | %a, %d %b %Y %T %z #(tmux -V)" | |||||
set -g status-right "#H | #(tmux -V) " | |||||
set -g set-titles on | |||||
setw -g mode-keys vi |
@@ -20,24 +20,25 @@ set viminfo+=n~/.vim/viminfo " viminfo | |||||
set list " タブ文字、行末など不可視文字を表示する | set list " タブ文字、行末など不可視文字を表示する | ||||
set listchars=tab:>-,extends:<,trail:-,eol:$ " listで表示される文字のフォーマットを指定する | set listchars=tab:>-,extends:<,trail:-,eol:$ " listで表示される文字のフォーマットを指定する | ||||
set showmatch " 閉じ括弧が入力されたとき、対応する括弧を表示する | set showmatch " 閉じ括弧が入力されたとき、対応する括弧を表示する | ||||
set ignorecase | |||||
set smartcase " 検索時に大文字を含んでいたら大/小を区別 | |||||
set whichwrap=b,s,h,l,<,>,[,] " カーソルを行頭、行末で止まらないようにする | |||||
"set whichwrap=b,s,h,l,<,>,[,] " カーソルを行頭、行末で止まらないようにする | |||||
set showmode " モード表示 | set showmode " モード表示 | ||||
set notitle " do not display editting file on titlebar | |||||
set incsearch | |||||
set title " display editting file on titlebar | |||||
"set incsearch | |||||
set wrapscan " 折り返し検索 | set wrapscan " 折り返し検索 | ||||
set showmatch " 括弧を閉じた時、対になる括弧を一瞬ハイライトする | set showmatch " 括弧を閉じた時、対になる括弧を一瞬ハイライトする | ||||
set ignorecase | |||||
set smartcase " 検索時に大文字を含んでいたら大/小を区別 | |||||
set incsearch | |||||
set wildmode=longest,list,full | set wildmode=longest,list,full | ||||
set ruler " 行番号、カーソル位置を表示 | set ruler " 行番号、カーソル位置を表示 | ||||
set nonumber " do not show line number at left side | set nonumber " do not show line number at left side | ||||
set laststatus=2 " ステータスラインを常に表示 | |||||
"set laststatus=2 " ステータスラインを常に表示 | |||||
set showcmd | set showcmd | ||||
set scrolloff=2 " 常に前後2行を表示 | set scrolloff=2 " 常に前後2行を表示 | ||||
syntax enable " シンタックス | syntax enable " シンタックス | ||||
set hidden " 編集中でも他ファイルへ移動可 | set hidden " 編集中でも他ファイルへ移動可 | ||||
set backspace=indent,eol,start " バックスペースでなんでも消せるように | |||||
" set autochdir " 自動的にカレントディレクトリを現在のファイルのディレクトリにする macだと出来ないってゆわれた | |||||
"set backspace=indent,eol,start " バックスペースでなんでも消せるように | |||||
"set autochdir " 自動的にカレントディレクトリを現在のファイルのディレクトリにする macだと出来ないってゆわれた | |||||
set encoding=utf-8 " 言語設定 | set encoding=utf-8 " 言語設定 | ||||
set fileencodings=utf-8,shift-jis,euc-jp,latin1 | set fileencodings=utf-8,shift-jis,euc-jp,latin1 | ||||
set mouse=h " マウス使わない | set mouse=h " マウス使わない | ||||
@@ -51,6 +52,7 @@ set shiftwidth=4 " width of indent | |||||
set expandtab " タブをスペースに展開する | set expandtab " タブをスペースに展開する | ||||
set autoindent " オートインデント | set autoindent " オートインデント | ||||
set smartindent | set smartindent | ||||
set cindent | |||||
filetype plugin indent on | filetype plugin indent on | ||||
let g:netrw_liststyle = 1 | let g:netrw_liststyle = 1 | ||||
@@ -67,7 +69,7 @@ if has('gui_running') | |||||
endif | endif | ||||
if has('win32') | if has('win32') | ||||
" Windows 用の設定 | |||||
" prefs for Windows | |||||
endif | endif | ||||
""""""""""""""""""""""""""""""""""""""" | """"""""""""""""""""""""""""""""""""""" | ||||
@@ -85,19 +87,6 @@ inoremap <ESC> <ESC>:<C-u>w<CR> | |||||
inoremap <C-c> <ESC>:<C-u>w<CR> | inoremap <C-c> <ESC>:<C-u>w<CR> | ||||
noremap <C-c> <ESC>:<C-u>w<CR> | noremap <C-c> <ESC>:<C-u>w<CR> | ||||
" 方向キーでバッファ操作 | |||||
" nnoremap <LEFT> <C-c>:bp!<CR> | |||||
" nnoremap <RIGHT> <C-c>:bn!<CR> | |||||
" nnoremap <UP> <C-c>:ls!<CR> | |||||
" nnoremap <DOWN> <C-c>:bd | |||||
" nnoremap <C-m>cd <C-c>:cd%:h<CR> | |||||
nnoremap <C-o> <C-c>:Explore<CR> | |||||
" http://d.hatena.ne.jp/yuroyoro/20101104/1288879591 | |||||
" 見た目で行移動 | |||||
nnoremap j gj | |||||
nnoremap k gk | |||||
" highlight current line | " highlight current line | ||||
" set cursorline | " set cursorline | ||||
" カレントウィンドウにのみ罫線を引く | " カレントウィンドウにのみ罫線を引く | ||||
@@ -0,0 +1,45 @@ | |||||
! | |||||
! ckw setting | |||||
! | |||||
Ckw*foreground: white | |||||
Ckw*background: black | |||||
! Ckw*cursorColor: green | |||||
! Ckw*cursorImeColor: red | |||||
! Ckw*backgroundBitmap: ckw_background.bmp | |||||
Ckw*title: ckw[bash] | |||||
Ckw*exec: C:\Windows\System32\cmd.exe /c ""C:\Program Files\Git\bin\sh.exe" --login -i" | |||||
! Ckw*chdir: c:\ | |||||
Ckw*scrollHide: yes | |||||
! Ckw*scrollRight: yes | |||||
Ckw*internalBorder: 2 | |||||
Ckw*lineSpace: 0 | |||||
Ckw*topmost: no | |||||
Ckw*transp: 240 | |||||
Ckw*transpColor: #000000 | |||||
Ckw*font: dejavu sans mono | |||||
Ckw*fontSize: 13 | |||||
Ckw*geometry: 120x39 | |||||
Ckw*saveLines: 500 | |||||
Ckw*color0: #000000 | |||||
Ckw*color1: #0000FF | |||||
Ckw*color2: #00FF00 | |||||
Ckw*color3: #00FFFF | |||||
Ckw*color4: #FF0000 | |||||
Ckw*color5: #FF00FF | |||||
Ckw*color6: #FFFF00 | |||||
Ckw*color7: #C0C0C0 | |||||
Ckw*color8: #808080 | |||||
Ckw*color9: #8888FF | |||||
Ckw*color10: #88FF88 | |||||
Ckw*color11: #88FFFF | |||||
Ckw*color12: #FF8888 | |||||
Ckw*color13: #FF88FF | |||||
Ckw*color14: #FFFF88 | |||||
Ckw*color15: #FFFFFF |
@@ -0,0 +1,33 @@ | |||||
test "`hostname`" == "arch-aspireone" && | |||||
setxkbmap -model "acer_laptop" -layout "jp" # this line must comes first | |||||
setxkbmap -option "ctrl:nocaps,ctrl:menu_rctrl" | |||||
xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt | |||||
#xmodmap -e 'remove Lock = Caps_Lock' | |||||
#xmodmap -e 'add Control = Caps_Lock' | |||||
type synclient >/dev/null 2>&1 && { | |||||
synclient MaxSpeed=1.6 | |||||
synclient MinSpeed=0.2 | |||||
synclient TouchpadOff=2 # tapping and scrolling are disabled | |||||
} | |||||
xset s 1800 # go blank after 30 min | |||||
xset dpms 1810 1820 1830 # standby, suspend and off seem not to be different for my environment | |||||
unset LC_MESSAGES | |||||
export LANG=ja_JP.utf8 | |||||
export BROWSER=firefox | |||||
export DMENU_FONT='-*-dejavu sans mono-*-r-*-*-11-*-*-*-*-*-*-*' | |||||
__upper(){ | |||||
echo $1 | tr '[:lower:]' '[:upper:]' | |||||
} | |||||
XDG_DIRS=$HOME/.xdg-dirs | |||||
for f in Desktop Download Templates Publicshare Documents Music Pictures Videos | |||||
do | |||||
export XDG_`__upper $f`_DIR=$XDG_DIRS/$f | |||||
mkdir -p $XDG_DIRS/$f | |||||
done |
@@ -0,0 +1,67 @@ | |||||
#!/bin/sh | |||||
# Programs run in background when starting x. | |||||
# Japanese IM settings are not included in this list. | |||||
_feh(){ | |||||
test -f "$HOME/.fehbg" && | |||||
type feh >/dev/null 2>&1 && | |||||
sh "$HOME/.fehbg" | |||||
} | |||||
_tint2(){ | |||||
#tint2 -c ~/.dotfiles/tint2rc & | |||||
tint2 & | |||||
} | |||||
_dropbox(){ | |||||
dropboxd & # done by ~/.config/autostart/dropbox.desktop | |||||
} | |||||
_volumeicon(){ | |||||
volumeicon & | |||||
} | |||||
_gsoundap(){ | |||||
gnome-sound-applet & | |||||
} | |||||
_conky(){ | |||||
conky -c ~/.dotfiles/conkyrc >~/.backup/log/conky.log 2>&1 & | |||||
conky -c ~/.dotfiles/conkyrc.2 >~/.backup/log/conky.2.log 2>&1 & | |||||
} | |||||
_wicd(){ | |||||
# done by /etc/xdg/autostart/wicd-client.desktop | |||||
wicd-client --tray & | |||||
} | |||||
_udisksvm(){ | |||||
# Detection of insertion of an optical disk | |||||
if ! pgrep -lf "udisks-daemon: polling /dev/sr0"; then | |||||
udisks --poll-for-media /dev/sr0 | |||||
fi | |||||
udisksvm >/dev/null & | |||||
} | |||||
_xcompmgr(){ | |||||
xcompmgr -c & | |||||
} | |||||
_saku(){ | |||||
(cd ~/src/saku-3.11.1/ && python2 saku.py) & | |||||
} | |||||
_gkeyring(){ | |||||
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 & | |||||
eval $(gnome-keyring-daemon -s) & | |||||
} | |||||
_nmapplet(){ | |||||
nm-applet & | |||||
} | |||||
for p in $@ | |||||
do | |||||
_$p | |||||
done | |||||