diff --git a/nwg_panel/config.py b/nwg_panel/config.py
index 344e6fc..6307784 100644
--- a/nwg_panel/config.py
+++ b/nwg_panel/config.py
@@ -444,7 +444,7 @@ class EditorWrapper(object):
builder.add_from_file(os.path.join(dir_name, "glade/config_main.glade"))
self.window = builder.get_object("main-window")
- self.window.set_transient_for(parent)
+ #self.window.set_transient_for(parent)
self.window.set_keep_above(True)
self.window.set_type_hint(Gdk.WindowTypeHint.DIALOG)
self.window.connect('destroy', self.show_parent, parent)
@@ -1932,6 +1932,16 @@ class EditorWrapper(object):
update_icon(self.button_icon, self.panel["icons"])
self.button_icon.connect("changed", update_icon, self.panel["icons"])
+ self.button_picker = builder.get_object("btn-picker")
+ img = Gtk.Image.new_from_icon_name("nwg-icon-picker", Gtk.IconSize.BUTTON)
+ self.button_picker.set_image(img)
+
+ if is_command("nwg-icon-picker"):
+ self.button_picker.set_tooltip_text("Pick an icon")
+ self.button_picker.connect("clicked", on_pick_btn, self.button_icon)
+ else:
+ self.button_picker.hide()
+
self.button_label = builder.get_object("label")
self.button_label.set_text(settings["label"])
@@ -2353,6 +2363,12 @@ class EditorWrapper(object):
self.scrolled_window.add(custom_items_grid)
+def on_pick_btn(btn, entry):
+ s = cmd2string("nwg-icon-picker")
+ if s:
+ entry.set_text(s)
+
+
class ControlsCustomItems(Gtk.Frame):
def __init__(self, panel, config, file):
check_key(panel, "controls-settings", {})
@@ -2375,7 +2391,6 @@ class ControlsCustomItems(Gtk.Frame):
self.refresh()
def refresh(self):
-
listbox = Gtk.ListBox()
listbox.set_selection_mode(Gtk.SelectionMode.NONE)
for i in range(len(self.items)):
@@ -2400,6 +2415,12 @@ class ControlsCustomItems(Gtk.Frame):
entry.connect("changed", self.update_icon, self.icons, i, "icon")
hbox.pack_start(entry, False, False, 0)
+ if is_command("nwg-icon-picker"):
+ btn = Gtk.Button.new_from_icon_name("nwg-icon-picker", Gtk.IconSize.MENU)
+ btn.set_tooltip_text("Pick an icon")
+ btn.connect("clicked", on_pick_btn, entry)
+ hbox.pack_start(btn, False, False, 0)
+
entry = Gtk.Entry()
entry.set_width_chars(15)
entry.set_text(item["cmd"])
@@ -2444,6 +2465,12 @@ class ControlsCustomItems(Gtk.Frame):
self.new_icon.connect("changed", update_icon, self.icons)
hbox.pack_start(self.new_icon, False, False, 0)
+ if is_command("nwg-icon-picker"):
+ btn = Gtk.Button.new_from_icon_name("nwg-icon-picker", Gtk.IconSize.MENU)
+ btn.set_tooltip_text("Pick an icon")
+ btn.connect("clicked", on_pick_btn, self.new_icon)
+ hbox.pack_start(btn, False, False, 0)
+
self.new_command = Gtk.Entry()
self.new_command.set_width_chars(15)
self.new_command.set_placeholder_text("command")
diff --git a/nwg_panel/glade/config_button.glade b/nwg_panel/glade/config_button.glade
index cbfd3d9..1edd130 100644
--- a/nwg_panel/glade/config_button.glade
+++ b/nwg_panel/glade/config_button.glade
@@ -179,6 +179,7 @@
False
Attention! Renaming an existing
button will create a new one.
+ start
gtk-dialog-warning
@@ -232,6 +233,23 @@ button will create a new one.
1
+
+
+
+ 2
+ 3
+
+
diff --git a/nwg_panel/main.py b/nwg_panel/main.py
index b89fe2a..1b056eb 100644
--- a/nwg_panel/main.py
+++ b/nwg_panel/main.py
@@ -240,6 +240,37 @@ def instantiate_content(panel, container, content_list, icons_path=""):
def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-c",
+ "--config",
+ type=str,
+ default="config",
+ help="config filename (in {}/)".format(common.config_dir))
+
+ parser.add_argument("-s",
+ "--style",
+ type=str,
+ default="style.css",
+ help="css filename (in {}/)".format(common.config_dir))
+
+ parser.add_argument("-sigdwl",
+ type=int,
+ default=10,
+ help="signal to refresh dwl-tags module; default: 10 (SIGUSR1)")
+
+ parser.add_argument("-r",
+ "--restore",
+ action="store_true",
+ help="restore default config files")
+
+ parser.add_argument("-v",
+ "--version",
+ action="version",
+ version="%(prog)s version {}".format(__version__),
+ help="display version information")
+
+ args = parser.parse_args()
+
# Kill running instances, if any
own_pid = os.getpid()
# We should never have more that 1, but just in case
@@ -285,37 +316,6 @@ def main():
else:
print("Couldn't determine cache directory", file=sys.stderr)
- parser = argparse.ArgumentParser()
- parser.add_argument("-c",
- "--config",
- type=str,
- default="config",
- help="config filename (in {}/)".format(common.config_dir))
-
- parser.add_argument("-s",
- "--style",
- type=str,
- default="style.css",
- help="css filename (in {}/)".format(common.config_dir))
-
- parser.add_argument("-sigdwl",
- type=int,
- default=10,
- help="signal to refresh dwl-tags module; default: 10 (SIGUSR1)")
-
- parser.add_argument("-r",
- "--restore",
- action="store_true",
- help="restore default config files")
-
- parser.add_argument("-v",
- "--version",
- action="version",
- version="%(prog)s version {}".format(__version__),
- help="display version information")
-
- args = parser.parse_args()
-
global sig_dwl
sig_dwl = args.sigdwl
diff --git a/setup.py b/setup.py
index 40d5db0..5418e39 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ def read(f_name):
setup(
name='nwg-panel',
- version='0.6.4',
+ version='0.6.5',
description='GTK3-based panel for sway window manager',
packages=find_packages(),
include_package_data=True,