1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Raspberry Piでアプリをフルスクリーン実行 (Labwc)

Posted at

この手の話題、色々なところでいろんな方法でできるとかできないとか書かれているけど、ボクはこの方法でできた。

前提条件

  • 現時点 (2025/5/28) で最新のRaspberry Pi OS
  • Labwcを使う (raspi-configのAdvanced Optionsから)
  • アプリ側が全画面で実行できるようになっている

アプリをJUCE + Projucerで作ってる場合

JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1をPreprocessor Definitionsに書いてStandAloneAppを自分で作る。
image.png

その自前のStandAloneAppクラスの中でDesktop::getInstance().setKioskModeComponent()でフルスクリーン化する。

MyStandAloneApp.cpp
void MyStandAloneApp::initialise (const String&)
{
    //  In this method, an instance of AudioProcessor is created, initialized, and setStateInformation() is called.
    mainWindow.reset (createWindow());

    // これは関係ないかも。やったとしても左上にいるっぽい。Windowsサイズに合わせてComponentのサイズもリサイズすべき
    mainWindow->centreWithSize(mainWindow->getWidth(), mainWindow->getHeight());

    mainWindow->setVisible (true);
#if JUCE_LINUX
    Desktop::getInstance().setKioskModeComponent(mainWindow.get(), false);
#endif
}

これで手動起動でフルスクリーンになることを確認。

Labwc の autostart と rc.xml

設定用のディレクトリを作成。

mkdir -p ~/.config/labwc

autostart という名前で下記のファイルを作成。

#!/bin/sh
# Labwc 起動後に実行するアプリ
# 必要に応じて1秒ほど待ってから起動すると安定する
sleep 1
/path/to/MyApp &

さらにrc.xmlというファイルを作成。

rc.xml
<?xml version="1.0"?>
<labwc_config>
  <windowRules>
    <!--
      identifier は Wayland ネイティブなら app_id、
      XWayland なら WM_CLASS のトリミング後の文字列
      (自分のアプリ名に合わせて書き換える)
    -->
    <windowRule identifier="MyApp" event="onMap">
      <!-- フルスクリーン化 -->
      <action name="ToggleFullscreen"/>
      <!-- タイトルバーなど装飾を完全にオフ -->
      <action name="ToggleDecorations" decorations="none"/>
    </windowRule>
  </windowRules>
</labwc_config>

このrc.xmlの中に<action name="HideCursor"/>を追加するとカーソルが消える…と思っても消えなかった。

マウスカーソルを隠す

sudo apt-get install unclutter-xfixes

# ~/.config/labwc/autostart に下記を記述
unclutter-xfixes --hide-on-touch &

アプリの起動と合わせると

#!/bin/sh
# Labwc 起動後に実行するアプリ
# 必要に応じて1秒ほど待ってから起動すると安定する
sleep 1
unclutter-xfixes --hide-on-touch &
/path/to/MyApp &
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?