summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-28 23:00:01 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-28 23:00:01 -0500
commit88e66fdabc8c6b5ff049d99514a74fadec2b0e51 (patch)
treeebcbf15e9ca77f674567285f15c69cb55200dff8
parentee43db00345e9d905597710dd6087db9e8279974 (diff)
downloadhorizon-88e66fdabc8c6b5ff049d99514a74fadec2b0e51.tar.gz
horizon-88e66fdabc8c6b5ff049d99514a74fadec2b0e51.tar.bz2
horizon-88e66fdabc8c6b5ff049d99514a74fadec2b0e51.tar.xz
horizon-88e66fdabc8c6b5ff049d99514a74fadec2b0e51.zip
Qt UI: Add helper to manipulate Xauthority files
This allows us to run software after the hostname changes in the Installation Environment and live desktops. Closes: #372
-rw-r--r--ui/qt5/CMakeLists.txt4
-rw-r--r--ui/qt5/horizon-xauth-helper2
-rw-r--r--ui/qt5/horizon-xauth-helper.133
-rw-r--r--ui/qt5/horizonwizard.cc7
4 files changed, 43 insertions, 3 deletions
diff --git a/ui/qt5/CMakeLists.txt b/ui/qt5/CMakeLists.txt
index e94e5b9..449e9bc 100644
--- a/ui/qt5/CMakeLists.txt
+++ b/ui/qt5/CMakeLists.txt
@@ -93,6 +93,6 @@ IF(INSTALL)
ENDIF()
install(TARGETS horizon-run-qt5 DESTINATION bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/horizon-run-qt5.8 DESTINATION share/man/man8)
- install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect DESTINATION bin)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect.1 DESTINATION share/man/man1)
+ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect ${CMAKE_CURRENT_SOURCE_DIR}/horizon-xauth-helper DESTINATION bin)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/horizon-ppc64-detect.1 ${CMAKE_CURRENT_SOURCE_DIR}/horizon-xauth-helper.1 DESTINATION share/man/man1)
ENDIF(INSTALL)
diff --git a/ui/qt5/horizon-xauth-helper b/ui/qt5/horizon-xauth-helper
new file mode 100644
index 0000000..c27050f
--- /dev/null
+++ b/ui/qt5/horizon-xauth-helper
@@ -0,0 +1,2 @@
+#!/bin/sh
+xauth -f $HOME/.Xauthority add "$1/unix:0" . $(xauth list ":0" | awk '{print $NF}')
diff --git a/ui/qt5/horizon-xauth-helper.1 b/ui/qt5/horizon-xauth-helper.1
new file mode 100644
index 0000000..17a5f2f
--- /dev/null
+++ b/ui/qt5/horizon-xauth-helper.1
@@ -0,0 +1,33 @@
+.Dd October 28, 2023
+.Dt HORIZON-XAUTH-HELPER 1
+.Os "Adélie Linux"
+.Sh NAME
+.Nm horizon-xauth-helper
+.Nd add new hostname to Xauthority file
+.Sh SYNOPSIS
+.Nm
+.Ar hostname
+.Sh DESCRIPTION
+The
+.Nm
+utility ensures that X11 allows new clients to connect from the hostname
+of the target system. This ensures that X11 software can be started
+after the
+.Cm hostname
+key is run in the Installation Environment.
+.Sh FILES
+.Bl -tag -width Ds
+.It Pa $HOME/.Xauthority
+The
+.Nm
+utility adds the new hostname to the current user's Xauthority file.
+.Sh HISTORY
+The
+.Nm
+command first appeared in Horizon 0.9.8.
+.Sh SEE ALSO
+.Xr Xsecurity 7 ,
+.Xr xauth 1 .
+.Sh AUTHORS
+.An A. Wilcox
+.Aq awilfox@adelielinux.org
diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc
index 0dfd43e..5096db9 100644
--- a/ui/qt5/horizonwizard.cc
+++ b/ui/qt5/horizonwizard.cc
@@ -546,7 +546,12 @@ QString HorizonWizard::toHScript() {
lines << "network false";
}
- lines << ("hostname " + field("hostname").toString());
+ const auto hostname = field("hostname").toString();
+ lines << ("hostname " + hostname);
+#ifdef HAS_INSTALL_ENV
+ QProcess p;
+ p.execute("horizon-xauth-helper", {hostname});
+#endif
switch(arch) {
case aarch64: