FYI the widget I've made has an option to let you choose to display 0 or
not.

On Fri, 27 Nov 2020, 08:23 el Paraguayo, <[email protected]> wrote:

> I think you need to change these lines:
> qtile.widgets_map["window_count"].update(win_count)
>
> To
> qtile.widgets_map["window_count"].update(str(win_count))
>
> On Fri, 27 Nov 2020, 06:23 Joe Yabuki, <[email protected]> wrote:
>
>> I''m using the code, because i' m on the official archlinux qtile
>> version.
>>
>> Best Regards
>> Kais
>>
>> ------------------------------
>> *From:* [email protected] <[email protected]> on
>> behalf of el Paraguayo <[email protected]>
>> *Sent:* Friday, November 27, 2020 1:16:45 AM
>> *To:* [email protected] <[email protected]>
>> *Subject:* Re: [qtile-dev] Number of opened windows?
>>
>> Are you using the widget or the code I pasted earlier?
>>
>> On Fri, 27 Nov 2020, 01:32 Joe Yabuki, <[email protected]> wrote:
>>
>> Hello again elparaguayo
>> Can you tell me please how to modify the code to display "0" when there's
>> no window ?
>>
>> On Thursday, November 26, 2020 at 7:05:00 p.m. UTC-5 Joe Yabuki wrote:
>>
>> Thank you Elparaguayo for your efforts, so the widget going to be
>> available in the next Qtile release?
>>
>> On Thursday, November 26, 2020 at 4:50:15 p.m. UTC-5 elParaguayo wrote:
>>
>> I've made the widget and made a pull request:
>> https://github.com/qtile/qtile/pull/1979
>>
>> On Thursday, 26 November 2020 at 09:28:49 UTC [email protected] wrote:
>>
>> It would be greatly appreciated!!
>>
>> Best Regards
>> Kais
>>
>> ------------------------------
>> *From:* [email protected] <[email protected]> on behalf of
>> elParaguayo <[email protected]>
>> *Sent:* Thursday, November 26, 2020 4:21:05 AM
>>
>> *To:* qtile-dev <[email protected]>
>> *Subject:* Re: [qtile-dev] Number of opened windows?
>> I can make this into a widget so you don't need to add all the extra
>> stuff to your config file.
>>
>> On Wednesday, 25 November 2020 at 21:30:35 UTC [email protected] wrote:
>>
>> This widget is very useful even in Max layout! I think this must be
>> integrated to qtile!
>> Thanks again elParguayo!
>>
>> On Wednesday, November 25, 2020 at 2:54:48 p.m. UTC-5 Joe Yabuki wrote:
>>
>> It's working great elPraguayo ! You're very good in python man!! Thank
>> you for your help!!!
>>
>> On Wednesday, November 25, 2020 at 8:43:54 a.m. UTC-5 elParaguayo wrote:
>>
>> One other point: my code above assumes you're already importing 'hook'
>> i.e.
>>
>> from libqtile import hook
>>
>> On Wed, 25 Nov 2020, 13:30 elParaguayo, <[email protected]> wrote:
>>
>> OK. Got it working.
>>
>> Put this in your config file:
>>
>> from libqtile import qtile
>>
>> @hook.subscribe.startup_complete
>> def create_win_count_hooks():
>>     hook.subscribe.client_killed(wincount_kill)
>>     hook.subscribe.client_managed(wincount)
>>     hook.subscribe.current_screen_change(wincount)
>>     hook.subscribe.setgroup(wincount)
>>     wincount()
>>
>> def wincount(*args):
>>     try:
>>         win_count = len(qtile.current_group.windows)
>>     except AttributeError:
>>         win_count = 0
>>     qtile.widgets_map["window_count"].update(win_count)
>>
>> def wincount_kill(window):
>>     try:
>>         win_count = len(qtile.current_group.windows)
>>     except AttributeError:
>>         win_count = 0
>>
>>     if win_count and getattr(window, "group", None):
>>         win_count -= 1
>>
>>     qtile.widgets_map["window_count"].update(win_count)
>>
>>
>> Then create a TextBox widget in your bar:
>> widget.TextBox(name="window_count", text="")
>>
>>
>> On Wednesday, 25 November 2020 at 07:26:17 UTC elParaguayo wrote:
>>
>> Well, it's almost working but there does seem to be a slight bug which
>> doesn't make sense to me. I'll post a question on the GitHub issues page to
>> see if it can be fixed. I'll also keep checking to see if I'm missing
>> something.
>>
>> On Wed, 25 Nov 2020, 06:29 Joe Yabuki, <[email protected]> wrote:
>>
>> I really appreciate your help ElParaguayo!!!
>>
>> Best Regards
>> Kais
>>
>> ------------------------------
>> *From:* [email protected] <[email protected]> on behalf of
>> elParaguayo <[email protected]>
>> *Sent:* Wednesday, November 25, 2020 1:11:22 AM
>> *To:* qtile-dev <[email protected]>
>> *Subject:* Re: [qtile-dev] Number of opened windows?
>>
>> I would think this is possible without a new widget.
>>
>> My approach would be:
>>
>>    1. find the code that lists windows in current group
>>    2. count the windows
>>    3. send text to a basic TextLayout widget
>>    4. add hooks to update text when windows opened or closed
>>
>> 2, 3 and 4 are easy enough. Just looking at #1 now...
>>
>> On Tuesday, 24 November 2020 at 23:51:04 UTC [email protected] wrote:
>>
>> Thank you for the reply Justine, but I'm looking for a widget to do that!
>>
>> On Tuesday, November 24, 2020 at 5:40:18 p.m. UTC-5 Justine Smithies
>> wrote:
>>
>> I just use the TaskList widget but you could easily make a new widget
>> that just displays the number of open windows.
>>
>> On Tue, 24 Nov 2020, 21:31 Joe Yabuki, <[email protected]> wrote:
>>
>> Hello guys
>> I'm wondering how can there any way to display the number of opened
>> window on the bar. I use the stack layout quite a lot and sometimes I open
>> more than 2 windows and I need to know if the total number of the opened
>> windows!
>>
>> Thank you in advance
>>
>> --
>> 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/6c923fd5-691d-4f01-8f59-92559d501835n%40googlegroups.com
>> <https://groups.google.com/d/msgid/qtile-dev/6c923fd5-691d-4f01-8f59-92559d501835n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "qtile-dev" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/qtile-dev/froEabtHAb4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/qtile-dev/a2a2f123-abe4-484d-8a3b-3d2abaee68a0n%40googlegroups.com
>> <https://groups.google.com/d/msgid/qtile-dev/a2a2f123-abe4-484d-8a3b-3d2abaee68a0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> 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/DM6PR06MB54180767F21AABE76808BA7AAEFA0%40DM6PR06MB5418.namprd06.prod.outlook.com
>> <https://groups.google.com/d/msgid/qtile-dev/DM6PR06MB54180767F21AABE76808BA7AAEFA0%40DM6PR06MB5418.namprd06.prod.outlook.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> 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/af469742-64df-4067-b820-3b651c2a031fn%40googlegroups.com
>> <https://groups.google.com/d/msgid/qtile-dev/af469742-64df-4067-b820-3b651c2a031fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "qtile-dev" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/qtile-dev/froEabtHAb4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/qtile-dev/c60fe9de-aeff-48b4-82e8-58ec5d52d6cen%40googlegroups.com
>> <https://groups.google.com/d/msgid/qtile-dev/c60fe9de-aeff-48b4-82e8-58ec5d52d6cen%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> 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/e6a63bfd-9d1b-41c7-8f74-ce166280287bn%40googlegroups.com
>> <https://groups.google.com/d/msgid/qtile-dev/e6a63bfd-9d1b-41c7-8f74-ce166280287bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "qtile-dev" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/qtile-dev/froEabtHAb4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/qtile-dev/CADPQLhCkXUBwD4FTmcVN_ak-PcX5KCL9XEO9tmrR6aOejYbM4w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/qtile-dev/CADPQLhCkXUBwD4FTmcVN_ak-PcX5KCL9XEO9tmrR6aOejYbM4w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
>> 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/DM6PR06MB5418AADE7621E53A9B1669B6AEF80%40DM6PR06MB5418.namprd06.prod.outlook.com
>> <https://groups.google.com/d/msgid/qtile-dev/DM6PR06MB5418AADE7621E53A9B1669B6AEF80%40DM6PR06MB5418.namprd06.prod.outlook.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/CADPQLhC%3DoBb%2Bo_pPuuMUXNe-5OVsSViuxJZ44Q6tY%3Dry_riVww%40mail.gmail.com.

Reply via email to