Request: mx-switchuser improvement

Post Reply
Message
Author
User avatar
oops
Posts: 1602
Joined: Tue Apr 10, 2018 5:07 pm

Request: mx-switchuser improvement

#1 Post by oops »

Request: mx-switchuser improvement
It would be interesting, when using the mx-switchuser tool to have for information the list of the actual users, and the related tty# (ex: Ctrl+Alt+F#)

Code: Select all

$ who
user5 tty7         2018-11-03 11:02 (:0)
user1  tty8         2018-11-03 11:47 (:1)
user3  tty9         2018-11-03 13:27 (:2)
...
Ctrl+Alt+F7 for user5, Ctrl+Alt+F8 for user1, etc
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19_x64 & antiX19_x32

User avatar
fehlix
Developer
Posts: 10303
Joined: Wed Apr 11, 2018 5:09 pm

Re: Request: mx-switchuser improvement

#2 Post by fehlix »

oops wrote: Sat Nov 03, 2018 12:59 pm Request: mx-switchuser improvement
It would be interesting, when using the mx-switchuser tool to have for information the list of the actual users, and the related tty# (ex: Ctrl+Alt+F#)

Code: Select all

$ who
user5 tty7         2018-11-03 11:02 (:0)
user1  tty8         2018-11-03 11:47 (:1)
user3  tty9         2018-11-03 13:27 (:2)
...
Ctrl+Alt+F7 for user5, Ctrl+Alt+F8 for user1, etc
Nice idea! And adding a click-to-change button to this to select from provided list of active VT-consoles
would make mouse-click-user easier to change to an active vt-console.
You could make it with providing password less command like

Code: Select all

sudo chvt 1
...
sudo chvt 7
sudo chvt 8
...
:puppy:
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

User avatar
oops
Posts: 1602
Joined: Tue Apr 10, 2018 5:07 pm

Re: Request: mx-switchuser improvement

#3 Post by oops »

fehlix wrote: Sat Nov 03, 2018 1:37 pm
oops wrote: Sat Nov 03, 2018 12:59 pm Request: mx-switchuser improvement
It would be interesting, when using the mx-switchuser tool to have for information the list of the actual users, and the related tty# (ex: Ctrl+Alt+F#)

Code: Select all

$ who
user5 tty7         2018-11-03 11:02 (:0)
user1  tty8         2018-11-03 11:47 (:1)
user3  tty9         2018-11-03 13:27 (:2)
...
Ctrl+Alt+F7 for user5, Ctrl+Alt+F8 for user1, etc
Nice idea! And adding a click-to-change button to this to select from provided list of active VT-consoles
would make mouse-click-user easier to change to an active vt-console.
You could make it with providing password less command like

Code: Select all

sudo chvt 1
...
sudo chvt 7
sudo chvt 8
...
:puppy:
Good idea too (a click-to-change button), will be better and faster .

PS: Right now, I have a workaround, just by adding: "$(who)" into the below script:

Code: Select all

#!/bin/bash

# /usr/local/bin/mx-switchuser


TEXTDOMAINDIR=/usr/share/locale
TEXTDOMAIN=mx-switchuser

