From 2782daf93172f3ce355538ac786ea81de35b4c69 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Wed, 21 Jun 2017 10:14:35 +0200 Subject: [PATCH] update yavdr-xorg files --- roles/yavdr-xorg/templates/autostart.j2 | 9 - .../yavdr-xorg/templates/openbox/autostart.j2 | 25 + roles/yavdr-xorg/templates/openbox/rc.xml.j2 | 816 ++++++++++++++++++ .../system}/x-verbose@.service.j2 | 0 .../user/detect-second-display.service.j2 | 9 + .../systemd/user/openbox-second.service.j2 | 14 + .../templates/systemd/user/osd2web.service.j2 | 13 + .../templates/systemd/user/tmux.service.j2 | 12 + 8 files changed, 889 insertions(+), 9 deletions(-) delete mode 100644 roles/yavdr-xorg/templates/autostart.j2 create mode 100644 roles/yavdr-xorg/templates/openbox/autostart.j2 create mode 100644 roles/yavdr-xorg/templates/openbox/rc.xml.j2 rename roles/yavdr-xorg/templates/{ => systemd/system}/x-verbose@.service.j2 (100%) create mode 100644 roles/yavdr-xorg/templates/systemd/user/detect-second-display.service.j2 create mode 100644 roles/yavdr-xorg/templates/systemd/user/openbox-second.service.j2 create mode 100644 roles/yavdr-xorg/templates/systemd/user/osd2web.service.j2 create mode 100644 roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 diff --git a/roles/yavdr-xorg/templates/autostart.j2 b/roles/yavdr-xorg/templates/autostart.j2 deleted file mode 100644 index 777c844..0000000 --- a/roles/yavdr-xorg/templates/autostart.j2 +++ /dev/null @@ -1,9 +0,0 @@ -env | grep "DISPLAY\|DBUS_SESSION_BUS_ADDRESS\|XDG_RUNTIME_DIR" > ~/.session-env -systemctl --user import-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS - -if which dbus-update-activation-environment >/dev/null 2>&1; then - dbus-update-activation-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR -fi - -# start systemd units for the yavdr user session -systemctl --user isolate yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/openbox/autostart.j2 b/roles/yavdr-xorg/templates/openbox/autostart.j2 new file mode 100644 index 0000000..f3b16c7 --- /dev/null +++ b/roles/yavdr-xorg/templates/openbox/autostart.j2 @@ -0,0 +1,25 @@ +#!/bin/bash + +# forward environment variables to an environment file and the systemd user session +env | grep "DISPLAY\|DBUS_SESSION_BUS_ADDRESS\|XDG_RUNTIME_DIR" > ~/.session-env +systemctl --user import-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS + +enabled_services=("detect-second-display.service" "openbox-second.service" "osd2web.service") +disabled_services=() + +# enable configured services for the user session +for service in "${enabled_services[@]}"; do + systemctl --user enable "$service" +done + +# disable unwanted services for the user session +for service in "${disabled_services[@]}"; do + systemctl --user disable "$service" +done + +if which dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR +fi + +# start systemd units for the yavdr user session +systemctl --user isolate yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/openbox/rc.xml.j2 b/roles/yavdr-xorg/templates/openbox/rc.xml.j2 new file mode 100644 index 0000000..d866a8c --- /dev/null +++ b/roles/yavdr-xorg/templates/openbox/rc.xml.j2 @@ -0,0 +1,816 @@ + + + + + 10 + 20 + + + yes + + no + + yes + + no + + 200 + + no + + + + Smart + +
yes
+ + Active + + Active + +
+ + Onyx + NLIMC + + yes + yes + + sans + 8 + + bold + + normal + + + + sans + 8 + + bold + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + normal + + normal + + + + sans + 9 + + bold + + normal + + + + sans + 9 + + bold + + normal + + + + + + 2 + 1 + + + + 875 + + + + yes + Nonpixel + + Center + + + + 10 + + 10 + + + + + + 0 + 0 + 0 + 0 + + + TopLeft + + 0 + 0 + no + Above + + Vertical + + no + 300 + + 300 + + Middle + + + + C-g + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + left + no + + + + + right + no + + + + + up + no + + + + + down + no + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + + + + + client-menu + + + + + + scrot -s + + + + + + + + + + + + + + + + + + + + + + + + yes + yes + + + + + + + + + + + right + + + + + left + + + + + up + + + + + down + + + + + + + true + Konqueror + + kfmclient openProfile filemanagement + + + + + + scrot + + + + + 1 + + 500 + + 400 + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + no + + + + + + + + + + + yes + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + top + + + + + + + left + + + + + + + right + + + + + + + bottom + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + client-menu + + + + + + + client-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vertical + + + + + horizontal + + + + + + + + + + + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + + + + + + + + client-list-combined-menu + + + + + root-menu + + + + + + + previous + + + + + next + + + + + previous + + + + + next + + + + + + + + + /var/lib/openbox/debian-menu.xml + menu.xml + 200 + + no + + 100 + + 400 + + yes + + yes + + + + + + no + true + + yes + + + no + true + + yes + + + no + true + + yes + + +
diff --git a/roles/yavdr-xorg/templates/x-verbose@.service.j2 b/roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2 similarity index 100% rename from roles/yavdr-xorg/templates/x-verbose@.service.j2 rename to roles/yavdr-xorg/templates/systemd/system/x-verbose@.service.j2 diff --git a/roles/yavdr-xorg/templates/systemd/user/detect-second-display.service.j2 b/roles/yavdr-xorg/templates/systemd/user/detect-second-display.service.j2 new file mode 100644 index 0000000..55f5fbe --- /dev/null +++ b/roles/yavdr-xorg/templates/systemd/user/detect-second-display.service.j2 @@ -0,0 +1,9 @@ +[Unit] +Description=Detect second DISPLAY using xrandr + +[Service] +Type=oneshot +ExecStart=/bin/bash -c 'export DISPLAY=$DISPLAY.1; xrandr -q | grep "connected" && echo "DISPLAY=$DISPLAY" > ~/.second_display || rm -f ~/.second_display' + +[Install] +WantedBy=yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/systemd/user/openbox-second.service.j2 b/roles/yavdr-xorg/templates/systemd/user/openbox-second.service.j2 new file mode 100644 index 0000000..5afe458 --- /dev/null +++ b/roles/yavdr-xorg/templates/systemd/user/openbox-second.service.j2 @@ -0,0 +1,14 @@ +[Unit] +Description=Start openbox on the second DISPLAY if it exists +After=detect-second-display.service +Wants=detect-second-display.service +Before=yavdr-frontend.service +ConditionFileNotEmpty=%h/.second_display + +[Service] +PassEnvironment=XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS +EnvironmentFile=%h/.second_display +ExecStart=/usr/bin/openbox --config-file %h/.config/openbox/rc.xml + +[Install] +WantedBy=yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/systemd/user/osd2web.service.j2 b/roles/yavdr-xorg/templates/systemd/user/osd2web.service.j2 new file mode 100644 index 0000000..2665393 --- /dev/null +++ b/roles/yavdr-xorg/templates/systemd/user/osd2web.service.j2 @@ -0,0 +1,13 @@ +[Unit] +Description=Start a kiosk browser on the second DISPLAY if it exists +After=detect-second-display.service openbox-second.service +Wants=detect-second-display.service openbox-second.service +ConditionFileNotEmpty=%h/.second_display + +[Service] +EnvironmentFile=%h/.second_display +PassEnvironment=XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS +ExecStart=/usr/bin/on_vdr -o -c 'kiosk-browser "http://localhost:4444/skins/horchiTft/index.html?theme=blue&onlyView=1"' + +[Install] +WantedBy=yavdr-desktop.target diff --git a/roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 b/roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 new file mode 100644 index 0000000..b3066db --- /dev/null +++ b/roles/yavdr-xorg/templates/systemd/user/tmux.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=Start tmux in detached session + +[Service] +EnvironmentFile=-%h/.session-env +Type=forking +ExecStart=/usr/bin/tmux new-session -s use-session -d +ExecStop=/usr/bin/tmux kill-session -t %u +Restart=always + +[Install] +WantedBy=default.target