Windows | Clipboard History

self.history = [] self.pinned = set() self.load_history() self.last_text = pyperclip.paste() self.running = True # GUI self.create_widgets() self.update_history_display() # Start background monitor self.monitor_thread = threading.Thread(target=self.monitor_clipboard, daemon=True) self.monitor_thread.start() self.root.protocol("WM_DELETE_WINDOW", self.on_close)

def load_history(self): if os.path.exists(HISTORY_FILE): try: with open(HISTORY_FILE, "r", encoding="utf-8") as f: data = json.load(f) self.history = data.get("history", []) self.pinned = set(tuple(x) for x in data.get("pinned", [])) except: self.history = [] self.pinned = set()

def paste_selected(self): selection = self.listbox.curselection() if selection: filtered = self.get_filtered_history() idx = selection[0] if idx < len(filtered): text = filtered[idx]["text"] pyperclip.copy(text) self.status_var.set(f"Copied to clipboard: text[:50]...") # Flash window (optional) self.root.attributes('-topmost', True) self.root.after(1000, lambda: self.root.attributes('-topmost', False)) windows clipboard history

def toggle_pin(self, index): filtered = self.get_filtered_history() if index < len(filtered): item = filtered[index] item_id = (item["text"], item["timestamp"]) if item_id in self.pinned: self.pinned.discard(item_id) else: self.pinned.add(item_id) self.save_history() self.update_history_display()

def create_widgets(self): # Top frame top_frame = tk.Frame(self.root) top_frame.pack(fill=tk.X, padx=5, pady=5) tk.Label(top_frame, text="Clipboard History", font=("Arial", 14, "bold")).pack(side=tk.LEFT) tk.Button(top_frame, text="Clear History", command=self.clear_history).pack(side=tk.RIGHT, padx=2) tk.Button(top_frame, text="Paste to Clipboard", command=self.paste_selected).pack(side=tk.RIGHT, padx=2) # Search bar self.search_var = tk.StringVar() self.search_var.trace("w", lambda *a: self.update_history_display()) search_entry = tk.Entry(self.root, textvariable=self.search_var, placeholder="Search...") search_entry.pack(fill=tk.X, padx=5, pady=2) # Listbox with scrollbar frame = tk.Frame(self.root) frame.pack(fill=tk.BOTH, expand=True, padx=5, pady=5) scrollbar = tk.Scrollbar(frame) scrollbar.pack(side=tk.RIGHT, fill=tk.Y) self.listbox = tk.Listbox(frame, yscrollcommand=scrollbar.set, font=("Consolas", 10)) self.listbox.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) self.listbox.bind("<Double-Button-1>", lambda e: self.paste_selected()) self.listbox.bind("<Button-3>", self.show_context_menu) # right-click scrollbar.config(command=self.listbox.yview) # Status bar self.status_var = tk.StringVar() self.status_var.set("Monitoring clipboard...") status_bar = tk.Label(self.root, textvariable=self.status_var, bd=1, relief=tk.SUNKEN, anchor=tk.W) status_bar.pack(side=tk.BOTTOM, fill=tk.X) False)) def toggle_pin(self

def clear_history(self): if messagebox.askyesno("Clear History", "Delete all clipboard history?"): self.history = [] self.pinned.clear() self.save_history() self.update_history_display() self.status_var.set("History cleared")

I can't directly develop or install software on your Windows machine, but I can give you for a custom Windows clipboard history manager (with GUI) that extends the built-in clipboard. text="Paste to Clipboard"

def get_filtered_history(self): search_term = self.search_var.get().lower() filtered = [item for item in self.history if search_term in item["text"].lower()] # Sort: pinned first, then by timestamp desc filtered.sort(key=lambda x: (x["text"], x["timestamp"]) not in self.pinned) return filtered

Vocabulary Notes

A variety of different English vocabulary topics including common words lists, charts and example sentences.

Learn Vocabulary

Vocabulary Games

Improve your English with our interactive English vocabulary games. There are many different topics and levels.

Play our Games

Connect with us

Woodward English on YouTube Woodward English on Instagram Woodward English on Spotify Woodward English on X