New setting: pointer_follows_monitor

This commit is contained in:
Bastien Dejean 2013-06-05 21:21:12 +02:00
parent 6296eebd13
commit 311fbc06d5
9 changed files with 51 additions and 18 deletions

View file

@ -201,6 +201,8 @@ The following messages are handled:
Colors are either [X color names](http://en.wikipedia.org/wiki/X11_color_names) or *#RRGGBB*, booleans are *true* or *false*.
All the boolean settings are *false* by default.
- `focused_border_color` — Color of the border of a focused window of a focused monitor.
- `active_border_color` — Color of the border of a focused window of an unfocused monitor.
@ -227,19 +229,21 @@ Colors are either [X color names](http://en.wikipedia.org/wiki/X11_color_names)
- `wm_name` — The value that shall be used for the `_NET_WM_NAME` property of the root window.
- `borderless_monocle`Whether to remove borders for tiled windows in monocle mode.
- `borderless_monocle`Remove borders for tiled windows in monocle mode.
- `gapless_monocle`Whether to remove gaps for tiled windows in monocle mode.
- `gapless_monocle`Remove gaps for tiled windows in monocle mode.
- `focus_follows_pointer` — Whether to focus the window under the pointer.
- `focus_follows_pointer` — Focus the window under the pointer.
- `pointer_follows_monitor` — When focusing a monitor, put the pointer at its center.
- `adaptative_raise` — Prevent floating windows from being raised when they might cover other floating windows.
- `apply_shadow_property` — Enable shadows for floating windows via the `_COMPTON_SHADOW` property.
- `auto_alternate`Whether to interpret two consecutive identical `use` messages as an `alternate` message.
- `auto_alternate`Interpret two consecutive identical `use` messages as an `alternate` message.
- `focus_by_distance`Whether to use window or leaf distance for focus movement.
- `focus_by_distance`Use window or leaf distance for focus movement.
## Environment Variables

View file

@ -2,7 +2,7 @@ _bspc()
{
local messages='get set list list_desktops list_monitors list_windows list_rules list_history presel cancel ratio pad focus shift swap push pull cycle nearest biggest circulate grab_pointer track_pointer ungrab_pointer toggle_fullscreen toggle_floating toggle_locked toggle_visibility close kill send_to drop_to send_to_monitor drop_to_monitor use use_monitor alternate alternate_desktop alternate_monitor add add_in rename_monitor rename remove_desktop send_desktop_to cycle_monitor cycle_desktop layout cycle_layout rotate flip balance rule remove_rule put_status adopt_orphans restore_layout restore_history quit'
local settings='focused_border_color active_border_color normal_border_color presel_border_color focused_locked_border_color active_locked_border_color normal_locked_border_color urgent_border_color border_width window_gap split_ratio top_padding right_padding bottom_padding left_padding wm_name borderless_monocle gapless_monocle focus_follows_pointer adaptative_raise apply_shadow_property auto_alternate focus_by_distance'
local settings='focused_border_color active_border_color normal_border_color presel_border_color focused_locked_border_color active_locked_border_color normal_locked_border_color urgent_border_color border_width window_gap split_ratio top_padding right_padding bottom_padding left_padding wm_name borderless_monocle gapless_monocle focus_follows_pointer pointer_follows_monitor adaptative_raise apply_shadow_property auto_alternate focus_by_distance'
COMPREPLY=()

18
bspwm.1
View file

@ -275,6 +275,7 @@ Restore the history of each desktop from the content of FILE_PATH.
.BI quit " [EXIT_STATUS]"
Quit.
.SH SETTINGS
.P
Colors are either
.B X
color names (cf.
@ -285,6 +286,10 @@ or
.I #RRGGBB
, booleans are
.IR "true " "or " false .
.P
All the boolean settings are
.I false
by default.
.TP
.I focused_border_color
Color of the border of a focused window of a focused monitor.
@ -336,13 +341,16 @@ The value that shall be used for the
property of the root window.
.TP
.I borderless_monocle
Whether to remove borders for tiled windows in monocle mode.
Remove borders for tiled windows in monocle mode.
.TP
.I gapless_monocle
Whether to remove gaps for tiled windows in monocle mode.
Remove gaps for tiled windows in monocle mode.
.TP
.I focus_follows_pointer
Whether to focus the window under the pointer.
Focus the window under the pointer.
.TP
.I pointer_follows_monitor
When focusing a monitor, put the pointer at its center.
.TP
.I adaptative_raise
Prevent floating windows from being raised when they might cover other floating windows.
@ -353,14 +361,14 @@ Enable shadows for floating windows via the
property.
.TP
.I auto_alernate
Whether to interpret two consecutive identical
Interpret two consecutive identical
.B use
messages as an
.B alternate
message.
.TP
.I focus_by_distance
Whether to use window or leaf distance for focus movement.
Use window or leaf distance for focus movement.
.SH ENVIRONMENT VARIABLES
.TP
.I BSPWM_SOCKET

View file

@ -571,6 +571,11 @@ void set_setting(char *name, char *value, char *rsp)
focus_follows_pointer = b;
}
return;
} else if (strcmp(name, "pointer_follows_monitor") == 0) {
bool b;
if (parse_bool(value, &b))
pointer_follows_monitor = b;
return;
} else if (strcmp(name, "adaptative_raise") == 0) {
bool b;
if (parse_bool(value, &b))
@ -644,6 +649,8 @@ void get_setting(char *name, char* rsp)
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(gapless_monocle));
else if (strcmp(name, "focus_follows_pointer") == 0)
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(focus_follows_pointer));
else if (strcmp(name, "pointer_follows_monitor") == 0)
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(pointer_follows_monitor));
else if (strcmp(name, "adaptative_raise") == 0)
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(adaptative_raise));
else if (strcmp(name, "apply_shadow_property") == 0)

