You are not logged in.

#1 2017-06-29 14:24:31

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Martix's Magical Menuswitch – switch between static and dynamic menu

After having a closer look at dynamic menus on #BĹ, it turns out that there is a way to have best of both worlds at the same time: The static “out-of-the-box” openbox menu and the exact same menu but with a dynamic menu structure (and switch back and forth between those two).

I guess it's better to demonstrate on pictures what I mean:

out-of-the-box-menu-with-switch-menu.th.png

1. On the first screenshot there is the out-of-the-box openbox menu. Nothing has changed, apart from one additional entry called “Switch Menu”.


2. When you click that entry, it will change the menu part of the openbox menu (third panel) into dynamic menus:

bl-obmenu-generator-menu-with-switch-menu.th.png

This menu also has the “Switch Menu” entry, so you can change back to the out-of-the-box static menu anytime. As mentioned this menu has a dynamic menu structure:

bl-obmenu-generator-dynamic-menu-with-switch-menu.th.png


And this is how it looks with icons having the Faenza icon theme:

bl-obmenu-generator-menu-with-switch-menu-and-faenza-theme.th.png

And the Menta icon theme:

bl-obmenu-generator-menu-with-switch-menu-and-menta-theme.th.png


This set up is supposed to work with the following “Preferences/Appearance/Icon Theme”s: Faenza-*, Gnome, Mate, Menta and Vibrancy-*. There were missing icons for me with Adwaita and Oxygen-*.

I've been testing this configuration for months now. Switching works nicely without issues and both menus do work great as well. Switching also works without a menu entry via terminal or gmrun.


How does this set up work?

Basically this configuration has two parts:

bl-obmenu-generator
1. A fork of obmenu-generator (made originally by trizen) was created in order to change the menu by obmenu-generator to the specifics of #BĹ. The menu has the exact same structure as the out-of-the-box #BĹ-openbox menu (apart from the dynamic part).

