linuxmint/Cinnamon — Issue #307: REQUEST - Swaped panels for classic-flipped layout option
Author: crzen
Created: 2012-02-07 17:23:47+00:00
State: open

I understand that in future updates to cinnamon we will have better reconfigurability of the panel(s). Until that time I was wondering if you would consider this additional function to the desktop layout. It adds a fourth choice to the existing three of traditional, flipped, and classic to cinnamon-settings, I just called it “classic flip”. It swaps the (classic) top and bottom panels and changes the directions of the menus, tooltips, applet tips/menus, and also of lookingglass without affecting the other settings.

These are the code changes I propose:

In /usr/lib/cinnamon-settings/cinnamon-settings.py
Change line 638 to:
desktop_layouts = [["traditional", _("Traditional (panel at the bottom)")], ["flipped", _("Flipped (panel at the top)")], ["classic", _("Classic (panels at the top and at the bottom)")], ["classic flip", _("Classic Flip (panels at the top and at the bottom)")]]

In /usr/cinnamon/js/ui/layout.js
Insert at line 268:
else if (Main.desktop_layout == Main.LAYOUT_CLASSIC_FLIP) {
this.panelBox.set_position(this.bottomMonitor.x, this.bottomMonitor.y + this.bottomMonitor.height - 25);
this.panelBox.set_size(this.bottomMonitor.width, 25);
this.panelBox2.set_position(this.primaryMonitor.x, this.primaryMonitor.y);
this.panelBox2.set_size(this.primaryMonitor.width, -1);
}

In usr/cinnamon/js/ui/main.js
Insert at line 56:
const LAYOUT_CLASSIC_FLIP = "classic flip";

In usr/cinnamon/js/ui/main.js
Insert at line 219
else if (desktop_layout == LAYOUT_CLASSIC_FLIP) {
applet_side = St.Side.BOTTOM;

In usr/cinnamon/js/ui/main.js
insert at line 316:
else if (desktop_layout == LAYOUT_CLASSIC_FLIP) {
panel = new Panel.Panel(true);
panel2 = new Panel.Panel(false);
if (global.session_type == Cinnamon.SessionType.USER) {
menu = new Menu.ApplicationsButton();
panel._leftBox.add(menu.actor);
panel._menus.addMenu(menu.menu);
panelLaunchersBox = new PanelLaunchers.PanelLaunchersBox(St.Side.BOTTOM);
panel._leftBox.add(panelLaunchersBox.actor);
showDesktopButton = new ShowDesktopButton.ShowDesktopButton(St.Side.TOP);
panel2._leftBox.add(showDesktopButton.actor);
windowList = new WindowList.WindowList(St.Side.TOP);
panel2._leftBox.add(windowList.actor);
}
dateMenu = new DateMenu.DateMenuButton({ showEvents: false });
panel._rightBox.add(dateMenu.actor, { y_fill: true });
panel._menus.addMenu(dateMenu.menu);
if (global.session_type == Cinnamon.SessionType.USER) {
workspaceSwitcher = new WorkspaceSwitcher.WorkspaceSwitcher();
panel2._rightBox.add(workspaceSwitcher.actor);
}
layoutManager.panelBox.add(panel.actor);
layoutManager.panelBox2.add(panel2.actor);
}

In /usr/cinnamon/js/ui/appletManager.js
Change line line 223 to:
if (Main.desktop_layout == Main.LAYOUT_TRADITIONAL || Main.desktop_layout == Main.LAYOUT_CLASSIC_FLIP) {

In /usr/cinnamon/js/ui/lookingGlass.js
Change line 936 to:
if (Main.desktop_layout == Main.LAYOUT_TRADITIONAL || Main.desktop_layout == Main.LAYOUT_CLASSIC_FLIP) {

Someone in the forums asked about swapping the panels, so I dug through the code and figured out a way to do it for them, I also liked it when I was done. I then thought a setting would be a better option for now so I rewrote it that way. This could easily be removed when the configurable panels become available and since you would be removing the other options anyway.