public void Initialize(IBarWidget[] left, IBarWidget[] right, IConfigContext context) { _left = new BarSection(false, leftPanel, left, _monitor, context, _config.DefaultWidgetForeground, _config.DefaultWidgetBackground, _config.FontName, _config.FontSize); _right = new BarSection(true, rightPanel, right, _monitor, context, _config.DefaultWidgetForeground, _config.DefaultWidgetBackground, _config.FontName, _config.FontSize); }
public static TitleBarPlugin AddTitleBar(this IConfigContext context, TitleBarPluginConfig config) { config ??= new TitleBarPluginConfig(); var plugin = new TitleBarPlugin(config); context.Plugins.RegisterPlugin(plugin); return(plugin); }
public static void AddBar(this IConfigContext context, BarPluginConfig config = null) { config = config ?? new BarPluginConfig(); context.AddLayoutProxy((layout) => new MenuBarLayoutEngine(layout, config.BarTitle, config.BarHeight)); context.Plugins.RegisterPlugin(new BarPlugin(config)); }
public static void DoConfig(IConfigContext context) { var config = LoadConfig(); var options = ScriptOptions.Default; var task = CSharpScript.EvaluateAsync <Action <IConfigContext> >(config, options); var func = task.Result; func(context); }
public void AfterConfig(IConfigContext context) { _context = context; _menu = new ActionMenuForm(context, _config); if (_config.RegisterKeybind) { _context.Keybinds.Subscribe(_config.KeybindMod, _config.KeybindKey, () => ShowDefault(), "open action menu"); } }
public WorkspaceContainer(IConfigContext context) { _context = context; _workspaces = new List <IWorkspace>(); _workspaceMap = new Dictionary <IWorkspace, int>(); _mtw = new Dictionary <IMonitor, IWorkspace>(); _lastMonitor = new Dictionary <IWorkspace, IMonitor>(); }
public Workspace(IConfigContext context, string name, ILayoutEngine[] layoutEngines) { _context = context; _layoutEngines = layoutEngines; _layoutIndex = 0; _windows = new List <IWindow>(); _lastFocused = null; Name = name; }
public void AfterConfig(IConfigContext context) { var thread = new Thread(() => { Application.EnableVisualStyles(); Application.Run(new MyAppContext(_config, context)); }); thread.Name = "BarPlugin"; thread.Start(); }
public void UpsertConfigContext(IConfigContext configContext) { if (configContext.PlaneDescriptor.Key != PlaneDescriptor.Key) //Incorrect plane { throw new ArgumentException( $"Incorrect Plane Descriptor : Expected {PlaneDescriptor.Key} Received {configContext.PlaneDescriptor.Key}"); } _configContexts.Remove(configContext.PlaneDescriptor.Value); _configContexts.Add(configContext.PlaneDescriptor.Value, configContext); }
public void AddingNewConfigContext_NewConfigContextStored() { ConfigPlane sut = new ConfigPlane("PlaneName"); ConfigContext configContext = new ConfigContext("PlaneName", "ConfigContextName"); sut.UpsertConfigContext(configContext); IConfigContext readConfigContext = sut.GetConfigContext("ConfigContextName"); Assert.IsNotNull(readConfigContext); Assert.That(readConfigContext.PlaneDescriptor.Key == "PlaneName"); Assert.That(readConfigContext.PlaneDescriptor.Value == "ConfigContextName"); }
public StickyWorkspaceContainer(IConfigContext context, StickyWorkspaceIndexMode indexMode) { _context = context; _indexMode = indexMode; _workspaces = new Dictionary <IMonitor, List <IWorkspace> >(); _orderedWorkspaces = new Dictionary <IMonitor, List <IWorkspace> >(); _allWorkspaces = new List <IWorkspace>(); foreach (var monitor in context.MonitorContainer.GetAllMonitors()) { _workspaces[monitor] = new List <IWorkspace>(); _orderedWorkspaces[monitor] = new List <IWorkspace>(); _wtm = new Dictionary <IWorkspace, IMonitor>(); } }
private ActionMenuItemBuilder CreateSwitchToWindowMenu(IConfigContext context) { var builder = Create(); var workspaces = context.WorkspaceContainer.GetAllWorkspaces(); foreach (var workspace in workspaces) { foreach (var window in workspace.ManagedWindows) { var text = $"[{workspace.Name}] {window.Title}"; builder.Add(text, () => context.Workspaces.SwitchToWindow(window)); } } return(builder); }
public static GapPlugin AddGap(this IConfigContext context, GapPluginConfig config) { config ??= new GapPluginConfig(); var plugin = new GapPlugin(config); context.AddLayoutProxy((layout) => { var gapLayout = new GapLayoutEngine(layout, config.InnerGap, config.OuterGap, config.Delta); plugin.RegisterLayout(gapLayout); return(gapLayout); }); context.Plugins.RegisterPlugin(plugin); return(plugin); }
public ActionMenuForm(IConfigContext context, ActionMenuPluginConfig config) { _context = context; _config = config; InitializeComponent(); this.Shown += OnLoad; this.textBox.KeyPress += OnKeyPress; this.KeyPress += OnKeyPress; this.textBox.KeyDown += OnKeyDown; this.KeyDown += OnKeyDown; this.textBox.TextChanged += OnTextChanged; this.listBox.GotFocus += OnGotFocus; this.textBox.LostFocus += OnLostFocus; this.TopMost = true; this.ControlBox = false; this.FormBorderStyle = FormBorderStyle.None; this.BackColor = System.Drawing.Color.LimeGreen; this.TransparencyKey = System.Drawing.Color.LimeGreen; this.Text = config.MenuTitle; this.Width = config.MenuWidth; this.MinimumSize = new Size(config.MenuWidth, config.MenuHeight); this.MaximumSize = new Size(config.MenuWidth, 100000); this.AutoSize = true; this.AutoSizeMode = AutoSizeMode.GrowAndShrink; this.label.Text = ""; this.label.BackColor = ColorToColor(config.Background); this.label.ForeColor = ColorToColor(config.Foreground); this.textBox.BackColor = ColorToColor(config.Background); this.textBox.ForeColor = ColorToColor(config.Foreground); this.listBox.BackColor = ColorToColor(config.Background); this.listBox.ForeColor = ColorToColor(config.Foreground); this.textBox.AutoSize = true; this.listBox.AutoSize = true; this.listBox.IntegralHeight = true; this.label.Font = new Font(config.FontName, config.FontSize, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); this.textBox.Font = new Font(config.FontName, config.FontSize, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); this.listBox.Font = new Font(config.FontName, config.FontSize, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); this.listBox.DisplayMember = "Text"; this.listBox.ValueMember = "Text"; }
public MyAppContext(BarPluginConfig config, IConfigContext context) { var bars = new List <BarForm>(); foreach (var m in context.MonitorContainer.GetAllMonitors()) { var bar = new BarForm(m, config); var left = config.LeftWidgets(); var right = config.RightWidgets(); bar.Initialize(left, right, context); bar.Show(); bars.Add(bar); } }
public void GettingConfigContext_ReturnsNullIfNotPresent() { ConfigPlane sut = new ConfigPlane("PlaneName"); ConfigContext configContext1 = new ConfigContext("PlaneName", "ConfigContextName1"); configContext1.UpsertConfigValue("TestConfig", "configContext1Value"); sut.UpsertConfigContext(configContext1); ConfigContext configContext2 = new ConfigContext("PlaneName", "ConfigContextName2"); configContext2.UpsertConfigValue("TestConfig", "configContext2Value"); sut.UpsertConfigContext(configContext2); IConfigContext readConfigContext = sut.GetConfigContext("UnknowConfigContextName"); Assert.IsNull(readConfigContext); }
public WindowRouter(IConfigContext context) { _context = context; _filters = new List <Func <IWindow, bool> >(); _routes = new List <Func <IWindow, IWorkspace> >(); IgnoreWindowClass("TaskManagerWindow"); IgnoreWindowClass("MSCTFIME UI"); IgnoreWindowClass("SHELLDLL_DefView"); IgnoreProcessName("SearchUI"); IgnoreProcessName("ShellExperienceHost"); IgnoreProcessName("LockApp"); IgnoreWindowClass("LockScreenBackstopFrame"); IgnoreProcessName("PeopleExperienceHost"); IgnoreWindowClass("Progman"); IgnoreProcessName("StartMenuExperienceHost"); _filters.Add((window) => !(window.ProcessId == Process.GetCurrentProcess().Id)); }
public BarSection(bool reverse, FlowLayoutPanel panel, IBarWidget[] widgets, IMonitor monitor, IConfigContext context, Color defaultFore, Color defaultBack, int fontSize) { _panel = panel; _widgets = widgets; _monitor = monitor; _configContext = context; _fontSize = fontSize; _dirty = true; _reverse = reverse; _defaultFore = defaultFore; _defaultBack = defaultBack; _clickedHandlers = new Dictionary <Label, Action>(); _context = new BarWidgetContext(this, _monitor, _configContext); InitializeWidgets(widgets, _context); }
public void GettingConfigContext_ReturnsConfigContextIfPresent() { ConfigPlane sut = new ConfigPlane("PlaneName"); ConfigContext configContext1 = new ConfigContext("PlaneName", "ConfigContextName1"); configContext1.UpsertConfigValue("TestConfig", "configContext1Value"); sut.UpsertConfigContext(configContext1); ConfigContext configContext2 = new ConfigContext("PlaneName", "ConfigContextName2"); configContext2.UpsertConfigValue("TestConfig", "configContext2Value"); sut.UpsertConfigContext(configContext2); IConfigContext readConfigContext = sut.GetConfigContext("ConfigContextName2"); Assert.IsNotNull(readConfigContext); Assert.That(readConfigContext.PlaneDescriptor.Key == "PlaneName"); Assert.That(readConfigContext.PlaneDescriptor.Value == "ConfigContextName2"); }
public KeybindManager(IConfigContext context) { _context = context; _kbdHook = KbdHook; _mouseHook = MouseHook; _kbdSubs = new Dictionary <Sub, NamedBind <KeybindHandler> >(); _mouseSubs = new Dictionary <MouseEvent, NamedBind <MouseHandler> >(); SubscribeDefaults(); var thread = new Thread(() => { Win32.SetWindowsHookEx(Win32.WH_KEYBOARD_LL, _kbdHook, Process.GetCurrentProcess().MainModule.BaseAddress, 0); Win32.SetWindowsHookEx(Win32.WH_MOUSE_LL, _mouseHook, Process.GetCurrentProcess().MainModule.BaseAddress, 0); Application.Run(); }); thread.Name = "KeybindManager"; thread.Start(); }
public void AddingExistingConfigContext_NewConfigContextSaved() { ConfigPlane sut = new ConfigPlane("PlaneName"); ConfigContext configContext1 = new ConfigContext("PlaneName", "ConfigContextName"); configContext1.UpsertConfigValue("TestConfig", "configContext1Value"); sut.UpsertConfigContext(configContext1); ConfigContext configContext2 = new ConfigContext("PlaneName", "ConfigContextName"); configContext2.UpsertConfigValue("TestConfig", "configContext2Value"); sut.UpsertConfigContext(configContext2); IConfigContext readConfigContext = sut.GetConfigContext("ConfigContextName"); Assert.IsNotNull(readConfigContext); Assert.That(readConfigContext.PlaneDescriptor.Key == "PlaneName"); Assert.That(readConfigContext.PlaneDescriptor.Value == "ConfigContextName"); Assert.That(readConfigContext.GetConfigValue("TestConfig").Equals("configContext2Value", StringComparison.InvariantCulture)); }
public BarSection(bool reverse, FlowLayoutPanel panel, IBarWidget[] widgets, IMonitor monitor, IConfigContext context, Color defaultFore, Color defaultBack, string fontName, int fontSize) { _panel = panel; _widgets = widgets; _monitor = monitor; _configContext = context; _fontName = fontName; _fontSize = fontSize; _reverse = reverse; _defaultFore = defaultFore; _defaultBack = defaultBack; _clickedHandlers = new Dictionary <Label, Action>(); _context = new BarWidgetContext(this, _monitor, _configContext); while (_panel.Controls.Count != _widgets.Count()) { _panel.Controls.Add(CreateWidgetPanel()); } InitializeWidgets(widgets, _context); }
public void Configure(IConfigContext context) { }
public WorkspaceManager(IConfigContext context) { _context = context; _windowsToWorkspaces = new Dictionary <IWindow, IWorkspace>(); }
public QueueManager() { _cuc = new ConfigControl(); _cdc = new ConfigContext(); }
public StickyWorkspaceContainer(IConfigContext context) : this(context, StickyWorkspaceIndexMode.Global) { }
public void AfterConfig(IConfigContext context) { _context = context; }
public void AfterConfig(IConfigContext context) { _plugins.ForEach(p => p.AfterConfig(context)); }
public BarWidgetContext(BarSection section, IMonitor monitor, IConfigContext context) { _section = section; Monitor = monitor; _context = context; }
public static void AddFocusIndicator(this IConfigContext context, FocusIndicatorPluginConfig config = null) { context.Plugins.RegisterPlugin(new FocusIndicatorPlugin(config ?? new FocusIndicatorPluginConfig())); }