开发者

getting selected text in current window

I'm trying to build a script that will add the currently selected text to the end of a file. So far it looks like cat selected_text >> quotes.txt.

I开发者_C百科s there any way, either in command line or in C/C++ to get the currently selected text from the currently active window?


Take a look at the xclip command

This command operates on X11 selections (the middle-click paste clipboard). It can be used to retrieve the last block of text that was selected using the mouse.


xsel is a command line tool for getting selected text, If the last text you have selected is in your current window, you will get it with command:

xsel
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