Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Open a folder

by marto (Cardinal)
on Mar 21, 2013 at 12:14 UTC ( [id://1024732]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Open a folder
in thread Open a folder

So if you were using MS Windows I'd advise you to use something like start $directory, where $directory is the path you wish to open. Now depending on your window manager the equivalent method could be many things, for example for xfce xdg-open $directory, gnome-open $directory, kde-open $directory and so on. So you're going to have to figure out the details of the end user platform (unless this is for a specific target that you know about), and cater for each accordingly.

Update: you may want to play around with the following basic example:

#!/usr/bin/perl use strict; use warnings; my $wm = $ENV{'XDG_CURRENT_DESKTOP'}; print "Window Manager: $wm"; # later on, call specific system command for the running window manage +r

Replies are listed 'Best First'.
Re^4: Open a folder
by jethro (Monsignor) on Mar 21, 2013 at 12:29 UTC

    I'm using kde on opensuse and xdg-open works even in kde. So it might just suffice to check for availability of any of the mentioned programs and call it irrespective of the window manager actually running. It would probably be a 99% solution

      Thanks for the info. I guess it depends on the system in question, perhaps they're lucky and only have to target a specific setup. Failing that I updated my reply with an example of pulling the running window manager from the environment variable, then it's simply a case of catering for each valid response.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1024732]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-25 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found