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

From WebOS Internals
Jump to navigation Jump to search
(Add description of how to rearrange order of menu items in launcher menu)
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<p>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.</p>
+
{{template:patch}}
<p>Upon further investigation, they were correct. There is existing code in a particular js file that has been commented out that will allow you to create a new page and delete the current page you are on in the Launcher. There is a variable that stores the max number of pages 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?</p>
+
[[Image:Launcher_AddDeletePages.jpg|border|right|Add/Delete Pages]]
<p>After I uncommented these said lines and rebooted, I was able to perform these functions. So I tested the new page function.</p>
+
==Introduction==
<p>The new page and delete page functions will appear in the launcher app menu.</p>
+
 
<p><strong>Creating/adding a page:</strong></p>
+
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?
<p>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. I was able to drag icons to it just like any other page. To test this new page out I added a contact to that page.</p>
+
 
<p><strong>Deleting/Removing a page:</strong></p>
+
===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==
  
<p>The code is already set up to automagically move any icons to the page to the left of the page you are deleting. What I mean is if the page you delete is in the middle of other pages it will toss whatever was on your current page to the page to the left of it.</p>
+
<pre>
<p>When I deleted a page that was to the left of the apps page that had web app defaulted to it, it tossed the icons to that page because there is no page to the left of the one I just deleted.</p>
+
/usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
<p><strong>Creating/adding multiple pages:</strong></p>
+
</pre>
<p>So I was on page 1 and created a new page. Then I moved over to the page where device info, backup, screen &amp; lock was at and created a new page there. It tossed the page to the right and made a new page.</p>
+
*Uncomment the following
<hr />
+
**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.
  
<h1 id="toc1"><span>Uncomment the Following</span></h1>
+
Original discovery credit is unknown. Pyrognome tested and confirmed the new page and delete page functionality.
  
<p>/usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js</p>
 
<p>Look for "appMenuModel" (line 27) a few lines below you will see a line that has "newpage" in it.<br />
 
  
On the line that remove the "/*" and on the line that has "deletepage" remove the "*/"</p>
+
'''Rearrange Order of Menu Items'''
<p>Next look further in the file (line 119) for "switch" again remove the "/* and "*/" that surrounds the cases for newpage and deletepage.</p>
 
<p>reboot and now you'll have new page and delete page in the launcher app menu.</p>
 
<p>Note that you can download a patch for this at http://gitorious.org/webos-internals/modifications/blobs/raw/master/applauncher/add-delete-pages-in-the-launcher.patch</p>
 
  
You can see a picture of the new menu here: http://img195.imageshack.us/img195/7636/unknown20091306141631.png
+
This is a fantastic patch that makes the launcher much more useful (along with the 4x4 icon patches), but I kept hitting Delete Page because it was second on the list when I was trying to List Apps.  Then, the page that I was currently on would be deleted and I would have to go back through and move all the icons to a new page - frustrating for me.  Therefore, I simply rearranged the order of the menu items to what was more intuitive for me.  This is a small change to this great patch, and does not add or subtract any functionality.
<p>-PS I moved the location of the edit menu down…</p>
 
<p>-Enjoy</p>
 
<hr />
 
<p>The credit to this goes to someone in the forums, at the time this was written I wasn't able to find out who exactly was it who wrote about it first (purely I don't have the time to look.) Pyrognome tested and confirmed the new page and delete page functionality.</p>
 
  
= Add/Delete Pages Patch =
+
<pre>
 +
Login via SSH
  
[[Image:Launcher_AddDeletePages.jpg|border|right|Add/Delete Pages]]
+
sudo -i
 +
//enter password to become root
 +
 
 +
cd /
 +
 
 +
mount -o remount,rw /
 +
 
 +
vi /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
 +
//go to lines 26 and 27 and comment them out by adding '//' in front of them...to do this, hit 'i' to enter edit mode (you will see a capital i on the
 +
//bottom left-hand corner of the screen) and scroll over to the beginning of the lines and type '//'. Then, rearrange the five menu items to whatever
 +
