{"id":2748,"date":"2011-02-13T16:16:42","date_gmt":"2011-02-13T10:46:42","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=2748"},"modified":"2016-12-19T15:04:56","modified_gmt":"2016-12-19T09:34:56","slug":"gnome-gui-integration-w-r-t-idea-gui-launcher","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/gnome-gui-integration-w-r-t-idea-gui-launcher\/","title":{"rendered":"GNOME GUI Integration w.r.t IDEA GUI Launcher"},"content":{"rendered":"<p>One of the important part of any Installer is <em>integrating and defining launchers for GUI<\/em>. This post will demonstrate adding entries in menu bar and panel, using scripts in context of creating a GUI launcher for IDEA IDE.<br \/>\n<br \/>\ncurrently IDEA does not come with any GUI Launcher but this does not mean that we cant have one. How cool it would be if we had an icon on the top panel to launch IDEA in Terminal mode.<br \/>\n<br \/>\nIDEA LAUNCHER IN PANEL -><br \/>\n<a href=\"\/blog\/wp-ttn-blog\/uploads\/2011\/02\/Screenshot.png\"><img decoding=\"async\" loading=\"lazy\" src=\"\/blog\/wp-ttn-blog\/uploads\/2011\/02\/Screenshot.png\" alt=\"\" title=\"idea panel demo\" width=\"400\" height=\"320\" class=\"alignnone size-full\" \/><br \/>\n<br \/>\nSimilarly an entry is also created in menu: application->programming->Idea<br \/>\n<strong>Download: <\/strong><a href='\/blog\/wp-ttn-blog\/uploads\/2011\/02\/idea_desktop_Integration.tar.gz'>idea_desktop_Integration.tar.gz<\/a> Check the installation guide below to see how to install<br \/>\n<br \/>\n<strong>PROBLEM STATEMENT:<\/strong><br \/>\nA program will be created to do IDEA GNOME GUI Integration, which <strong>launches IDEA in TERMINAL<\/strong> such that we can see whats happening in the background, that too with the ease of GUI one click quick launch. It requires following subtasks:<\/p>\n<ol>\n<li><strong>Building Launch Environment for idea.sh: <\/strong>idea.sh is designed to launch in terminal with all PATH variables set for various SDK&#8217;s. if we try to launch it in a standalone terminal it will not work as environment is required. In this step we will generate the launch environment<\/li>\n<li><strong>Adding Menu Bar Entry: <\/strong>in this we will add an entry to menu: <em>application->programming->Idea<\/em> using scripts, automated.<\/li>\n<li><strong>Adding entry to panel: <\/strong>here we will add an entry for launcher in the quickLaunch panel on top of the screen.<\/li>\n<\/ol>\n<p>\n<strong>Building Launch Environment<\/strong><br \/>\nwhenever terminal is launched it runs the .bashrc file which have the PATH variables to be set.<br \/>\nbut we cant execute .bashrc in standalone terminals i.e terminals with no command point as GUI always launches applications in standalone terminals.<br \/>\nso the other option is:- extract all the PATH variables from .bashrc and create your own setup script for the terminal.<br \/>\nthis can be achieved by simple commands:-<br \/>\n[shell]grep &quot;export&quot; ~\/.bashrc |tee ~\/.IDEALauncher[\/shell]<br \/>\nthis will extract all exported variables and make a file containing all of them in the home folder with the name .IDEALauncher<br \/>\nand we can execute this script to set the path via command:<br \/>\n[shell]chmod 777 ~\/.IDEALauncher<br \/>\n. ~\/.IDEALauncher[\/shell]<br \/>\nNow it has set all the path variables needed for the launch.<br \/>\n<br \/>\nthe above mentioned task is stored in a file klaunch.sh and is the launcher start point. file is as follows:<br \/>\n<strong>Note:<\/strong> UI and echo&#8217;s have been removed here to make it more readable, in attached file lot other stuff is there.<br \/>\n[shell]<br \/>\n# IDEA Launcher Script for gnome desktop integration.<br \/>\n# By Kushal Likhi<\/p>\n<p>#GET settings of enviornment variables and create a shell script for those<br \/>\ngrep &quot;export&quot; ~\/.bashrc |tee ~\/.IDEALauncher<\/p>\n<p>#set enviornment variables<br \/>\nchmod 777 ~\/.IDEALauncher<br \/>\n. ~\/.IDEALauncher<\/p>\n<p>#launch IDEA<br \/>\n`idea.sh`<br \/>\n[\/shell]<br \/>\n<br \/>\n<strong>Setup Process<\/strong><br \/>\nadding menu bar entries and panel entries is a part of setup process and is as follows:<br \/>\n<\/p>\n<blockquote><p><strong><em>&#8220;Everything in LINUX is a file&#8221;<\/em><\/strong><\/p><\/blockquote>\n<p>yes, and using the above saying all we have to do is: create\/edit\/add some files<br \/>\nFOR <strong>Menu Entry<\/strong> we have to create a file:<strong> <em>\/usr\/share\/applications\/idea.desktop<\/em><\/strong> and update cache to be safe<br \/>\nthe Script is as follows for the <strong><em>setup<\/em><\/strong> file:<br \/>\n[shell]<br \/>\n#IDEA Desktop integration setup file<br \/>\n# (c) Kushal Likhi<br \/>\n#Ver 1.0<\/p>\n<p>#clear screen for good clean looks<br \/>\nclear<\/p>\n<p>#welcome message<br \/>\necho &quot;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-WELCOME&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&quot;<br \/>\necho &quot;&quot;<br \/>\necho &quot; SETUP Program for IDEA GNOME Integration&quot;<br \/>\necho &quot; by: kushal likhi&quot;<br \/>\necho &quot;&quot;<br \/>\necho &quot;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&quot;<\/p>\n<p>#read IDEA installation dir path<br \/>\necho &quot;&quot;<br \/>\nread -p &quot;Enter IDEA Bin Location, press enter to keep default(\/opt\/idea\/bin\/), note: end path with &#8216;\/&#8217;:&quot; ideahome<\/p>\n<p>if [ -z &quot;$ideahome&quot;]<br \/>\nthen<br \/>\n\tideahome=\/opt\/idea\/bin\/<br \/>\nelse<br \/>\n\techo &quot;path set!&quot;<br \/>\nfi<\/p>\n<p>echo &quot;&quot;<br \/>\necho &quot;Path set to: &quot;$ideahome <\/p>\n<p>#copy files<br \/>\necho &quot;&quot;<br \/>\necho &quot;Generating launcher&#8230;.&quot;<br \/>\nsudo cp -fv klaunch.sh $ideahome<br \/>\necho &quot;&quot;<br \/>\necho &quot;copying Icons&#8230;.&quot;<br \/>\nsudo cp -fv icon.png $ideahome<br \/>\necho &quot;&quot;<\/p>\n<p>#add menu entries<br \/>\necho &quot;checking for \/usr\/share\/applications&quot;<\/p>\n<p>if [ -d &quot;\/usr\/share\/applications&quot; ]<br \/>\nthen<br \/>\n#found cache file<br \/>\necho &quot;found&quot;<br \/>\necho &quot;Adding Entries&#8230;.&quot;<\/p>\n<p>#NOTE: echo here is used to create files, NOT display on console, &#8216;&gt;&#8217; creates a file, and &#8216;&gt;&gt;&#8217; appends to it.<br \/>\nsudo echo &quot;[Desktop Entry]&quot; &gt; \/usr\/share\/applications\/idea.desktop<br \/>\nsudo echo &quot;Type=Application&quot; &gt;&gt; \/usr\/share\/applications\/idea.desktop<br \/>\nsudo echo &quot;Encoding=UTF-8&quot; &gt;&gt; \/usr\/share\/applications\/idea.desktop<br \/>\n#sudo echo &quot;Version 1.0&quot; &gt;&gt; \/usr\/share\/applications\/idea.desktop<br \/>\nsudo echo &quot;Name=IDEA IDE&quot; &gt;&gt; \/usr\/share\/applications\/idea.desktop<br \/>\nsudo echo &quot;Comment=Launcher for IDEA by Kushal&quot; &gt;&gt; \/usr\/share\/applications\/idea.desktop<br \/>\nsudo echo &quot;Categories=Development;&quot; &gt;&gt; \/usr\/share\/applications\/idea.desktop<br \/>\nsudo echo &quot;Exec=&quot;$ideahome&quot;klaunch.sh&quot; &gt;&gt; \/usr\/share\/applications\/idea.desktop<br \/>\nsudo echo &quot;Icon=&quot;$ideahome&quot;icon.png&quot; &gt;&gt; \/usr\/share\/applications\/idea.desktop<br \/>\nsudo echo &quot;Terminal=true&quot; &gt;&gt; \/usr\/share\/applications\/idea.desktop<br \/>\necho &quot;&quot;<br \/>\necho &quot;updating \/usr\/share\/applications\/desktop.en_US.UTF8.cache&quot;<br \/>\nsudo echo &quot;[idea]&quot; &gt;&gt; \/usr\/share\/applications\/desktop.en_US.UTF8.cache<br \/>\nsudo echo &quot;Name=IDEA IDE&quot; &gt;&gt; \/usr\/share\/applications\/desktop.en_US.UTF8.cache<br \/>\nsudo echo &quot;Comment=Launcher for IDEA by Kushal&quot; &gt;&gt; \/usr\/share\/applications\/desktop.en_US.UTF8.cache<br \/>\nsudo echo &quot;Categories=Development;&quot; &gt;&gt; \/usr\/share\/applications\/desktop.en_US.UTF8.cache<br \/>\nsudo echo &quot;Exec=&quot;$ideahome&quot;klaunch.sh&quot; &gt;&gt; \/usr\/share\/applications\/desktop.en_US.UTF8.cache<br \/>\nsudo echo &quot;Icon=&quot;$ideahome&quot;icon.png&quot; &gt;&gt; \/usr\/share\/applications\/desktop.en_US.UTF8.cache<br \/>\nsudo echo &quot;Terminal=true&quot; &gt;&gt; \/usr\/share\/applications\/desktop.en_US.UTF8.cache<br \/>\nsudo echo &quot;Type=Application&quot; &gt;&gt; \/usr\/share\/applications\/desktop.en_US.UTF8.cache<br \/>\nsudo echo &quot;&quot; &gt;&gt; \/usr\/share\/applications\/desktop.en_US.UTF8.cache<br \/>\necho &quot;&quot;<br \/>\necho &quot;adding pannel entry&#8230;&#8230;&quot;<\/p>\n<p>#\/usr\/lib\/gnome-panel\/gnome-panel-add &#8211;launcher=\/usr\/share\/applications\/idea.desktop<br \/>\nchmod 777 panel<\/p>\n<p>bash .\/panel<\/p>\n<p>echo &quot;&quot;<br \/>\necho &quot;Menu set&#8230;.. Enjoy!!&quot;<br \/>\necho &quot;&quot;<br \/>\necho &quot;&#8212;&#8212;&gt; YOU WILL FIND ENTRY IN (Applications -&gt; Programming) MENU&quot;<br \/>\necho &quot;&quot;<br \/>\necho &quot;NOTE: Run command .\/panel to add panel entry explicitly. was unable to add panel in sudo mode&quot;<br \/>\nelse<br \/>\n# file not found<br \/>\necho &quot;ERROR! Does not exist! this setup works for GNOME only&quot;<br \/>\nexit 1<br \/>\nfi<br \/>\n[\/shell]<br \/>\nnow here we have added menu entry.<br \/>\n<br \/>\n<strong>Adding Panel Entry:<\/strong><br \/>\nUbuntu has made this task easy by providing us with a python script to manipulate panels.<br \/>\nso all we have to do is use that script.. \ud83d\ude00<br \/>\nso the code is as follows for the <strong><em>panel<\/em><\/strong> file:-<br \/>\n[shell]<br \/>\necho &quot;adding panel&#8230;&#8230;&quot;<br \/>\n\/usr\/lib\/gnome-panel\/gnome-panel-add &#8211;launcher=\/usr\/share\/applications\/idea.desktop &#8211;panel=top_panel_screen0<br \/>\necho &quot;panel entry added&#8230; &quot;<br \/>\n[\/shell]<br \/>\nyou can also add to the bottom panel with the switch &#8211;panel=bottom_panel_screen0 , now the launch button will appear next to show desktop icon at the botton left corner.<br \/>\nwe can also align them to left or right, all is documented in the script usage guide.<br \/>\n<br \/>\n<strong>Installation Guide<\/strong><br \/>\ninstallation is very simple, just follow the following steps:<\/p>\n<ol>\n<li><strong>STEP 1: <\/strong>Download the files: <a href='\/blog\/wp-ttn-blog\/uploads\/2011\/02\/idea_desktop_Integration.tar.gz'>idea_desktop_Integration.tar.gz<\/a><\/li>\n<li><strong>STEP 2: <\/strong>Extract the files to a directory.<\/li>\n<li><strong>STEP 3: <\/strong>go in the root of the extracted files and issue command<br \/>\n[shell]<br \/>\nsudo .\/setup<br \/>\n[\/shell]<br \/>\nthen when asked enter idea path if it is different from the mentioned, if its same as mentioned just press enter.\n<\/li>\n<li><strong>STEP 4: <\/strong>issue command:<br \/>\n[shell]<br \/>\n.\/panel<br \/>\n[\/shell]<br \/>\nthis has to be issued seperate because the ubuntu script for panel does not work in sudo mode\n<\/li>\n<li><strong>STEP 5: <\/strong>all set Enjoy!! now whenever you have to launch IDEA just click on the icon and it will launch gracefully<\/li>\n<\/ol>\n<p>\n<strong>~~Kushal Likhi~~<\/strong><br \/>\n<a href=\"http:\/\/www.tothenew.com\">http:\/\/www.intelligrape.com<\/a><br \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the important part of any Installer is integrating and defining launchers for GUI. This post will demonstrate adding entries in menu bar and panel, using scripts in context of creating a GUI launcher for IDEA IDE. currently IDEA does not come with any GUI Launcher but this does not mean that we cant [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1},"categories":[1],"tags":[516],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/2748"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=2748"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/2748\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=2748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=2748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=2748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}