Writing my first Slackbuild and cannot add an entry to KDE games menu
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Writing my first Slackbuild and cannot add an entry to KDE games menu
I believe that I have all the necessary bits and pieces, the Slackbuild works, but I can't get it to add a KDE menu item for the program.
I have a program.desktop file and it has been added to /usr/share/applications. I have a program.png added to /usr/share/pixmaps, I have a doinst.sh but I have no idea if it is running or not.
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi
The xscrabble.desktop
Code:
[Desktop Entry]
Name=xscrabble
Comment=xscrabble - A Scrabble like game
Exec=/usr/X11/bin/xscrabble
Icon=/usr/share/pixmaps/xscrabble.png
Terminal=false
Type=Application
Categories=Game;
The xscrabble.Slackbuild
Code:
#!/bin/sh
# SlackBuild script for Xscrabble
# Written by Steven A. McIntosh (samac) (mcintosh@cotterochan.co.uk)
#
# This game has it's own install script and this script uses it and
# creates a Slackware package.
#
PRGNAM=xscrabble
VERSION=2.12
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
rm -fr $TMP/$PRGNAM $PKG $TMP/$PRGNAM-$VERSION
mkdir -p $TMP $PKG $OUTPUT
cd $TMP || exit 1
tar xvjf $CWD/${PRGNAM}-$VERSION.tar.bz2 || exit 1
# Don't trust the ownership/permissions...
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
chmod 755 $PRGNAM-$VERSION
# Make the directories that are needed by Xscrabble's build script
mkdir -p $PKG/usr/share/pixmaps \
$PKG/usr/share/applications
# Replace the build script with a SBo friendly one and move language files
cp $CWD/build $TMP/$PRGNAM-$VERSION
cp $CWD/xscrabble_en.tar.bz2 $TMP
cd $TMP/$PRGNAM-$VERSION
# Call the Xscrabble build script
./build bin &&
./build install &&
./build lang en &&
./build clean
# OK, put everything where it goes in a proper Slack package...
mkdir -p $PKG/usr/X11/bin \
$PKG/install
#
mv $PKG/usr/games/xscrabble $PKG/usr/X11/bin
mv $PKG/usr/games/xscrab $PKG/usr/X11/bin
rmdir $PKG/usr/games
cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
Please keep any suggestions KISS as I am not brilliant at bash scripting.
OK, interesting. The doinst.sh is running and the xscrabble.desktop works fine with just Categories=Game;
I logged in as root and there was xscrabble in the games menu, but it is not there when I log in as samac. Could it be because I have modified the menu with KDE's menu editor and it is now looking for a different configuration file.
I modified the slackbuild, .desktop and doinst.sh from a package that managed to add itself to my menu, so I am not sure what the problem is, could it be permissions?
I logged in as root and there was xscrabble in the games menu, but it is not there when I log in as samac.
First thing to do is verify the xscrabble.desktop file has 644 and root:root permissions.
Quote:
Could it be because I have modified the menu with KDE's menu editor and it is now looking for a different configuration file.
A local user menu will override the KDE defaults. The user menu is stored at ~/.config/menus/applications-kmenuedit.menu. You can temporarily move that file to see whether something in the configuration is overriding the KDE defaults. Be sure to not be in X/KDE or at least not logged in as that user when you temporarily rename the file.
All of the menu configuration files are basically a list of Include and Exclude directives. Your samac config file might have some kind of Exclude directive for the Games menu.
xscrabble.desktop file has 644 and root:root permissions.
Changing the name of ~/.config/menus/applications-kmenuedit.menu did not work, though the original did have an exclude for xscrabble.desktop, which I subsequently edited out. That did not work either.
I then created a new user, vanilla, and both they and root have xscrabble in their menus.
Renaming the user menu should have been sufficient.
Were the directory permissions of ~/.config and ~/.config/menu 755 and samac:samac? Were the permissions of ~/.config/menu//applications-kmenuedit.menu 644 samac:samac?
There is a second directory affecting the user menu. That location is ~/.local/share. In ~/.local/share you will find two directories: applications and desktop-directories. You'll find the Trash directory there too.
Quote:
though the original did have an exclude for xscrabble.desktop, which I subsequently edited out.
Perhaps there remained some remnant in the config file. The Include and Exclude directives are not always easy to follow. Been there done that. Perhaps try using the graphical menu editor to edit the file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.