JWM config generator - Yet another JWM tool

Moderator: Forum moderators

Post Reply
Rev
Posts: 4
Joined: Fri Jun 14, 2024 6:08 am

JWM config generator - Yet another JWM tool

Post by Rev »

Hello everyone! I am originally from the DSL forums, but I wanted to share my project I've been working on for the last couple of months. It's not Puppy Linux specific and is more of a general utility program just for JWM.
Please let me know if I'm posting this in the right place, I'm brand new to this forum.

The program is called jwms (I know, pretty creative lol). Since it was originally meant to be a quasi session manager for JWM. But right now it's just a fancy JWM config generator. I might eventually change the name to something else.
The program was inspired by other programs such as JWMKit and some other projects, but I wanted this project to be more minimal and fast. Another reason is that I just don't like how JWM handles its configuration.

The program generates the root menu based on the valid programs found under /usr/share/applications and will try to find their associated icons based on the currently active gtk2 icon theme or will fall back to using icons from hicolor.
Categories are generated as long as they have at least one program in them, so empty categories are ignored.
Styles, key bindings, autostart script, and the tray are also created and are mostly finished.

It will generate all the necessary files in the ~./config/jwm directory along with the .jwmrc file in the home directory

The program is written entirely in C and only uses libbsd and libconfuse as a dependency.

Here is the link for the project. You just need to run make inside the jwms folder and then to run the program just do ./jwms
https://github.com/purpasmart96/jwms

I'm currently requesting feedback, ideas, or feature requests.

Last edited by Rev on Tue Jun 18, 2024 1:49 am, edited 1 time in total.
User avatar
RSH
Posts: 110
Joined: Tue May 28, 2024 7:33 pm
Location: Kassel
Has thanked: 53 times
Been thanked: 36 times
Contact:

Re: Yet another JWM tool

Post by RSH »

I tried to compile this in Bionic.
Confuse.h missing.
Where do I get this?

Edit:

I found it in Paxkage Manager when searchig for confuse.
Installed all 3 packages and compiled successfully.

Now testing...

My OS: ArtStudio64 - a Woof-CE built from Bionic 18.04
Running in RAM only, no save file, no save folder
www.youtube.com/@RainerSteffenHain

User avatar
RSH
Posts: 110
Joined: Tue May 28, 2024 7:33 pm
Location: Kassel
Has thanked: 53 times
Been thanked: 36 times
Contact:

Re: Yet another JWM tool

Post by RSH »

It won't run. Ignoring all of the .desktop files.

Code: Select all

Failed to parse or ignoring /usr/share/applications/runscripts4wineportables.desktop
Failed to parse or ignoring /usr/share/applications/save_file_builder.desktop
Failed to parse or ignoring /usr/share/applications/set-global-font-size.desktop
Failed to parse or ignoring /usr/share/applications/sfs-plus-menu.desktop
Failed to parse or ignoring /usr/share/applications/sfs-plus-remaster.desktop
Failed to parse or ignoring /usr/share/applications/sfs2petconverter.desktop
Failed to parse or ignoring /usr/share/applications/sfs_load.desktop
Failed to parse or ignoring /usr/share/applications/sound-switcher.desktop
Failed to parse or ignoring /usr/share/applications/topless-dashboard.desktop
Failed to parse or ignoring /usr/share/applications/update-globicons.desktop
Failed to parse or ignoring /usr/share/applications/openoffice4-javafilter.desktop
Failed to parse or ignoring /usr/share/applications/openoffice4-qstart.desktop
/tmp/runinterminal-3932: line 3:  3937 Speicherzugriffsfehler  "/mnt/sda1/Dateien/Downloads/jwms-master/jwms"
Script completed hit RETURN to close window.

My OS: ArtStudio64 - a Woof-CE built from Bionic 18.04
Running in RAM only, no save file, no save folder
www.youtube.com/@RainerSteffenHain

Rev
Posts: 4
Joined: Fri Jun 14, 2024 6:08 am

Re: Yet another JWM tool

Post by Rev »

RSH wrote: Sat Jun 15, 2024 4:18 am

It won't run. Ignoring all of the .desktop files.

Code: Select all

