termux-APIのTermux-usbを少し試す

Androidでdeb系ぽいLinux環境を実現できるTermuxからAndroidを操作するAPIのTermux-APIのupdateがありました.

termux api usb 01

Add a USB API compatible with libusb – see https://wiki.termux.com/wiki/Termux-usb for more information.

なんだか気になる更新内容です.

早速試してみます.

まずはパッケージを最新にして関連パッケージを導入
$ pkg update
$ pkg install root-repo
$ pkg install termux-api
$ pkg install libusb
$ pkg install clang
termux-usb コマンドでデバイスを確認してアクセス許可を与える(ここではUSBメモリ)
$ termux-usb -l
[
  "/dev/bus/usb/001/004"
]
$ termux-usb -r /dev/bus/usb/001/004
Access granted.

アクセスの許可はAndroidの画面で操作が必要です.

termux api usb 02

ちなみに,USB Keyboardは認識できませんでした(Androidでは利用できているのに!)

lsusb的にusb情報を表示するプログラムのサンプルをコンパイルして実行
$ cat << __EOF__ > usbtest.c
> $ cat usbtest.c
> #include <stdio.h>
> #include <assert.h>
> #include <libusb-1.0/libusb.h>
>
> int main(int argc, char **argv) {
>     libusb_context *context;
>     libusb_device_handle *handle;
>     libusb_device *device;
>     struct libusb_device_descriptor desc;
>     unsigned char buffer[256];
>     int fd;
>     assert((argc > 1) && (sscanf(argv[1], "%d", &fd) == 1));
>     assert(!libusb_init(&context));
>     assert(!libusb_wrap_sys_device(context, (intptr_t) fd, &handle));
>     device = libusb_get_device(handle);
>     assert(!libusb_get_device_descriptor(device, &desc));
>     printf("Vendor ID: %04x\n", desc.idVendor);
>     printf("Product ID: %04x\n", desc.idProduct);
>     assert(libusb_get_string_descriptor_ascii(handle, desc.iManufacturer, buffer, 256) >= 0);
>     printf("Manufacturer: %s\n", buffer);
>     assert(libusb_get_string_descriptor_ascii(handle, desc.iProduct, buffer, 256) >= 0);
>     printf("Product: %s\n", buffer);
>     assert(libusb_get_string_descriptor_ascii(handle, desc.iSerialNumber, buffer, 256) >= 0);
>     printf("Serial No: %s\n", buffer);
>     libusb_exit(context);
> }
> __EOF__
$ gcc usbtest.c -lusb-1.0 -o usbtest
$ termux-usb -e ./usbtest /dev/bus/usb/001/004
Vendor ID: 13fe
Product ID: 3600
Manufacturer:
Product: USB DISK 2.0
Serial No: 07AC10081C16381A

てことでTermuxからlibusbが使えるようになったようです.

ちなみに,lsusbを実行するとこんな感じです.rootedな端末だと使えるんでしょうけど.

$ lsusb
lsusb: /sys/bus/usb/devices: Permission denied
$ tsudo lsusb
/data/data/com.termux/files/usr/bin/tsu: 146: exec: : Permission denied
環境
$ dpkg-query -W termux-api libusb clang
clang   8.0.1-4
libusb  1.0.23-rc1-1
termux-api      0.47
$ adb shell dumpsys package com.termux.api | grep -E 'versionCode|versionName'
    versionCode=38 minSdk=21 targetSdk=28
    versionName=0.38
$ adb shell dumpsys package com.termux | grep -E 'versionCode|versionName'
    versionCode=75 minSdk=21 targetSdk=28
    versionName=0.75
$ getprop ro.bootimage.build.fingerprint
essential/mata/mata:10/QP1A.190711.122/420:user/release-keys
$ getprop ro.build.version.security_patch
2019-09-05
$ getprop ro.product.cpu.abilist
arm64-v8a,armeabi-v7a,armeabi

ffmpegでgifからmp4に変換した動画がInstagramに投稿できない

先日のttygifで作成したanimation gifをInstagramに投稿しようとしたところ,animation gifは投稿できるけどanimationせず1枚目の画像が表示されるだけです.ffmpegでmp4に変換するだけで良さそうだけど投稿できません.白い動画でプログレスがずっと表示され,「次へ」を押すとアプリ自体が落ちてしまいます.動画は同端末のvlcなどでは問題なく再生できています.

IMG 20191005 195714

$ ffmpeg -i tty.gif tty.mp4

