You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I followed some instruction and suggestion and here is the script I am using. I am almost there except the RDP session doesn't seem to respond to WIN-XXX keyboard shortcuts.
To Reproduce
#!/bin/bash
# Script to backup and restore RDP configuration for i3 window manager
# Variables
BACKUP_DIR="/etc/xrdp/backup_startwm"
STARTWM_SH="/etc/xrdp/startwm.sh"
XSSESSION="$HOME/.xsession"
# Function to backup original startwm.sh
backup() {
echo "Backing up original startwm.sh to $BACKUP_DIR/startwm.sh.bak"
sudo mkdir -p "$BACKUP_DIR"
sudo cp "$STARTWM_SH" "$BACKUP_DIR/startwm.sh.bak"
echo "Backup completed."
}
# Function to apply changes to startwm.sh
apply_changes() {
echo "Creating ~/.xsession with 'i3'"
echo "regolith-session" > "$XSSESSION"
chmod +x "$XSSESSION"
echo "Modifying $STARTWM_SH to enable i3 over RDP"
sudo cp "$STARTWM_SH" "$BACKUP_DIR/startwm.sh.bak2"
# Define the original lines to replace
ORIGINAL_LINE1="test -x /etc/X11/Xsession && exec /etc/X11/Xsession"
ORIGINAL_LINE2="exec /bin/sh /etc/X11/Xsession"
# Read the last two lines of startwm.sh
LAST_TWO_LINES=$(sudo tail -n 2 "$STARTWM_SH")
# Check if the last two lines match the original lines
if [ "$LAST_TWO_LINES" == "$ORIGINAL_LINE1
$ORIGINAL_LINE2" ]; then
echo "Original lines match. Proceeding with replacement."
# Remove the last two lines
sudo sed -i '$d' "$STARTWM_SH" # Delete last line
sudo sed -i '$d' "$STARTWM_SH" # Delete second last line
# Append the new configuration
sudo bash -c "cat >> $STARTWM_SH <<EOF
if [ -r ~/.xsession ]; then
exec /bin/bash --login ~/.xsession
elif command -v regolith-session >/dev/null 2>&1; then
exec regolith-session
else
exec /etc/X11/Xsession
fi
EOF"
echo "Changes applied successfully."
else
echo "The last two lines of $STARTWM_SH do not match the expected original lines."
echo "Aborting modification to prevent accidental deletion."
fi
}
# Function to restore original startwm.sh
restore() {
if [ -f "$BACKUP_DIR/startwm.sh.bak" ]; then
echo "Restoring original startwm.sh from backup"
sudo cp "$BACKUP_DIR/startwm.sh.bak" "$STARTWM_SH"
echo "Restoration completed."
else
echo "Backup file not found. Cannot restore."
fi
}
# Check for arguments
if [ "$#" -ne 1 ]; then
echo "Usage: $0 {backup|apply|restore}"
exit 1
fi
case "$1" in
backup)
backup
;;
apply)
backup
apply_changes
;;
restore)
restore
;;
*)
echo "Invalid option: $1"
echo "Usage: $0 {backup|apply|restore}"
exit 1
;;
esac
The text was updated successfully, but these errors were encountered:
Describe the bug
I followed some instruction and suggestion and here is the script I am using. I am almost there except the RDP session doesn't seem to respond to WIN-XXX keyboard shortcuts.
To Reproduce
The text was updated successfully, but these errors were encountered: