geommer / yabar

A modern and lightweight status bar for X window managers.
MIT License
679 stars 49 forks source link

yabar_workspace: Only updates if some program is open on previous workspace #147

Closed Narrat closed 7 years ago

Narrat commented 7 years ago

Kinda weird to describe. Example 1: Five workspaces and on the first two of them are open programs. the yb_ws block will change from 1 to 3 if I'm cycling through the workspaces. For the rest it stays with the name of the third workspace.

Example 2: Five workspaces, staying on Two with an open program, hop to Workspace Four (no program there), yb_ws updates to the name of workspace four. Hopping from four to five or three (no programs open there too) and the name displayed is from workspace four. Hopping to a workspace with an open program there will also result in the correct name displayed.

Opening a program on those empty workspaces will update the yb_ws to the correct name.

bla4 Instead of an epsilon there is delta displayed

Edit:

Correct display: bla5

Probably a video would be more fitting.. hm

NBonaparte commented 7 years ago

What WM are you using?

Narrat commented 7 years ago

Ah, I knew I forgot something. This is openbox

Edit: As a sidenote, since the wiki can only by edited by collaborators. The URL at the bottom of https://github.com/geommer/yabar/wiki has a small typo (geommert instead of geommer)

NBonaparte commented 7 years ago

Thanks, fixed.

What is the output of xprop -root | grep _NET? (Run it right after switching workspaces as per your examples.) I have a hunch that openbox might do something funky with the EWMH properties.

Edit: you may want to do some delay, like sleep 1 && xprop -root, so you don't have to open a new terminal. Run it on a terminal in a workspace that is already occupied, then switch to the empty workspace and get the output.

Narrat commented 7 years ago

Switched that way, that on the third workspace the wrong name was displayed (the one from the fourth) Results from two different programs, as openbox also provides a tool for querying xproperties

$ sleep 3 && obxprop --root | grep _NET
_NET_ACTIVE_WINDOW(WINDOW) = 0
_NET_CLIENT_LIST(WINDOW) = 6291459, 20971523, 25165827, 27262979, 23068673
_NET_SHOWING_DESKTOP(CARDINAL) = 0
_NET_CURRENT_DESKTOP(CARDINAL) = 2
_NET_DESKTOP_NAMES(UTF8_STRING) = "Alpha", "Beta", "Gamma", "Delta", "Epsilon"
_NET_WORKAREA(CARDINAL) = 0, 30, 1680, 1020, 0, 30, 1680, 1020, 0, 30, 1680, 1020, 0, 30, 1680, 1020, 0, 30, 1680, 1020
_NET_DESKTOP_VIEWPORT(CARDINAL) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
_NET_NUMBER_OF_DESKTOPS(CARDINAL) = 5
_NET_DESKTOP_GEOMETRY(CARDINAL) = 1680, 1050
_NET_CLIENT_LIST_STACKING(WINDOW) = 6291459, 25165827, 20971523, 27262979, 23068673
_NET_SUPPORTED(ATOM) = _NET_SUPPORTING_WM_CHECK, _NET_WM_FULL_PLACEMENT, _NET_CURRENT_DESKTOP, _NET_NUMBER_OF_DESKTOPS, _NET_DESKTOP_GEOMETRY, _NET_DESKTOP_VIEWPORT, _NET_ACTIVE_WINDOW, _NET_WORKAREA, _NET_CLIENT_LIST, _NET_CLIENT_LIST_STACKING, _NET_DESKTOP_NAMES, _NET_CLOSE_WINDOW, _NET_DESKTOP_LAYOUT, _NET_SHOWING_DESKTOP, _NET_WM_NAME, _NET_WM_VISIBLE_NAME, _NET_WM_ICON_NAME, _NET_WM_VISIBLE_ICON_NAME, _NET_WM_DESKTOP, _NET_WM_STRUT, _NET_WM_STRUT_PARTIAL, _NET_WM_ICON, _NET_WM_ICON_GEOMETRY, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DESKTOP, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_TOOLBAR, _NET_WM_WINDOW_TYPE_MENU, _NET_WM_WINDOW_TYPE_UTILITY, _NET_WM_WINDOW_TYPE_SPLASH, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_NORMAL, _NET_WM_ALLOWED_ACTIONS, _NET_WM_WINDOW_OPACITY, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_STATE, _NET_WM_STATE_MODAL, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_SHADED, _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_SKIP_PAGER, _NET_WM_STATE_HIDDEN, _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE_ABOVE, _NET_WM_STATE_BELOW, _NET_WM_STATE_DEMANDS_ATTENTION, _NET_MOVERESIZE_WINDOW, _NET_WM_MOVERESIZE, _NET_WM_USER_TIME, _NET_FRAME_EXTENTS, _NET_REQUEST_FRAME_EXTENTS, _NET_RESTACK_WINDOW, _NET_STARTUP_ID, _NET_WM_SYNC_REQUEST, _NET_WM_SYNC_REQUEST_COUNTER, _NET_WM_PID, _NET_WM_PING, _KDE_WM_CHANGE_STATE, _KDE_NET_WM_FRAME_STRUT, _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _OB_WM_ACTION_UNDECORATE, _OB_WM_STATE_UNDECORATED, _OPENBOX_PID, _OB_THEME, _OB_CONFIG_FILE, _OB_CONTROL, _OB_VERSION, _OB_APP_ROLE, _OB_APP_TITLE, _OB_APP_NAME, _OB_APP_CLASS, _OB_APP_GROUP_NAME, _OB_APP_GROUP_CLASS, _OB_APP_TYPE
_NET_SUPPORTING_WM_CHECK(WINDOW) = 4194827

