I want to add a menu item of my application to the GNOME menu. I had created a desktop file for it and placed it in /usr/share/applications, but the menu item is not appearing in the GNOME menu. Below is my desktop file which I created in the name of Aces.desktop...
[Desktop Entry]
Encoding=UTF-8
Version 1.0
Name=Aces
Comment=Compile and Execute C programs
Categories=GNOME;Application;Development;
Exec=/usr/share/Aces/Aces
Icon=/usr/share/Aces/icon.png
Terminal=false
Type=Application
StartupNotify=true
After placing it in /usr/share/applications, I tried restarting the PC and still it did not work.
Any kind of help is appreciatable... :)
Well I just managed to add my program to Debian 9 / Ubuntu latest Unity interface on three steps.
0.- In you application folder locate or create a squared 72x72 or 96x96 or 128x128 or so on icon with .xpm or .png extension.
1.- In you application folder copy from /usr/share/applications/{example}.desktop, rename it to {myapp}.desktop and craft it to meet your application requirements
2.- run this then edit back {myapp}.desktop in case of problems
$ desktop-file-validate {myapp}.desktop
3.-run this to install your launcher into the appropiate directory and bring it lo live
in case of 'just for current user' do:
$ desktop-file-install --dir=/home/{user}/.local/share/applications/ {myapp}.desktop
'for all users' (/usr/share/applications/) do as root:
# desktop-file-install {myapp}.desktop
I've found my silly mistake :) I forgot to give executable privileges to the desktop file. So after you give executable privileges to the desktop file by the command
chmod +x <desktop file path>
place it in
/usr/share/applications /* So the menu option is available to all the user */
or
~/.local/share/applications /* In this case the menu option is available only to that particular user*/
after you apply the executable permission, the desktop file will take the name and icon specified by you, in the .desktop file.
The term "Gnome Menu" can be a bit ambiguous, but I use MATE-Desktop (the Gnome 2 clone), and the easiest way I've found to add an item to the Applications menu (for example) is to right click on "Applications" and click on "Edit Menu". You can get edit the menus, show or hide various sections, and add a new item with the command, description, icon, etc. Note that right-clicking on any sub-menu (like 'Programming') doesn't work -- it has to be the main 'Applications' menu on your gnome panel.
You can use Arronax, if you want to do this quickly.
This answer uses Firefox and CentOS as an example, but these steps should work for any application. The example assumes that you already have GVim installed.
If you don't, simply pick any other menu item that doesn't use hyphens in its title. For example, using chromium-browser.desktop would be bad, while using caja.desktop would be goodness.
1 DOWNLOAD, INSTALL AND TEST FIREFOX FROM MOZILLA SITE
cd /usr/local
sudo wget http://ftp.mozilla.org/pub/firefox/releases/81.0/linux-x86_64/en-US/firefox-81.0.tar.bz2
sudo tar xvjf firefox-81.0.tar.bz2
sudo rm -fr firefox-81.0.tar.bz2
sudo ln -s /usr/local/firefox/firefox /usr/bin/firefox
firefox &
2 FIND AND ‘INSTALL’ FIREFOX ICONS
find /usr/local/firefox -name \*.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default16.png /usr/share/icons/hicolor/16x16/apps/firefox.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default32.png /usr/share/icons/hicolor/32x32/apps/firefox.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default48.png /usr/share/icons/hicolor/48x48/apps/firefox.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default64.png /usr/share/icons/hicolor/64x64/apps/firefox.png
sudo cp -p /usr/local/firefox/browser/chrome/icons/default/default128.png /usr/share/icons/hicolor/128x128/apps/firefox.png
3 ‘CREATE’ A FIREFOX DESKTOP FILE
cd /usr/share/applications
sudo cp -p gvim.desktop firefox.desktop
sudo sed -i "s/Gvim/Firefox/g" firefox.desktop
sudo sed -i "s/GVim/Firefox/g" firefox.desktop
sudo sed -i "s/gvim/firefox/g" firefox.desktop
sudo sed -i "s/Categories=Utility;TextEditor;/Categories=Network;WebBrowser;/g" firefox.desktop
Related
I am puttying into my Centos 7 terminal on Windows 10. I would like to be able to open and edit the Linux files using sublime text rather than having to edit right in the terminal. Any thoughts on how to do this?
Get a copy of the Windows apps -- "WinSCP" (for SFTP and use as a remote filemanager, etc. and includes putty), and "Notepad Plus Plus" (Notepad++) ... easy way to edit files on remote server. All are free downloads.
I personally like nano, its really easy to use
nano /path/to/file.c
ctrl + x to exit, ctrl+o to output the file with a y/n save prompt
If you want to use sublime, do the following
$> wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
$> echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
$> sudo apt-get update
$> sudo apt-get install sublime-text
Then this line will show you the sublime help options
$> subl -h
Assuming this:
$> subl /path/to/file.txt
I am trying to start browser in Raspberry Pi, on boot. These are the steps I've followed so far:
I have edited the .bashrc file from the root folder using this command:
sudo nano /home/pi/.bashrc
Added the following line at the end the file.
midori -e Fullscreen -a http://www.google.com
I restarted Raspberry Pi.
sudo reboot
It does not open the browser, on boot. How ever if I manually click on Terminal, it opens the browser.
I got a very simple solution of this. At first install midori on your pi.
sudo apt-get install midori
Then add the file that you want to auto start here.
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
For example you want to open google browser after reboot. Add this line to autostart file.
#midori -e Fullscreen -a http://google.com
Save the file and reboot your Pi. Now the google browser will auto start up every time you reboot.
I got the solution .
In new versions it is not supporting in this autostart file
sudo nano /etc/xdg/lxsession/LXDE/autostart
I changed the code to the below autostart file.
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
You can use crontab
sudo crontab -e
And add
#reboot command_you_want_to_run &
I solved using autostart of LXDE-pi and a sh file.
I had to install xautomation for simulate an user input
sudo apt-get install xautomation
In the home of pi I've created a sh file
touch start_browser.sh
I've inserted the following code in the file
#!/bin/sh
# running the browser on the main desktop
sudo -u pi epiphany-browser -a --profile ~/.config http://www.google.com/ --display=:0 &
# waits a few seconds, we wait that the browser has started successfully
sleep 15s;
# xautomation simulates the pressure on the F11 key for activate the browser in full screen mode on the main desktop
xte "key F11" -x:0
I added the executable permission on the sh file with chmod command
sudo chmod 755 start_browser.sh
I've modified the autostart files of LXDE-pi session
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
by adding the following command to run my sh file
#/home/pi/start_browser.sh
Now our browser should be start in full screen mode at each boot
If it does not, check that the Raspberry's configuration had enabled the boot into the desktop environment
sudo raspi-config
Select: 3 Enable Boot to Desktop/Scratch
Select: Desktop Log in as user 'pi' at the graphical desktop
Enjoy
In latest versions of raspberian you have to edit
sudo vi .config/lxsession/LXDE-pi/autostart
for this
#midori -e Fullscreen -a http://google.com
to work..
I am using JBoss 7.1.1 application server with my java application in linux and have successfully been able to start JBoss during the processing phase of IZPack(processSpec.xml). I was getting "command not found" messages during the processing phase. I decided to get rid of all the comments and the messages went away. However, when I execute the uninstall, mkdir and ln -s -T appends a "?" at the end of the filename and link. Is this a bug? The rm -r successfuly removes the jboss script at /etc/init.d, but fails to remove the jboss-as.conf file at /etc/jboss-7.1.1.Final. I have jboss home at /usr/share. rm -r fails to remove /standalone and /modules. I get a popup during the uninstall stating administrative priveleges are required to remove /standalone and /modules.
All input is appreciated.
Glenn
rm(1) man page notes :
Otherwise, if a file is unwritable, standard input is a terminal, and the -f or --force option is not given, or the -i or
--interactive=always option is given, rm prompts the user for whether to remove the file. If the response is not affirma-tive, the file is skipped.
That appended ? after filename sounds like the prompt.
You're trying to remove files, that's readonly. rm -r is failing to remove things, probably because you don't own /standalone and /modules. Presumbably you needed "administrative privileges" to get things installed where they are in first place.
I am trying to make cgMiner auto-start when my Raspberry Pi (Raspbian Linux) starts.
Edited the rc.local file:
sudo nano /etc/rc.local
and added this line:
nohup ./cgminer-3.1.1/cgminer --config /home/pi/cgminer.conf -S /dev/ttyUSB0 -S /dev/ttyUSB1 >/dev/null 2>&1&
and cgMiner doesn't start. If I type in terminal the exact same line with sudo in front it works perfectly.
sudo nohup ./cgminer-3.1.1/cgminer --config /home/pi/cgminer.conf -S /dev/ttyUSB0 -S /dev/ttyUSB1 >/dev/null 2>&1&
What can I do?
I think it is related to the path or better the current working directory.
You are using ./cgminer and not a full path. So either use the full path or first cd to the directory containing the cgminer program.
Also have a look at the following page over at adafruit doing the exact same thing you are trying to accomplish
http://learn.adafruit.com/piminer-raspberry-pi-bitcoin-miner/configure-auto-start
Adafruit has the following code in /etc/rc.local
cd /home/pi/PiMiner
python PiMiner.py &
cd ..
nohup ./cgminer-3.1.1/cgminer --config /home/pi/cgminer.conf -S /dev/ttyUSB0 -S /dev/ttyUSB1 >/dev/null 2>&1&
The first and third line (the cd commands) ensure that the folder containing the folder containing the cgminer command is the current directory.
From the two cd commands adding the following command before the line containing the cgminer command would solve your issue
cd /home/pi
I seem to have found the solution for this problem, assuming it is the same as for bfgminer.
After spending a full day playing with init.d scripts, I found the simplest way is to make sure your cgminier.conf file has all the arguments in then add the following to the end of /etc/rc.local
cd /home/YOURNAME/bfgminer
sudo ./bfgminer
It ran without the sudo part, but didn't start up my block erupter without it.
I also managed to get it running from init.d, but had issues with it preventing system rebooting when done that way.
Hope that helps
I am developing an application in beaglebone.
I want to add start up scripts to my Beaglebone but I can not find /etc/inittab.
I am using the image : Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.05-beaglebone-2012.06.18.img.xz
I think in the previous versions of image there is /etc/initab but for the new distributions I could not find the inittab :/
I want to apply this : Automatic login on Angstrom Linux
but I can not because there is no /etc/inittab.
Where is the inittab in new distributions.
When I write uname -r it gives:
3.2.23
Regards
inittab has been replaced by systemd
This is how I did it for the serial console. You can probably adapt it easily for tty1 by replacing "serial-getty#..." by "getty#...", but I haven't tested it.
cp /lib/systemd/system/serial-getty#.service /etc/systemd/system/autologin#.service
rm /etc/systemd/system/getty.target.wants/serial-getty#ttyO0.service
ln -s /etc/systemd/system/autologin#.service /etc/systemd/system/getty.target.wants/serial-getty#ttyO0.service
Create the following script file in any location (/home/root/autologin.sh in my case)
#!/bin/sh
exec /bin/login -f root
Make it executable
chmod a+x autologin.sh
Edit /etc/systemd/system/autologin#.service and update the ExecStart command by adding the -n (Do not prompt the user for a login name) and -l (Invoke the specified login_program instead of /bin/login) options.
ExecStart=-/sbin/agetty -n -l /home/root/autologin.sh -s %I 115200