From 82b4417de86c322be134bf9a6470a36347a2079c Mon Sep 17 00:00:00 2001 From: CodeBoxer Date: Tue, 5 May 2026 14:17:41 +0600 Subject: [PATCH] Hypnotix: Add a copy button for IPTV channel URLs (#402) --- usr/lib/hypnotix/hypnotix.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/usr/lib/hypnotix/hypnotix.py b/usr/lib/hypnotix/hypnotix.py index a6be99f..1588a4e 100755 --- a/usr/lib/hypnotix/hypnotix.py +++ b/usr/lib/hypnotix/hypnotix.py @@ -86,13 +86,26 @@ def __init__(self, channel, logo, **kwargs): self.set_tooltip_text(channel.name) frame = Gtk.Frame() + label = Gtk.Label(channel.name) label.set_max_width_chars(30) label.set_ellipsize(Pango.EllipsizeMode.END) + label.set_xalign(0.0) + + copy_button = Gtk.Button.new_from_icon_name("edit-copy-symbolic", Gtk.IconSize.BUTTON) + copy_button.set_tooltip_text(_("Copy channel URL to clipboard")) + copy_button.connect("clicked", self.on_copy_clicked) + + info_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) + info_box.pack_start(label, True, True, 0) + info_box.pack_start(copy_button, False, False, 0) + info_box.set_spacing(6) + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, border_width=6) box.pack_start(logo, False, False, 0) - box.pack_start(label, False, False, 0) + box.pack_start(info_box, False, False, 0) box.set_spacing(6) + frame.add(box) self.add(frame) @@ -100,6 +113,11 @@ def __init__(self, channel, logo, **kwargs): def channel(self): return self._channel + def on_copy_clicked(self, widget): + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) + if self._channel.url: + clipboard.set_text(self._channel.url, -1) + class MyApplication(Gtk.Application): # Main initialization routine def __init__(self, application_id, flags):