KDE:klipper程序动作脚本 [英] KDE: klipper action script

查看:580
本文介绍了KDE:klipper程序动作脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,KDE的剪贴板经理 - klipper程序 - 可以写出要应用一个脚本来剪贴板中的内容相匹配的正则表达式。说我想通过克利佩尔bash脚本下载图像。

So KDE's clipboard manager - klipper - allows one to write a script to be applied to clipboard contents matching regexp. Say, I want klipper to download an image through bash script.

下面是一个klipper程序QRegExp:

Here's a klipper QRegExp:

^http://.*\.(png|svg|gif|jpg|jpeg)

我知道,这个正则表达式的作品 - klipper程序每次我复制图片地址到剪贴板时通知我。然后,这里有一个bash脚本

I know that this regexp works - klipper notifies me every time I copy image URL to clipboard. Then, here's a bash script

#!/bin/bash
# let's name it clip.bash
name=`basename $1`
curl -o ~/Downloads/$name $1

我把这个脚本到PATH(我试过喂这个脚本用图像的URL我的自我 - 它的工作原理),最后我指定的操作方式如下:

I put this script to the PATH (I tried to feed this script with a image URL my self - it works), and finally I specify an action the following way:

clip.bash \%s

一切都很好,并采取关心 - 但它不能正常工作

everything's fine and taken care about - but it doesn't work!

所以我的问题是:如何使klipper程序通过bash脚本下载图片

So my question is: "how to make klipper download an image through the bash script?"

推荐答案

第一个想法:


  1. 你确定的%前的反斜线?我还没有进入KDE的权利,但我不知道你需要它。

  2. 你确定klipper程序看到你的变化到PATH变量?你可以尝试使用绝对路径(像/家/../ clip.bash)

如果那些没有工作,你可以尝试从登录脚本一些调试信息。例如:

If those don't work, you can try to log some debug info from your script. For example:

#!/bin/bash
name=`basename $1`
echo "curl -o ~/Downloads/$name $1" 1>&2

运行

tail ~/.xsession-errors

看什么命令脚本刚才试图执行。

to see what command your script have just tried to execute.

这篇关于KDE:klipper程序动作脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