Commit graph

344 commits

Author SHA1 Message Date
Christoph Gysin 7d82cd9c0a cmd_output: Use list_seq_find() to find matching config 2015-11-29 15:29:06 +02:00
Drew DeVault 1661edee28 Allow output config for output named *
Which will match any output.
2015-11-28 10:18:37 -05:00
Drew DeVault 2f192cceca Improve config file loading
This also makes it so that your i3 config is used before
/etc/sway/config.
2015-11-28 10:00:53 -05:00
Christoph Gysin e362f871d9 Call swaybg without invoking a shell
This makes escaping the arguments obsolete.

Also avoid dynamic memory allocation for the output id. It only supported ids up
to 99. Now we support up to 999, and take 4 bytes off the stack instead.
2015-11-25 23:19:11 +02:00
Drew DeVault 9fb020d04c Merge pull request #251 from sce/criteria_1
criteria: Add. Learn for_window command.
2015-11-25 09:28:43 -05:00
Christoph Gysin eeb7f5c036 config: print line number 2015-11-25 15:48:27 +02:00
S. Christoffer Eliesen a06cb7cd01 criteria: Add. Learn for_window command.
A criteria is a string in the form of `[class="regex.*" title="str"]`.
It is stored in a struct with a list of *tokens* which is a
attribute/value pair (stored as a `crit_token` struct). Most tokens will
also have a precompiled regex stored that will be used during criteria
matching.

for_window command: When a new view is created its metadata is tested
against all stored criteria, and if a match is found the associated
command list is executed.

Unfortunately some metadata is not available in sway at the moment
(specifically `instance`, `window_role` and `urgent`). Any criteria
string that tries to match an unsupported attribute will fail.

(Note that while the criteria code can be used to parse any criteria
string it is currently only used by the `for_window` command.)
2015-11-25 14:34:33 +01:00
S. Christoffer Eliesen a6c9f40b9a sway_binding_cmp_keys: Differentiate between modifier keys.
Compare modifiers as well as keys when number of modifiers+keys are the
same (so that e.g. mod1+x != mod4+x).
2015-11-24 19:26:43 +01:00
taiyu 9d50f88cef fix list sorting 2015-11-24 00:30:02 -08:00
S. Christoffer Eliesen a0c5a0bb30 cmd_bindsym: Detect/handle duplicates.
Also replace `bindsym_sort` with function `sway_binding_cmp` that takes
all data into account when comparing.
2015-11-22 21:17:36 +01:00
S. Christoffer Eliesen 5531dbe1b2 cmd_workspace: Don't fill up config->workspace_outputs with duplicates.
This also fixes a bug where issuing a new "workspace a output b" command
for an already assigned workspace would not work (the old config would
be found first and used instead).
2015-11-22 11:08:08 +01:00
Drew DeVault 2100d7bfef Fix #240 2015-11-19 20:04:03 -05:00
Drew DeVault 5728307520 Add wallpapers to output command 2015-11-19 18:55:17 -05:00
S. Christoffer Eliesen a94a91a723 cmd_output: Replace existing config if called multiple times. 2015-11-16 15:57:42 +01:00
Drew DeVault 38b18d460a Revert "Try ~/.i3/config earlier than /etc/sway/config"
This reverts commit f0ceb4e909.
2015-11-13 08:17:29 -05:00
Drew DeVault f0ceb4e909 Try ~/.i3/config earlier than /etc/sway/config
And ~/.config/i3/config, of course.
2015-11-13 08:09:30 -05:00
Drew DeVault 250097d32b Fix gaps for views being incorrect 2015-11-12 08:02:39 -05:00
S. Christoffer Eliesen abc5fbfaec Learn "gaps edge_gaps <on|off|toggle>".
When yes, the old behaviour of adding half the inner gap around each
view is used.

When no, don't add any gap when an edge of the view aligns with the
workspace. The result is inner gap only between views, not against the
workspace edge.

The algorithm is not perfect because it means the extra space is
distributed amongst edge-aligned views only, but it's simple, looks good
and it works.
2015-11-04 13:21:10 +01:00
S. Christoffer Eliesen af30a1b67c ipc,commands,config: Replace cmd_status enum with cmd_results struct.
In i3 the ipc reply will contain a human readable error message, and
this patch replicates that behaviour.

However, that error message is also useful for logging, which this
patch takes advantage of.

E.g. instead of logging errors directly in commands.c/checkargs, it is
fed back to the caller which eventually ends up logging everything with
maximum context available (config.c/read_config).