音声がないのがいけないのかな?と anullsrc フィルタで無音の音声トラックを追加してみても変わらず.

$ ffmpeg -f lavfi -i anullsrc -i tty.gif -shortest tty.mp4

手詰まりになって検索してみると以下のページを発見.

このページによると以下の条件で投稿できないようです.

  • 3秒以下の動画
  • Instagramが受け付けないカラーエンコーディングの利用

今回の動画は20秒ほどなので長さは問題無さそうです.

うまく行っていなかった動画を確認すると元記事と同様 yuv444p を使っているようです.

$ ffprobe tty.mp4 2>&1 | grep -E "Stream.*Video"
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 802x750, 73 kb/s, 4.17 fps, 4.17 tbr, 12800 tbn, 8.33 tbc (default)

てことで,以下のようにカラーエンコーディングに yuv420p を指定して変換すると投稿できました.(音声トラックはあってもなくてもどちらでもOKだった)

$ ffmpeg -i tty.gif -pix_fmt yuv420p -filter_complex "scale=trunc(iw/2)*2:trunc(ih/2)*2" tty.mp4
$ ffprobe tty.mp4 2>&1 | grep -E "Stream.*Video"
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1058x750, 97 kb/s, 16.08 fps, 16.08 tbr, 12352 tbn, 32.17 tbc (default)

この投稿をInstagramで見る

pfetch logo #unix

matokenさん(@matoken)がシェアした投稿 –

公式の文章があればいいんですが見つからず.以下が少し近い?

変換環境
$ dpkg-query -W ffmpeg
ffmpeg	7:4.1.4-1+b2
$ lsb_release -dr
Description:	Debian GNU/Linux bullseye/sid
Release:	unstable
$ uname -m
x86_64
投稿環境
$ adb shell dumpsys package com.instagram.android | grep -E 'versionCode|versionName'
    versionCode=175574628 minSdk=23 targetSdk=28
    versionName=113.0.0.39.122
$ adb shell getprop ro.bootimage.build.fingerprint
essential/mata/mata:10/QP1A.190711.122/420:user/release-keys
$ adb shell getprop ro.build.version.security_patch
2019-09-05
$ adb shell getprop ro.product.cpu.abilist
arm64-v8a,armeabi-v7a,armeabi

可愛いシステム情報表示ツールのpfetch

screenfetchやneofetchと同じようなものですが,shell script 1本で動いてロゴが可愛いです.

$ git clone https://github.com/dylanaraps/pfetch
$ pfetch/pfetch
  _____      matoken@t430s
 /  __ \     os     Debian GNU/Linux bullseye/sid
|  /    |    host   23533KJ ThinkPad T430s
|  \___-     kernel 5.2.0-2-amd64
-_           uptime 8d 3h 7m
  --_        pkgs   5796
             memory 13560M / 15924M

fpetch

現在のバージョンではロゴはこれだけあるよう.

$ grep PF_ASCII: pfetch -A999|grep \*\)
        [Aa]lpine*)
        [Aa]ndroid*)
        [Aa]rch*)
        [Aa]rco*)
        [Aa]rtix*)
        [Cc]ent[Oo][Ss]*)
        [Dd]ebian*)
        [Dd]ragon[Ff]ly*)
        [Ee]lementary*)
        [Ff]edora*)
        [Ff]ree[Bb][Ss][Dd]*)
        [Gg]entoo*)
        [Gg]uix[Ss][Dd]*|[Gg]uix*)
        [Hh]aiku*)
        [Hh]yperbola*)
        [Ll]inux*[Ll]ite*|[Ll]ite*)
        [Ll]inux*)
        [Mm]ac[Oo][Ss]*|[Dd]arwin*)
        [Mm]ageia*)
        [Mm]anjaro*)
        [Mm]inix*)
        [Mm][Xx]*)
        [Nn]et[Bb][Ss][Dd]*)
        [Nn]ix[Oo][Ss]*)
        [Oo]pen[Bb][Ss][Dd]*)
        [Oo]penSUSE*|[Oo]pen*SUSE*|SUSE*|suse*)
        [Pp]arabola*)
        [Pp]op!_[Oo][Ss]*)
        [Pp]ure[Oo][Ss]*)
        [Ss]lackware*)
        [Ss]un[Oo][Ss]|[Ss]olaris*)
        [Uu]buntu*)
        [Vv]oid*)
        *)

環境変数 PF_INFOPF_ASCII で指定したものを表示できるようです.そこでこういうscriptで表示して,

