1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-14 12:12:12 +00:00

Use Wayland compositor's ~/.config/wayfire.ini to show pop-ups & browser on boot

This commit is contained in:
root 2023-12-16 23:51:24 -05:00
parent c4738b007e
commit c90c85acaf
8 changed files with 67 additions and 54 deletions

View file

@ -2,34 +2,36 @@
# AND roles/network/tasks/netwarn.yml FOR iiab-network
- name: Install /etc/profile.d/sshpwd-profile-iiab.sh from template, to issue warnings (during shell/ssh logins) if iiab-admin password is the default
- name: Install /etc/profile.d/iiab-pwdwarn-profile.sh from template, to issue warnings (during shell/ssh logins) if iiab-admin password is the default
template:
src: sshpwd-profile-iiab.sh.j2
dest: /etc/profile.d/sshpwd-profile-iiab.sh
src: iiab-pwdwarn-profile.sh.j2
dest: /etc/profile.d/iiab-pwdwarn-profile.sh
mode: '0644'
- name: Is /etc/xdg/lxsession/LXDE-pi a directory?
- name: Does /home/{{ iiab_admin_user }}/.config/wayfire.ini exist?
stat:
path: /etc/xdg/lxsession/LXDE-pi
register: lx
path: /home/{{ iiab_admin_user }}/.config/wayfire.ini
register: wayfire_ini
- name: "If so, install from template: /etc/xdg/lxsession/LXDE-pi/sshpwd-lxde-iiab.sh"
- name: "If so, install from template: /usr/local/sbin/iiab-pwdwarn-wayfire"
template:
src: sshpwd-lxde-iiab.sh.j2
dest: /etc/xdg/lxsession/LXDE-pi/sshpwd-lxde-iiab.sh
src: iiab-pwdwarn-wayfire.j2
dest: /usr/local/sbin/iiab-pwdwarn-wayfire
mode: '0755'
when: lx.stat.isdir is defined and lx.stat.isdir # and is_raspbian
when: wayfire_ini.stat.exists
# 2019-03-07: This popup (/etc/xdg/lxsession/LXDE-pi/sshpwd-lxde-iiab.sh) does
# 2019-03-07: This pop-up (/etc/xdg/lxsession/LXDE-pi/sshpwd-lxde-iiab.sh) did
# not actually appear when triggered by /etc/xdg/autostart/pprompt-iiab.desktop
# (or pprompt.desktop as Raspbian has working since 2018-11-13!) Too bad as it
# would be really nice to standardize this popup across Ubermix & all distros..
# would be really nice to standardize pop-ups across Ubermix & all distros...
# Is this a permissions/security issue presumably? Official autostart spec is:
# https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html
# Raspbian's 2016-2018 evolution here: https://github.com/iiab/iiab/issues/1537
- name: ...and put a line in /etc/xdg/lxsession/LXDE-pi/autostart to trigger popups
lineinfile:
path: /etc/xdg/lxsession/LXDE-pi/autostart
line: "@/etc/xdg/lxsession/LXDE-pi/sshpwd-lxde-iiab.sh"
when: lx.stat.isdir is defined and lx.stat.isdir # and is_raspbian
- name: ...and put a line in /home/{{ iiab_admin_user }}/.config/wayfire.ini to trigger pop-ups
ini_file:
path: /home/{{ iiab_admin_user }}/.config/wayfire.ini # iiab-admin
section: autostart
option: iiab-pwdwarn-wayfire
value: /usr/local/sbin/iiab-pwdwarn-wayfire
when: wayfire_ini.stat.exists

View file

@ -99,7 +99,7 @@
- roles/network/templates/gateway/iiab-internet-on # Invoked by 1-prep (so full path needed)
- roles/network/templates/gateway/iiab-internet-off # Invoked by 1-prep (so full path needed)
- name: 'Install /usr/local/sbin/netwarn for pop-ups on boot, if iiab-network should be run'
- name: 'Install /usr/local/sbin/iiab-netwarn for pop-ups on boot, if iiab-network should be run'
include_tasks: roles/network/tasks/netwarn.yml # Invoked by 1-prep (so full path needed)

View file

