Inheritance: System.Windows.Forms.NativeWindow
        void IPlugin.InitializePlugin(Windawesome windawesome)
        {
            Workspace.WorkspaceWindowAdded += OnWorkspaceApplicationAdded;
            Workspace.WorkspaceWindowRemoved += OnWorkspaceApplicationRemoved;
            //Workspace.WorkspaceChangedFrom += OnWorkspaceChangedFrom;
            //Workspace.WorkspaceChangedTo += OnWorkspaceChangedTo;
            Workspace.WorkspaceLayoutChanged += OnWorkspaceLayoutChanged;
            this.windawesome = windawesome;

            subclassedWindows = new HashMultiSet<Window>[windawesome.config.Workspaces.Length];
            for (var i = 0; i < windawesome.config.Workspaces.Length; i++)
            {
                subclassedWindows[i] = new HashMultiSet<Window>();
            }
        }
Esempio n. 2
0
        void IPlugin.InitializePlugin(Windawesome windawesome)
        {
            this.windawesome = windawesome;

            if (logRuleMatching)
            {
                Windawesome.ProgramRuleMatched += OnProgramRuleMatched;
            }
            if (logCreation)
            {
                Workspace.WorkspaceWindowAdded += OnWorkspaceWindowAdded;
            }
            if (logDeletion)
            {
                Workspace.WorkspaceWindowRemoved += OnWorkspaceWindowRemoved;
            }
            if (logWorkspaceSwitching)
            {
                Workspace.WorkspaceShown += OnWorkspaceShown;
                Workspace.WorkspaceHidden += OnWorkspaceHidden;
                Workspace.WorkspaceActivated += OnWorkspaceActivated;
                Workspace.WorkspaceDeactivated += OnWorkspaceDeactivated;
            }
            if (logWindowMinimization)
            {
                Workspace.WorkspaceWindowMinimized += OnWorkspaceWindowMinimized;
            }
            if (logWindowRestoration)
            {
                Workspace.WorkspaceWindowRestored += OnWorkspaceWindowRestored;
            }
            if (logActivation)
            {
                Workspace.WindowActivatedEvent += OnWindowActivated;
            }
        }
Esempio n. 3
0
        static void Main()
        {
            bool createdNew;
            using (new Mutex(true, "{BCDA45B7-407E-43F3-82FB-D1F6D6D093FF}", out createdNew))
            {
                if (createdNew) // if the mutex was taken successfully, i.e. this is the first instance of the app running
                {
                    SetPriorities();

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    // set exception handling
                    Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                    Application.ThreadException += OnApplicationThreadException;
                    AppDomain.CurrentDomain.UnhandledException += (_, e) => OnException(e.ExceptionObject as Exception);

                    windawesome = new Windawesome();
                    Application.Run(new WindawesomeApplicationContext());

                    Application.ThreadException -= OnApplicationThreadException;
                }
            }
        }
Esempio n. 4
0
 void IWidget.StaticInitializeWidget(Windawesome windawesome)
 {
 }
        void IWidget.StaticInitializeWidget(Windawesome windawesome)
        {
            if (NativeMethods.RegisterGlobalShellHook(windawesome.Handle))
            {
                globalShellHookMessage = NativeMethods.RegisterWindowMessage("GLOBAL_SHELL_HOOK");
                if (SystemAndProcessInformation.isAtLeastVista && SystemAndProcessInformation.isRunningElevated)
                {
                    if (SystemAndProcessInformation.isAtLeast7)
                    {
                        NativeMethods.ChangeWindowMessageFilterEx(windawesome.Handle, globalShellHookMessage, NativeMethods.MSGFLTEx.MSGFLT_ALLOW, IntPtr.Zero);
                    }
                    else
                    {
                        NativeMethods.ChangeWindowMessageFilter(globalShellHookMessage, NativeMethods.MSGFLT.MSGFLT_ADD);
                    }
                }

                windawesome.RegisterMessage((int) globalShellHookMessage, OnGlobalShellHookMessage);
            }
        }
Esempio n. 6
0
            public static void LoadAll(Windawesome windawesome, Config config, IEnumerable<FileInfo> files)
            {
                ScriptScope scope = null;
                ScriptEngine previousLanguage = null;
                foreach (var file in files)
                {
                    var engine = GetEngineForFile(file);
                    if (engine != null)
                    {
                        if (scope == null)
                        {
                            scope = engine.CreateScope();
                            scope.SetVariable("windawesome", windawesome);
                            scope.SetVariable("config", config);
                        }
                        else if (previousLanguage != engine)
                        {
                            var oldScope = scope;
                            scope = engine.CreateScope();
                            oldScope.GetItems().
                                Where(variable => variable.Value != null).
                                ForEach(variable => scope.SetVariable(variable.Key, variable.Value));
                            previousLanguage.Runtime.Globals.GetItems().
                                Where(variable => variable.Value != null).
                                ForEach(variable => scope.SetVariable(variable.Key, variable.Value));
                        }

                        scope = engine.ExecuteFile(file.FullName, scope);
                        previousLanguage = engine;
                    }
                }
            }
Esempio n. 7
0
        internal void LoadConfiguration(Windawesome windawesome)
        {
            const string layoutsDirName = "Layouts";
            const string widgetsDirName = "Widgets";
            const string pluginsDirName = "Plugins";
            const string configDirName  = "Config";

            if (!Directory.Exists(configDirName) || Directory.EnumerateFiles(configDirName).FirstOrDefault() == null)
            {
                throw new Exception("You HAVE to have a " + configDirName + " directory in the folder and it must " +
                    "contain at least one Python or Ruby file that initializes all instance variables in 'config' " +
                    "that don't have default values!");
            }
            if (!Directory.Exists(layoutsDirName))
            {
                Directory.CreateDirectory(layoutsDirName);
            }
            if (!Directory.Exists(widgetsDirName))
            {
                Directory.CreateDirectory(widgetsDirName);
            }
            if (!Directory.Exists(pluginsDirName))
            {
                Directory.CreateDirectory(pluginsDirName);
            }
            var files =
                Directory.EnumerateFiles(layoutsDirName).Select(fileName => new FileInfo(fileName)) .Concat(
                Directory.EnumerateFiles(widgetsDirName).Select(fileName => new FileInfo(fileName))).Concat(
                Directory.EnumerateFiles(pluginsDirName).Select(fileName => new FileInfo(fileName))).Concat(
                Directory.EnumerateFiles(configDirName) .Select(fileName => new FileInfo(fileName)));

            PluginLoader.LoadAll(windawesome, this, files);
        }
 void IPlugin.InitializePlugin(Windawesome windawesome)
 {
 }
Esempio n. 9
0
        void IBar.InitializeBar(Windawesome windawesome)
        {
            // statically initialize all widgets
            // this statement uses the laziness of Where
            this.leftAlignedWidgets.Cast<IWidget>().Concat(this.rightAlignedWidgets).Concat(this.middleAlignedWidgets).
                Where(w => !widgetTypes.Contains(w.GetType())).
                ForEach(w => { w.StaticInitializeWidget(windawesome); widgetTypes.Add(w.GetType()); });

            WidgetControlsChanged = OnWidgetControlsChanged;
            SpanWidgetControlsAdded = OnSpanWidgetControlsAdded;
            SpanWidgetControlsRemoved = OnSpanWidgetControlsRemoved;
            FixedWidthWidgetWidthChanged = OnFixedWidthWidgetWidthChanged;

            leftAlignedWidgets.ForEach(w => w.InitializeWidget(this));
            rightAlignedWidgets.ForEach(w => w.InitializeWidget(this));
            middleAlignedWidgets.ForEach(w => w.InitializeWidget(this));

            // get initial controls
            this.form.SuspendLayout();

            this.leftAlignedWidgets.SelectMany(widget => widget.GetInitialControls(true)).ForEach(this.form.Controls.Add);
            this.rightAlignedWidgets.SelectMany(widget => widget.GetInitialControls(false)).ForEach(this.form.Controls.Add);
            this.middleAlignedWidgets.SelectMany(widget => widget.GetInitialControls()).ForEach(this.form.Controls.Add);

            this.form.ResumeLayout();
        }
Esempio n. 10
0
 void IWidget.StaticInitializeWidget(Windawesome windawesome)
 {
     WorkspacesWidget.windawesome = windawesome;
 }
Esempio n. 11
0
 void IWidget.StaticInitializeWidget(Windawesome windawesome)
 {
     ApplicationTabsWidget.windawesome = windawesome;
 }