Failed to parse or ignoring /usr/share/applications/runscripts4wineportables.desktop
Failed to parse or ignoring /usr/share/applications/save_file_builder.desktop
Failed to parse or ignoring /usr/share/applications/set-global-font-size.desktop
Failed to parse or ignoring /usr/share/applications/sfs-plus-menu.desktop
Failed to parse or ignoring /usr/share/applications/sfs-plus-remaster.desktop
Failed to parse or ignoring /usr/share/applications/sfs2petconverter.desktop
Failed to parse or ignoring /usr/share/applications/sfs_load.desktop
Failed to parse or ignoring /usr/share/applications/sound-switcher.desktop
Failed to parse or ignoring /usr/share/applications/topless-dashboard.desktop
Failed to parse or ignoring /usr/share/applications/update-globicons.desktop
Failed to parse or ignoring /usr/share/applications/openoffice4-javafilter.desktop
Failed to parse or ignoring /usr/share/applications/openoffice4-qstart.desktop
/tmp/runinterminal-3932: line 3:  3937 Speicherzugriffsfehler  "/mnt/sda1/Dateien/Downloads/jwms-master/jwms"
Script completed hit RETURN to close window.

Oh, those messages debug messages, All desktop entries must have an icon, be an application, have an executable, and must not contain the the no_display attribute. Otherwise it will ignore them.
The other message at the end is quite interesting. It looks like a memory error, which is strange since I tested it with Valgrind with no errors.
If you can run

Code: Select all

make clean

and then build it with

Code: Select all

make debug

and post the output of it that would be greatly appreciated.

dogcat
Posts: 259
Joined: Fri Feb 18, 2022 11:14 pm
Has thanked: 69 times
Been thanked: 118 times

Re: Yet another JWM tool

Post by dogcat »

I built it on 32-bit Bionic using make debug.
There were some warnings, I attach the output from the build.

Code: Select all

# make debug
gcc -g -O0 -Wall -Wextra -c -o build/debug/bstree.o src/bstree.c
gcc -g -O0 -Wall -Wextra -c -o build/debug/config.o src/config.c
src/config.c: In function ‘GetStyleType’:
src/config.c:80:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < ARRAY_SIZE(style_types); i++)
                       ^
src/config.c: In function ‘GenJWMAutoStart’:
src/config.c:349:10: warning: unused variable ‘keymods’ [-Wunused-variable]
     char keymods[64];
          ^~~~~~~
src/config.c: In function ‘GenJWMRootMenu’:
src/config.c:950:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (size_t i = 0; i < num_categories; i++)
                          ^
src/config.c: In function ‘GenJWMRCFile’:
src/config.c:977:30: warning: unused parameter ‘jwm’ [-Wunused-parameter]
 static int GenJWMRCFile(JWM *jwm)
                              ^~~
At top level:
src/config.c:78:12: warning: ‘GetStyleType’ defined but not used [-Wunused-function]
 static int GetStyleType(char *key)
            ^~~~~~~~~~~~
gcc -g -O0 -Wall -Wextra -c -o build/debug/darray.o src/darray.c
gcc -g -O0 -Wall -Wextra -c -o build/debug/desktop_entries.o src/desktop_entries.c
src/desktop_entries.c: In function ‘EntryPrint’:
src/desktop_entries.c:175:41: warning: unused parameter ‘args’ [-Wunused-parameter]
 static void EntryPrint(void *ptr, void *args)
                                         ^~~~
src/desktop_entries.c: In function ‘ParseCategories’:
src/desktop_entries.c:337:27: warning: ‘main’ is usually a function [-Wmain]
         XDGMainCategories main = GetXDGMainCategoryType(token);
                           ^~~~
At top level:
src/desktop_entries.c:189:12: warning: ‘ExecCmp’ defined but not used [-Wunused-function]
 static int ExecCmp(const void *a, const void *b)
            ^~~~~~~
gcc -g -O0 -Wall -Wextra -c -o build/debug/hashing.o src/hashing.c
src/hashing.c: In function ‘HashMapPrint’:
src/hashing.c:240:38: warning: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘size_t {aka unsigned int}’ [-Wformat=]
             printf("Key Hash : 0x%08lX\n", map->entries[i]->hash);
                                  ~~~~^     ~~~~~~~~~~~~~~~~~~~~~
                                  %08X
src/hashing.c: In function ‘HashMapPrint2’:
src/hashing.c:256:38: warning: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘size_t {aka unsigned int}’ [-Wformat=]
             printf("Key Hash : 0x%08lX\n", map->entries[i]->hash);
                                  ~~~~^     ~~~~~~~~~~~~~~~~~~~~~
                                  %08X
