Commit graph

299 commits

Author SHA1 Message Date
Mikkel Oscar Lyderik 2935e24cf5 Implement 'smart_gaps' feature from i3-gaps 2016-03-20 12:29:47 +01: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 e15a8a0376 Improve how swaybars are spawned 2016-02-27 22:12:35 +01:00
Mikkel Oscar Lyderik bad4e22f3b Make sway spawn only one bar per bar config 2016-02-27 22:12:35 +01:00
crondog 0ee5547406 font: Allow adding font to the config. In prep for border titles
v2: Give default font and make bar use it if no bar font
2016-01-27 20:53:31 +11:00
Yacine Hmito c487cf71a5 Fix issue #455
CMAKE_INSTALL_FULL_SYSCONFIG is not actually passed to
the C preprocessor. I remember it working, so I must have
messed up somewhere last time I touched this.
This is fixed by manually passing its value to the C preprocessor
through the SYSCONFDIR definition
2016-01-21 21:08:18 +01:00
Drew DeVault d969a1dec0 Fix memory leak in config.c
Thanks @jollywho
2016-01-21 11:18:13 -05:00
Cole Mickens 28081b7689 libinput 2016-01-19 06:51:36 -08:00
Mikkel Oscar Lyderik f8b260d4a1 Add support for bincode command
If a bindsym and bincode maps to the same combination, the last one will
overwrite any previous mappings.
2016-01-09 18:07:47 +01:00
Mikkel Oscar Lyderik 32cd3f70eb Add function for duplication a sway_binding 2016-01-08 03:03:55 +01:00
Mikkel Oscar Lyderik 843e2ad2c1 Only send modifier event once for active modifiers
This makes sure that a modifier event is only sent for active bar
modifiers, and that it is only sent once for each of those modifiers.

An active bar modifier is a modifier defined for a bar with `mode hide`
and `hidden_state hide`.
2016-01-05 23:18:59 +01:00
Mikkel Oscar Lyderik 7727c9efbc Detect bar modifier pressed/released 2016-01-05 00:49:44 +01:00
Yacine Hmito f02cf75ff3 Use SYSCONFDIR as recommended
- swaylock config path not hardcoded anymore
- the unusual and weird FALLBACK_CONFIG_DIR is no more
2015-12-23 12:22:48 +01:00
Drew DeVault 91c102a897 Merge pull request #393 from robotanarchy/musl-libc-compatibility
musl libc compatibility
2015-12-21 20:42:08 -05: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
Drew DeVault fc71c6303c Fix default swaybar font 2015-12-21 05:07:19 -05:00
Drew DeVault 33fb648938 Merge pull request #372 from sce/fix_swaybar_output_name_test
config: load_swaybars: Fix name comparison.
2015-12-20 09:23:34 -05:00
S. Christoffer Eliesen 6ace37d0b1 config: load_swaybars: Fix name comparison. 2015-12-20 12:53:56 +01:00
S. Christoffer Eliesen 2779559b15 config: free_bar: Check if outputs is NULL.
bar_config.outputs is NULL if no output is explicitly defined in config
(ie. use for for all outputs).
2015-12-20 10:14:36 +01:00
Mikkel Oscar Lyderik 207678e809 Add support for running swaybar_command 2015-12-19 01:03:39 +01:00
Drew DeVault b9f14cee41 Merge pull request #359 from mikkeloscar/i3bar-command
Add bar option: swaybar_command <command>
2015-12-18 18:19:59 -05:00
Mikkel Oscar Lyderik 9d7f1afdfb Add bar option: swaybar_command <command> 2015-12-19 00:13:51 +01:00
Mikkel Oscar Lyderik 90ff36cab8 Terminate children when freeing output container 2015-12-18 18:27:54 +01:00
Mikkel Oscar Lyderik ede27eabc5 Reload swaybar/swaybg on config reload.
This works by tracking the pids of the child processes in the related
output container and terminating the processes and spawning new ones on
a config reload.

Should solve: #347
2015-12-18 18:27:44 +01:00
Drew DeVault 03787871d0 Fix bar invocation for multihead setup 2015-12-16 19:36:31 -05:00
Drew DeVault 1a365f19c9 Use system swaybar instead of local swaybar 2015-12-16 19:30:38 -05:00
Drew DeVault 60c204a09b Invoke swaybar when an output matches a bar config 2015-12-16 19:29:47 -05:00
Drew DeVault 01798a5ae2 Merge pull request #338 from mikkeloscar/bar-separator-symbol
Implement bar option: separator_symbol
2015-12-16 07:47:00 -05:00
Mikkel Oscar Lyderik 053fb09d1e Use free_flat_list for simple char* list.
No need to reimplement free_flat_list functionality.
2015-12-16 13:06:54 +01:00
Mikkel Oscar Lyderik 2fd7dd64ec Implement bar option: separator_symbol 2015-12-16 13:01:11 +01:00
Mikkel Oscar Lyderik 47f4aea9e7 Correctly free bindings list 2015-12-15 22:16:54 +01:00
Mikkel Oscar Lyderik f59f5d27aa Implement bar option: output <output> 2015-12-15 22:01:53 +01:00
Mikkel Oscar Lyderik 05e7334106 Fix active_workspace_border color definition 2015-12-15 15:08:41 +01:00
Mikkel Oscar Lyderik 6834a33290 Add bar height option (Airblader/i3) 2015-12-15 15:02:13 +01:00
Mikkel Oscar Lyderik de1f625c27 Add rgba support for bar colors 2015-12-15 13:45:04 +01:00
Mikkel Oscar Lyderik 8c1d56812b Implement bar option: colors {} 2015-12-15 13:12:55 +01:00
Drew DeVault 242da783f4 Merge pull request #324 from mikkeloscar/free-bar-bindings
Free bar->bindings
2015-12-14 19:58:41 -05:00
Mikkel Oscar Lyderik 95de999922 Free bar->bindings 2015-12-15 01:53:34 +01:00
Mikkel Oscar Lyderik 0513322c03 Move default bar config to bar creation.
Get rid of `config->bar` and define the default bar config options when
a bar is initialized.
2015-12-15 01:05:00 +01:00
Yacine Hmito 87126a9fc2 Added bar_cmd_bindsym
Defined a sway_mouse_binding for clicks on the swaybar
2015-12-15 00:15:32 +01:00
Mikkel Oscar Lyderik 0aeee6963d Make mouse key used for drag/resize configurable
This makes it possible to define what mouse button key (left|right) to
use for dragging/resizing.
2015-12-14 22:31:34 +01:00
Mikkel Oscar Lyderik 211bc71599 Use tabs instead of spaces 2015-12-14 16:38:49 +01:00
Drew DeVault 4d17aa9919 Revert "Make mouse key used for drag/resize configurable"
This reverts commit 22916e9ebc.
2015-12-14 08:57:00 -05:00
Mikkel Oscar Lyderik 0a8ec26383 Implement bar option: tray_padding <px> [px] 2015-12-14 12:56:59 +01:00
Mikkel Oscar Lyderik 74152043f4 Implement 'bar { }' block parsing 2015-12-14 12:56:45 +01:00
Drew DeVault 19fd979af4 Merge pull request #300 from mikkeloscar/configure-mouse-btn
[RFC] Make mouse key used for drag/resize configurable
2015-12-12 12:28:56 -05:00
Drew DeVault bffbe11e53 Fix config.c strlen error 2015-12-11 14:22:28 -05:00
Mikkel Oscar Lyderik 22916e9ebc Make mouse key used for drag/resize configurable
This makes it possible to define what mouse button key (left|right) to
use for dragging/resizing.
2015-12-11 18:04:27 +01:00
Yacine Hmito f3f77f9ff1 FALLBACK_CONFIG_DIR did not work. Fixed.
- Flag was ignored. Now it's taken into account.
- Missing trailing slashes in path now behaves properly.
2015-12-01 19:41:44 +01:00
Yacine Hmito 09feef89ee Can customize config fallback directory
CMake takes a `FALLBACK_CONFIG_DIR` flag which is the directory where the
standard configuration file `config` is copied at installation.
If loading from typical configuration directories fails, sway loads
FALLBACK_CONFIG_DIR/config (/etc/sway/config by default).
2015-12-01 01:07:48 +01:00
Drew DeVault 44d0f731c3 Add framework for switching command sets
This will allow the bar {} block to have a different command set (and
also bar { colors { } }.
2015-11-29 17:20:27 -05:00
Drew DeVault 4f89735fc4 Add bar config struct and defaults 2015-11-29 17:05:04 -05:00
Christoph Gysin b1bd3ae6f3 cmd_output: Merge instead of replace output config 2015-11-29 23:17:56 +02:00
Drew DeVault 5a369b3132 Only strip comments at the start of a line
This is necessary because i3 config files use CSS notation for colors
(i.e. #rrggbb).
2015-11-29 14:02:58 -05:00
Christoph Gysin ffdfaaa985 apply_output_config: use list_seq_find() to find config 2015-11-29 15:31:58 +02:00
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