Page 11 of 20

Re: MX-21 MX-Fluxbox

Posted: Sun Sep 12, 2021 7:36 am
by PPC
I've been trying to create a hook up to apt to automaticaly update the "all apps" menu every time a package is installed/removed...
I've found out how to create the hooks up, but it tries to generate the config file in the root folder, not in the user's home...
Before I dig deeper into this... Is there any interest from the Dev team to include such kind of hook up? It would make the fluxbox menu more intuitive to use...

P.

Re: MX-21 MX-Fluxbox

Posted: Sun Sep 12, 2021 8:03 am
by Jerry3904
Good thought, thanks, but I think we have that already covered in the startup file.

Code: Select all

#update app  menu if it doesn't exist
if [ ! -f $HOME/.fluxbox/submenus/full_menu ]; then
    command -v mxfb-menu-generator && mxfb-menu-generator
fi

Re: MX-21 MX-Fluxbox

Posted: Sun Sep 12, 2021 9:24 am
by PPC
@Jerry3904 : yes, that script in the startup file creates a full menu, if none is found, but does not automaticaly update it, if the user add/removes some package, that's why I got interested in apt hook ups..., so the "all apps" menu is dynamic...

P.

Re: MX-21 MX-Fluxbox

Posted: Sun Sep 12, 2021 9:33 am
by Jerry3904
Give it a shot so we can test it -- thanks.

Re: MX-21 MX-Fluxbox

Posted: Sun Sep 12, 2021 1:57 pm
by PPC
@Jerry3904 .

It took some trial and error and a lot of web searching...
Here is how I got a dynamic "all apps" menu:

1- Add to the startup file this command, to log the user name:

Code: Select all

 whoami > /tmp/current_user.txt 
2- Edit /etc/apt/apt.conf.d/00exectmp and add this hook:

Code: Select all

 DPkg::Post-Invoke {"user=$(cat /tmp/current_user.txt) && su $user /usr/bin/mxfb-menu-generator";}; 
I tested this, using apt to first install "mutt" - the menu updated and the app appeared in my menu > all apps > internet
I purged "mutt" and the app was removed from my "all apps" menu

This seems to work, but, please, do test this extensively before trying to implement it...
Also I would like a better way to store the "regular" user that is in the system before running "sudo", I'm not that confident in using such volatile place as the /tmp/ folder...

(note1: I tried adding DPkg::Pre-Invoke {"whoami > /tmp/current_user.txt";}; that would be ideal- getting the user right before running apt... but it does not work.
note2: If you don't run the post-invoke as a regular user, the menu generator will error out because it's trying to create files in the root home folder...)

P.

Re: MX-21 MX-Fluxbox

Posted: Sun Sep 12, 2021 2:12 pm
by dolphin_oracle
should be able to use the "logname" command to get the user name. @PPC

Code: Select all

 DPkg::Post-Invoke {"su $(logname) /usr/bin/mxfb-menu-generator";};

Re: MX-21 MX-Fluxbox

Posted: Sun Sep 12, 2021 2:27 pm
by PPC
@dolphin_oracle
Man... I should have "googled" a bit more! Thanks, DO, the hook up is perfect, no need to add anything to the start up file, now!
If this is implemented, I think MXFB menu + rofi to search for apps are enough for my needs, I can remove xfce's file search, and stick with a more "pure" fluxbox setup

Many thanks for the tip!
And I hope this hook up is approved to be in the final MXFB... it probably is a nice feature, most people expect apps that were installed to magically appear in the menu- they have no idea of the work that's behind that!

P.

Re: MX-21 MX-Fluxbox

Posted: Sun Sep 12, 2021 2:32 pm
by PPC
I also spiced up the "simple weather" "script" that shows the weather, using wtt.in
This script has to be tested, and needs a fail safe, for when the detected place does not exist in wtt.in database...
This does a better job at finding exactly where you are, and displays the weather in your language:

Code: Select all

#! /bin/bash
geoip="$(wget -O- -q http://geoip.ubuntu.com/lookup)"
area="$(sed -r 's/.*<RegionName>(.*?)<\/RegionName>.*/\1/g' <<< $geoip)"
corrected_area=$(echo "${area// /_}")
echo $corrected_area
langu=$(locale | grep LANG | cut -d= -f2 | cut -d. -f1)
l1=$(echo $langu |cut -d_ -f1)
curl http://wttr.in/$corrected_area?lang=$l1
Enjoy
P,

Re: MX-21 MX-Fluxbox

Posted: Sun Sep 12, 2021 3:23 pm
by Jerry3904
Thanks, we'll give it all a test!

DO and others may be more use than I will be...

Re: MX-21 MX-Fluxbox

Posted: Tue Sep 14, 2021 6:00 am
by gennargiu
Hi i have a problem with fluxbox and application setting manager. it don't work. I used version beta 2 xfce enviroment and switch at fluxbox from exit session. Many thanks for your help me and best regards from Naples (Italy)

gennaro