$ sleep 3 && xprop -root | grep _NET  
_NET_ACTIVE_WINDOW(WINDOW): window id # 0x0
_NET_CLIENT_LIST(WINDOW): window id # 0x600003, 0x1400003, 0x1800003, 0x1a00003, 0x1600001, 0x800003
_NET_SHOWING_DESKTOP(CARDINAL) = 0
_NET_CURRENT_DESKTOP(CARDINAL) = 2
_NET_DESKTOP_NAMES(UTF8_STRING) = "Alpha", "Beta", "Gamma", "Delta", "Epsilon"
_NET_WORKAREA(CARDINAL) = 0, 30, 1680, 1020, 0, 30, 1680, 1020, 0, 30, 1680, 1020, 0, 30, 1680, 1020, 0, 30, 1680, 1020
_NET_DESKTOP_VIEWPORT(CARDINAL) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
_NET_NUMBER_OF_DESKTOPS(CARDINAL) = 5
_NET_DESKTOP_GEOMETRY(CARDINAL) = 1680, 1050
_NET_CLIENT_LIST_STACKING(WINDOW): window id # 0x1800003, 0x1400003, 0x1a00003, 0x800003, 0x600003, 0x1600001
_NET_SUPPORTED(ATOM) = _NET_SUPPORTING_WM_CHECK, _NET_WM_FULL_PLACEMENT, _NET_CURRENT_DESKTOP, _NET_NUMBER_OF_DESKTOPS, _NET_DESKTOP_GEOMETRY, _NET_DESKTOP_VIEWPORT, _NET_ACTIVE_WINDOW, _NET_WORKAREA, _NET_CLIENT_LIST, _NET_CLIENT_LIST_STACKING, _NET_DESKTOP_NAMES, _NET_CLOSE_WINDOW, _NET_DESKTOP_LAYOUT, _NET_SHOWING_DESKTOP, _NET_WM_NAME, _NET_WM_VISIBLE_NAME, _NET_WM_ICON_NAME, _NET_WM_VISIBLE_ICON_NAME, _NET_WM_DESKTOP, _NET_WM_STRUT, _NET_WM_STRUT_PARTIAL, _NET_WM_ICON, _NET_WM_ICON_GEOMETRY, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DESKTOP, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_TOOLBAR, _NET_WM_WINDOW_TYPE_MENU, _NET_WM_WINDOW_TYPE_UTILITY, _NET_WM_WINDOW_TYPE_SPLASH, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_NORMAL, _NET_WM_ALLOWED_ACTIONS, _NET_WM_WINDOW_OPACITY, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_STATE, _NET_WM_STATE_MODAL, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_SHADED, _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_SKIP_PAGER, _NET_WM_STATE_HIDDEN, _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE_ABOVE, _NET_WM_STATE_BELOW, _NET_WM_STATE_DEMANDS_ATTENTION, _NET_MOVERESIZE_WINDOW, _NET_WM_MOVERESIZE, _NET_WM_USER_TIME, _NET_FRAME_EXTENTS, _NET_REQUEST_FRAME_EXTENTS, _NET_RESTACK_WINDOW, _NET_STARTUP_ID, _NET_WM_SYNC_REQUEST, _NET_WM_SYNC_REQUEST_COUNTER, _NET_WM_PID, _NET_WM_PING, _KDE_WM_CHANGE_STATE, _KDE_NET_WM_FRAME_STRUT, _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _OB_WM_ACTION_UNDECORATE, _OB_WM_STATE_UNDECORATED, _OPENBOX_PID, _OB_THEME, _OB_CONFIG_FILE, _OB_CONTROL, _OB_VERSION, _OB_APP_ROLE, _OB_APP_TITLE, _OB_APP_NAME, _OB_APP_CLASS, _OB_APP_GROUP_NAME, _OB_APP_GROUP_CLASS, _OB_APP_TYPE
_NET_SUPPORTING_WM_CHECK(WINDOW): window id # 0x40020b

