I ended up doing the changes :) https://github.com/qtile/qtile/pull/1852

Le ven. 31 juil. 2020 à 17:09, Guillaume Gelin <cont...@ramnes.eu> a écrit :

> Of course it does block, sorry, I should have read more carefully rather
> than copy pasting your commands. :)
>
> Well, you can use subprocess.Popen instead of subprocces.run, or write a
> function that uses Qtile's async loop (I guess), or work on a PR so that
> cmd_spawn actually uses a shell as the documentation suggests (maybe as an
> option with a keyworded argument?)
>
> Le ven. 31 juil. 2020 à 16:11, Vlad <vlad10072...@gmail.com> a écrit :
>
>> Well, this works, but not in way I wanted: it pause whole qtile for 5
>> seconds and then shutdown, I was planning to use this 5 seconds to cancel
>> shutdown if that was miss-click.
>>
>> пятница, 31 июля 2020 г., 16:46:22 UTC+3 пользователь Guillaume Gelin
>> написал:
>>>
>>> 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 <vlad10...@gmail.com> 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 <vlad10...@gmail.com> 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 <vlad10...@gmail.com> 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 qtil...@googlegroups.com.
>>>>>>>> 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 qtil...@googlegroups.com.
>>>>>> 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 qtil...@googlegroups.com.
>>>> 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 qtile-dev+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/qtile-dev/f1aa672a-f29a-47a6-8398-31df6865b0e8o%40googlegroups.com
>> <https://groups.google.com/d/msgid/qtile-dev/f1aa672a-f29a-47a6-8398-31df6865b0e8o%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Guillaume Gelin
>


-- 
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 qtile-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qtile-dev/CAPn4x%2BoJapKj58Xs3hkbVt66pq%3DK9uUKEmHEjhq4NBO3N4Jk9Q%40mail.gmail.com.

Reply via email to