Forum › Forums › Official Releases › antiX-19 “Marielle Franco, Hannie Schaft, Manolis Glezos, Grup Yorum, Wobblies” › Recent Files non-Latin wrong symbols
- This topic has 29 replies, 5 voices, and was last updated Feb 7-4:22 pm by Anonymous.
-
AuthorPosts
-
February 2, 2021 at 7:10 pm #51345
Anonymous
::IceWM and counterparts are rather bare-bones and “wooden” in terms of modern desktop usability. There is no remedy, except wait for (or make) some IceWM-ng (= new generation).
Additional options like “open with” could be added by means of IceWM menu’s items that are both clickable and submenu-containing as Logout and some Theme sub-items are (see screenshot below). Manpages are silent on it. Somebody, reveal the recipe!
quoting this “whole passage” but I’m focused on replying to the first sentence only. I reckon the remainder spans a separate topic (or 2).
I’m compelled to insist that there is no “remedy”, period.
iceWM and its kindred window managers cannot anticipate, and successfully cope with, the myriad quirks of NN disparate programs. The job of a window manager is simply to manage X window containers and to be blind to, and not interfere with, the operation(s) of (and IPC) performed by and between the windowed programs.February 2, 2021 at 7:32 pm #51346Anonymous
::means of [..] menu items that are both clickable and submenu-containing…
Ultimately, developing a superior menuing widget might be the winning approach.
The “window manager” menu would be relegated to use only when intending to change wm-related settings.The spaceFM menu, with its “design mode” customizability…
is it an appealing candidate for a standalone, window manager agnostic, desktop menuing widget?Fuggetabout “spacefm”, I envisioning a forked/renamed (and filemanager agnostic) menuing widget.
February 2, 2021 at 7:36 pm #51347Member
Xecure
::As skidoo praised it so much, I wanted to read the code and learn a bit to improve my bash coding skills.
What does this do?
if [ "$( stat -c '%s' "$configfile_path" )" -ge 9 ] ; thenShould there also be a check for the existence of certain files?
Also, why not load all information into variables or into files in RAM temp to reduce the time of read/writes and improve performance?I am learning here. If uxer doesn’t mind, I would like to learn a bit of the provided work.
- This reply was modified 2 years, 3 months ago by Xecure.
antiX Live system enthusiast.
General Live Boot Parameters for antiX.February 2, 2021 at 8:36 pm #51352Moderator
Brian Masinick
::if [ "$( stat -c '%s' "$configfile_path" )" -ge 9 ] ; thenStat is a command used to obtain file or file system statistics.
The -c option uses the format provided.
The ‘%s’ option specifies a string and “$configfile_path” is the string that is being evaluated.
-ge 9 means “greater than or equal to 9.Putting it all together, if the length of the “$configfile_path” string is 9 or more characters long, then the comparison is true (so perform whatever step or steps are listed in the “if block”).
Is this clear enough?
--
Brian MasinickFebruary 2, 2021 at 8:45 pm #51353Moderator
Brian Masinick
February 2, 2021 at 8:51 pm #51354Member
Xecure
::Brian Masinick, I can read man pages. I have read the man page for stat, but I don’t understand why this test is performed if there is no check for the existence of the file first. I also get this error when running the script:
stat: cannot stat '/home/pc/.config/icewm-menu-recentfiles-plus.rc.toml': No such file or directory ./icewm-menu-recentfiles-plus.sh: 31: [: Illegal number:So I was asking, in a roundabout way, to know what they were trying to achieve with that line, as I would be able to suggest a different aproach once I understood what the uxer was trying to do..
antiX Live system enthusiast.
General Live Boot Parameters for antiX.February 2, 2021 at 9:20 pm #51360Anonymous
::The ‘percent s’ here specifies (tells) the stat utility
“Hey, don’t show me all the columns. The only detail I wanna see is: total size, in bytes”Try it on a known file:
$ stat -c ‘%s’ ~/.fluxbox/menu
8570Try it on a known non-existent file:
$ stat -c ‘%t’ ~/.fluxbox/menushoe
stat: cannot stat ‘/home/demo/.fluxbox/menushoe’: No such file or directory————– trying to achieve
I didn’t go back and look at the line, in context.
If the .xbel is smaller than 9bytes, consider it empty/unusble ?
When “empty”, it probably still contains something like
[xml][/xml]
opening and closing tagsFebruary 2, 2021 at 9:42 pm #51361Moderator
Brian Masinick
::Brian Masinick, I can read man pages. I have read the man page for stat, but I don’t understand why this test is performed if there is no check for the existence of the file first. I also get this error when running the script:
stat: cannot stat '/home/pc/.config/icewm-menu-recentfiles-plus.rc.toml': No such file or directory ./icewm-menu-recentfiles-plus.sh: 31: [: Illegal number:So I was asking, in a roundabout way, to know what they were trying to achieve with that line, as I would be able to suggest a different approach once I understood what the uxer was trying to do..
Sorry that I missed the intent of your question; I figured you would be able to find information; posted the comments mostly for those reading for the first time, possibly learning how to write shell scripts. Uxer will probably figure out some improvements, and the other comments here, along with your insight should be of more help than my comments, which simply point to easily found information on the Web.
--
Brian MasinickFebruary 2, 2021 at 11:01 pm #51365Anonymous
::> I didn’t go back and look at the line, in context
because this a “12 blind monkeys describe an elephant’s trunk” game, innit?
February 3, 2021 at 5:16 pm #51427Anonymous
::What does this do?
if [ "$( stat -c '%s' "$configfile_path" )" -ge 9 ] ; thenstat -c %s — report total size of a file, in bytes
Note that stat fed with path of a symbolic link, will output the size of the link, so path needs to be resolved via realpath or other means.
sometimes https://explainshell.com/ may be helpful (but way too often is not)
The snippet means:
if the file is 9 bytes or more in size, then do
if the file is 8 or less bytes in size, or if the file does not exist, then don’t doIt is because “at_once=” is the shortest among settings stored in stat-tested configfile and the string is 8 characters long, with a value it is at least 9 characters long, which with unicode is 9 bytes. No point of reading configfile less than 9 bytes in size.
Should there also be a check for the existence of certain files?
why this test is performed if there is no check for the existence of the file first
It depends on your stance: “explicit is better than implicit” vs hacking.
For the former, yes there should also be a check for the existence.
For the latter, it suffices. I think it is both logically and implementationally correct:
“stat” may not report a positive or zero integer if the file does not exist;
“[” may not report success with malformed expression — the expression fails → the “[” fails → the “0” exit code is not returned → the “then” block is not performed.
So why puff up the code (and waste your fingers’ movements) with dedicated existence check?
I am learning here either. It is of my own devising, I haven’t read this hack somewhere among best practices, like https://www.etalabs.net/sh_tricks.html . Please correct me if I mistake.I also get this error when running the script:
stat: cannot stat '/home/pc/.config/icewm-menu-recentfiles-plus.rc.toml': No such file or directory ./icewm-menu-recentfiles-plus.sh: 31: [: Illegal number:Yes, I am aware of these 2 errors when the configfile does not exist. This local failure does not hurt the algorithm, at least that is what I can see. What can you say, did you remove icewm-menu-recentfiles-plus.rc.toml manually? Do these 2 errors break something?
Also, if the community here prefers having additional existence check, so be it. Please let me know explicitly.
I would be able to suggest a different aproach once I understood what the uxer was trying to do..
Brevity
Also, why not load all information into variables or into files in RAM temp to reduce the time of read/writes and improve performance?
Files are read once into variables, in order to reduce the time of read/writes and improve performance.
if [ "$( stat -c '%s' "$configfile_path" )" -ge 9 ] ; then
is a check whether to read the file at all, in order to reduce the time of read/writes and improve performance. This my coding is exploratory. You may argue that calling a check itself causes load, and it may be speedier to just blindly load that configfile.unreliable // inconsistent are the changes effected upon recently-used.xbel by various programs
The daemon would be left to stumble along as best it can.
inotifywait -m $HOME/.local/share/recently-used.xbel | \
while read file;do yad –text=”oOo” && sleep 10; doneThe sleep was intended as a debounce, in case multiple, back-to-back events are emitted.
No joy ~~ swap mymenucontentgenerator.sh in place of yad and we would wind launching multiple racy instances of the generator script.Please comment on this anti-race conceptual approach:
2 executables:
menu-generator-daemon.sh:
inotifywait -m "$XDG_DATA_HOME/recently-used.xbel" | while read inotifywait_output do if [ -e /var/run/menu-generator-running ] ; then touch /var/run/menu-generator-queued else menu-generator.sh & touch /var/run/menu-generator-running fi donemenu-generator.sh — maximum one instance:
menu_generate while [ -e /var/run/menu-generator-queued ] do rm /var/run/menu-generator-queued menu_generate done rm /var/run/menu-generator-running exitIceWM and counterparts are rather bare-bones and “wooden” in terms of modern desktop usability. There is no remedy, except wait for (or make) some IceWM-ng (= next generation).
Additional options like “open with” could be added by means of IceWM menu’s items that are both clickable and submenu-containing as Logout and some Theme sub-items are (see screenshot below). Manpages are silent on it. Somebody, reveal the recipe!
quoting this “whole passage” but I’m focused on replying to the first sentence only. I reckon the remainder spans a separate topic (or 2).
I’m compelled to insist that there is no “remedy”, period.
iceWM and its kindred window managers cannot anticipate, and successfully cope with, the myriad quirks of NN disparate programs. The job of a window manager is simply to manage X window containers and to be blind to, and not interfere with, the operation(s) of (and IPC) performed by and between the windowed programs.I was talking on:
a given user, during a given interaction, will wish to specify the opener (aka handler) for “this item, this time”. The menu-based solution probably cannot provide such flexibility (right-clicking an item would expose an action menu, offering an action labeled “Choose” or “OpenWith”). Possibly (I haven’t tested) in certain scenarios, the user could drag the {icewm} menu entry, dropping it on the desktop-resident icon for the desired handler/opener program…
I meant that it is 2021, and IceWM menu still has no: tooltips, right-mouse-button context menu, and other nifties.
I’d like to ask for the second time, if anybody knows, how to get that both-clickable-and-with-submenu entry.
“man 5 icewm-menu” describes prog and menu, but not how to combine them. The combination is part of IceWM menu — look at Logout. You can click on it or hover the cursor over the arrow and get Logout submenu. If anybody knows, tell me please how can such a combo be done for user-specified entries.February 3, 2021 at 6:27 pm #51431MemberPPC
::@uxer – Hi! Not answering your question, just providing some feedback:
I like antiX so much because how light it is, while still fully functional… That is the reason why I dislike running deamons, even very light ones… I do have 2 single core computers, one of which is a netbook with 1 Gb of RAM… so i tend to conserve system resources as much as I can…
About the lack of tooltips and context menu- I never noticed they were missing until I read your post 🙂
You are right about that, of course. It’s the curse of running a very light system, some features are not implementend. Tooltips are not really necessary (for me), but a contextual menu to add applications to pin/unpin apps to the menu, the toolbar or desktop would make sense- the problem is that antiX does not come with any DE that takes care of that.
Not really a Menu suggestion, but a toolbar suggestion- I find that having the toolbar icon manager on icewm’s toolbar is a handy way to add/remove icons- On the “menu” front: I wrote a script to pin/unpin apps to fluxbox menu- all that can aliviate the lack of contextual menu, but does not solve that “problem”.It’s always nice seeing someone trying to improve antiX! Thanks to all those that contribute with their ideas!
P.
February 3, 2021 at 7:41 pm #51434Anonymous
::Upon reading post #51347, I realized that my comment may have inadvertently slighted PPC BobC and Girafenaine by failing to similarly comment their efforts toward providing a recentlyused lookup solution.
> uxer wrote:
> I am not a bash scripter, thoughMaybe no one else remembers. Fresh in my mind is:
> BobC: I’m not a programmer…
–> skidoo: psssst! he IS a programmer, he just doesn’t realize it yet, hehe> Please correct me if I mistake.
uxer, that is my motto as well.
For the benefit of future readers (especially any “lurkers” in the audience):In this forum and elsewhere, each time someone presents code, some of the reactions may seem squinty-eyed, or overly-critical.
Lookit, I made a custom shell prompt!
Gee,kidgrampa, we’re soooo proud of you /sPer the established culture in this forum, any overtly “sarcastic” posts are thankfully rare here. Tr0n fights for the users. skidoo rails against parroted misinformation. New participants who are unaware of the local culture (and the possibly-too-predictable nature of each character in the clubhouse) might not immediately recognize the sunshine-n-rainbows aspect of collective, iterative, codeslinging.
February 3, 2021 at 8:36 pm #51438Anonymous
::About the lack of tooltips and context menu- I never noticed they were missing
It’s the curse of running a very light system, some features are not implemented.{bzzzzp} cognitive dissonance {skidoo smells smoke. Is something burning?}
I’d like to ask for the second time, if anybody knows, how to get that both-clickable-and-with-submenu entry.
A few weeks ago, I waded through the iceWM source code, searching for a definitive answer to a similar question. I posted a github link (
Menu.cc)
https://www.antixforum.com/forums/topic/ideas-for-improvements-in-future-releases/page/8/ thought the post containing that link was here, but cannot find it at the moment.https://github.com/bbidulock/icewm/blob/icewm-1-4-BRANCH/src/wmmenu.ccMaybe the gist of your question is not being received as intended.
As for me, I have focused on the andHere (it’s only a 35line file) https://github.com/bbidulock/icewm/blob/icewm-1-4-BRANCH/src/objmenu.h we can note that, for each menu item (node), the program is hardcoded to recognize only one action. As in, what you are hoping seems impossible, as the menu code lacks accommodation for “and/or/both” (unless I’m looking at, pointing to, a non-relavent portion of the icewm code).
February 3, 2021 at 8:56 pm #51439Anonymous
::Please comment on this anti-race conceptual approach
not useful (er, counterproductive) to process any redundant or stale/queued past events, right?
Pedantically reading “queued”, I stumbled for a moment. Yes, using a flagfile to denote “pending” seems sound.raw train-of-thought notes here
Regarding “anti-race”, I’ve read that inotifywait is, unfortunately, inherently racy (due to its monitoring of inodes, vs actual “files”) but it seems like the best tool available for the task at hand.
A debounce, or periodic timer mechanism would still be required, right?
The “menu-generator.sh”, each time it is called…
iflazyatimerelatime? noatime? mount option probably in effect, can we reliably consult timestamp of the flagfile?
/var/run$ mount|grep run tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,noatime,size=3288292k,mode=755)Wait, was my suggestion to use inotifywait an over-engineered “solution” ?
menu-generator.sh
could simply run as a daemon which periodically consults mtime attribute of the recently-used.xbel fileFebruary 7, 2021 at 4:22 pm #54094Anonymous
::If my reading of “man 5 fluxbox-menu” is correct, fluxbox’ menu reads only files, like IceWM’s “include” entry, but not STDOUTs, like IceWM’s “includeprog” entry — Recent Files list in fluxbox can’t be generated on-demand. JWM, another option in antiX, does support dynamic output (“man 1 jwm”).
Girafenaine at http://forum.mxlinux.org/viewtopic.php?f=143&t=60813&p=620739&hilit=recent suggests using cron, “every eg 15 minutes”.
If my understanding of antiX’ policy is correct, neither daemon, nor cron would be included as defaults, and Girafenaine’s Recent Files for fluxbox would not be included into antiX (MX’ policy may differ). Daemon/cron approach may still be implemented as an option, but this way we end up with multiconfiguration which adds complexity, against antiX’ policy. Without daemon/cron we have a lag, I can’t call antiX lean with it. Vicious circle.
Solutions?Also, how can I get an authoritative reply on whether antiX wants my proposal to be finished→released→included, or what.
-
AuthorPosts
- You must be logged in to reply to this topic.