Raspberry Pi OS (32-bit) with desktop Tiger VNC + dwm
前回はRaspberry Pi4にReal VNCでRaspberry Pi OS デフォルトdesktopをインストールしましたが今回はvncserverをTiger VNCにウインドウマネージャーをdwmに変更します。
作業環境としてはRaspberry Pi3からssh vncviewerで接続、作業しています。
Tiger VNC
Tiger VNCのメリットしては表示速度が早い、シンプル(くどくない)なことなどが挙げられると思います。欠点はマシン間で日本語のコピペができない。
Real VNCを削除してTiger VNCと入れ替えます。
Raspberry Pi4
# apt -y purge realvnc-vnc-server # apt -y install tigervnc-standalone-server tigervnc-common tigervnc-viewer
Raspberry Pi3
realvnc-vnc-viewerからtigervnc-serverに接続はできますが表示速度は遅い(逆は不可)
Recommended SoftwareからVNC Viewerのチェックを外して削除、tigervnc-viewerをインストール
# apt -y install tigervnc-viewer
tigervnc-serverの起動
tigervnc1.9.0になってから起動は環境変数を指定する必要があります。
下記ページの最後の方に方法が載っています。
https://github.com/TigerVNC/tigervnc/issues/800
$ vncviewer LD_PRELOAD=/lib/arm-linux-gnueabihf/libgcc_s.so.1 vncserver :1 -localhost no
Pi3からsshでPi4にログインして上記のコマンドを実行、最初にパスワードを求められます。
~/.vnc以下にファイルpasswdが作成されます。
passwdをPi3の適当なディレクトリにコピー、リネーム(~/.vnc/pi4とします)
Pi3から接続(Pi4のvnc.confは別途作成、後述)
$ vncviewer -passwd /home/pi/.vnc/pi4 192.168.0.4:1
dwm
タイル型ウィンドウマネージャのdwmはコンパクト、軽快で慣れないうちは多少のクセがあるもののvncserverには最適と思っています。
パッケージからもインストールできますが軽快に使うにはコンパイルは必須と思います。
# apt -y install libxinerama-dev libxft-dev
dwm 6.2 ダウンロード 編集
$ wget https://dl.suckless.org/dwm/dwm-6.2.tar.gz $ tar tar -xvf dwm-6.2.tar.gz
展開するとconfig.def.hがあるのでコピーしてconfig.hを編集します。
当サイトのconfig.h
フォンサイズ変更
タイトルバーカラー変更
modキー windowsキー
左右の境界線比率
横分割 modキー+ i
縦分割 modキー+ u
アプリケーション終了 modキー+ q
編集が済んだらmake (数秒で完了)
$ sudo make clean install
コンパイルしたファイルは/usr/local/binにコピーされます。
出来上がったファイルは48900バイトの小さいファイルで変更が無ければ以降コピーするだけで使うことができます。
dmenuは別途インストールします。(suckless-tools)
単体もしくはsurfブラウザをインストールすると依存でインストールされます。
その他
xterm + vimは適切に.vimrcを設定します。
アプリケーションランチャとして本来のdmenuだけでは使いにくいのでdmenuスクリプトとxbindkeysで使いやすく設定します。https://dbpro.xyz/6749
# apt -y install xterm xbindkeys
xterm
~/.Xresources
XTerm*utf8 : 1 XTerm*locale : false XTerm*faceName : monospace XTerm*faceSize : 9 XTerm*fontDoublesize : true XTerm*saveLines : 2000 XTerm*geometry : 80x24 XTerm*charClass: 33:48,37:48,45-47:48,38:48,64:48 XTerm*background: #222222 XTerm*foreground: #DDDDDD XTerm*color0: #333333 XTerm*color1: #A94952 XTerm*color2: #83A949 XTerm*color3: #A99F49 XTerm*color4: #4983A9 XTerm*color5: #A94983 XTerm*color6: #49A99F XTerm*color7: #AAAAAA XTerm*color8: #666666 XTerm*color9: #ED6975 XTerm*color10: #B8ED69 XTerm*color11: #EDE169 XTerm*color12: #69B8ED XTerm*color13: #ED69B8 XTerm*color14: #69EDE1 XTerm*color15: #DDDDDD
xbindkeys
~/.xbindkeysrc
########################### # xbindkeys configuration # # Version: 1.8.6 # xbindkeys -k "dmenu_main" m:0x8 + c:40 Alt + d "cd && xterm" m:0x1 + c:36 Shift + Return "cd && xterm" m:0x0 + c:102 Muhenkan
vncboot
先に述べたライブラリパスを前回Real VNCで使ったvncbootのstartに追記、変更します。
start) echo "Starting VNC Server" #Insert your favoured settings for a VNC session #su $USER -c '/usr/bin/vncserver :1' su $USER -c 'LD_PRELOAD=/lib/arm-linux-gnueabihf/libgcc_s.so.1 /usr/bin/vncserver :1' ;;
ちなみにC shell(tcsh)を使っている(まずいないと思うが)場合はvncbootは変更しないで~/.cshrcに記載します。
# tigervncserver setenv LD_PRELOAD /lib/arm-linux-gnueabihf/libgcc_s.so.1
~/.vnc/xstartup
#!/bin/sh xrdb $HOME/.Xresources xsetroot -solid gray3 xsetroot -cursor_name left_ptr vncconfig nowin=1 & xbindkeys & sleep 1 dwm & cd && xterm
~/.vnc/vnc.conf
$geometry = "1020x655"; $depth = 24; $desktopName = "Raspberry Pi 4"; $localhost = "no";
HDMI出力をCLI
HDMIには本来のディスクトップが出力されていると思うのでCLIに変更
# systemctl disable lightdm
準備ができたところで再起動、Pi3から接続
$ vncviewer -passwd /home/pi/.vnc/pi4 192.168.0.4:1
dwmのウインドウモード 上部タグナンバーとタイトルバーの間
[ ]= タイル 新しいウインドウは左から
><> フロート アプリケーションのデフォルトサイズで表示
[2] 最大化 右クリック 数値は現在のウインドウ数
デフォルトのタイル、フロートに戻すにはmodキー+ F T
ターミナルを2つ起動
左右の境界線はmodキー+ H modキー+ Lで移動
左右のウインドウ入れ替えはmodキー+ Enter
modキー+ マウス左クリックドラッグでウインドウを表に出せる
隠れたウインドウはmodキー+ J modキー+ Kで表
タグの切り替えはmodキー+ 数字(マウス可)
横分割にしてフロートでターミナル起動
modキー+ マウス左クリックで移動 modキー+ マウス右クリック(右下)を掴んでウインドウサイズ変更
基本はこれくらいしか使っていませんが左手はショートカット、右手は隙あらばマウスを握っているヘタレキーボーダーには充分間に合っています。
デフォルトでインストールされているアプリケーションも問題なく起動します。
プロパティからコマンド名を調べれば微妙なアプリケーションも起動します。
次回は日本語環境を設定していきます。