예제 #1
0
        static void Main()
        {
            InitialiseWinForms();

            // Hook 'shell' events into the capturing form.
            Win32.RegisterShellHookWindow(ShellEventsDelegateForm.Handle);

            // Hook into system wide windowing events
            using (var winHook = new WindowHookManager())
            {

                using (var switcherForm = new SwitcherForm(winHook))
                using (var concentrationForm = new ConcentrationForm(winHook))
                using (var popupWindows = new PopupWindows())
                using (var pushback = new Pushback())
                using (var arranger = new WindowArranger())
                //using (var experimental = new Experimental())
                using (var hotKeys = new HotkeyCore())
                {
                    //hotKeys.Macro(new[] { Keys.LControlKey, Keys.Space }, new KeySequence().Up(Keys.LControlKey).Repeat(4, Keys.Space)); // for annoying text entry that does't do tabs

                    hotKeys.Bind(new[] { Keys.LWin, Keys.Tab }, switcherForm.Toggle);
                    hotKeys.Bind(new[] { Keys.LShiftKey, Keys.F12 }, concentrationForm.Toggle);
                    hotKeys.Bind(new[] { Keys.RShiftKey, Keys.F12 }, concentrationForm.Toggle);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.Space }, popupWindows.ToggleVisibility);
                    hotKeys.Bind(new[] { Keys.LControlKey, Keys.LWin, Keys.Space }, popupWindows.ToggleFade);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.Escape }, pushback.PushBackFrontWindow);

                    // re-arrangement of top-window that breaks less things than the Windows built-in
                    hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D1 }, arranger.SetTopLeft);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D2 }, arranger.SetTop);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D3 }, arranger.SetTopRight);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D4 }, arranger.SetLeft);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D5 }, arranger.SetCentre);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D6 }, arranger.SetRight);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D7 }, arranger.SetBottomLeft);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D8 }, arranger.SetBottom);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.LControlKey, Keys.D9 }, arranger.SetBottomRight);

                    // win-arrow to move screen
                    hotKeys.Bind(new[] { Keys.LWin, Keys.Left }, arranger.MoveScreenLeft);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.Up }, arranger.MoveScreenUp);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.Right }, arranger.MoveScreenRight);
                    hotKeys.Bind(new[] { Keys.LWin, Keys.Down }, arranger.MoveScreenDown);

                    //hotKeys.Bind(new[] { Keys.LWin, Keys.A }, experimental.HideForegroundWindow);

                    TrayIcon = new NotifyTrayApp("Windows Jedi", Resources.JediIcon, "https://github.com/i-e-b/WindowsJedi");
                    TrayIcon.AddMenuItem("Settings", delegate { new Settings().ShowDialog(); });
                    TrayIcon.AddMenuItem("Re-type file", delegate { new FileRetypeChooser().Show(); });

                    Application.ThreadException += Application_ThreadException;

                    Application.Run();

                }
                ShellEventsDelegateForm.Dispose();
            }
        }
예제 #2
0
        public SwitcherForm(WindowHookManager winHook)
        {
            _winHook = winHook;
            _keyMgr = new KeyHookManager();
            _keyMgr.KeyDown += keyMgr_KeyDown;
            _keyMgr.KeyUp += keyMgr_KeyUp;
            KeyPreview = true;
            _passThroughKeys = new Queue<PassThroughKey>();
            _windows = new List<Window>();
            _overlays = new List<Form>();

            _winHook.WindowCreated += _winHook_WindowSetChanged;
            _winHook.WindowDestroyed += _winHook_WindowSetChanged;
        }
예제 #3
0
 public ConcentrationForm(WindowHookManager winHook)
 {
     Name = "WindowsJedi Concentration Veil";
     _winHook = winHook;
 }