ClipSync/client.py
2023-01-28 16:03:13 +01:00

50 lines
1.0 KiB
Python

import pyperclip
import socketio
import os
import subprocess
# standard Python
# to put in a conf file
ip = 'simailadjalim.fr'
port = "9564"
hostname = "WarMachine"
logfilepath = "./logs.txt"
"""
This script is a daemon that, on event, send and sync the clipboard with a distant one
"""
def dechiffreCePutainDeMessage(message : str) -> str:
"""
"""
ip = f"http://{ip}:{port}/"
print(ip)
sio = socketio.Client()
sio.connect(ip)
print("[Debug] Connected to Server .w.")
def sendSystemNotification(title:str,content:str):
"""
Une fonction pour 1. rendre le truc plus secure et
eviter que thomas face des rce sur mon pc .w. lmao
"""
subprocess.run(["notify-send",title,content])
@sio.event
def clip(data):
content = data["content"]
clipCmd = f'echo {content} | xclip'
print(f"[ClipEvent] received data from ")
os.system(clipCmd)
@sio.event
def notify(data):
title, content = data["title"], data["content"]
command = f'notify-send "{title}" "{content}"'
print(command)
os.system(command)
sio.wait()