Difference between revisions of "Patch Launcher Add or Delete Pages"

From WebOS Internals
Jump to navigation Jump to search
Line 85: Line 85:
 
  },
 
  },
 
</source>
 
</source>
 +
 +
== 1.2 Update ==
 +
In 1.2, you'll need to uncomment lines 26-27, 120-134.

Revision as of 07:00, 29 September 2009


Add/Delete Pages

Introduction

Someone in the forum talked about being able to add and delete pages in the Launcher app and I thought I would look into it further. They stated that they were able to add new pages and delete existing pages. Upon further investigation, they were correct. There is existing code, commented out, that will allow you to create a new launcher page or delete the current launcher page. There is a variable for the max number of pages palm set to 10. This value can probably be increased, but I don't recommend it and seriously, who would need more that 10 pages anyway, right?

Usage

  • The new page and delete page functions will appear in the launcher menu.
    • New Page
      • This will create a new page and move whatever page you were on to the right. There is nothing special to this page besides the fact that you now have a new page. You can drag icons to it just like any other page.
    • Delete Page
      • This will delete the current launcher page. Any icons on the page will automatically move to the page to the left of the page being deleted. If there is no page to the left of the page being deleted icons are automatically moved to the default page of the Web Browser.

Editing Process

/usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
  • Uncomment the following
    • Look for "appMenuModel" (line 29) a few lines below you will see a line that has "newpage" in it. On the line that remove the "/*" and on the line that has "deletepage" remove the "*/"
    • Look further in the file (line 120) for "switch" again remove the "/* and "*/" that surrounds the cases for newpage and deletepage.
  • Perform a restart and the new page and delete page options will be in the launcher menu.

Original discovery credit is unknown. Pyrognome tested and confirmed the new page and delete page functionality.

Patch Process

The patch is also located in the webos-internals gitorious repository. Click Applying Patches for info on patching from it.

I'm trying to make most of my modifications into patches --HattCzech

  • Run the following commands:

In this example, I have the patch file located in my home directory under patches <source lang="bash"> cd / sudo patch -p0 --backup-if-mismatch < ~/patches/adddelpages.patch </source>

  • This is what you should see if it ran properly:

<source lang="text"> patching file /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js </source>

These modifications will require LunaSysMgr to be restarted. A rescan will not work. After you've run the commands above, run one more command: <source lang="bash"> pkill LunaSysMgr </source>


Patch Source (adddelpages.patch)

<source lang="diff"> diff -ur /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js /usr/lib/luna/sysmod/luna-applauncher/app/controllers/launcher-assistant.js --- /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js 2009-07-18 00:21:37.000000000 -0500 +++ /usr/lib/luna/sysmod/luna-applauncher/app/controllers/launcher-assistant.js 2009-07-24 11:03:32.000000000 -0500 @@ -30,8 +30,8 @@

		visible: true,
		label: $L('Launcher'),
        items: [

- /*{ label: $L('New page'), command: 'newpage' }, - { label: $L('Delete page'), command: 'deletepage' },*/ + { label: $L('New page'), command: 'newpage' }, + { label: $L('Delete page'), command: 'deletepage' },

			Mojo.Menu.editItem,
			{ label: $L('List Apps...'), command: 'listapps' },
			Mojo.Menu.helpItem

@@ -124,7 +124,6 @@

				case 'listapps':
					ApplicationService.launch(this.deviceInfo.id, this.deviceInfo.params);
					break;

- /*

				case 'newpage':
					if (this.pageDivs.length < 10) {
						this.insertPage(this.activePageIndex, true);

@@ -138,7 +137,6 @@

						}
					}
					break;

- */

			}
		}
	},

</source>

1.2 Update

In 1.2, you'll need to uncomment lines 26-27, 120-134.