#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes 'sleep';

my @LIST=('alpine','android','arch','arco','artix','centos','debian','dragonfly','elementary','fedora','freebsd','gentoo','guixsd','haiku','hyperbola','lite','linux','macos','mageia','manjaro','mint','minix','mx','netbsd','nixos','openbsd','suse','parabola','pop!_os','pureos','slackware','sunos','ubuntu','void');

foreach my $dist ( sort @LIST ){
  my $pfetch = `clear`;
  $pfetch .= "$dist\n";
  $pfetch .= `PF_INFO=ascii PF_ASCII=$dist pfetch`;
  print $pfetch;
  sleep(0.5);
}
`PF_INFO=ascii pfetch > /dev/null`;
print "done\n";

asciinemaへのアップロード……に失敗したのでttyrecして,ttygifしてみました.

pfetch logos
$ ttyrec pfetch.tty # 録画開始
$ perl pfetch-logo.pl # logo表示
$ exit  # 録画終了
$ vi pfetch.tty # テキストエディタで頭と最後のゴミ削除
$ resize -s 11 25 # terminalを小さくしておく
$ ttygif -in pfetch.tty # gifに書き出し
$ WINDOWID=`xdotool getactivewindow` ttygif -in pfetch.tty # `cannot get screenshot` と言われる場合

元のロゴはこの ufetch の一部が使われているよう.こちらにはRaspbianもありますね.

ufetch raspbian

余録:ufetchのロゴを楽しむ
$ git clone https://gitlab.com/jschx/ufetch
$ find ./ufetch/ -name "ufetch-*" -executable \! -name "*.png" -print0 | sort -n | xargs -0 -n1 -I{} sh -c "{} 2>/dev/null; sleep 0.5"
環境
$ git log -1
commit 1ff17055b958fb2436bb9810bfba0d97c64390a4 (HEAD -> master, origin/master, origin/HEAD)
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Tue Oct 1 15:09:43 2019 +0300

    pfetch: fix bug
$ ttygif -v # https://github.com/sugyan/ttygif
0.0.3
$ ls -l `which sh`
lrwxrwxrwx 1 root root 4 Jul 19 03:15 /usr/bin/sh -> dash
$ dpkg-query -W dash perl ttyrec
dash    0.5.10.2-6
perl    5.28.1-6
ttyrec  1.0.8-5+b2
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

Raspbian Buster 2019-09-26

リリースされていました.

2019-09-26:
* rpi-eeprom included
  - This will automatically update the SPI EEPROM on the Raspberry Pi 4 to the latest stable version.
     See https://rpf.io/eeprom for more information.
* New icon theme for file manager icons
* Appearance Settings - option for identical desktop on both monitors
* Appearance Settings - option to show different desktop icons on both monitors
* Taskbar automatically moved to monitor 0 if monitor 1 not found at boot
* Switching of audio output between two HDMI devices added to volume plugin
* Switching of audio input devices added to volume plugin
* .asoundrc (ALSA config file) now uses 'plug' values to support more devices
* Audio Settings tool modified to integrate more closely with volume plugin to reduce duplicated code
* Screen Configuration tool now shows separate menus for resolution and refresh rate
* Primary and active monitor settings removed from Screen Configuration tool
* Overscan support added for FKMS driver
* New keyboard shortcuts added - Ctrl-Alt-End brings up shutdown menu; Ctrl-Alt-M moves taskbar between monitors
* Latest changes to Bluez ALSA interface integrated to improve connection to Bluetooth audio devices
* Mousepad used as simple text editor instead of leafpad
* Version 3.2 of Thonny added
* Version 74 of Chromium added
* Version 3.0.8 of VLC added
* Version 32.0.0.255 of Flash player added
* Version 6.5.0 of RealVNC Server added
* Version 6.19.715 of RealVNC Viewer added (full image only)
* Version 12.0.1 of Mathematica added (full image only)
* Version 0.20.8 of NodeRED added (full image only)
* Version 3.1.0 of Sonic Pi added (full image only)
* Scratch 3 added (full image only)
* Bug fix - URL handling in Terminal
* Bug fix - octal values in SSIDs in network plugin
* Bug fix - remaining value in progress bar when transferring files
* Bug fix - integration of xarchiver tool with file manager
* Bug fix - start menu opening on incorrect monitor
* Bug fix - minimised applications wrongly displayed on taskbar on second monitor
* Bug fix - Bluetooth icon disappearing on x86 platforms when Bluetooth turned off
* Bug fix - Screen Configuration tool not shown on x86 platforms and settings not being saved
* Various translation updates
* Various minor bug fixes
* Epiphany/Web removed
* ntfs-3g included
* pciutils added
* Linux kernel 4.19.75
* Raspberry Pi firmware 01508e81ec1e918448227ca864616d56c430b46d

