diff --git a/nwg_shell_config/main.py b/nwg_shell_config/main.py index 2768b58..3bb5b02 100644 --- a/nwg_shell_config/main.py +++ b/nwg_shell_config/main.py @@ -287,7 +287,10 @@ def on_apply_btn(b): "custom": preset_custom } preset = presets[settings["panel-preset"]] - update_swaync_config(preset["swaync-positionX"], preset["swaync-positionY"]) + update_swaync_config(preset["swaync-positionX"], + preset["swaync-positionY"], + preset["swaync-control-center-width"], + preset["swaync-notification-window-width"]) save_includes() f = os.path.join(data_dir, "settings") @@ -679,7 +682,9 @@ def load_preset(file_name): "dock-css": "", "dock-on": False, "swaync-positionX": "right", - "swaync-positionY": "top" + "swaync-positionY": "top", + "swaync-control-center-width": 500, + "swaync-notification-window-width": 500 } preset_file = os.path.join(data_dir, file_name) if os.path.isfile(preset_file): @@ -727,15 +732,22 @@ def save_presets(): save_json(preset_custom, f) -def update_swaync_config(pos_x, pos_y): +def update_swaync_config(pos_x, pos_y, cc_width, window_width): settings_file = os.path.join(config_home, "swaync/config.json") if os.path.isfile(settings_file): print("Loading swaync settings from {}".format(settings_file)) swaync_settings = load_json(settings_file) swaync_settings["positionX"] = pos_x swaync_settings["positionY"] = pos_y + swaync_settings["control-center-width"] = cc_width + swaync_settings["notification-window-width"] = window_width else: - swaync_settings = {"positionX": pos_x, "positionY": pos_y} + swaync_settings = { + "positionX": pos_x, + "positionY": pos_y, + "control-center-width": cc_width, + "notification-window-width": window_width + } print("Saving swaync settings to {}".format(settings_file)) save_json(swaync_settings, settings_file) diff --git a/nwg_shell_config/shell/custom b/nwg_shell_config/shell/custom index 6ea08e0..e999547 100644 --- a/nwg_shell_config/shell/custom +++ b/nwg_shell_config/shell/custom @@ -28,5 +28,7 @@ "dock-css": "", "dock-on": false, "swaync-positionX": "right", - "swaync-positionY": "top" + "swaync-positionY": "top", + "swaync-control-center-width": 500, + "swaync-notification-window-width": 500 } \ No newline at end of file diff --git a/nwg_shell_config/shell/preset-0 b/nwg_shell_config/shell/preset-0 index 4d52de0..88bf6fe 100644 --- a/nwg_shell_config/shell/preset-0 +++ b/nwg_shell_config/shell/preset-0 @@ -28,5 +28,7 @@ "dock-css": "preset-0.css", "dock-on": false, "swaync-positionX": "right", - "swaync-positionY": "top" + "swaync-positionY": "top", + "swaync-control-center-width": 500, + "swaync-notification-window-width": 500 } \ No newline at end of file diff --git a/nwg_shell_config/shell/preset-1 b/nwg_shell_config/shell/preset-1 index 4a64612..05056f2 100644 --- a/nwg_shell_config/shell/preset-1 +++ b/nwg_shell_config/shell/preset-1 @@ -28,5 +28,7 @@ "dock-css": "preset-1.css", "dock-on": true, "swaync-positionX": "center", - "swaync-positionY": "top" + "swaync-positionY": "top", + "swaync-control-center-width": 500, + "swaync-notification-window-width": 500 } \ No newline at end of file diff --git a/nwg_shell_config/shell/preset-2 b/nwg_shell_config/shell/preset-2 index 9c0042b..f567255 100644 --- a/nwg_shell_config/shell/preset-2 +++ b/nwg_shell_config/shell/preset-2 @@ -28,5 +28,7 @@ "dock-css": "preset-2.css", "dock-on": false, "swaync-positionX": "right", - "swaync-positionY": "bottom" + "swaync-positionY": "bottom", + "swaync-control-center-width": 400, + "swaync-notification-window-width": 400 } \ No newline at end of file diff --git a/nwg_shell_config/shell/preset-3 b/nwg_shell_config/shell/preset-3 index 9233225..f2ed5c3 100644 --- a/nwg_shell_config/shell/preset-3 +++ b/nwg_shell_config/shell/preset-3 @@ -28,5 +28,7 @@ "dock-css": "preset-3.css", "dock-on": true, "swaync-positionX": "right", - "swaync-positionY": "top" + "swaync-positionY": "top", + "swaync-control-center-width": 400, + "swaync-notification-window-width": 400 } \ No newline at end of file diff --git a/nwg_shell_config/ui_components.py b/nwg_shell_config/ui_components.py index ce94e84..1e41bb0 100644 --- a/nwg_shell_config/ui_components.py +++ b/nwg_shell_config/ui_components.py @@ -1043,7 +1043,7 @@ def bar_tab(preset, preset_name): def notification_tab(preset, preset_name): frame = Gtk.Frame() - frame.set_label(" {}: Notification placement ".format(preset_name)) + frame.set_label(" {}: Notification center ".format(preset_name)) frame.set_label_align(0.5, 0.5) frame.set_property("hexpand", True) grid = Gtk.Grid() @@ -1076,6 +1076,24 @@ def notification_tab(preset, preset_name): combo_position_x.set_active_id(preset["swaync-positionY"]) combo_position_x.connect("changed", set_dict_key_from_combo, preset, "swaync-positionY") + lbl = Gtk.Label.new("Control center width:") + lbl.set_property("halign", Gtk.Align.END) + grid.attach(lbl, 0, 3, 1, 1) + + sb_cc_width = Gtk.SpinButton.new_with_range(0, 1000, 1) + sb_cc_width.set_value(preset["swaync-control-center-width"]) + sb_cc_width.connect("value-changed", set_int_from_spinbutton, preset, "swaync-control-center-width") + grid.attach(sb_cc_width, 1, 3, 1, 1) + + lbl = Gtk.Label.new("Notification window width:") + lbl.set_property("halign", Gtk.Align.END) + grid.attach(lbl, 0, 4, 1, 1) + + sb_window_width = Gtk.SpinButton.new_with_range(0, 1000, 1) + sb_window_width.set_value(preset["swaync-control-center-width"]) + sb_window_width.connect("value-changed", set_int_from_spinbutton, preset, "swaync-notification-window-width") + grid.attach(sb_window_width, 1, 4, 1, 1) + frame.show_all() return frame diff --git a/setup.py b/setup.py index 9320934..2f19ddf 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ def read(f_name): setup( name='nwg-shell-config', - version='0.3.0', + version='0.3.1', description='nwg-shell configuration utility', packages=find_packages(), include_package_data=True,