/README.md

https://github.com/BelkaDev/RofiFtw · Markdown · 75 lines · 60 code · 15 blank · 0 comment · 0 complexity · 2147edb50ab5013a8ca07d246c104161 MD5 · raw file

  1. ## RofiFtw (Rofi for the web)
  2. Use rofi to perform web search with instant search suggestions </br>
  3. As of now, it supports the following websites:</br>
  4. * Youtube/Google
  5. * Wikipedia
  6. * Duckduckgo
  7. * Archwiki
  8. * Amazon
  9. * Deezer
  10. * Lastfm (requires Api key)
  11. * Google books
  12. </br>
  13. ![demo](https://raw.githubusercontent.com/BelkaDev/Rofiftw/master/src/demo.gif)</br>
  14. ### Requirements
  15. * [rofi blocks ](https://github.com/OmarCastro/rofi-blocks)
  16. this is what makes the rofi interaction dynamic.
  17. * [Jq](https://github.com/stedolan/jq) for Json processing.
  18. ### Usage
  19. Simply run the wrapper script for whichever API you'd want to handle the request </br>
  20. <i>Example:</i> </br>
  21. ` suggest youtube` </br>
  22. Each of the APis can be run indpendently from your terminal: </br>
  23. ` youtube <search>` </br>
  24. returns youtube suggestions of your entry in plain/text. </br></br>
  25. ![scrot](https://raw.githubusercontent.com/BelkaDev/Rofiftw/master/src/scrot)</br>
  26. you can configure all the APIs in their own respective files. </br>
  27. options can include search language and other basic search parameters. </br> </br>
  28. <b>note:</b> most of them barely include a basic search function, they aren't in any way complete </br>
  29. it's not hard to implement more options by reading through their documentations. </br>
  30. it's also made easy to add a custom API to the list, move them to the /APIs directory and follow the existing declarations.
  31. #### Intercepting results
  32. this script does nothing but to grab your selection which can seem to be pointless on its own. </br>
  33. however, you can combine it with additional scripts to make things more interesting.</br> here is a non-exhaustive list of scripts that blend well with it.
  34. * [play](https://github.com/BelkaDev/Mustream) songs/albums in Spotify
  35. * [getbook](https://github.com/BelkaDev/scropts/blob/master/getBook) download publicly available books
  36. * [youtubemenu](https://github.com/BelkaDev/scropts/blob/master/youtube) a youtube dmenu fetcher with thumbnails support
  37. This is an example for handling the selection based on your search type, you can add it at the end </br>
  38. of the wrapper script:
  39. ``` Bash
  40. case "$API" in
  41. "google") $BROWSER "https://www.google.com/search?q=$result" ;;
  42. "deezer" | "lastfm") play "$selection" ;;
  43. "youtube") youtube "$selection" ;;
  44. "books") getBook "$selection" ;;
  45. esac
  46. ```
  47. ### Installation
  48. ```
  49. git clone https://github.com/BelkaDev/RofiFtw.git ~/RofiFtw && cd ~/RofiFtw
  50. chmod +x *
  51. ```
  52. move the folder content to your $PATH directory
  53. ### Bugs & issues
  54. * You may notice a small delay while processing the input:</br>
  55. this can be fixed by increasing the refresh rate (ie number of typed characters before sending the request) </br> which will affect the average response time.</br>
  56. At the time being it's linear and pretty straightforward.
  57. if you know a better / more complex algorithm let me know.
  58. * Special and non-utf characters cause rofi to break, so they are filtered by default. </br>
  59. If you care about displaying them, [this fork](https://github.com/fogine/rofi-blocks/tree/fix-%233-wide-unicode) fixes the issues.
  60. more instructions can be found in [the code](https://github.com/BelkaDev/RofiFtw/blob/master/handler)</br>