このショートカットが便利かも?

  • New keyboard shortcuts added – Ctrl-Alt-End brings up shutdown menu; Ctrl-Alt-M moves taskbar between monitors

とりあえず,liteだけダウンロードキューに入れておきました.

$ wget https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip.torrent \
  https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip.sig
$ transmission-cli 2019-09-26-raspbian-buster-lite.zip.torrent

ADD: その後ダウンロードが終わったのでverify

$ gpg --verify ./2019-09-26-raspbian-buster-lite.zip.sig
gpg: assuming signed data in './2019-09-26-raspbian-buster-lite.zip'
gpg: Signature made Mon 30 Sep 2019 09:43:50 PM JST
gpg:                using RSA key 54C3DD610D9D1B4AF82A37758738CD6B956F460C
gpg: Good signature from "Raspberry Pi Downloads Signing Key" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 54C3 DD61 0D9D 1B4A F82A  3775 8738 CD6B 956F 460C

#Raspberry Pi 4 model B も先週あたりに工事設計認証が総務省のリストに載ったようだし日本発売も間近?(所謂技適問題)
##電源バグも修正してくれると嬉しい

自転車修理(スポーク折れ,リヤディレイラー,チェーン交換)

先日壊れた自転車の部品が届いたので交換しました.

リヤディレイラーはシルバーをと思ったけどブラックの方が200円ちょい安かったのでそちらにした.(交換するたびにパーツグレードが下がって……)

IMG 20190927 181429.resized

質感はやっぱり値段なりで重い.スポークはストックから

IMG 20190927 182336.resized

紙節約でPDFのURLいいですね…….しかし欲しい情報はそれじゃなかった.ほしかったのはこっち → https://si.shimano.com/#/ja/DM/GN0001

IMG 20190927 183028.resized

早速作業します.

リヤディレイラーはケーブルを外し,チェーンを切って外す.

スポークを入れるためにタイヤ,チューブ,リムテープを取り外し.

IMGP0136.resized

折れたスポークはカセット側なのでカセットも外す.(部屋の中の工具箱で保管しているのに工具錆びる><)

IMGP0135.resized

ニップルは手で入れるのは難しい.折れたのや余ったスポークにニップルの逆側から繋いで差し込むと簡単.スポークを入れてリムテープ,タイヤ,チューブをはめて空気を入れてから触れ取り.ここが一番時間掛かる…….完璧ではないけどとりあえずブレーキシューに当たらないくらいまで触れ取り.後日少し走ったらまた触れ見る.

IMGP0137.resized

後はリヤディレイラーをエンドに止めてチェーンを入れてワイヤー繋いで調整.一番トップ(一番小さいギヤ)に切り替えた状態でワイヤーを引っ張って留める.チェーンの長さや微調整は次のsiteからPDFのマニュアルを入手して参照する.

アウターワイヤーも曲がってたけどとりあえずそのまま使ってみた.試走して問題なければとりあえず出来上がり.
ALTUS初めてですが案外性能いい?

使った工具.蚊にたかられるので虫除け重要.

IMGP0139.resized

死んでしまった部品…….リヤディレイラーは300円位で買った中古だったけどチェーンはKMCのを久々に使ったのだけどすぐ壊してしまい悪いことをした…….

IMGP0140.resized

エンドキャップとスポークの手持ちが切れたので補充したい.

「鹿児島Linux勉強会 2019.09」に向かう

2019-09-21(sat) に「鹿児島Linux勉強会 2019.09」に参加するために鹿児島市に行ってきました.

例によって集まりが悪くオンライン開催かなと思っていたのですが,参加者が三人に :)
前日までに
「クラウド系自由ソフトウェアがお手軽に利用できるFreedomBoxの最近とFreedomBone」,「VPSサーバのOSアップグレードといくつかのサーバからの引っ越し」
というネタを用意しました.

興味のある方は以下からどうぞ.

台風が少し心配でしたが16:00時解散なら市内の人には影響は殆ど無いだろうと思い開催としました.

当日は07:00頃家を出て鴨池・垂水フェリーを使い鹿児島市へ.

