デスクトップに猫を住まわせるonekoコマンド

はじめに

Linuxでの作業中、ふと画面に癒やしが欲しくなることはないだろうか。
殺風景なターミナルやウィンドウの間を、小さな猫が走り回ってくれたら、作業効率も上がるかもしれない(あるいは下がるかもしれない)。

今回は、古くから愛されているX Window System用のアプリケーション oneko を紹介する。
マウスカーソルを追いかけて猫が走り回る、ただそれだけのシンプルなツールとなっている。

環境

Ubuntu 24.04 LTS
oneko 1.2.sakura.6

※ X Window Systemが動作する環境(デスクトップLinuxやWSLg環境など)が必要。

インストール

UbuntuなどのDebian系ディストリビューションであれば、aptで簡単にインストールできる。

sudo apt install oneko
ログ
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  crack-common gyp libcares2 libgl1-amber-dri libglapi-mesa libjs-async libjs-events libjs-inherits
  libjs-is-typedarray libjs-prettify libjs-regenerate libjs-source-map libjs-sprintf-js
  libjs-typedarray-to-buffer libllvm17t64 liblttng-ust-common1t64 liblttng-ust-ctl5t64 liblttng-ust1t64
  libnotify-bin libqt5x11extras5 libre2-10 libssl-dev libuv1-dev libxcb-damage0 mesa-utils-bin node-abbrev
  node-ampproject-remapping node-ansi-regex node-ansi-styles node-aproba node-are-we-there-yet node-arrify
  node-async node-async-each node-auto-bind node-babel-plugin-add-module-exports node-babel7-runtime
  node-balanced-match node-base64-js node-binary-extensions node-brace-expansion node-busboy
  node-camelcase node-caniuse-lite node-chownr node-chrome-trace-event node-ci-info node-cjs-module-lexer
  node-cli-boxes node-cli-cursor node-clone node-collection-visit node-color-convert node-color-name
  node-colors node-commander node-commondir node-concat-stream node-console-control-strings
  node-convert-source-map node-core-js node-core-js-pure node-core-util-is node-data-uri-to-buffer
  node-decompress-response node-deep-is node-defaults node-define-property node-delegates node-depd
  node-diff node-electron-to-chromium node-encoding node-end-of-stream node-err-code node-error-ex
  node-es-module-lexer node-escape-string-regexp node-eslint-utils node-eslint-visitor-keys node-esquery
  node-estraverse node-esutils node-events node-fancy-log node-fast-deep-equal node-fast-levenshtein
  node-fetch node-find-up node-flatted node-foreground-child node-fs-readdir-recursive
  node-fs-write-stream-atomic node-fs.realpath node-function-bind node-get-caller-file node-get-stream
  node-get-value node-glob node-globals node-got node-graceful-fs node-growl node-has-flag
  node-has-unicode node-has-value node-has-values node-hosted-git-info node-iconv-lite node-ieee754
  node-iferr node-imurmurhash node-indent-string node-inflight node-inherits node-ini node-interpret
  node-ip node-ip-regex node-is-arrayish node-is-binary-path node-is-buffer node-is-descriptor
  node-is-extglob node-is-path-cwd node-is-plain-obj node-is-plain-object node-is-stream
  node-is-typedarray node-is-windows node-isarray node-isexe node-isobject node-js-tokens node-json-buffer
  node-json-parse-better-errors node-json-schema node-json-schema-traverse node-json-stable-stringify
  node-jsonify node-jsonparse node-kind-of node-levn node-loader-runner node-locate-path
  node-lodash-packages node-lowercase-keys node-lru-cache node-map-visit node-memfs node-merge-stream
  node-mimic-response node-minimatch node-minimist node-minipass node-mute-stream node-n3 node-negotiator
  node-npm-run-path node-object-inspect node-object-visit node-once node-optimist node-optionator
  node-osenv node-p-cancelable node-p-limit node-p-locate node-p-map node-pascalcase node-path-dirname
  node-path-exists node-path-is-absolute node-path-is-inside node-path-type node-pify node-pkg-dir
  node-postcss-value-parser node-prelude-ls node-process-nextick-args node-promise-inflight
  node-promise-retry node-promzard node-prr node-pump node-punycode node-quick-lru node-randombytes
  node-read node-readable-stream node-rechoir node-regenerator-runtime node-regenerator-transform
  node-regexpp node-regjsgen node-repeat-string node-require-directory node-require-from-string
  node-resolve node-resolve-cwd node-resolve-from node-restore-cursor node-resumer node-retry
  node-run-queue node-safe-buffer node-serialize-javascript node-set-blocking node-set-immediate-shim
  node-shebang-command node-shebang-regex node-shell-quote node-signal-exit node-slash node-slice-ansi
  node-source-list-map node-source-map node-spdx-correct node-spdx-exceptions node-spdx-expression-parse
  node-spdx-license-ids node-sprintf-js node-ssri node-stack-utils node-string-decoder node-strip-bom
  node-supports-color node-tapable node-terser node-text-table node-through node-time-stamp
  node-to-fast-properties node-tslib node-type-check node-typedarray node-typedarray-to-buffer node-undici
  node-unicode-canonical-property-names-ecmascript node-unicode-match-property-value-ecmascript
  node-unicode-property-aliases-ecmascript node-unset-value node-uri-js node-util-deprecate node-uuid
  node-v8flags node-validate-npm-package-license node-wcwidth.js node-webpack-sources node-wordwrap
  node-wrappy node-write-file-atomic node-xtend node-y18n node-yallist node-yaml nodejs-doc xbitmaps
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  oneko
0 upgraded, 1 newly installed, 0 to remove and 42 not upgraded.
Need to get 36.3 kB of archives.
After this operation, 119 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu noble/universe amd64 oneko amd64 1.2.sakura.6-15 [36.3 kB]
Fetched 36.3 kB in 1s (41.3 kB/s)
Selecting previously unselected package oneko.
(Reading database ... 117357 files and directories currently installed.)
Preparing to unpack .../oneko_1.2.sakura.6-15_amd64.deb ...
Unpacking oneko (1.2.sakura.6-15) ...
Setting up oneko (1.2.sakura.6-15) ...
Processing triggers for gnome-menus (3.36.0-1.1ubuntu3) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for desktop-file-utils (0.27-2build1) ...