At least _NET_CURRENT_DESKTOP has the right value

NBonaparte commented 7 years ago

Does 8d0fef3 fix this? Since _NET_CURRENT_DESKTOP changes properly, the block should theoretically update as well.

Also (even if the fix works) could you try doing xprop -root -spy (or the obxprop equivalent) and see if _NET_ACTIVE_WINDOW changes normally? Without the fix, the handler just checks for _NET_ACTIVE_WINDOW, and if it doesn't change, then the block doesn't update, which might be the source of the issue.

Narrat commented 7 years ago

Unfortunately it doesn't change the behaviour even with 8d0fef3.

And regarding _NET_ACTIVE_WINDOW behaviour. If there is an ID (one of those listed in _NET_CLIENT_LIST) on a workspace, the fitting ID is shown there. And if changes are tracked, well, that would explain the behaviour. Switching to an empty workspace produces a change, as it switches from $ID to 0. On further switches to empty workspaces there is no change as it stays at 0.

NBonaparte commented 7 years ago

Sorry, it looks like I forgot to get the current workspace in the previous commit. Does a1bd267 work for you?

Narrat commented 7 years ago

Yes, with a1bd267 applied it is working. Thanks

Closing this issue, as it is resolved

KmBKeef commented 6 years ago

Hmm still.. it doesn't update unless the previous workspace got something here is the relevant part of my yabar.conf

 workspaces: {

      exec: "YABAR_WORKSPACE";
      internal-option1: "   4 5 6 7 8 9 " // firefox, terminal, fighter-jet, [4-9], music.

      align: "left";
      justify: "center";
      type: "persist";
      fixed-size: 40;

      background-color-rgb: 0x303030;
      underline-color-rgb:  0x242424;   }
KmBKeef commented 6 years ago

screenshot from 2017-07-20 16-38-48 screenshot from 2017-07-20 16-39-01

Narrat commented 6 years ago

What does

yabar -v

print and what window manager do you use? To me it kinda looks like i3 and the reported issue was more or less specific to openbox

