如何检查Weston环境

如何在运行时检查程序是否在Weston环境中运行。 我在C中编写Gtk + -3.0编程,我希望根据显示服务器技术,GUI运行不同的窗口大小和类似的提示。

更确切地说。 我的系统是一个非常小的嵌入式Linux。 我通过systemd启动weston:

# weston systemd service unit file                                                                          

[Unit]
Description=Weston launcher
After=systemd-user-sessions.service

[Service]
Environment=PATH=/usr/bin:/bin:/usr/sbin:/sbin
Environment=HOME=/root
ExecStart=/root/weston.sh
Restart=always
RestartSec=10

[Install]
Alias=display-manager.service
WantedBy=graphical.target

这是启动脚本:

#!/bin/bash
# Weston startup file.
export XDG_RUNTIME_DIR="/run/shm/wayland"
mkdir -p "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"

/usr/bin/weston --tty=1 --log=/var/log/weston.log
采纳答案:

http://manpages.ubuntu.com/manpages/saucy/man1/weston.1.html

尝试获取此环境变量 -

WAYLAND_DISPLAY

例如,使用getenv()...

#include <stdio.h>
#include <stdlib.h>

int main ()
{
   printf("WESTON : %s\n", getenv("WAYLAND_DISPLAY"));
   return(0);
}
author: neil

参考更多解答: How to check a weston environment ,转载请保留出处如何检查Weston环境及作者信息

Statement: We respect knowledge and authors. Since the content comes from the Internet and is intended for scientific research, any reprinters should retain the author's signature and origin. If you are the author of the content and feel in dispute, please contact email: 1076545519@qq.com. We will find out the situation and deal with it in time. We sincerely thank the author for his hard work.


更多:c