//order you want...what I like best is below:
 +
 
 +
        items: [
 +
                        //{ label: $L('New page'), command: 'newpage' },
 +
                        //{ label: $L('Delete page'), command: 'deletepage' },
 +
                        Mojo.Menu.editItem,
 +
                        { label: $L('List Apps...'), command: 'listapps' },
 +
                        { label: $L('New page'), command: 'newpage' },
 +
                        { label: $L('Delete page'), command: 'deletepage' },
 +
                        Mojo.Menu.helpItem
 +
                ]
 +
 
 +
//This puts Edit first, then List Apps, New Page, Delete Page, and Help last in the menu
 +
//hit ESC to exit edit mode, and then type ':wq' to save the file (launcher-assistant.js) that we just modified...
 +
 
 +
mount -o remount,ro /
 +
 
 +
stop LunaSysMgr && start LunaSysMgr
 +
</pre>
 +
 
 +
All credit for this patch goes to original developer!
 +
 
 +
Enjoy! jmartino2011, 11-10-09
  
== Introduction ==
+
==Patch Process==
  
I'm trying to make most of my modifications into patches, so here's another.
+
The patch is also located in the webos-internals gitorious repository. Click [[Applying Patches]] for info on patching from it.
* [[User:HattCzech|HattCzech]]
 
  
== Procedure ==
+
I'm trying to make most of my modifications into patches --[[User:HattCzech|HattCzech]]
  
Run the following commands:
+
*Run the following commands:
  
 
''In this example, I have the patch file located in my home directory under '''patches'''''
 
''In this example, I have the patch file located in my home directory under '''patches'''''
Line 48: Line 82:
 
</source>
 
</source>
  
This is what you should see if it ran properly:
+
*This is what you should see if it ran properly:
 
<source lang="text">
 
<source lang="text">
 
patching file /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
 
patching file /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
Line 59: Line 93:
  
  
== adddelpages.patch ==
+
===Patch Source (adddelpages.patch)===
  
 
<source lang="diff">
 
<source lang="diff">
Line 93: Line 127:
 
  },
 
  },
 
</source>
 
</source>
 +
 +
== 1.2 Update ==
 +
In 1.2, you'll need to uncomment lines 26-27, 120-134.

Latest revision as of 20:58, 10 November 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.


Rearrange Order of Menu Items

This is a fantastic patch that makes the launcher much more useful (along with the 4x4 icon patches), but I kept hitting Delete Page because it was second on the list when I was trying to List Apps. Then, the page that I was currently on would be deleted and I would have to go back through and move all the icons to a new page - frustrating for me. Therefore, I simply rearranged the order of the menu items to what was more intuitive for me. This is a small change to this great patch, and does not add or subtract any functionality.

Login via SSH

sudo -i
//enter password to become root

cd /

mount -o remount,rw /

vi /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
//go to lines 26 and 27 and comment them out by adding '//' in front of them...to do this, hit 'i' to enter edit mode (you will see a capital i on the
//bottom left-hand corner of the screen) and scroll over to the beginning of the lines and type '//'. Then, rearrange the five menu items to whatever
//order you want...what I like best is below:

         items: [
                        //{ label: $L('New page'), command: 'newpage' },
                        //{ label: $L('Delete page'), command: 'deletepage' },
                        Mojo.Menu.editItem,
                        { label: $L('List Apps...'), command: 'listapps' },
                        { label: $L('New page'), command: 'newpage' },
                        { label: $L('Delete page'), command: 'deletepage' },
                        Mojo.Menu.helpItem
                ]

//This puts Edit first, then List Apps, New Page, Delete Page, and Help last in the menu
//hit ESC to exit edit mode, and then type ':wq' to save the file (launcher-assistant.js) that we just modified...

mount -o remount,ro /

stop LunaSysMgr && start LunaSysMgr

All credit for this patch goes to original developer!

Enjoy! jmartino2011, 11-10-09

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.