You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



add menu item

Author (Read 7296 times)

0 Members and 1 Guest are viewing this topic.

Re: add menu item
« Reply #14 on: August 13, 2014, 09:07:01 AM »
 

paul59

  • Guest
Great, happy Minecrafting :D

Paul
 

Re: add menu item
« Reply #13 on: August 13, 2014, 08:34:09 AM »
 

davidwillis

  • Guest
Thanks to everyone else too for the help!
 

Re: add menu item
« Reply #12 on: August 13, 2014, 08:19:53 AM »
 

davidwillis

  • Guest
Thanks Paul.  That worked perfectly!
 

Re: add menu item
« Reply #11 on: August 12, 2014, 06:08:03 PM »
 

rijnsma

  • Forum Regular
  • ***
  • 212
    Posts
  • Reputation: 16
  • Never give up..
    • View Profile
Some entries are not removable.
I have a Remastersys-entry of a version that did not work right, which I like to remove,
because I switched to an older one. That one is in place in the menu.
But the old one doesn't disappear when I delete it in Alacarte.  :o No big deal, but not right.
 

Re: add menu item
« Reply #10 on: August 12, 2014, 09:32:32 AM »
 

paul59

  • Guest
I just solved this too :D

Downloaded the server and put it in it's own directory. Edited eula.txt to signify agreement (won't run unless you've done this).

Created a launcher script in the server directory like so and made it executable:

Code: [Select]
#!/bin/sh
cd /home/paul/programs/minecraft-server/
java -Xmx1024M -Xms1024M -jar /home/paul/programs/minecraft-server/minecraft_server.1.7.10.jar

Modify the path to match your setup and add nogui to the end of the line beginning 'java....' if you don't need the god-mode :D

Edited the main menu and added an item to the games category with launcher command like this:

Code: [Select]
/home/paul/programs/minecraft-server/launch-server.sh

Again modify path to suit.

Works fine, kids will be happy :D

I've found the menu editor (alacarte or libremenu?) to be flakey - entries seem to disappear after editing sometimes.

Paul
« Last Edit: August 12, 2014, 09:34:10 AM by paul59 »
 

Re: add menu item
« Reply #9 on: August 12, 2014, 09:01:10 AM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8778
    Posts
  • Reputation: 802
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
Try this. In your home folder, make a new folder called mcserver, then inside that folder, make a file called mcexec, paste the following into it:

Code: [Select]
#!/bin/bash
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

Save it, right click on it, Make file executable. Make sure the server file minecraft_server.jar is in the same folder.

Open text editor and place the following in it:

Code: [Select]
[Desktop Entry]
Name=Minecraft Server
Comment=Minecraft Server
Exec=x-terminal-emulator --geometry=95x25 -t "MC Server" -e "bash -c /home/user/mcserver/mcexec;bash"
Icon=/location/of/icon/file
Terminal=false
Type=Application
Categories=Game;

Save the file as minecraftserver.desktop and place it in /home/user/.local/share/applications/

It should show up under Menu, Games.
« Last Edit: August 12, 2014, 09:12:02 AM by Valtam »
 

Re: add menu item
« Reply #8 on: August 12, 2014, 08:35:03 AM »
 

davidwillis

  • Guest
Thanks for the instructions.  Maybe I am not been clear on what I am trying to do.

Basically I can start a minecraft server my opening a terminal the cd ing to the correct directory, then run:
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

My kids use this to play minecraft together using our two computers at home.  However they never seem to be able to get it running when I am not home, so I would like to make a menu item that they could just click on to start the server.

I have been looking at making a file in /usr/share/applications (since the "Main menu" doesn't seem to have an option for the working directory).

I will keep looking and let you know if I get something that works.

 

Re: add menu item
« Reply #7 on: August 12, 2014, 03:56:32 AM »
 

Kirkx

  • Occasional Poster
  • **
  • 51
    Posts
  • Reputation: 10
  • Linux Lite Member
    • View Profile

  • CPU: Athlon 64 3500+ 2.2 GHz

  • MEMORY: 4Gb

  • VIDEO CARD: GeForce 8500 GT / Nvidia 340.76
I can help you with getting the terminal window open. Then you will still need to figure out all the java staff.

1) Save the following test script as the file named "test" (no quote marks, no extension) here:

Code: [Select]
/usr/scripts/
http://i.imgur.com/ICr4XWj.png

Copy the contents of the file "test" from here:

Code: [Select]
#!/bin/bash

bold=`tput bold`
normal=`tput sgr0`

echo "${bold}**********************"
echo "Test Script"
echo "**********************${normal}"
echo ""
echo ""
echo "Test script running ..."

echo ""
echo "Test script complete."
# sleep 5

2) Hit Alt+F2 and run the following command:

Code: [Select]
x-terminal-emulator --geometry=95x25 -t "My Custom Window Title" -e /usr/scripts/test
To prevent the terminal window from auto-closing after executing the script change the command as follows:

Code: [Select]
x-terminal-emulator --geometry=95x25 -t "My Custom Window Title" -e "bash -c /usr/scripts/test;bash"
I have to admit that I'm not sure if that's the smartest, most correct method to keep the terminal open, so let's wait for others to confirm this.

By modifying the command shown above you can set the size of the terminal window (--geometery=WxH) or add the title (it's optional). Later, when you have all the parameters tweaked to your liking you can save the command permanently in Alacarte (Main Menu). DO NOT place the check mark next to "Launch in Terminal", just ignore that box.
« Last Edit: August 12, 2014, 05:17:17 AM by Kirkx »
LL 2.4, Xubuntu 14.04.2, Debian 8, Manjaro
 

Re: add menu item
« Reply #6 on: August 11, 2014, 07:40:31 PM »
 

davidwillis

  • Guest
Thanks.   I have tried it with the full path as well, but it didn't make any difference.

 

Re: add menu item
« Reply #5 on: August 11, 2014, 09:33:05 AM »
 

paul59

  • Guest
It works fine from command line (I do have to be in the correct folder when I run it though).

You could probably put the path to the .jar file like so rather than having to be in the same directory:

Code: [Select]
java -Xmx1024M -Xms1024M -jar /path/to/archive/minecraft_server.jar nogui

Paul
 

Re: add menu item
« Reply #4 on: August 11, 2014, 08:30:11 AM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8778
    Posts
  • Reputation: 802
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
...and the script?
 

Re: add menu item
« Reply #3 on: August 11, 2014, 08:29:01 AM »
 

davidwillis

  • Guest
Sure, this is what I run from command line to get the server up.

Quote
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

It works fine from command line (I do have to be in the correct folder when I run it though).

 

Re: add menu item
« Reply #2 on: August 11, 2014, 02:25:35 AM »
 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8778
    Posts
  • Reputation: 802
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
Can you please show us your script (make sure it is executable) and the command you are running to start you server.
« Last Edit: August 11, 2014, 03:57:23 AM by Valtam »
 

add menu item
« Reply #1 on: August 10, 2014, 10:35:51 PM »
 

davidwillis

  • Guest
I am trying to add a menu item that will run a script from the terminal.  However after adding it, it does not open a terminal, and it does not run the script.

The menu item is simply to start a minecraft server.  It works fine running the command via command line, but I can't get the menu item to work.  Is there a way to set the directory path to run the script from (so it will find all the files it needs to run)?  And also why does it not open the terminal window, when I have that option checked (using main menu).   

Thanks
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section