2022-03-05 (Sa) [長年日記]
_ org.freedesktop.PowerManagement.Inhibit
っていうのが dbus にある。
これ qdbus で使えるかな? と思って使ってみた。
qdbus org.freedesktop.PowerManagement.Inhibit /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.Inhibit miv image
しかし暗くなる。
前後で
qdbus org.freedesktop.PowerManagement.Inhibit /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.HasInhibit
を実行してみても、false のまま。
なんじゃそりゃ!
とぐぐってみると、どうも、接続が切れると自動で UnInhibit するらしい。
なるほど、じゃぁ qdbusviewer で同じことをやってみた。
確かにこれなら HasInhibit が true になる。
miv 内でなんとかするしかないんかね。 Gtk アプリだから GDBus かな。
GDBusProxy *proxy = g_dbus_proxy_new_for_bus_sync(
G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.freedesktop.PowerManagement.Inhibit",
"/org/freedesktop/PowerManagement/Inhibit",
"org.freedesktop.PowerManagement.Inhibit",
NULL,
NULL);
g_dbus_proxy_call_sync(
proxy,
"org.freedesktop.PowerManagement.Inhibit.Inhibit",
g_variant_new(
"(ss)",
"miv",
"Showing images"),
G_DBUS_CALL_FLAGS_NONE,
0,
NULL,
NULL);
こうかな。
試したところ、screensaver は起動しなかったけど、画面暗くはなった。 嬉しくねええええ orz
あ、いや、別の service を使えばいけた。
GDBusProxy *proxy = g_dbus_proxy_new_for_bus_sync(
G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.kde.Solid.PowerManagement.PolicyAgent",
"/org/kde/Solid/PowerManagement/PolicyAgent",
"org.kde.Solid.PowerManagement.PolicyAgent",
NULL,
NULL);
g_dbus_proxy_call_sync(
proxy,
"org.kde.Solid.PowerManagement.PolicyAgent.AddInhibition",
g_variant_new(
"(uss)",
4,
"miv",
"Showing images"),
G_DBUS_CALL_FLAGS_NONE,
0,
NULL,
NULL);
よし来たーー!!
KDE 専用になっちまったけどな。
_ OS が起動しなくなった
ArchLinux。
pacman -Syu
で更新中、kernel は更新したけど kernel module が
更新できてないうちに、KDE Plasma が死んだ。
で、もう reboot するしかなかったので reboot したところ、 やっぱり起動しなかった、と。
archiso は焼いてあるんだけど、zfs が入ってないんで、 どうしようかなーと思いながら、英語版の install archlinux on zfs を 読んだところ、
https://github.com/eoli3n/archiso-zfs
↑こんなものができていた。
つまり、archiso で起動して、ネットワークの設定をしたら、おもむろに
curl -s https://eoli3n.github.io/archzfs/init | bash
を実行する。すると zfs の準備ができる、と。
おおお。なんて便利なものができたんだ。
[ツッコミを入れる]