Пример #1
0
 protected override ClickAnimation OnClicked(uint button, ModifierType mod, double xPercent, double yPercent)
 {
     if ((!ManagedWindows.Any() && button == 1) || button == 2 ||
         (button == 1 && (mod & ModifierType.ControlMask) == ModifierType.ControlMask))
     {
         Launch();
         return(ClickAnimation.Bounce);
     }
     return(base.OnClicked(button, mod, xPercent, yPercent));
 }
Пример #2
0
        protected override MenuList OnGetMenuItems()
        {
            MenuList list = base.OnGetMenuItems();

            if (ManagedWindows.Any())
            {
                list[MenuListContainer.Actions].Insert(0, new MenuItem(Catalog.GetString("New _Window"), RunIcon, (o, a) => Launch()));
            }
            else
            {
                list[MenuListContainer.Actions].Insert(0, new MenuItem(Catalog.GetString("_Open"), RunIcon, (o, a) => Launch()));
            }

            return(list);
        }
Пример #3
0
        void SetState()
        {
            ItemState state = 0;

            if (Windows.Any(w => w == Wnck.Screen.Default.ActiveWindow))
            {
                state |= ItemState.Active;
            }
            if (ManagedWindows.Any(w => w.NeedsAttention()))
            {
                state |= ItemState.Urgent;
            }

            State = state;
        }
Пример #4
0
        protected override ClickAnimation OnClicked(uint button, ModifierType mod, double xPercent, double yPercent)
        {
            if (!ManagedWindows.Any() || button != 1)
            {
                return(ClickAnimation.None);
            }

            List <Wnck.Window>        stack   = new List <Wnck.Window> (Wnck.Screen.Default.WindowsStacked);
            IEnumerable <Wnck.Window> windows = ManagedWindows.OrderByDescending(w => stack.IndexOf(w));

            bool not_in_viewport = !windows.Any(w => !w.IsSkipTasklist && w.IsInViewport(w.Screen.ActiveWorkspace));
            bool urgent          = windows.Any(w => w.NeedsAttention());

            if (not_in_viewport || urgent)
            {
                foreach (Wnck.Window window in windows)
                {
                    if (urgent && !window.NeedsAttention())
                    {
                        continue;
                    }

                    if (!window.IsSkipTasklist)
                    {
                        WindowControl.IntelligentFocusOffViewportWindow(window, windows);
                        return(ClickAnimation.Darken);
                    }
                }
            }

            if (windows.Any(w => w.IsMinimized && w.IsInViewport(Wnck.Screen.Default.ActiveWorkspace)))
            {
                WindowControl.RestoreWindows(windows);
            }
            else if (windows.Any(w => w.IsActive && w.IsInViewport(Wnck.Screen.Default.ActiveWorkspace)) ||
                     Windows.Any(w => w == Wnck.Screen.Default.ActiveWindow))
            {
                WindowControl.MinimizeWindows(windows);
            }
            else
            {
                WindowControl.FocusWindows(windows);
            }

            return(ClickAnimation.Darken);
        }
Пример #5
0
        void SetNameAndIcon()
        {
            if (!ManagedWindows.Any())
            {
                return;
            }

            if (ShowHovers)
            {
                if (ManagedWindows.Count() > 1 && Windows.First().ClassGroup != null)
                {
                    HoverText = ManagedWindows.First().ClassGroup.Name;
                }
                else
                {
                    HoverText = ManagedWindows.First().Name;
                }
            }

            SetIconFromPixbuf(base_window.Icon);
        }
Пример #6
0
        protected override MenuList OnGetMenuItems()
        {
            MenuList list = base.OnGetMenuItems();

            if (ManagedWindows.Any())
            {
                if (ManagedWindows.Any(w => w.IsMaximized))
                {
                    list[MenuListContainer.Actions].Add(new MenuItem(Catalog.GetString("Unma_ximize"), MaximizeIcon,
                                                                     (o, a) => WindowControl.UnmaximizeWindows(ManagedWindows)));
                }
                else
                {
                    list[MenuListContainer.Actions].Add(new MenuItem(Catalog.GetString("Ma_ximize"), MaximizeIcon,
                                                                     (o, a) => WindowControl.MaximizeWindows(ManagedWindows)));
                }

                if (ManagedWindows.Any(w => w.IsMinimized))
                {
                    list[MenuListContainer.Actions].Add(new MenuItem(Catalog.GetString("_Restore"), MinimizeIcon,
                                                                     (o, a) => WindowControl.RestoreWindows(ManagedWindows)));
                }
                else
                {
                    list[MenuListContainer.Actions].Add(new MenuItem(Catalog.GetString("Mi_nimize"), MinimizeIcon,
                                                                     (o, a) => WindowControl.MinimizeWindows(ManagedWindows)));
                }

                list[MenuListContainer.Actions].Add(new MenuItem(Catalog.GetString("_Close All"), CloseIcon,
                                                                 (o, a) => WindowControl.CloseWindows(ManagedWindows)));

                foreach (Wnck.Window window in ManagedWindows)
                {
                    list[MenuListContainer.Windows].Add(new WindowMenuItem(window, window.Icon));
                }
            }

            return(list);
        }