Skip to content

Instantly share code, notes, and snippets.

@100111001
Created June 16, 2019 09:31
Show Gist options
  • Save 100111001/92df1b3d3789ea71bd15a5d1b34d2a6a to your computer and use it in GitHub Desktop.
Save 100111001/92df1b3d3789ea71bd15a5d1b34d2a6a to your computer and use it in GitHub Desktop.
Bash version of the qvm-filemanager.pl
#!/bin/sh
set -e
front=$(xprop -notype -root _NET_ACTIVE_WINDOW | awk '{if (match($0,"^_NET_ACTIVE_WINDOW: window id # (0x[0-9a-f]*), 0x0$",m)){print m[1];} exit 0;}' )
test -n "$front"
vm=$(xprop -id "$front" -notype _QUBES_VMNAME | awk '{if (match($0,"^_QUBES_VMNAME = \"([^\"]*)\"$",m)){print m[1];} exit 0;}')
if [ -n "$vm" ]; then
exec qvm-run -- "$vm" 'sh -c "[ -f /usr/bin/nemo ] && exec /usr/bin/nemo || [ -f /usr/bin/nautilus ] && exec /usr/bin/nautilus --new-window --no-default-window || [ -f /usr/bin/dolphin ] && exec /usr/bin/dolphin"'
else
exec /usr/bin/thunar
fi
@100111001
Copy link
Author

Considers not installed file managers in templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment