Name userscripts

This commit is contained in:
Thomas Dehaeze 2021-05-13 18:55:29 +02:00
parent 71a0c2601d
commit 0ccedc97ea

View File

@ -51,7 +51,7 @@ c.content.blocking.adblock.lists = ['https://easylist.to/easylist/easylist.txt',
* Editor
#+begin_src python
c.editor.command = ['/usr/bin/termite', '--class="Floating"', '-e', 'nvim {}']
c.editor.command = ['/usr/bin/alacritty', '--class="Floating"', '-e', 'nvim {}']
#+end_src
* Downloads
@ -62,13 +62,14 @@ c.downloads.location.remember = True
c.downloads.location.suggestion = 'path'
c.downloads.position = 'bottom'
c.downloads.remove_finished = 10000
# c.downloads.open_dispatcher = 'linkhandler'
#+END_SRC
* File Select
#+begin_src python
c.fileselect.handler = "default"
# c.fileselect.single_file.command = ['termine', '-e', 'ranger', '--choosefile', '{}']
# c.fileselect.multiple_files.command = ['termite', '-e', 'ranger', '--choosefiles', '{}']
# c.fileselect.multiple_files.command = ['alacritty', '-e', 'ranger', '--choosefiles', '{}']
#+end_src
* Colors
@ -271,82 +272,104 @@ config.bind('gs', 'open -t qute://settings')
* Custom Bindings
Create a Password for the current website
#+begin_src python
config.bind(',P', 'spawn --userscript ~/.config/qutebrowser/userscripts/add-passowrd.sh')
c.aliases['Password_Add'] = 'spawn --userscript ~/.config/qutebrowser/userscripts/add-passowrd.sh'
config.bind(',P', 'Password_Add')
#+end_src
Use Pass to fill password and username (configuration is done in =~/.config/qutebrowser/password_fill_rc=)
#+begin_src python
config.bind(',p', 'spawn --userscript password_fill')
c.aliases['Password_Fill'] = 'spawn --userscript password_fill'
config.bind(',p', 'Password_Fill')
#+END_SRC
Open Youtube video using =mpv=
#+begin_src python
config.bind(',m', 'spawn --detach mpv --force-window yes {url}')
config.bind(',M', 'hint links spawn --detach mpv --force-window yes {hint-url}')
c.aliases['MPV_view'] = 'spawn --detach mpv --force-window yes {url}'
config.bind(',m', 'MPV_view')
c.aliases['MPV_view_hint'] = 'hint links spawn --detach mpv --force-window yes {hint-url}'
config.bind(';m', 'MPV_view_hint')
#+END_SRC
Download Youtube video / entire playlist
#+begin_src python
config.bind(',v', 'spawn --userscript ~/.config/qutebrowser/userscripts/yt-download.sh {url}')
config.bind(',V', 'hint links spawn --userscript ~/.config/qutebrowser/userscripts/yt-download.sh {hint-url}')
c.aliases['Download_Youtube'] = 'spawn --userscript ~/.config/qutebrowser/userscripts/yt-download.sh {url}'
config.bind(',v', 'Download_Youtube')
c.aliases['Download_Youtube_hint'] = 'hint links spawn --userscript ~/.config/qutebrowser/userscripts/yt-download.sh {hint-url}'
config.bind(';v', 'Download_Youtube_hint')
#+END_SRC
Add page to Bookmarks using =buku=
#+begin_src python
config.bind(',b', 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-add.sh')
config.bind(',B', 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-rofi.sh')
c.aliases['Bookmark_Add'] = 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-add.sh'
config.bind(',b', 'Bookmark_Add')
c.aliases['Bookmark_Add_Custom'] = 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-rofi.sh'
config.bind(',B', 'Bookmark_Add_Custom')
#+end_src
Download with =aria2c=
#+begin_src python
config.bind(',d', 'hint links spawn --userscript ~/.config/qutebrowser/userscripts/aria2c-add.sh {hint-url}')
config.bind(',D', 'hint links spawn --userscript ~/.config/qutebrowser/userscripts/aria2c-add-homelab.sh {hint-url}')
c.aliases['Download_Local'] = 'hint links spawn --userscript ~/.config/qutebrowser/userscripts/aria2c-add.sh {hint-url}'
config.bind(',d', 'Download_Local')
c.aliases['Download_Homelab'] = 'hint links spawn --userscript ~/.config/qutebrowser/userscripts/aria2c-add-homelab.sh {hint-url}'
config.bind(',D', 'Download_Homelab')
#+end_src
Open bookmark using =buku=
#+begin_src python
config.bind(',o', 'spawn ~/.local/bin/bukurun')
c.aliases['Open_Bookmark'] = 'spawn ~/.local/bin/bukurun'
config.bind(',o', 'Open_Bookmark')
#+end_src
Open with =linkhandler=
#+begin_src python
c.aliases['Open_Default'] = 'hint links spawn --detach linkhandler {hint-url}'
config.bind(',O', 'Open_Default')
#+end_src
Org Capture
#+begin_src python
config.bind(',r', 'spawn --userscript ~/.config/qutebrowser/userscripts/org-capture.sh')
config.bind(',R', 'hint links userscript ~/.config/qutebrowser/userscripts/org-capture.sh')
c.aliases['Org_Capture'] = 'spawn --userscript ~/.config/qutebrowser/userscripts/org-capture.sh'
config.bind(',r', 'Org_Capture')
c.aliases['Org_Capture_hint'] = 'hint links userscript ~/.config/qutebrowser/userscripts/org-capture.sh'
config.bind(';R', 'Org_Capture_hint')
#+end_src
Screenshot of webpage to png
#+begin_src python
config.bind(',s', 'spawn --userscript ~/.config/qutebrowser/userscripts/html-to-pdf.sh')
config.bind(',S', 'spawn --userscript ~/.config/qutebrowser/userscripts/html-to-png.sh')
c.aliases['Save_PDF'] = 'spawn --userscript ~/.config/qutebrowser/userscripts/html-to-pdf.sh'
config.bind(',s', 'Save_PDF')
c.aliases['Save_PNG'] = 'spawn --userscript ~/.config/qutebrowser/userscripts/html-to-png.sh'
config.bind(',S', 'Save_PNG')
#+end_src
Download AES video
#+begin_src python
config.bind(',E', 'spawn --userscript ~/.config/qutebrowser/userscripts/aes-download.sh')
c.aliases['Download_AES'] = 'spawn --userscript ~/.config/qutebrowser/userscripts/aes-download.sh'
config.bind(',E', 'Download_AES')
#+end_src
Download a torrent
#+begin_src python
config.bind(',t', 'hint links spawn torrent-add {hint-url}')
#+end_src
Annotate with Hypothesis
#+begin_src python
config.bind(',a', "jseval javascript:(function(){window.hypothesisConfig=function(){return{showHighlights:true,appType:'bookmarklet'};};var d=document,s=d.createElement('script');s.setAttribute('src','https://hypothes.is/embed.js');d.body.appendChild(s)})();")
c.aliases['Download_Torrent_Homelab'] = 'hint links spawn torrent-add {hint-url}'
config.bind(',t', 'Download_Torrent_Homelab')
#+end_src
See Amazon price history using CamelCamelCamel
#+begin_src python
config.bind(',A', "open -t https://fr.camelcamelcamel.com/search?sq={url}")
c.aliases['CamelCamelCamel'] = 'open -t https://fr.camelcamelcamel.com/search?sq={url}'
config.bind(',A', 'CamelCamelCamel')
#+end_src
Org Roam Entry for the current page
#+begin_src python
config.bind(',R', "open javascript:void(location.href='org-protocol://roam-ref?template=r&ref='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title))")
#+end_src
#+begin_src python
config.bind(',Z', "open -w https://bm.tdehaeze.xyz/bookmarks/new?url={url}&auto_close")
c.aliases['Org_Roam_Save'] = "open javascript:void(location.href='org-protocol://roam-ref?template=r&ref='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title))"
config.bind(',R', 'Org_Roam_Save')
#+end_src
* Userscripts
@ -357,6 +380,8 @@ config.bind(',Z', "open -w https://bm.tdehaeze.xyz/bookmarks/new?url={url}&auto_
:header-args:python+: :comments both :mkdirp yes
:END:
[[https://qutebrowser.org/doc/userscripts.html][Here]] is the documentation related to userscripts.
** Create a new password
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/add-passowrd.sh
url=$(echo "$QUTE_URL" | awk -F[/:] '{print $4}' | rofi -p "URL" -dmenu -lines 1)
@ -592,7 +617,7 @@ dl-add $(echo "$1" | sed 's/\&af=.*$//g') && \
dunstify "Aria2" "Error"
#+end_src
** Screenshot
** Save to PNG
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/html-to-png.sh
filename=$(rofi -p "filename" -dmenu -lines 1)