diff --git a/nwg_panel/common.py b/nwg_panel/common.py
index f02d10f1..482652e2 100644
--- a/nwg_panel/common.py
+++ b/nwg_panel/common.py
@@ -26,10 +26,8 @@
"pamixer": False,
"pactl": False,
"playerctl": False,
- "netifaces": False,
- "btmgmt": False,
"wlr-randr": False,
- "hyprctl":False,
+ "hyprctl": False,
"upower": False,
"swaync": False
}
diff --git a/nwg_panel/config.py b/nwg_panel/config.py
index a88315d9..d50dd5f0 100644
--- a/nwg_panel/config.py
+++ b/nwg_panel/config.py
@@ -67,8 +67,8 @@
"modules-center": [],
"modules-right": [],
"controls-settings": {
- "components": ["net", "brightness", "volume", "battery"],
- "commands": {"net": "", "bluetooth": "", "battery": ""},
+ "components": ["brightness", "volume", "battery"],
+ "commands": {"battery": ""},
"show-values": False,
"interval": 1,
"icon-size": 16,
@@ -77,7 +77,6 @@
"click-closes": False,
"root-css-name": "controls-overview",
"css-name": "controls-window",
- "net-interface": "",
"battery-low-level": 20,
"battery-low-interval": 3,
"custom-items": [{"name": "Panel settings", "icon": "nwg-panel", "cmd": "nwg-panel-config"}],
@@ -3463,7 +3462,6 @@ def edit_controls(self, *args):
settings = self.panel["controls-settings"]
defaults = {
"components": [
- "net",
"brightness",
"volume",
"battery",
@@ -3485,7 +3483,6 @@ def edit_controls(self, *args):
"click-closes": False,
"root-css-name": "controls-overview",
"css-name": "controls-window",
- "net-interface": "",
"battery-low-level": 20,
"battery-low-interval": 3,
"processes-label": voc["processes"],
@@ -3551,20 +3548,6 @@ def edit_controls(self, *args):
self.ctrl_comp_switcher.set_sensitive(is_command("pamixer"))
self.ctrl_comp_switcher.set_active(settings["output-switcher"])
- self.ctrl_comp_net = builder.get_object("ctrl-comp-net")
- self.ctrl_comp_net.set_label(voc["network-interface"])
- self.ctrl_comp_net.set_tooltip_text(voc["network-interface-tooltip"])
- self.ctrl_comp_net.set_active("net" in settings["components"])
-
- self.ctrl_comp_bluetooth = builder.get_object("ctrl-comp-bluetooth")
- self.ctrl_comp_bluetooth.set_label(voc["bluetooth"])
- self.ctrl_comp_bluetooth.set_tooltip_text(voc["bluetooth-tooltip"])
- if is_command("btmgmt"):
- self.ctrl_comp_bluetooth.set_active("bluetooth" in settings["components"])
- else:
- self.ctrl_comp_bluetooth.set_active(False)
- self.ctrl_comp_bluetooth.set_sensitive(False)
-
self.ctrl_comp_battery = builder.get_object("ctrl-comp-battery")
self.ctrl_comp_battery.set_label(voc["battery"])
self.ctrl_comp_battery.set_tooltip_text(voc["battery-tooltip"])
@@ -3601,20 +3584,6 @@ def edit_controls(self, *args):
lbl = builder.get_object("lbl-css-name")
lbl.set_text("{}:".format(voc["css-name"]))
- self.ctrl_cdm_net = builder.get_object("ctrl-cmd-net")
- self.ctrl_cdm_net.set_placeholder_text(voc["on-click-command"])
- check_key(settings["commands"], "net", "")
- self.ctrl_cdm_net.set_text(settings["commands"]["net"])
-
- self.ctrl_net_name = builder.get_object("ctrl-net-name")
- self.ctrl_net_name.set_placeholder_text(voc["name"])
- self.ctrl_net_name.set_text(settings["net-interface"])
-
- self.ctrl_cdm_bluetooth = builder.get_object("ctrl-cmd-bluetooth")
- self.ctrl_cdm_bluetooth.set_placeholder_text(voc["on-click-command"])
- check_key(settings["commands"], "bluetooth", "")
- self.ctrl_cdm_bluetooth.set_text(settings["commands"]["bluetooth"])
-
self.ctrl_cdm_battery = builder.get_object("ctrl-cmd-battery")
self.ctrl_cdm_battery.set_placeholder_text(voc["on-click-command"])
check_key(settings["commands"], "battery", "")
@@ -3713,20 +3682,6 @@ def update_controls(self):
settings["output-switcher"] = self.ctrl_comp_switcher.get_active()
- if self.ctrl_comp_net.get_active():
- if "net" not in settings["components"]:
- settings["components"].append("net")
- else:
- if "net" in settings["components"]:
- settings["components"].remove("net")
-
- if self.ctrl_comp_bluetooth.get_active():
- if "bluetooth" not in settings["components"]:
- settings["components"].append("bluetooth")
- else:
- if "bluetooth" in settings["components"]:
- settings["components"].remove("bluetooth")
-
if self.ctrl_comp_battery.get_active():
if "battery" not in settings["components"]:
settings["components"].append("battery")
@@ -3741,9 +3696,6 @@ def update_controls(self):
if "processes" in settings["components"]:
settings["components"].remove("processes")
- settings["commands"]["net"] = self.ctrl_cdm_net.get_text()
- settings["net-interface"] = self.ctrl_net_name.get_text()
- settings["commands"]["bluetooth"] = self.ctrl_cdm_bluetooth.get_text()
settings["commands"]["battery"] = self.ctrl_cdm_battery.get_text()
settings["processes-label"] = self.ctrl_comp_processes_label.get_text()
settings["root-css-name"] = self.ctrl_root_css_name.get_text()
diff --git a/nwg_panel/config/config b/nwg_panel/config/config
index df11e4bf..4659b823 100644
--- a/nwg_panel/config/config
+++ b/nwg_panel/config/config
@@ -31,8 +31,6 @@
"battery"
],
"commands": {
- "net": "",
- "bluetooth": "",
"battery": ""
},
"show-values": false,
@@ -42,7 +40,6 @@
"leave-closes": true,
"click-closes": false,
"css-name": "controls-window",
- "net-interface": "",
"custom-items": [
{
"name": "Panel settings",
@@ -167,14 +164,11 @@
],
"controls-settings": {
"components": [
- "net",
"brightness",
"volume",
"battery"
],
"commands": {
- "net": "",
- "bluetooth": "",
"battery": ""
},
"show-values": false,
@@ -184,7 +178,6 @@
"leave-closes": true,
"click-closes": false,
"css-name": "controls-window",
- "net-interface": "",
"custom-items": [
{
"name": "Panel settings",
@@ -268,4 +261,4 @@
"on-scroll-down": ""
}
}
-]
\ No newline at end of file
+]
diff --git a/nwg_panel/glade/config_controls.glade b/nwg_panel/glade/config_controls.glade
index 5124bfc6..dc0f0f09 100644
--- a/nwg_panel/glade/config_controls.glade
+++ b/nwg_panel/glade/config_controls.glade
@@ -8,7 +8,7 @@
0.5
out
-
+
-
-
-
- 0
- 2
-
-
-
-
-
- 2
- 2
-
-
-
-
-
- 3
- 2
-
-
-
-
-
- 0
- 3
-
-
-
-
-
- 2
- 3
-
-
0
- 4
+ 2
@@ -170,7 +108,7 @@
2
- 4
+ 2
@@ -182,7 +120,7 @@
0
- 5
+ 3
@@ -192,7 +130,7 @@
2
- 5
+ 3
@@ -207,7 +145,7 @@ values in the panel widget
0
- 16
+ 14
@@ -219,7 +157,7 @@ values in the panel widget
0
- 15
+ 13
@@ -236,7 +174,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 15
+ 13
@@ -248,7 +186,7 @@ the horizontal, in degrees, measured counterclockwise
0
- 14
+ 12
@@ -258,7 +196,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 14
+ 12
@@ -270,7 +208,7 @@ the horizontal, in degrees, measured counterclockwise
0
- 13
+ 11
@@ -280,7 +218,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 13
+ 11
@@ -292,7 +230,7 @@ the horizontal, in degrees, measured counterclockwise
0
- 12
+ 10
@@ -302,7 +240,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 12
+ 10
@@ -314,7 +252,7 @@ the horizontal, in degrees, measured counterclockwise
0
- 11
+ 9
@@ -324,7 +262,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 11
+ 9
@@ -336,7 +274,7 @@ the horizontal, in degrees, measured counterclockwise
0
- 10
+ 8
@@ -346,7 +284,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 10
+ 8
@@ -358,7 +296,7 @@ the horizontal, in degrees, measured counterclockwise
0
- 9
+ 7
@@ -369,7 +307,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 9
+ 7
@@ -381,7 +319,7 @@ the horizontal, in degrees, measured counterclockwise
0
- 8
+ 6
@@ -392,7 +330,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 8
+ 6
@@ -406,7 +344,7 @@ the horizontal, in degrees, measured counterclockwise
0
- 7
+ 5
@@ -418,7 +356,7 @@ the horizontal, in degrees, measured counterclockwise
0
- 6
+ 4
@@ -428,7 +366,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 6
+ 4
@@ -439,7 +377,7 @@ the horizontal, in degrees, measured counterclockwise
2
- 7
+ 5
@@ -454,7 +392,7 @@ window when left
0
- 17
+ 15
@@ -469,7 +407,7 @@ window on mouse click outside it
2
- 17
+ 15
@@ -484,7 +422,7 @@ on panel Controls widget pointed
2
- 16
+ 14
@@ -628,21 +566,6 @@ on panel Controls widget pointed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/nwg_panel/icons_dark/bluetooth-active-symbolic.svg b/nwg_panel/icons_dark/bluetooth-active-symbolic.svg
deleted file mode 100644
index 6521c5d3..00000000
--- a/nwg_panel/icons_dark/bluetooth-active-symbolic.svg
+++ /dev/null
@@ -1,206 +0,0 @@
-
-
diff --git a/nwg_panel/icons_dark/bluetooth-disabled-symbolic.svg b/nwg_panel/icons_dark/bluetooth-disabled-symbolic.svg
deleted file mode 100644
index e41de613..00000000
--- a/nwg_panel/icons_dark/bluetooth-disabled-symbolic.svg
+++ /dev/null
@@ -1,206 +0,0 @@
-
-
diff --git a/nwg_panel/icons_dark/network-wired-disconnected-symbolic.svg b/nwg_panel/icons_dark/network-wired-disconnected-symbolic.svg
deleted file mode 100644
index 24c2f696..00000000
--- a/nwg_panel/icons_dark/network-wired-disconnected-symbolic.svg
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
diff --git a/nwg_panel/icons_dark/network-wired-symbolic.svg b/nwg_panel/icons_dark/network-wired-symbolic.svg
deleted file mode 100644
index 06bf8fb9..00000000
--- a/nwg_panel/icons_dark/network-wired-symbolic.svg
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
diff --git a/nwg_panel/icons_dark/network-wireless-connected-symbolic.svg b/nwg_panel/icons_dark/network-wireless-connected-symbolic.svg
deleted file mode 100644
index 0780bd82..00000000
--- a/nwg_panel/icons_dark/network-wireless-connected-symbolic.svg
+++ /dev/null
@@ -1,221 +0,0 @@
-
-
diff --git a/nwg_panel/icons_dark/network-wireless-disconnected-symbolic.svg b/nwg_panel/icons_dark/network-wireless-disconnected-symbolic.svg
deleted file mode 100644
index 1c056492..00000000
--- a/nwg_panel/icons_dark/network-wireless-disconnected-symbolic.svg
+++ /dev/null
@@ -1,221 +0,0 @@
-
-
diff --git a/nwg_panel/icons_light/bluetooth-active-symbolic.svg b/nwg_panel/icons_light/bluetooth-active-symbolic.svg
deleted file mode 100644
index 8ec4a698..00000000
--- a/nwg_panel/icons_light/bluetooth-active-symbolic.svg
+++ /dev/null
@@ -1,206 +0,0 @@
-
-
diff --git a/nwg_panel/icons_light/bluetooth-disabled-symbolic.svg b/nwg_panel/icons_light/bluetooth-disabled-symbolic.svg
deleted file mode 100644
index 541b3cb6..00000000
--- a/nwg_panel/icons_light/bluetooth-disabled-symbolic.svg
+++ /dev/null
@@ -1,206 +0,0 @@
-
-
diff --git a/nwg_panel/icons_light/network-wired-disconnected-symbolic.svg b/nwg_panel/icons_light/network-wired-disconnected-symbolic.svg
deleted file mode 100644
index f48377ee..00000000
--- a/nwg_panel/icons_light/network-wired-disconnected-symbolic.svg
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
diff --git a/nwg_panel/icons_light/network-wired-symbolic.svg b/nwg_panel/icons_light/network-wired-symbolic.svg
deleted file mode 100644
index 03c758d5..00000000
--- a/nwg_panel/icons_light/network-wired-symbolic.svg
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
diff --git a/nwg_panel/icons_light/network-wireless-connected-symbolic.svg b/nwg_panel/icons_light/network-wireless-connected-symbolic.svg
deleted file mode 100644
index a3976e7b..00000000
--- a/nwg_panel/icons_light/network-wireless-connected-symbolic.svg
+++ /dev/null
@@ -1,221 +0,0 @@
-
-
diff --git a/nwg_panel/icons_light/network-wireless-disconnected-symbolic.svg b/nwg_panel/icons_light/network-wireless-disconnected-symbolic.svg
deleted file mode 100644
index 4546474b..00000000
--- a/nwg_panel/icons_light/network-wireless-disconnected-symbolic.svg
+++ /dev/null
@@ -1,221 +0,0 @@
-
-
diff --git a/nwg_panel/langs/en_US.json b/nwg_panel/langs/en_US.json
index 129c49ad..7bd59485 100644
--- a/nwg_panel/langs/en_US.json
+++ b/nwg_panel/langs/en_US.json
@@ -24,8 +24,6 @@
"battery-low-check-tooltip": "Set 0 to disable.",
"battery-low-notification": "Battery low notification at [%]",
"battery-tooltip": "Depends on `python-psutil`.",
- "bluetooth": "Bluetooth",
- "bluetooth-tooltip": "Depends on `bluez-utils`.",
"bottom-margin": "Bottom margin",
"brightness": "Brightness",
"brightness-slider": "Brightness slider",
@@ -131,8 +129,6 @@
"move-up": "move up",
"name": "Name",
"name-max-length": "Name max length",
- "network-interface": "Network interface",
- "network-interface-tooltip": "Network interface status;\nuse `ifconfig` to check names,\ne.g. `enp6s0`or `wlo1`.\nDepends on `python-netifaces`.",
"new": "New",
"new-file": "New file",
"new-panel-config-file-name": "New panel config file name",
diff --git a/nwg_panel/langs/pl_PL.json b/nwg_panel/langs/pl_PL.json
index e2f48276..9bc6972f 100644
--- a/nwg_panel/langs/pl_PL.json
+++ b/nwg_panel/langs/pl_PL.json
@@ -24,8 +24,6 @@
"battery-low-check-tooltip": "Ustaw 0 by wyłączyć.",
"battery-low-notification": "Alarmuj o słabej baterii przy [%]",
"battery-tooltip": "Zależy od paczki `python-psutil`.",
- "bluetooth": "Bluetooth",
- "bluetooth-tooltip": "Zależy od paczki `bluez-utils`.",
"bottom-margin": "Margines dolny",
"brightness": "Jasność",
"brightness-slider": "Suwak jasności",
@@ -131,8 +129,6 @@
"move-up": "przesuń w górę",
"name": "Nazwa",
"name-max-length": "Maks. długość nazwy",
- "network-interface": "Interface sieciowy",
- "network-interface-tooltip": "Status interfejsu sieciowego;\nużyj `ifconfig` by sprawdzić nazwę,\nn.p. `enp6s0` lub `wlo1`.\nZależy od pakietu `python-netifaces`.",
"new": "Nowy",
"new-file": "Nowy plik",
"new-panel-config-file-name": "Nazwa nowego pliku konfiguracyjnego panelu",
diff --git a/nwg_panel/modules/brightness_slider.py b/nwg_panel/modules/brightness_slider.py
index e2ff47ec..579f6410 100644
--- a/nwg_panel/modules/brightness_slider.py
+++ b/nwg_panel/modules/brightness_slider.py
@@ -7,7 +7,7 @@
gi.require_version('GtkLayerShell', '0.1')
from gi.repository import Gtk, Gdk, GLib, GtkLayerShell
-from nwg_panel.tools import check_key, get_brightness, set_brightness, update_image, create_background_task
+from nwg_panel.tools import check_key, get_brightness, set_brightness, update_image, create_background_task, eprint
class BrightnessSlider(Gtk.EventBox):
@@ -92,7 +92,7 @@ def refresh_output(self):
controller=self.settings["backlight-controller"])
GLib.idle_add(self.update_brightness)
except Exception as e:
- print(e)
+ eprint(e)
def update_brightness(self, get=True):
icon_name = bri_icon_name(self.bri_value)
diff --git a/nwg_panel/modules/controls.py b/nwg_panel/modules/controls.py
index 1e0afbfd..5758b8b9 100644
--- a/nwg_panel/modules/controls.py
+++ b/nwg_panel/modules/controls.py
@@ -11,7 +11,7 @@
from gi.repository import Gtk, Gdk, GLib, GtkLayerShell
from nwg_panel.tools import check_key, get_brightness, set_brightness, get_volume, set_volume, get_battery, \
- get_interface, update_image, bt_info, eprint, list_sinks, toggle_mute, create_background_task
+ update_image, eprint, list_sinks, toggle_mute, create_background_task
from nwg_panel.common import commands
@@ -35,7 +35,6 @@ def __init__(self, settings, position, alignment, width, monitor=None, icons_pat
check_key(settings, "click-closes", False)
check_key(settings, "root-css-name", "controls-overview")
check_key(settings, "components", ["brightness", "battery", "volume", "processes"])
- check_key(settings, "net-interface", "")
check_key(settings, "angle", 0.0)
check_key(settings, "battery-low-level", 20)
check_key(settings, "battery-low-interval", 3)
@@ -45,11 +44,6 @@ def __init__(self, settings, position, alignment, width, monitor=None, icons_pat
self.icon_size = settings["icon-size"]
- self.net_icon_name = "view-refresh-symbolic"
- self.net_image = Gtk.Image.new_from_icon_name(self.net_icon_name, Gtk.IconSize.MENU)
- self.net_label = Gtk.Label() if settings["show-values"] else None
- self.net_ip_addr = None
-
self.bri_icon_name = "view-refresh-symbolic"
self.bri_image = Gtk.Image.new_from_icon_name(self.bri_icon_name, Gtk.IconSize.MENU)
self.bri_label = Gtk.Label() if settings["show-values"] else None
@@ -61,11 +55,6 @@ def __init__(self, settings, position, alignment, width, monitor=None, icons_pat
self.vol_value = 0
self.vol_muted = False
- self.bt_icon_name = "view-refresh-symbolic"
- self.bt_image = Gtk.Image.new_from_icon_name(self.bt_icon_name, Gtk.IconSize.MENU)
- self.bt_label = Gtk.Label() if settings["show-values"] else None
- self.bt_name = ""
-
self.bat_icon_name = "view-refresh-symbolic"
self.bat_image = Gtk.Image.new_from_icon_name(self.bat_icon_name, Gtk.IconSize.MENU)
self.bat_label = Gtk.Label() if settings["show-values"] else None
@@ -108,19 +97,6 @@ def build_box(self):
if self.vol_label:
box.pack_start(self.vol_label, False, False, 0)
- if "net" in self.settings["components"] and self.settings["net-interface"]:
- if commands["netifaces"]:
- box.pack_start(self.net_image, False, False, 4)
- if self.net_label:
- box.pack_start(self.net_label, False, False, 0)
- else:
- print("'netifaces' python module not found")
-
- if "bluetooth" in self.settings["components"] and commands["btmgmt"]:
- box.pack_start(self.bt_image, False, False, 4)
- if self.bt_label:
- box.pack_start(self.bt_label, False, False, 0)
-
if "battery" in self.settings["components"]:
box.pack_start(self.bat_image, False, False, 4)
if self.bat_label:
@@ -129,15 +105,6 @@ def build_box(self):
box.pack_start(self.pan_image, False, False, 4)
def refresh_output(self):
- if "net" in self.settings["components"] and self.settings["net-interface"]:
- self.net_ip_addr = get_interface(self.settings["net-interface"])
- GLib.idle_add(self.update_net, self.net_ip_addr)
-
- if commands["btmgmt"]:
- name, powered = bt_info()
- if "bluetooth" in self.settings["components"]:
- GLib.idle_add(self.update_bt, name, powered)
-
if "brightness" in self.settings["components"]:
try:
self.bri_value = get_brightness(
@@ -145,7 +112,7 @@ def refresh_output(self):
controller=self.settings["backlight-controller"])
GLib.idle_add(self.update_brightness)
except Exception as e:
- print(e)
+ eprint(e)
if "volume" in self.settings["components"] and (commands["pamixer"] or commands["pactl"]):
try:
@@ -170,25 +137,6 @@ def refresh_bat(self):
thread = create_background_task(self.refresh_bat_output, 5)
thread.start()
- def update_net(self, ip):
- icon_name = "network-wired-symbolic" if ip else "network-wired-disconnected-symbolic"
- if icon_name != self.net_icon_name:
- update_image(self.net_image, icon_name, self.icon_size, self.icons_path)
- self.net_icon_name = icon_name
-
- if self.net_label:
- self.net_label.set_text("{}".format(self.settings["net-interface"]))
-
- def update_bt(self, name, powered):
- icon_name = "bluetooth-active-symbolic" if powered else "bluetooth-disabled-symbolic"
- if icon_name != self.bt_icon_name:
- update_image(self.bt_image, icon_name, self.icon_size, self.icons_path)
- self.bt_icon_name = icon_name
-
- self.bt_name = name
- if self.bt_label:
- self.bt_label.set_text(name)
-
def update_brightness(self, get=True):
icon_name = bri_icon_name(self.bri_value)
@@ -297,8 +245,6 @@ def __init__(self, parent, position, alignment, settings, width, monitor=None, i
self.settings = settings
self.position = position
- self.net_icon_name = ""
-
self.menu_box = None
self.sink_box = None
@@ -377,7 +323,7 @@ def __init__(self, parent, position, alignment, settings, width, monitor=None, i
GtkLayerShell.set_anchor(self, GtkLayerShell.Edge.RIGHT, True)
GtkLayerShell.set_anchor(self, GtkLayerShell.Edge.BOTTOM, True)
- check_key(settings, "commands", {"battery": "", "net": ""})
+ check_key(settings, "commands", {"battery": ""})
add_sep = False
if "brightness" in settings["components"]:
@@ -448,68 +394,6 @@ def __init__(self, parent, position, alignment, settings, width, monitor=None, i
sep = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
v_box.pack_start(sep, True, True, 10)
- if "net" in settings["components"] and commands["netifaces"] and settings["net-interface"]:
- event_box = Gtk.EventBox()
- if "net" in settings["commands"] and settings["commands"]["net"]:
- event_box.connect("enter_notify_event", self.on_enter_notify_event)
- event_box.connect("leave_notify_event", self.on_leave_notify_event)
-
- event_box.connect('button-press-event', self.launch, settings["commands"]["net"])
-
- inner_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
- inner_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
- inner_vbox.pack_start(inner_hbox, True, True, 6)
- v_box.pack_start(event_box, True, True, 0)
-
- self.net_icon_name = "view-refresh-symbolic"
- self.net_image = Gtk.Image.new_from_icon_name(self.net_icon_name, Gtk.IconSize.MENU)
-
- icon_name = "network-wired-symbolic" if self.parent.net_ip_addr else "network-wired-disconnected-symbolic"
-
- if icon_name != self.net_icon_name:
- update_image(self.net_image, icon_name, self.icon_size, self.icons_path)
- self.net_icon_name = icon_name
-
- inner_hbox.pack_start(self.net_image, False, False, 6)
-
- self.net_label = Gtk.Label("{}: {}".format(settings["net-interface"], self.parent.net_ip_addr))
- inner_hbox.pack_start(self.net_label, False, True, 6)
-
- if "net" in settings["commands"] and settings["commands"]["net"]:
- img = Gtk.Image()
- update_image(img, "pan-end-symbolic", self.icon_size, self.icons_path)
- inner_hbox.pack_end(img, False, True, 4)
-
- event_box.add(inner_vbox)
-
- if "bluetooth" in settings["components"] and commands["btmgmt"]:
- event_box = Gtk.EventBox()
- if "bluetooth" in settings["commands"] and settings["commands"]["bluetooth"]:
- event_box.connect("enter_notify_event", self.on_enter_notify_event)
- event_box.connect("leave_notify_event", self.on_leave_notify_event)
-
- event_box.connect('button-press-event', self.launch, settings["commands"]["bluetooth"])
-
- inner_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
- inner_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
- inner_vbox.pack_start(inner_hbox, True, True, 6)
- v_box.pack_start(event_box, True, True, 0)
-
- self.bt_icon_name = "view-refresh-symbolic"
- self.bt_image = Gtk.Image.new_from_icon_name(self.bt_icon_name, Gtk.IconSize.MENU)
-
- inner_hbox.pack_start(self.bt_image, False, False, 6)
-
- self.bt_label = Gtk.Label()
- inner_hbox.pack_start(self.bt_label, False, True, 6)
-
- if "bluetooth" in settings["commands"] and settings["commands"]["bluetooth"]:
- img = Gtk.Image()
- update_image(img, "pan-end-symbolic", self.icon_size, self.icons_path)
- inner_hbox.pack_end(img, False, True, 4)
-
- event_box.add(inner_vbox)
-
if "battery" in settings["components"]:
event_box = Gtk.EventBox()
if "battery" in settings["commands"] and settings["commands"]["battery"]:
@@ -699,21 +583,6 @@ def custom_item(self, name, icon, cmd):
def refresh(self, *args):
if self.get_visible():
self.refresh_sinks()
- if "net" in self.settings["components"] and commands["netifaces"] and self.settings["net-interface"]:
- if self.parent.net_icon_name != self.net_icon_name:
- update_image(self.net_image, self.parent.net_icon_name, self.icon_size, self.icons_path)
- self.net_icon_name = self.parent.net_icon_name
-
- ip_addr = "disconnected" if not self.parent.net_ip_addr else self.parent.net_ip_addr
- self.net_label.set_text("{}: {}".format(self.settings["net-interface"], ip_addr))
-
- if "bluetooth" in self.settings["components"] and commands["btmgmt"]:
- if self.parent.bt_icon_name != self.bt_icon_name:
- update_image(self.bt_image, self.parent.bt_icon_name, self.icon_size, self.icons_path)
- self.bt_icon_name = self.parent.bt_icon_name
-
- if self.bt_label:
- self.bt_label.set_text(self.parent.bt_name)
if "battery" in self.settings["components"]:
if self.parent.bat_icon_name != self.bat_icon_name:
@@ -895,9 +764,3 @@ def bat_icon_name(value, is_charging):
icon_name = "battery-low-symbolic"
return icon_name
-
-
-def bt_icon_name(is_on):
- icon_name = "bluetooth-active-symbolic" if is_on else "bluetooth-disabled-symbolic"
-
- return icon_name
diff --git a/nwg_panel/tools.py b/nwg_panel/tools.py
index ade432b9..9b397dc3 100644
--- a/nwg_panel/tools.py
+++ b/nwg_panel/tools.py
@@ -24,11 +24,6 @@
import nwg_panel.common
-try:
- import netifaces
-except ModuleNotFoundError:
- pass
-
try:
import psutil
except:
@@ -391,12 +386,6 @@ def check_commands():
for key in nwg_panel.common.commands:
nwg_panel.common.commands[key] = is_command(key)
- try:
- import netifaces
- nwg_panel.common.commands["netifaces"] = True
- except ModuleNotFoundError:
- pass
-
try:
import requests
nwg_panel.common.commands["python-requests"] = True
@@ -524,34 +513,25 @@ def set_volume(percent):
def get_brightness(device="", controller=""):
brightness = 0
if nwg_panel.common.commands["light"] and controller == "light":
- try:
- cmd = "light -G -s {}".format(device) if device else "light -G"
- output = cmd2string(cmd)
- brightness = int(round(float(output), 0))
- except:
- pass
+ cmd = "light -G -s {}".format(device) if device else "light -G"
+ output = cmd2string(cmd)
+ brightness = int(round(float(output), 0))
elif nwg_panel.common.commands["brightnessctl"] and controller == "brightnessctl":
- try:
- cmd = "brightnessctl m -d {}".format(device) if device else "brightnessctl m"
- output = cmd2string(cmd)
- max_bri = int(output)
-
- cmd = "brightnessctl g -d {}".format(device) if device else "brightnessctl g"
- output = cmd2string(cmd)
- b = int(output) * 100 / max_bri
- brightness = int(round(float(b), 0))
- except:
- pass
+ cmd = "brightnessctl m -d {}".format(device) if device else "brightnessctl m"
+ output = cmd2string(cmd)
+ max_bri = int(output)
+
+ cmd = "brightnessctl g -d {}".format(device) if device else "brightnessctl g"
+ output = cmd2string(cmd)
+ b = int(output) * 100 / max_bri
+ brightness = int(round(float(b), 0))
elif nwg_panel.common.commands["ddcutil"] and controller == "ddcutil":
- try:
- cmd = "ddcutil getvcp 10 --bus={}".format(device) if device else "ddcutil getvcp 10"
- output = cmd2string(cmd)
- b = int(output.split("current value =")[1].split(",")[0])
- brightness = int(round(float(b), 0))
- except:
- pass
+ cmd = "ddcutil getvcp 10 --bus={}".format(device) if device else "ddcutil getvcp 10"
+ output = cmd2string(cmd)
+ b = int(output.split("current value =")[1].split(",")[0])
+ brightness = int(round(float(b), 0))
else:
- eprint("Couldn't get brightness, is 'light' or 'brightnessctl' or 'ddcutil' installed?")
+ raise ValueError("Couldn't get brightness, is 'light' or 'brightnessctl' or 'ddcutil' installed?")
return brightness
@@ -632,16 +612,6 @@ def seconds2string(seconds):
return "{}:{}".format(hrs, minutes)
-def get_interface(name):
- try:
- addrs = netifaces.ifaddresses(name)
- list = addrs[netifaces.AF_INET]
-
- return list[0]["addr"]
- except:
- return None
-
-
def update_image(image, icon_name, icon_size, icons_path="", fallback=True):
scale = image.get_scale_factor()
icon_size *= scale
@@ -706,23 +676,6 @@ def create_pixbuf(icon_name, icon_size, icons_path="", fallback=True):
return pixbuf
-def bt_info():
- name, powered = "", False
- try:
- info = subprocess.check_output("btmgmt info", shell=True).decode("utf-8").strip().splitlines()
- for line in info:
- if "current settings" in line:
- if "powered" in line:
- powered = True
- continue
- if "name" in line and "short" not in line:
- name = line.split("name")[1].strip()
- except:
- pass
-
- return name, powered
-
-
def list_configs(config_dir):
configs = {}
# allow to store json files other than panel config files in the config directory