1. Add a function writeall and make swrite wrap that function. Use either writeall or swrite, depending on whether we want to exit on errors or not.
2. Fix warnings when compiling with a higher optimisation level.
(CFLAGS ?= -pipe -O3 -march=native -mtune=native -freorder-blocks-and-partition)
Signed-off-by: hwangcc <hwangcc@csie.nctu.edu.tw>
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
Add `markup` to the i3bar protocol as a block member.
This is a string that determines how the block should be parsed as
markup. "pango" indicates the block should be parsed as Pango markup.
"none" indicates the block should not be parsed as markup.
Parse text within workspace buttons and the i3bar statusline as Pango
markup. This lets people specify things like font weight, text color,
background color, font size, and font family in the text of i3bar.
fixes#1468
Add support for the _NET_WM_MOVERESIZE client message. This message
enables clients to initiate window moving or resizing. Toolkits like
Gtk3 use this message when the user drags a client-side decorated window
by its title bar. When Gtk detects that the window manager does not
support this client message, it uses a slow fallback implementation.
fixes#1432
When loading a new font with `load_font`, free the previously loaded
font with `free_font`.
If no font is loaded, `free_font` will simply return (instead of
crashing because of a double free).
Add the `--whole-window` switch for mouse bindings. This switch controls
what part of the container the pointer must be over to trigger a mouse
binding. The default is to only trigger mouse bindings over the
titlebars. With this switch, a mouse binding will be triggered over the
main part of the window as well.
This is a breaking change to the previous behavior, which would trigger
a mouse binding with a modifier over any part of the window.
fixes#1429
Since this commit:
f691a55923
the shell that is used is the system's bourne shell (/bin/sh) and the
env variable SHELL is not considered.
No logic changes.
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
Rather than just toggling the fullscreen modes, allow to set them
directly with:
fullscreen enable|toggle [global]
fullscreen disable
For compatibility, retain the previous command and its toggling behavior:
fullscreen [global]
fixes#1120
Copy the binding struct before running it and use this copy to emit the
binding event.
This fixes a crash when the command `reload` is used in a binding when
the binding event is emitted.
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
We're going to call parse_configuration() very early if -C is given on
the command line. Instead of the previous "only_check_config", which has
been a global variable, we now simply pass use_nagbar as false if we're
just validating.
This causes the whole parsing to run without X and of course without
starting nagbar and displaying the errors to standard out/error instead.
The return code of parse_configuration() is now a boolean which
represents whether an error occured during parsing and the programs exit
code is returned accordingly.
Although the config parser still has a lot of side-effects, we now can
parse without the need to have an XCB connection. A nicer implementation
would be to just set the new font and load it just after we're done
parsing, but to ensure we don't break functionality we just load a dummy
FONT_TYPE_NONE if XCB isn't available. The main reason for going this
route is that it's a bit difficult to test fonts in a distribution
agnostic way without bundling fonts with i3 (or Xdummy to be more
exact).
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
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
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.4
> IconicState - The client's top-level window is iconic (whatever that
> means for this window manager). The client can assume that its
> top-level window is not viewable, its icon_window (if any) will be
> viewable and, failing that, its icon_pixmap (if any) or its
> WM_ICON_NAME will be displayed.
For these requests, we just close the window.
fixes#1279
Maintain the _NET_DESKTOP_NAMES property on the root window.
http://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368131760
> _NET_DESKTOP_NAMES
>
> _NET_DESKTOP_NAMES, UTF8_STRING[]
>
> The names of all virtual desktops. This is a list of NULL-terminated
> strings in UTF-8 encoding [UTF8]. This property MAY be changed by a
> Pager or the Window Manager at any time.
A container selected with criteria should be moved with the `move
[direction]` command, instead of this command always acting on the
focused container.
This removes our last dependency on Xlib! :)
(Okay, an Xlib dependency still comes in through other libraries that we
link against, but it’s not us. Our code is simpler by this change and
uses one less connection to X11.)
A configured mouse binding (for example `bindsym button3 kill`) runs
its command when the mouse button is pressed over parts of a container.
If the binding has no modifer, it will only run when the button is
clicked on the window titlebar.
Otherwise if the binding has a modifier, it will run over the titlebar
or any part of the contained window.
fixes#558
_NET_NUMBER_OF_DESKTOPS:
> This property SHOULD be set and updated by the Window Manager to
> indicate the number of virtual desktops.
We interpret this property as the number of noninternal workspaces.
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.
Add run_binding function to bindings.h.
> Runs the given binding and handles parse errors. Returns a
> CommandResult for running the binding's command. Caller should render
> tree if needs_tree_render is true. Free with command_result_free().
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.
This patch adds a new configuration option "mouse_warping [output|none]".
When mouse warping is disabled, mouse cursor does not jump to middle of current
screen when changing workspaces between multiple outputs. This introduces a
"special" cursor state, where focus is in one window and cursor on another.
Useful for eg. scrolling a web page with mouse wheel while typing into another
window on keyboard.
Workspace assignments with bare numbers assign all workspaces with that
number to the specified output.
Workspace assignment by number is overridden by workspace assignment by
name.
Change the name of structs CommandResult and ConfigResult to
CommandResultIR and ConfigResultIR to show they are an intermediate
representation used during parsing.
Floating windows already had their own border style, but the width was
the same for all windows.
The configuration directives 'new_window' and 'new_float' can now be
used simultaneously to have different border widths for floating and
tiled windows.
fixes#1244
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
Change the primary binding accessor to `get_binding_from_xcb_event`.
This function gets a binding from a generic xcb event of type KeyPress,
KeyRelease, ButtonPress, or ButtonRelease by determining the input type
(keyboard or mouse), the modifiers pressed from the filtered event
`state`, managing the proper fall back in case mode switch is enabled,
and finally querying the bindings for a binding that matches the event.
The logic of querying keyboard bindings is not intended to be altered by
this change.
The general accessor has been slightly modified to work with mouse
bindings and made private because it is only used in bindings.c