You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
1.0 KiB

  1. #!/bin/sh
  2. # VPN
  3. NMCONN="49088a1e-18c2-48aa-a664-f212eb83a727"
  4. # RDP
  5. DEF_RESOLUTION="1920x1080"
  6. DRIVE="work,${HOME}/Documents/Work"
  7. DOMAIN="$(pass show Work/AD-LOGIN | awk '/domain:/ {print $2}')"
  8. USER="$(pass show Work/AD-LOGIN | awk '/user:/ {print $2}')"
  9. REMOTE="$(pass show Work/AD-LOGIN | awk '/remote:/ {print $2}')"
  10. rdp() {
  11. # alternative to "dynamic-resolution" is "smart-sizing"
  12. xfreerdp /network:lan /gdi:hw +glyph-cache +fonts +aero \
  13. /bpp:32 /size:${DEF_RESOLUTION} /dynamic-resolution \
  14. /audio-mode:0 /sound:sys:pulse /microphone:sys:pulse \
  15. /kbd:German /drive:${DRIVE} \
  16. +auto-reconnect /auto-reconnect-max-retries:5 \
  17. /d:${DOMAIN} /u:${USER} /v:${REMOTE} /p:$(zenity --entry \
  18. --title="Password" --text="Enter your _password:" --hide-text)
  19. zenity --question --title="Disconnect?" \
  20. --text="RDP connection closed. Do you want to close the VPN connection too?" && \
  21. nmcli con down ${NMCONN}
  22. }
  23. if [ $(nmcli con show ${NMCONN} | awk '/GENERAL.STATE/ {print $2}') == "activated" ]; then
  24. rdp
  25. else
  26. nmcli --ask con up ${NMCONN} &
  27. rdp
  28. fi