ZSA Moonlander を買ったらしい話

ERGODOXの亜種のような新作のような、キーボード Moonlanderが届いた。

表題、買ったらしいというのは、購入した記憶が全く無いという件。

友人に問い合わせたところ、サプライズプレゼントでは無いらしい。

数年前にガラスが手に刺さって、キーボードが打ちづらく、HHKからKinesissに乗り換え、ERGODOX EZを使用するようになり、数年がすぎ、なれていたのに、届いてしまったので、使うことにした。

親指のキー配列がERGODOX EZよりも左右2つづつ、計4つキーが少ない。 そして左端、右端のキーサイズが通常のキートップで小さくなっている。

ドライバをArchlinuxから書き込む為には以下の、パッケージを追加インストールする必要があった

arm-none-eabi-newlib arm-none-eabi-gcc

ドライバのコンパイルにはqmkが引き続きつかえる。 ただし、新機能というかEZにはなかった機能として、キートップ下のLED、キーボードマクロの記憶機能など、あるので、https://configure.ergodox-ez.com/moonlander/layouts/60qpr/latest/0 からひとしきり、設定をいじり、ダウンロード。

なにやら警告がでてwallyというアプリケーション経由でバイナリをやけと書いてあるので実行。 接続されているデバイスを自動で認識して、ファイルを選択して流し込むことができた。

ちなみに、キーマップのコンセプトとしては、Archlinux, i3, vimになれていたら使いやすいだろうと思う。 基本ホームポジション。マウス操作、キー操作はvimと同じにしてある。

パームレストがキーボードと連結されているので、入力中、手が机の角にあたって痛いこともなく、素敵かもしれない。

https://www.zsa.io/moonlander/

追記、Kailh Box Red 軸だったのだがタイプ時に底打ちするような違和感がつかれたので、Cherry の赤軸を買おうと思ったが透明ハウジングがないのでLEDを潰すのもなぁと思い、 透明ハウジングのピンク軸を購入。

ちゃかちゃかと軸交換をしたところ。やはり使い慣れているだけあって、圧倒的にタイプ効率がよくなった。 ただ、若干押下時にカサつくのでスイッチをあけて、ルブを塗ろうかどうか。。。。

抜き差しがめんどくさいので、こなれて違和感がなくなれば無視しようと思った。

PHPカンファレンスに初めて行った話

20年弱PHPを開発言語としてしようしてきて、初めてPHPカンファレンスに行った。

"Sebastian Bergmann" PHPUNITの開発者は、"I believe in opensource" と言っていた。 BEAR.Sunday の開発者 Koriyamさんは、"自分がすごいんじゃない。Google Guiceがすごいんだ"と言っていた。 Nrslibさんは、"理想をおってほしい" と言っていた。

世界は僕が思うそれより広かった。 もと勉強しよう。

オープンソースコミュニティはSebastianの言うように、人々がそこに向き合うから成立する。 OpenSSLは世界で利用されているが、そのコントリビューターはたった二人だったそうだ。

ソフトウェアの設計、思想を世界で共有して、その先をみんなでつくってゆく。 今、生きていること。技術を通して世界を変えてゆく。

一人で自分と切磋琢磨してきた。 もっともっと大きな世界で生きていこう。

Githubアカウントも前のパスワードもメアドも忘れちゃったから新しく作ろう。 思想と哲学の伴わない設計を書くのをやめよう。 Qiitaにもアカウントを作ろう。 Twitterも使おう。

自分の思想を貫くために、今まで世界にあった思想のことを学ぼう。

そんな感想をもった。

vim8とneovim

neovimがリリースされたと思ったら、vim8.0がリリースされた。 vim使いとしてはちょっと残念。

vim7までは1種類だったvimがvim8とneovimという2種類になってしまった。

どちらでも対応できるように、設定を作り直した。

今回の目標は

  1. 設定を変えることでいらないプラグインを排除できること。
  2. できるかぎりlasy_loadingして起動速度を上げる
  3. 設定を増やしても迷わないファイル構成

Github: haimemat/vim-settings

VIMをセットアップするツール

  1. 設定ファイル群
  2. インストール用makefile

使い方(archlinux)

$ make -f archlinux.mk

設定

" ------------------------------------------------
" 設定
" ------------------------------------------------

"let mapleader = "\<Space>"

" VIMRC用のディレクトリ
let g:my_vimrc_path='~/vimrc'
let g:dein_dir='~/.cache/dein'

" Nora設定
let g:nora = {
  \ 'leader': '<SPACE>',
  \ 'super': 's',
  \ 'enable': 1
  \ }

" 使いたいものだけ定義する
" 例: dein
" 読み込まれるtoml: vimrc/toml/dein.toml
" 読み込まれるtoml: vimrc/toml/dein_lazy.toml
let g:my_pakages = [
 \ 'dein', 
 \ 'unite',
 \ 'extra'
 \ ]

ファイル構成

  • vimrc
  • types/各ファイルタイプ別の設定
  • toml/plugnのインストール設定
  • rc/起動時に読み込まれるファイル
  • plugins/plugin起動時に読み込まれるファイル
.
├── README.md
├── archlinux.mk
├── plugins
│   ├── qfixhowm.rc.vim
│   ├── quickrun.rc.vim
│   ├── unite.rc.vim
│   ├── vimfiler.rc.vim
│   ├── vimshell.rc.vim
│   └── vimtex.rc.vim
├── rc
│   ├── basic.vim
│   ├── dein.vim
│   ├── init.vim
│   ├── keymap-nora-terminal.vim
│   ├── keymap-nora-unite.vim
│   ├── keymap-nora.vim
│   ├── keymap.vim
│   └── types.vim
├── toml
│   ├── dein.toml
│   ├── dein_lazy.toml
│   ├── extra.toml
│   ├── extra_lazy.toml
│   └── unite_lazy.toml
├── types
│   ├── tex.vim
│   └── vim.vim
└── vimrc

キーマップ

mode キー 割当 備考
normal ; : 誤操作防止
command w1 w! 誤操作防止
command q1 q! 誤操作防止
normal ZZ none 誤操作防止
normal ZQ none 誤操作防止
normal Q none 誤操作防止
insert jj ESC モード移動を便利に
insert,normal,visual CTRL-l ESC モード移動を便利に
normal j gj 移動を直感的に
normal k gk 移動を直感的に
normal gj j 移動を直感的に
normal gk k 移動を直感的に
mode キー 割当 備考
insert,normal,visual c-f nora NORAキー
normal space nora NORAキー
normal s snora SUPER NORAキー
normal nora+r vimrcを再読込
normal nora+p :set paste! ペーストモード切り替え
normal nora+a :Alignta 整列
normal nora+h Unite history ファイルヒストリ
normal snora+e vimfiler ファイルエクスプローラを表示

など、詳しくは rc/keymap-nora.vim参照

Rofiをいじる

rofiというランチャーをいじる

yoaurt -S rofi

使い方をみる

rofi --help

rofi usage:
    rofi [-options ...]

Command line only options:
    -no-config                             Do not load configuration, use default values.
    -v,-version                            Print the version number and exit.
    -dmenu                                 Start in dmenu mode.
    -display [string]                      X server to contact.
        ${DISPLAY}
    -h,-help                               This help message.
    -dump-xresources                       Dump the current configuration in Xresources format and exit.
    -dump-xresources-theme                 Dump the current color scheme in Xresources format and exit.
    -e [string]                            Show a dialog displaying the passed message and exit.
    -markup                                Enable pango markup where possible.
    -normal-window                         In dmenu mode, behave as a normal window. (experimental)
    -show [mode]                           Show the mode 'mode' and exit. The mode has to be enabled.
DMENU command line options:
    -mesg [string]                         Print a small user message under the prompt (uses pango markup)
    -p [string]                            Prompt to display left of entry field
    -selected-row [integer]                Select row
    -format [string]                       Output format string
        s
    -u [list]                              List of row indexes to mark urgent
    -a [list]                              List of row indexes to mark active
    -l [integer]                           Number of rows to display
    -i                                     Set filter to be case insensitive
    -only-match                            Force selection or custom entry
    -no-custom                             Don't accept custom entry
  -select [string]                       Select the first row that matches
  -password                              Do not show what the user inputs. Show '*' instead.
  -markup-rows                           Allow and render pango markup as input data.
  -sep [char]                            Element separator.
      '\n'
  -input [filename]                      Read input from file instead from standard input.
  -sync                                  Force dmenu to first read all input data, then show dialog.
Global options:
  -modi [string]                          Enabled modi
      window,run,ssh (Default)
  -width [number]                         Window width
      50 (Default)
  -lines [number]                         Number of lines
      15 (Default)
  -columns [number]                       Number of columns
      1 (Default)
  -font [string]                          Font to use
      mono 12 (Default)
  -color-normal [string]                  Color scheme for normal row
      #fdf6e3,#002b36,#eee8d5,#586e75,#eee8d5 (Default)
  -color-urgent [string]                  Color scheme for urgent row
      #fdf6e3,#dc322f,#eee8d5,#dc322f,#fdf6e3 (Default)
  -color-active [string]                  Color scheme for active row
      #fdf6e3,#268bd2,#eee8d5,#268bd2,#fdf6e3 (Default)
  -color-window [string]                  Color scheme window
      #fdf6e3,#002b36 (Default)
  -bw [number]                            Border width
      1 (Default)
  -location [number]                      Location on screen
      0 (Default)
  -padding [number]                       Padding
      5 (Default)
  -yoffset [number]                       Y-offset relative to location
      0 (Default)
  -xoffset [number]                       X-offset relative to location
      0 (Default)
  -[no-]fixed-num-lines                   Always show number of lines
      True (Default)
  -terminal [string]                      Terminal to use
      rofi-sensible-terminal (Default)
  -ssh-client [string]                    Ssh client to use
      ssh (Default)
  -ssh-command [string]                   Ssh command to execute
      {terminal} -e {ssh-client} {host} (Default)
  -run-command [string]                   Run command to execute
      {cmd} (Default)
  -run-list-command [string]              Command to get extra run targets
       (Default)
  -run-shell-command [string]             Run command to execute that runs in shell
      {terminal} -e {cmd} (Default)
  -window-command [string]                Command executed on accep-entry-custom for window modus
      xkill -id {window} (Default)
  -[no-]disable-history                   Disable history in run/ssh
      False (Default)
  -[no-]levenshtein-sort                  Use levenshtein sorting
      False (Default)
  -[no-]case-sensitive                    Set case-sensitivity
      False (Default)
  -[no-]cycle                             Cycle through the results list
      True (Default)
  -[no-]sidebar-mode                      Enable sidebar-mode
      False (Default)
  -eh [number]                            Row height (in chars)
      1 (Default)
  -[no-]auto-select                       Enable auto select mode
      False (Default)
  -[no-]parse-hosts                       Parse hosts file for ssh mode
      False (Default)
  -[no-]parse-known-hosts                 Parse known_hosts file for ssh mode
      True (Default)
  -combi-modi [string]                    Set the modi to combine in combi mode
      window,run (Default)
  -matching [string]                      Set the matching algorithm. (normal, regex, glob, fuzzy)
      normal (Default)
  -[no-]tokenize                          Tokenize input string
      True (Default)
  -m [string]                             Monitor id to show on
      -5 (Default)
  -line-margin [number]                   Margin between rows
      2 (Default)
  -line-padding [number]                  Padding within rows
      1 (Default)
  -filter [string]                        Pre-set filter
      (unset) (Default)
  -separator-style [string]               Separator style (none, dash, solid)
      dash (Default)
  -[no-]hide-scrollbar                    Hide scroll-bar
      False (Default)
  -[no-]fullscreen                        Fullscreen
      False (Default)
  -[no-]fake-transparency                 Fake transparency
      False (Default)
  -dpi [number]                           DPI
      -1 (Default)
  -threads [number]                       Threads to use for string matching
      0 (Default)
  -scrollbar-width [number]               Scrollbar width
      8 (Default)
  -scroll-method [number]                 Scrolling method. (0: Page, 1: Centered)
      0 (Default)
  -fake-background [string]               Background to use for fake transparency. (background or screenshot)
      screenshot (Default)
  -window-format [string]                 Window Format. w (desktop name), t (title), n (name), r (role), c (class)
      {w}   {c}   {t} (Default)
  -[no-]click-to-exit                     Click outside the window to exit
      True (Default)
  -[no-]show-match                        Indicate how it match by underlining it.
      True (Default)
  -pid [string]                           Pidfile location
      /run/user/15000/rofi.pid (Default)
  -kb-primary-paste [string]              Paste primary selection
      Control+V,Shift+Insert (Default)
  -kb-secondary-paste [string]            Paste clipboard
      Control+v,Insert (Default)
  -kb-clear-line [string]                 Clear input line
      Control+w (Default)
  -kb-move-front [string]                 Beginning of line
      Control+a (Default)
  -kb-move-end [string]                   End of line
      Control+e (Default)
  -kb-move-word-back [string]             Move back one word
      Alt+b (Default)
  -kb-move-word-forward [string]          Move forward one word
      Alt+f (Default)
  -kb-move-char-back [string]             Move back one char
      Left,Control+b (Default)
  -kb-move-char-forward [string]          Move forward one char
      Right,Control+f (Default)
  -kb-remove-word-back [string]           Delete previous word
      Control+Alt+h,Control+BackSpace (Default)
  -kb-remove-word-forward [string]        Delete next word
      Control+Alt+d (Default)
  -kb-remove-char-forward [string]        Delete next char
      Delete,Control+d (Default)
  -kb-remove-char-back [string]           Delete previous char
      BackSpace,Control+h (Default)
  -kb-remove-to-eol [string]              Delete till the end of line
      Control+k (Default)
  -kb-remove-to-sol [string]              Delete till the start of line
      Control+u (Default)
  -kb-accept-entry [string]               Accept entry
      Control+j,Control+m,Return,KP_Enter (Default)
  -kb-accept-custom [string]              Use entered text as command (in ssh/run modi)
      Control+Return (Default)
  -kb-accept-alt [string]                 Use alternate accept command.
      Shift+Return (Default)
  -kb-delete-entry [string]               Delete entry from history
      Shift+Delete (Default)
  -kb-mode-next [string]                  Switch to the next mode.
      Shift+Right,Control+Tab (Default)
  -kb-mode-previous [string]              Switch to the previous mode.
      Shift+Left,Control+Shift+Tab (Default)
  -kb-row-left [string]                   Go to the previous column
      Control+Page_Up (Default)
  -kb-row-right [string]                  Go to the next column
      Control+Page_Down (Default)
  -kb-row-up [string]                     Select previous entry
      Up,Control+p,Shift+Tab,Shift+ISO_Left_Tab (Default)
  -kb-row-down [string]                   Select next entry
      Down,Control+n (Default)
  -kb-row-tab [string]                    Go to next row, if one left, accept it, if no left next mode.
      Tab (Default)
  -kb-page-prev [string]                  Go to the previous page
      Page_Up (Default)
  -kb-page-next [string]                  Go to the next page
      Page_Down (Default)
  -kb-row-first [string]                  Go to the first entry
      Home,KP_Home (Default)
  -kb-row-last [string]                   Go to the last entry
      End,KP_End (Default)
  -kb-row-select [string]                 Set selected item as input text
      Control+space (Default)
  -kb-screenshot [string]                 Take a screenshot of the rofi window
      Alt+S (Default)
  -kb-toggle-case-sensitivity [string]    Toggle case sensitivity
      grave,dead_grave (Default)
  -kb-toggle-sort [string]                Toggle sort
      Alt+grave (Default)
  -kb-cancel [string]                     Quit rofi
      Escape,Control+g,Control+bracketleft (Default)
  -kb-custom-1 [string]                   Custom keybinding 1
      Alt+1 (Default)
  -kb-custom-2 [string]                   Custom keybinding 2
      Alt+2 (Default)
  -kb-custom-3 [string]                   Custom keybinding 3
      Alt+3 (Default)
  -kb-custom-4 [string]                   Custom keybinding 4
      Alt+4 (Default)
  -kb-custom-5 [string]                   Custom Keybinding 5
      Alt+5 (Default)
  -kb-custom-6 [string]                   Custom keybinding 6
      Alt+6 (Default)
  -kb-custom-7 [string]                   Custom Keybinding 7
      Alt+7 (Default)
  -kb-custom-8 [string]                   Custom keybinding 8
      Alt+8 (Default)
  -kb-custom-9 [string]                   Custom keybinding 9
      Alt+9 (Default)
  -kb-custom-10 [string]                  Custom keybinding 10
      Alt+0 (Default)
  -kb-custom-11 [string]                  Custom keybinding 11
      Alt+exclam (Default)
  -kb-custom-12 [string]                  Custom keybinding 12
      Alt+at (Default)
  -kb-custom-13 [string]                  Csutom keybinding 13
      Alt+numbersign (Default)
  -kb-custom-14 [string]                  Custom keybinding 14
      Alt+dollar (Default)
  -kb-custom-15 [string]                  Custom keybinding 15
      Alt+percent (Default)
  -kb-custom-16 [string]                  Custom keybinding 16
      Alt+dead_circumflex (Default)
  -kb-custom-17 [string]                  Custom keybinding 17
      Alt+ampersand (Default)
  -kb-custom-18 [string]                  Custom keybinding 18
      Alt+asterisk (Default)
  -kb-custom-19 [string]                  Custom Keybinding 19
      Alt+parenleft (Default)
  -display-ssh [string]                   The display name of this browser
      (unset) (Default)
  -display-run [string]                   The display name of this browser
      (unset) (Default)
  -display-drun [string]                  The display name of this browser
      (unset) (Default)
  -display-window [string]                The display name of this browser
      (unset) (Default)
  -display-windowcd [string]              The display name of this browser
      (unset) (Default)
  -display-combi [string]                 The display name of this browser
      (unset) (Default)