if [ ! -e ~/.switchuser ] ; then
  CHECKBOX=$(yad --form --title=$"User Switching"  --text=$"This tool allows you to switch to a different user without closing down your current session.

To return to the original user, simply press Ctrl-Alt-F7. Go back again with Ctrl-Alt-F8.

$(who)

Do you want to switch to another user?" --field=$"Do not show this screen again":chk)
  if [ $? -eq 0 ] ; then
    if [ $CHECKBOX == "TRUE|" ] ; then
    
# screen always shown : touch ~/.switchuser_always_show_screen
		# touch ~/.switchuser
		touch ~/.switchuser_always_show_screen


    fi
  else
    exit 1
  fi
fi

dm-tool switch-to-greeter
exit 0
... Or an other way:

Code: Select all

#! /bin/bash

# /usr/local/bin/mx-switchuser
# https://forum.mxlinux.org/viewtopic.php?f=93&t=46815&p=465281#p465281

TEXTDOMAINDIR=/usr/share/locale
TEXTDOMAIN=mx-switchuser

action=$(yad --width 700 --entry --title "System Logout" \
    --image=gnome-shutdown \
    --button="ScreenLock:5" \
    --button="ScrL+Suspend:4" \
    --button="$(who):3" \
    --button="Switch User:2" \
    --button="gtk-ok:0" --button="gtk-close:1" \
    --text "Choose action: Switch to a different user without closing down your current session.Ctrl-Alt-F7/F8/F9" \
    --entry-text \
    "Ctrl-Alt-F7" "Ctrl-Alt-F8" "Ctrl-Alt-F9" "Ctrl-Alt-F10" "Ctrl-Alt-F11" "Ctrl-Alt-F12" "Logout..." )
ret=$?
 
[[ $ret -eq 1 ]] && exit 0

if [[ $ret -eq 2 ]]; then
#    gdmflexiserver --startnew &

# Pour MX17
# dm-tool switch-to-greeter &
dm-tool switch-to-greeter &
    exit 0
fi

if [[ $ret -eq 3 ]]; then
#    gdmflexiserver --startnew &
# Pour MX17
# ls &
/usr/local/bin/mx-switchuser &

    exit 0
fi

if [[ $ret -eq 4 ]]; then
# Pour MX17
#Screen_saver_lock_puis_suspend-veille
# xdg-screensaver lock && sleep 3s && dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true &
xdg-screensaver lock && sleep 3s && dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true &
    exit 0
fi


if [[ $ret -eq 5 ]]; then
# Pour MX17
#Screen_saver_lock_puis_suspend-veille
# xdg-screensaver lock && sleep 3s && dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true &
xdg-screensaver lock &
    exit 0
fi

case $action in
    Ctrl-Alt-F7*) cmd="sudo chvt 7" ;;
    Ctrl-Alt-F8*) cmd="sudo chvt 8" ;;
    Ctrl-Alt-F9*) cmd="sudo chvt 9" ;;
    Ctrl-Alt-F10*) cmd="sudo chvt 10" ;;
    Ctrl-Alt-F11*) cmd="sudo chvt 11" ;;
	Ctrl-Alt-F12*) cmd="sudo chvt 12" ;;   



#    Power-Off*) cmd="sudo /sbin/poweroff" ;;
#    Reboot*) cmd="sudo /sbin/reboot" ;;
#    Suspend*) cmd="sudo /bin/sh -c 'echo disk > /sys/power/state'" ;;
    
#    Power-Off*) cmd="/bin/systemctl poweroff" ;;
#    Reboot*) cmd="/bin/systemctl reboot" ;;
#    Suspend*) cmd="/bin/systemctl suspend" ;;   
    
    # Alternative dbus
#    Power-Off-dbus*) cmd="dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.PowerOff" boolean:true" ;;
#    Reboot-dbus*) cmd="dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Reboot" boolean:true" ;;
#    Suspend-dbus*) cmd="dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true" ;;
          
           
    
#    Logout-now*) cmd="xfce4-session-logout -l" ;;  
    
    Logout...*) 
    case $(wmctrl -m | grep Name) in 
        *Xfwm4) cmd="xfce4-session-logout" ;;    
        *Openbox) cmd="openbox --exit" ;;
        *FVWM) cmd="FvwmCommand Quit" ;;
        *Metacity) cmd="gnome-save-session --kill" ;; 
        *) exit 1 ;;
    esac
    ;;
    *) exit 1 ;;    
esac

eval exec $cmd

exit 0

You do not have the required permissions to view the files attached to this post.
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19_x64 & antiX19_x32

Post Reply

Return to “XFCE Desktop Environment”