Tiago Cunha [Sun, 13 May 2012 22:15:11 +0000 (23:15 +0100)]
Support maximum length in the character pairs.
The specified length is used to limit the number of characters outputted
by the sequence. Thus, it's now possible to limit, for instance, the
window name length.
Tiago Cunha [Sun, 13 May 2012 00:33:38 +0000 (01:33 +0100)]
Add the ability to format the status-bar output.
Introduced the new bar_format configuration file keyword that allows to
customize the status-bar by providing character sequences that are
replaced accordingly, effectively supplanting the enabled options. The
default output is retained, though.
Tiago Cunha [Sat, 12 May 2012 21:59:48 +0000 (22:59 +0100)]
Zap superfluous calls to bar_update.
Remove scattered calls to bar_update when switching workspaces and
cycling layouts, which are preceded by a focus function call. They
already are (as they should be) responsible for doing that.
Tiago Cunha [Sat, 12 May 2012 21:17:22 +0000 (22:17 +0100)]
Kill references before focusing on a new window.
Like the other focusing functions, make focus_prev call kill_refs before
trying to focus on a new window. This way, the current window references
are cleared like it should be when the very last window is destroyed.
Otherwise, the status-bar output will contain (while its alarm does not
expire) the class hint of the to be removed window.
Tiago Cunha [Sat, 12 May 2012 21:05:21 +0000 (22:05 +0100)]
Don't call the status-bar wrapper function.
The update functions already check if the window related enabled options
are set. Just call it directly, instead. As a consequence, the wrapper
function can now be deleted.
Tiago Cunha [Sat, 12 May 2012 20:52:20 +0000 (21:52 +0100)]
Reuse class hint in the status-bar.
The window's class hint is already retrieved by the manage_window
function, which is called when a new application is spawned. Therefore,
use it when displaying the application's class and name, instead of
fetching them again with XGetClassHint(3).
Besides, its error checking was incorrect, since it also returns zero on
error.
Tiago Cunha [Wed, 8 Feb 2012 01:17:18 +0000 (01:17 +0000)]
Remove redundant checks.
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.
Tiago Cunha [Wed, 8 Feb 2012 01:07:46 +0000 (01:07 +0000)]
Clear status-bar when iconifying the last window.
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.
Tiago Cunha [Wed, 8 Feb 2012 01:00:33 +0000 (01:00 +0000)]
Add status-bar wrapper function.
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.
Tiago Cunha [Sat, 4 Feb 2012 14:41:30 +0000 (14:41 +0000)]
Fallback to WM_NAME if _NET_WM_NAME fails.
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.
Tiago Cunha [Thu, 2 Feb 2012 23:55:19 +0000 (23:55 +0000)]
Use the warn(3) functions instead of fprintf(3).
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).
Tiago Cunha [Thu, 2 Feb 2012 15:52:56 +0000 (15:52 +0000)]
NUL terminate the strftime(3) buffer.
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.
Reginald Kennedy [Fri, 3 Feb 2012 17:58:52 +0000 (01:58 +0800)]
When responding to a ConfigureRequest event without reconfiguring the window,
take into account WM_SIZE_HINTS (if set) when generating the ConfigureNotify
response.
Reginald Kennedy [Wed, 1 Feb 2012 20:50:43 +0000 (04:50 +0800)]
Fix response to applications when windows are not reconfigured as requested.
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.
Tiago Cunha [Mon, 23 Jan 2012 19:17:16 +0000 (19:17 +0000)]
Plug memory and file descriptor leak.
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.
Lawrence Teo [Tue, 10 Jan 2012 01:30:00 +0000 (20:30 -0500)]
Fix a crash when mvws_n is used in an empty workspace.
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.