Monitor layout:
              ID: 0
            name: eDP1
        position: 0,900
            size: 2880,1620

              ID: 1
            name: VGA1
        position: 3704,0
            size: 1920,1080

              ID: 2 (primary)
            name: DP1
        position: 3064,1080
            size: 2560,1440


Compile time options:
  * window  enabled
  * drun    enabled
  * timings disabled
  * gcov    disabled
  * asan    disabled

For more information see: man rofi
                 Version: 1.3.0
              Bugreports: https://github.com/DaveDavenport/rofi/
                 Support: https://forum.qtools.org/
                          #rofi @ freenode.net
      Configuration file: /home/kurari/.config/rofi/config

とりあえず、ウインドウの切り替えとコマンド実行の機能だけ持たせて起動

rofi -combi-modi 'window,run' -show

本家サイトを覗いていたらdmenuとかいうモードを発見

echo -e "Option #1\nOption #2\nOption #3" | rofi -dmenu

戻り値で選択したテキストが帰ってくる。 これをスクリプトで受ければ、グラフィカルな操作できるのね。

i3のランチャコマンドを作成してみた

#!/bin/bash

cmd=$(cat <<EOF | rofi -dmenu -p "i3 menu: " -format s
MainTerminal
firefox
thunderbird
keepassx
nautilus
xprop
sakura
screenshot DP1
screenshot eDP1
screenshot VGA1
edit ~/.config/i3/config
edit $HOME/.dotfiles/Makefile
edit $HOME/.dotfiles/vim/rc/vimrc
lock
exit
cansel
EOF)

case "$cmd" in
    MainTerminal) runorraise title MainTerminal 'sakura -t MainTerminal -e ./tmux-single main';;
    firefox) runorraise class Firefox firefox;;
    thunderbird) runorraise class Thunderbird thunderbird;;
    keepassx) runorraise class keepassx keepassx;;
    sakura) sakura ;;
    screenshot*) ~/bin/ss-monitor ${cmd##screenshot } ;;
    lock) xscreensaver-command --lock;;
    edit*)
        # rofi -e "vim ${cmd##edit }"
        sakura -t "$cmd" -e "sh -c \"$EDITOR ${cmd##edit }\""
    ;;
    exit) i3-msg exit;;
    xprop) 
        xprop > /tmp/tmp$$
        sakura -t "$cmd" -e $EDITOR /tmp/tmp$$
        ;;
    *) 
        sh -c "$cmd"  || rofi -e "noting to do $cmd" ;;
esac

Firefoxをvimにする

vimperator addonをfirefoxにインストール。

基本操作

cmd -
j 下へ
k 上へ
C-d スクロールダウン
C-u スクロールアップ
/ ジャンプ
d タブを閉じる
u 閉じたタブを開く
o ページを開く
t ページをタブで開く
gi 1つめの入力ボックスにフォーカス
Ngi Nめの入力ボックスにフォーカス
f リンク移動(番号を打つ)
F fの移動をタブにする)

