From 89181d8089514a87c2bac39ab9c8662bb27c7851 Mon Sep 17 00:00:00 2001 From: Leopold Talirz Date: Thu, 12 Oct 2023 21:37:42 +0200 Subject: [PATCH] fix vmd app (#1736) Co-authored-by: Leopold Talirz --- .../files/bc_vmd/template/script.sh.erb | 16 +------ .../files/bc_vmd/template/xfce.sh | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 playbooks/roles/ood-applications/files/bc_vmd/template/xfce.sh diff --git a/playbooks/roles/ood-applications/files/bc_vmd/template/script.sh.erb b/playbooks/roles/ood-applications/files/bc_vmd/template/script.sh.erb index 10b0526df..0860d32da 100644 --- a/playbooks/roles/ood-applications/files/bc_vmd/template/script.sh.erb +++ b/playbooks/roles/ood-applications/files/bc_vmd/template/script.sh.erb @@ -11,18 +11,7 @@ cd "${HOME}" # # Launch Xfce Window Manager and Panel # - -( - module restore - export XDG_CONFIG_HOME="<%= session.staged_root.join("config") %>" - export XDG_DATA_HOME="<%= session.staged_root.join("share") %>" - export XDG_CACHE_HOME="$(mktemp -d)" - xfwm4 --compositor=off --daemon --sm-client-disable - xsetroot -solid "#D3D3D3" - xfsettingsd --sm-client-disable - export XFCE_PANEL_MIGRATE_DEFAULT=yes - xfce4-panel --sm-client-disable -) & +source "<%= session.staged_root.join("xfce.sh") %>" # # Start VMD @@ -30,10 +19,9 @@ cd "${HOME}" VMD_HOME_DIR="<%= context.vmd_home %>" -<%- if gpu -%> set -x +<%- if gpu -%> xfce4-terminal -e "vglrun $VMD_HOME_DIR/bin/vmd" -T "VMD Terminal" --disable-server <%- else -%> -set -x xfce4-terminal -e "$VMD_HOME_DIR/bin/vmd" -T "VMD Terminal" --disable-server <%- end -%> diff --git a/playbooks/roles/ood-applications/files/bc_vmd/template/xfce.sh b/playbooks/roles/ood-applications/files/bc_vmd/template/xfce.sh new file mode 100644 index 000000000..3dec1dd7c --- /dev/null +++ b/playbooks/roles/ood-applications/files/bc_vmd/template/xfce.sh @@ -0,0 +1,44 @@ +# Remove any preconfigured monitors +if [[ -f "${HOME}/.config/monitors.xml" ]]; then + mv "${HOME}/.config/monitors.xml" "${HOME}/.config/monitors.xml.bak" +fi + +# Copy over default panel if doesn't exist, otherwise it will prompt the user +PANEL_CONFIG="${HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml" +if [[ ! -e "${PANEL_CONFIG}" ]]; then + mkdir -p "$(dirname "${PANEL_CONFIG}")" + cp "/etc/xdg/xfce4/panel/default.xml" "${PANEL_CONFIG}" +fi + +# Disable startup services +xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false +xfconf-query -c xfce4-session -p /startup/gpg-agent/enabled -n -t bool -s false + +# Disable useless services on autostart +AUTOSTART="${HOME}/.config/autostart" +rm -fr "${AUTOSTART}" # clean up previous autostarts +mkdir -p "${AUTOSTART}" +for service in "pulseaudio" "rhsm-icon" "spice-vdagent" "tracker-extract" "tracker-miner-apps" "tracker-miner-user-guides" "xfce4-power-manager" "xfce-polkit"; do + echo -e "[Desktop Entry]\nHidden=true" > "${AUTOSTART}/${service}.desktop" +done + +# Run Xfce4 Terminal as login shell (sets proper TERM) +TERM_CONFIG="${HOME}/.config/xfce4/terminal/terminalrc" +if [[ ! -e "${TERM_CONFIG}" ]]; then + mkdir -p "$(dirname "${TERM_CONFIG}")" + sed 's/^ \{4\}//' > "${TERM_CONFIG}" << EOL + [Configuration] + CommandLoginShell=TRUE +EOL +else + sed -i \ + '/^CommandLoginShell=/{h;s/=.*/=TRUE/};${x;/^$/{s//CommandLoginShell=TRUE/;H};x}' \ + "${TERM_CONFIG}" +fi + +# launch dbus first through eval becuase it can conflict with a conda environment +# see https://github.com/OSC/ondemand/issues/700 +eval $(dbus-launch --sh-syntax) + +# Start up xfce desktop (block until user logs out of desktop) +xfce4-session & \ No newline at end of file