Now that the focus_magic function is responsible for updating the
status-bar when there are no windows, remove superfluous checks from a
couple of places that were previously needed.
Fixed a typo in a comment while there.
Make the focus_magic function responsible for updating the status-bar
output when there is no window available. Now, any window related output
gets cleared when iconifying the last available window.
Instead of checking if any of the window related enabled options are set
and updating the status-bar over and over again, delegate that job to a
small wrapper function.
Instead of hand rolling a dynamic array, just use a tail queue by taking
advantage of the queue(3) macros.
Simplifies the code, since there's no need to (re)allocate the array and
to keep track of its size and length.
ok marco
If requesting the window name with _NET_WM_NAME fails, fallback to
requesting it with WM_NAME. While here, make the property request
through the get_property wrapper function.
Makes scrotwm show the titles for xterm (and probably others) windows.
While focusing on a window, update the status-bar if any of the window
related enabled options is set, so that its output matches reality.
Easily reproducible by firing up scrotwm and opening a new window.
ok marco
Rather than using fprintf(3) to display a formatted error message on
stderr (and, occasionally in conjunction with strerror(3)), use the
warn(3) functions. A few cases that also used perror(3) were changed
accordingly, as well.
While there, remove an extra fprintf(3) call in conf_load which is
already followed by an err(3).
ok marco
SUS says that if there wasn't enough space to copy the expanded format
to the buffer, strftime(3) will not NUL terminate it. It would work on
some implementations (eg on OpenBSD), though.
Therefore, take advantage of the return value to prevent using the
character array with unspecified contents with a very large clock
format.
Besides, the strlcat(3) call below relies on the destination buffer
being NUL terminated.
ok marco
Instead of hand rolling a dynamic array, just use a tail queue by taking
advantage of the queue(3) macros.
Simplifies the code, since there's no need to (re)allocate the array and
to keep track of its size and length.
Instead of hand rolling a dynamic array, just use a tail queue by taking
advantage of the queue(3) macros.
Simplifies the code, since there's no need to (re)allocate the array and
to keep track of its size and length.
This gives applications a chance to redraw the window contents to the actual, unchanged, window geometry.
Fixes issues with gvim, emacs, firefox, feh and many other applications.
ok marco
- Improve debug output.
- Improve code styling compliance.
- Use the X,Y,WIDTH,HEIGHT macros where applicable on ws_win and swm_region objects.
- Fix handling of _NET_MOVERESIZE_WINDOW client message.
ok marco
Now that asprintf(3) return value is checked in conf_load(), make the
code release the memory returned by fparseln(3) and fclose(3) the
configuration file FILE pointer.
Style nit fixed while there.
ok marco
Floating windows are constrained to region on move/resize operations.
Resize center is now based on window center, instead of region center.
Fix several uninitialized/unused variable warnings.
Handle asprintf return value in conf_load.
mvws_n invokes send_to_ws(), which in turn calls focus() to focus on
the previous window before sending the current window to the desired
workspace. The TAILQ_PREV() call in focus() will fail if there are no
windows in the current workspace.
This commit adds a safeguard to focus() by ensuring that the list of
windows in the current workspace is not empty and that there is at
least one uniconified window to focus on before proceeding.
This commit also modifies send_to_ws() to set r->ws->focus to NULL if
there are no more windows in the workspace after sending the current
window to another workspace. This fixes an odd behavior where you can
"summon" a window that you have previously moved to another workspace,
even though you are in an empty workspace.
Closes FS#191
ok marco
- Refresh status bar (if name/class/title are enabled) when no window
can be focused, so that the name/class/title will be cleared.
- Handle window class/name change events to refresh the bar when appropriate.
- Move XA_WM_NORMAL_HINTS into the '#if 0' block, since the status bar
should not need to be updated for that event.
From: Splex <splecks@rejii.com>
ok marco
Older versions of dmenu (4.2.1) do not send the newline character
long with the response while newer versions (4.4.2) do, this
causes mild bugs (last char in the name of the workspace gets
lobbed off for example). Fix it by sanitizing the string in the
response handler.
Tested by me & lteo with different dmenu version.
OK lteo, marco
Pressing M-s will show a little numbered box on the top-left of each
window. You can switch focus to the desired window by typing its number
and pressing Enter. This lets you focus on a window instantly without
needing to cycle through other windows.
ok marco