Пример #1
0
 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);
 }
Пример #2
0
        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));
        }
Пример #4
0
        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);
        }
Пример #5
0
        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");
            }
        }
Пример #6
0
        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>();
        }
Пример #7
0
        public Workspace(IConfigContext context, string name, ILayoutEngine[] layoutEngines)
        {
            _context       = context;
            _layoutEngines = layoutEngines;
            _layoutIndex   = 0;
            _windows       = new List <IWindow>();

            _lastFocused = null;
            Name         = name;
        }
Пример #8
0
        public void AfterConfig(IConfigContext context)
        {
            var thread = new Thread(() =>
            {
                Application.EnableVisualStyles();
                Application.Run(new MyAppContext(_config, context));
            });

            thread.Name = "BarPlugin";
            thread.Start();
        }
Пример #9
0
        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);
        }
Пример #10
0
        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");
        }
Пример #11
0
 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>();
     }
 }
Пример #12
0
        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);
        }
Пример #13
0
        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);
        }
Пример #14
0
        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";
        }
Пример #15
0
            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);
                }
            }
Пример #16
0
        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);
        }
Пример #17
0
        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));
        }
Пример #18
0
        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);
        }
Пример #19
0
        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");
        }
Пример #20
0
        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();
        }
Пример #21
0
        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));
        }
Пример #22
0
        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);
        }
Пример #23
0
 public void Configure(IConfigContext context)
 {
 }
Пример #24
0
 public WorkspaceManager(IConfigContext context)
 {
     _context             = context;
     _windowsToWorkspaces = new Dictionary <IWindow, IWorkspace>();
 }
Пример #25
0
 public QueueManager()
 {
     _cuc = new ConfigControl();
     _cdc = new ConfigContext();
 }
Пример #26
0
 public StickyWorkspaceContainer(IConfigContext context) : this(context, StickyWorkspaceIndexMode.Global)
 {
 }
Пример #27
0
 public void AfterConfig(IConfigContext context)
 {
     _context = context;
 }
Пример #28
0
 public void AfterConfig(IConfigContext context)
 {
     _plugins.ForEach(p => p.AfterConfig(context));
 }
Пример #29
0
 public QueueManager()
 {
     _cuc = new ConfigControl();
     _cdc = new ConfigContext();
 }
Пример #30
0
 public BarWidgetContext(BarSection section, IMonitor monitor, IConfigContext context)
 {
     _section = section;
     Monitor  = monitor;
     _context = context;
 }
Пример #31
0
 public static void AddFocusIndicator(this IConfigContext context, FocusIndicatorPluginConfig config = null)
 {
     context.Plugins.RegisterPlugin(new FocusIndicatorPlugin(config ?? new FocusIndicatorPluginConfig()));
 }