How to drag a url to a .desktop shortcut - linux

I have created a new .desktop shortcut in LXDE, and added that shortcut to the "Application Launch Bar". I can drag a file onto the shortcut, and the filename will be passed to a script successfully. However, when I drag a link from either Firefox or Chrome, the link is not passed as an argument.
The important parts of my .desktop file are as follows:
[Desktop Entry]
Exec=/bin/bash /home/myUserName/test.sh %u
Terminal=false
StartupNotify=true
And /home/myUserName/test.sh simply contains:
echo "!$1!" > /home/myUserName/test.txt
just to prove that it's passing arguments.
I've read the freedesktop standards.
I had only Chrome installed when I discovered the problem, but I read that chrome was saving files instead of links, so I switched to Firefox; however the URL is still not passing to the desktop shortcut.
I hope I'm overlooking something, as this seems to be a huge gap in continuity with freedesktop standards.
Any suggestions?
EDIT: After testing, Firefox saves an HTML file instead of a link just like Chrome, so it appears to be an LXDE bug rather than a browser bug. I'll assume that my next endeavor is to find out why.

I've not completely absorbed the delineation between a window manager and a desktop manager, but I believe that LXDE is the culprit, either directly or indirectly, in conjunction with pcmanfm.
I've read that installing pcmanfm-mod might solve my problem, and I've also read that pcmanfm is no longer being developed, and is replaced by spacefm, which is out of my scope to install right now, as it is not available in my distribution.
To bottom-line it, XFCE with Thunar has solved the problem. I added a "Launcher" to my newly-installed XFCE-Panel, and its EXEC is identical to the one in the original post, and the %u is now successfully passed to my script when I drag a link from Firefox. I have not tried to drag a link from Chrome, but I feel it would work as well.

Related

how to launch evince at 100% zoom, or other pdf-viewing solution

I'm going through a bunch of PDFs viewing and then renaming.
I want to open each PDF at 100% zoom when I double-click it from nautilus. Currently it opens at 59%. I have to resize the window every time.
The application seems to call itself "Document Viewer". As far as I can tell, this is an unhelpful indirect name for evince. But I am not sure, because GNOME as a whole is trying to be "clever" about everything.
I've tried "Save Current Settings as Default", but that doesn't have the desired effect.
I've also tried gsettings set org.gnome.Evince.Default zoom 1.0 based on eg https://askubuntu.com/questions/606838/configure-evince-to-open-maximized-with-100-zoom-level . The gesttings command did not produce an error. But nor did it change evince's behaviour.
I'm open to a generic X11 solution, and reserving an area of the screen for this. I'm also open to a solution involving evince, or how nautilus launches it, or a different graphical shell or PDF viewer. Preferably applications available with debian 10.
Ideally I'd like a graphical shell which can give 100% previews and inline renames with F2. This would give a quick workflow for view-renaming whole folders of scanned papers one after the other.
I'd also be interested in socio-cultural explanations of the confluence of factors that resulted in such a severe and basic failure: opening a PDF from the graphical file browser does not result in a readable rendering, and requires the user to resize the window.
Screen is 3840x2160.
"Save Current Settings as Default" works for me on F33. I didn't change any of the other Gnome settings. I use a couple of different monitors with different resolutions and it doesn't give me any issues. I don't know if Debian handles Evince differently; I haven't used Debian for ages. Not a lot of help, sorry.

"Registering" GVim in Windows XP

This is probably bordering off-topic-ness here, but not a lot of people on SuperUser use GVim, as opposed to here, so I'm leaving it here.
The problem is simple - I'm using GVim 7.3. from vim.org, downloaded it in the form of archived binaries (the two archive files) like always and replaced the older version. However, I can't get Windows to recognize it and to associate a file extension to it.
From windows explorer go to, let's say, .py file, Open with ... / Browse / gvim.exe in its directory and ... nothing. Like it never happened.
Does anyone have any idea what could be causing this behaviour? It's mighty annoying to have to open every file from within Vim manually.
I think the default installer ("self-installing executable") from vim.org lets you register shell associations; this means you get an entry "open with vim" in every context menu from the explorer. Did you not use this file?
I'm looking at this page and I'm thinking about this download.
This doesn't answer your question, but it's a different way to edit with gvim from the context menu.
Create a .reg file with the contents below (adjusting your path to gvim.exe) and execute it. Then whenever you right-click on a file in explorer you will have an "Open with GVIM" option.
REGEDIT4
[HKEY_CLASSES_ROOT\Unknown\shell]
#="Open with GVIM"
[HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell]
[HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell\Open with &GVim]
#="Open with GVIM"
[HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell\Open with &GVim\command]
#="C:\\Vim\\gvim.exe \"%1\""
I gave up trying all kinds of tricks through the registry, but this solution works for me just fine. I might add, I'm having the same issue on Windows 7. Since Windows seems to be able to do the association with vim.exe just fine, and this is apparently tied to the file name, I moved vim.exe off as say vim.ex$ and made a copy of gvim.exe to vim.exe. Cheap and easy way around this goofy problem, and I can't say I ever use vim.exe on purpose.

