https://bugs.kde.org/show_bug.cgi?id=508660

--- Comment #4 from Mik <[email protected]> ---
as per my reply in reddit......

I dont seem to be able to edit my original post so just to add a little more
info.

I added another user, no initial difference to issue. Only I as a user show up
in the locker screen.

It is kscreenlocker_greet that is the screen locker program.

If I logout and login, and then lock, switch user now works but only current
user shows up, but at least it doesn't hang the whole computer now if I
accidentally click on switch users, and I can login again.

Updated script to wait 15secs, logout, and with autologin enabled, it
automatically loges in agan as me, and then locks the screen after another
15seconds.

I dont seem to be able to edit my original post so just to add a little more
info.

I added another user, no initial difference to issue. Only I as a user show up
in the locker screen.

It is kscreenlocker_greet that is the screen locker program.

If I logout and login, and then lock, switch user now works but only current
user shows up, but at least it doesn't hang the whole computer now if I
accidentally click on switch users, and I can login again.

Updated script to wait 15secs, logout, and with autologin enabled, it
automatically loges in agan as me, and then locks the screen after another
15seconds.

#!/usr/bin/python
import tkinter as tk
from tkinter import filedialog, messagebox
from pathlib import Path
import threading
import time
import os

# Start countdown
def start_countdown():
    try:
        minutes = 0
        seconds = 14
        total_seconds = minutes * 60 + seconds
        if total_seconds <= 0:
            messagebox.showerror("Error", "Please enter a positive time.")
            return
    except ValueError:
        messagebox.showerror("Error", "Please enter valid numbers.")
        return
    threading.Thread(target=run_countdown, args=(total_seconds,),
daemon=True).start()

# Run countdown in background
def run_countdown(total_seconds):
    while total_seconds > 0:
        total_seconds -= 1
        mins = total_seconds // 60
        secs = total_seconds % 60
        countdown_label.config(text=f"{mins:02d}:{secs:02d}")
        time.sleep(1)
    if not a.exists():
        with open('/tmp/flag_file', 'w') as f:
            pass
        root.quit()
        os.system("qdbus org.kde.Shutdown /Shutdown logout")
        root.destroy()
    else:
        os.remove(a)
        root.quit()
        os.system("qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock")
        root.destroy()


# GUI setup
a = Path("/tmp/flag_file")
root = tk.Tk()
root.title("Python Countdown Timer")
root.geometry("650x130")
root.resizable(False, False)
root.attributes("-topmost", True)
title_label = tk.Label(root, text="Close this box to stop AutoScreenLock",
font=("Arial", 24))
title_label.pack(pady=10)
countdown_label = tk.Label(root, text="00:00", font=("Arial", 24))
countdown_label.pack(pady=10)
start_countdown()

# Check if the file exists

root.mainloop()

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to