View file

@ -63,6 +63,7 @@ void load_settings(void)
borderless_monocle = BORDERLESS_MONOCLE;
gapless_monocle = GAPLESS_MONOCLE;
focus_follows_pointer = FOCUS_FOLLOWS_POINTER;
pointer_follows_monitor = POINTER_FOLLOWS_MONITOR;
adaptative_raise = ADAPTATIVE_RAISE;
apply_shadow_property = APPLY_SHADOW_PROPERTY;
auto_alternate = AUTO_ALTERNATE;

View file

@ -20,13 +20,14 @@
#define WINDOW_GAP 6
#define SPLIT_RATIO 0.5
#define BORDERLESS_MONOCLE false
#define GAPLESS_MONOCLE false
#define FOCUS_FOLLOWS_POINTER false
#define ADAPTATIVE_RAISE false
#define APPLY_SHADOW_PROPERTY false
#define AUTO_ALTERNATE false
#define FOCUS_BY_DISTANCE false
#define BORDERLESS_MONOCLE false
#define GAPLESS_MONOCLE false
#define FOCUS_FOLLOWS_POINTER false
#define POINTER_FOLLOWS_MONITOR false
#define ADAPTATIVE_RAISE false
#define APPLY_SHADOW_PROPERTY false
#define AUTO_ALTERNATE false
#define FOCUS_BY_DISTANCE false
char focused_border_color[MAXLEN];
char active_border_color[MAXLEN];
@ -53,6 +54,7 @@ double split_ratio;
bool borderless_monocle;
bool gapless_monocle;
bool focus_follows_pointer;
bool pointer_follows_monitor;
bool adaptative_raise;
bool apply_shadow_property;
bool auto_alternate;

3
tree.c
View file

@ -766,6 +766,9 @@ void select_monitor(monitor_t *m)
last_mon = mon;
mon = m;
if (pointer_follows_monitor)
center_pointer(m);
ewmh_update_current_desktop();
}

View file

@ -614,3 +614,10 @@ void clear_input_focus(void)
{
xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, root, XCB_CURRENT_TIME);
}
void center_pointer(monitor_t *m)
{
int16_t cx = m->rectangle.x + m->rectangle.width / 2;
int16_t cy = m->rectangle.y + m->rectangle.height / 2;
xcb_warp_pointer(dpy, XCB_NONE, root, 0, 0, 0, 0, cx, cy);
}

View file

@ -50,5 +50,6 @@ void enable_motion_recorder(void);
void disable_motion_recorder(void);
void update_motion_recorder(void);
void clear_input_focus(void);
void center_pointer(monitor_t *);
#endif