How to get default command to open a terminal window? (Bash or Python)

Desktop entry files (.desktop files) may indicate that an application requires a terminal window to run ("Terminal=true"), e.g. vim & maxima.
How does a .desktop launcher determine which terminal to use? E.g. when opening a file associated with vim, what points it to 'urxvtc -e %s' or 'gnome-terminal...' or whatever?
Is there a standard environment variable with the terminal command? $TERM only contains an identifying name but I don't see how to programmatically deduce the command from it. Grepping through the output of "set" doesn't show me anything useful either.
My search-fu has failed me. Does anyone have any ideas?
EDIT: Clarified subject and post.
Last edited by Xyne (2011-02-02 14:00:14)

Maybe my search-fu can be of help here:
For KDE:
terminal=$(kreadconfig --file kdeglobals --group General \
--key TerminalApplication --default konsole)
For GNOME:
TERM_EXEC_KEY="/desktop/gnome/applications/terminal/exec"
TERM_EXEC_ARG_KEY="/desktop/gnome/applications/termina/exec_arg"
TERM_EXEC=$( gconftool-2 --get ${TERM_EXEC_KEY}) # e.g.
"gnome-terminal"
TERM_EXEC_ARG=$( gconftool-2 --get ${TERM_EXEC_ARG_KEY} ) # e.g. "-x"
terminal="$TERM_EXEC $TERM_EXEC_ARG"
For XFCE:
Xfce has a directory called "share/xfce4/helpers/" which contains desktop entry files for commonly used terminals, browsers and email apps. These entries contain extra keys like X-XFCE-Category=WebBrowser or X-XFCE-Category=TerminalEmulator .
Then there is a file called ".config/xfce4/helpers.rc" which in my case looks like:
WebBrowser=firefox
MailReader=thunderbird
From: http://www.mail-archive.com/[email protected] … 01661.html
edit: there is also xdg-settings (in xdg-utils) which can store default-app information, but i'm not sure if all DE's make use of this..
Last edited by litemotiv (2011-02-02 14:08:27)

