Commit graph

3520 commits

Author SHA1 Message Date
Christoph Gysin 78c2e29328 swaybg: make argv const 2015-11-25 21:00:23 +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
Drew DeVault 964b4d2ddb Merge pull request #259 from christophgysin/lineno
config: print line number
2015-11-25 09:09:05 -05:00
S. Christoffer Eliesen 5483fe1883 criteria: Code formatting. 2015-11-25 14:59:07 +01:00
Drew DeVault 0976bf7f68 Merge pull request #258 from christophgysin/whitespace
config: remove trailing whitespace
2015-11-25 08:53:33 -05:00
Christoph Gysin eeb7f5c036 config: print line number 2015-11-25 15:48:27 +02:00
Christoph Gysin 71f28fae57 config: remove trailing whitespace 2015-11-25 15:48:13 +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
Drew DeVault 402c9f4bf0 Merge pull request #255 from christophgysin/ninja
cmake: fix ninja build
2015-11-25 08:19:34 -05:00
Drew DeVault d4ac0df906 Merge pull request #257 from christophgysin/missing-include
extensions: add missing include
2015-11-25 07:44:06 -05:00
Christoph Gysin 1b5e0020c3 cmake: fix ninja build
When using the ninja generator:

  $ cmake -G Ninja <dir>
  $ ninja -C <dir>

This commit fixes the warning:

ninja: warning: multiple rules generate bin/wayland-desktop-shell-protocol.c.  builds involving this target will not be correct; continuing anyway [-w dupbuild=warn]
2015-11-25 14:39:14 +02:00
Christoph Gysin a99aa92bc6 extensions: add missing include
This fixes a compiler warning:

../sway/extensions.c: In function ‘set_background’:
../sway/extensions.c:16:37: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
  struct background_config *config = malloc(sizeof(struct background_config));
                                     ^
../sway/extensions.c:16:37: warning: incompatible implicit declaration of built-in function ‘malloc’
../sway/extensions.c:16:37: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
2015-11-25 14:39:09 +02:00
taiyu a0b5953aa8 Merge pull request #254 from christophgysin/typo
cmake: Fix typo
2015-11-25 04:38:20 -08:00
Christoph Gysin 590c46aa69 cmake: Fix typo 2015-11-25 14:09:26 +02:00
Drew DeVault a642827dfb Merge pull request #253 from sce/add_sibling_handle_floating_alt1
Handle floating views in layout code
2015-11-24 16:10:01 -05:00
S. Christoffer Eliesen e31a899841 layout: get_swayc_in_direction_under: Handle floating views. 2015-11-24 21:34:41 +01:00
S. Christoffer Eliesen b5ddad4bf6 layout: swap_container: Handle floating views. 2015-11-24 21:34:41 +01:00
S. Christoffer Eliesen ed1b0bffbc layout: replace_child: Handle floating views. 2015-11-24 21:34:41 +01:00
S. Christoffer Eliesen 8aef255d5f layout: add_sibling: Handle floating views properly.
This should fix #241.
2015-11-24 21:34:24 +01:00
Drew DeVault 53ec7a74b6 Merge pull request #252 from sce/fix_binding_cmp
sway_binding_cmp_keys: Differentiate between modifier keys.
2015-11-24 15:32:35 -05: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
Drew DeVault 8ad8ceeeb9 Merge pull request #250 from sce/initial_support_for_criteria_strings
Initial support for criteria strings
2015-11-24 10:56:29 -05:00
S. Christoffer Eliesen db92920cf9 handle_command: Skip commands that has a criteria string.
We can't handle them currently (the criteria needs to e.g. be passed to
each command handler which then needs to do the right thing), so it's
better to just do nothing than to create unexpected results (because the
command was executed on the wrong view).