KmBKeef commented 6 years ago

yabar's version is: yabar v0.4.0-146-g9779a5e

And I am using i3-gaps

===============================(I'll be back after 7-9 hours)=============================

Narrat commented 6 years ago

Maybe you could take a look at the xprop values, like previously mentioned ( https://github.com/geommer/yabar/issues/147#issuecomment-293108367 ). As far as I know i3 had some issues with some EWMH values (like https://github.com/i3/i3/issues/938 )

Are those workspaces existing? Years ago when I tried i3 workspaces were created on the fly and removed without an open program (like while you're moving through the workspaces, the empty second one gets created, but removed when you move to the next. yabar checks and propably gets the info on two existing workspaces and what you want as third is reported back as the second one)

KmBKeef commented 6 years ago

You are right, they get removed when you leave them empty..but surely there is a way for yabar to figure out what workspace am i on. since i travel between them using i3's shortcut ($mod 1, $mod 2, $mod 3...)

$ sleep 3 && xprop -root | grep _NET
_NET_DESKTOP_VIEWPORT(CARDINAL) = 0, 0, 0, 0, 0, 0
_NET_DESKTOP_NAMES(UTF8_STRING) = "1 # \"Firefox\"", "3 # \"WarThunder\"", "4"
_NET_NUMBER_OF_DESKTOPS(CARDINAL) = 3
_NET_CURRENT_DESKTOP(CARDINAL) = 2
_NET_ACTIVE_WINDOW(WINDOW): window id # 0x0
_NET_CLIENT_LIST(WINDOW): window id # 0xa00007, 0x1400010, 0x140003d, 0xa001ba
_NET_CLIENT_LIST_STACKING(WINDOW): window id # 0xa00007, 0x1400010, 0x140003d, 0xa001ba
_NET_SUPPORTED(ATOM) = _NET_SUPPORTED, _NET_SUPPORTING_WM_CHECK, _NET_WM_NAME, _NET_WM_VISIBLE_NAME, _NET_WM_MOVERESIZE, _NET_WM_STATE_STICKY, _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE_DEMANDS_ATTENTION, _NET_WM_STATE_MODAL, _NET_WM_STATE_HIDDEN, _NET_WM_STATE, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_NORMAL, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_UTILITY, _NET_WM_WINDOW_TYPE_TOOLBAR, _NET_WM_WINDOW_TYPE_SPLASH, _NET_WM_WINDOW_TYPE_MENU, _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, _NET_WM_WINDOW_TYPE_POPUP_MENU, _NET_WM_WINDOW_TYPE_TOOLTIP, _NET_WM_WINDOW_TYPE_NOTIFICATION, _NET_WM_DESKTOP, _NET_WM_STRUT_PARTIAL, _NET_CLIENT_LIST, _NET_CLIENT_LIST_STACKING, _NET_CURRENT_DESKTOP, _NET_NUMBER_OF_DESKTOPS, _NET_DESKTOP_NAMES, _NET_DESKTOP_VIEWPORT, _NET_ACTIVE_WINDOW, _NET_CLOSE_WINDOW
_NET_WM_NAME(UTF8_STRING) = "i3"
_NET_SUPPORTING_WM_CHECK(WINDOW): window id # 0x200063

When I'm back home ill try to make static workspaces and ill see what happens

Narrat commented 6 years ago

Well, at least you could propably write your own script and add a custom block to the config which replaces the internal workspace one . For further discussion I would suggest to open a new issue, as this was a specific and solved problem. And you want a feature included, which is currently not covered by yabar.

But maybe the whole issue is solved by static workspaces if that is possible?

KmBKeef commented 6 years ago

unfortunately it turned out that i3 devs hate static workspaces...

hmm alright thanks for your time and effort

im gonna use this i3-msg -t get_workspaces | jq '.[] | select(.focused==true).name' | cut -d"\"" -f2

not the best but it works