dangvd / ksmoothdock

A cool desktop panel for KDE Plasma 5
56 stars 7 forks source link

Feature Request: Ability to add Screen Lock to the dock #68

Closed ibigpapa closed 6 years ago

ibigpapa commented 6 years ago

In Use an internal command or use a D-Bus command Screen Lock isn't available. In the Application dock item it's available under session. I would like to have as an icon on dock.

dangvd commented 6 years ago

You can just drag-and-drop the item in the Applications menu to the Edit Launchers dialog, or just edit the command manually with the Lock Screen command. The Use a D-Bus command drop-down is for convenience, any D-Bus command you type in would work.

Also, the reason I haven't added the Screen Lock to the drop down because of some minor look-and-feel issue.

ibigpapa commented 6 years ago

I will try to do it again but last time i thought i dragged and dropped from that application menu it didn't take. I'll let you know how that works. I'll do the D-Bus trick if it doesn't work. Thanks

dangvd commented 6 years ago

Ah sorry:

At the moment I'm not sure how to solve this.

ibigpapa commented 6 years ago

I did it a round about way.

created a script to lock the screen using loginctl

#!/usr/bin/python3.6

import subprocess

info_task = subprocess.run(['loginctl', 'show-user', 'my_user'], stdout=subprocess.PIPE)

output = info_task.stdout.decode('utf-8')

sessions = [line for line in output.splitlines() if 'Sessions=' in line][0]

session_ids = sessions.replace('Sessions=','').split()

the_int = 1
for session_id in session_ids:
    try:
        the_int = int(session_id)
        continue
    except ValueError:
        pass

subprocess.run(['loginctl', 'lock-session', str(the_int)])
dangvd commented 6 years ago

Hi ibigpapa, This has been fixed and released in v5.8 Hope you like it.