wallpaper – matoken's blog https://matoken.org/blog Is there no plan B? Sun, 26 Feb 2023 19:25:47 +0000 ja hourly 1 https://wordpress.org/?v=6.8.1 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg wallpaper – matoken's blog https://matoken.org/blog 32 32 Windows/Linux環境で動作する視差壁紙エンジンのlwp https://matoken.org/blog/2023/02/27/parallax-wallpaper-engine/ https://matoken.org/blog/2023/02/27/parallax-wallpaper-engine/#respond Sun, 26 Feb 2023 22:25:00 +0000 https://matoken.org/blog/?p=3856

視差壁紙エンジンのlwp というものを試してみました.

動作環境はLinux, Windows です.Linux amd64 環境で試してみました.
lwp のREADME では / に展開するようにとなっていましたがあまりやりたくないのでとりあえずアドホックに動かしました.

$ wget https://github.com/jszczerbinsky/lwp/releases/download/1.5/lwp-linux-x86_64.zip (1)
$ unzip -l ./lwp-linux-x86_64.zip
Archive:  ./lwp-linux-x86_64.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2023-02-19 07:42   etc/
      661  2023-02-19 07:32   etc/default.cfg
     1047  2023-02-22 23:42   etc/lwp.cfg
        0  2023-02-11 05:41   usr/
        0  2023-02-22 23:42   usr/bin/
    30800  2023-02-22 23:42   usr/bin/lwp
        0  2022-09-30 05:27   usr/share/
        0  2022-09-30 05:27   usr/share/lwp/
     1076  2023-02-22 23:42   usr/share/lwp/LICENSE
        0  2022-09-30 05:27   usr/share/lwp/wallpapers/
        0  2023-02-21 07:58   usr/share/lwp/wallpapers/test/
  8294538  2023-02-22 23:42   usr/share/lwp/wallpapers/test/1.bmp
      102  2023-02-22 04:16   usr/share/lwp/wallpapers/test/source
  8294538  2023-02-22 23:42   usr/share/lwp/wallpapers/test/3.bmp
  8294538  2023-02-22 23:42   usr/share/lwp/wallpapers/test/2.bmp
      461  2023-02-22 23:42   usr/share/lwp/wallpapers/test/wallpaper.cfg
        0  2023-02-11 05:41   usr/etc/
      558  2023-02-11 05:41   usr/etc/default.cfg
---------                     -------
 24918319                     18 files
$ mkdir lwp
$ cd lwp
$ unzip ../lwp-linux-x86_64.zip
$ usr/bin/lwp (2)
INFO: User config file not found, opening default config
ERROR: Default config file not found!
Segmentation fault
$ mkdir ~/.config/lwp (3)
$ install ./etc/lwp.cfg ~/.config/lwp/lwp.cfg (4)
$ xrandr | grep \* (5)
   1920x1200     59.96*+
$ vi ~/.config/lwp/lwp.cfg (6)
$ diff -u etc/lwp.cfg ~/.config/lwp/lwp.cfg
--- etc/lwp.cfg 2023-02-22 23:42:43.000000000 +0900
+++ /home/matoken/.config/lwp/lwp.cfg   2023-02-27 03:31:49.160716609 +0900
@@ -25,11 +25,11 @@
 monitor1_h=1080

 # Absolute path to the wallpaper directory
-monitor1_wallpaper=/usr/share/lwp/wallpapers/test
+monitor1_wallpaper=./usr/share/lwp/wallpapers/test (7)

 # Wallpaper size and position relative to Your monitor
 # Wallpaper resolution ratio should be the same as in original image
 monitor1_wallpaper_x=0
 monitor1_wallpaper_y=0
 monitor1_wallpaper_w=1920
-monitor1_wallpaper_h=1080
+monitor1_wallpaper_h=1200 (8)
$ usr/bin/lwp (9)
  1. release からバイナリアーカイブを取得
  2. 展開して実行してみると設定ファイルが見当たらないらしい
  3. 設定ファイルディレクトリを作成
  4. 規定値の設定ファイルをコピー
  5. 解像度を確認,ここでは 1920×1200
  6. 設定ファイルを編集
  7. 壁紙のパスを修正
  8. 解像度を修正
  9. 実行すると壁紙が設定された

