Search code examples
pythonlinuxurlclipboardpyperclip

How to save url using xdotool ctrl+c data in python list in linux


I started with following code

def getclip(self):
   xdo = Xdo()
   key = "ctrl+c"
   xdo.send_keysequence_window(0, key.encode())

now i wish to print the data in clipboard(literally - not the python module) in python console

how can I achieve that?


Solution

  • xdo = Xdo()
    
    def sendkeys(*keys):
        for k in keys: xdo.send_keysequence_window(0, k.encode())
    
    def geturl():
        sendkeys("alt+d")
        sendkeys("ctrl+c")
        url=pyperclip.paste()