I've recently been working on two new fluxbox scripts and both are
concerned with menu generation. First up is mengen
-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/bin/bash
#: Title : mengen
#: Date : November 2013
#: Author : Sharon Kimble, James Morris
#: Version : 2.0
#: Description : to generate fluxbox menu plus your usermenu too
#: Options : none
#: Requirements : menumaker-0.99.7.tar.gz, in the /programmes directory
#: License : GNU GPL 3.0 or later
####################################################
# Change log
# * 23-11-13 - Initial release
# * 25-11-13 - added ability to remove xscreensaver entries from "Others"
###################################################
mv ~/.fluxbox/menu{,-$(date +%Y%m%d-%R)}; mmaker fluxbox -f; sed -i '\|\[exec[]]\s[(].*[)]\s[{]/usr/lib/xscreensaver/.*\s-root[}]|d' ~/.fluxbox/menu; sed -i '\|\[exec[]]\s[(].*[)]\s[{]\b\(xscreensaver\).*[}]|d' ~/.fluxbox/menu; perl -0777 -pi -e 's/(.*)\[end]/$1/s;s/(.*)\[end]/$1/s;s/^\s*\n//gm' ~/.fluxbox/menu; printf '\t[end]\n\t[separator]\n\t[submenu] (My Menu)\n\t[include] (~/.fluxbox/usermenu)\n\t[end]\n\t[end]' >>~/.fluxbox/menu
|
This should be saved to your /home/$USER/bin
or if you don't have one,
to somewhere like /usr/local/bin
and made executable. Instructions as
to how to do this have been given in previous posts. Then, when you
install a new programme which you know has a menu entry, just run
mengen
in a terminal window and about a minute later, you'll be
presented with a new working fluxbox menu, complete with your user menu
at the end, and no references to xscreensavers which clutter up the
space. And, because the menu has had a lot of unnecessary clutter taken
out of it, then its much faster and easier to use. This will work on any
fluxbox installation providing, let me emphasise this, providing that
you have installed menumaker
.
And the second script is called fluxmenu
and is far more challenging!
You choose some programmes to look at, then you install it/them and
generate the complete fluxbox menu, exactly the same as mengen
. It
uses the same block of code so you'll get the same results! The
questions it asks are -
- "What programmes would you like to see? One word answer please!"
- "What programme do you want to see more information of? "
- "Do you want to install more than one programme? If you answer 'n' then you will install your choice [y/n/q] "
- "What programmes do you want to see more information of? Please leave a space between each programme. "
- "Do you want to install these programmes? [y/n/q] "
- "Do you want to update the universal database? [y/n/q] "
- "Do you want to update the fluxbox menu? [y/n] "
And thats it! It seems complicated at first, but once you've used it a couple of times it is easier.
And here it is -
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #!/bin/bash
#: Title : fluxmenu
#: Date : November 2013
#: Author : Sharon Kimble
#: Version : 4.0
#: Times edited : 24
#: Description : to easily show a list of programmes, choose one and install it, and then update the 'universal database', and generate a complete fluxbox menu.
#: Options : 1, as listed in variables
#; Requirements : menumaker-0.99.7.tar.gz, in the /programmes directory
#: License : GNU GPL 3.0 or later
####################################################
# Changelog.
# * 17-11-13 - initial version of the script, logs output, added ability to install, and update
# the universal database.
# * 18-11-13 - added the ability to generate a fluxbox menu.
# * 19-11-13 - added the ability to quit part-way through
# * 22-11-13 - the menu now includes your 'usermenu'
# * 23-11-13 - has the ability to install more than one programme at a time.
# * 25-11-13 - now excludes all xscreensaver entries from the main menu when its generated.
####################################################
# Variables
logprogramme="/home/boudiccas/logs/want.txt"
####################################################
exec > >(tee -a $logprogramme) 2>&1
# Searches the apt-cache
echo "What programmes would you like to see? One word answer please!"
echo
read programme
echo
apt-cache search programme
echo
# Uses apt-cache policy to show info regarding one programme
echo "What programme do you want to see more information of? "
echo
read "$programme"
echo
apt-cache show "$programme" | grep -i description -A 8
apt-cache policy "$programme" #shows whether installed or not, and repo of it.
echo
{
read -p "Do you want to install more than one programme? If you answer 'n' then you will install your choice [y/n/q] " ynq
case $ynq in
[Yy]* ) echo;;
[Nn]* ) sudo apt-get install "$programme";;
[Qq]* ) exit;;
* ) echo "Please answer yes or no. ";;
esac
}
# Uses apt-cache policy to show info regarding one or more programmes
echo "What programmes do you want to see more information of? Please leave a space between each programme. "
echo
read "$programme"
echo
apt-cache show "$programme"
apt-cache policy "$programme" #shows whether installed or not, and repo of it.
# Install them?
echo
{
read -p "Do you want to install these programmes? [y/n/q] " ynq
case $ynq in
[Yy]* ) sudo apt-get install "$programme";;
[Nn]* ) echo;;
[Qq]* ) exit;;
* ) echo "Please answer yes or no. ";;
esac
}
# use updatedb
echo
{
read -p "Do you want to update the universal database? [y/n/q] " ynq
case $ynq in
[Yy]* ) sudo updatedb;;
[Nn]* ) echo;;
[Qq]* ) exit;;
* ) echo "Please answer yes or no. ";;
esac
}
echo
{
read -p "Do you want to update the fluxbox menu? [y/n] " yn
case $yn in
[Yy]* ) mv ~/.fluxbox/menu{,-$(date +%Y%m%d-%R)}; mmaker fluxbox -f; sed -i '\|\[exec[]]\s[(].*[)]\s[{]/usr/lib/xscreensaver/.*\s-root[}]|d' ~/.fluxbox/menu; sed -i '\|\[exec[]]\s[(].*[)]\s[{]\b\(xscreensaver\).*[}]|d' ~/.fluxbox/menu; perl -0777 -pi -e 's/(.*)\[end]/$1/s;s/(.*)\[end]/$1/s;s/^\s*\n//gm' ~/.fluxbox/menu; printf '\t[end]\n\t[separator]\n\t[submenu] (My Menu)\n\t[include] (~/.fluxbox/usermenu)\n\t[end]\n\t[end]' >>~/.fluxbox/menu;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no. ";;
esac
}
exit
|
Comments
comments powered by Disqus