Commit Graph

76 Commits

Author SHA1 Message Date
Daniel Lockyer c9d634414a sway/main.c: simplify free'ing by switching to the helper method 2016-05-05 23:30:28 +01:00
Drew DeVault 54c635ca16 Update to wlc 0.0.2 2016-04-16 10:22:50 -04:00
Mikkel Oscar Lyderik 71a5350b68 Implement include command
The include command (`include <path>`) makes it possible to include sub
config files from the main config file (or from within other sub config
files).

The include command uses the following rules for including config files:

* the `path` can be either a full path or a path that is relative to the
  parent config. Shell expansion is supported, so it's possible to do
  `include ~/.config/sway.d/*`.
* The same config file can only be included once (to prevent include
  cycles). If a config is included multiple times it will just be
  ignored after it has been included once.
* Including a sub config file is the same as inserting the content of
  that file into the parent config, thus rules about overwriting
  bindsyms etc. works the same as for a single config.

Implement #542
2016-03-26 16:37:50 +01:00
Mikkel Oscar Lyderik 938ff29b7b Gracefully exit when config is not found
This makes sure that sway will gracefully exit if the config is not
found or sway is unable to read it.
2016-03-24 22:20:25 +01:00
Drew DeVault 06107bb44e Make the nvidia warning louder 2016-03-24 16:48:53 -04:00
Drew DeVault fd061d4dc4 Don't set WLC_DIM on startup 2016-03-24 14:09:18 -04:00
Drew DeVault 5c85c018b4 Update to new WLC API 2016-03-24 14:08:53 -04:00
Mikkel Oscar Lyderik 67bbcceba1 Free config before exiting sway.
Apart from freeing the sway_config struct, this also terminates the
swaybars spawned by sway, since they are linked by PID to the bar config
structs.
2016-02-27 22:13:15 +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
Yacine Hmito c400ca8f88 Fix for when sway_abort doesn't exit
sway_terminate does an exit in case wlc_terminate doesn't
2016-02-25 23:46:27 +01:00
Yacine Hmito e239fbbd88 No options when using sway as IPC client
Sway used to attempt sending an IPC command composed of every argument
after the first non-option argument encountered.
Now, raises an error if an option is encountered before the intended command.
Some options such as -h or -v take effect when parsing, so they still
apply.
2016-02-25 23:04:59 +01:00
Yacine Hmito 179192e222 Removed p as a valid CLI option
The get-socketpath long option had an undocumented short alternative
as `p`. It has been removed.
However, the code in the options array is still the 'p' char.
2016-02-25 21:50:24 +01:00
crondog cd0eaf00da Prevent ipc from crashing sway 2016-01-22 12:29:18 +11:00
Cole Mickens 28081b7689 libinput 2016-01-19 06:51:36 -08:00
Mikkel Oscar Lyderik 2e0ef533f2 Init layout before checking config 2016-01-05 19:16:46 +01:00
Mikkel Oscar Lyderik 16b8c2e915 Handle SIGTERM sent to sway
This makes sway handle and gracefully shut down everything when
receiving a SIGTERM.

Fix #416
2015-12-29 13:03:53 +01:00
Streetwalrus Einstein 774ffbe0d5 Detect proprietary AMD drivers too 2015-12-14 18:13:44 +02:00
Drew DeVault af80b12add Implement invoking `sway` as IPC client
As an alternative to invoking swaymsg.
2015-12-12 13:01:00 -05:00
Drew DeVault 25ad3181f5 Merge pull request #276 from sce/earlier_logging
main: Setup logging before wlc_init.
2015-11-29 09:08:56 -05:00
S. Christoffer Eliesen c26a4b42cf main: Setup logging before wlc_init.
If `wlc_init` fails the error message will never be logged or printed
anywhere.
2015-11-29 15:01:47 +01:00
Christoph Gysin 923c3245ac Fix option parsing
Using 'flag' results in duplicate code paths for short and long options.

This broke the -q short option in swaymsg, because there was:

 {"quiet", no_argument, &quiet, 'q'}

Which will set quiet to 'q' and return 0, not 'q'.
2015-11-28 23:50:44 +02:00
Christoph Gysin 2f2e1f3fc7 sway: Add --help option that prints usage 2015-11-28 23:50:44 +02:00
Christoph Gysin e48a16ce5e sway: Print usage and exit on unknown options 2015-11-28 23:50:44 +02:00
Christoph Gysin 3ba33321de Use macros for exit values 2015-11-28 23:50:10 +02:00
S. Christoffer Eliesen 20cb390323 sway/main: Move wlc init to after args are handled.
First of all because it's not needed that early, and second of all
because there's a bug where calling `sway --get-socketpath` via `popen`
causes the child sway process to spin/hang instead of returning EOF.
(Specifically `(unset SWAYSOCK; swaymsg)` hangs.) This patch fixes that.

(Also note that this patch moves the "detailed review" comment, so I
guess this patch requires extra detailed review?)
2015-11-28 20:35:57 +01:00
Drew DeVault 27f03c705d Move IPC client into common, refactor IPC 2015-11-27 09:50:04 -05:00
Drew DeVault 82db2a57a9 Basic support for extensions in server and clients 2015-11-18 22:01:22 -05:00
S. Christoffer Eliesen f64b7e71d4 ipc: Store socketname in SWAYSOCK. Fixes `--get-socketpath`.
After adding pid to the socket path the `--get-socketpath` command broke
because it doesn't know the pid of the running instance. Fix this by
setting and querying `SWAYSOCK`.

Also ignore `SWAYSOCK` upon normal startup if a socket exists at that
location (ie. from another sway instance), and don't overwrite `I3SOCK`
if it exists either.
2015-11-13 18:18:52 +01:00
S. Christoffer Eliesen 3be11a08e6 main: Implement --get-socketpath switch. 2015-10-18 19:53:56 +02:00
taiyu 18f4905e62 #187, let init handle child processes 2015-10-08 08:12:31 -07:00
Drew DeVault 5bcecbb751 Revert "#187 cleanup zombies properly" 2015-10-08 06:24:35 -04:00
taiyu 5539fd89be #187 cleanup zombies properly using default 2015-10-07 16:18:57 -07:00
Drew DeVault 318e1be240 Fix warnings introduced by prior commit 2015-09-18 07:27:35 -04:00
Drew DeVault 8e25ce4e57 Fix build for debian stretch
Fixes #182
2015-09-18 07:16:20 -04:00
Drew DeVault 1756a4f2da fclose /proc/modules when we're done with it 2015-09-02 11:47:15 -04:00
Drew DeVault 4ef60e7c09 Add check for nvidia module and warn user 2015-09-02 11:46:21 -04:00
Drew DeVault eb003689a3 Log sway version on startup 2015-09-02 09:42:27 -04:00
Luminarys 42de135c3a Added in better versioning info 2015-08-26 21:13:53 -05:00
taiyu 1fa7a91bfb move_container_to fixup 2015-08-26 11:01:26 -07:00
Luminarys 38cfdf99f4 Added in build version based on git hash 2015-08-25 22:04:57 -05:00
taiyu e121258426 longopt minor fix 2015-08-25 16:39:05 -07:00
Drew DeVault e78221e6a0 Prefix log events from wlc with [wlc] 2015-08-23 13:31:16 -04:00
Drew DeVault ac2034df99 Handle wlc log events 2015-08-23 13:08:04 -04:00
Drew DeVault 2a799a731f Remove wlc logging stuff 2015-08-21 18:24:54 -04:00
minus f26ed32e46 added sway_terminate to exit cleanly 2015-08-20 15:27:56 +02:00
minus 91c0877264 properly exit sway
- wlc_terminate() instead of exit(0)
- unlink IPC socket
2015-08-20 15:24:33 +02:00
minus 8981b48cd2 very basic IPC implementation
simply executes the received data as command
2015-08-20 15:24:33 +02:00
Drew DeVault 579fe70ed9 Add command line parsing
Closes #6
2015-08-20 08:37:24 -04:00
Drew DeVault 3f3d1ffee4 Rearrange main.c some more 2015-08-17 18:20:56 -04:00
Luminarys 7427ce8930 Switched config loading order to prevent root access w/wlc 2015-08-17 17:15:05 -05:00