Would you like to react to this message? Create an account in a few clicks or log in to continue.

2 posters
  • Post new topic
  • Reply to topic

IceWM ja JWM shudown dialogs (SOLVED)

nobody
nobody


Posts : 48
Join date : 2024-05-12
Location : Finland

IceWM ja JWM shudown dialogs (SOLVED) Empty IceWM ja JWM shudown dialogs (SOLVED)

Post by nobody 13th June 2024, 11:27 pm

In PCLOS Debian shutdown and reboot dialogs does not work. Log out  works using the next script.

Code:
#!/bin/bash
session=`loginctl session-status | head -n 1 | awk '{print $1}'`
loginctl terminate-session $session

Any ideas for shudown and reboot for JWM and IceWM desktops?


Last edited by nobody on 15th June 2024, 10:35 pm; edited 1 time in total
Upgreyed
Upgreyed
Admin


Posts : 129
Join date : 2024-05-12
Location : The Sunshine State FL USA

IceWM ja JWM shudown dialogs (SOLVED) Empty Re: IceWM ja JWM shudown dialogs (SOLVED)

Post by Upgreyed 14th June 2024, 12:28 am

nobody wrote:In PCLOS Debian shutdown and reboot dialogs does not work. Log out  works using the next script.

Code:
#!/bin/bash
session=`loginctl session-status | head -n 1 | awk '{print $1}'`
loginctl terminate-session $session

Any ideas for shudown and reboot for JWM and IceWM desktops?
https://ice-wm.org/man/icewm-shutdown
nobody
nobody


Posts : 48
Join date : 2024-05-12
Location : Finland

IceWM ja JWM shudown dialogs (SOLVED) Empty Re: IceWM ja JWM shudown dialogs (SOLVED)

Post by nobody 14th June 2024, 10:19 pm

Those instructions does not work in PCLOS Debian. What are liightdm dialog commands?
Upgreyed
Upgreyed
Admin


Posts : 129
Join date : 2024-05-12
Location : The Sunshine State FL USA

IceWM ja JWM shudown dialogs (SOLVED) Empty Re: IceWM ja JWM shudown dialogs (SOLVED)

Post by Upgreyed 14th June 2024, 11:34 pm

nobody wrote:Those instructions does not work in PCLOS Debian. What are lightdm dialog commands?

Here's a yad script to shutdown, reboot. Try it?

Code:
#!/bin/bash

action=$(yad --width 300 --center --entry --title "System Logout" \
    --image=gnome-shutdown \
    --button="Switch User:2" \
    --button="gtk-ok:0" --button="gtk-close:1" \
    --text "Choose action:" \
    --entry-text \
    "Power Off" "Reboot" "Suspend" "Logout")
ret=$?

[[ $ret -eq 1 ]] && exit 0

if [[ $ret -eq 2 ]]; then
    gdmflexiserver --startnew &
    exit 0
fi

case $action in
    Power*) cmd="su -c /sbin/poweroff" ;;
    Reboot*) cmd="su -c /sbin/reboot" ;;
    Suspend*) cmd="su -c /bin/sh -c 'echo disk > /sys/power/state'" ;;
    Logout*)
    case $(wmctrl -m | grep Name) in
        *Openbox) cmd="openbox --exit" ;;
        *FVWM) cmd="FvwmCommand Quit" ;;
            *Metacity) cmd="gnome-save-session --kill" ;;
        *) exit 1 ;;
    esac
    ;;
    *) exit 1 ;;    
esac

eval exec $cmd
Upgreyed
Upgreyed
Admin


Posts : 129
Join date : 2024-05-12
Location : The Sunshine State FL USA

IceWM ja JWM shudown dialogs (SOLVED) Empty Re: IceWM ja JWM shudown dialogs (SOLVED)

Post by Upgreyed 15th June 2024, 10:02 am

Probably you could just rework the script to your liking for JWM and IceWM. I did a couple of changes for MATE to work here:

Code:
#!/bin/bash
ICON="/usr/share/icons/mate/48x48/places/start-here.png"
action=$(yad --width=375 --height=90 --fixed --center --entry --title="System Actions" \
    --image="$ICON" --window-icon="$ICON" \
    --button="gtk-close:1" --button="gtk-ok:0" \
    --text "Choose action:" --entry-text "Power Off" "Reboot" "Logout" "Suspend")
    ret=$?
[[ $ret -eq 1 ]] && exit 0
case $action in
Power*) cmd="/sbin/poweroff"
    yad --form --title="Authentication" --on-top --no-escape --center \
    --fixed --borders=10 --width="425" \
    --window-icon="$ICON" \
    --image="$ICON" \
    --image-on-top --text-align=center \
    --text="Authentication is needed to run as the superuser" \
    --button="Cancel!gtk-cancel:1" \
    --button="Ok!gtk-ok:0" \
    --field="Password::H" "$PASSWD" \
