기본 콘텐츠로 건너뛰기

[리눅스 명령어] Unity Panel에 Launcher추가

출처 : http://www.geekyboy.com/archives/384

요약:
나는 아래 본문에 소개된 여러 방법들중에 Method2가 가장 편리하다 생각함.

1. 설치
sudo apt-get install --no-install-recommends gnome-panel

2. alias 등록하기
echo 'alias createLauncherIcon="sudo gnome-desktop-item-edit /usr/share/applications/ --create-new"' \
>> ~/.bashrc

3. 실행하기
$ createLauncherIcon

4. 시키는대로 값을 채워넣고 오케이

5. 이제 nautilus /usr/share/applications/아이콘이름.icon을 마우스로 드래그해서 Unity Launcher에 넣어 놓는다.

6. 이제 실행될 것이다.

Tip1:
4번에서 아이콘 이미지를 찾는데 종종 아이콘이 굉장히 깊숙한 하위 디렉토리에 숨어 있는 경우가 있다. 파일이 한두개가 아니라 수십개의 경우 다양한 경로를 따라가 노틸러스를 실행해 이미지를 일일히 보는 것도 장난 아닌 막노동이다. 차라리 모든 이미지 파일을 /tmp/images에 복사해놓고 원하는 이미지인지 확인할 수 있다면?
$ find . -type f | xargs -i{} file {} | grep -i image | awk -F":" '{print $1}' | xargs -i{} cp {} /tmp/images #이는 하위 디렉토리에 있는 파일들중 이미지파일만을 /tmp/images(미리 만들어야함)에 복사해 준다. 이제 직접 이 /tmp/images/에 있는 파일들을 눈으로 한꺼번에 보고 파일 이름을 파악하면 경로 찾기 끝. (단, awk 프로그래밍 언어를 이용해 콜론을 delimiter로 사용했지만, 이건 어디까지나 파일 이름에 콜론이 없다는 가정 하에만 사용 가능하니 주의. 만약 그런 경우라면 잘 풀어나가길 바란다. sed를 이용해 .png .icon .xpm .jpg .jpg 이후의 값은 무조건 스트림 삭제(?)하는 것도 방법)

그런데 gnome-desktop-item-edit파일을 이요해 만들때 xpm확장자의 이미지 파일이 기본 형식인 듯 하다. 만약 원하는 이미지를 찾았지만 png 등의 다른 형식이라면? 방법은 ImageMagick패키지의 convert 콘솔 프로그램을 이용하면 된다.
$ convert a.png a.xpm

Tip2:
그리고 nautilus 등의 디렉토리 탐색기를 이용해 /usr/share/applications/에 들어가도 파일을 지우거나 수정이 불가능하다. 반드시 관리자 권한을 부여받은 프로세스를 생성해야 함.
$ sudo nautilus /usr/share/applications/

Tip3:
만약 아이콘을 오른쪽 클릭해 run as root를 띄우고 싶다면 다음과 같이 한다. (ex. wireshark)
아래의 코드 내용을 적절히 바꿔 program.desktop 파일 끝에 append한다.
X-Ayatana-Desktop-Shortcuts=Runroot

[Runroot Shortcut Group]
Name=Run as root
Exec=gksudo -k -u root APP_COMMAND
TargetEnvironment=Unity
만약 이미 퀵리스트가 존재한다면 내용을 문맥에 맞게 추가하면 된다.

끝~


본문:

Add items to Ubuntu 12.04 Unity Launcher (quicklaunch)

The recent upgrade to Ubuntu 12.04 Precise Pangolin left me somewhat hanging when it comes to creating launchers on the desktop, and also in the Unity Launcher (also called quicklaunch in some places) for Zend Studio and PHPStorm. In Gnome prior to Unity in Ubuntu it was easy to right click the desktop and select Create Launcher to create icons on the desktop to launch applications or scripts, but in 12.04 that options is gone. So here is how I solved some of the issues.
I will cover adding Eclipse to the launcher, adding Zend Studio to the launcher, and PHPStorm to the launcher.

Method 1

For Netbeans and Eclipse based editors like Zend Studio or Aptana it is not too bad. I created a *.desktop files for each one and put it in the /home/{username}/.local/share/applications/ directory. Here is how I created a zendstudio.desktop file:
Note: If you want this option to be available for all users you can alternatively create the file in the /usr/share/applications/ directory, but that requires root or sudo permissions.
[Desktop Entry]
Version=1.0
Name=Zend Studio
Comment=PHP IDE for PHP development
Type=Application
Categories=Development;IDE;
Exec=/home/{username}/Zend/ZendStudio-10.0.0/ZendStudio
Terminal=false
StartupNotify=true
Icon=/home/{username}/Zend/ZendStudio-10.0.0/icon.xpm
After creating the file above I then launched Zend Studio by going to the Zend folder in my home directory and double clicking the ZendStudio executable. Once the application is running I right clicked the icon in the Unity Launcher and select “Lock to Launcher”. Now the application stays in the Unity Launcher.
The above worked for most applications, but did NOT work for PHPStormwhich launches by using a shell script named PhpStorm.sh. I tried doing the method above, and I also tried creating the desktop file and then dragging and dropping it to the Launcher, and that did not work either. (See Method 3 Below which works for PHPStorm.)

Method 2

Another method I found was to install the ‘gnome-panel’ package. (Actually it was already installed on my system for some reason.)
sudo apt-get install --no-install-recommends gnome-panel
With the gnome-panel I was now able to create a launcher on the desktop using the command below.
gnome-desktop-item-edit ~/Desktop/ --create-new

In the create launcher dialog I filled it out as follows:
Type: Application
Name: PhpStorm
Command: /bin/bash /home/username/PhpStorm/PhpStorm-117.257/bin/phpstorm.sh
NOTE: You could use /bin/sh or whatever shell you use. I use bash so that is why I put /bin/bash.
To create a shortcut in the Unity Launcher I double clicked the new desktop launcher I created above. (NOTE: If you start PHPStorm by executing the phpstorm.sh you do not get any options at all when right clicking the icon in the Unity Launcher.) Then when PHPStorm was running I was then able to right click on the icon in the Unity Launcher and selected “Lock to Launcher”. Voila! Now I have phpstorm on the Unity Launcher.

Method 3

This option is built right into PHPStorm. The wonderful people at JetBrains created a handy item in Tools to automatically create a menu item for you. Simply click on Tools->Create Desktop entry…and now you can Lock to Launcher the next time you run it. Start the JetBrains PhpStorm IDE from the Unity Dash you can then right click on the icon that shows up in the Unity Launcher and select “Lock to Launcher”. The icon now stays there, even after a reboot/logout.
Update:

Method 4

See comment to this post below by Shinybird on using Ubuntu Tweak. (Not sure if it works, but it sounds good.)
Enjoy!!!


source: http://askubuntu.com/questions/118822/how-to-launch-application-as-root-from-unity-launcher

If you want the app to always run as root
1) Pin the application to the launcher as normal.
2) Locate the applications .desktop file which will be in either:
  • /usr/share/applications/APPNAME.desktop
  • ~/.local/share/applications/APPNAME.desktop
  • or somewhere else, use locate .desktop|grep APPAME
3) Open with gedit:
gksudo gedit /usr/share/applications/APPNAME.desktop
4) Change then line
Exec=APP_COMMAND
to
Exec=gksudo -k -u root APP_COMMAND
5) Save
This command will also keep your environment which is very usefull if you need to connect to others servers and use your private key.
To add a quicklist option to 'Run as root'
Follow steps 1, 2 and 3 above
If the launcher currently doesn't have any other quicklist options, just append this to the end of the document
X-Ayatana-Desktop-Shortcuts=Runroot

[Runroot Shortcut Group]
Name=Run as root
Exec=gksudo -k -u root APP_COMMAND
TargetEnvironment=Unity

댓글

이 블로그의 인기 게시물

[인코딩] MS949부터 유니코드까지

