Nothin' but Slackware

バイクとLinuxに戯れる日々

2021年06月

bluetooth-autoconnect

いつの頃からか不明だが、いままで slackware64-current を起動時(起動後のログインコンソール)
で自動認識されていた Logicoolのbluetooth-Mouse が自動認識されなくなり、X起動後の
bluemanで接続処理しないと使えない状況になっていた。

根本的な原因と対策は未だ不明で調査中であるが、Archの「bluetooth-autoconnect」 スクリプトが
有効そうなので、とりあえずの暫定対策として導入した。(> Thanks Arch)


Step by Step INSTALL How2

Step-1. Install python-prctrl package
  ※ 忙しい人は、おそらく pip install python-prctrl でインストール可能と思われるが
  自分はパッケージ管理したかったので、以下のスクリプトで Slackware64-current向け
  パッケージを作成してインストールした。
1) pythom-prctrl.SlackBuild
#!/bin/sh

# Slackware build script for python-prctl
# Copyright 2021 JW(Shinichi Abe) <shin1.abe@nifty.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PRGNAM=python-prctl
VERSION=${VERSION:-1.8.1}
BUILD=${BUILD:-1}
TAG=${TAG:-jw}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/jw}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
 -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

python3 setup.py install --root=$PKG

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

#find $PKG/usr/man -type f -exec gzip -9 {} \;
#for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
  README docs  $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}

2) slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

                      |-----handy-ruler------------------------------------------------------|
python-prctl: python-prctl ()
python-prctl: The linux prctl function allows you to control specific
python-prctl: characteristics of a process' behaviour. Usage of the function is
python-prctl: fairly messy though, due to limitations in C and linux.
python-prctl: This module provides a nice non-messy python(ic) interface.
python-prctl:
python-prctl: https://pypi.org/project/python-prctl/
python-prctl:
python-prctl:
python-prctl:
python-prctl:


Step-2. Copy the python script "bluetooth-autoconnect" into /usr/bin/

[Code]
wget https://github.com/jrouleau/bluetooth-autoconnect/raw/master/bluetooth-autoconnect

[Code]
# cp bluetooth-autoconnect /usr/bin/
# chmod a+x /usr/bin/bluetooth-autoconnect


Step-3. Edit /etc/rc.d/rc.local and enable bluetooth-autostart at boot-up
 Add following line to /etc/rc.d/rc.local
----------------------------------------------
# Enable bluetooth-autoconnect
/usr/bin/bluetooth-autoconnect

----------------------------------------------


Step-4. Edit /etc/bluetooth/main.conf

[Code]
# AutoEnable defines option to enable all controllers when they are found.
# This includes adapters present on start as well as adapters that are plugged
# in later on. Defaults to 'false'.
AutoEnable = true


blueman-2.2.1 LC_MESSAGES 日本語翻訳状況

blueman-2.2.1 の日本語メッセージの翻訳作業に参加しています。

日本語化進捗状況ウィジェット
(日本語化翻訳へ協力してくださる方は下記の画像をクリックして
 翻訳作業に参加することが出来ます)
==========================
翻訳状況
==========================
PC用読者登録 QRコード

スマホ用読者登録ボタン


How to convert mp4 file to the mobile quality 320x240p mp4

【備忘録】
手元の動画(例えば INPUT.mp4)を自家用車のナビで認識可能な 320x240pサイズ
変換するためのコマンド

Case-1) Convert with "-hwaccel cuda" of NVIDIA GPU (on my desktop PC)
[Code]
$ ffmpeg -hwaccel cuda -i INPUT.mp4 -vcodec mpeg4 -b:a 300k -s 320x240 -ac 2 -ab 128k -acodec aac OUT.mp4

Case-2) Convert with vdpau (on Intel GPU, without NVIDIA)
[Code]
$ ffmpeg -i INPUT.mp4 -b:a 300k -s 320x240 -vcodec mpeg4 -ac 2 -ab 128k -acodec aac OUT.mp4


