Page 1 of 1
JWM config generator - Yet another JWM tool
Posted: Fri Jun 14, 2024 11:16 pm
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.
Re: Yet another JWM tool
Posted: Sat Jun 15, 2024 4:07 am
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...
Re: Yet another JWM tool
Posted: Sat Jun 15, 2024 4:18 am
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.
Re: Yet another JWM tool
Posted: Sat Jun 15, 2024 9:23 am
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
and then build it with
and post the output of it that would be greatly appreciated.
Re: Yet another JWM tool
Posted: Sat Jun 15, 2024 12:13 pm
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.
Re: Yet another JWM tool
Posted: Sat Jun 15, 2024 1:08 pm
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.
Re: Yet another JWM tool
Posted: Sat Jun 15, 2024 11:01 pm
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.
Re: JWM config generator - Yet another JWM tool
Posted: Tue Jun 18, 2024 4:26 am
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
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.