Commit graph

68 commits

Author SHA1 Message Date
Calvin Lee 016261fd64 Print log level even if STDERR is not a tty
Makes reading debug logs much easier, debug lines will start with `E`,
info lines with `I` and error lines with `E`.
2017-10-20 15:12:28 -06:00
johalun 7fef283044 FreeBSD fixes
Increase _POSIX_SOURCE value where needed.
Increase _XOPEN_SOURCE value where needed.
Conditionally link to libcap (only on Linux).
Possibly some trailing whitespace fixes (automatic).
2017-06-06 09:45:50 +02:00
Mykyta Holubakha f470fa58a3 Replace spaces with tabs in resolve_path 2017-05-11 19:38:32 +03:00
Drew DeVault 586eca0e4c Fix link to dotfiles, closes #1193 2017-04-26 10:07:32 -04:00
Jerzi Kaminsky 8ecb490679 Make sway_abort() report location 2017-04-20 19:20:40 +03:00
Jerzi Kaminsky c9694ee63d Add resolve_path() to utils 2017-04-16 17:09:53 +03:00
Jerzi Kaminsky 709b53bd43 Fix location reported by sway_assert 2017-04-16 16:39:53 +03:00
Jerzi Kaminsky eb3b1ec5f1 Fix variadic forwarding in sway_assert
_sway_assert is a variadic function which tries
to delegate to another variadic function. This
requires a vprintf-style variant of the delegate.

https://stackoverflow.com/a/150616
2017-04-16 16:39:53 +03:00
Drew DeVault 9aed9d9359 UnGNUify the codebase 2017-03-10 23:41:24 -05:00
Calvin Lee 34e2c70abc Feature for #1078: Configurable swaylock colors
Colors are configured through the command line so that swaylock conforms
to the i3lock fork 'github.com/chrjguill/i3lock-color'. Differences from
it are that one letter options '-r' and '-s' are not implimentend because
'-s' is already used by '--scaling' in swaylock.
This commit also fixed whitespace in 'include/swaylock/swaylock.h' and
changed `parse_color` in 'common/util.h' so that it can accept colors
that do not start with a hash. This was done to keep compatability with
the i3lock fork.
2017-02-21 14:12:31 -07:00
wil 1b87193c3d Added "layout promote" command. 2016-12-29 20:31:30 +01:00
Drew DeVault d75a747a3d Handle config-related allocation failures 2016-12-15 19:01:41 -05:00
Drew DeVault 4c6c65e70c Handle malloc failures from read_line 2016-12-15 19:01:40 -05:00
Drew DeVault 9ad1e6b40f Handle malloc failure in ipc_recv_response 2016-12-15 19:01:40 -05:00
Drew DeVault 416417a54c Reorganize includes 2016-09-01 08:18:37 -04:00
Johannes Lundberg 949933c5c3 Fix to make ipc client code FreeBSD compatible. 2016-08-30 16:59:36 -07:00
progandy bf4056a2c6 common: use strtoul in parse_color to avoid clamp
Some implementations of strtol may clamp the values to LONG_MAX instead of
wrapping around to negative values, so use strtoul instead to parse colors.
2016-08-04 14:37:54 +02:00
Zandr Martin 98aa59fdda
implement solid color rendering for swaybg 2016-07-30 18:50:13 -05:00
Tony Crisci 70360c5c07 Add timestamp to log messages 2016-07-28 22:15:14 -04:00
Drew DeVault c8917395c0 Remove SIGSERV and SIGABORT handler
From now on let's just let the core dumps happen and ask users to
provide them.
2016-07-17 11:29:29 -04:00
David Eklov 26842ff383 Add get_log_level() to encapsulate v (current log level)
This patch also makes all global variable in log.c static.
2016-06-27 18:56:50 -05:00
Zandr Martin 9ecb43ea3b
couple small fixes 2016-06-11 15:29:04 -05:00
Zandr Martin 2298143d09
cleanup + add timeouts for pid_workspace list 2016-06-11 12:43:34 -05:00
Zandr Martin 66caee645c Merge branch 'master' into assign-command 2016-06-11 09:33:24 -05:00
Zandr Martin 03d79b41c7
semi-working (only non-client/server wayland apps) 2016-06-10 06:08:59 -05:00
Roosembert Palacios 230591fa4e
Common: Readline: Ignore newline on '\' escaped line ends.
Escape line return when reading from a file with the '\' character.
Similar to shell scripts.