UHC = Unified Hangul Code = 통합형 한글 코드 = ks_c_5601-1987 이는 MS사가 기존 한글 2,350자밖에 지원하지 않던 KS X 1001이라는 한국 산업 표준 문자세트를 확장해 만든 것으로, 원래 문자세트의 기존 내용은 보존한 상태로 앞뒤에 부족한 부분을 채워넣었다. (따라서 KS X 1001에 대한 하위 호환성을 가짐) 그럼, cp949는 무엇일까? cp949는 본래 코드 페이지(code page)라는 뜻이라 문자세트라 생각하기 십상이지만, 실제로는 인코딩 방식이다. 즉, MS사가 만든 "확장 완성형 한글 ( 공식명칭 ks_c_5601-1987 ) "이라는 문자세트를 인코딩하는 MS사 만의 방식인 셈이다. cp949 인코딩은 표준 인코딩이 아니라, 인터넷 상의 문자 송수신에 사용되지는 않는다. 하지만, "확장 완성형 한글" 자체가 "완성형 한글"에 대한 하위 호환성을 고려해 고안됐듯, cp949는 euc-kr에 대해 (하위) 호환성을 가진다. 즉 cp949는 euc-kr을 포괄한다. 따라서, 윈도우즈에서 작성되어 cp949로 인코딩 되어있는 한글 문서들(txt, jsp 등등)은 사실, euc-kr 인코딩 방식으로 인터넷 전송이 가능하다. 아니, euc-kr로 전송해야만 한다.(UTF-8 인코딩도 있는데 이것은 엄밀히 말해서 한국어 인코딩은 아니고 전세계의 모든 문자들을 한꺼번에 인코딩하는 것이므로 euc-kr이 한국어 문자세트를 인코딩할 수 있는 유일한 방식임은 변하지 않는 사실이다.) 물론 이를 받아보는 사람도 euc-kr로 디코딩을 해야만 문자가 깨지지 않을 것이다. KS X 1001을 인코딩하는 표준 방식은 euc-kr이며 인터넷 상에서 사용 가능하며, 또한 인터넷상에서 문자를 송수신할때만 사용.(로컬하드에 저장하는데 사용하는 인코딩방식으로는 쓰이지 않는 듯하나, *nix계열의 운영체제에서는 LANG을 euc-kr로 설정 가능하기도 한걸

[linux] 뻔하지 않은 파일 퍼미션(file permissions) 끄적임. 정말 속속들이 아니?

1. [특수w]내 명의의 디렉토리라면 제아무리 루트가 만든 파일에 rwxrwxrwx 퍼미션이라 할지라도 맘대로 지울 수 있다. 즉 내 폴더안의 파일은 뭐든 지울 수 있다. 2. [일반rx]하지만 읽기와 쓰기는 other의 권한을 따른다. 3.[일반rwx]단 남의 계정 폴더는 그 폴더의 퍼미션을 따른다. 4.[일반]만약 굳이 sudo로 내 소유로 파일을 넣어놓더라도 달라지는건 없고, 단지 그 폴더의 other퍼미션에 write권한이 있으면 파일을 만들고 삭제할 수 있다. 5.디렉토리의 r권한은 내부의 파일이름 정도만 볼 수있다. 하지만 ls 명령의 경우 소유자, 그룹, 파일크기 등의 정보를 보는 명령어므로 정상적인 실행은 불가능하고, 부분적으로 실행됨. frank@localhost:/export/frankdir$ ls rootdir/ ls: cannot access rootdir/root: 허가 거부 ls: cannot access rootdir/fa: 허가 거부 fa  root #이처럼 속한 파일(폴더)만 딸랑 보여준다. frank@localhost:/export/frankdir$ ls -al rootdir/ # al옵션이 모두 물음표 처리된다.. ls: cannot access rootdir/root: 허가 거부 ls: cannot access rootdir/..: 허가 거부 ls: cannot access rootdir/.: 허가 거부 ls: cannot access rootdir/fa: 허가 거부 합계 0 d????????? ? ? ? ?             ? . d????????? ? ? ? ?             ? .. -????????? ? ? ? ?             ? fa -????????? ? ? ? ?             ? root 하지만 웃긴건, r에는 읽기 기능이 가능하므로 그 폴더 안으로 cd가 되는 x권한이 없더라도 어떤 파일이 있는지 목록 정도는 알 수 있다. 하지만 r이라고

[hooking, 후킹, 훅킹] Hooking이란?

source: http://jinhokwon.blogspot.kr/2013/01/hooking.html Hooking 이란? [출처] http://blog.daum.net/guyya/2444691 훅킹(Hooking)이란 이미 작성되어 있는 코드의 특정 지점을 가로채서 동작 방식에 변화를 주는 일체의 기술 이다. 훅이란 낚시바늘같은 갈고리 모양을 가지는데 여기서는 코드의 중간 부분을 낚아채는 도구라는 뜻으로 사용된다. 대상 코드의 소스를 수정하지 않고 원하는 동작을 하도록 해야 하므로 기술적으로 어렵기도 하고 운영체제의 통상적인 실행 흐름을 조작해야 하므로 때로는 위험하기도 하다. 훅킹을 하는 방법에는 여러 가지가 있는데 과거 도스 시절에 흔히 사용하던 인터럽터 가로채기 기법이나 바로 앞에서 알아본 서브클래싱도 훅킹 기법의 하나라고 할 수 있다. 이외에도 미리 약속된 레지스트리 위치에 훅 DLL의 이름을 적어 주거나 BHO(Browser Helper Object)나 응용 프로그램 고유의 추가 DLL(Add in)을 등록하는 간단한 방법도 있고 PE 파일의 임포트 함수 테이블을 자신의 함수로 변경하기, CreateRemoteThread 함수로 다른 프로세스의 주소 공간에 DLL을 주입(Injection)하는 방법, 메모리의 표준 함수 주소를 덮어 쓰는 꽤 어려운 방법들도 있다. 이런 고급 훅킹 기술은 이 책의 범위를 벗어나므로 여기서는 소개만 하고 다루지는 않기로 한다. 이 절에서 알아볼 메시지 훅은 윈도우로 전달되는 메시지를 가로채는 기법으로 다양한 훅킹 방법중의 하나이다. 메시지 기반의 윈도우즈에서는 운영체제와 응용 프로그램, 또는 응용 프로그램 사이나 응용 프로그램 내부의 컨트롤끼리도 많은 메시지들을 주고 받는다. 훅(Hook)이란 메시지가 목표 윈도우로 전달되기 전에 메시지를 가로채는 특수한 프로시저이다. 오고 가는 메시지를 감시하기 위한 일종의 덫(Trap)인 셈인데 일단 응용 프로그램이 훅 프로시저를 설치하면 메시지가 윈도우로 보내지기