topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 3:24 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: FARR works ok in crunchbang linux  (Read 3064 times)

klausbh

  • Supporting Member
  • Joined in 2012
  • **
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
FARR works ok in crunchbang linux
« on: April 17, 2014, 10:46 PM »
I recently migrated from win XP to #! linux and one of the programs I didn't want to live without was find and run robot. Well, after playing around for several evenings I now have FARR mostly set up to my liking:

- on first "pause" key-press after booting, FARR is loaded via WINE
- subsequent "pauses" summon and dismiss the FARR search window as expected
- the search window is (almost always) focused such that typing triggers searches as expected
- files on both my NTFS (windows) and EXT4 (linux) partition are found as expected
- windows .exe files start via WINE
- document types configured to launch via specific windows apps do so
- document types configured to launch via specific linux apps do so
- unspecified document types consult the linux file manager for a default linux app
- some bugs require workarounds (e.g., ordering searched folders by drag-and-drop does not work, but editing FindAndRunRobot.ini does work)

There were two main issues that required work on my part:

1st problem: WINE alone does not get “pause” to work. Solution: a linux script (I call it “farr.sh") is triggered by “pause” and sends another “pause” to FARR. The same script also focuses the window, and launches FARR in the first place. Here it is:

Code: Text [Select]
  1. #!/bin/sh
  2. if [ -z "$(pgrep FindAndRunRobot)" ]
  3.         then
  4.                 /usr/bin/wine /media/third/testing/FindAndRunRobot/FindAndRunRobot.exe
  5.         else   
  6.                 xdotool search --classname FindAndRunRobot key "Pause" search --name "Find And Run Robot 2" windowactivate --sync
  7. fi
  8. exit 0

Since crunchbang uses openbox as a window manager, the initial hotkey can be set up in ~/.config/openbox/rc.xml as follows:

Code: Text [Select]
  1. [code=text]
  2.     <keybind key="Pause">
  3.       <action name="Execute">
  4.         <startupnotify>
  5.           <enabled>true</enabled>
  6.           <name>Run Program</name>
  7.         </startupnotify>
  8.         <command>farr.sh</command>
  9.       </action>
  10.     </keybind>
[/code]


2nd problem: FARR needs a custom document opener that can trigger both linux and WINE applications as needed. Solution: a windows batch file (which I call “bender.bat” after the wino robot in futurama).  Since #! uses thunar as a file manager,  thunar can be called to indirectly associate documents with linux applications. One could also bypass thunar and specify everything explicitly. Here is the batch script:

Code: Text [Select]
  1. @ECHO OFF
  2. SETLOCAL
  3.  
  4. SET foo=%1
  5. SET foo=%foo:a=A%
  6. SET foo=%foo:b=B%
  7. SET foo=%foo:c=C%
  8. SET foo=%foo:d=D%
  9. SET foo=%foo:e=E%
  10. SET foo=%foo:f=F%
  11. SET foo=%foo:g=G%
  12. SET foo=%foo:h=H%
  13. SET foo=%foo:i=I%
  14. SET foo=%foo:j=J%
  15. SET foo=%foo:k=K%
  16. SET foo=%foo:l=L%
  17. SET foo=%foo:m=M%
  18. SET foo=%foo:n=N%
  19. SET foo=%foo:o=O%
  20. SET foo=%foo:p=P%
  21. SET foo=%foo:q=Q%
  22. SET foo=%foo:r=R%
  23. SET foo=%foo:s=S%
  24. SET foo=%foo:t=T%
  25. SET foo=%foo:u=U%
  26. SET foo=%foo:v=V%
  27. SET foo=%foo:w=W%
  28. SET foo=%foo:x=X%
  29. SET foo=%foo:y=Y%
  30. SET foo=%foo:z=Z%
  31.  
  32. SET bar=goto :thunar
  33.  
  34. IF %foo:~-2%==.R   SET bar=z:\media\third\testing\npp.6.5.minimalist\notepad++.exe "%1"
  35. IF %foo:~-4%==.PDF SET bar=z:\media\third\testing\SumatraPDFPortable\SumatraPDFPortable.exe "%1"
  36.  
  37. %bar%
  38.  
  39. goto :theend
  40.  
  41. :thunar
  42. winepath -u "%1" > %TEMP%\temp.txt
  43. SET /P foo=< %TEMP%\temp.txt
  44. del %TEMP%\temp.txt
  45. SET foo=%foo: =\ %
  46. \bin\sh -c "thunar %foo%"
  47.  
  48. :theend

I think the only part that needs to be customized is the section with if statements (one for each file type).

enjoy!

P.S.: Does anyone know how FARR could tell, without indexing, which files on a linux partition are executable (i.e. read the execute bit)?


ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: FARR works ok in crunchbang linux
« Reply #1 on: April 17, 2014, 11:05 PM »
Nice!  Had tried before to get FARR working under *NIX + WINE but didn't get nearly as far as you did.

Now if mouser would consider WINE a real target ;)



Sorry I don't have any good ideas about your question.