From 9163ad40ed2757a753bee46b67c54387e2a0c9c9 Mon Sep 17 00:00:00 2001 From: piotr Date: Tue, 13 Jun 2023 00:21:48 +0200 Subject: [PATCH] add NM Applet check button --- nwg_shell_config/langs/en_US.json | 2 ++ nwg_shell_config/langs/pl_PL.json | 2 ++ nwg_shell_config/main_hyprland.py | 4 +++- nwg_shell_config/shell/settings-hyprland | 2 +- nwg_shell_config/ui_components.py | 6 ++++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/nwg_shell_config/langs/en_US.json b/nwg_shell_config/langs/en_US.json index a36af74..41386af 100644 --- a/nwg_shell_config/langs/en_US.json +++ b/nwg_shell_config/langs/en_US.json @@ -226,6 +226,8 @@ "night-light-day-tooltip": "Day light color temperature: `wlsunset -T`", "night-light-night-tooltip": "Night light color temperature: `wlsunset -t`", "night-light-tooltip": "Determines if to use `wlsunset`.", + "nm-applet": "NetworkManager applet", + "nm-applet-tooltip": "Determines if to autostart NetworkManager applet", "no-border-on-floating": "No boarder on floating", "no-cursor-warps": "No cursor warps", "no-cursor-warps-tooltip": "If set, will not warp the cursor in many cases (focusing, keybinds, etc)", diff --git a/nwg_shell_config/langs/pl_PL.json b/nwg_shell_config/langs/pl_PL.json index a160d59..436d18e 100644 --- a/nwg_shell_config/langs/pl_PL.json +++ b/nwg_shell_config/langs/pl_PL.json @@ -226,6 +226,8 @@ "night-light-day-tooltip": "Temperatura barwowa światła dziennego: `wlsunset -T`", "night-light-night-tooltip": "Temperatura barwowa światła nocnego: `wlsunset -t`", "night-light-tooltip": "Określa czy używać `wlsunset`.", + "nm-applet": "Applet NetworkManager", + "nm-applet-tooltip": "Określa czy uruchamiać applet NetworkManager", "no-border-on-floating": "Pływające okna bez ramki", "no-cursor-warps": "Bez przyspieszania kursora", "no-cursor-warps-tooltip": "Wyłącza przyspieszanie kursora w wielu przypadkach (ogniskowanie, skróty klawiaturowe itp.)", diff --git a/nwg_shell_config/main_hyprland.py b/nwg_shell_config/main_hyprland.py index 787352f..a653c87 100644 --- a/nwg_shell_config/main_hyprland.py +++ b/nwg_shell_config/main_hyprland.py @@ -699,7 +699,8 @@ def save_includes(): p = os.path.join(config_home, "swaync") includes.append("exec-once = swaync -c {}/hyprland.json -s {}/{}.css".format(p, p, name)) - includes.append("exec-once = nm-applet --indicator") + if settings["appindicator"]: + includes.append("exec-once = nm-applet --indicator") if cmd_launcher_autostart: includes.append(cmd_launcher_autostart) @@ -908,6 +909,7 @@ def reload(): def load_settings(): settings_file = os.path.join(data_dir, "settings-hyprland") defaults = { + "appindicator": True, "night-lat": -1, "night-long": -1, "night-temp-low": 4500, diff --git a/nwg_shell_config/shell/settings-hyprland b/nwg_shell_config/shell/settings-hyprland index b446c6b..41d7e29 100644 --- a/nwg_shell_config/shell/settings-hyprland +++ b/nwg_shell_config/shell/settings-hyprland @@ -1,4 +1,5 @@ { + "appindicator": true, "night-lat": -1, "night-long": -1, "night-temp-low": 4500, @@ -33,7 +34,6 @@ "dwindle-use-settings": true, "dwindle-pseudotile": false, "dwindle-force_split": 0, - "dwindle-preserve_split": true, "dwindle-permanent_direction_override": false, "dwindle-special_scale_factor": 0.8, "dwindle-split_width_multiplier": 1.0, diff --git a/nwg_shell_config/ui_components.py b/nwg_shell_config/ui_components.py index 2459ec1..eb15da3 100644 --- a/nwg_shell_config/ui_components.py +++ b/nwg_shell_config/ui_components.py @@ -415,6 +415,12 @@ def screen_tab(settings, voc, pending_updates): else: settings["update-indicator-on"] = False + cb_nm_applet = Gtk.CheckButton.new_with_label(voc["nm-applet"]) + cb_nm_applet.set_active(settings["appindicator"]) + cb_nm_applet.connect("toggled", set_from_checkbutton, settings, "appindicator") + cb_nm_applet.set_tooltip_text(voc["nm-applet-tooltip"]) + grid.attach(cb_nm_applet, 1, 8, 1, 1) + frame.show_all() return frame, update_btn