You are not logged in.
Hi @Bronto!
1) I've been using beepmein every day to remind me of a couple of things I often forget, eg a reminder at mid-day, triggered from a line in my startup script:
beepmein --reason 'NEWS' 11:55
So I added a new option --reason to bypass the popup to enter the reason every time, in the "main" section ~line #250:
if [[ "$1" != "--reaction" ]] ; then
if [[ "$1" == "--nr" ]] ; then # --nr must be first
# chop off first argument
noreason="true" && shift
elif [[ "$1" == "--reason" ]]; then
reason="$2"
noreason="true" # inhibit reason popup
shift 2
fi
if [[ "${!#}" == "--alarm" ]] ; then # --alarm must be last
# chop off last argument
alarm="--alarm" && set -- "${@:1:$(($#-1))}"
testAlarmPath
fi
#...etc
2) Since I enabled localhost root mail in Thunderbird I was getting regular messages from 'at' about jobs that had been run. Tried a couple of things and now they've stopped, maybe all of them are necessary?
In Playa() lines #173 #176
if command -v mpv >/dev/null 2>&1
then
mpv --no-terminal --no-resume-playback --no-video "$file"
elif command -v cvlc >/dev/null 2>&1
then
cvlc --quiet --no-video "$file" vlc://quit
and for 'at' itself line #288:
at -M "$attime" <<< "$(echo "sleep $delay; #etc etc
What do you think about this stuff?
---
offtopic/
It would be nice to have persistent alarms at the same time every day/week, but of course that's not how 'at' works at all and I'm quite happy with beepmein how it is now. Unless you want to rewrite it to use systemd timers or something...
...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
- Single cli with reason included is certainly an improvement (especially in gui popups world, if it removes the 2nd popup).
- Never send mail (-M) switch is an improvement.
- About persistent alarms: Maybe cron + 'easy cron builder'* could be used? (don't know) < This gets into territory of things like google calendar, which has a really neat gui and it is in the cloud ....
I'am glad this thing is useful, I do use it quite regularly as well, but mostly just from cli.
*A part of script that has yet to be written.
Edit: This option parsing if-then stuff is really annoying, do we have a better/battle tested method?
Looking at this mess https://mywiki.wooledge.org/BashFAQ/035
Last edited by brontosaurusrex (2021-11-28 19:28:44)
Offline
- Single cli with reason included is certainly an improvement (especially in gui popups world, if it removes the 2nd popup).
- Never send mail (-M) switch is an improvement.
OK I'll merge that in.
------------------------------------
This option parsing if-then stuff is really annoying, do we have a better/battle tested method?
Looking at this mess https://mywiki.wooledge.org/BashFAQ/035
There are different ways indeed - in simple scripts I usually do something like Woolledge's first example:
flag='default'
file=''
while [[ -n $1 ]]
do
case "$1" in
-h|--help)
echo "$HELP"
exit 0
;;
-t|--thing)
flag='thing' # so can refer to $flag later
shift
;;
-f|--file)
file=$2
shift 2
;;
-*)
echo "${0}: ${1}: no such option" >&2
echo "
$HELP"
exit 1
;;
*)
<possibly do something with $1, or else error out>
shift # if you still want to continue
;;
esac
done
So count down through the parameters using shift till they're all used up, and inspect each one with case.
But there are other ways of course, like getopts. I haven't yet found a need for that. If you're planning to make the script publicly available you might need to give more thought to strange ways people might try to call it, at least error out if necessary.
...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
Thanks for the example, this does look nicer.
OK I'll merge that in.
Great, make sure that the gui part is also aware of the changes?
Offline
Do the changes affect the GUI at all? It's only a new CLI option. I'll add this to the beepmein help message:
beepmein --reason <reason> # pass reason (must be first & second parameters)
The pipemenu works OK as-is I think.
---
Did notice with the pipemenu, the time-to-go is shifted almost off the screen to the right:
It seems to be the tab that goes in on line 110:
[[ "$toEvent" ]] && toEvent="\t< $toEvent"
Replace that \t with four spaces and it looks like this:
No idea why the tab is so huge, or the spaces so small...
...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
I meant if the popups could be formatted to include --reason it may improve user experience (or not), as you wish.
Last edited by brontosaurusrex (2021-11-30 10:13:33)
Offline
^Ah I think I see what you mean.
I leave that in your hands, as the CLI option by itself is enough for my selfish personal needs.
...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
I've been poking around the scripts a bit, but I'am slow, did two small changes though
diff ~/bin/beepmein .
146c146
< [[ -f $file ]] || { return 1; } # if no sample configured then return error, so that failsafe beeps can be used instead
---
> [[ -f $file ]] || { superecho "file not found" ; return 1; }
diff ~/bin/pipeBeepmein .
6c6
< # usage: pipeBeepmein | jgmenu --vsimple --at-pointer
---
> # usage: pipeBeepmein | jgmenu --simple --icon-size=0
1st one is kinda important, since it removes confusing notification message when no audio samples are configured.
edit: Plan was also to move the 'timeToEvent' stuff into cli version (for nicer --list), but confused by my own code....
edit2: Not sure whats up with tabs, looks like this here
Or with 'tint2_look=1" in jgmenurc like
https://scrot.cloud/images/2021/12/09/jgmenu2-fs8.png
edit3: Plan is also to change the parameter parsing to that nice while/case thing (including --reason). And the never send mail -M switch for 'at'.
Last edited by brontosaurusrex (2021-12-09 21:36:19)
Offline
Is this what pops up when you right-click the tint2 clock in Lithium?
Not sure whats up with tabs, looks like this here
https://scrot.cloud/images/2021/12/09/jgmenu.pngOr with 'tint2_look=1" in jgmenurc like
https://scrot.cloud/images/2021/12/09/jgmenu2-fs8.png
It's puzzling. If I switch jgmenurc for a single line 'tint2_look=1' then the appearance is the black vsimple style, but that lo~ng tab remains. Likewise with 'bl-beepmein-pipemenu | jgmenu --vsimple --at-pointer'
But anyway, by default, we should be using the current jgmenu theme, to match the rest of the desktop, no? (ie the way it is now.)
BUT why aren't you getting that long tab?? It appears for me whatever I do. Different jgmenu version?
john@lithium:~$ apt policy jgmenu
jgmenu:
Installed: 4.4.0+bl10-1
...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
On this machine
apt-cache policy jgmenu
jgmenu:
Installed: 4.2.1-1
Candidate: 4.2.1-1
Version table:
*** 4.2.1-1 100
100 /var/lib/dpkg/status
The other one has latest jgmenu git build, but the menu looks the same (that is tabs are 'correct')
Offline
Full output:
john@lithium:~$ apt-cache policy jgmenu
jgmenu:
Installed: 4.4.0+bl10-1
Candidate: 4.4.0+bl10-1
Version table:
*** 4.4.0+bl10-1 500
500 https://pkg.bunsenlabs.org/debian lithium/main amd64 Packages
100 /var/lib/dpkg/status
So 4.4.0+bl10-1 is in the Lithium repo. I see 4.4.0-1 is in Bookworm but no earlier release. Where did you get 4.2.1-1 from?
Anyway I'll try building from git and see if the problem goes away: if it does, then we just have to an upgrade of the BL package.
...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
2nd machine (git build)
jgmenu --version
jgmenu v4.4.0
which jgmenu
/home/ticho/bin/jgmenu
Where did you get 4.2.1-1 from?
Actually no idea, that vbox install hasn't spin for a while, I'll upgrade both machines to latest git?
Offline
I tried setting a different font in jgmenurc but while it changed the appearance it didn't help with the long tabs.
Last edited by johnraff (2021-12-11 06:46:06)
...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
See “tabs” in https://jgmenu.github.io/jgmenu.1.html
The first tab is set to 120 by default.
Offline
@malm thank you - that's got it!
eg in bl-jgpop, change the last line:
exec jgmenu --simple --config-file=<( sed '/menu_padding_top/ { s/^/#/ }; $ a tabs = 20' ~/.config/jgmenu/jgmenurc ) <other args>
The extra sed code '$ a tabs = 20' appends a final line to jgmenurc just for popup menus. Permanently adding 'tabs = 20' to jgmenurc would have the same effect.
But this begs some questions:
1) Why is the default tab length so long?
2) Will something break elsewhere in jgmenu if the default tab length is shortened in jgmenurc?
3) Why is tab length defined in pixels instead of in spaces or ems or some other character-size related measure?
4) Why is @Bronto not seeing the 120px tabs - or maybe his screen is very high-res so 120px isn't so long?
...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
Ha ha. Well, I suppose it comes from not having any real “acceptance criteria” and just implementing features to suit one’s need at the time with complete disregard for code maintainability (note to self). So to answer your questions:
1) If I remember correctly, I implemented it to align the bunsenlabs keybinds, which looked bad in the original openbox menu. I suspect I set the default to 120 because that was easier than getting lots of BL users to add “tabs=120” in their jgmenurc.
2) Anyone relying on the default being 120 will experience a “breaking change” if we change it. Just looked at our bunsen-configs, and we haven’t got a “tabs=120” in there, so our keybind pipemenu would look odd.
From an “upstream” perspective, the neatest way would be to set the default to 0 (to not specify any tabs) which would fall back on the pango default which is 8 spaces.
3) pango_layout_set_tabs() takes the tab argument in pixels - so coder laziness rather than anything clever
4) Not sure. Has @Bronto set tabs in jgmenurc?
Offline
The first tab seems to be exactly (or very close) to 120px from the left border on brontos example, so not sure what we are talking about?
https://scrot.cloud/images/2021/12/13/jgmenu2.png
My jgmenurc is empty.
Last edited by brontosaurusrex (2021-12-13 05:56:07)
Offline
My first tab is 120px from the previous character, not from the left border, and pushes the time off the screen:
(Same if launched 'bl-beepmein-pipemenu | jgmenu --vsimple'.)
With
tabs = 0
Last edited by johnraff (2021-12-13 07:15:05)
...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
From an “upstream” perspective, the neatest way would be to set the default to 0 (to not specify any tabs) which would fall back on the pango default which is 8 spaces.
This sounds like the clean way to go really, rather than having a tab-width baked into jgmenu to serve the needs of one particular pipemenu.
But... then how to set the wide tabs needed for the keyboard bindings pipemenu?? Since that's a submenu of the main jgmenu in BL, unless I'm missing something, then the only way would be to have the whole menu running with 'tabs = 120', because I can't find any way to have a separate config value in a pipemenu which is being called by the root menu. Is there a way?
Alternatively, is jgmenu able to take multiple space inside the csv data and display them somehow?
Tested: spaces in the csv label section are displayed as-is.
OB xml labels are generated thus:
printf "%-20s %s" "$key" "$cmd"
which lines the $cmd part up nicely on the right at a standard 20chars width for the $key column (I think).
eg XML:
<item label="A-m Move">
But the jgmenu_run ob processor turns those spaces into a single tab:
jgmenu_run ob --cmd='bl-kb-pipemenu --keybinds' | tr '\t' '*'
--- last line of output ---
A-m*Move,echo >/dev/null 2>&1
Is there any way the spaces could be preserved?
Or, if bl-kb-pipemenu were rewritten to output native jgmenu csv, that ought to work, and tabs become irrelevant?
That might be the best way to go in fact, and wouldn't be very hard.
...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
@malm please don't worry about changing the behaviour of jgmenu in any way - at least not till post-beryllium and you feel you have the time.
Rewriting bl-kb-pipemenu to output csv was indeed easy, but the problem was that the spaces only work to align the right-hand column if a monospace font is used, and I couldn't get tabs to work at all. So never mind - let's leave it how it is now, with the OB xml pipemenu and the default 120px tabs.
---
Meanwhile bl-beepmein-pipemenu looks OK for me if 'tabs = 0' is set somewhere - eg in the bl-jgpop launcher script - which leaves the default tabs unchanged.
But @bronto I still don't understand why those 120px tabs are looking OK for you but not for me. Or why your tabs are being measured from the left-hand margin, but mine from the preceeding character (see above screenshots).
Anyway, if you temporarily set 'tabs = 0' in jgmenurc, how does the beepmein pipemenu popup look for you? If it's still OK then we have an easy way forward...
...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