WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed  (Read 3526 times)

Offline Zlika

  • Newbie
  • *
  • Posts: 29
Hi all,

I try to make a custom tinycore image without the Xprogs extension. The problem is that now when I select "Exit" in the window manager menu it only closes the window manager but the computer is not halted.
How could I change that?

Thanks for your replies.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
« Reply #1 on: November 17, 2016, 05:17:41 PM »
Include Xprogs.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
« Reply #2 on: November 17, 2016, 07:53:04 PM »
Xprogs.tcz  is part of the default desktop base on Tiny Core.
If you don't want to use the features provided by  Xprogs.tcz  (f.e. exittc), you would need to modify the Window Manager accordingly.
I wasn't able to spot the part where it creates the "Exit" part of the menu via the scripts included in the FLWM extension (I'm not used to FLWM).
I suspect that you want to keep the size at a minimum? Otherwise, other WMs might be easier to configure to your needs.
Download a copy and keep it handy: Core book ;)

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
« Reply #3 on: November 17, 2016, 07:56:45 PM »
Or extract only the stuff you need from  Xprogs.tcz  and include it in a self made  initrd  (i.e. core.gz  or an additional cpio archive that you would load in addition to core.gz) or  *.tcz .
Download a copy and keep it handy: Core book ;)

Offline Zlika

  • Newbie
  • *
  • Posts: 29
Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
« Reply #4 on: November 18, 2016, 03:51:44 AM »
Hi,

I don't want to include Xprogs because I don't need it and I want to produce a smaller image. The only thing I want is to understand how Xprogs/Exittc hooks the FLWM "Exit" menu to shutdown the computer, so I could do the same without Xprogs. I was not able to understand it by analyzing the Xprogs extension. I tried for example to add a .wmx/SystemTools/Exit script but it is not called on FLWM Exit.

Regards,
Thomas

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
« Reply #5 on: November 18, 2016, 04:55:21 AM »
Hi Zlika.

To me Misalf's suggestion would probably be easiest, strip Xprogs.tcz to include only exittc executable related stuff. Rename it Xprogs_mod.tcz or similar so it's not overwritten in an update check.

However, unsquashing flwm.tcz -> usr/local/bin/flwm_initmenu appears to be the script that builds the menu, this appears to be how the menu gets created:
Code: [Select]
TARGET="$SYSMENU"/SystemTools && mkdir "$TARGET"
sync
for D in `ls /usr/local/share/applications/tinycore-*`; do
   writeFLWMitem "$D"
done

Everything in /usr/local/share/applications/tinycore-* coincidentally is part of Xprogs.tcz unsquashed:
Code: [Select]
tinycore-apps.desktop        tinycore-mnttool.desktop
tinycore-cpanel.desktop      tinycore-screenshot.desktop
tinycore-editor.desktop      tinycore-services.desktop
tinycore-exittc.desktop      tinycore-settime.desktop
tinycore-flrun.desktop

The tinycore-exittc.desktop file requires the exittc executable:
Code: [Select]
[Desktop Entry]
Name=Exit
Exec=exittc
Icon=exittc
X-FullPathIcon=/usr/local/share/pixmaps/exittc.png
Type=Application
Categories=System;

Although Xprogs contains 18 executables none are critical for backup and shutdown, as the base TC file system appears to contain the following:
/sbin/poweroff
/sbin/halt
/usr/bin/backup
/usr/bin/filetool.sh

So if you absolutely don't want Xprogs you could probably modify flwm.tcz, add this directory and desktop file: /usr/local/share/applications/tinycore-exittc.desktop. Then modify the desktop file to include something like: exec=sudo /sbin/poweroff. Not tested, just best guess.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11043
Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
« Reply #6 on: November 18, 2016, 05:44:00 AM »
The exit menu item is hardcoded in the flwm source. You can build your own flwm with it edited to something else.
The only barriers that can stop you are the ones you create yourself.

Offline Zlika

  • Newbie
  • *
  • Posts: 29
Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
« Reply #7 on: November 18, 2016, 07:56:44 AM »
The exit menu item is hardcoded in the flwm source. You can build your own flwm with it edited to something else.

You're right, and it is the "exittc" command that is called:
Code: [Select]
tc@box:/usr$ grep -r exittc *
(...)
local/bin/flwm_topside:exittc
tc@box:/usr$ which exittc
/usr/local/bin/exittc

So I just had to add a /usr/local/bin/exittc script with:
Code: [Select]
#!/bin/sh
sudo poweroff

and it works!

Thank you all for your help.

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
« Reply #8 on: November 18, 2016, 06:20:54 PM »
Thanks for posting your simply elegant solution!