Re: [qubes-users] How to assign keyboard shortcuts to a VM?

2021-08-11 Thread Sven Semmler

Just to riff on this ...

I made a bash script called qvm-run-in-focused-vm that accepts one command as 
parameter and then uses the structure @unman showed to run that command either 
in dom0 or the VM that has the focus.

Then I hooked up the following XFCE shortcuts:

Ctrl+Enter  --> qvm-run-in-focused-vm xterm
Ctrl+Shift+Enter--> qvm-run-in-focused-vm nautilus
Ctrl+Shift+W--> qvm-run-in-focused-vm "sudo poweroff"

So much goodness! ;-)

--
 public key: https://www.svensemmler.org/2A632C537D744BC7.asc
fingerprint: DA59 75C9 ABC4 0C83 3B2F 620B 2A63 2C53 7D74 4BC7

--
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/65b7dc2d-7b15-971f-06da-86eea6801ea3%40SvenSemmler.org.


OpenPGP_signature
Description: OpenPGP digital signature


Re: [qubes-users] How to assign keyboard shortcuts to a VM?

2021-06-23 Thread unman
On Tue, Jun 22, 2021 at 07:15:22PM -0500, Sven Semmler wrote:
> Hi Michael,
> 
> I don't have the time currently to figure this out and send you a working
> solution. So instead I'll share things I know:
> 
> 1) if you inquire the window property "_QUBES_VMNAME" of the active window,
> you'll get the name of the qube
> 
> 2) you should be able to get to this with wmctrl or maybe xdotool
> 
> Then write a little bash script in dom0 and hook it up to a shortcut, is
> what I think.
> 
> Good luck!
> 
> /Sven

Here's a script that does exactly this.
Edit it to do something with $QUBE.
Associate it with a shortcut.

```
#!/bin/bash
ID=`xdotool getwindowfocus`
QUBE=`xprop _QUBES_VMNAME -id $ID|cut -f2 -d\" `
if [[ "$QUBE" == "_QUBES_VMNAME:  not found." ]]; then
  exit
else
# Do something with $QUBE
fi
```

The if clause is to exclude dom0 windows, but you could adapt that if
you *do* want action in dom0.

unman

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/20210623101854.GA27860%40thirdeyesecurity.org.


Re: [qubes-users] How to assign keyboard shortcuts to a VM?

2021-06-22 Thread Sven Semmler

Hi Michael,

I don't have the time currently to figure this out and send you a 
working solution. So instead I'll share things I know:


1) if you inquire the window property "_QUBES_VMNAME" of the active 
window, you'll get the name of the qube


2) you should be able to get to this with wmctrl or maybe xdotool

Then write a little bash script in dom0 and hook it up to a shortcut, is 
what I think.


Good luck!

/Sven


--
 public key: https://www.svensemmler.org/2A632C537D744BC7.asc
fingerprint: DA59 75C9 ABC4 0C83 3B2F 620B 2A63 2C53 7D74 4BC7

--
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/c1670d6c-93be-67c6-f8ba-64e0c61835a4%40SvenSemmler.org.


OpenPGP_signature
Description: OpenPGP digital signature


[qubes-users] How to assign keyboard shortcuts to a VM?

2021-06-21 Thread Michael Singer
Dear Qubes community,

I am looking for a way to execute a command with a keyboard shortcut. For 
example, the command "screenshot" should start the screenshot program within 
the respective VM or the command "nautilus" should pop up a file browser window 
of the VM that is currently being worked with.

If I set up a keyboard combination for this in dom0 in the xfce keyboard 
settings, then I would have to set a different keyboard combination for each 
Qube:

Ctrl+Alt+1 for Qube1: qvm-run Qube1 nautilus
Ctrl+Alt+2 for Qube2 qvm-run Qube2 nautilus

So, how can I do the same thing at the qube level instead of in dom0?

You can install the autokey program, but it requires me to write a python 
script, and I don't know how to express a simple shell command in python.

All the best
Michael Singer

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/67cc8511-0717-10b0-8c66-44de68261cbe%40posteo.de.