使い方

基本的な起動

ターミナルで以下のコマンドを実行するだけで、画面上に猫が現れる。

oneko

マウスカーソルを動かすと、猫が一生懸命追いかけてくる。
カーソルに追いつくと、猫はあくびをしたり、寝てしまったりする。

終了するには、ターミナルで Ctrl + C を押す。
バックグラウンドで実行した場合は、kill コマンドなどでプロセスを終了させる。

# バックグラウンドで実行
oneko &

# 終了
pkill oneko

キャラクターの変更

oneko にはいくつかのオプションがあり、キャラクターを変更することができる。

オプションキャラクター
-toraトラ猫
-dog
-sakuraさくら(カードキャプターさくら)
-tomoyo知世(カードキャプターさくら)
# 犬にする
oneko -dog

# さくらちゃんにする
oneko -sakura

その他のオプション

色や動作を調整するオプションも用意されている。

オプション説明
-display <display>表示するディスプレイを指定する
-fg <color>前景色(線の色)を指定する
-bg <color>背景色(塗りつぶしの色)を指定する
-speed <dots>移動速度(1回の移動距離ドット数)
-time <microseconds>動作間隔(マイクロ秒)。値を小さくすると動きが速くなる
-idle <dots>猫が起きるまでのマウス移動速度の閾値
-name <name>ウィンドウ名を指定する
-towindowカーソルではなく選択したウィンドウを追いかける
-toname <name>指定した名前のウィンドウを追いかける
-tofocusカーソルではなくフォーカスのあるウィンドウを追いかける
-rv色を反転させる(モノクロディスプレイのみ有効)
-position <geometry>マウスポインタに対する相対位置を調整する
-debug同期モードにする(デバッグ用)
-patchlevel現在のパッチレベルを表示する
-cursor <cursornumber>終了時に設定するカーソル番号を指定する
# 赤い猫にする
oneko -fg red

WSLでの実行について

WSL (Windows Subsystem for Linux) で oneko を動かすには、GUIアプリケーションを表示する仕組みが必要である。

WSLg (Windows 11 / 最新のWindows 10)

Windows 11 や、最新の Windows 10 (WSL2) を使用している場合、WSLg (Windows Subsystem for Linux GUI) 機能により、追加の設定なしで動作する。 インストール後、そのままコマンドを実行すればWindowsのデスクトップ上に猫が現れる。

それ以外の環境

WSLg が利用できない古い環境では、Windows側に X Server (VcXsrvなど) のインストールと、WSL側での DISPLAY 環境変数の設定が必要になる。

おわりに

oneko は非常にシンプルなツールだが、デスクトップに少しの遊び心を加えてくれる。
作業に疲れた時、ふと画面を走る猫を眺めてリフレッシュしてみてはいかがだろうか…!

Hugo で構築されています。
テーマ StackJimmy によって設計されています。