LoginSignup
3
1

More than 3 years have passed since last update.

【Windows Terminal】右下にキャラクターを表示させる【海外でよくある】

Posted at

私のブログにも同じ記事があります。

どんなやつ?

こんなやつです。

1.画像の用意

まずは透過画像の用意です。Transparent animeとかでググるといいでしょう。
わたしはここを使わせていただきましたm(__)m

こんな感じでいくつかダウンロード!
上記のサイトからダウンロードする場合、リサイズして200pxくらいがちょうどいいです。

2.setting.jsonの書き換え

以下のように書き換えます。透過率は0~1の間でいじってみてください。

setting.json
// ファイルのパス。使用可能な拡張子は`.jpg`、`.png`、`.gif `。
"backgroundImage": "%USERPROFILE%\\Documents\\my_contents\\Transparent_image_with_wt\\item\\1.png",

// 背景画像のストレッチ モード。元の画像をそのままのサイズで使用
"backgroundImageStretchMode": "none",

// 背景画像の配置。右下
"backgroundImageAlignment": "bottomRight",

// 背景画像の不透明度。0~1の間で設定。0に近いほど透明。
"backgroundImageOpacity": 0.8

そして起動。完成です。

3.表示する画像をランダムにしてみる

ここまでの内容だと画像が固定されてしまっているので、ちょっとつまらないです。ランダムにしてあげましょう。
調べてみた感じwindows terminalにそのような設定は無さそうだったので、ちょっと工夫します。

仕組み

1.読み込み先の画像パスを固定

"backgroundImage": "%USERPROFILE%\\Documents\\my_contents\\Transparent_image_with_wt\\main.png",

2.以下のようなバッチを用意。

mwt.bat
@chcp 65001 > nul
@pushd %~dp0

@rem windows terminalが読み込む画像パスにランダムで画像を配置する

@set /a n=0
@for%%A in (..\Transparent_image_with_wt\item\*) do @if exist %%A ( @set /a n=n+1 )

@rem 最初のランダムは使えない
@echo %RANDOM% > nul

@set /a R=(%RANDOM%*%n%/32768)+1

@copy /Y ..\Transparent_image_with_wt\item\%R%.png ..\Transparent_image_with_wt\main.png > nul

@wt

3.上記のバッチにパスを通す
4.win+rでランチャー起動⇒作成したバッチファイル名(mwt)を入力しエンター。

何回か試してみます。


まだ画像が少ないんでかぶる率も高いですが、動作はOKですね!
読んでいただきありがとうございました。

参考

https://www.hiclipart.com/search?clipart=anime
https://docs.microsoft.com/ja-jp/windows/terminal/customize-settings/profile-settings

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1