"$passwd" | while read line; do
PASSWD=`echo $line | awk -F'|' '{print $1}'`
if [[ ${?} != 0 || -z ${PASSWD} ]]
then
    exit 0
else
    echo -e $PASSWD | su -c "$cmd"  <<<${PASSWD}
fi
done
;;
Reboot*) cmd="/sbin/reboot"
    yad --form --title="Authentication" --on-top --no-escape --center \
    --fixed --borders=10 --width="425" \
    --window-icon="$ICON" \
    --image="$ICON" \
    --image-on-top --text-align=center \
    --text="Authentication is needed to run as the superuser" \
    --button="Cancel!gtk-cancel:1" \
    --button="Ok!gtk-ok:0" \
    --field="Password::H" "$PASSWD" \
"$passwd" | while read line; do
PASSWD=`echo $line | awk -F'|' '{print $1}'`
if [[ ${?} != 0 || -z ${PASSWD} ]]
then
    exit 0
else
    echo -e $PASSWD | su -c "$cmd"  <<<${PASSWD}
fi
done
;;
Logout*) cmd="mate-session-save --logout-dialog"
;;
Suspend*) cmd="/bin/sh -c 'echo disk > /sys/power/state'"
    yad --form --title="Authentication" --on-top --no-escape --center \
    --fixed --borders=10 --width="425" \
    --window-icon="$ICON" \
    --image="$ICON" \
    --image-on-top --text-align=center \
    --text="Authentication is needed to run as the superuser" \
    --button="Cancel!gtk-cancel:1" \
    --button="Ok!gtk-ok:0" \
    --field="Password::H" "$PASSWD" \
"$passwd" | while read line; do
PASSWD=`echo $line | awk -F'|' '{print $1}'`
if [[ ${?} != 0 || -z ${PASSWD} ]]
then
    exit 0
else
    echo -e $PASSWD | su -c "$cmd"  <<<${PASSWD}
fi
done
;;
*)
    case $(wmctrl -m | grep Name) in
        *Openbox) cmd="openbox --exit" ;;
        *FVWM) cmd="FvwmCommand Quit" ;;
            *Metacity) cmd="gnome-save-session --kill" ;;
        *) exit 1 ;;
    esac
    ;;
    *) exit 1 ;;    
esac
eval exec $cmd
nobody
nobody


Posts : 48
Join date : 2024-05-12
Location : Finland

IceWM ja JWM shudown dialogs (SOLVED) Empty Re: IceWM ja JWM shudown dialogs (SOLVED)

Post by nobody 15th June 2024, 10:37 pm

@Upgreyed Those ways are working, but they requires password when shutting down or reboot.
nobody
nobody


Posts : 48
Join date : 2024-05-12
Location : Finland

IceWM ja JWM shudown dialogs (SOLVED) Empty Re: IceWM ja JWM shudown dialogs (SOLVED)

Post by nobody 15th June 2024, 10:48 pm

The solution was to make a ~/.xinitrc file which contents is

Code:
exec dbus-launch --exit-with-session jwm

And the add to the JWM menu file (~/.jwm/menu) entries


Code:
  <Program label="Log Out" icon="/usr/share/icons/gnome/32x32/actions/system-log-out.png">~/.jwm/LogOut</Program>
    <Separator/>
    
      <Program label="Shutdown" icon="/usr/share/icons/gnome/32x32/actions/xfce-system-exit.png">loginctl poweroff</Program>
    <Separator/>
    
      <Program label="Reboot" icon="/usr/share/icons/gnome/24x24/actions/tab-new.png">loginctl reboot</Program>
    <Separator/>

And log out script is

Code:
#!/bin/bash
session=`loginctl session-status | head -n 1 | awk '{print $1}'`
loginctl terminate-session $session

Found from https://wiki.gentoo.org/wiki/Elogind
Upgreyed
Upgreyed
Admin


Posts : 129
Join date : 2024-05-12
Location : The Sunshine State FL USA

IceWM ja JWM shudown dialogs (SOLVED) Empty Re: IceWM ja JWM shudown dialogs (SOLVED)

Post by Upgreyed 16th June 2024, 12:16 am

nobody wrote:@Upgreyed Those ways are working, but they requires password when shutting down or reboot.

You can add a pkexec policy file in /usr/share/polkit-1/actions and it can be used without a password.
Just another way around to get the same effect.
Code:

<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>

Sponsored content


IceWM ja JWM shudown dialogs (SOLVED) Empty Re: IceWM ja JWM shudown dialogs (SOLVED)

Post by Sponsored content

  • Post new topic
  • Reply to topic

Current date/time is 28th September 2024, 8:03 pm