I was thinking of something along those lines:
mouse_callbacks = {'Button1': lambda _: subprocess.run('sleep 5 && shutdown
now', shell = True), 'Button3': lambda _: subprocess.run('pkill sleep',
shell = True)}
Le ven. 31 juil. 2020 à 15:30, Vlad <[email protected]> a écrit :
> I'm not sure if I understood you correctly. Here is all ways I tried:
> 1. Shutdown computer after restart config
>
>> mouse_callbacks = {'Button1': subprocess.run('sleep 5 && shutdown now',
>> shell = True), 'Button3': subprocess.run('pkill sleep', shell = True)}
>
>
> 2. Do nothing
>
>> mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn("sleep 5 &&
>> shutdown now"), 'Button3': lambda qtile: qtile.cmd_spawn("pkill sleep")}
>
> But
>
>> mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn("sleep 50"),
>> 'Button3': lambda qtile: qtile.cmd_spawn("pkill sleep")}
>>
> working, I can see sleep process in htop
>
> 3. Do nothing
>
>> mouse_callbacks = {'Button1': lazy.spawn('sleep 50'), 'Button3':
>> lazy.spawn("pkill sleep")}
>>
>
> пятница, 31 июля 2020 г., 15:54:13 UTC+3 пользователь Guillaume Gelin
> написал:
>>
>> With the lambda?
>>
>> Le ven. 31 juil. 2020 à 14:39, Vlad <[email protected]> a écrit :
>>
>>> Already did, but it works too good. After restart config it immediately
>>> shutdown the computer.
>>>
>>> пятница, 31 июля 2020 г., 15:05:10 UTC+3 пользователь Guillaume Gelin
>>> написал:
>>>>
>>>> Can't you just use subprocess.run(..., shell=True) rather than
>>>> qtile.cmd_spawn?
>>>>
>>>> Le ven. 31 juil. 2020 à 13:51, Vlad <[email protected]> a écrit :
>>>>
>>>>> I want to make shutdown button with 5 seconds delay and canceling.
>>>>>
>>>>> mouse_callbacks = {'Button1': lambda qtile: qtile.cmd_spawn("sleep 5
>>>>>> && shutdown now"), 'Button3': lambda qtile: qtile.cmd_spawn("pkill
>>>>>> sleep")}
>>>>>
>>>>>
>>>>> This code is not working, it seems that cmd_spawn can't run two
>>>>> commands because qtile.cmd_spawn("sleep 5") works well.
>>>>> Any suggestions how can I realize this?
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "qtile-dev" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/qtile-dev/18af6362-414b-4771-8ab9-4f80bbc5896do%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/qtile-dev/18af6362-414b-4771-8ab9-4f80bbc5896do%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>>>>
>>>> --
>>>> Guillaume Gelin
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "qtile-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/qtile-dev/aa1671c5-b84d-42b6-a231-609bded3ff4fo%40googlegroups.com
>>> <https://groups.google.com/d/msgid/qtile-dev/aa1671c5-b84d-42b6-a231-609bded3ff4fo%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> Guillaume Gelin
>>
> --
> You received this message because you are subscribed to the Google Groups
> "qtile-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/qtile-dev/20aa0182-78ef-46f3-a778-662fe147baabo%40googlegroups.com
> <https://groups.google.com/d/msgid/qtile-dev/20aa0182-78ef-46f3-a778-662fe147baabo%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
Guillaume Gelin
--
You received this message because you are subscribed to the Google Groups
"qtile-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/qtile-dev/CAPn4x%2Bo%3D4z9P_0t47bPcjQJ-%3DfzmYd7%2BEZHGbv%3D3jKSMYe7ZOQ%40mail.gmail.com.