Per-workspace Application Instances

Hi all, I started using xmonad last week, and encountered very few problems during configuration and use. It's nearly perfect for how I work. But I've run into a bothersome issue. There are times when I need to have dozens of PDFs readily available. Since I started using xmonad, I switched to qpdfview for its tabbed interface. Whenever I open a PDF from a file manager (xfe), qpdfview is called with the --unique option, so that all new windows open as tabs in the main window. The problem is that, if I want to then open a PDF on a different workspace, I either need to create a new instance of qpdfview, or use a different PDF viewer. A minor inconvenience, to be sure. But then I realized that qpdfview has a --instance <name> option, which I imagine could be used with xmonad's workspace identifiers. So, any instance started in workspace 3 would be named 'd3', and qpdfview would be called with '--unique --instance d3'. The problem is, I don't know where to start with this. My idea was to use environment variables to identify the current workspace, but I'm not sure how to. Any suggestions/ideas are greatly appreciated! Regards, Chris

On Mon, Aug 25, 2014 at 1:11 PM, Chris Bell
The problem is, I don't know where to start with this. My idea was to use environment variables to identify the current workspace, but I'm not sure how to. Any suggestions/ideas are greatly appreciated!
Add EwmhDesktops to your config and use wmctrl or xprop -root to get the current desktop. Both will require processing the output: "wmctrl -d" indicates the current desktop with an asterisk and "xprop -root -notype _NET_CURRENT_DESKTOP" includes the property name. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Mon, Aug 25, 2014 at 1:11 PM, Chris Bell
The problem is, I don't know where to start with this. My idea was to use environment variables to identify the current workspace, but I'm not sure how to.
Also note that environment variables will not work if you expect to see them in e.g. shells; they're inherited at process creation time and cannot be updated by other processes afterward. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Mon, Aug 25, 2014 at 1:22 PM, Brandon Allbery
Also note that environment variables will not work if you expect to see them in e.g. shells; they're inherited at process creation time and cannot be updated by other processes afterward.
I know, but i figured it was better than the current situation. I'd
just have to remember the limitation.
On Mon, Aug 25, 2014 at 1:20 PM, Brandon Allbery
Add EwmhDesktops to your config and use wmctrl or xprop -root to get the current desktop. Both will require processing the output: "wmctrl -d" indicates the current desktop with an asterisk and "xprop -root -notype _NET_CURRENT_DESKTOP" includes the property name.
This is an awesome solution. Thank you so very, very much. I ended up using `wmctrl -d | egrep \* | cut -b 1` to get the workspace index, and created a shell script to munge everything together. Result: each workspace works with its own qpdfview instance. Thanks again! Chris
participants (2)
-
Brandon Allbery
-
Chris Bell