Similar Messages

  • How to get PDF files to open in 1 window, rather than a new window each time

    When opening several PDF files, I find they open up in a new window. Previosuly they opened within the same window.
    I am using Adobe Reader 9

    Thank you for your comments.
    Truthfully, I am shocked that this is the case and even more so that people didn't put up such a stink that Apple had to reinstate the old option. If I had to pick only one, which doesn't seem reasonable at all, I would choose the separate windows of old as opposed to the tabs.
    Thanks again for your help; I was really hoping that I wouldn't be disappointed.

  • History window opens by default when i open a new window or restart firefox. How can i get rid of that ? its annoying.

    History window opens by default when i open a new window or restart firefox. How can i get rid of that ? its annoying

    If the History sidebar is closed when you close Firefox and doesn't stay closed on the next start then that can be problem with the file localstore.rdf in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder]
    Delete localstore.rdf or rename the file to localstore.rdf.sav in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder] to test if the file is corrupted.<br />
    See http://kb.mozillazine.org/Corrupt_localstore.rdf<br />
    (caution: do not delete the localstore.rdf file in the Firefox program installation folder)
    Note:<br />
    Deleting the file [http://kb.mozillazine.org/localstore.rdf localstore.rdf] will reset the customizations of the toolbars to the defaults.<br />
    You can rename "localstore.rdf" to "localstore.rdf.sav" to test if that solves it.<br />
    Then you can restore the customization by copying "localstore.rdf.sav" to "localstore.rdf" if it didn't work.<br />

  • How to get default values while using the transaction "BP"

    Hi Group,
    I have a query on how to get default values while using the transaction <b>BP</b>?
    The thing is:
    when I enter into the transaction "BP", I need to see some default values to some of the input fields in the screen.
    how can I achieve this?
    So please kindly let me know the procedure to achieve this.
    Thanks & Regards,
    Vishnu.

    Hi,
    The events of BDT can be used to default some fields on creating a partner.
    For this create a function module for ISDAT. attach that event in BUS7.
    In the ISDAT funtion modulethe following code should be used.
    For example to set the nationality:
    I_BUSDEFAULT-NATIO = 'DE.
    CALL FUNCTION 'BUP_BUPA_FIELDVALUES_SET'
    EXPORTING
    i_busdefault = I_BUSDEFAULT
    Regards, Smita.

  • I have recently had to fire my web designer who was using iWeb.  Now I'm trying to figure out how to get the site to open in iWeb on my new MacBook Pro.  Is there a way?

    I have recently had to fire my web designer who was using iWeb.  Now I'm trying to figure out how to get the site to open in iWeb on my new MacBook Pro.  Is there a way?

    Firstly iWeb CAN'T IMPORT any kind of published html code as it has no import facility.  You can however add html code, javascript and css by selecting the html snippet and placing it on your page the entering the code in here and clicking on Apply.  You DO NOT create a shape as you say - you use the html snippet and place your code in there.
    There are not really a lot of ways in which you can write code - if you want to enter small amounts of code, then you would use an ordinary text editor to do this such as Text Edit on a Mac or Text Wrangler.  If you want to add code to iWeb like this, then you would either use the html snippet method in iWeb itself or you would have to publish the site to a local folder from iWeb and open the relevant html page with a text editor and add the additional code in this way and then publish.  However, if he decided to add the code with a text editor, then you would have to upload the pages directly to the server using an ftp client - if you try to upload the site directly from iWeb, all the extra code will be overwritten.
    As for checking whether the site was created using iWeb, all you need do is view the site in Safari and then click on View and then select View Source Code and it will tell you.
    Even thoough extra code was added to the site and he might well have done this by publishing to a local folder and adding the code with a text editor, he should still have the domain file for the site too.
    Ask again.  I'm sure that for adding quick code, most would not want to use programmes such as Dreamweaver, but a simple text editor will suffice.  As OT already said, if he claims that he does not have the domain.sites file, then try Flux 4 which is a web design programme and has full import facilities.  At least this way, if he just gives you the published version of the site, you have some way of opening it.
    You can download a free trial of Flux 4 and you can also purchase the full version from the Mac App Store if you decide you like it.

  • How to open a terminal window in a path currently visible in the Finder?

    I often need to open a terminal window with the current visible folder (a long, deep path) as the working directory.
    In Windows I used to have the little "Open command window here..." hack available in the context menu in Explorer.
    How can I achieve the same on OS X to avoid tediously typing the path?

    open a finder window and navigate to one-level above
    this visible folder.
    open a terminal window.
    drag the folder of interest from the finder window
    into the terminal window. now you see the whole path
    to that folder has been typed out for you....
    so, if you wanted to 'cd' into that folder in
    terminal, you'd type cd, then a space, into the
    terminal window, then drag that folder in there from
    the finder, then hit return.... viola!
    If the folder you want is already open, you can drag the icon at the top of the Finder window. You don't have to go one level up.

  • How to get the current logged in username from windows and put it into an AS var

    Hello,
    I was hopeing someone would know how to get the current logged in username from windows and put it into a var, so I can create a dynamic text box to display it.
    Thanks in advance
    Michael

    Just for everyone’s info, this is the script I have used to get the logged in windows username into flash ---- not and air app.
    In the html page that publishes with the .swf file under the <head> section:-
    <script language="JavaScript" type="text/javascript">
    function findUserName() {
         var wshell=new ActiveXObject ("wscript.shell");
         var username=wshell.ExpandEnvironmentStrings("%username%");
         return username;
    </script>
    The ActionScript:-
    import flash.external.ExternalInterface;
    var username:String = ExternalInterface.call ("findUserName");
    trace (username); // a quick test to see it in output

  • I can not get my itunes to open on my windows 7 pc

    I can not get my itunes to open on my windows 7 pc

    Is there any kind of error message?

  • Opening a Terminal window in AppleScript

    Hello, I am having dificulties getting a terminal window to open from an AppleScript. I recently upgraded from OS X SnowLeopard to Lion. Under SnowLeopard the following AppleScript would activate Terminal and open a Terminal window:
    tell application "Terminal"
           activate
    end tell
    However, now that I am using Lion, when I run the above script Terminal will activate but a Terminal window does not open. Does anybody know how to modify this script so that Terminal activates and a Terminal window opens? Thanks George

    Hello, I figured out the answer. I just needed to tell the applescript to open a new window using the system events command. Here is the revised script:
    tell application "Terminal"
           activate
          tell application "System Events" to keystroke "n" using {command down}
    end tell
    Thanks, George

  • Keyboard shortcuts: adding service to open a Terminal window not being saved

    Hi
    Objective: A shortcut to open a terminal window with the path of the 'in-focus' Finder window (Mavericks).
    Solution (that doesn't work): Apple Menu/System Preferences/Keyboard
    Select: Shortcuts
    Select: Services
    Check box for: New Terminal At Folder
    Close System Preferences
    This approach seems to be advised on quite a few sites. When I do it, the service I add simply doesn't get saved. I go back into the System Preferences and look under the path above and see that the box for New Terminal Åt Folder is unchecked.
    Any help in being able to achieve my objective would be greatly appreciated :-)

    Those things are saved as part of the workspace. It sounds as if the current workspace file has become corrupt. Close ID, then go to your user profile and you'll find the workspaces folder under \Application Data\Adobe\InDesign\Version 6.0\<language>\Workspaces. Delete the "current" xml file for the workspace and restart ID. The workspace will be restored to the conditions set when it was saved, but hopefully will remember changes again when you close the program.

  • Can/Could/Why-Can't-We Open a Terminal Window from Finder...

    I do a lot of development needing a terminal window but also need to bounce about a lot between file system areas (my machine, our NFS drives in our fleet, etc.).
    It'd be nice if we could open a terminal window from Finder. I.e., If I'm in Finder and see that I need to work in the terminal window (be it with IDL*, NCL, gcc, etc) I can do a quick GUI click or keykick or whatever, and be happily dropped into a terminal window in that directory. The alternative for me now is to open Terminal from my doc and dig through the file system to my destination.
    Can I do that in Finder? I seem to remember in a past life with (ahem) an certain other "operating system" that just released their "apology" edition, that you could do this from their File Exploder. If not, gee, wouldn't that be nice to add, kids?
    Bill

    Thanks for the help on this!
    The Matt's macoshints solution (the first comment by Greg Spence, below) was simple enough and met my requirements very nicely, thanks much. (the script is below)
    tell application "Finder"
    set myWin to window 1
    set theWin to (quoted form of POSIX path of (target of myWin as alias))
    tell application "Terminal"
    activate
    tell window 1
    do script "cd " & theWin & ";ls -al | more"
    end tell
    end tell
    end tell
    It worked on the local mac, my unix nsf drives, and the samba drives to which I am connected.
    I also tried the cd-to script but as I use tcsh it was not working for me. Other potential users have apparently cited the problem as well (nice simple icon graphic for the finderbar though).

  • Auto updated firefox on OS X but missing "open in 32-bit mode" check box in get info. How do I default firefox to open in 32-bit mode?

    Auto updated firefox on OS X but missing "open in 32-bit mode" check box in firefox 'get info'. How do I change firefox to open in 32-bit mode without the checkbox available?

    After long phone call with apple support the thing that seemed to work was:
    make a new user.
    Copying the itunes app from the new user’s Application folder to the shared folder.
    Then open up your old user account and copy it over the old itunes app.
    hope it works for you too

  • How to get highest number of open cursors within the current calendar day

    Hi all ,
    i need to know how to get the highest number of open cursors within the current calendar day.
    Thanks ,

    823030 wrote:
    the issue is my customer is getting the error ORA-01000: maximum open cursors exceeded and we need an sql statment that gets the following values :
    -highest number of open cursors experienced in the current calendar day.
    -current open cursors
    -and maximum open cursorsThis error is rare. It happens when
    a) the value of the open cursor parameter is set extremly low (default is something like 1000). Low would be something like 10.
    b) <strike>you have many concurrent users(=sessions) and </strike>the application does not use bind values
    In this case each select will open a new cursor, instead of reusing it.
    c) you have a select that opens a cursor for each line. This can happen with a statement where you have the CURSOR keyword somewhere in the select or where clause. Those cursors will be closed when the select is finished. But during the run time of the select, all cursors stay open.
    To track the number of "open cursors" during the day you would need to implement some monitoring. Maybe based on the view that was already mentioned.
    Edited by: Sven W. on May 16, 2011 2:30 PM - since the parameter is on session level, other open cursors should not influence it much.

  • How to get the command line interface for WRT160NL router

    hi,
    How can I get the command line interface for WRT160NL router. please suggest.

    If you’re trying to access the web-based interface of your router, just use its default IP address (192.168.1.1). The Username is left blank and the Password is "admin". Here’s a quick link on how to do that.

  • How to get the data of Open Opportunities and Closed Opportunities

    Hi Guys,
      i'm studying about Sales Opportunities in SAP BusinessOne.
    i'm able to get the data about Sales Opportunities(i enterd), Opportunities Report and Lost Opportunities.
    But i dont know how to get information about Open Opportunities Reports and Closed Opportunitiesn Reports.i'm unable to find even their names of tables.
    plz send a reply.................
       with regards,
    santh

    Thanq Alexey for ur Helpful Answer,
       i'm aware about execution of a query in the Query Analyzer of SQL Server.but i dont know how to move to ShowDebugInformation Menu.
       can i find it in  the SAP Business One Tool. or do i need
    to check any data base help given by B1(Ex:- REFDB2004).
        plz give answer for  this also............
      with regards,
    santh

Maybe you are looking for

  • Firefox (for android) takes forever to load or doesn't load at all

    Firefox will not load or takes forever to load (i.e. up to 3 or 4 minutes) mostly, I get an "unable to connect" "offline mode" error. Other apps that use data are able to connect to the network, but FF...not so much. I'm on a Nexus 5 running kk 4.4.2

  • Sales order stock from Projects

    Dear Gurus, The Scenerio is, I am procuring materials through project. Generally it will go into project stock, If it is mentioned as a stock item. But my requirement is, the procured material has to go into salesorder stock.( Bcoz delivery of materi

  • Issue with Date showing Null in interactive report

    I created an interactive report for a customer and was confused to see blanks or more specifically dashes where there should be dates in one of the fields. I knew this field should have data so I did some testing and this is what I have found: The sq

  • Help needed urgently with two major Logic 9 issues

    Dear all, We've recently migrated from Logic 7 to 9 and have a major album project to finish using a fairly modest tracking setup. We've encountered two major issues that are holding up progress and wondered if anyone here has experienced them and ha

  • Photo app reboots i4

    When I use any photo app my phone reboots. Help