vimrc的な子が使えるらしい ~/.vimperatorrc

"デフォルトのサーチエンジン
set defsearch=google

set hlsearch

まぁ、あんまりいじるとこないからこれくらいかな。

Archlinuxでスクリーンショット

設定もぼちぼち落ち着いてきたので、スクリーンショットでも取ろうかと。

importというコマンドでスクリーンショットが取れるので、 どのパッケージにあるのか探してみる。

$ pkgfile import
extra/bash-completion
extra/imagemagick
community/plan9port
community/quilt

うん、bash-completionは補完機能だから、imagemagickか。

yaourt -S imagemagick

依存関係を解決しています...
衝突するパッケージがないか確認しています...

パッケージ (3) liblqr-0.4.2-1  ocl-icd-2.2.10-1  imagemagick-6.9.7.0-2

合計ダウンロード容量:  2.25 MiB
合計インストール容量:  9.86 MiB

:: インストールを行いますか? [Y/n] 
:: パッケージを取得します...
liblqr-0.4.2-1-x86_64.pkg.tar.xz をダウンロード...
ocl-icd-2.2.10-1-x86_64.pkg.tar.xz をダウンロード...
imagemagick-6.9.7.0-2-x86_64.pkg.tar.xz をダウンロード...
キーリングを確認...
パッケージの整合性を確認しています...
パッケージファイルのロード...
ファイルの衝突を確認しています...
空き容量の確認...
:: パッケージの変更を処理しています...
インストール liblqr...
インストール ocl-icd...
ocl-icd の提案パッケージ
    opencl-driver: packaged opencl driver
インストール imagemagick...
imagemagick の提案パッケージ
    imagemagick-doc: for additional information
    ghostscript: for Ghostscript support [インストール済み]
    openexr: for OpenEXR support
    openjpeg2: for JP2 support [インストール済み]
    libwmf: for WMF support
    librsvg: for SVG support [インストール済み]
    libxml2: for XML support [インストール済み]
    libpng: for PNG support [インストール済み]
    libwebp: for WEBP support [インストール済み]

使い方をみる

$ import --help

Version: ImageMagick 6.9.7-0 Q16 x86_64 2016-12-23 http://www.imagemagick.org
Copyright: Copyright 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP 
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib
Usage: import [options ...] [ file ]

Image Settings:
  -adjoin              join images into a single multi-image file
  -border              include window border in the output image
  -channel type        apply option to select image channels
  -colorspace type     alternate image colorspace
  -comment string      annotate image with comment
  -compress type       type of pixel compression when writing the image
  -define format:option
                       define one or more image format options
  -density geometry    horizontal and vertical density of the image
  -depth value         image depth
  -descend             obtain image by descending window hierarchy
  -display server      X server to contact
  -dispose method      layer disposal method
  -dither method       apply error diffusion to image
  -delay value         display the next image after pausing
  -encipher filename   convert plain pixels to cipher pixels
  -endian type         endianness (MSB or LSB) of the image
  -encoding type       text encoding type
  -filter type         use this filter when resizing an image
  -format &quot;string&quot;     output formatted image characteristics
  -frame               include window manager frame
  -gravity direction   which direction to gravitate towards
  -identify            identify the format and characteristics of the image
  -interlace type      None, Line, Plane, or Partition
  -interpolate method  pixel color interpolation method
  -label string        assign a label to an image
  -limit type value    Area, Disk, Map, or Memory resource limit
  -monitor             monitor progress
  -page geometry       size and location of an image canvas
  -pause seconds       seconds delay between snapshots
  -pointsize value     font point size
  -quality value       JPEG/MIFF/PNG compression level
  -quiet               suppress all warning messages
  -regard-warnings     pay attention to warning messages
  -respect-parentheses settings remain in effect until parenthesis boundary
  -sampling-factor geometry
                       horizontal and vertical sampling factor
  -scene value         image scene number
  -screen              select image from root window
  -seed value          seed a new sequence of pseudo-random numbers
  -set property value  set an image property
  -silent              operate silently, i.e. don't ring any bells 
  -snaps value         number of screen snapshots
  -support factor      resize support: > 1.0 is blurry, < 1.0 is sharp
  -synchronize         synchronize image to storage device
  -taint               declare the image as modified
  -transparent-color color
                       transparent color
  -treedepth value     color tree depth
  -verbose             print detailed information about the image
  -virtual-pixel method
                       Constant, Edge, Mirror, or Tile
  -window id           select window with this id or name

