@@ -9,8 +9,8 @@ import signal
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, Gdk, GLib
|
||||
|
||||
from nwg_panel.tools import get_config_dir, load_json, save_json, load_string, list_outputs, check_key, list_configs, \
|
||||
local_dir, create_pixbuf, update_image, is_command, check_commands, cmd2string
|
||||
from nwg_panel.tools import get_config_dir, local_dir, load_json, save_json, load_string, list_outputs, check_key, \
|
||||
list_configs, create_pixbuf, update_image, is_command, check_commands, cmd2string
|
||||
|
||||
from nwg_panel.__about__ import __version__
|
||||
|
||||
@@ -169,7 +169,8 @@ class PanelSelector(Gtk.Window):
|
||||
|
||||
label = Gtk.Label()
|
||||
status = cmd2string("nwg-menu -v") if self.plugin_menu_start else "not installed"
|
||||
label.set_markup('MenuStart plugin: {} <a href="https://github.com/nwg-piotr/nwg-menu">GitHub</a>'.format(status))
|
||||
label.set_markup(
|
||||
'MenuStart plugin: {} <a href="https://github.com/nwg-piotr/nwg-menu">GitHub</a>'.format(status))
|
||||
ivbox.pack_start(label, True, False, 0)
|
||||
|
||||
self.scrolled_window = Gtk.ScrolledWindow()
|
||||
@@ -431,6 +432,9 @@ class EditorWrapper(object):
|
||||
self.panel_idx = panel_idx
|
||||
self.config = {}
|
||||
self.panel = {}
|
||||
self.executors_base = {}
|
||||
self.executors_file = os.path.join(local_dir(), "executors.json")
|
||||
self.executors_base = load_json(self.executors_file) if os.path.isfile(self.executors_file) else {}
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(os.path.join(dir_name, "glade/config_main.glade"))
|
||||
|
||||
@@ -442,7 +446,7 @@ class EditorWrapper(object):
|
||||
self.window.connect("key-release-event", handle_keyboard)
|
||||
self.window.connect("show", self.hide_parent, parent)
|
||||
|
||||
Gtk.Widget.set_size_request(self.window, 840, 1)
|
||||
Gtk.Widget.set_size_request(self.window, 720, 1)
|
||||
|
||||
self.known_modules = ["clock", "playerctl", "sway-taskbar", "sway-workspaces", "scratchpad"]
|
||||
|
||||
@@ -469,7 +473,7 @@ class EditorWrapper(object):
|
||||
else:
|
||||
btn.set_sensitive(False)
|
||||
btn.set_tooltip_text("Plugin not found")
|
||||
|
||||
|
||||
btn = builder.get_object("btn-clock")
|
||||
btn.connect("clicked", self.edit_clock)
|
||||
|
||||
@@ -1147,7 +1151,7 @@ class EditorWrapper(object):
|
||||
adj = Gtk.Adjustment(value=0, lower=8, upper=129, step_increment=1, page_increment=10, page_size=1)
|
||||
self.ws_image_size.configure(adj, 1, 0)
|
||||
self.ws_image_size.set_value(settings["image-size"])
|
||||
|
||||
|
||||
self.ws_name_length = builder.get_object("name-length")
|
||||
self.ws_name_length.set_numeric(True)
|
||||
adj = Gtk.Adjustment(value=0, lower=1, upper=256, step_increment=1, page_increment=10, page_size=1)
|
||||
@@ -1177,7 +1181,7 @@ class EditorWrapper(object):
|
||||
val = self.ws_show_icon.get_active()
|
||||
if val is not None:
|
||||
settings["show-icon"] = val
|
||||
|
||||
|
||||
val = self.ws_show_name.get_active()
|
||||
if val is not None:
|
||||
settings["show-name"] = val
|
||||
@@ -1314,7 +1318,7 @@ class EditorWrapper(object):
|
||||
for item in self.scrolled_window.get_children():
|
||||
item.destroy()
|
||||
self.scrolled_window.add(grid)
|
||||
|
||||
|
||||
def update_menu_start(self):
|
||||
settings = self.panel["menu-start-settings"]
|
||||
|
||||
@@ -1358,7 +1362,7 @@ class EditorWrapper(object):
|
||||
settings["autohide"] = val
|
||||
|
||||
save_json(self.config, self.file)
|
||||
|
||||
|
||||
def edit_scratchpad(self, *args):
|
||||
self.load_panel()
|
||||
self.edited = "scratchpad"
|
||||
@@ -1446,6 +1450,11 @@ class EditorWrapper(object):
|
||||
item = Gtk.MenuItem.new_with_label("Add new")
|
||||
menu.append(item)
|
||||
item.connect("activate", self.edit_executor, "executor-unnamed_{}".format(len(executors) + 1), True)
|
||||
if self.executors_base:
|
||||
item = Gtk.MenuItem.new_with_label("Database")
|
||||
item.connect("activate", self.import_executor)
|
||||
menu.append(item)
|
||||
|
||||
menu.show_all()
|
||||
menu.popup_at_widget(btn, Gdk.Gravity.EAST, Gdk.Gravity.WEST, None)
|
||||
|
||||
@@ -1520,12 +1529,33 @@ class EditorWrapper(object):
|
||||
self.executor_interval.set_value(settings["interval"])
|
||||
|
||||
self.executor_remove = builder.get_object("remove")
|
||||
self.executor_remove.set_sensitive(name in self.panel)
|
||||
|
||||
self.executor_save_to_db_btn = builder.get_object("save-to-database")
|
||||
self.executor_save_to_db_btn.connect("clicked", self.check_and_save_to_db, name, settings)
|
||||
if new:
|
||||
self.executor_remove.set_visible(False)
|
||||
self.executor_save_to_db_btn.set_visible(False)
|
||||
|
||||
for item in self.scrolled_window.get_children():
|
||||
item.destroy()
|
||||
self.scrolled_window.add(grid)
|
||||
|
||||
def check_and_save_to_db(self, btn, name, settings):
|
||||
if name not in self.executors_base:
|
||||
self.save_executor_to_db(btn, name, settings)
|
||||
else:
|
||||
menu = Gtk.Menu()
|
||||
item = Gtk.MenuItem.new_with_label("Replace '{}' in database".format(name))
|
||||
item.connect("activate", self.save_executor_to_db, name, settings)
|
||||
menu.append(item)
|
||||
menu.set_reserve_toggle_size(False)
|
||||
menu.show_all()
|
||||
menu.popup_at_widget(btn, Gdk.Gravity.NORTH, Gdk.Gravity.SOUTH, None)
|
||||
|
||||
def save_executor_to_db(self, widget, name, settings):
|
||||
self.executors_base[name] = settings
|
||||
save_json(self.executors_base, self.executors_file)
|
||||
|
||||
def update_executor(self):
|
||||
config_key = "executor-{}".format(self.executor_name.get_text())
|
||||
settings = self.panel[config_key] if config_key in self.panel else {}
|
||||
@@ -1582,6 +1612,97 @@ class EditorWrapper(object):
|
||||
|
||||
save_json(self.config, self.file)
|
||||
|
||||
def import_executor(self, item):
|
||||
builder = Gtk.Builder.new_from_file(os.path.join(dir_name, "glade/executor_import.glade"))
|
||||
grid = builder.get_object("grid")
|
||||
|
||||
for item in self.scrolled_window.get_children():
|
||||
item.destroy()
|
||||
self.scrolled_window.add(grid)
|
||||
|
||||
self.ie_combo = builder.get_object("select")
|
||||
for key in self.executors_base:
|
||||
self.ie_combo.append(key, key)
|
||||
self.ie_combo.connect("changed", self.ie_on_combo_changed, self.executors_base)
|
||||
|
||||
self.ie_script = builder.get_object("script")
|
||||
self.ie_interval = builder.get_object("interval")
|
||||
self.ie_icon_size = builder.get_object("icon-size")
|
||||
self.ie_on_left_click = builder.get_object("on-left-click")
|
||||
self.ie_on_middle_click = builder.get_object("on-middle-click")
|
||||
self.ie_on_right_click = builder.get_object("on-right-click")
|
||||
self.ie_on_scroll_up = builder.get_object("on-scroll-up")
|
||||
self.ie_on_scroll_down = builder.get_object("on-scroll-down")
|
||||
self.ie_tooltip_text = builder.get_object("tooltip-text")
|
||||
self.ie_icon_placement = builder.get_object("icon-placement")
|
||||
self.ie_css_name = builder.get_object("css-name")
|
||||
|
||||
self.ie_btn_delete = builder.get_object("btn-delete")
|
||||
self.ie_btn_delete.connect("clicked", self.ie_show_btn_delete_menu)
|
||||
self.ie_btn_import = builder.get_object("btn-import")
|
||||
self.ie_btn_import.set_label("Add to '{}'".format(self.panel["name"]))
|
||||
self.ie_btn_import.connect("clicked", self.ie_on_import_btn)
|
||||
|
||||
def ie_on_import_btn(self, btn):
|
||||
executor = self.ie_combo.get_active_text()
|
||||
if executor not in self.panel:
|
||||
self.ie_add_executor(btn, executor)
|
||||
else:
|
||||
self.ie_show_btn_import_menu(btn)
|
||||
|
||||
def ie_show_btn_import_menu(self, btn):
|
||||
executor = self.ie_combo.get_active_text()
|
||||
menu = Gtk.Menu()
|
||||
item = Gtk.MenuItem.new_with_label("Replace '{}' in '{}'".format(executor, self.panel["name"]))
|
||||
item.connect("activate", self.ie_add_executor, executor)
|
||||
menu.append(item)
|
||||
menu.set_reserve_toggle_size(False)
|
||||
menu.show_all()
|
||||
menu.popup_at_widget(btn, Gdk.Gravity.NORTH, Gdk.Gravity.SOUTH, None)
|
||||
|
||||
def ie_show_btn_delete_menu(self, btn):
|
||||
executor = self.ie_combo.get_active_text()
|
||||
menu = Gtk.Menu()
|
||||
item = Gtk.MenuItem.new_with_label("Delete '{}' from database".format(executor))
|
||||
item.connect("activate", self.ie_remove_executor, executor)
|
||||
menu.append(item)
|
||||
menu.set_reserve_toggle_size(False)
|
||||
menu.show_all()
|
||||
menu.popup_at_widget(btn, Gdk.Gravity.NORTH, Gdk.Gravity.SOUTH, None)
|
||||
|
||||
def ie_add_executor(self, widget, executor):
|
||||
self.panel[executor] = self.executors_base[executor].copy()
|
||||
save_json(self.config, self.file)
|
||||
|
||||
def ie_remove_executor(self, item, executor):
|
||||
del self.executors_base[executor]
|
||||
self.ie_combo.remove_all()
|
||||
for key in self.executors_base:
|
||||
self.ie_combo.append(key, key)
|
||||
for label in [self.ie_script, self.ie_interval, self.ie_icon_size, self.ie_on_left_click,
|
||||
self.ie_on_middle_click, self.ie_on_right_click, self.ie_on_scroll_up, self.ie_on_scroll_down,
|
||||
self.ie_tooltip_text, self.ie_icon_placement, self.ie_css_name]:
|
||||
label.set_text("")
|
||||
save_json(self.executors_base, self.executors_file)
|
||||
|
||||
def ie_on_combo_changed(self, combo, executors):
|
||||
executor = combo.get_active_text()
|
||||
if executor:
|
||||
self.ie_script.set_text(executors[executor]["script"])
|
||||
self.ie_interval.set_text(str(executors[executor]["interval"]))
|
||||
self.ie_icon_size.set_text(str(executors[executor]["icon-size"]))
|
||||
self.ie_on_left_click.set_text(executors[executor]["on-left-click"])
|
||||
self.ie_on_middle_click.set_text(executors[executor]["on-middle-click"])
|
||||
self.ie_on_right_click.set_text(executors[executor]["on-right-click"])
|
||||
self.ie_on_scroll_up.set_text(executors[executor]["on-scroll-up"])
|
||||
self.ie_on_scroll_down.set_text(executors[executor]["on-scroll-down"])
|
||||
self.ie_tooltip_text.set_text(executors[executor]["tooltip-text"])
|
||||
self.ie_icon_placement.set_text(executors[executor]["icon-placement"])
|
||||
self.ie_css_name.set_text(executors[executor]["css-name"])
|
||||
|
||||
self.ie_btn_delete.set_sensitive(True)
|
||||
self.ie_btn_import.set_sensitive(True)
|
||||
|
||||
def select_button(self, btn):
|
||||
self.edited = "buttons"
|
||||
menu = Gtk.Menu()
|
||||
|
@@ -228,6 +228,9 @@ button will create a new one.</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Module :: Button</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<!-- n-columns=3 n-rows=10 -->
|
||||
<!-- n-columns=3 n-rows=11 -->
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
@@ -235,6 +235,9 @@
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Module :: Clock</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
@@ -281,5 +284,8 @@
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
@@ -243,6 +243,9 @@ Depends on `python-netifaces`.</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Controls :: Settings</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
|
@@ -14,6 +14,9 @@
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Module :: Dwl Tags</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<!-- n-columns=3 n-rows=14 -->
|
||||
<!-- n-columns=3 n-rows=15 -->
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="column-spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="css-name">
|
||||
@@ -287,6 +287,9 @@ executor will create a new one.</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Module :: Executor</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
@@ -296,7 +299,7 @@ executor will create a new one.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="remove">
|
||||
<property name="label" translatable="yes">Remove this executor</property>
|
||||
<property name="label" translatable="yes">Remove executor</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
@@ -305,7 +308,6 @@ executor will create a new one.</property>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">14</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -378,6 +380,21 @@ executor will create a new one.</property>
|
||||
<property name="top-attach">11</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="save-to-database">
|
||||
<property name="label" translatable="yes">Save to database</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">14</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
@@ -4,6 +4,7 @@
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<object class="GtkWindow" id="main-window">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="decorated">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
@@ -207,7 +208,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">20</property>
|
||||
<property name="padding">10</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
@@ -232,7 +233,7 @@
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">20</property>
|
||||
<property name="padding">10</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
@@ -248,7 +249,7 @@
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="btn-apply-restart">
|
||||
<property name="label">Apply &restart</property>
|
||||
<property name="label">Save & restart</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
@@ -276,7 +277,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="btn-apply">
|
||||
<property name="label">Apply changes</property>
|
||||
<property name="label">Apply</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
@@ -301,7 +302,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">10</property>
|
||||
<property name="padding">6</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@@ -6,14 +6,17 @@
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="column-spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Plugins::MenuStart</property>
|
||||
<property name="label" translatable="yes">Plugins :: MenuStart</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
|
@@ -48,6 +48,9 @@
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Modules :: </property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="column-spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
|
@@ -174,6 +174,9 @@
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Module :: Playerctl</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
|
@@ -14,6 +14,9 @@
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Module :: Scratchpad</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
|
@@ -217,6 +217,9 @@ context menu out of them.</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Module :: SwayTaskbar</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
@@ -245,8 +248,5 @@ context menu out of them.</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
@@ -50,6 +50,9 @@ of workspaces to show</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Module :: SwayWorkspaces</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
|
389
nwg_panel/glade/executor_import.glade
Normal file
389
nwg_panel/glade/executor_import.glade
Normal file
@@ -0,0 +1,389 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<!-- n-columns=2 n-rows=14 -->
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-end">12</property>
|
||||
<property name="label" translatable="yes">Executors :: Database</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="spacing">10</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="btn-delete">
|
||||
<property name="label" translatable="yes">Delete from database</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="btn-import">
|
||||
<property name="label" translatable="yes">Add to panel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">13</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="css-name">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">12</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">css-name:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">12</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="icon-placement">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">11</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">icon-placement:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">11</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tooltip-text">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap-mode">word-char</property>
|
||||
<property name="max-width-chars">35</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">10</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">tooltip-text:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">10</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="on-scroll-down">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap-mode">word-char</property>
|
||||
<property name="max-width-chars">35</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">9</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">on-scroll-down:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">9</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="on-scroll-up">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap-mode">word-char</property>
|
||||
<property name="max-width-chars">35</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">on-scroll-up:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="on-right-click">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap-mode">word-char</property>
|
||||
<property name="max-width-chars">35</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">on-right-click:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="on-middle-click">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap-mode">word-char</property>
|
||||
<property name="max-width-chars">35</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">on-middle-click:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="on-left-click">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap-mode">word-char</property>
|
||||
<property name="max-width-chars">35</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">on-left-click:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="icon-size">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">icon-size:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="interval">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">interval:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="script">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap-mode">word-char</property>
|
||||
<property name="max-width-chars">35</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="label" translatable="yes">script:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="select">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">select executor</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="active">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
109
nwg_panel/local/executors.json
Normal file
109
nwg_panel/local/executors.json
Normal file
@@ -0,0 +1,109 @@
|
||||
{
|
||||
"executor-cpuav": {
|
||||
"script": "gopsuinfo -i a",
|
||||
"interval": 2,
|
||||
"tooltip-text": "CPU average load",
|
||||
"on-left-click": "alacritty -e htop",
|
||||
"on-middle-click": "",
|
||||
"on-right-click": "",
|
||||
"on-scroll-up": "",
|
||||
"on-scroll-down": "",
|
||||
"css-name": "",
|
||||
"icon-size": 16,
|
||||
"icon-placement": "right"
|
||||
},
|
||||
"executor-cpubar": {
|
||||
"script": "gopsuinfo -c g",
|
||||
"interval": 2,
|
||||
"tooltip-text": "",
|
||||
"on-left-click": "",
|
||||
"on-middle-click": "",
|
||||
"on-right-click": "",
|
||||
"on-scroll-up": "",
|
||||
"on-scroll-down": "",
|
||||
"css-name": "",
|
||||
"icon-size": 16,
|
||||
"icon-placement": "left"
|
||||
},
|
||||
"executor-temp": {
|
||||
"script": "gopsuinfo -i t",
|
||||
"interval": 5,
|
||||
"tooltip-text": "",
|
||||
"on-left-click": "",
|
||||
"on-middle-click": "",
|
||||
"on-right-click": "",
|
||||
"on-scroll-up": "",
|
||||
"on-scroll-down": "",
|
||||
"css-name": "",
|
||||
"icon-size": 16,
|
||||
"icon-placement": "left"
|
||||
},
|
||||
"executor-memory": {
|
||||
"script": "gopsuinfo -i m",
|
||||
"interval": 5,
|
||||
"tooltip-text": "",
|
||||
"on-left-click": "",
|
||||
"on-middle-click": "",
|
||||
"on-right-click": "",
|
||||
"on-scroll-up": "",
|
||||
"on-scroll-down": "",
|
||||
"css-name": "",
|
||||
"icon-size": 16,
|
||||
"icon-placement": "left"
|
||||
},
|
||||
"executor-drives": {
|
||||
"script": "gopsuinfo -i n",
|
||||
"interval": 15,
|
||||
"tooltip-text": "",
|
||||
"on-left-click": "",
|
||||
"on-middle-click": "",
|
||||
"on-right-click": "",
|
||||
"on-scroll-up": "",
|
||||
"on-scroll-down": "",
|
||||
"css-name": "",
|
||||
"icon-size": 16,
|
||||
"icon-placement": "left"
|
||||
},
|
||||
"executor-uptime": {
|
||||
"script": "gopsuinfo -i u",
|
||||
"interval": 60,
|
||||
"tooltip-text": "",
|
||||
"on-left-click": "",
|
||||
"on-middle-click": "",
|
||||
"on-right-click": "",
|
||||
"on-scroll-up": "",
|
||||
"on-scroll-down": "",
|
||||
"css-name": "",
|
||||
"icon-size": 16,
|
||||
"icon-placement": "left"
|
||||
},
|
||||
"executor-weather": {
|
||||
"script": "curl https://wttr.in/?format=1 -s",
|
||||
"interval": 1800,
|
||||
"css-name": "weather",
|
||||
"on-right-click": "",
|
||||
"icon-size": 16,
|
||||
"show-icon": true,
|
||||
"tooltip-text": "",
|
||||
"on-left-click": "",
|
||||
"on-middle-click": "",
|
||||
"on-scroll-up": "",
|
||||
"on-scroll-down": "",
|
||||
"root-css-name": "",
|
||||
"icon-placement": "left"
|
||||
},
|
||||
"executor-updates": {
|
||||
"script": "sway-check-updates",
|
||||
"interval": 900,
|
||||
"icon-size": 16,
|
||||
"on-left-click": "foot sway-update",
|
||||
"tooltip-text": "",
|
||||
"on-middle-click": "",
|
||||
"on-right-click": "",
|
||||
"on-scroll-up": "",
|
||||
"on-scroll-down": "",
|
||||
"css-name": "",
|
||||
"root-css-name": "",
|
||||
"icon-placement": "left"
|
||||
}
|
||||
}
|
@@ -260,12 +260,6 @@ def main():
|
||||
global sig_dwl
|
||||
sig_dwl = args.sigdwl
|
||||
|
||||
"""# signal handlers
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
# Will do nothing if no dwl-tags instance found
|
||||
signal.signal(args.sigdwl, refresh_dwl)"""
|
||||
|
||||
catchable_sigs = set(signal.Signals) - {signal.SIGKILL, signal.SIGSTOP}
|
||||
for sig in catchable_sigs:
|
||||
signal.signal(sig, signal_handler)
|
||||
@@ -298,6 +292,7 @@ def main():
|
||||
copy_files(os.path.join(dir_name, "icons_dark"), os.path.join(common.config_dir, "icons_dark"))
|
||||
copy_executors(os.path.join(dir_name, "executors"), os.path.join(common.config_dir, "executors"))
|
||||
copy_files(os.path.join(dir_name, "config"), common.config_dir, args.restore)
|
||||
copy_files(os.path.join(dir_name, "local"), local_dir())
|
||||
|
||||
tree = common.i3.get_tree() if sway else None
|
||||
common.outputs = list_outputs(sway=sway, tree=tree)
|
||||
@@ -320,7 +315,7 @@ def main():
|
||||
check_key(panel, "output", "")
|
||||
|
||||
clones = []
|
||||
if panel["output"] == "All" and len(common.outputs) > 1:
|
||||
if panel["output"] == "All" and len(common.outputs) >= 1:
|
||||
to_remove.append(panel)
|
||||
for key in common.outputs.keys():
|
||||
clone = panel.copy()
|
||||
|
4
setup.py
4
setup.py
@@ -8,12 +8,12 @@ def read(f_name):
|
||||
|
||||
setup(
|
||||
name='nwg-panel',
|
||||
version='0.5.6',
|
||||
version='0.5.7',
|
||||
description='GTK3-based panel for sway window manager',
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
package_data={
|
||||
"": ["config/*", "icons_dark/*", "icons_light/*", "executors/*"]
|
||||
"": ["config/*", "icons_dark/*", "icons_light/*", "executors/*", "local/*"]
|
||||
},
|
||||
url='https://github.com/nwg-piotr/nwg-panel',
|
||||
license='MIT',
|
||||
|
Reference in New Issue
Block a user