2

How can I, at runtime check whether the program is running in a Weston environment. I program a Gtk+-3.0 in C and I want depending on the Display Server technology the GUI is running different windows size and similar hints.

To be more precise. My system is a very small embedded linux. I start weston via systemd:

# 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

This is the startup script:

#!/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
4

1 回答 1

2

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);
}
于 2015-08-04T10:01:13.683 回答