Image Operators:
  -annotate geometry text
                       annotate the image with text
  -colors value        preferred number of colors in the image
  -crop geometry       preferred size and location of the cropped image
  -encipher filename   convert plain pixels to cipher pixels
  -geometry geometry   preferred size or location of the image
  -help                print program options
  -monochrome          transform image to black and white
  -negate              replace every pixel with its complementary color 
  -repage geometry     size and location of an image canvas
  -quantize colorspace reduce colors in this colorspace
  -resize geometry     resize the image
  -rotate degrees      apply Paeth rotation to the image
  -strip               strip image of all profiles and comments
  -thumbnail geometry  create a thumbnail of the image
  -transparent color   make this color transparent within the image
  -trim                trim image edges
  -type type           image type

Miscellaneous Options:
  -debug events        display copious debugging information
  -help                print program options
  -list type           print a list of supported option arguments
  -log format          format of debugging information
  -version             print version information

By default, 'file' is written in the MIFF image format.  To
specify a particular image format, precede the filename with an image
format name and a colon (i.e. ps:image) or specify the image type as
the filename suffix (i.e. image.ps).  Specify 'file' as '-' for
standard input or output.

なんかいっぱいあるなぁ。 とりあえず、欲しい機能を抜粋

オプション 効果
-frame window別にキャプチャする
-window root 全画面キャプチャ
-crop geometry 画面から特定範囲を切り出す
オプション無し カーソルが出てきて領域を選択できる

ラッパーコマンドを作るならこんな感じか

#!/bin/basnh
NAME=$NAME
OPTION=$OPTION
DIR=/tmp

# スクリーンショットを取る
import $OPTION $DIR/$NAME
# ビューワーで確認する
feh $DIR/$NAME

マルチモニターでprimaryだけを取得するには全体を範囲にいれから切り抜く必要がある。 xrandrを使ってモニタ情報を取得する

$ xrandr | grep '^DP1' # モニタ名で絞り込むと以下のようなレスポンスがくるので
DP1 connected primary 2560x1440+3152+1152 (normal left inverted right x axis y axis) 600mm x 340mm
$ xrandr | grep '^DP1' | cut -d' ' -f4 # スペース区切りにした4フィールド目を取得
2560x1440+3152+1152

これを使ってスクリーンショットを取る

$ import -window root -crop $(xrandr|grep '^DP1'|cut -d' ' -f4) hoge.png

i3-wmに仕込むなら

~/bin/ss-monitorとかコマンド作成して

#!/bin/bash

MONITOR=${1}
NAME=$(date +%Y%m%d-%H%M%S).png
SIZE=$(xrandr|grep &quot;^${MONITOR}&quot;|cut -d&quot; &quot; -f4)
OPTIONS=&quot;&quot;
OPTIONS+=&quot;-resize 1200x1200&quot;
import -window root -crop $SIZE $OPTIONS $NAME
feh $NAME
exit 0

バインドでつなぐ

bindsym $mod+s exec ~/bin/ss-monitor DP1

f:id:kurari0118:20170102163209p:plain

Bashからfirefoxをリロードする

コマンドを使ってWindow操作ができれば仕事が早くできる。

pacman -S xdotool

使い方 1. window idを探す xdotool search 2. window id を操作する

例: firefoxを捕まえて更新する

xdotool search --sync --all --onlyvisible --name firefox | while read id
do
    xdotool key --window $id  "CTRL+F5"
done

シンプルにする

xdotool search --sync --all --onlyvisible --name firefox | xargs  -I {} -n 1 xdotool key --window {} "CTRL+F5"

i3-wmへ

bindsym Control+Shift+r exec sh -c 'xdotool search --all --onlyvisible --name firefox | xargs -I {} xdotool key --window "{}" "CTRL+F5"'

これで、ブラウザを開く+VIで作業。 変更をしたらControl+Shift+rで更新がかかるができたー!