Signed-off-by: Roosembert Palacios <roosembert.palacios@epfl.ch>
2016-06-06 00:17:27 +02:00
Zandr Martin 9ccc92705e implement stable sort for lists
also change sort_workspaces() to use it
2016-06-02 15:48:14 -05:00
Eric Engestrom cc9d1cacbb common: refactor sway_log()
This removes most preprocessor logic, leaving it only it the header.
2016-05-02 18:30:04 +01:00
Eric Engestrom f53ddbe800 common: fix double-close in error_handler() 2016-05-02 15:58:32 +01:00
Eric Engestrom a1bb58017b Fix off-by-one bug in log functions 2016-05-02 12:04:14 +01:00
Eric Engestrom aece36cd22 common: fix potential buffer overflow 2016-05-01 13:57:23 +01:00
Daniel Lockyer 235cfd93b2 common/stringop.c: a premature decrement meant an element of argv was never released 2016-04-29 18:00:21 +01:00
Tomáš Čech bcdeb72189 Explicitly mark static linking in CMake
When no type is given, it depends on BUILD_SHARED_LIBS value which is
not desired in this case.
2016-04-28 20:13:26 +02:00
Tomáš Čech 468ddfb34d Fix missing include paths
When headers were installed in more sofisticated places (but package
config knows it right), it revealed missing paths in CMake
configuration. Lets fix it.
2016-04-28 20:08:41 +02:00
Eric Engestrom 3e8081514d Fix spelling mistakes 2016-04-02 16:00:05 +01:00
Dominique Martinet 234932723c CMake: add missing wlc include dir for common and swaygrab 2016-03-24 18:26:01 -04:00
Mikkel Oscar Lyderik 1d010afbf7 Abort when receiving 0 bytes in IPC call
When sway crashes a swaybar process is sometimes left behind running at
100% CPU. This was caused by the swaybar trying to retrieve an IPC
response from the closed sway socket.

This patch fixes the problem by aborting when the socket has been closed
(recv return 0).

Fix #528
2016-03-22 11:27:39 +01:00
Mikkel Oscar Lyderik 5e253fdd9a Correctly exit sway on errors.
Calling `exit` in sway_terminate prevents sway from correctly shutting
down (freeing data, cleanly terminating the ipc server, etc.).

A better way is to exit straight away if the failure occurs before
`wlc_run` and use sway_abort as usual if it occur when wlc is running.
2016-02-26 09:42:21 +01:00
Mikkel Oscar Lyderik bacd40d6db Fix clang warnings 2016-02-08 12:30:42 +01:00
Drew DeVault e5bb08cc18 Print /proc/<pid>/maps on segfault 2016-01-28 07:57:07 -05:00
Mikkel Oscar Lyderik 32ae26e519 Add quotes to multiword arguments.
This adds quotes around multiword arguments before they are passed to
`/bin/sh -c` in an exec command.

Example:

I connect to irc like this:

    exec termite -e "mosh server tmux a"

Without this patch the arguments are passed to sh as:

    termite -e mosh server tmux a

When it should be:

    termite -e "mosh server tmux a"

For the command to work.
2016-01-25 00:14:13 +01:00
Mikkel Oscar Lyderik c8cf3f70f9 numlen(0) == 1 2016-01-24 03:02:51 +01:00
Mikkel Oscar Lyderik 2707be7199 use log10 in numlen 2016-01-24 02:59:58 +01:00
Drew DeVault a416715372 Revert "s/numlen/log10/g"
This reverts commit 038bb8cc7c.
2016-01-23 16:35:32 -05:00
Drew DeVault 038bb8cc7c s/numlen/log10/g 2016-01-23 15:51:38 -05:00
Mikkel Oscar Lyderik dffacea831 Add function for getting list of modifier names.
Get an array of modifier names from modifier masks.
2016-01-08 03:03:40 +01:00
Mikkel Oscar Lyderik 95e0f44c73 Move modifier name table to common/util.c
Lookup of modifier names is required in several places, thus it makes
sense to move it to a general place.
2016-01-05 18:36:24 +01:00
Mikkel Oscar Lyderik 7298a9c67a Add type to returned response.
Makes `ipc_recv_response` return a struct with size, type and payload
rather than just the payload string.

This is useful if the type has to be checked on the client.
2016-01-03 20:40:50 +01:00
progandy 8fefdb3c64 swaybar: fix memory leaks 2015-12-22 17:54:47 +01:00
robotanarchy c3e9ee5e43 replace non-standard qsort_r with qsort
I've tried to make as few changes, as possible.

Usually the reason for using qsort_r is, that you can pass an extra userdata pointer to the
compare function. However, in sway list_sort wrapped qsort_r and always called a wrapper
function for comparing, the wrapper function then had the real compare function as argument.
The only thing, that the wrapper function does, is dereferencing the 'left' and 'right' function
arguments before passing them to the real compare function.

I have renamed list_sort to list_qsort to avoid confusion (so nobody tries to use list_qsort like
list_sort) and removed the wrapper functionality. Now the dereferencing must be done in the
compare function, that gets passed.

Some compare functions were used in both list_sort and list_seq_find. To make the difference
clear, I've added a '_qsort' suffix to the compare functions, that are intended to be used with
the new list_qsort. (In other words: list_qsort is not compatible anymore with list_seq_find).

- Changed and renamed function (it isn't used anywhere but in commands.c, and only for sorting):
	compare_set -> compare_set_qsort
- New wrapper functions:
	sway_binding_cmp_qsort (for sway_binding_cmp)
	sway_mouse_binding_cmp_qsort (for sway_mouse_binding_cmp)
2015-12-22 00:38:18 +01:00