CIAvash / qutebrowser-userscripts

userscripts for qutebrowser (written in Raku)
https://codeberg.org/CIAvash/qutebrowser-userscripts
GNU Lesser General Public License v3.0
10 stars 0 forks source link

yank-text-url - Userscript exited with status 1 #1

Closed muralikodali closed 3 years ago

muralikodali commented 3 years ago

though this issue is not related to your scripts, i request your help in solving installation of zef modules

yank-title-url exited successfully.

yank-text-url is giving following error.

===SORRY!=== Error while compiling /home/xxxx/.local/share/qutebrowser/userscripts/yank-text-url
Could not find Clipboard in:
    inst#/home/xxxx/.raku
    inst#/home/xxxx/.rakubrew/versions/moar-/share/perl6/site
    inst#/home/xxxx/.rakubrew/versions/moar-/share/perl6/vendor
    inst#/home/xxxx/.rakubrew/versions/moar-/share/perl6/core
    ap#
    nqp#
    perl5#
at /home/xxxx/.local/share/qutebrowser/userscripts/yank-text-url:5

i have tried to install Clipborad using zef and got the following result.

zef search clipboard
===> Found 0 results

after googling, i found a suggestion to install inline::Perl5 to use modules in perl5 installation.

I have got the following error.

zef install Inline::Perl5
===> Searching for: Inline::Perl5
===> Searching for missing dependencies: perl:from<native>, File::Temp, Distribution::Builder::MakeFromJSON:ver<0.6+>
===> Failed to find dependencies: perl:from<native>
Failed to resolve some missing dependencies (use e.g. --exclude="perl" to skip)

request your guidance on this matter.

CIAvash commented 3 years ago

That's my fault, sorry about that. I missed adding the lib folder to the path for yank-text-url. Now it should be fixed, please try the new file.

You don't need to install anything other than what's mentioned in the README, Clipboard and the other modules are in the lib folder.

muralikodali commented 3 years ago

thanks for your reply. i am getting copied text and url now. but there is no space or blank line between copied text and url.

for select-links-with-title, i am getting following error :

Type check failed in binding to parameter '$html'; expected Str but got Any (Any)
  in sub find at /home/xxxx/.local/share/qutebrowser/userscripts/lib/QBUtils.rakumod (QBUtils) line 9
  in block <unit> at /home/xxxx/.local/share/qutebrowser/userscripts/select-links-with-title line 6
CIAvash commented 3 years ago

Are you using X display server and xclip?

Can you show me the keybindings you are using?

muralikodali commented 3 years ago

My OS is Arch Linux with i3 window manager. I am using X display and xclip.

My key bindings are (in autoconfig.py) :

    ';j': spawn --userscript yank-text-url
    ';k': spawn --userscript select-links-with-title

i have copied only the above two scripts to userscripts folder. yank-text-url is working fine ( without a blank line between copied text and url )

CIAvash commented 3 years ago

My OS is Arch Linux with i3 window manager. I am using X display and xclip.

I'm on Wayland so I can't test it on X right now, But I don't remember having a problem with xclip. Can you run this in your terminal and see if the text is copied and separated with newline?

 echo -e "title\nurl" | xclip -selection clipboard

My key bindings are (in autoconfig.py) :

    ';k': spawn --userscript select-links-with-title

select-links-with-title should be used with hint. Look at the hint containers example in the README.

If you want to select links of the current page, use select Links --with-title. You need the select script for this.

muralikodali commented 3 years ago
 echo -e "title\nurl" | xclip -selection clipboard

changing the above command to with extra \n, echo -e "title\n\nurl" | xclip -selection clipboard got the blank line in between.

my terminal is alacritty and shell is fish.

select-links-with-title should be used with hint. Look at the hint containers example in the README.

If you want to select links of the current page, use select Links --with-title. You need the select script for this.

copying select script and changing key configuration to hint links userscript select-links-with-title gave the expected result.

rofi is launching full size. can we change the geometry of rofi ?

CIAvash commented 3 years ago
 echo -e "title\nurl" | xclip -selection clipboard

changing the above command to with extra \n, echo -e "title\n\nurl" | xclip -selection clipboard got the blank line in between.

There shouldn't be any blank lines, it just joins them with a newline. so if the selected text is 'test' and url is 'http://example.com', what gets copied is:

test
http://example.com

If you want an extra newline, add another \n to the script, where the other \n is.

rofi is launching full size. can we change the geometry of rofi ?

You'd have to manually change the -location and -width or other options in the lib/Rofi.rakumod file.