You are not logged in.
Pages: 1
This little utility just simplifies the code a bit if you want to add a small jgmenu popup to a tint2 button or any kind of launcher on a panel. It might be useful to call from a script too. Does away with xdotool and setting up key combos in rc.xml, and doesn't need openbox to be running.
It works with openbox-style xml or native jgmenu csv - pipemenus or static menu files. The default is pipemenu + native csv, so if you wanted to pop up a menu from a static xml file you'd use:
bl-jgpop -o -f /path/to/some_menu.xml
but for a native jgmenu csv pipemenu, just:
bl-jgpop command
bl-jgpop launch a simple jgmenu pipemenu
Usage: bl-jgpop -h|--help
bl-jgpop [-o|--openbox] <pipemenu_command> [<arguments>]
bl-jgpop [-o|--openbox] -f|--file <menu_file>
It can be called from a tint2 button or any launcher.Options:
-h --help
show this message
-o --openbox
parse the pipemenu output, or file, as openbox xml (default is csv)
-f --file
read a file instead of running an executable
parsing mode is determined by previous option
Most of the pipemenus and menu files on peoples' systems are likely to be openbox style atm so you'll need the -o option a lot. I wondered about making that the default, but jgmenu csv menus are easy to write and likely to become the default in the future.
Because in some cases you're passing commands as part of outer commands as a jgmenu option the quoting got a bit tricky, but I think it's OK now. Seems to work even if filepaths contain spaces or pipemenus need options passing (eg 'pipemenu --nifty'). Please give it a try - if it looks useful it can easily be dropped into bunsen-utilities.
#!/bin/bash
HELP=" bl-jgpop launch a simple jgmenu popup menu
Usage: bl-jgpop -h|--help
bl-jgpop [-o|--openbox] <pipemenu_command> [<arguments>]
bl-jgpop [-o|--openbox] -f|--file <menu_file>
It can be called from a tint2 button or any launcher.
Options:
-h --help
show this message
-o --openbox
parse the pipemenu output, or file, as openbox xml (default is csv)
-f --file
read a file instead of running an executable
parsing mode is determined by previous option
"
parsing='native'
source='pipe'
while [[ -n $1 ]]
do
case "$1" in
-h|--help)
echo "$HELP"
exit 0
;;
-o|--openbox)
parsing='openbox'
shift
;;
-f|--file)
source='file'
shift
;;
-*)
echo "${0}: ${1}: no such option" >&2
echo "
$HELP"
exit 1
;;
*)
hash "$1" >/dev/null || {
echo "${0}: $1 is not an executable command" >&2
exit 1
}
src=("$@")
break
;;
esac
done
opt='--csv-cmd'
case "$parsing" in
native)
case "$source" in
pipe)
arg="${src[@]@Q}" # single-quote command & arguments separately
;;
file)
arg=${src[0]} # discard any junk arguments after filepath
opt='--csv-file'
;;
esac
;;
openbox)
case "$source" in
pipe)
arg="jgmenu_run ob --cmd=\"${src[@]@Q}\"" # command needs extra layer of quotes in case it contains spaces
;;
file)
arg="jgmenu_run ob '${src[0]}'"
;;
esac
;;
esac
exec jgmenu --simple --config-file=<( sed '/menu_padding_top/ s/^/#/' ~/.config/jgmenu/jgmenurc ) "${opt}=${arg}"
Last edited by johnraff (2021-11-20 01:01:30)
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
Added a button in tint2 and opened "recent-files" (same we were working on here: https://forums.bunsenlabs.org/viewtopic.php?id=7333
It works well and is a nifty little addition. Doesn't show icons with the entries. At least not here using the "-t gnome" switch with pipe-recent-files, but neither does jgmenu for me. Icons were working in the Openbox menu, but when I switched over to Jgmenu, I lost icons in the pipe-menus, and I can't find the answer. eh.
Only other thing of notice was the "spinning ball" after activation if not in the pipe-menu. Not a big deal here. Hell, it might even be a feature.
Switching to a simple file worked well also. I used ~/.config/openbox/menu.xml as a test and everything works as expected but still no icons.
This tool can be a really cool way to design different applications menus for tint2. Lots of neat possibilities.
I like it:) You should certainly add it somewhere.
Edit* Made a small custom.xml with the 'recents' call inside as well. Love it.
Last edited by sleekmason (2021-11-19 18:48:28)
Offline
^ Looks really slick! Love your theming, the name of your panel folder icons please?
No, he can't sleep on the floor. What do you think I'm yelling for?!!!
Offline
^ Looks really slick! Love your theming, the name of your panel folder icons please?
Made em:) Colored them anyway:) The first three, and the numbers. They are located in my Github Here.
Checkout the wbar icons located there too:)
Last edited by sleekmason (2021-11-20 03:48:40)
Offline
Thanks for checking it out!
Doesn't show icons with the entries. At least not here using the "-t gnome" switch with pipe-recent-files, but neither does jgmenu for me. Icons were working in the Openbox menu, but when I switched over to Jgmenu, I lost icons in the pipe-menus, and I can't find the answer. eh.
There's an entry in jgmenurc
icon_size = 0
I guess the first thing to try would be to set that to something other than 0. Also, I duplicated that setting in bl-jgpop, which was quite unnecessary. Best is for the popup menus to copy the appearance of the regular jgmenu as configured in jgmenurc, so edit the last line of bl-jgpop to:
exec jgmenu --simple --config-file=<( sed '/menu_padding_top/ s/^/#/' ~/.config/jgmenu/jgmenurc ) "${opt}=${arg}"
to remove the icon setting and leave it up to jgmenurc. I'll edit the OP too. (The sed stuff is to take out the unwanted space at the top which regular jgmenu uses to put the search icon.)
Only other thing of notice was the "spinning ball" after activation if not in the pipe-menu.
I guess that's "startup notification", set in application .desktop files? Or is it startup notification of the menu itself? If launched from tint2 it can be stopped in tint2rc: https://jgmenu.github.io/integration.html#tint2
Made a small custom.xml with the 'recents' call inside as well. Love it.
https://i.postimg.cc/N9nP2Myg/recents.png
Agree with @hhh - your graphics stuff is really nice!
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
Thank you! Adjusted the last line to --icon-size=20 and it works great now:)
Offline
^Cool!
If you want that icon size for all your menus - not just popups - you can put it in jgmenurc instead.
OTOH I guess you can add other jgmenu settings to that line in the script and they'll overrule jgmenurc for popups only.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
hhh wrote:^ Looks really slick! Love your theming, the name of your panel folder icons please?
Made em:) Colored them anyway:) The first three, and the numbers. They are located in my Github Here.
Checkout the wbar icons located there too:)
Nice, I thought it was that Git but wanted to make sure. The wbar icons are lovely, but it's the OpenSuse Breeze theme that I was intrigued by. It fits a certain wallpaper...
I'm theming this tomorrow, it will be the easiest job ever. Ten minutes, max.
No, he can't sleep on the floor. What do you think I'm yelling for?!!!
Offline
^ Tomorrow? Ooo... ho ho ho ho! Today me Buck-O! You go out again right after lunch!
No, he can't sleep on the floor. What do you think I'm yelling for?!!!
Offline
Pages: 1