IMG 20190921 070740
IMG 20190921 090510
IMG 20190921 092236
DP1M0776

すき家で朝食を摂ってプラージュで散髪をして100円ショップを覗いたらもう時間が迫っていたので会場へ.
IMG 20190921 105644
IMG 20190921 120542

会場は湯楽館 多目的ルーム3.
電源,Wi-Fiに会場据え付けPCがあって3時間1500円で人数制限無く誰でも借りれます.
今回は参加者3人なので一人あたり500円になるはず.

DP1M0778

しかし,参加者が来ないので深セン方面のSFD代理登録したり,Androidで配信テストしたり,先日立てたOracle Cloudをいじったりしていました…….

meets.で買ったスマホ三脚スタンドは良さそうです.
DP1M0779
IMG 20190921 140731
IMG 20190921 143148
IMG 20190921 143154

16:00になって撤収しました.与次郎のダイソーとニシムタに寄ってフェリーで食べる夕食を入手,フェリーの時間を確認すると次は5分後……その次のフェリーですね.

鹿児島市ではあまり台風の影響を感じなかったのですがフェリーで大隅に渡ると雨風が強いです.荷物を濡らしたくないので雨具にポンチョを選んだのですが風と相性が悪いです.向かい風でなかなか進まないし腕が疲れる.海岸線はずっと向かい風だったので遠回りになるけど古江から内陸側に登って海岸から離れます.
IMG 20190921 182139
IMG 20190921 191931
IMG 20190921 201726

このルートだとスーパーにも寄れます.見切り品のおにぎりを入手.
しかし,残り5kmほどのところで木の枝を拾ってリヤホイールに巻き込んだようでリヤディレイヤーを折ってしまいますorz
ポークも1本折れています.

この状態では押すことも出来ないのでそのへんの蔓でディレイラーとチェーンをフレームに結んで折れたスポークを巻き付けてフロントのチェーンも落として押せるようにして家まで押して帰りました.木に囲まれていて風はなかったのだけどそれが活かせませんでしたね.

IMG 20190921 223823

この辺は木が道路に張り出していて雨風で枝葉が落ちてきて車通りも少ないので路面状態よくなくて辛いです.

IMG 20190923 023201

何気に同じ原因でリヤディレイラーを折ったのは2度目.1度目から1年も経っていません.
グラベルロードとかだともう少しこういう道に強いでしょうか?あまり変わらないかな…….
内装ギヤのほうが良いかもですね.
シングルやFixedだとさらに壊れにくいだろうけど10%超の上りがあるので辛いかな.

ちなみに自走でなく公共交通機関を使うと日帰りの範囲で天文館を目的地にすると滞在できるのは最大10:47〜13:15とちょっと現実的でないのですよね…….

さて,自転車の修理にはリヤディレイヤー,チェーン,スポークが必要.
この辺?(RDはもう少し上のグレードにしたいけど……)

リヤホイールは既にスポークを4本折って交換しているしリムも摩耗しているのでこれも出来れば交換したいところ…….


localeが足りなくてmcomixが起動しなくなっていた

mcomix が起動しなくなりました.こないだのエンバグ?と思ったけど

エラーが違う.

$ mcomix
Traceback (most recent call last):
  File "/usr/bin/mcomix", line 11, in <module>
    load_entry_point('mcomix==1.2.1', 'console_scripts', 'mcomix')()
  File "/usr/lib/python2.7/dist-packages/mcomix/run.py", line 127, in run
    i18n.install_gettext()
  File "/usr/lib/python2.7/dist-packages/mcomix/i18n.py", line 71, in install_gettext
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python2.7/locale.py", line 581, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

localeぽいので適当に指定してみると起動.

$ LC_ALL=C mcomix

しかし,C だと日本語ファイル名などでエラーとなる.

UnicodeEncodeError: 'ascii' codec can't encode characters in position 25-27: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mcomix/file_chooser_base_dialog.py", line 215, in _response
    if os.path.isdir(path):
  File "/usr/lib/python2.7/genericpath.py", line 49, in isdir
    st = os.stat(s)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 25-27: ordinal not in range(128)

en_US.UTF-8 だととりあえず利用できるけど,ja_JP.UTF-8 とかで日本語を指定すると……うまく行かない?

$ export LC_ALL=ja_JP.UTF-8 mcomix
bash: warning: setlocale: LC_ALL: cannot change locale (ja_JP.UTF-8)

localeを確認するとインストール時に設定していたつもりの ja_JP.UTF-8 がありません.

