Skip to content

Commit

Permalink
make fixmenus itself reconfigure labwc
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Dec 23, 2024
1 parent 2b50db5 commit 47223f8
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 20 deletions.
1 change: 1 addition & 0 deletions woof-code/3builddistro
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ chroot rootfs-complete install -D -m 644 /home/spot/.config/mimeapps.list /root/
chroot rootfs-complete install -D -m 644 /home/spot/.config/mimeapps.list /etc/skel/.config/mimeapps.list

chroot rootfs-complete /etc/rc.d/rc.update w
chroot rootfs-complete run-as-spot fixmenus

rm -rf build
mkdir build
Expand Down
2 changes: 1 addition & 1 deletion woof-code/rootfs-petbuilds/fixmenusd/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fixmenusd uses inotify to watch /usr/share/applications and runs argv[1] on change.
fixmenusd uses inotify to watch /usr/share/applications and runs fixmenus on change.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Version=1.0
Name=fixmenusd
Comment=fixmenus daemon
Exec=fixmenusd "fixmenus; killall -HUP labwc"
Exec=fixmenusd
Terminal=false
Type=Application
8 changes: 4 additions & 4 deletions woof-code/rootfs-petbuilds/fixmenusd/fixmenusd.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
#include <fcntl.h>

static int
sh(const char *cmd, const sigset_t *set)
fixmenus(const sigset_t *set)
{
pid_t pid, reaped;

pid = fork();
if (pid == 0) {
if (sigprocmask(SIG_SETMASK, set, NULL) == 0)
execl("/bin/sh", "/bin/sh", "-c", cmd, (char *)NULL);
execlp("fixmenus", "fixmenus", (char *)NULL);

exit(EXIT_FAILURE);
}
Expand Down Expand Up @@ -77,7 +77,7 @@ main(int argc, char* argv[])
sigset_t set, oset;
int fd, appwd, flatpakappwd, sig;

if (argc != 2)
if (argc != 1)
return EXIT_FAILURE;

if ((sigemptyset(&set) < 0) ||
Expand Down Expand Up @@ -115,7 +115,7 @@ main(int argc, char* argv[])
(((sig == SIGRTMIN) &&
(handle_events(fd, appwd, flatpakappwd, &oset) == 0)) ||
((sig == SIGALRM) &&
(sh(argv[1], &oset) == 0)) ||
(fixmenus(&oset) == 0)) ||
(sig == SIGCHLD)));

inotify_rm_watch(fd, flatpakappwd);
Expand Down
4 changes: 0 additions & 4 deletions woof-code/rootfs-skeleton/etc/rc.d/rc.update
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ update_cache_files() {
fi
done

if [ /usr/bin/labwc-xdgmenu ] ; then
LANG=C run-as-spot fixmenus #Reconstruct configuration files for JWM, IceWM...
[ -n "$WAYLAND_DISPLAY" ] && killall -HUP labwc
fi
if [ -e /usr/bin/update-desktop-database ] ; then
rm -f /usr/share/applications/mimeinfo.cache 2>/dev/null
update-desktop-database /usr/share/applications
Expand Down
12 changes: 3 additions & 9 deletions woof-code/rootfs-skeleton/usr/local/bin/fixmenus
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,10 @@
#120209 this script now called from /usr/sbin/quicksetup, whenever locale is changed.
#120216 sss translation file now uses simple sed expressions.

[ ! "$HOME" ] && HOME='/root'
[ "$HOME" = "/" ] && HOME='/root'
export HOME

LANG1="${LANG%_*}" #120207 ex: de

for ONESRC in `ls /etc/xdg/templates/_* 2>/dev/null` #ex: _root_.jwmrc
do
ONEDEST=${ONESRC##*/} # basename: _root_.jwmrc
if [ "$HOME" != "/root" ] ; then
ONEDEST=${ONEDEST//_root/$HOME} # _root.jwmrc -> /home/finn_.jwmrc
fi
ONEDEST=${ONEDEST//_root/$HOME} # _root.jwmrc -> /home/finn_.jwmrc
ONEDEST=${ONEDEST//_/\/} # _root_.jwmrc -> /root/.jwmrc
echo "Generating $ONEDEST..."

Expand All @@ -44,4 +36,6 @@ do
mv -f ${TMPDEST} ${ONEDEST}
done

labwc -r

###END###
2 changes: 1 addition & 1 deletion woof-code/rootfs-skeleton/usr/local/bin/logout_gui
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exec yad \
--field "$(gettext 'Install Puppy')"\!media-flash-symbolic:FBTN "kill \$YAD_PID; bootflash" \
--field "$(gettext 'Restart graphical server')"\!view-refresh-symbolic:FBTN "kill \$YAD_PID; restartwm" \
--field "$(gettext 'Exit to Prompt')"\!application-exit-symbolic:FBTN "kill \$YAD_PID; wmexit" \
--field "$(gettext 'Rebuild Menu')"\!open-menu-symbolic:FBTN "kill \$YAD_PID; fixmenus; killall -HUP labwc" \
--field "$(gettext 'Rebuild Menu')"\!open-menu-symbolic:FBTN "kill \$YAD_PID; fixmenus" \
--field "$(gettext 'Lock screen')"\!system-lock-screen-symbolic:FBTN "kill \$YAD_PID; swaylock" \
--no-buttons \
--use-interp

0 comments on commit 47223f8

Please sign in to comment.