Inheritance: IBar
        void IWidget.InitializeWidget(Bar bar)
        {
            this.bar = bar;

            var powerStatus = SystemInformation.PowerStatus;
            label = bar.CreateLabel((powerStatus.PowerLineStatus == PowerLineStatus.Offline ?
                textForNotCharging : textForCharging) + prefix + (powerStatus.BatteryLifePercent * 100) + postfix, 0);
            label.BackColor = backgroundColor;
            label.ForeColor = foregroundColor;
            label.TextAlign = ContentAlignment.MiddleCenter;
            switch (powerStatus.BatteryChargeStatus)
            {
                case BatteryChargeStatus.Critical:
                    label.ForeColor = Color.Red;
                    break;
                case BatteryChargeStatus.High:
                    label.ForeColor = Color.Green;
                    break;
                case BatteryChargeStatus.Low:
                    label.ForeColor = Color.Orange;
                    break;
                case BatteryChargeStatus.NoSystemBattery:
                    label.ForeColor = Color.Black;
                    label.Text = @"NO BAT";
                    return ;
            }

            bar.BarShown += () => updateTimer.Start();
            bar.BarHidden += () => updateTimer.Stop();
        }
Example #2
0
 void IWidget.InitializeWidget(Bar bar)
 {
     label = bar.CreateLabel(separator, 0);
     label.BackColor = backgroundColor;
     label.ForeColor = foregroundColor;
     label.TextAlign = ContentAlignment.MiddleCenter;
 }
        void IWidget.InitializeWidget(Bar bar)
        {
            this.bar = bar;

            bar.BarShown += OnBarShown;
            bar.BarHidden += OnBarHidden;

            Windawesome.WindowTitleOrIconChanged += OnWindowTitleOrIconChanged;
            Workspace.WorkspaceWindowAdded += OnWorkspaceWindowAdded;
            Workspace.WorkspaceWindowRemoved += OnWorkspaceWindowRemoved;
            Workspace.WorkspaceWindowRestored += (_, w) => OnWindowActivated(w.hWnd);
            Workspace.WindowActivatedEvent += OnWindowActivated;
            Workspace.WorkspaceHidden += OnWorkspaceHidden;
            Workspace.WorkspaceShown += OnWorkspaceShown;
            Workspace.WorkspaceDeactivated += _ => OnWindowActivated(IntPtr.Zero);
            Workspace.WorkspaceWindowOrderChanged += OnWorkspaceWindowOrderChanged;
            Workspace.WorkspaceMonitorChanged += OnWorkspaceMonitorChanged;

            currentlyHighlightedPanel = null;

            mustResize = new bool[windawesome.config.Workspaces.Length];
            applicationPanels = new LinkedList<Tuple<IntPtr, Panel>>[windawesome.config.Workspaces.Length];
            for (var i = 0; i < windawesome.config.Workspaces.Length; i++)
            {
                applicationPanels[i] = new LinkedList<Tuple<IntPtr, Panel>>();
            }
        }
Example #4
0
        void IWidget.InitializeWidget(Bar bar)
        {
            this.bar = bar;

            label = bar.CreateLabel(prefix + counter.NextValue().ToString("00") + postfix, 0);
            label.BackColor = backgroundColor;
            label.ForeColor = foregroundColor;
            label.TextAlign = ContentAlignment.MiddleCenter;

            bar.BarShown += () => updateTimer.Start();
            bar.BarHidden += () => updateTimer.Stop();
        }
        void IWidget.InitializeWidget(Bar bar)
        {
            this.bar = bar;

            label = bar.CreateLabel("", 0);
            label.BackColor = backgroundColor;
            label.ForeColor = foregroundColor;
            label.TextAlign = ContentAlignment.MiddleCenter;

            Workspace.WindowActivatedEvent += SetNewLanguage;
            InputLanguageChanged += SetNewLanguage;
        }
        void IWidget.InitializeWidget(Bar bar)
        {
            this.bar = bar;

            label = bar.CreateLabel("", 0);
            label.BackColor = backgroundColor;
            label.ForeColor = foregroundColor;
            label.TextAlign = ContentAlignment.MiddleCenter;

            bar.BarShown += () => updateTimer.Start();
            bar.BarHidden += () => updateTimer.Stop();
        }
        void IWidget.InitializeWidget(Bar bar)
        {
            this.bar = bar;

            Windawesome.WindowTitleOrIconChanged += WindawesomeOnWindowTitleOrIconChanged;

            var hWnd = NativeMethods.FindWindow(windowClassName, null);
            var text = NativeMethods.GetText(hWnd);
            label = bar.CreateLabel(text, 0);
            label.BackColor = backgroundColor;
            label.ForeColor = foregroundColor;
            label.TextAlign = ContentAlignment.MiddleCenter;
        }
Example #8
0
        void IWidget.InitializeWidget(Bar bar)
        {
            this.bar = bar;

            bar.BarShown += () => OnWorkspaceLayoutChanged(bar.Monitor.CurrentVisibleWorkspace);

            Workspace.LayoutUpdated += () => OnWorkspaceLayoutChanged(bar.Monitor.CurrentVisibleWorkspace);
            Workspace.WorkspaceShown += OnWorkspaceLayoutChanged;
            Workspace.WorkspaceLayoutChanged += (ws, _) => OnWorkspaceLayoutChanged(ws);

            layoutLabel = bar.CreateLabel("", 0);
            layoutLabel.TextAlign = ContentAlignment.MiddleCenter;
            layoutLabel.BackColor = backgroundColor;
            layoutLabel.ForeColor = foregroundColor;
            if (onClick != null)
            {
                layoutLabel.Click += (unused1, unused2) => onClick();
            }
        }
Example #9
0
        void IWidget.InitializeWidget(Bar bar)
        {
            if (flashWorkspaces)
            {
                flashTimer.Tick += OnTimerTick;
                OnWorkspaceFlashingStopped += SetWorkspaceLabelColor;
            }

            bar.BarShown += () => flashTimer.Start();
            bar.BarHidden += () => flashTimer.Stop();

            workspaceLabels = new Label[windawesome.config.Workspaces.Length];

            Workspace.WorkspaceWindowAdded += (ws, _) => SetWorkspaceLabelColor(ws);
            Workspace.WorkspaceWindowRemoved += (ws, _) => SetWorkspaceLabelColor(ws);

            Workspace.WorkspaceDeactivated += OnWorkspaceChangedFromTo;
            Workspace.WorkspaceActivated += OnWorkspaceChangedFromTo;
            Workspace.WorkspaceShown += OnWorkspaceChangedFromTo;
            Workspace.WorkspaceHidden += OnWorkspaceChangedFromTo;

            for (var i = 0; i < windawesome.config.Workspaces.Length; i++)
            {
                var workspace = windawesome.config.Workspaces[i];
                var name = workspace.name ?? (i + 1).ToString();

                var label = bar.CreateLabel(" " + name + " ", 0);
                label.TextAlign = ContentAlignment.MiddleCenter;
                label.Click += OnWorkspaceLabelClick;
                workspaceLabels[i] = label;
                SetWorkspaceLabelColor(workspace);
            }
        }