@ -1,21 +1,22 @@
# 2022-07-22: SIMILAR TO roles/iiab-admin/tasks/pwd-warnings.yml FOR passwords
# AND roles/www_options/tasks/main.yml FOR browser
# 2022-07-22: An /etc/profile.d/ version like /etc/local/sbin/netwarn but for
# ssh sessions (across all OS's/distros/window managers) might also make sense?
# 2022-07-22: An /etc/profile.d/ version like /etc/local/sbin/iiab-netwarn but for
# shell / ssh logins (across all OS's/distros/window managers) might also make sense?
- name: Does /etc/xdg/lxsession/LXDE-pi/autostart exist?
- name: Does /home/{{ iiab_admin_user }}/.config/wayfire.ini exist?
stat:
path: /etc/xdg/lxsession/LXDE-pi/autostart
register: lxde_pi_autostart_present
path: /home/{{ iiab_admin_user }}/.config/wayfire.ini
register: wayfire_ini
- name: If so, add /usr/local/sbin/netwarn to /etc/xdg/lxsession/LXDE-pi/autostart
lineinfile:
path: /etc/xdg/lxsession/LXDE-pi/autostart
regexp: '^/usr/local/sbin/netwarn$'
line: '/usr/local/sbin/netwarn'
when: lxde_pi_autostart_present.stat.exists
- name: If so, add /usr/local/sbin/iiab-netwarn to /home/{{ iiab_admin_user }}/.config/wayfire.ini
ini_file:
path: /home/{{ iiab_admin_user }}/.config/wayfire.ini # iiab-admin
section: autostart
option: iiab-netwarn
value: /usr/local/sbin/iiab-netwarn
when: wayfire_ini.stat.exists
# mate desktop detection based on 'register: nd_dir' in enable_services
@ -39,9 +40,9 @@
# (Let's insert those here if so, and refine the 'when:' line below.)
- name: 'If a supported graphical OS is detected, install from template: /usr/local/sbin/netwarn'
- name: 'If a supported graphical OS is detected, install from template: /usr/local/sbin/iiab-netwarn'
template:
src: roles/network/templates/netwarn/netwarn # Invoked by 1-prep (so full path needed)
src: roles/network/templates/netwarn/iiab-netwarn # Invoked by 1-prep (so full path needed)
dest: /usr/local/sbin/
mode: 0755
when: lxde_pi_autostart_present or (mate_dir.stat.exists and mate_dir.stat.isdir)
when: wayfire_ini.stat.exists or (mate_dir.stat.exists and mate_dir.stat.isdir)

View file

@ -1,8 +1,12 @@
#!/bin/bash
# CONFUSING BUT FYI: Commands below run *strictly sequentially* when this
# script (/usr/local/sbin/netwarn) is invoked by autostart during OS boot.
# This allows return codes to be meaningful, at each successive step.
# CONFUSING BUT FYI: Steps below run *strictly sequentially* when this script
# (/usr/local/sbin/iiab-netwarn) is run on boot, triggered by either autostart:
# https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html
# ...or by Wayland compositor Wayfire's ~/.config/wayfire.ini for RasPiOS 12+:
# https://github.com/WayfireWM/wayfire/wiki/Configuration#autostart
#
# This allows return codes ($rc) to be meaningful, at each successive step.
# (As of July 2022, this is tested to work well with Ubuntu Mate and "Raspberry
# Pi OS with desktop" on Raspberry Pi 4!)
#

View file

@ -4,7 +4,7 @@ Comment[en_US]=iiab-network
Name[en_CA]=iiab-network
Comment[en_CA]=iiab-network
Type=Application
Exec=/usr/local/sbin/netwarn
Exec=/usr/local/sbin/iiab-netwarn
Hidden=false
Name=iiab-network
Comment=iiab-network

View file

@ -31,29 +31,35 @@
# 2022-07-22: SIMILAR TO roles/iiab-admin/tasks/pwd-warnings.yml FOR passwords
# AND roles/network/tasks/netwarn.yml FOR iiab-network
- name: Does /etc/xdg/lxsession/LXDE-pi/autostart exist? (if so, auto-launch browser on boot, displaying http://box/home IIAB home page)
- name: Does /home/{{ iiab_admin_user }}/.config/wayfire.ini exist?
stat:
path: /etc/xdg/lxsession/LXDE-pi/autostart
register: lxde_pi_autostart_present
path: /home/{{ iiab_admin_user }}/.config/wayfire.ini
register: wayfire_ini
- name: Does /usr/bin/chromium exist? (check for browser filename change)
- name: Does /usr/bin/chromium-browser exist?
stat:
path: /usr/bin/chromium
register: chromium_present
path: /usr/bin/chromium-browser
register: chromium_browser
- name: Add chromium-browser to /etc/xdg/lxsession/LXDE-pi/autostart
lineinfile:
path: /etc/xdg/lxsession/LXDE-pi/autostart
regexp: '^/usr/bin/chromium-browser'
line: '/usr/bin/chromium-browser --disable-restore-session-state http://box/home'
when: lxde_pi_autostart_present.stat.exists and not chromium_present.stat.exists
# - name: Does /usr/bin/chromium exist? (check for browser filename change)
# stat:
# path: /usr/bin/chromium
# register: chromium_present
- name: Add chromium to /etc/xdg/lxsession/LXDE-pi/autostart
lineinfile:
path: /etc/xdg/lxsession/LXDE-pi/autostart
regexp: '^/usr/bin/chromium'
line: '/usr/bin/chromium --disable-restore-session-state http://box/home'
when: lxde_pi_autostart_present.stat.exists and chromium_present.stat.exists
- name: If both above exist, add '/usr/bin/chromium-browser --disable-restore-session-state http://box/home' to /home/{{ iiab_admin_user }}/.config/wayfire.ini
ini_file:
path: /home/{{ iiab_admin_user }}/.config/wayfire.ini # iiab-admin
section: autostart
option: chromium-browser
value: '/usr/bin/chromium-browser --disable-restore-session-state http://box/home'
when: wayfire_ini.stat.exists and chromium_browser.stat.exists
# - name: Add chromium to /etc/xdg/lxsession/LXDE-pi/autostart
# lineinfile:
# path: /etc/xdg/lxsession/LXDE-pi/autostart
# regexp: '^/usr/bin/chromium'
# line: '/usr/bin/chromium --disable-restore-session-state http://box/home'
# when: lxde_pi_autostart_present.stat.exists and chromium_present.stat.exists
# 2022-12-29: php-settings.yml is ALSO attempted (on demand) by every