$ grep -v ^# /etc/locale.gen |uniq

en_US.UTF-8 UTF-8

/etc/locale.gen を編集して,ja_JP.UTF-8 のコメントを外して locale-gen コマンドで生成したら動くようになりました.

$ sudo git diff HEAD~~ /etc/locale.gen
diff --git a/locale.gen b/locale.gen
index c432a9a..afb6141 100644
--- a/locale.gen
+++ b/locale.gen
@@ -287,7 +287,7 @@ en_US.UTF-8 UTF-8
 # it_IT@euro ISO-8859-15
 # iu_CA UTF-8
 # ja_JP.EUC-JP EUC-JP
-# ja_JP.UTF-8 UTF-8
+ja_JP.UTF-8 UTF-8
 # ka_GE GEORGIAN-PS
 # ka_GE.UTF-8 UTF-8
 # kab_DZ UTF-8
$ sudo locale-gen
Generating locales (this might take a while)...
  en_US.UTF-8... done
  ja_JP.UTF-8... done
Generation complete.
環境
$ dpkg-query -W locales mcomix
locales 2.29-1
mcomix  1.2.1-1.1
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

略語郎のサンプルテキストをstardict形式に変換してGoldenDictで利用

過去に購入したことのあるEDPさんが新しいその他書籍を公開しました!

略語郎 Ver.144(2015年3月20日版)のテキストデータ
その他書籍 略語郎 Ver.144(2015年3月20日版)のテキストデータ ¥ 150

EDPの英辞郎はStarDict形式に変換して辞書閲覧ソフトのGoldenDictで利用していおます.
略語郎も同様に利用できないかとサンプルテキストで試してみました.

以前英辞郎を変換したときと同じ手順で試しました.

$ time perl eiji2sd-text.pl ryakugoro-sample.txt

Sorting...

Done.

real    0m0.277s
user    0m0.178s
sys     0m0.017s

20190906 21:50:35 8570

変換した辞書ファイルをGoldenDictに設定して試してみるとうまく動いているようです.
150円だし買ってもいいかも.

環境
$ dpkg-query -W perl goldendict
goldendict      1.5.0~rc2+git20181207+ds-1
perl    5.28.1-6
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64

awesome wmでパスを追加する

bashだと~/bin とかにパスが通っているのにawesomeからmod4 +r で起動しようとするとコマンドが見当たりません.

20190830 14:08:46 21926

AppImageやFlatpakなんかのアプリを格納したりしているのですがこれだと /home/user/bin/command とかフルパスで書かないと駄目です.

bashだとパスが通っています.

$ type -a MQTT-Explorer
MQTT-Explorer is /home/matoken/bin/MQTT-Explorer
$ ls -l /home/matoken/bin/MQTT-Explorer
lrwxrwxrwx 1 matoken matoken 71 Aug 25 21:22 /home/matoken/bin/MQTT-Explorer -> /home/matoken/opt/AppImage/MQTT-Explorer-0.3.6-no-delete-limit.AppImage

awesomeで,mod4 + r して sh -c "$PATH >> ~/tmp/awesomepath" とかして PATH を確認してみるとこれだけしかパスが通っていません.

$ cat ~/tmp/awesomepath
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

~/.xinitrc でパスを追加してみましたが反映されません.
多分lightdm経由で起動しているので関係なかった.

$ ps auxf|grep -B3 awesome
root     32202  0.0  0.0 309612  5532 ?        SLsl  8月29   0:00 /usr/sbin/lightdm
root     32208  1.2  0.5 430424 82396 tty7     Ssl+  8月29  10:48  \_ /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
root     32283  0.0  0.0 163604  5856 ?        Sl    8月29   0:00  \_ lightdm --session-child 12 21
matoken  32293  0.1  0.6 350760 99060 ?        Ssl   8月29   1:18      \_ awesome

~/.Xsession に`PATH=$HOME/bin:$PATH` のような感じでパスを追加するとパスが通りました.でもパスの追加しか書いていないと色々と起動しないサービスがあります.
大本の`/etc/X11/Xsession` をcpしてきてそのファイルにパスの設定を追加したらOKでした.

$ cp /etc/X11/Xsession ~/.Xsession
$ echo 'PATH=$HOME/bin:$PATH' >> ~/.Xsession

これパスの管理一緒にしたいですね.

環境
$ dpkg-query -W awesome lightdm
awesome 4.3-4
lightdm 1.26.0-5
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64