2023年8月17日木曜日

特定のディレクトリ以下の背景色や壁紙を変更(*diroptionを使用)

前回のはディレクトリ名によっては機能しない場合があったので、真面目に考えてみた。

通常時の背景画像と背景色設定

これを設定しておかないと、背景色や背景画像を変えたディレクトリを抜けても、元に戻らない。以下のコマンドを一度実行する。これは背景画像なし、背景色もなしの設定。

*diroption -"*" cmd:"*deletecust X_bg:P_%%n %%: *deletecust X_bg:T_%%n %%: *color back"

特定のディレクトリ以下の背景色を変更

該当ディレクトリに行き、以下のコマンドを実行する。

*diroption -thisbranch cmd "*color back %"_DBLA: 暗灰  _DBLU: 暗青  _DRED: 暗赤/茶  _DMAG: 暗紫 _DGRE: 暗緑  _DCYA: 暗水  _DBRO: 暗黄"%{_DBLU%}"

もとに戻す場合は該当ディレクトリで以下のコマンドを実行。

*diroption -thisbranch cmd ""

特定のディレクトリ以下の背景画像を変更

以下を編集して取込。サブ窓用のユーザコマンド*opensubwinを登録しておく。

_Command	= {	; ユーザコマンド・関数
opensubwin	= *ppc -r -bootid:x -single -k *jumppath %*arg(1) %%: *fitwindow %NC,%%NC,20 %%: *mapkey use,K_subwin %%: *js "PPx.EntryIndex = 2" %%: *linemessage %*arg(2)
}

K_subwin	= {	** comment **
\ENTER	,*execute ,%*getcust(_User:temp_exec)
}

該当ディレクトリに行き、以下のコマンドを実行する。

*setcust _User:temp_exec=*execute %n,*diroption -thisbranch cmd "%(*setcust X_bg:T_%%%%n=20 %%%%: *setcust X_bg:P_%%%%n=%FCD %%%%: %%%%K"loadcust"%) %%: %%K"@Q" %: *opensubwin %1,壁紙にする画像ファイルを選択してください

サブ窓が開くので、壁紙にしたい画像ファイルにカーソルをあわせ、Shift+ENTERを押す。

F5を押して、背景画像が変更されていたら成功。

もとに戻す場合は該当ディレクトリで以下のコマンドを実行。

*diroption -thisbranch cmd ""

0 件のコメント:

コメントを投稿