diff --git a/src/applets/workspaces/WorkspaceItem.vala b/src/applets/workspaces/WorkspaceItem.vala index e5f223db1..cd1918309 100644 --- a/src/applets/workspaces/WorkspaceItem.vala +++ b/src/applets/workspaces/WorkspaceItem.vala @@ -23,10 +23,12 @@ namespace Workspaces { public signal void pls_update_windows(); private Gtk.Grid icon_grid; private Gtk.Allocation real_alloc; + private float size_multiplier; - public WorkspaceItem(Wnck.Workspace space) { + public WorkspaceItem(Wnck.Workspace space, float multiplier) { this.get_style_context().add_class("workspace-item"); this.workspace = space; + this.size_multiplier = multiplier; this.set_tooltip_text(workspace.get_name()); real_alloc.width = 0; @@ -261,6 +263,10 @@ namespace Workspaces { this.queue_resize(); } + public void set_size_multiplier(float multiplier) { + size_multiplier = multiplier; + } + public override void size_allocate(Gtk.Allocation allocation) { this.queue_resize(); base.size_allocate(real_alloc); @@ -290,8 +296,8 @@ namespace Workspaces { return; } float height = WorkspacesApplet.panel_size; - min = nat = (int) (height * 2.9); - real_alloc.width = (int) (height * 2.9); + min = nat = (int) (height * 2.9 * size_multiplier); + real_alloc.width = (int) (height * 2.9 * size_multiplier); } public override void get_preferred_height(out int min, out int nat) { @@ -301,8 +307,8 @@ namespace Workspaces { return; } float height = WorkspacesApplet.panel_size; - min = nat = (int) (height * 2); - real_alloc.height = (int) (height * 2); + min = nat = (int) (height * 2 * size_multiplier); + real_alloc.height = (int) (height * 2 * size_multiplier); } public Wnck.Workspace get_workspace() { diff --git a/src/applets/workspaces/WorkspacesApplet.vala b/src/applets/workspaces/WorkspacesApplet.vala index d589ed24e..7a6b4ea48 100644 --- a/src/applets/workspaces/WorkspacesApplet.vala +++ b/src/applets/workspaces/WorkspacesApplet.vala @@ -27,12 +27,15 @@ namespace Workspaces { public class WorkspacesAppletSettings : Gtk.Grid { [GtkChild] private unowned Gtk.ComboBoxText? combobox_visibility; + [GtkChild] + private unowned Gtk.ComboBoxText? combobox_multiplier; private Settings? settings; public WorkspacesAppletSettings(Settings? settings) { this.settings = settings; settings.bind("addbutton-visibility", combobox_visibility, "active_id", SettingsBindFlags.DEFAULT); + settings.bind("item-size-multiplier", combobox_multiplier, "active_id", SettingsBindFlags.DEFAULT); } } @@ -58,6 +61,7 @@ namespace Workspaces { private List dynamically_created_workspaces; private Settings settings; private AddButtonVisibility button_visibility = AddButtonVisibility.ALWAYS; + private float item_size_multiplier = 1.0f; public string uuid { public set ; public get ; } @@ -120,6 +124,7 @@ namespace Workspaces { main_layout.pack_start(add_button_revealer, false, false, 0); on_settings_change("addbutton-visibility"); + on_settings_change("item-size-multiplier"); Gtk.drag_dest_set( add_button, @@ -209,13 +214,21 @@ namespace Workspaces { } private void on_settings_change(string key) { - if (key != "addbutton-visibility") { - return; + if (key == "addbutton-visibility") { + button_visibility = (AddButtonVisibility)settings.get_enum(key); + add_button_revealer.set_reveal_child(((button_visibility == AddButtonVisibility.ALWAYS) && below_max_workspace_count())); + } else if (key == "item-size-multiplier") { + item_size_multiplier = float.parse(settings.get_string(key)); + foreach (Gtk.Widget widget in workspaces_layout.get_children()) { + Gtk.Revealer revealer = widget as Gtk.Revealer; + WorkspaceItem item = revealer.get_child() as WorkspaceItem; + item.set_size_multiplier(item_size_multiplier); + } + Timeout.add(100, () => { + update_workspaces.begin(); + return true; + }); } - - button_visibility = (AddButtonVisibility)settings.get_enum(key); - - add_button_revealer.set_reveal_child(((button_visibility == AddButtonVisibility.ALWAYS) && below_max_workspace_count())); } private void populate_workspaces() { @@ -278,7 +291,7 @@ namespace Workspaces { } private void workspace_added(Wnck.Workspace space) { - WorkspaceItem item = new WorkspaceItem(space); + WorkspaceItem item = new WorkspaceItem(space, item_size_multiplier); var _workspace = wnck_screen.get_active_workspace(); if (_workspace != null && _workspace == space) { item.get_style_context().add_class("current-workspace"); diff --git a/src/applets/workspaces/com.solus-project.workspaces.gschema.xml b/src/applets/workspaces/com.solus-project.workspaces.gschema.xml index b370bd290..daf13315a 100644 --- a/src/applets/workspaces/com.solus-project.workspaces.gschema.xml +++ b/src/applets/workspaces/com.solus-project.workspaces.gschema.xml @@ -5,11 +5,23 @@ + + + + + + + 'always' Add Button Visibility Controls the visibility of the add workspace button + + '1.0' + Item Size Multiplier + A multiplier for the size of individual workspace items + diff --git a/src/applets/workspaces/settings.ui b/src/applets/workspaces/settings.ui index e5af6bfbe..543ec501e 100644 --- a/src/applets/workspaces/settings.ui +++ b/src/applets/workspaces/settings.ui @@ -11,6 +11,9 @@ True False + start + center + True "Add" button visibility @@ -18,6 +21,20 @@ 0 + + + True + False + start + center + True + Item Size Multiplier + + + 0 + 1 + + True @@ -35,5 +52,27 @@ 0 + + + True + True + end + center + True + 3 + 1.0 + + 0.5x + 0.75x + 1.0x + 1.5x + 2.0x + + + + 1 + 1 + +