How can I make Emacs Org-mode open links to sites in Google Chrome?

Google Chrome is set as the default browser. However, it opens links in Firefox, which is undesired.
How can I make Org-mode to open links in Google Chrome?
Emacs 23.2 doesn't directly support Google Chrome, but it does support a "generic" browser, and something like this should work:
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "chromium-browser")
You don't mention your OS, but if it's Windows or Mac, you can try:
(setq browse-url-browser-function 'browse-url-default-windows-browser)
(setq browse-url-browser-function 'browse-url-default-macosx-browser)
And, if that doesn't work, there are other folks who have implemented 'browse-url-chrome. Google turned up the following link:
http://code.ohloh.net/search?s=browse-url-chrome&browser=Default
As Trey suggests, you can set it to a generic browser, but instead of "chromium-browser" use "google-chrome", like this:
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "google-chrome")
That worked for me with Emacs 23.2 and Chrome 12.
I have a similar problem (although the other way around: I wanted Emacs to open Firefox, but it opened Chromium).
I'm using Ubuntu 12.04 (Precise Pangolin), but already had the problem with Ubuntu 11.10 (Oneiric Ocelot). The solution below applies to Linux, maybe macOS (?), and probably not Windows.
Setting browse-url-generic-program as suggested in other answers didn't work for me. Note also that my default browser is generally Firefox: that's what most other applications are using to open a URL, including xdg-open. So I was surprised that Emacs would do otherwise.
I finally figured out that Emacs is using the sensible-browser (1) script. Looking at that script, I noticed that:
it first looks at the BROWSER environment variable;
else, it tries several other generic scripts, starting with gnome-www-browser
It so happens that, on my machine, BROWSER is not set, but gnome-www-browser is a script apparently put there by Chromium, and (naturally) running Chromium.
So, long story short: putting the following line
export BROWSER=firefox # Or any browser of your choice
in your .profile may help if Emacs is not using the correct browser.
Setting the browser function is very easy using the GUI:
In the menu, click Options > Customize Emacs > Top-level customization Group
Click on the link External (Interfacing to external utilities.)
Click on the link Browse Url (Use a web browser to look at a URL.)
Click on the small triangle to the left of Browse Url Browser Function, this reveals a Value Menu button and some help text
Click the Value Menu button
Choose your preference from the displayed menu
Move to the top of the buffer, click the button Apply and Save to save the change to your ~/.emacs file
Done :-)
I also had this problem when exporting org files to HTML. It would use Firefox instead of a Chromium browser. I fixed it by customizing org-file-apps (which for some reason had been set to open XHTML and HTML files with Firefox).
I now have an entry for extension \.x?html?\' with command set to the Lisp form: (browse-url file)
I was on macOS and the browse-url-default-macos-browser did not work for me.
My solution was:
(setq browse-url-browser-function 'browse-url-chrome)
(setq browse-url-chrome-program "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"))
For ChrUbuntu, the google-chrome incantation as given by Alan Turing works with Emacs 23.3.1, the default as of today. I suspect the chrubuntu configuration even when tickled to use chromium uses the wrong binary name.
In emacs 28 (Fedora Linux) I just needed this
(setq browse-url-browser-function 'browse-url-chrome)

I want to use VI-like commands in Web Browser?

I love VI and I'm looking for a plugin of some sort that would allow me to input text in my browser (preferably Firefox or Chrome) using VI commands. It would save me an immense amount of time and at the same time when writing long emails. Can anyone think of any plugins that would allow me to do this? I was hopeful with Vimperator (https://addons.mozilla.org/en-US/firefox/addon/4891) but after installing it, I realized that it didn't do the one VI think I wanted to do: create or edit a text box with VI commands. It just allowed me to do Browser commands and scrolling in VI-style.
since you have installed Vimperator , you can try this :
se
editor=”YOUR-GVIM-PATH/vim72/gvim.exe
-f”
Press Ctrl + i to call gvim to deal with the text you want to edit.
I've had great luck with itsAllText firefox extension. Probably not as smooth as your dream, but it works very well in practice.
https://addons.mozilla.org/en-US/firefox/addon/4125
I've been using the Mozex extension for Firefox for years.
http://mozex.mozdev.org/
Once installed, on the "Textarea" tab, assign a hot-key and enter the command to run. For example:
gnome-terminal -e "/usr/bin/vim %t"
When the hot-key is pressed, Mozex will create a temporary file and replace the "%t" above with its name.
If there's more than one text area on a page it will allow you to pick which one you want to edit.
Mozex provides a lot more functionality than just text area editing. If you want to "view source" with Vim, you can do that too.
I've used jV for a while on firefox. It works even with newer versions that the extension doesn't officially claim to support. The dev says they are working on a chrome version.
Currently the Chrome Extensions API is fairly simple; I simply don't think that there are currently enough API hooks into the browser to be able to support something like this.
You might want to check out the confusingly-named Conkeror browser (not the same as Konqueror in Linux), which is best described as the love child of VI and Firefox. It's like VI with the Gecko rendering engine (I think).

Can't Copy & Paste in Eclipse 3.5

I recently updated my Eclipse to the latest release 3.5 and since then I have a very annoying problem with c&p using the shortcuts.
In an editor (xml, jsp, doesn't matter which one) I try to copy something and paste it somewhere else, nothing happens. When I cut out something and put it somewhere else I sometimes get something else (like a messed up part of my previous selection) or just some whitespaces. This gets even worse when I change lines in between.
First I thought that my keyboard is probably broken but it works just fine in other programs. Then I tried using the context menus' c&p and there it works. Yesterday I managed to get at least an error message when I tried to copy a file in the navigator from one project to another (the message was just "error using copy...bla". no details).
Does anyone else have this problem, or know how to solve it?
I am running on Kubuntu 9.04, and have quite some plugins installed (but only from the Galileo Updates Site), like Birt, Mylin, WST, or Subversive.
For my problem, I had to go to Window > Preferences > Java > Editor > Typing, and uncheck "Update imports"
This must be related to the key mapping, since those shortcuts are defined according to context.
(Column "When", in Preferences / General / Keys)
Check if those shortcuts do not work for any editor (do they work for Java editor?)
If they work for some editor, not for other, then some plugin settings must have re-affected them to another command.
This is caused by various X clipboard managers doing weird things with the clipboard. (bug report).
In XFCE the clipman applet was rolled in XFCE 4.8, and will be the source of these problems.
To fix this in XFCE - kill xfce4-settings-helper. You will need to use Settings Manager -> Session and Startup -> Session to kill it, as otherwise it may restart automatically.
To prevent this starting next time, you will need to remove it from your startup/login programs in Settings Manager > Session and Startup > Application Autostart.
Problem was solved with newer Eclipse releases. I think >= 3.6. Depending on your distribution there may be a (back)port of this (not on my Xubuntu 11.04) within the repositories.
So a tarball installation of Eclipse 4.0 works perfectly for me. Cut&Paste works and I am lucky that my plugins are compatible to 4.0.
Unfortunately Sublime Text has the same problems.
I read somewhere that in KDE maybe Klipper / "Klipper on the panel" conflicts with eclipse copy action.
It's a tool for clipboard history. Try to remove that! It may solve your problem :-/
For me the xfce4-settings-helper killing worked.
Workaround:
You can cut&paste from the compare view. So simply compare the un-copyable file (e.g., local history) with a different version and Control-C what you need there.
In the *.java editor page, right click and select open in text editor. Past your snippet there. Your Snippet will show in the *.java page'
I use Eclipse Kepler for PHP development. It's dumb I know.
None of the solutions suggested here has solved this source of frustration.
I can confirm the copy function works whether shortcut keys are bound or not. As I can copy from eclipse and paste into any other application. Except eclipse.
My solution. Accidental discovery: Eclipse Kepler will allow you to paste outside the php open and close tags and allow you to click and drag the highlighted block of content into into position.
Acceptable solution for small bits of code. Horribly crippling for larger development environments.
For Xming, this resolved the problem for me. In XLaunch uncheck Clipboard (clipboard manager) in the "Specify parameter settings" GUI form.

Resources