Dark theme使用時の WPS-Office-for-Linux表示問題への対策

自分は slackware64-currentのDdesktop環境として Xfce4を使っており、
gtk+ および Qt5のテーマとして dark系テーマを採用している。

しかしながら、drak系テーマとWPS-Officeはいまいち相性が良くないらしく、
wps(文書作成)やet(表計算)などの起動後、普通の作業画面には特に問題は
見あらたらないのだが、オプション設定画面を表示すると以下のような表示になり
設定項目を読み取るのが困難な状態になる。
wps-office-option-view-with-dark-theme_01


これを回避するには、アプリケーション起動コマンドを以下のように指定して
起動させる。

$ env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc wps -style=gtk+

これにより、アプリケーションは強制的に "oxygen-gtk" テーマで起動されるため、
オプションダイアログが読み取れるようになる。
(dark系テーマにはならないので、本当の意味の対策ではないが)

※ 上記設定で解決しない場合は、env 指定は省いて単に <実行ファイル> -style=motif
  の指定をしてみるか、他の gtkテーマを指定してみるか等を試すしかないかも。


wps-office-option-view-with-dark-theme_fixed

・コマンドから起動する場合の例は以下のように <HOME>/.bashrc に
aliasを追加しておけばよい
[Code]

$ nano <HOME>/.bashrc
ADD following lines

# Fix wps theme under grobal datrk setting
alias wps='env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc wps -style=gtk+'
alias et='env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc et -style=gtk+';
alias wpp='env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc wpp -style=gtk+'
alias wpspdf='env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc wpspdf -style=gtk+'


・Xfce4メニューから起動するときはメニューエディタで各アプリケーションの
 実行命令を以下のように書き換える
[Code]
env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc /usr/bin/wps %U -style=gtk+
env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc /usr/bin/wpspdf %F -style=gtk+
env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc /usr/bin/wpp %F -style=gtk+
env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc /usr/bin/et %F -style=gtk+
env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc /usr/bin/wps %F -style=gtk+


---
【更新】2021-06-05
PDF-Reader (wpspdf) の場合、上記と同じ設定にしても options ダイアログの
文字が読み取れなかった。
wpspdf のみ下記コマンドを指定することで表示できるようになった。
[Code]
env GTK2_RC_FILES=/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc /usr/bin/wpspdf -style=gtk+

---
【更新】2021-06-05 (2)
PDF-Reader (wpspdf)の日本語化ファイルをLinguistを使用して更新。
更新したソース
pdf.ts
pdfcore.ts
pdfresources.ts
地味に苦労した... _| ̄|○ (相変わらず Qt5-Linguistは便利だ)

苦労の成果(スクリーンショット)
更新前
wpspdf-before-01

wpspdf-before-02

更新後
wpspdf-after-01

wpspdf-after-02

【更新】2021-06-05 (3)
いろいろ試してみると、-style=motif の指定だと wps, et, wpp の起動後のオプション表示は
OKなのだが、今度は ファイル > 開く のオープンダイアログの表示が「文字が見えない」
状態になってた。_| ̄|○
…で、結局全ての実行命令に対して wpspdf と同様の設定にすることで一応の解決に至った。


ギャラリー
  • deepl-clip.sh で簡単翻訳 [更新:2025-04-29]
  • Avidemux 2.8.2_20250323_7cf15b3
  • Avidemux 2.8.2_20250323_7cf15b3
  • Avidemux 2.8.x with Qt6 GUI
  • Avidemux 2.8.x with Qt6 GUI
  • MEGAcmd-2.0.0_Linux
  • gcolor3 with Japanese menu and LC_MESSAGES
  • avidemux2 TEST package from the latest git source (on jul.23.2024)
  • fcitx5-mozc-2.29.5135.102.1 (15jw) -- Added "merge-ut-dictionaries"