So instead of logging e.g. "Error on line 'exit'" it will now log:
"Error on line 'exit': Can't execute from config."
2015-10-22 23:36:24 +02:00
S. Christoffer Eliesen edf33aad29 config: Add "seamless_mouse" to decide if pointer crosses output edges. 2015-10-22 01:39:12 +02:00
S. Christoffer Eliesen 4fea92ef0c config: Don't try to apply bad output resolution. 2015-10-21 23:59:01 +02:00
S. Christoffer Eliesen ca862a5bd4 config: Apply output config also during config reload. 2015-10-21 23:24:06 +02:00
taiyu 72aaffcf5b fix config search paths 2015-09-20 10:56:22 -07:00
taiyu 0bea2e2122 multi command keybinds 2015-09-14 19:59:25 -07:00
Drew DeVault e505abfe75 Revert "new_workspace null behavior + testmap functions + regex"
This reverts commit e1d18e42a8.

Fixes #180

cc @taiyu-len
2015-09-13 19:46:16 -04:00
taiyu e1d18e42a8 new_workspace null behavior + testmap functions + regex 2015-09-12 02:38:03 -07:00
taiyu aaa0923bc4 cmd status + workspace ws output op 2015-09-10 11:07:40 -07:00
taiyu 799ff640f8 remove old things 2015-09-08 10:28:53 -07:00
taiyu aa22dc3113 var replacement changes 2015-09-08 10:27:09 -07:00
taiyu fd6d06ff61 fix missing symbol bug 2015-09-08 09:52:33 -07:00
taiyu da76ecb5f8 escape check fix 2015-09-08 09:10:36 -07:00
taiyu d673a72705 set variable changes 2015-09-08 08:54:57 -07:00
Thomas Wouters c3f76f8785 fix outut typo 2015-09-08 14:37:20 +02:00
taiyu 3eb29ea736 strdup + style 2015-09-07 15:03:04 -07:00
taiyu 47ff000697 put strip_whitespace back 2015-09-07 14:40:23 -07:00
taiyu 71af5b7dde config modes 2015-09-07 14:29:40 -07:00
taiyu 3fb8397724 free config stuff 2015-09-07 06:52:27 -07:00
taiyu b7de289332 free config when reloading 2015-09-06 23:22:02 -07:00
taiyu 5408d34c9c config_path cleanup 2015-09-06 22:48:43 -07:00
taiyu f25c6b312b gap resize 2015-09-05 20:48:52 -07:00
taiyu afa6747145 enum for command type 2015-09-04 17:09:07 -07:00
taiyu c5d0b5d437 style 2015-09-04 17:02:02 -07:00
taiyu 4cd18449d2 better handling of commands during config 2015-09-04 16:57:03 -07:00
Luminarys 12e96f0f9e Added in workspace_auto_back_and_forth 2015-08-30 21:34:24 -05:00
taiyu e0d5486957 default floating_mod 2015-08-28 14:45:40 -07:00
Luminarys acb3fbdfb5 Added in default_orientation handling 2015-08-27 21:52:59 -05:00
taiyu c8415d7fef split_string memory leaks cleanedup 2015-08-23 19:09:18 -07:00
Drew DeVault b7f4607544 Implement output configuration through config
Do not use `output res WIDTHxHEIGHT` yet, wlc has issues with it (cc
@Cloudef)
2015-08-22 11:18:55 -04:00
minus 8dfaf6265b fixed #108 signed/unsigned comparison 2015-08-21 16:53:11 +02:00
Drew DeVault 3a5fce339f Reset key buffer on reload
To preserve my sanity
2015-08-20 17:14:46 -04:00
Drew DeVault 579fe70ed9 Add command line parsing
Closes #6
2015-08-20 08:37:24 -04:00
aouelete acbcf17905 Fixed config path 2015-08-19 13:41:58 -04:00
Luminarys 0e4df85ba1 Fixed config loading 2015-08-19 09:33:30 -05:00
Drew DeVault 0f29f04816 Set test to NULL when appropriate
Thanks @SyedAmerGilani
2015-08-19 08:24:39 -04:00
Drew DeVault 1ec8e082a2 Free environment vars after loading config
Thanks @SyedAmerGilani
2015-08-19 08:22:18 -04:00
Drew DeVault 79f9d93ef3 Refactor config file loading 2015-08-19 07:50:27 -04:00
Drew DeVault ae367c5af4 Merge pull request #80 from SyedAmerGilani/fix_memory_leaks
fix a few possible memory leaks
2015-08-19 07:01:14 -04:00
Syed Amer Gilani ba5b451dd0 fixed string building for XDG_CONFIG_HOME config loading 2015-08-19 12:51:11 +02:00
Syed Amer Gilani 95517ac77e fix a few possible memory leaks 2015-08-19 11:27:48 +02:00
Luminarys f718556a85 Removed debugging, added in proper gap resets for config reloads 2015-08-18 21:05:58 -05:00
Drew DeVault 446d593b4c Merge pull request #73 from KoffeinFlummi/gaps
Add support for gaps option
2015-08-18 18:07:51 -04:00
KoffeinFlummi c75d5ceba4 Merge remote-tracking branch 'upstream/master' into gaps 2015-08-19 00:05:18 +02:00
Drew DeVault 8e201091a5 Fix indented comments being weird 2015-08-18 18:03:38 -04:00
KoffeinFlummi 4c688cba4e Add support for gaps option 2015-08-18 23:53:57 +02:00
Drew DeVault 85a573dab7 Revert "enhanced whitespace remover"
This reverts commit abd0afb03a.
2015-08-18 08:39:26 -04:00
Drew DeVault 2139001c9f Coding style enforcement
This was done by hand, so I might have missed things. If anyone knows of
a good C style enforcement tool, let me know.
2015-08-18 07:20:34 -04:00
Drew DeVault 2f6dd0687b Merge pull request #65 from taiyu-len/focus_v2
Focus v2
2015-08-18 07:02:31 -04:00
Drew DeVault debb0d6bc1 Fix #64 2015-08-18 06:53:13 -04:00
taiyu b132f67e7b minor fixes 2015-08-18 03:48:41 -07:00
taiyu abd0afb03a enhanced whitespace remover 2015-08-18 03:22:31 -07:00
taiyu e9c3a9016f config handles comments better 2015-08-18 02:48:56 -07:00
Drew DeVault 780893a933 Add support for workspace [name] output [name] 2015-08-17 20:34:53 -04:00
Luminarys 7427ce8930 Switched config loading order to prevent root access w/wlc 2015-08-17 17:15:05 -05:00
Luminarys 64a971882a Minor fix to config loading 2015-08-15 20:13:18 -05:00
Luminarys 24231bef0e Added in additional checks for i3 config paths 2015-08-15 20:03:33 -05:00
Luminarys 614393c09c Added in config file loading from multiple sources 2015-08-15 19:51:23 -05:00
Luminarys ea9efc884d Allowed for execd commands to be spawned after abort 2015-08-13 14:41:36 -05:00
Luminarys 527288a826 fixes to cmd queue freeing, style 2015-08-13 14:41:36 -05:00
Luminarys 9a0a858d1e Typo fix 2015-08-13 14:41:36 -05:00
Luminarys d12a786160 Removed some unnecessary logs 2015-08-13 14:41:36 -05:00
Luminarys ab130fb56b Added in command queue 2015-08-13 14:41:36 -05:00
Luminarys a5b02791d4 Changed command handler to perform var subs on all cmd args
Fixed workspace_next_name to use the first workspace name it can find in the config

Minor fixes

Changed command handler to perform var subs on all portions of a command

Revert "Changed command handler to perform var subs on all portions of a command"

This reverts commit fcfcffa1ea9819bcada6e6c85b40b21bf1b3a96e.

Var sub fixes

Minor fixes

More minor fixes
2015-08-11 12:48:55 -05:00
Taiyu beabb12d63 destroys empty workspace + minor bugfixes 2015-08-10 17:32:50 -07:00
Luminarys 508980e3ab Abstracted load_config 2015-08-10 14:22:22 -05:00
Luminarys 7c02a1967b Spaces to Tabs 2015-08-10 14:09:51 -05:00
Luminarys 68beabda03 Style fixes and slight reload command alteration 2015-08-10 14:00:10 -05:00
Luminarys c0ee2a6406 Added in reload and exec_always handling 2015-08-10 13:53:43 -05:00
Drew DeVault f97a48d5b7 Implement focus_follows_mouse 2015-08-09 09:23:10 -04:00
Drew DeVault a78b921803 Implement key bindings 2015-08-08 19:24:18 -04:00
Drew DeVault 47b28bd335 Clean up config loading and launch wayland 2015-08-05 22:59:06 -04:00
Drew DeVault 5767dcc86e Mostly implement bindsym command 2015-08-05 22:40:38 -04:00
Drew DeVault d0f1fb71d1 Flesh out some command parsing
This implements the `set` command from i3
2015-08-05 22:10:56 -04:00
Drew DeVault e07c77fbb7 Build out command subsystem
Everyone loves code stolen from your own projects
2015-08-05 17:30:47 -04:00
Drew DeVault 542ef0c777 Pull in some scas code and read i3 config file 2015-08-04 21:30:40 -04:00