Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow clock widget to be optionally placed back at middle of panel #60

Closed
willismonroe opened this issue Feb 7, 2017 · 31 comments
Closed
Assignees

Comments

@willismonroe
Copy link

Is there a way to center the Date and Time widget?

@jderose9
Copy link
Contributor

jderose9 commented Feb 8, 2017

You want the date and time in the dead center of the panel (like stock gnome)? Do I understand correctly?

@willismonroe
Copy link
Author

Yep, my assumption is that the setting "Clock location" -> "Natural" would be the same as the original panel, i.e. in the center. For me, that setting places the Date/Time widget on the left-most edge of the right hand corner widgets. I'd be happy to work on a patch if you can point me in the write direction.

@jderose9
Copy link
Contributor

jderose9 commented Feb 9, 2017

In gnome, the main panel is split in 3 containers (_leftBox, _centerBox, _rightBox). This extension overrides the allocation in panel.js so that the center container is moved directly next to the right container.

So, basically, the default behavior just needs to be called instead of the override to have the centerBox back to the center. That includes everything in the center though (so if you added additional center items via extensions, such as openWeather).

I'm not decided how to most clearly represent that option in the settings though. The existing setting is specific to the clock widget and whether it should be moved from the center container to the right container. Maybe a new setting under the Advanced dialog menu?

@d3v2null
Copy link

d3v2null commented Feb 23, 2017

Having the option to move the clock to the centre is a 'must have' in my opinion..
Thank you very much for enhancing the user experience in GNOME with this extension!!

@jderose9
Copy link
Contributor

jderose9 commented Feb 25, 2017

If the AppMenu is visible on the panel, does it go on the right or in the center next to the clock?
bottomrightappmenu

Does the font need to be configured separately from the right side content?

@jderose9 jderose9 changed the title Way to center Date and Time Allow clock widget to be optionally placed back at middle of panel Mar 4, 2017
@thedrint
Copy link

thedrint commented Mar 30, 2017

@jderose9 i think that @willismonroe want something like this

gnome-shell-imgur-3xqoxy

I'm not familiar with javascript and extensions coding, simply change __setClockLocation

    if(loc == "NATURAL") {
            // only move the clock back if it's in the right box
            if ( rightBox.get_children().indexOf(dateMenu.container) != -1 ) {
                rightBox.remove_actor(dateMenu.container);
                centerBox.add_actor(dateMenu.container);
            }
            else {
                dateMenu.container.set_x_align(Clutter.ActorAlign.CENTER);
                dateMenu.container.set_x_expand(true);
            }
        } else {

and _allocate

        let sideWidth = allocWidth - rightNaturalWidth - centerNaturalWidth;
        //DIRTY: Correcting real width of leftBox
        sideWidth = Math.min(sideWidth, leftNaturalWidth);

        let childBoxLeft = new Clutter.ActorBox();
        childBoxLeft.y1 = 0;
        childBoxLeft.y2 = allocHeight;
        if (this.panel.actor.get_text_direction() == Clutter.TextDirection.RTL) {
            childBoxLeft.x1 = allocWidth - Math.min(Math.floor(sideWidth), leftNaturalWidth);
            childBoxLeft.x2 = allocWidth;
        } else {
            childBoxLeft.x1 = 0;
            childBoxLeft.x2 = sideWidth;
        }
        this.panel._leftBox.allocate(childBoxLeft, flags, true);

        let childBoxRight = new Clutter.ActorBox();
        childBoxRight.y1 = 0;
        childBoxRight.y2 = allocHeight;
        if (this.panel.actor.get_text_direction() == Clutter.TextDirection.RTL) {
            childBoxRight.x1 = 0;
            childBoxRight.x2 = rightNaturalWidth;
        } else {
            childBoxRight.x1 = allocWidth - rightNaturalWidth;
            childBoxRight.x2 = allocWidth;
        }
        this.panel._rightBox.allocate(childBoxRight, flags, true);

        let childBoxCenter = new Clutter.ActorBox();
        childBoxCenter.y1 = 0;
        childBoxCenter.y2 = allocHeight;
        if (this.panel.actor.get_text_direction() == Clutter.TextDirection.RTL) {
            // childBoxCenter.x1 = rightNaturalWidth;
            // childBoxCenter.x2 = childBoxRight.x1 + centerNaturalWidth;
            childBoxCenter.x1 = childBoxRight.x1;
            childBoxCenter.x2 = childBoxLeft.x2;
        } else {
            // childBox.x1 = allocWidth - centerNaturalWidth - rightNaturalWidth;
            // childBox.x2 = childBox.x1 + centerNaturalWidth;
            childBoxCenter.x1 = childBoxLeft.x2;
            childBoxCenter.x2 = childBoxRight.x1;
        }
        this.panel._centerBox.allocate(childBoxCenter, flags, true);

        let childBox = new Clutter.ActorBox();

behaviors in panel.js

But keep in mind that its hack, for my custom situation (i dont use appMenu). For appMenu it would be great make complex decision. IMHO, mac style is best, but I dont know how to implement it on a small displays.

@hlechner
Copy link
Contributor

hlechner commented Apr 6, 2017

@jderose9 or maybe just keep the original position for objects on center and right position?

I have two objects in center (Weather and Clock) and the rest on right position:
image

Using dash-to-panel the objects seems a mess together:
image

@prairir
Copy link

prairir commented Apr 19, 2017

i would also like to say that not having a way to put the clock back to the middle is very unfortunate because it is something i would like alot.

@akyag
Copy link

akyag commented Jun 14, 2017

yes, i would like the clock and date in the centre too, its something that I have gotten used to...

@Biggybi
Copy link

Biggybi commented Aug 24, 2017

I also would like to suggest adding an option to place the clock at the center of the bar :)

