Last active
June 16, 2019 09:30
-
-
Save jpouellet/bbf51888aee69a266f200f37963b8b87 to your computer and use it in GitHub Desktop.
Qubes OS: Opens a file manager in the focused VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
sub open_file_manager { | |
my $vm = shift; | |
exec {'qvm-run'} ('qvm-run', '--', $vm, 'exec nautilus --new-window --no-desktop </dev/null >/dev/null') or die "qvm-run exec failed\n"; | |
} | |
if (defined $ARGV[0]) { | |
open_file_manager $ARGV[0]; | |
} | |
$_ = `xprop -notype -root _NET_ACTIVE_WINDOW`; | |
/^_NET_ACTIVE_WINDOW: window id # (?<id>0x[0-9a-f]+), 0x0$/m or die "unable to get active window\n"; | |
$_ = `xprop -id "$+{id}" -notype _QUBES_VMNAME`; | |
if (/^_QUBES_VMNAME = \"(?<vm>[^\"]+)\"$/m) { | |
length $+{vm} or die "empty string VM is invalid\n"; | |
open_file_manager $+{vm}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on qvm-terminal: https://gist.github.com/jpouellet/0f74459699433cabc26c389caf36b455