gcc -g -O0 -Wall -Wextra -c -o build/debug/icons.o src/icons.c
src/icons.c: In function ‘LookupFallbackIcon’:
src/icons.c:519:38: warning: unused parameter ‘icon’ [-Wunused-parameter]
 char *LookupFallbackIcon(const char *icon)
                                      ^~~~
At top level:
src/icons.c:316:12: warning: ‘IconDirCmp’ defined but not used [-Wunused-function]
 static int IconDirCmp(const void *a, const void *b)
            ^~~~~~~~~~
gcc -g -O0 -Wall -Wextra -c -o build/debug/ini.o src/ini.c
gcc -g -O0 -Wall -Wextra -c -o build/debug/jwms.o src/jwms.c
gcc -g -O0 -Wall -Wextra -c -o build/debug/list.o src/list.c
gcc -g -O0 -Wall -Wextra -c -o build/debug/themes.o src/themes.c
gcc -g -O0 -Wall -Wextra -o build/debug/jwms build/debug/bstree.o build/debug/config.o build/debug/darray.o build/debug/desktop_entries.o build/debug/hashing.o build/debug/icons.o build/debug/ini.o build/debug/jwms.o build/debug/list.o build/debug/themes.o -lconfuse -lbsd
# 

Launching the binary ended in a segmentation fault. Output from that is attached as a zip as it is quite long.

jwms-binary-run-output_bionic-32bit.txt.gz
(3.9 KiB) Downloaded 11 times

Μακάριοι οι καθαροί στην καρδιά * επειδή, θα δουν τον Θεό.

User avatar
bigpup
Moderator
Posts: 6972
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 898 times
Been thanked: 1520 times

Re: Yet another JWM tool

Post by bigpup »

It will generate all the necessary files in the ~./config/jwm directory along with the .jwmrc file in the home directory

In Puppy Linux there is no ~./config/jwm

There is ~/.config directory

There is ~.jwm a hidden directory in the root directory. ~ is the root directory.

along with the .jwmrc file in the home directory

Puppy does not use the home directory like other Linux OS's.

In Puppy the location is ~.jwmrc which is in the root directory ~

Because Puppy is setup for only one user root.

/home is used only as a place for the restricted spot implementation of restricting Internet programs, only location to download stuff to.
/home/spot
When programs are run-as-spot they have full permission only in the /home/spot directory

What other Linux OS's use /home for.
Puppy does it in ~ (the root directory)

Puppy has another home directory /mnt/home
But this is really just the mount point of the location of the Puppy save.
It gets created when the save is made and boot using the save.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

Rev
Posts: 4
Joined: Fri Jun 14, 2024 6:08 am

Re: Yet another JWM tool

Post by Rev »

bigpup wrote: Sat Jun 15, 2024 1:08 pm

It will generate all the necessary files in the ~./config/jwm directory along with the .jwmrc file in the home directory

In Puppy Linux there is no ~./config/jwm

There is ~/.config directory

There is ~.jwm a hidden directory in the root directory. ~ is the root directory.

along with the .jwmrc file in the home directory

Puppy does not use the home directory like other Linux OS's.

In Puppy the location is ~.jwmrc which is in the root directory ~

Because Puppy is setup for only one user root.

/home is used only as a place for the restricted spot implementation of restricting Internet programs, only location to download stuff to.
/home/spot
When programs are run-as-spot they have full permission only in the /home/spot directory

What other Linux OS's use /home for.
Puppy does it in ~ (the root directory)

Puppy has another home directory /mnt/home
But this is really just the mount point of the location of the Puppy save.
It gets created when the save is made and boot using the save.

Well, that explains a lot. I haven't used Puppy Linux in quite a while and I completely forgot about these differences since I mainly use Debian as my dev environment. The program was originally designed to be distro agnostic.
The pathing part should be pretty straightforward to fix. I'll try to get it working.

Rev
Posts: 4
Joined: Fri Jun 14, 2024 6:08 am

Re: JWM config generator - Yet another JWM tool

Post by Rev »

After doing some debugging, it turns out the path issues weren't the reason for the segfault. It was actually my parser for grabbing

Code: Select all

gtk-icon-theme-name

Since my program finds the home directory by reading $HOME instead of hardcoding it, it correctly had set root as the home directory. Right now I would say that there is still some issues.
As of now, I would say that its current state is a downgrade over existing puppy tools, partly because it's not puppy specific.
I am currently planning on having the program do a lot of similar tasks and reduce the amount of shell scripts being used.

Also, if you guys are going to continue to try out my program, then make sure to back up your .jwmrc file.

Post Reply

Return to “Utilities”