Page 5 of 5

Re: MX Fluxbox versus other Window Managers and Desktop Envioroments

Posted: Fri Jul 31, 2020 6:39 am
by Jerry3904
I'll take a look, thanks. Not sure ATM how much use it would be, for me at least, but will find out.

Re: MX Fluxbox versus other Window Managers and Desktop Envioroments

Posted: Fri Jul 31, 2020 6:42 am
by Jerry3904
BTW: I have found a nifty and very powerful "calc" plugin that I have asked to be packaged. Usage not obvious, but am going to do up a Help file.

Re: MX Fluxbox versus other Window Managers and Desktop Envioroments

Posted: Fri Jul 31, 2020 9:45 am
by PPC
@Jerry3904: If you mean this (https://github.com/svenstaro/rofi-calc) it looks great! I never heard of it...

Re: MX Fluxbox versus other Window Managers and Desktop Envioroments

Posted: Fri Jul 31, 2020 10:04 am
by Jerry3904
We just packaged it up and it should show up in the repo pretty soon. You have to install qalculate and then use the modus

calc: qalc

Re: MX Fluxbox versus other Window Managers and Desktop Envioroments

Posted: Sat Aug 01, 2020 7:29 am
by ceeslans
PPC wrote: Fri Jul 31, 2020 6:06 am <snip>
... Is there any interest in also adding one of my previous suggestions- a "Recent files" menu entry?
Since Fb does not have dynamic menus, this can only, to my knowledge, be done using a script. I have one written, but I got some feedback in the antiX forum and it does not work well in non Latin characters ( cyrilic in particular)...

For anyone wanting to test that script, it's below (just paste the code into a text file called something like "recent_files.sh", save it, make it executable and run it. You can, of course add it to the menu, create a shortcut idesk icon, or a dock icon, so it can be easily accessible...

Code: Select all

#!/bin/bash
### Recent files window- by PPC, 13/1/2020, for use with antiX and MX-fluxbox
#GPL licence- do what you want with this, but please keep lines about the author, date and licence
# works on any system with yad and xdg-open installed, optionally: exo-open (see exceptions to the general rule, when launching files, near the end.
# https://pastebin.com/fSDPR9E1
#Parse the file that stores the recent used files, send output to recent0.txt
awk -F"file://|\" " '/file:\/\// {print $2}' ~/.local/share/recently-used.xbel > ~/.recent0.txt
#reverse contents order, so last file comes first, and so on...
tac ~/.recent0.txt > ~/.recent.txt
#function to decode file name (from %20 instead of spaces, etc, from https://unix.stackexchange.com/questions/159253/decoding-url-encoding-percent-encoding
urldecode() {
    local url_encoded="${1//+/ }"
    printf '%b' "${url_encoded//%/\\x}"
}
# Use a undecorated Yad window to select file to be executed
EXEC=$(yad --title="Recent files" --undecorated --width=450 --height=400 --center --separator=" " --list  --column=" Recent Files:"  < ~/.recent.txt)
#do decoding on the file name, just in case it has spaces or special characters that come up as %xx
decoded=$(urldecode $EXEC)
# general rule: open selected file with the aplication used for its file type
openwith=xdg-open 
###Exceptions to the general rule: LibreOffice Writer ".odt" files - check extension and  force it to open with lowriter; also more exceptions: like open ".sh" files for edition and run ".desktop" files instead of editing them
check=$(echo -n $EXEC | tail -c 3)
	if [ "$check" == "odt" ]; then openwith=lowriter ; fi  #this solves bug opening odt files with spaces
	if [ "$check" == ".sh" ]; then openwith=exo-open ; fi
	if [ "$check" == "top" ]; then openwith=exo-open ; fi
#add quotes to the file name, just in case it has spaces
EXEC2="'"$decoded"'"
#launch the selected file
run=$(echo $openwith $EXEC2)
eval $run
@PPC: Ohhh, I like that one, it works great.
I call it from the FB menu, with the yad script opening near the mouse (--mouse).
Afaik, most extensions are opened with the correct application - except executable bash scripts that are without extension... these are opened (not executed) by terminal emulator - instead of the texteditor (being default execution when opened in filemanager).
Is there any way to tell the script to open in a texteditor - other than renaming all scriptfiles systemwide to *.sh of course...

Re: MX Fluxbox versus other Window Managers and Desktop Envioroments

Posted: Sat Aug 01, 2020 8:04 am
by Jerry3904
Pretty neat! Worth thinking about for next mxfb...

Re: MX Fluxbox versus other Window Managers and Desktop Envioroments

Posted: Sun Aug 02, 2020 7:54 am
by Jerry3904
@PPC: OK, been looking at this and have a couple of suggestions/requests.

1) I ran into Ceeslans's problem as well. On my system, exo-open correctly opens a shell script without extension using geany (though default I think would be featherpad). I see you have exceptions at the end of your script and hope this could be corrected there. Would this work (< stackexchange):

Code: Select all

if [ "`head -c 2 infile`" = "#!" ]; then openwith=exo-open ; fi
2) Files changed a month ago are not "recent" in my world, and I would like to let the user limit the entries in recently-used.xbel. Maybe there could be some declaration like this that could be inserted into an AWK expression:

Code: Select all

DATESINCE="today - <some number of days>"
Default could be 7 maybe, though I would use 3 myself.

3) I might fiddle with the yad box a bit...

Thanks

Re: MX Fluxbox versus other Window Managers and Desktop Envioroments

Posted: Sun Aug 02, 2020 9:33 am
by Jerry3904
Hmmm, don't think that works. Tried this without apparent success as well:

Code: Select all

#for shell scripts without extension
shebang=$(grep -q == "#!")
	if [ "$shebang" == "0" ]; then openwith=xdg-open ; fi
Giving up...