@nobody-special666
Copy link

yes please give the open to leave all centered widgets (clock, openweather, etc.) alone where gnome has defaulted them to be for so long.

@optimistic5
Copy link

I also agree. It would be great to have an option "clock in the center".

@ghost
Copy link

ghost commented Dec 14, 2017

I really miss the ability to put the clock and openweather widget in the center.

@ghost
Copy link

ghost commented Jan 21, 2018

Have a look at this answer : https://askubuntu.com/a/948120/661482

@nobody-special666
Copy link

nobody-special666 commented Feb 14, 2018

i just discovered "frippery panel favorites" extension, which simply adds the favorites launchers to the panel without disturbing the placement of other extensions, and since uninstalled dash to panel.
Still, thanks for all the hard work on this plugin.

@SegFault0x0
Copy link

Great plugin, but yeah, this is a big stopper for me. I've been sticking with the Taskbar extension for almost a year hoping that Dash-To-Panel would one day finally add an option to center the clock.

@craiggjigg
Copy link

seconding this, I would also like to have the option to center my clock + weather while using Dash to Panel. I could have sworn I hade it before I disabled and started messing around with the Dock but I guess not.

Driving me nuts, great extension though!

@jderose9
Copy link
Contributor

jderose9 commented Aug 22, 2018

I've added two new taskbar positions and adjusted the description of the existing options. The options now are:

  • Left, with plugin icons collapsed to right
  • Left, with fixed center plugin icons *
  • Left, with floating center plugin icons *
  • Center, fixed in middle of monitor
  • Center, floating between left and right elements

The * are the new options which are intended to address this issue.

Any feedback on the new descriptions or the behavior of the options would be appreciated! Available now in master.

@charlesg99
Copy link
Member

Works good over here 👍

@tnilzon
Copy link

tnilzon commented Aug 27, 2018

Hi, tnilzon here:
I have now downloaded and tried the extension from master. Yes it works, the clock can now be positioned in the panel center! Nice work!!!
Thanks!

@eyome
Copy link

eyome commented Sep 6, 2018

Hi,

I downloaded Dash-to-panel from Gnome Shell extension and I don't have this functionality.
Could you push this new version? :p

Best regards.

@eyome
Copy link

eyome commented Sep 13, 2018

Hi,

Thank you so much, it is exactly what I looked for!

Best regards!

@jderose9
Copy link
Contributor

Great, thanks! This in in v16 and live on e.g.o.

@willismonroe
Copy link
Author

I'm not seeing the new center options (I just checked e.g.o and I'm running the most recent version).

I have:

  • Left of plugin icons
  • Right of plugin icons
  • Left of system indicators
  • Right of system indicators
  • Left of taskbar
  • Right of taskbar

@jderose9
Copy link
Contributor

@willismonroe they are actually under the taskbar position settings. It's confusing because gnome breaks the panel up into left, center and right boxes. The center box typically contains the clock and some other plugins such as open weather.

What dash-to-panel did before was to push the center box all the way to the right, directly next to the right box content. I you chose to move the clock next to the status icons, it would actually remove it from the center box and into the right box. So, to get the clock in the center you need to leave the center box in the center, and leave the clock in the center box.

I'm definitely open to improving this as I would like it to be easy for someone to understand without a paragraph explaining the inner-workings of gnome. Better wording maybe, or a screenshot or highlighting sections of the panel could help?

@willismonroe
Copy link
Author

Thanks @jderose9 for that thorough explanation. I guess it's still not exactly what I was looking for, here's the result:
image

centering the "center box" moves all the open application icons also to the middle.

That all being said, it's still a great extension, and the way I use gnome Shell.

@jderose9
Copy link
Contributor

@willismonroe What is the configuration you are looking for? If you want the clock in the center, put the taskbar position as "Left, with fixed center plugin icons" and the Clock location as "left/right of plugin icons".

@willismonroe
Copy link
Author

willismonroe commented Sep 25, 2018 via email

@SegFault0x0
Copy link

[...] put the taskbar position as "Left, with fixed center plugin icons" and the Clock location as "left/right of plugin icons".

:) A bit cryptic, but works beautifully! Great job!

@jderose9
Copy link
Contributor

I'd definitely like to improve the wording on these two settings. Suggestions welcome :)

@gyscos
Copy link

gyscos commented Mar 26, 2020

[...] put the taskbar position as "Left, with fixed center plugin icons" and the Clock location as "left/right of plugin icons".

It seems that this centers the pair "clock and app menu", which means that when changing application, the app menu will have a different label (for example "Google Chrome" instead of "Tweaks"). This will change the size of the app menu button, and will slightly offset the clock. The end result is that the clock wiggles left and right everytime the user switches between applications.

A workaround could be to not show the App Menu at all, but this may be undesirable for some applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests