Hi Albert,
On Wed, Jul 05, 2017 at 05:56:36AM -0700, Albert Mokrejs wrote:
> I quite like your script, it seems very compact. My plan for later versions
> of this wrapper was also to avoid relying on dmenu_path on the target VMs,
> but I wanted to get the basic functionality down first. I might honestly
> end up using your script for that since it's a lot cleaner than something
> I'd probably end up writing.
Thanks! Feel free to use it and give attribute if you like to.
I attached a new version with a bugfix.
> However, one behavior from dmenu_path that I think would be worth saving
> would be caching, since there will be lots of instances where none of the
> $PATH folders will have changed between uses. I'm still working on ironing
> out the kinks for this, but I hope to publish the next version by the end
> of the week. The main idea is to find the most recent update time in the
> $PATH folders (Effectively the most recent time when the program list has
> changed somehow) and compare it to the cache file's.
On the top of my head, maybe an APT hook similar to how the application
menu files are updated would do the trick? A simple script that is run
after packages are installed/removed and writes the current bin entries
to local file.
This script could also be run manually (with qvm-run) or by cron.
For AppVMs, the list of directories could be restricted to /usr/local.
This way you could merge the cache file from its TemplateVM with the
local cache file any time you need a complete list of binaries available
on the AppVM.
However, I wonder if any cache scheme can be faster than just checking
the current PATH and list directory contents, and still be simple
enough to use in arbitrary pipes. Classic tradeoff :-)
A single run of 'stat -c %Y /usr/local/bin' via qvm-run took 0.21s...
But maybe you have a faster solution in mind?
> Also,
>
> > This list can then be piped to dmenu or rofi or whatever,
> > *running in dom0 or any other VM. *
>
> Have you somehow gotten dmenu/rofi working within a non-dom0 VM? That was
> my first attempt before I wrote the qvm-run based script, and I found that
> Qubes would not let dmenu bind the keyboard, thus leaving dmenu stuck open
> and unresponsive. If you got it working, I'm somewhat curious as to how.
Sadly I have the same experience as you.
However, if I have another window open from a program already running on
the target VM it seems to hand over the keyboard to dmenu upon receiving
focus.
I haven't verified if this is a side effect of i3wm, qvm-run, qrexec or
possibly all of them combined. Have you made any tests in other WMs like
XFCE? I know that i3wm has some configurable logic for deciding if/when
window clients should be granted focus...