{"id":214,"date":"2016-04-02T13:55:00","date_gmt":"2016-04-02T04:55:00","guid":{"rendered":"http:\/\/arat.xyz\/wordpress\/?p=214"},"modified":"2016-04-02T14:37:21","modified_gmt":"2016-04-02T05:37:21","slug":"%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%83%a1%e3%83%8b%e3%83%a5%e3%83%bc%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92peco%e3%81%a7%e9%81%b8%e6%8a%9e%e3%81%99%e3%82%8b%e3%81%9f%e3%82%81%e3%81%ae%e3%82%b9","status":"publish","type":"post","link":"https:\/\/www.arat.xyz\/wordpress\/?p=214","title":{"rendered":"\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u306e\u5185\u5bb9\u3092peco\u3067\u9078\u629e\u3059\u308b\u305f\u3081\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210"},"content":{"rendered":"<div id=\"outline-container-orgheadline1\" class=\"outline-2\">\n<h2 id=\"orgheadline1\">\u7d4c\u7def<\/h2>\n<div class=\"outline-text-2\" id=\"text-orgheadline1\">\n<p> \u4ee5\u524d\u306ffluxbox\u3092\u4f7f\u7528\u3057\u3066\u304a\u308a\u3001\u53f3\u30af\u30ea\u30c3\u30af\u3067\u30e1\u30cb\u30e5\u30fc\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u306e\u30e1\u30cb\u30e5\u30fc\u306f\u30d5\u30a1\u30a4\u30eb\u3092\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u3067\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u307e\u3057\u305f\u3002 <\/p>\n<p> \u73fe\u5728xmonad\u306b\u79fb\u884c\u3057\u3066\u304a\u308a\u3001\u3044\u304f\u3064\u304b\u306e\u30ad\u30fc\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5272\u308a\u5f53\u3066\u3066\u3044\u307e\u3059\u3002 <\/p>\n<p> \u5272\u308a\u5f53\u3066\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u591a\u304f\u306a\u308b\u3068\u899a\u3048\u308b\u306e\u304c\u5927\u5909\u306a\u306e\u3067\u3001\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u308b\u30e1\u30cb\u30e5\u30fc\u304c\u306a\u3044\u304b\u3068\u63a2\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\uff08\u63a2\u3057\u65b9\u304c\u60aa\u3044\u305f\u3081\uff1f\uff09\u3002 <\/p>\n<p> \u305d\u3053\u3067\u81ea\u5206\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u304d\u307e\u3057\u305f\u3002\u6163\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u591a\u5c11\u6642\u9593\u306f\u304b\u304b\u308a\u307e\u3057\u305f\u3002 <\/p>\n<\/div>\n<\/div>\n<div id=\"outline-container-orgheadline7\" class=\"outline-2\">\n<h2 id=\"orgheadline7\">\u5185\u5bb9<\/h2>\n<div class=\"outline-text-2\" id=\"text-orgheadline7\">\n<\/div>\n<div id=\"outline-container-orgheadline2\" class=\"outline-3\">\n<h3 id=\"orgheadline2\">Ruby\u30b9\u30af\u30ea\u30d7\u30c8<\/h3>\n<div class=\"outline-text-3\" id=\"text-orgheadline2\">\n<p> <a href=\"https:\/\/github.com\/toshi-ara\/mymenu.rb\">GitHub<\/a> \u3067\u516c\u958b\u3057\u3066\u3044\u307e\u3059\u3002 <\/p>\n<div class=\"org-src-container\">\n<pre class=\"src src-ruby\"><span style=\"color: #656565;\">#<\/span><span style=\"color: #757575;\">!\/usr\/bin\/env ruby<\/span>\n<span style=\"color: #656565;\"># <\/span><span style=\"color: #757575;\">coding: utf-8<\/span>\n\n<span style=\"color: #656565;\"># <\/span><span style=\"color: #757575;\">peco binary<\/span>\n<span style=\"color: #cd5542;\">PECO<\/span> = <span style=\"color: #cd5542;\">File<\/span>.expand_path <span style=\"color: #bdbc61;\">\"\/usr\/bin\/peco\"<\/span>\n\n<span style=\"color: #656565;\"># <\/span><span style=\"color: #757575;\">terminal emulator (xterm\/urxvt\/mlterm)<\/span>\n<span style=\"color: #cd5542;\">XTERM<\/span> = <span style=\"color: #bdbc61;\">\"mlterm\"<\/span>\n\n<span style=\"color: #656565;\"># <\/span><span style=\"color: #757575;\">menu list<\/span>\nmenufile = <span style=\"color: #cd5542;\">File<\/span>.expand_path <span style=\"color: #bdbc61;\">\"~\/.mymenu\"<\/span>\n\n\n<span style=\"color: #528fd1;\">require<\/span> <span style=\"color: #bdbc61;\">'tempfile'<\/span>\n\n<span style=\"color: #5180b3;\">class<\/span> <span style=\"color: #cd5542;\">MyMenu<\/span>\n  <span style=\"color: #5180b3;\">def<\/span> <span style=\"color: #6aaf50;\">initialize<\/span>(menufile)\n    <span style=\"color: #baba36;\">@menufile<\/span> = menufile\n    <span style=\"color: #baba36;\">@appfilepath<\/span> = <span style=\"color: #cd5542;\">Tempfile<\/span>.new(<span style=\"color: #bdbc61;\">\"tmpnew\"<\/span>).path\n    <span style=\"color: #baba36;\">@hash<\/span> = <span style=\"color: #cd5542;\">Hash<\/span>.new\n  <span style=\"color: #5180b3;\">end<\/span>\n\n  <span style=\"color: #528fd1;\">protected<\/span>\n\n  <span style=\"color: #5180b3;\">def<\/span> <span style=\"color: #6aaf50;\">set_hash_and_list<\/span>\n    io1 = <span style=\"color: #cd5542;\">File<\/span>.open(<span style=\"color: #baba36;\">@menufile<\/span>, <span style=\"color: #bdbc61;\">\"r\"<\/span>)     <span style=\"color: #656565;\"># <\/span><span style=\"color: #757575;\">filelist<\/span>\n    io2 = <span style=\"color: #cd5542;\">File<\/span>.open(<span style=\"color: #baba36;\">@appfilepath<\/span>, <span style=\"color: #bdbc61;\">\"w\"<\/span>)  <span style=\"color: #656565;\"># <\/span><span style=\"color: #757575;\">list of application name<\/span>\n\n    io1.each {|line|\n      line.strip!\n      line.chomp!\n      <span style=\"color: #5180b3;\">next<\/span> <span style=\"color: #5180b3;\">if<\/span> line == <span style=\"color: #bdbc61;\">\"\"<\/span> || (<span style=\"color: #bdbc61;\">\/^#\/<\/span> =~ line)\n\n      rows = line.split(<span style=\"color: #bdbc61;\">\/,\/<\/span>)\n      rows[1] = rows[0] <span style=\"color: #5180b3;\">if<\/span> rows[1].nil?\n      <span style=\"color: #baba36;\">@hash<\/span>.store(rows[0], rows[1])\n      io2.puts rows[0]\n    }\n    io1.close\n    io2.close\n  <span style=\"color: #5180b3;\">end<\/span>\n\n  <span style=\"color: #5180b3;\">def<\/span> <span style=\"color: #6aaf50;\">exec_peco<\/span>\n    out = <span style=\"color: #cd5542;\">Tempfile<\/span>.new(<span style=\"color: #bdbc61;\">\"peco-out\"<\/span>)\n    err = <span style=\"color: #cd5542;\">Tempfile<\/span>.new(<span style=\"color: #bdbc61;\">\"peco-err\"<\/span>)\n    <span style=\"color: #528fd1;\">system<\/span> <span style=\"color: #bdbc61;\">\"<\/span><span style=\"color: #baba36;\">#{XTERM}<\/span><span style=\"color: #bdbc61;\"> -e sh -c '<\/span><span style=\"color: #baba36;\">#{PECO}<\/span><span style=\"color: #bdbc61;\"> <\/span><span style=\"color: #baba36;\">#{@appfilepath}<\/span><span style=\"color: #bdbc61;\"> &gt; <\/span><span style=\"color: #baba36;\">#{out.path}<\/span><span style=\"color: #bdbc61;\"> 2&gt; <\/span><span style=\"color: #baba36;\">#{err.path}<\/span><span style=\"color: #bdbc61;\">'\"<\/span>\n\n    res = <span style=\"color: #bdbc61;\">`cat <\/span><span style=\"color: #baba36;\">#{out.path}<\/span><span style=\"color: #bdbc61;\">`<\/span>\n    <span style=\"color: #5180b3;\">if<\/span> res != <span style=\"color: #bdbc61;\">\"\"<\/span>\n      app = <span style=\"color: #baba36;\">@hash<\/span>[res.chomp!]\n      <span style=\"color: #528fd1;\">system<\/span>(<span style=\"color: #bdbc61;\">\"<\/span><span style=\"color: #baba36;\">#{app}<\/span><span style=\"color: #bdbc61;\"> &amp;\"<\/span>)\n    <span style=\"color: #5180b3;\">end<\/span>\n  <span style=\"color: #5180b3;\">end<\/span>\n\n  <span style=\"color: #528fd1;\">public<\/span>\n\n  <span style=\"color: #5180b3;\">def<\/span> <span style=\"color: #6aaf50;\">exec_MyMenu<\/span>\n    <span style=\"color: #5180b3;\">self<\/span>.set_hash_and_list\n    <span style=\"color: #5180b3;\">self<\/span>.exec_peco\n  <span style=\"color: #5180b3;\">end<\/span>\n<span style=\"color: #5180b3;\">end<\/span>\n\n\nmymenu = <span style=\"color: #cd5542;\">MyMenu<\/span>.new(menufile)\nmymenu.exec_MyMenu\n<\/pre>\n<\/div>\n<p> \u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5f8c\u534a\u306f\u308b\u3073\u304d\u3061\u69d8\u304c\u516c\u958b\u3057\u3066\u3044\u308b <a href=\"http:\/\/rubikitch.com\/2015\/09\/29\/peco-wrapper\/\">peco<\/a> \u3092\u53c2\u8003\u306b\u3055\u305b\u3066\u9802\u304d\u307e\u3057\u305f\u3002\u3068\u3044\u3046\u3088\u308a\u3082\u305d\u306e\u307e\u307e\u4f7f\u7528\u3055\u305b\u3066\u9802\u304d\u307e\u3057\u305f\u3002 <\/p>\n<\/div>\n<\/div>\n<div id=\"outline-container-orgheadline5\" class=\"outline-3\">\n<h3 id=\"orgheadline5\">\u8a2d\u5b9a<\/h3>\n<div class=\"outline-text-3\" id=\"text-orgheadline5\">\n<\/div>\n<div id=\"outline-container-orgheadline3\" class=\"outline-4\">\n<h4 id=\"orgheadline3\">mymenu.rb<\/h4>\n<div class=\"outline-text-4\" id=\"text-orgheadline3\">\n<p> <b>XTERM<\/b> \u306b\u4f7f\u7528\u3057\u305f\u3044\u30bf\u30fc\u30df\u30ca\u30eb\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u30fc\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002 <\/p>\n<ul class=\"org-ul\">\n<li>xterm\/urxvt\/mlterm \u3067\u3042\u308c\u3070\u5927\u4e08\u592b\u3067\u3057\u305f\u3002<\/li>\n<li>gnome-terminal\/lxterminal \u306f\u5931\u6557\u3057\u307e\u3057\u305f\u3002<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div id=\"outline-container-orgheadline4\" class=\"outline-4\">\n<h4 id=\"orgheadline4\">~\/.mymenu<\/h4>\n<div class=\"outline-text-4\" id=\"text-orgheadline4\">\n<p> <b>~\/.mymenu<\/b> \u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8f09\u3057\u307e\u3059\u3002 \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3057\u306a\u3044\u3068\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3059\u3002 <\/p>\n<pre class=\"example\">\nFD, gnome-terminal -e fd\nR, lxterminal -e R\nleafpad\n<\/pre>\n<p> \u30e1\u30cb\u30e5\u30fc\u306b\u8868\u793a\u3057\u305f\u3044\u5185\u5bb9\u3068\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3092\u30ab\u30f3\u30de\u3067\u533a\u5207\u3063\u3066\u8a18\u8f09\u3059\u308b\u3060\u3051\u3067\u3059\u3002 <\/p>\n<ul class=\"org-ul\">\n<li>\u30ab\u30f3\u30de\u306e\u5de6\u5074\u306b\u8a18\u8f09\u3057\u305f\u5185\u5bb9\u304c\u30e1\u30cb\u30e5\u30fc\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/li>\n<li>\u30ab\u30f3\u30de\u306e\u53f3\u5074\u306b\u8a18\u8f09\u3057\u305f\u5185\u5bb9\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\n<ul class=\"org-ul\">\n<li>\u7701\u7565\u3057\u305f\u5834\u5408\u306b\u306f\u5de6\u5074\u306e\u5185\u5bb9\u304c\u305d\u306e\u307e\u307e\u30b3\u30de\u30f3\u30c9\u3068\u3057\u3066\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/li>\n<li>\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u5b9f\u884c\u3057\u305f\u3044\u5834\u5408\u306b\u306f &#8220;\uff08\u4f7f\u7528\u3057\u305f\u3044\u30bf\u30fc\u30df\u30ca\u30eb\uff09 -e \uff08\u5b9f\u884c\u3057\u305f\u3044\u30b3\u30de\u30f3\u30c9\uff09&#8221; \u306e\u3088\u3046\u306b\u8a18\u8f09\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-orgheadline6\" class=\"outline-3\">\n<h3 id=\"orgheadline6\">\u4f7f\u7528\u6cd5<\/h3>\n<div class=\"outline-text-3\" id=\"text-orgheadline6\">\n<p> mymenu.rb\u3092\u597d\u304d\u306a\u30ad\u30fc\u306b\u5272\u308a\u5f53\u3066\u307e\u3059\u3002 <\/p>\n<p> \u3042\u3068\u306f\u597d\u304d\u306a\u3088\u3046\u306b\u7d5e\u308a\u8fbc\u307f\u3092\u3059\u308b\u3060\u3051\u3067\u3059\u3002 <\/p>\n<p> <a href=\"http:\/\/rubikitch.com\/2015\/09\/30\/peco034\/\">Hit-a-Hint<\/a> \u306e\u8a2d\u5b9a\u3092\u3057\u3066\u304a\u3051\u3070\u3001\u300c@\u300d\u3092\u62bc\u3057\u305f\u5f8c\u306b\u5019\u88dc\u306e\u5de6\u7aef\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u6587\u5b57\u3092\u6253\u3061\u8fbc\u3080\u3053\u3068\u3067\u5373\u5ea7\u306b\u9078\u629e\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002 <\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u7d4c\u7def \u4ee5\u524d\u306ffluxbox\u3092\u4f7f\u7528\u3057\u3066\u304a\u308a\u3001\u53f3\u30af\u30ea\u30c3\u30af\u3067\u30e1\u30cb\u30e5\u30fc\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u306e\u30e1\u30cb\u30e5\u30fc\u306f\u30d5\u30a1\u30a4\u30eb\u3092\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u3067\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u307e\u3057\u305f\u3002 \u73fe\u5728xmonad\u306b\u79fb\u884c\u3057\u3066\u304a\u308a\u3001\u3044\u304f\u3064\u304b\u306e\u30ad\u30fc\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5272\u308a\u5f53\u3066\u3066<\/p><\/div>\n<div class=\"blog-btn\"><a href=\"https:\/\/www.arat.xyz\/wordpress\/?p=214\" class=\"home-blog-btn\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,8],"tags":[107,105,108],"_links":{"self":[{"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/214"}],"collection":[{"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=214"}],"version-history":[{"count":2,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/214\/revisions"}],"predecessor-version":[{"id":216,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/214\/revisions\/216"}],"wp:attachment":[{"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}