Android の壁紙のようで面白いです.ただ,手元の環境では縦サイズが足りません.壁紙の元サイズが 1920×1080 に対してPCの解像度が 1920×1200 なのでそのせいだと思います.

$ file usr/share/lwp/wallpapers/test/*.bmp
usr/share/lwp/wallpapers/test/1.bmp: PC bitmap, Windows 98/2000 and newer format, 1920 x 1080 x 32, cbSize 8294538, bits offset 138
usr/share/lwp/wallpapers/test/2.bmp: PC bitmap, Windows 98/2000 and newer format, 1920 x 1080 x 32, cbSize 8294538, bits offset 138
usr/share/lwp/wallpapers/test/3.bmp: PC bitmap, Windows 98/2000 and newer format, 1920 x 1080 x 32, cbSize 8294538, bits offset 138
環境
$ dpkg-query -W libwayland-server0 gnome-shell
gnome-shell     43.2-2
libwayland-server0:amd64        1.21.0-1
libwayland-server0:i386 1.21.0-1
$ lsb_release -a
Distributor ID: Debian
Description:    Debian GNU/Linux bookworm/sid
Release:        n/a
Codename:       bookworm
$ arch
x86_64
]]>
https://matoken.org/blog/2023/02/27/parallax-wallpaper-engine/feed/ 0
awesome wm や i3 wm で feh と Unsplash を使ってランダムな壁紙を設定 https://matoken.org/blog/2021/06/21/random-wallpaper-setting-with-unsplash/ https://matoken.org/blog/2021/06/21/random-wallpaper-setting-with-unsplash/#respond Sun, 20 Jun 2021 23:14:57 +0000 http://matoken.org/blog/?p=3275

unsplash logo

Unsplash という画像サービスを知りました.

無料で利用できる写真が提供されています.どうもアップロードされた写真を人力で選別しているようです.そのため高品質な写真が集まっているようです.

そして,URL指定だけで使える簡易APIが提供されています.これと feh コマンドを使ってランダムな壁紙を設定してみました.

Unsplash の https://source.unsplash.com/ の後ろにパラメーターを追加していって条件に合う画像を取得できるようです.

例えば https://source.unsplash.com/random/likes?linux,penguin このURLではユーザーにLikeされたLinuxやpenguinをキーワードに検索されたランダムな画像が取得できます.
このURLを feh コマンドに渡すと壁紙が設定できました :)

$ feh --bg-max https://source.unsplash.com/random/likes?linux,penguin

最近使っている壁紙設定scriptです.crontabからでも呼べるようにWMのDISPLAY番号を調べて設定するようになっています. PICTURES に壁紙の格納されたディレクトリを設定して,WMNAME を利用するWMのプロセス名に書き換えて使います.壁紙ディレクトリの中の画像をランダムに設定します.

#!/bin/sh

PICTURES="${HOME}/Pictures/wp"
WMNAME="i3"
USERID=$( id -u )
DISPLAYPID=$( pgrep -u "${USERID}" "${WMNAME}"$ )
DISPLAYNO=$( strings /proc/"$DISPLAYPID"/environ | grep ^DISPLAY= )
sh -c "$DISPLAYNO feh --bg-max -z ${PICTURES}"

これを流用して,以下のように書き換えてcrontabから呼ぶようにしてみました.

#!/bin/sh

PICTURESURL="https://source.unsplash.com/random/likes?linux,penguin"
WMNAME="i3"
USERID=$( id -u )
DISPLAYPID=$( pgrep -u "${USERID}" "${WMNAME}"$ )
DISPLAYNO=$( strings /proc/"$DISPLAYPID"/environ | grep ^DISPLAY= )
sh -c "$DISPLAYNO feh --bg-max ${PICTURESURL}"

いつもはJPLのギャラリーや気に入った画像をダウンロードして使っていましたが似たような画像を集めてしまいがちです.ランダムな画像にすることで自分ではあまり選ばないような壁紙が設定されるようになって新鮮な気持ちになれました.

環境
$ dpkg-query -W feh procps binutils
binutils        2.35.2-2
feh     3.6.3-1
procps  2:3.3.17-5
$ lsb_release -dr
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
$ arch
x86_64
]]>
https://matoken.org/blog/2021/06/21/random-wallpaper-setting-with-unsplash/feed/ 0