//this comment works at startOfLine !!
//Regexp - perl compatible lib
//
//Script bar usage:
//  anycmd or :regexpFind
//
//Description format to show info:
//
//  distro=description
//  info=description     <=optional(used in left about button,right=groupAbout)
//
//	group
//	shortdesc
//	longdesc
//	script => note: $<ask> may be used in script, used in cd ../cd /anydir(usesThisScriptWithoutInitVars)
//	...and optional:
//  about=description      <=usedOnRightAboutButton: whenOnly1Group(itUsesThis),whenMoreGroups(itUsesThisExceptWhenEmpty-thenItUses1stOne-thatWayWhenMultiGroupsYouCanSpecJust1stForAll)
//	fillheight=true	       <=if it's known only one 'listbox' will be shown(eg for installed apps)
//	menubarhideresult=true <=will hide script result, default is shown
//	regexp=use internal regexp to include only wanted results
//	ondblclick=script,eg: sh -c leafpad $<thisone>	<=will execute this script while replacing $<thisone> with dblclicked list item
//  menubar=Name=Script	<=where script may be: xterm -e "echo $<thisone>;read -p 'Enter to continue...'"
//  	or: xterm -e "echo $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"  <=will extract 2nd column by space separator
//  menubarrejoiner=string	<=join regexes with this string(default is one space) <=used when regexp has more than one capture
//  menubarscrseparate=true	<=when multiselected, it executes scripts separatelly,default=joined all selected after a script
//  --- <= separator for same/similar group selection items
//  Key_(F1..F12,Enter,Esc,Space,Backspace,a..z,0..9)[-123]=script <=where 1Alt2Shift3Ctrl,eg:Key_F1-31=ls
//    Note: not all key combinations work for now, eg: Shift-0..9
//
//  This are the extra internal vars cmds supported:
//     $<...>>           <=sendToResult(usedWith evalresult)
//     $<thisone>        <=current list item
//     $<thisonew>       <=current list item,w=wholeWithDir(sinonim for $<var:curdir>
//     $<pdir> $<sdir>   <=programDir/scriptsDir respectivelly
//     $<setvar:anyId=anyValue>[+=,=] where anyValue may be :ask <=initializationOfVars,eg: sh -c "ls $<setvar:myvar=:ask>"
//        $<setvar:anyId=anyValue>=script  <=will set result to it
//        $<setvar:anyId=anyValue>+=script <=will add result to it
//        $<setvar:anyId=anyValue>script   <=will just initialize value
//        reserved vars:
//          curdir: that is both, $<setvar:curdir> and $<var:curdir> - used in dironedown/dironeup
//     $<var:anyId>      <=readValue,supportedInOnDblClick
//     $<2panel>         <=explicitly set script results to panel(ondblclick,...)
//     $<2panelclear>    <=clear panel
//     $<2panel1stclear> <=ResIntoPanelButFirstClearIt <= this a a combination of upper two
//     $<2panelprevent>  <=mainlyForBaseScript, prevents results output to panel
//     $<2dialog>        <=result to dialog: only usefull in mainCmd or when setting menubarhideresult-but wan't explicitly to redirect result to dlg for current menubar
//     fullscreen,fulscreenoff
//     asdblclick        <=use the same functionality as would be for ondblclick
//     evalresult        <=evaluate result until no more $<...> left, usefull for toggling, eg: 
//                         inMainCmdSetSomewhere($<setvar:fscreen=off>), then
//                         Key_F12=if [ "$<var:fscreen>" = "on" ];then echo '$<setvar:fscreen=off>>$<fullscreenoff>>';else echo '$<setvar:fscreen=on>>$<fullscreen>>';fi; $<evalresult>  <=note that last ';' is not needed-it's just for easier reading
//     showvars          <=usefull for debuging
//     view              <=default internal view/edit current - toggle
//     codeeditor        <=codeeditor - toggle in current window(Ctrl-s saves/creates)
//	And this:
//		>		<=before command(runAndDon'tWaitForItsResults),eg: ondblclick=>$<thisonew> 
//For now when multiselection, only one $<thisone...> can be used


distro=vlinux xbps
info=Sample script with xbps install system\nand simple fileExplorer/editor


hardware
all info
hardwared pci description
sh -c lspci

hardware
vga info
graphics card description
sh -c "lspci|grep -i vga"


software-installed
software installed
software installed on this os
xbps-query -l
fillheight=true
menubarhideresult=true
menubar=remove(withDeps)=xterm -geometry 125x48+68+42 -rv -e "xbps-remove -R $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=pkgInfo(installed)=xterm -geometry 125x48+68+42 -rv -e "xbps-query $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
//todo: when regexp contains >
//menubar=use ls=sh ls

software-available
software available
software available on repositories
sh -c "xbps-query -Rs '' |grep '^\[-\]'"
//sh -c "xbps-query -Rs '' |grep '^\[-\]'"
regexp=^\[-\]
fillheight=true
menubarhideresult=true
menubar=install=xterm -geometry 125x48+68+42 -rv -e "xbps-install -S && xbps-install $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=pkgInfo(repository)=xterm -geometry 125x48+68+42 -rv -e "xbps-query -R $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"

software-all
list all packages
list all packages repository/local
xbps-query -Rs ''
fillheight=true
menubarhideresult=true
menubar=install=xterm -geometry 125x48+68+42 -rv -e "xbps-install -S && xbps-install $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=remove(withDeps)=xterm -geometry 125x48+68+42 -rv -e "xbps-remove -R $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=pkgInfo(installed)=xterm -geometry 125x48+68+42 -rv -e "xbps-query $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=pkgInfo(repository)=xterm -geometry 125x48+68+42 -rv -e "xbps-query -R $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"

software-search
search packages
search all packages in repository
xbps-query -Rs "$<ask>"
fillheight=true
menubarhideresult=true
menubar=install=xterm -geometry 125x48+68+42 -rv -e "xbps-install -S && xbps-install $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=remove(withDeps)=xterm -geometry 125x48+68+42 -rv -e "xbps-remove -R $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=pkgInfo(installed)=xterm -geometry 125x48+68+42 -rv -e "xbps-query $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=pkgInfo(repository)=xterm -geometry 125x48+68+42 -rv -e "xbps-query -R $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"

vlinux-pkg-search-regexp
vlinux search package regexp
search all packages in repository - with regular expression
xbps-query -R --regex -s "$<ask>"
fillheight=true
menubarhideresult=true
menubar=install=xterm -geometry 125x48+68+42 -rv -e "xbps-install -S && xbps-install $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=remove(withDeps)=xterm -geometry 125x48+68+42 -rv -e "xbps-remove -R $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=pkgInfo(installed)=xterm -geometry 125x48+68+42 -rv -e "xbps-query $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"
menubar=pkgInfo(repository)=xterm -geometry 125x48+68+42 -rv -e "xbps-query -R $<thisone:.*? (.*?) .*>;read -p 'Enter to continue...'"

software-os-auto-update
update system/software packages
check and update all packages to latest versions through repository
xterm -geometry 125x48+68+42 -rv -e "xbps-install -Suv;read -p 'Enter to continue...'"
fillheight=true

---
simple explorer
simple explorer
list dirs/files,using: dblclick,rightclick,arrow keys,enter, editFind,type :anyregexp
$<setvar:curdir=:ask>$<setvar:fscreen=off>$<2panelclear>sh -c "(echo ..;find '$<var:curdir>' -mindepth 1 -maxdepth 1 -type d -printf '%f\n'|sort;echo '>=---';find '$<var:curdir>' -mindepth 1 -maxdepth 1 -type f -printf '%f\n')"
about=SimpleFileExplorer:\n  -cd any may be used in cmdbar\n  -to create file: click on .. then F3(optionalText) then Ctrl-s\n  -editor: type --help Ctrl-Enter for more
//ls $<ask> $<setvar:curdir=:ask>
//ls $<2listbox>
Key_F3=$<codeeditor>
Key_F4=leafpad '$<thisonew>'
Key_F11-3=echo '$<var:curdir>' $<2dialog>
Key_F12=sh -c "if [ $<var:fscreen> = on ];then echo '$<setvar:fscreen=off>>$<fullscreenoff>>';else echo '$<setvar:fscreen=on>>$<fullscreen>>';fi" $<evalresult>
//Key_F11=$<setvar:fscreen=off>$<fullscreen>
//Key_F12=$<fullscreenoff>
Key_Enter=$<asdblclick>
fillheight=true
menubarhideresult=true
//mainone must be 1st
//ondblclick=$(ls -d '$<var:curdir>/*/'|head -c -2;echo -----;ls '$<var:curdir>/*') $<2panel1stclear>
//ondblclick=ls --group-directories-first $<var:curdir> $<2panel1stclear>
ondblclick=\.\.||$<dironedown>sh -c "(echo ..;find '$<var:curdir>' -mindepth 1 -maxdepth 1 -type d -printf '%f\n'|sort;echo '>=---';find '$<var:curdir>' -mindepth 1 -maxdepth 1 -type f -printf '%f\n')" $<2panel1stclear>
//ondblclick=\.\.||$<dironedown>sh -c "(echo ..;ls --group-directories-first $<var:curdir>)" $<2panel1stclear>
ondblclick=$<sdir>/checkfile.bash '$<thisonew>'=="dir"$<dironeup>sh -c "(echo ..;find '$<var:curdir>' -mindepth 1 -maxdepth 1 -type d -printf '%f\n'|sort;echo '>=---';find '$<var:curdir>' -mindepth 1 -maxdepth 1 -type f -printf '%f\n')" $<2panel1stclear>
ondblclick=$<sdir>/checkfile.bash '$<thisonew>'=="execs">xterm -rv -e sh -c "'$<thisonew>';while true;do sleep 10;done"
ondblclick=$<sdir>/checkfile.bash '$<thisonew>'=="exec">$<thisonew>
ondblclick=$<sdir>/checkfile.bash '$<thisonew>'=="text">leafpad "$<thisonew>"
ondblclick=$<sdir>/checkfile.bash '$<thisonew>'=="img">xdg-open "$<thisonew>"
ondblclick=$<sdir>/checkfile.bash '$<thisonew>'=="snd">xdg-open "$<thisonew>"
ondblclick=$<sdir>/checkfile.bash '$<thisonew>'=="bin">xterm -rv -e sh -c "$<sdir>/viewashex.sh '$<thisonew>';while true; do sleep 1;done"
menubar=view type=file -b --mime-type '$<thisonew>' $<2dialog>
menubar=open wdefapp=>xdg-open "$<thisonew>"
//ondblclick=$<sdir>/checkfile.bash $<thisonew>=="bin">xterm -rv -c "hexdump -C -n 256 $<thisonew>"
//ondblclick=cmd==".."$<dironedown>ls $<var:curdir>
//ondblclick=>sh -c "leafpad $<thisone>"