open as root?

The dedicated forum for PCMan File Manager - http://wiki.lxde.org/en/PCManFM
miks
Posts: 9
Joined: Tue Sep 29, 2009 1:02 pm

Re: open as root?

Post by miks »

freelY, I tried your fix and it launches pcmanfm from the menu entry but not as root.......
phillipe
Posts: 41
Joined: Mon Apr 27, 2009 4:12 pm

Re: open as root?

Post by phillipe »

Here is the code fixed:

Code: Select all

#!/bin/sh

#-------------------------------------------------------
# Start program

export launchasroot='
<window title="Root Launcher" icon="/usr/share/icons/gnome/32x32/apps/file-manager.png" window-position="2" width-request="300">
	<notebook labels="Launch as Root">
		<frame>
		<hbox>
			<button>
				<input file>"/usr/share/icons/gnome/32x32/apps/file-manager.png"</input>
				<action>gksu -l /usr/bin/pcmanfm &</action>
			</button>
			<text use-markup="true" width-chars="17">
				<label>"File Manager Superuser Mode"</label>
			</text>
		</hbox>
		</frame>
	</notebook>
</window>
'

gtkdialog --program=launchasroot
unset launchasroot
==> Phillipe Smith ( SmithuX ) <==
Email: phillipe@archlinux.com.br
WebSite: http://www.smithux.com
Neal
Posts: 19
Joined: Wed Aug 12, 2009 9:34 am

Re: open as root?

Post by Neal »

Hmm...... I'm not seeing the error in the script, so I'll need to review it a line at a time. I'll get back to you as soon as I have something.
FreelY
Posts: 11
Joined: Tue Oct 06, 2009 11:31 pm
Location: ҒЯ

Re: open as root?

Post by FreelY »

Strange. You should have "PCMan file manager" and the new created "PCMan Root" in your LXDE menu.
Image

This my file /usr/bin/launchasroot.sh

Code: Select all

#!/bin/sh

#-------------------------------------------------------
# Start program

export launchasroot='
<window title="Root Launcher" icon="/usr/share/icons/gnome/32x32/apps/file-manager.png" window-position="2">
<vbox>
  <notebook label="Launch as Root ">
  <vbox>
  <frame>
            <hbox>
                 <button>
                  <input file>"/usr/share/icons/file_tools_section.png"</input>
                  <action>gksu -l /usr/bin/pcmanfm &</action>
               </button>
               <text use-markup="true" width-chars="17">
                  <label>"File Manager Superuser Mode"</label>
               </text>
            </hbox>   
  </vbox>
</window>
'

gtkdialog --program=launchasroot
unset launchasroot
My /usr/share/applications/pcmanfm_root.desktop file:

Code: Select all

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=PCMan Root
Categories=Application;System;Utility;Core;GTK;
Name[zh_TW]=檔案總管
Name[fi]=PCMan-tiedostonhallinta
Name[et]=PCMan failihaldur
Name[ja]=PCMan ファイルマネージャ
Exec=gksu /usr/bin/pcmanfm
Icon=pcmanfm
StartupNotify=true
Type=Application
Terminal=false
MimeType=x-directory/normal;inode/directory;
GenericName=File Manager
GenericName[ru]=Файловый менеджер
GenericName[zh_TW]=檔案管理程式
GenericName[fi]=Tiedostonhallinta
GenericName[et]=Failihaldur
GenericName[ja]=ファイルマネージャ
Comment=Browse the file system and manage the files
Comment[zh_TW]=瀏覽檔案系統及管理檔案
Comment[fi]=Selaa tiedostojärjestelmää ja hallitse tiedostoja
Comment[et]=Lehitse failisüsteemi ja halda faile
Comment[ja]=ファイルシステムをブラウズし、ファイルの管理を行います
And my /usr/share/applications/.desktop file (named "Launch as Root")

Code: Select all

[Desktop Entry]
Name=Launch as Root
Exec=/usr/bin/launchasroot
Comment=Root Launcher
Icon=file-manager.png
Terminal=false
Type=Application
StartupNotify=true
Categories=Application;System;Utility;Core;GTK;
OnlyShowIn=LXDE;

Don't forget to restart your session.
Last edited by FreelY on Sun Nov 08, 2009 11:07 pm, edited 1 time in total.
Image
miks
Posts: 9
Joined: Tue Sep 29, 2009 1:02 pm

Re: open as root?

Post by miks »

OK, thanks guys, I now have it (sort of) working from the menu after copying FreelY's scripts etc BUT strangely, after a fresh boot, it brings up the dialog box asking for the root password. OK o far. After entering that, the screen flashes but no pcmanfm appears. So, I go back to the menu and try again and this time it opens as root, and continues to do so for the rest of the session. Wierd. Anyway, it is good enough, but it would be interesting to know why it needs 2 stabs at it after a reboot. :mrgreen:
Locked