Implement the configuration option floating_modifier and document it
This commit is contained in:
parent
9a931079fd
commit
62c8d58d82
|
@ -206,6 +206,26 @@ umlauts or special characters 'and' having some comfortably reachable key
|
||||||
bindings. For example, when typing, capslock+1 or capslock+2 for switching
|
bindings. For example, when typing, capslock+1 or capslock+2 for switching
|
||||||
workspaces is totally convenient. Try it :-).
|
workspaces is totally convenient. Try it :-).
|
||||||
|
|
||||||
|
=== The floating modifier
|
||||||
|
|
||||||
|
To move floating windows with your mouse, you can either grab their titlebar
|
||||||
|
or configure the so called floating modifier which you can then press and
|
||||||
|
click anywhere in the window itself. The most common setup is to configure
|
||||||
|
it as the same one you use for managing windows (Mod1 for example). Afterwards,
|
||||||
|
you can press Mod1, click into a window using your left mouse button and drag
|
||||||
|
it to the position you want it at.
|
||||||
|
|
||||||
|
*Syntax*:
|
||||||
|
--------------------------------
|
||||||
|
floating_modifier <Modifiers>
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
*Examples*:
|
||||||
|
--------------------------------
|
||||||
|
floating_modifier Mod1
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
|
||||||
=== Variables
|
=== Variables
|
||||||
|
|
||||||
As you learned in the previous section about keyboard bindings, you will have
|
As you learned in the previous section about keyboard bindings, you will have
|
||||||
|
|
|
@ -9,6 +9,9 @@ terminal /usr/bin/urxvt
|
||||||
# ISO 10646 = Unicode
|
# ISO 10646 = Unicode
|
||||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
|
|
||||||
|
# Use Mouse+Mod1 to drag floating windows to their wanted position
|
||||||
|
floating_modifier Mod1
|
||||||
|
|
||||||
# Fullscreen (Mod1+f)
|
# Fullscreen (Mod1+f)
|
||||||
bind Mod1+41 f
|
bind Mod1+41 f
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* i3 - an improved dynamic tiling window manager
|
* i3 - an improved dynamic tiling window manager
|
||||||
*
|
*
|
||||||
* (c) 2009 Michael Stapelberg and contributors
|
* © 2009 Michael Stapelberg and contributors
|
||||||
*
|
*
|
||||||
* See file LICENSE for license information.
|
* See file LICENSE for license information.
|
||||||
*
|
*
|
||||||
|
@ -37,6 +37,10 @@ struct Config {
|
||||||
const char *terminal;
|
const char *terminal;
|
||||||
const char *font;
|
const char *font;
|
||||||
|
|
||||||
|
/** The modifier which needs to be pressed in combination with your mouse
|
||||||
|
* buttons to do things with floating windows (move, resize) */
|
||||||
|
uint32_t floating_modifier;
|
||||||
|
|
||||||
/* Color codes are stored here */
|
/* Color codes are stored here */
|
||||||
struct config_client {
|
struct config_client {
|
||||||
struct Colortriple focused;
|
struct Colortriple focused;
|
||||||
|
|
24
src/config.c
24
src/config.c
|
@ -215,6 +215,30 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcasecmp(key, "floating_modifier") == 0) {
|
||||||
|
char *walk = value;
|
||||||
|
uint32_t modifiers = 0;
|
||||||
|
|
||||||
|
while (*walk != '\0') {
|
||||||
|
/* Need to check for Mod1-5, Ctrl, Shift, Mode_switch */
|
||||||
|
CHECK_MODIFIER(SHIFT);
|
||||||
|
CHECK_MODIFIER(CONTROL);
|
||||||
|
CHECK_MODIFIER(MODE_SWITCH);
|
||||||
|
CHECK_MODIFIER(MOD1);
|
||||||
|
CHECK_MODIFIER(MOD2);
|
||||||
|
CHECK_MODIFIER(MOD3);
|
||||||
|
CHECK_MODIFIER(MOD4);
|
||||||
|
CHECK_MODIFIER(MOD5);
|
||||||
|
|
||||||
|
/* No modifier found? Then we’re done with this step */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG("Floating modifiers = %d\n", modifiers);
|
||||||
|
config.floating_modifier = modifiers;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* assign window class[/window title] → workspace */
|
/* assign window class[/window title] → workspace */
|
||||||
if (strcasecmp(key, "assign") == 0) {
|
if (strcasecmp(key, "assign") == 0) {
|
||||||
LOG("assign: \"%s\"\n", value);
|
LOG("assign: \"%s\"\n", value);
|
||||||
|
|
|
@ -302,9 +302,11 @@ int handle_button_press(void *ignored, xcb_connection_t *conn, xcb_button_press_
|
||||||
client = table_get(&by_parent, event->event);
|
client = table_get(&by_parent, event->event);
|
||||||
border_click = true;
|
border_click = true;
|
||||||
}
|
}
|
||||||
/* See if this was a click with Mod1. If so, we need to move around
|
/* See if this was a click with the configured modifier. If so, we need
|
||||||
* the client if it was floating. if not, we just process as usual. */
|
* to move around the client if it was floating. if not, we just process
|
||||||
if ((event->state & XCB_MOD_MASK_1) != 0) {
|
* as usual. */
|
||||||
|
if (config.floating_modifier != 0 &&
|
||||||
|
(event->state & config.floating_modifier) != 0) {
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
LOG("Not handling, Mod1 was pressed and no client found\n");
|
LOG("Not handling, Mod1 was pressed and no client found\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue