Commit Graph

162 Commits (c2bd10c482173b72a74f568348305ea87d3b4dd9)

Author SHA1 Message Date
johannes karoff 1437271e65 do not match docks in config and command criteria (#2340) 2016-09-26 09:45:58 -07:00
Ingo Bürk b1d70f25b3 Introduced a new GET_BINDING_MODES message type and reply. (#2376)
This type dumps all currently configured binding modes.

fixes #2375
2016-06-15 22:25:22 +02:00
Tony Crisci e690e3d483 Cast con id as uintptr_t (#2298)
Use `uintptr_t` to cast the con id to int instead of `long int`. This
type is guaranteed to hold the pointer as an int regardless of platform.

fixes #2283
2016-04-15 00:27:43 -07:00
Ingo Bürk 018922dcc4 Allow "modifier none" in i3bar to disable the modifier.
This allows "modifier none" (and "modifier off") for the bar config
in order to disable the modifier key altogether. This is useful
for users who use a different approach to hiding / showing the bar,
e.g., a custom keybind that involved multiple keys or scripts.

fixes #2208
2016-02-11 20:51:05 +01:00
Michael Stapelberg de035cab6d ipc: fix memory leak when clients with subscriptions disconnect 2016-01-08 21:24:21 +01:00
Michael Stapelberg 287ebcc206 ipc: fix cosmetic memory leak when shutting down 2016-01-08 21:24:12 +01:00
Ingo Bürk 1f660a4cc4 Move title_format from window to container.
This patch moves the title_format information from windows to containers.
Furthermore, it allows correctly setting it on window-less containers and
displays the title accordingly for split containers.

We now also dump and read title_format in GET_TREE / during restarts.

fixes #2120
2016-01-05 12:22:27 -05:00
Ingo Bürk bc250b26a0 Allow multiple tray_output directives.
This patch introduces the possibility to specify the tray_output directive
multiple times. All values will be used by i3bar, in the order they are
given.

This way, a single bar configuration can be used for several machines with
internal output names "eDP1" and "LVDS-0" by specifying tray_output for both.
Any external output (e.g., "DP-0") will still not receive the tray. The same
effect can be achieved by using "primary", but forces the user to couple the
tray display to the primary output which may not be desirable behavior.

relates to #555
2015-11-01 16:35:17 -05:00
David Simon dc05d905c1 Optionally change i3bar color on focused output, implements #2020 2015-10-27 09:12:57 -04:00
Ingo Bürk 9bb2f038ab Allow multiple marks on windows.
This patch allows multiple marks to be set on a single window. The restriction that a mark may
only be on one window at a time is still upheld as this is necessary for commands like
"move window to mark" to make sense.

relates to #2014
2015-10-22 15:29:42 +02:00
Michael Stapelberg 8125b54e09 fix a memory leak in handle_get_bar_config 2015-10-19 19:13:15 +02:00
Ingo Bürk 2c338b6ae2 Handle _NET_WM_STATE_STICKY, but only for floating containers. If this atom is set, the floating window will always be automatically moved to the currently active workspace of the output that it is on. This is the equivalent of a sticky note stuck to the monitor.
We will respect this atom upon managing a window as well as when we receive a request that changes the sticky state.

fixes #1455
2015-09-13 20:40:20 +02:00
Michael Stapelberg bf3cd41b5d Use libxkbcommon for translating keysyms, support all XKB groups.
fixes #1835

This commit improves the translation of keysyms to keycodes by loading
keymaps using libxkbcommon-x11 and using libxkbcommon for figuring out
the keymap, depending on each keybinding’s modifiers. This way, the
upper layers of complex layouts are now usable with i3’s bindsym
directive, such as de_neo’s layer 3 and higher.

Furthermore, the commit generalizes the handling of different XKB
groups. We formerly had support only for two separate groups, the
default group 1, and group 2. While Mode_switch is only one way to
switch to group 2, we called the binding option Mode_switch. With this
commit, the new names Group1, Group2 (an alias for Mode_switch), Group3
and Group4 are introduced for configuring bindings. This is only useful
for advanced keyboard layouts, such as people loading two keyboard
layouts and switching between them (us, ru seems to be a popular
combination).

When grabbing keys, one can only specify the modifier mask, but not an
XKB state mask (or value), so we still dynamically unbind and re-bind
keys whenever the XKB group changes.

The commit was manually tested using the following i3 config:

    bindsym Group4+n nop heya from group 4
    bindsym Group3+n nop heya from group 3
    bindsym Group2+n nop heya from group 2
    bindsym n nop heya
    bindsym shift+N nop explicit shift binding
    bindsym shift+r nop implicit shift binding
    bindcode Group2+38 nop fallback overwritten in group 2 only
    bindcode 38 nop fallback

…with the following layout:

    setxkbmap -layout "us,ua,ru,de" -variant ",winkeys,,neo" \
      -option "grp:shift_caps_toggle,grp_led:scroll" \
      -model pc104 -rules evdev

By default (xkb group 1, us layout), pressing “n” will result in the
“heya” message appearing. Pressing “a” will result in the “fallback”
message appearing. “j” is not triggered.

By pressing Shift+CapsLock you switch to the next group (xkb group 2, ua
layout). Pressing “a” will result in the “fallback overwritten in group
2 only” message, pressing “n” will still result in “heya”. “j” is not
triggered.

In the next group (xkb group 3, ru layout), pressing “a” will result in
the “fallback” message again, pressing “n” will result in “heya”,
“j” is not triggered.

In the last group (xkb group 4, de_neo layout), pressing “a” will still
result in “fallback”, pressing “n” will result in “heya”, pressing “j”
will result in “heya from group 4”.

Pressing shift+n results in “explicit shift binding”, pressing shift+r
results in “implicit shift binding”. This ensures that keysym
translation falls back to looking at non-shift keys (“r” can be used
instead of ”R”) and that the order of keybindings doesn’t play a role
(“bindsym n” does not override “bindsym shift+n”, even though it’s
specified earlier in the config).

The fallback behavior ensures use-cases such as ticket #1775 are still
covered.

Only binding keys when the X server is in the corresponding XKB group
ensures use-cases such as ticket #585 are still covered.
2015-08-26 09:56:42 +02:00
Michael Stapelberg 419b73be9e Merge pull request #1816 from tcreech/tcreech-for-illumos
Changes for compiling i3 on Illumos
2015-08-04 00:10:06 -07:00
shdown c85d16faa4 Use safe wrappers wherever possible 2015-08-03 12:50:50 +03:00
shdown bc52fae15c libi3: change scalloc() signature to match calloc() 2015-08-03 12:50:13 +03:00
Tim Creech f41018b33e Changes for compiling on Illumos
* common.mk: use -lsocket -liconv -lgen on Illumos/Solaris
* mkdirp: return int and accept a mode argument
* use i3's mkdirp on everything except Illumos
2015-07-30 07:44:10 -04:00
hwangcc23 44367572c9 Display which config is used in --more_version
In the output of i3 --moreversion,
display the path of the used config and its last modified time.
2015-07-10 22:54:25 +08:00
Michael Hofmann bad4203755 Configurable tray padding. 2015-06-28 00:14:37 +02:00
Ingo Bürk 9eb255d5fa Ensure format of dumped bindings for i3bar is compatible with i3 bindings.
fixes #1695
2015-06-18 19:28:24 +02:00
Ingo Bürk 2b6f76852c Implement i3's logic for maintaining a list of 'bindsym' directives and passing it to i3bar through the IPC. 2015-06-05 12:30:53 +02:00
Ingo Bürk 9b691bcca2 Introduce a config directive 'binding_mode' in the 'bar' config, pass it through the IPC and parse it in i3bar. 2015-05-31 16:49:09 +02:00
Deiz 884214f14f Update copyright notices and get rid of ranges
The script used to make these changes can be found at:

   https://gist.github.com/Deiz/32322020f76d23e2bf8f
2015-04-20 17:50:21 -04:00
Deiz cd4bc2adf5 Store Git commit identifier in its own object
Fixes #1640
2015-04-06 18:28:40 -04:00
Deiz e622c42ef0 Move mkdirp into libi3 2015-03-29 17:18:00 -04:00
Michael Stapelberg 037cb317cb Merge pull request #1578 from Airblader/feature-custom-separator
Add support for a custom separator symbol
2015-03-25 22:49:09 +01:00
Ingo Bürk 80da100ac8 Add support for a custom separator symbol
This introduces a "separator_symbol" property for the i3bar configuration.
If set, the specified string will be used as a separator instead of a vertical line. Since it is an optional configuration, complete backwards compatibility is given.

fixes #1472
2015-03-25 21:38:55 +01:00
Michael Stapelberg 26237508ea Bugfix: skip restart_mode swallow specifications
Otherwise, placeholder windows would accumulate these over restarts. The
worst part is that they don’t get dumped properly, meaning an empty
swallows specification ends up in the state, which matches any window,
so other random windows would be matched into the placeholder (e.g.
i3bar).

fixes #1502
2015-03-25 20:50:25 +01:00
Michael Stapelberg 091f1db39a run clang-format (3.5.0)
Not quite sure why there are so many differences. Perhaps we’ve gotten
out of the habit of running clang-format after every change.

I guess it’d be best to have a travis hook that runs clang-format for us
and reports any problems on pull requests.
2015-03-01 17:16:03 +01:00
Tony Crisci 823b46a544 Include workspace con in workspace event
Send the affected workspace in the "current" property for each workspace
event for any type of workspace event that affects a particular
workspace.

fixes #1411
2014-12-22 09:47:31 +01:00
cornerman 58c65a64fe add deco_rect property to con in ipc response 2014-11-29 18:19:39 +01:00
Tony Crisci 6ba7728136 Bugfix: check symbol for NULL in binding json dump
When dumping a binding, as is done during the binding event, check
symbol for NULL. If it is, dump json null. This prevents a crash when
running a binding that was configured with bindcode.

fixes #1379
2014-10-05 21:06:11 +02:00
Tony Crisci fbaf084426 Implement the ipc 'binding' event
The binding event will be triggered when a binding is run as a result of
some a user action. The binding event has the following properties:

change: (str) Currently this will only be "run" but may be expanded in
the future. Included for consistency with other events.

binding: (map) the serialized binding

The "binding" member will have these properties:

input_type: (str) either "keyboard" or "mouse"

input_code: (int) the xcb keycode of the keyboard binding if it was
provided or the mouse button if it is a mouse binding.

symbol: (str) the string representation of the input code

command: (str) the bound command

mods: (list of str) a list of the modifiers that were pressed as string
symbols

fixes #1210
2014-10-03 09:35:37 +02:00
Tony Crisci fd8a2b0e51 IPC: set ws reply "num" member to -1 when named
When a named workspace (i.e., a workspace that has a name that does not
begin with text that can be parsed as an integer greater than or equal
to zero) is represented by the ipc as a workspace json object such as
can be queried with `i3-msg -t get_workspaces`, set the num property to
-1 instead of json null.

This is for convenience of ipc consumers using type-constrained
languages such as C which have difficulty cleanly expressing nullable
integers.

fixes #1368
2014-09-29 09:33:02 +02:00
Michael Stapelberg 2fecf57699 Properly handle windows unsetting WM_TRANSIENT_FOR (Thanks Janus)
fixes #1351
2014-08-26 10:00:14 +02:00
Michael Stapelberg 0d656dd05d don’t set names corresponding to debug colors, remove “sleep 1”.
The names were (mostly) internal to i3 anyway.

Hopefully this doesn’t break anything, but I really think this old
behavior needs to go now :).
2014-07-15 10:36:31 +02:00
Tony Crisci 8e23dc881b i3bar: implement custom mouse wheel commands
Users can specify a command to run when a button was pressed on i3bar to
override the default behavior. Currently only the mouse wheel buttons
are supported. This is useful for disabling the scroll wheel action or
running scripts that implement custom behavior for these buttons.

Example:

bar {
    wheel_up_cmd nop
    wheel_down_cmd exec ~/.i3/scripts/custom_wheel_down
}

fixes #1104
2014-07-10 22:40:12 +02:00
Michael Stapelberg 01a2c5a3f1 Merge branch 'master' into next 2014-06-27 09:05:32 +02:00
Michael Stapelberg c159fc4197 Bugfix: create the directory for storing the restart state (Thanks hjem)
fixes #1303
2014-06-27 09:04:51 +02:00
Michael Stapelberg 4c06e7a573 clang-format-3.5 **/*.h **/*.c
This should be the last commit that formats a big bunch of files. From
here on, whenever I merge patches, I’ll run clang-format like described
in the title.
2014-06-19 11:20:32 +02:00
Michael Stapelberg 9200094203 format **/*.c with clang-format-3.5
This has multiple effects:

1) The i3 codebase is now consistently formatted. clang-format uncovered
   plenty of places where inconsistent code made it into our code base.

2) When writing code, you don’t need to think or worry about our coding
   style. Write it in yours, then run clang-format-3.5

3) When submitting patches, we don’t need to argue about coding style.

The basic idea is that we don’t want to care about _how_ we write the
code, but _what_ it does :). The coding style that we use is defined in
the .clang-format config file and is based on the google style, but
adapted in such a way that the number of modifications to the i3 code
base is minimal.
2014-06-15 19:07:02 +02:00
Tony Crisci c7aae56030 Refactor parse_command
parse_command returns a struct that contains useful information about
the result of a command as a whole (instead of the intermediate
representation used during parsing).

parse_command now requires the caller to allocate the yajl_gen used for
generating a json reply. This is passed as the second parameter to
parse_command. If NULL is passed, no json reply will be generated.
2014-05-31 14:59:35 +02:00
Tony Crisci 45fa4b7d23 Change the names of parser result structs
Change the name of structs CommandResult and ConfigResult to
CommandResultIR and ConfigResultIR to show they are an intermediate
representation used during parsing.
2014-05-20 19:59:01 +02:00
Tony Crisci e707e0a5fa i3bar: implement custom workspace numbers config
Implement the configuration option within the bar config directive for
custom workspace numbers with the directive `strip_workspace_numbers
yes`.

This directive strips the workspace name of the number prefix and
delimiter. When the workspace name consists only of the number, it will
default to show the number.

For example:

* "2:5" -> "5"
* "4:$" -> "$"
* "8" -> "8"

This allows customization of i3bar for alternate ordering of workspaces
which has a legitimate use for alternate keyboard layouts such as
Dvorak.

fixes #1131
2014-05-16 17:55:30 +02:00
Tony Crisci 2f42fe61d9 Feature: send complete config on barconfig_update
Send all the options in the bar block on the barconfig_update event.

This will eventually allow for dynamically updating bar colors with the
`reload` command.
2014-04-30 09:33:29 +02:00
Tony Crisci 7a5cf4aa44 Bugfix: ipc window event crash with no window
The log message at the top of ipc_send_window_event would segfault when
no xcb window is present, such as for a split container.

The log now shows the con id which is more relevant anyway.
2014-04-30 09:22:46 +02:00
Michael Stapelberg b28ddca96d Merge branch 'master' into next 2014-03-08 20:59:18 +01:00
Tony Crisci a16dfdb15e Bugfix: ipc_receive_message reply leak
The function ipc_recv_message in libi3 allocates memory to the location
of the `message` reply in src/ipc_receive_message.c with malloc and must
be freed.

This memory leak was found using valgrind.
2014-03-08 20:58:56 +01:00
Marco Hunsicker 00ee86de79 Send IPC window events for focus and title changes
This patch fixes ticket #1168 to extend the window IPC event mechanism
to send IPC events for window focus and title changes. The newly added
window events use the same format as the already established "new"
event.

Specifically this patch:

* Moves the ipc_send_window_event() function from src/manage.c into
  src/ipc.c and adds an argument for the change property of the event
* Updates src/manage.c to use the new function signature. To ensure
  that the "new" event does not send the same event data as the
  "focus" event, setting focus now happens after the "new" event
  has been sent
* Adds IPC focus event notification to src/x.c. To workaround a problem
  during window close when accessing the window name, a function has been
  added to query whether a window is actually attached to its parent. To
  avoid obsolete focus notification, a new field has been added to keep
  track of the focus without any interference by the click handling
* Adds IPC title event notification to src/handlers.c. To avoid
  obsolete title notification, a function has been added to determine
  whether a window title has actually changed
* Updates the IPC documentation to include the new events
* Updates testcases/t/205-ipc-windows.t to include the "focus" event
  in order to ensure the correct event sequence
* Adds two new unit tests, b/testcases/t/219-ipc-window-focus.t and
  b/testcases/t/220-ipc-window-title.t to ensure proper "focus" and
 "title" events
2014-02-26 22:24:19 +01:00
Michael Stapelberg 10d7c1a993 Merge branch 'master' into next 2014-01-13 23:36:47 +01:00