bl-menu-switch
2. After clicking on “Menu Switch” it starts a simple (bash-)script called bl-menu-switch. It basically changes the menu.xml file in ~/.config/openbox (when in use the openbox menu uses its menu.xml and bl-obmenu-generator's menu.xml is renamed to menu.xml.bak [and vice versa]). This way it switches back and forth between the openbox menu and the bl-obmenu-generator menu. This script can be also started via terminal command or gmrun.

-------------------------------------------------------------------------------------------------------------------------

Last edited by martix (2018-06-15 18:05:37)

Offline

#2 2017-06-29 14:29:37

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

Installation

In order to set up the configuration above, first bl-obmenu-generator has to be installed. It is also possible to install this menu without switching back and forth later (so there will be no “Menu Switch” entry, if someone only wants to use a dynamic menu).


Installation of bl-obmenu-generator


1. Run the following command to install bl-obmenu-generator and its dependencies (step by step instructions are available here): [if you already have an ~/src folder, remove "mkdir ~/src && " from the beginning]

mkdir ~/src && sudo apt install cpanminus gexec libcpan-distnameinfo-perl libcpan-meta-check-perl libfile-pushd-perl liblocal-lib-perl libgtk2-perl libmodule-cpanfile-perl libparse-pmfile-perl libstring-shellquote-perl libdata-dump-perl && sudo cpanm Linux::DesktopFiles && sudo cpanm Data::Dump && cd ~/src && wget https://www.notabug.org/martix/bl-obmenu-generator/archive/master.tar.gz && tar vxf master.tar.gz && rm master.tar.gz && cd bl-obmenu-generator && sudo cp bl-obmenu-generator /usr/bin && sudo chmod 755 /usr/bin/bl-obmenu-generator && mkdir ~/.config/bl-obmenu-generator && cp schema.pl ~/.config/bl-obmenu-generator && bl-obmenu-generator -i -p


2. If you switch from the Paper icon theme to the Papirus theme, fix the missing icons with the following command:

cp ~/.config/bl-obmenu-generator/schema.pl ~/.config/bl-obmenu-generator/schema.pl.bak && sed -i '/Preferences/s/preferences-other/preferences-desktop/g' ~/.config/bl-obmenu-generator/schema.pl && sed -i '/menu.xml/s/text-editor/menu-editor/g' ~/.config/bl-obmenu-generator/schema.pl && sed -i '/schema.pl/s/text-editor/menu-editor/g' ~/.config/bl-obmenu-generator/schema.pl && sed -i '/bl-text-editor/s/package_editors/cs-windows/g' ~/.config/bl-obmenu-generator/schema.pl && sed -i '/bl-text-editor/s/hexedit/text-editor/g' ~/.config/bl-obmenu-generator/schema.pl && sed -i '/obconf/s/gtk-preferences/preferences-desktop-tweaks/g' ~/.config/bl-obmenu-generator/schema.pl && sed -i '/bl-compositor/s/window-new/Xfwm4CompositeEditor/g' ~/.config/bl-obmenu-generator/schema.pl && sed -i '/gmrun/s/system-run/application-x-phatch/g' ~/.config/bl-obmenu-generator/schema.pl

When changing back from the Papirus icon theme to Paper or Bunsen-Paper, you can use the ~/.config/bl-obmenu-generator/schema.pl.bak file and rename it to schema.pl.



3. Add bl-menu-switch [remove "mkdir ~/src && " from the beginning of the following command if you already have the ~/src folder]:

mkdir ~/src && cd ~/src && wget https://notabug.org/martix/bl-menu-switch/archive/master.tar.gz && tar vxf master.tar.gz && cd bl-menu-switch && cp bl-menu-switch ~/bin && chmod 755 ~/bin/bl-menu-switch && sudo cp ~/src/bl-menu-switch/bl-menu-switch_Paper_icon_32x32/bl-menu-switch.svg /usr/share/icons/Paper/32x32/apps/ && sudo cp ~/src/bl-menu-switch/bl-menu-switch_Papirus_icon_48x48/bl-menu-switch.svg /usr/share/icons/Papirus/48x48/apps && sed -i '/bl-menu-switch/s/#{item/{item/g' ~/.config/bl-obmenu-generator/schema.pl && sed -i '/item label="Edit autostart"/i \\t\t\t\t<item label="Menu Switch">\n\t\t\t\t\t<action name="Execute">\n\t\t\t\t\t\t<command>\n\t\t\t\t\t\t\tbl-menu-switch\n\t\t\t\t\t\t</command>\n\t\t\t\t\t</action>\n\t\t\t\t</item>' ~/.config/openbox/menu.xml.bak

That was it. There will be a new entry in the menu: Preferences/Openbox/Menu Switch. After clicking on it, the menu switches back to the static Openbox menu. As both menus have the “Switch Menu” entry, it is possible to switch back and forth between the out-of-the-box Openbox menu and the bl-obmenu-generator menu.

Last edited by martix (2018-06-15 18:19:20)

Offline

#3 2017-06-29 14:31:35

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

For an overview here are the main parts of the configuration above:

1. The packages required by bl-obmenu-generator
2. bl-obmenu-generator in /usr/bin
3. Directory ~/.config/bl-obmenu-generator/ with the following files: schema.pl -> this is for editing the menu-structure; config.pl -> this is created by bl-obmenu-generator; cache.db and icons.db -> also generated by bl-obmenu-generator
4. menu.xml and menu.xml.bak in ~/.config/openbox
5. the script bl-menu-switch in ~/bin
6. the "Menu Switch" entries added to the menus



Issue after upgrading to Stretch

On #BĹ (Jessie) I did a fool's upgrade to Stretch and everything was ok. However the menu by bl-obmenu-generator did NOT work. bl-obmenu-generator -i -p gave me:

Can't locate Linux/DesktopFiles.pm in @INC (you may need to install the Linux::DesktopFiles module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) 

In a forum I found an easy fix -> fire up the terminal (super+t) and run as root:

perl -MCPAN -e shell

Answer the questions, get the (cpan) shell prompt and run:

install Linux::DesktopFiles

It will install the missing module. After it's finished, exit via:

exit

In the terminal stop being root (exit again) and run

bl-obmenu-generator -i -p

It should work now.



BLOB Configuration Manager menu entry
On #BĹ there is a great tool called BLOB Configuration Manager, which is available via Openbox menu, but it needs tweaking to get an entry in the bl-obmenu-generator menu.

1. Create a file called BLOB Themes Manager.desktop

touch 'BLOB Themes Manager.desktop'

2. Open it

geany 'BLOB Themes Manager.desktop'

3. Paste the following content in the file and save:

[Desktop Entry]
Encoding=UTF-8
Name=BLOB Themes Manager
Exec=bl-obthemes
Terminal=false
Type=Application
Icon=distributor-logo-bunsenlabs
Categories=System

4. Copy the file to /usr/share/applications (somehow putting the file in ~/.local/share/applications did not work for me)

sudo cp 'BLOB Themes Manager.desktop' /usr/share/applications

[ Well, long story short: Open geany as root, paste that content in a new file and save it in /usr/share/applications under the name BLOB Themes Manager.desktop devil   ]

In the bl-obmenu-generator menu under System Tools there should be the entry for the BLOB Themes Manager.



How to change the icon theme for the menu?

The icon theme for the menu follows the general icon theme defined in "Preferences/Appearance/Icon Theme". If the icon theme is changed there, the icons for the menu will be updated accordingly after running

bl-obmenu-generator -i -d

This command generates a new ~/.config/obmenu-generator/icons.db. On newer bl-obmenu-generator versions running this command is not required anymore.



How to make the menu with icons open fast?

To make the bl-obmenu-generator menu with icons as fast as possible, first let's have a glance at the creator's advices:

If icon_dirs_first is set to ["/usr/share/icons"], any subdirectory is searched for icons. This is a very bad thing to do,
because the icon_theme may, or may not be the first subdirectory which is scanned, and, once an icon is found,
it will not be replace by another. If Linux::DesktopFiles is updated to a version >= 0.07, you can safely say:
gtk_rc_filename => undef, icon_dirs_first => undef, icon_dirs_last => undef, icon_dirs_second => undef,

If Linux::DesktopFiles is still 0.06, then I would suggest the following configuration: gtk_rc_filename => undef,
icon_dirs_first => ['/usr/share/icons/CURRENT_ICON_THEME_NAME'], icon_dirs_last => ['/usr/share/icons/gnome'],
icon_dirs_second => ['/usr/share/icons/Faenza'], One more thing: after the icon theme is changed, you need to manually delete
~/.config/obmenu-generator/icons.db, or run obmenu-generator -i -d to generate a new icons database. 

The option "icon_dirs_first" is in the bl-obmenu-generator file - line 254. This is also in ~/.config/bl-obmenu-generator/config.pl (line 84).

In order to get the menu with icons as fast as possible make sure that "icon_dirs_first" is set according to the chosen icon theme.

Out of the box the bl-obmenu-generator file has the following configuration:
- icon_dirs_first -> Faenza-Dark-Bunsen
- icon_dirs_second -> Faenza
- icon_dirs_last -> gnome

gtk_rc_filename is set to undef. There is also the setting "strict_icon_dirs", which makes it to look for icons only in the given directories, but I did not figure out yet in which cases this setting would be helpful.



Tips&Tricks

There is one thing I really like on #BĹ. If tint2 is in a vertical position on the right or the left side, there is a 1 pixel wide edge at the top of the screen (otherwise not noticeable, configurable for other sides via Menu/Preferences/Openbox/GUI Config Tool/Margins), even if a window is maximized. This means that it's possible to simply pull up anywhere the mouse-pointer and after a right click the menu will appear.

Editing ~/.config/obmenu-generator/schema.pl is fairly easy and there is NO need for restart. If there is wrong syntax, the menu won't start.

While searching for a new icon for a certain entry there is a handy little tool that can be useful: The "Icon browser". If there are missing icons in the menu, because there is an icon not available, change the name of the icon in schema.pl or use the full path to the icon file (if that file is not in the defined icons directory).

Is there anything missing in comparison to the out-of-the-box static menu?

I checked every main directory given in the static openbox menu.

From Accessories the BLOB Themes Manager is missing in the bl-obmenu-generator menu, which is an easy fix (see above -> create the .desktop file in /usr/share/applicatons). Catfish, Archive Manager (under Accessories) and htop (under System Tools - btw this was originally called "System", but there is a System entry already between Preferences and Help, so I changed it to "System Tools") are available.

Under Graphics the entries for the applications that can be installed like Gimp, Blender, Inkscape, Mandelbulber, etc. are not there, but these can be installed via Synaptic or command line (or aptitude or you name it). However here is one thing that is not in the bl-obmenu-generator menu: The scrot Screenshooter. This could be also implemented with some tweaking though, but I just used the Xfce4 Screenshooter (it's under Accessories).

From Multimedia there are those Install* entries obviously not in the dynamic menu, otherwise everything is there. Same goes to Network: Remote Filesystems -> Gigolo -> available under System Tools.

From Office Gnumeric is at the same place, Calculator is under Accessories as Galculator. Evidence PDF Viewer is under Office.

All in all there is nothing missing, apart from scrot Screenshooter (which would need some tweaking). On the GitLab page there is a wiki with a short changelog. The fork bl-obmenu-generator is mainly about tweaking schema.pl, while obmenu-generator itself had only a couple of #BĹ-specific changes.

Last edited by martix (2018-06-15 18:23:25)

Offline

#4 2017-06-29 15:19:19

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 995

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

Nice guide Martix. I  will take a look at your menu tool and will try it out.


Real Men Use Linux

Online

#5 2017-06-29 16:07:21

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,437

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

Very nice martix.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#6 2017-09-13 23:24:55

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

If anyone is interested in bl-obmenu-generator, here is an info just for the record: Changing the icon theme is quite simple as it is defined by the line

icon_dirs_first  => "/usr/share/icons/Faenza/",

in the bl-obmenu-generator file (and in config.pl, which is generated by bl-obmenu-generator). There is also the possibility to set where to look for icons at a second stage by: icon_dirs_second. Changing icon_dirs_first to Papirus

icon_dirs_first  => "/usr/share/icons/Papirus/",

looks nice:

blobmenugeneratorwithpapirusicontheme.th.png

Even better with dark theme:

blobmenugeneratormenuwithpapirusiconthemeffdca.th.png

...and with some fancy fonts (called URW Chancery L Bold Italic):

blobmenugeneratormenuandpapirusicontheme.th.png


When changing the icon directory, for an immediate effect the icon-db has to be re-generated:

obmenu-generator -d

Last edited by martix (2017-09-14 00:45:21)

Offline

#7 2017-09-18 21:27:57

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

How to get a transparent menu by bl-obmenu-generator?

bl_obmenu_generator_transparent.th.png

This is fairly easy as there is only one setting to change: Open compton.conf (Menu/Preferences/Compositor/Edit Compositing Settings) and change the following line e.g.

menu-opacity = 0.8;

To make it more transparent, choose a smaller value like 0.7. In order to take effect: Menu/Preferences/Compositor/Restart Compositing


How to use artwiz fonts in bl-obmenu-generator?

I guess this is a bit tricky and using artwiz can lead to issues. After following this guide it kind of worked for me (see screenshot), but I'm still unsure about certain steps. Here they are:

1. Download the artwiz fonts.

2. Unpack the bz2 archive.

3. Move into the new directory:

cd artwiz-aleczapka-en-1.3

4. Debian no longer recognises .pcf font files, only .pcf.gz files, so archive those files with the following command:

gzip *.pcf

5. Copy as root the entire artwiz-aleczapka-en-1.3 directory to /usr/share/fonts/X11/misc.

6. Move (cd /usr/share/fonts/X11/misc) into this directory and create as root an index of the font files that X will be able to use:

mkfontdir
mkfontscale

***The following step 7 is from the original guide but it seems it is NOT required (just jump to step 8 instead): 7. By default Debian disables bitmapped fonts, so we have to delete 70-no-bitmaps.conf in the /etc/fonts/conf.d/ directory.

8. Renew as root font cache:

fc-cache -f -v

9. Enable as root the use of bitmapped fonts:

dpkg-reconfigure fontconfig-config

10. You will be asked to answer three questions. Select
- Native
- Automatic
- Yes

11. Reconfigure as root the fontconfig settings:

dpkg-reconfigure fontconfig

12. At step 12 I got stuck (Blimey! It was the last one!):  It says add "xset fp+ "/usr/share/fonts/X11/misc/artwiz-aleczapka-en-1.3/" &" without quotes to ~/.xprofile (or ~/.xinitrc) -> none of them are on #BĹ. However in the comments on that guide page made by urukrama there is a remark saying ./xsessionrc should be used instead.

So open ~/.xsessionrc and add:

# added in order to use artwiz fonts
xset fp+ "/usr/share/fonts/X11/misc/artwiz-aleczapka-en-1.3/" &

If the display manager is bypassed, ~/.profile should be used instead.

Done! Done? I hope so. Someone else maybe using these fonts?


Sidenote: I found something about creating 40-x-fonts.conf in /usr/share/X11/xorg.conf.d/ with the following content:

Section "Files"
 	FontPath "/usr/share/fonts/X11/misc/artwiz-aleczapka-en-1.3/"
EndSection

I'm not sure but hopefully this is not necessary after steps 1-12.


Now I have to find somewhere an out-of-the-box /usr/share/fonts/X11/misc directory because I messed it up a bit.  smile  Btw the font on the screenshot is called anorexia Regular - set via Menu/Preferences/Openbox/GUI Menu Editor/Appearance/Menu Item. However changing font size or using the same in italic does not seem to work here (bold works). I will have to test it further though.

Last edited by martix (2017-09-19 08:36:03)

Offline

#8 2017-09-19 06:14:56

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

martix wrote:

7. By default Debian disables bitmapped fonts, so we have to delete 70-no-bitmaps.conf in the /etc/fonts/conf.d/ directory.

I don't think you need to do that — the `dpkg-reconfigure fontconfig` step will do that for you anyway, it's an ncurses front-end for managing /etc/fonts without having to get your hands dirty.

martix wrote:

It says add "xset fp+ "/usr/share/fonts/X11/misc/artwiz-aleczapka-en-1.3/" &" without quotes to ~/.xprofile (or ~/.xinitrc) -> none of them are on #BĹ. However in the comments on that guide page made by urukrama there is a remark saying ./xsessionrc should be used instead.

Neither ~/.xprofile or ~/.xinitrc are read during the startup of the BunsenLabs desktop so ~/.xsessionrc is the correct location but be sure to add to the contents rather than overwrite them wink

If the display manager is bypassed, ~/.profile should be used instead (or source ~.xsessionrc from ~/.profile).


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#9 2017-09-19 08:43:53

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

@HoaS Thank you for the remarks, they are implemented now in the steps above!

As a side effect of artwiz (I guess at least because I did not change mouse settings) I have a new (arch?) mouse pointer now.
mousepointer1.png
mousepointer2.png

Actually I like it, looks good with dark theme.

Offline

#10 2017-11-29 21:06:19

DaveFL67
New Member
From: Tallahassee, FL
Registered: 2017-11-23
Posts: 1

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

I can create a menu without icons. I cannot create one with icons. I am not sire what caused this issue. I have used obmenu-generator before on a straight Debian machine. This may be a simple error on my part, not having the correct dependencies. Or it may be the script. I have no idea, I am not a programmer.

Here's a screenshot:
http://www.davedorm.com/stuff/bl-obmenu-generator.png

Last edited by Head_on_a_Stick (2017-11-30 07:27:19)


</dave>
.-.. .. ...- . / .-.. --- -. --. / .- -. -.. / .--. .-. --- ... .--. . .-. -.-.--
"Every choice we make allows us to manipulate the future."
                                                                     ~ Captain Jean-Luc Picard

Offline

#11 2017-11-29 23:22:45

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: Martix's Magical Menuswitch – switch between static and dynamic menu

Hi @DaveFL67! I can think of three things to try. First simply run   bl-obmenu-generator -i -p

If it does not work, check/try the "Issue after upgrading to Stretch"-part in the #3rd post above.  There are three easy steps to follow.

And last: Sometimes the icon-db has to be re-generated via:  obmenu-generator -d  After that:  bl-obmenu-generator -i -p

Does it work now? I can suggest to use an icon theme with only .svg files, in which case bl-obmenu-generator will be really fast.

Offline

Board footer

Powered by FluxBB