(Before this patch any command list with a criteria string would simply
fail to parse, so this is at least a step in the right direction.)
2015-11-24 16:29:28 +01:00
S. Christoffer Eliesen b7e3d05ace stringop: Properly handle criteria strings.
A criteria string (e.g. '[class="something" title="something"]') is now
correctly treated as a single argument.
2015-11-24 16:12:37 +01:00
Drew DeVault e7c0573a98 Merge pull request #249 from sce/extra_view_metadata
Extra view metadata
2015-11-24 10:12:08 -05:00
S. Christoffer Eliesen 4367e6d3e3 container: Store app_id attribute for views. 2015-11-24 16:00:41 +01:00
S. Christoffer Eliesen 47c313fe3e container: Store class attribute for views. 2015-11-24 16:00:41 +01:00
Drew DeVault c671329681 Merge pull request #248 from taiyu-len/master
fix list sorting
2015-11-24 07:37:16 -05:00
taiyu 9d50f88cef fix list sorting 2015-11-24 00:30:02 -08:00
Drew DeVault cb11364552 Merge pull request #247 from sce/handle_bindsym_duplicates
Handle bindsym duplicates
2015-11-22 15:29:17 -05: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 9ce5d635f1 commands: Comment/doc for config_command. 2015-11-22 15:54:31 +01:00
Drew DeVault 7bd82a26b0 Merge pull request #245 from sce/workspace_output_duplicates
Fix `workspace_output` duplicates
2015-11-22 09:18:20 -05: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
S. Christoffer Eliesen d0af224e6d stringop: lenient_strcmp: Add. 2015-11-21 22:22:09 +01:00
S. Christoffer Eliesen a33e3badad list: Add list_seq_find.
Sometimes one has to traverse a list to find out if some data already
exists there in order to avoid dupilcates in the list, and this function
facilitates in that without requiring that the data is ordered.
2015-11-21 22:22:08 +01:00
Drew DeVault 56e80c0f73 Update header for default config 2015-11-19 20:10:14 -05:00
Drew DeVault 2100d7bfef Fix #240 2015-11-19 20:04:03 -05:00
Drew DeVault 35fd139105 Add all documented scaling modes to config parser
Note that not all scaling modes are actually supported by swaybg yet.
2015-11-19 18:55:58 -05:00
Drew DeVault 5728307520 Add wallpapers to output command 2015-11-19 18:55:17 -05:00
Drew DeVault 79b277fe9b Parse output background config 2015-11-19 18:25:15 -05:00
Drew DeVault 392f02da64 Stretch image to fit output resolution 2015-11-19 08:34:32 -05:00
Drew DeVault 1a3a7f2514 Basic image rendering for swaybg 2015-11-19 08:20:07 -05:00
Drew DeVault b4e5e1381f Refactor the crap out of wayland clients
And create a background surface on every output when invoking swaybg.
2015-11-19 07:58:57 -05:00
Drew DeVault 4a1584be53 Fix background extensions
Thanks @Cloudef, it works great
2015-11-19 07:23:11 -05:00
Drew DeVault 65b8a5c3ce Add background handling
This does not work as expected. I think the problem is on the wlc side.
Please review, @Cloudef. To reproduce the issues:

1. Run sway
2. Open terminal in sway
3. Run swaybg

swaybg will create a surface and ask to have it set as the background,
but wlc_handle_from_wl_surface_resource will return 0. If the swaybg
surface is a shell surface, then it works - but wlc complains about the
pointer type and segfaults as soon as the pre-render hook tries to draw
the background.
2015-11-18 22:14:57 -05:00
Drew DeVault 82db2a57a9 Basic support for extensions in server and clients 2015-11-18 22:01:22 -05:00
Drew DeVault fb0bfa13ce Fix warning about uninitialized variable 2015-11-18 19:59:47 -05:00
Drew DeVault 2f01a3265d Exit if unable to allocate buffer 2015-11-18 19:58:38 -05:00
Drew DeVault 7a40eb6de6 Support cursors over wayland clients
Apparently wayland has fucking client-side cursors, too
2015-11-18 19:38:42 -05:00