diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e1e2e9c..d3fedc8 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,10 @@
-
+
+
@@ -469,7 +470,15 @@
1726841190285
-
+
+
+ 1726860371820
+
+
+
+ 1726860371820
+
+
@@ -510,7 +519,6 @@
-
@@ -535,6 +543,7 @@
-
+
+
\ No newline at end of file
diff --git a/wg_func.py b/wg_func.py
index 63b9ebe..5f34f2b 100755
--- a/wg_func.py
+++ b/wg_func.py
@@ -3,7 +3,7 @@ import os
import shutil
import zipfile
from datetime import datetime
-from tkinter import filedialog
+from tkinter import filedialog, ttk
import tkinter as tk
from pathlib import Path
from subprocess import check_call
@@ -363,3 +363,6 @@ class ExportTunnels:
except TypeError:
pass
+
+
+
diff --git a/wg_main.py b/wg_main.py
index 7518379..e96024d 100755
--- a/wg_main.py
+++ b/wg_main.py
@@ -108,6 +108,9 @@ class FrameWidgets(ttk.Frame):
tl = ListTunnels.tl_list()
if len(tl) != 0:
self.wg_autostart.configure(state='normal')
+ self.lb_rename.config(state='normal')
+ self.lb_rename.delete(0, tk.END)
+ self.btn_rename.config(state='normal')
self.l_box = tk.Listbox(self.lb_frame_btn_lbox, fg='#606060', selectmode='single')
self.l_box.config(highlightthickness=0, relief='ridge')
@@ -190,8 +193,35 @@ class FrameWidgets(ttk.Frame):
self.btn_exp = tk.Button(self.lb_frame_btn_lbox, image=self.exp_pic, bd=0, command=ExportTunnels.wg_export)
self.btn_exp.grid(column=0, row=3, padx=15, pady=8)
+ # Label Entry
+ self.lb_rename = ttk.Entry(self, width=45)
+ self.lb_rename.grid(column=2, row=4, padx=30, pady=15, sticky='snw')
+ self.lb_rename.insert(0, 'Max. 12 characters without blanks!')
+ self.lb_rename.config(state='disable')
+
+ def tl_rename():
+ try:
+ self.select_tunnel = self.l_box.curselection()
+ select_tl = self.l_box.get(self.select_tunnel[0])
+ # nmcli connection modify old connection.id iphone
+ check_call(['nmcli', 'connection', 'modify', select_tl, 'connection.id', self.lb_rename.get()])
+ source = Path('/etc/wire_py') / str(select_tl + '.conf')
+ destination = source.with_name(str(self.lb_rename.get() + '.conf'))
+ source.replace(destination)
+ self.l_box.delete(self.select_tunnel[0])
+ self.l_box.insert("end", self.lb_rename.get())
+ self.l_box.update()
+ self.lb_rename.delete(0, tk.END)
+ if self.a != '' and self.a == select_tl:
+ self.a = TunnelActiv.active()
+ self.StrVar.set(value=self.a)
+
+ return select_tl
+ except IndexError:
+ pass
+
# Button Rename
- self.btn_rename = ttk.Button(self, text='Rename')
+ self.btn_rename = ttk.Button(self, text='Rename', state='disable', command=tl_rename)
self.btn_rename.grid(column=2, row=4, padx=20, pady=15, sticky='e')
# Check Buttons