mirror of
https://github.com/vale981/bspwm
synced 2025-03-05 09:51:38 -05:00
New setting: pointer_follows_monitor
This commit is contained in:
parent
6296eebd13
commit
311fbc06d5
9 changed files with 51 additions and 18 deletions
14
README.md
14
README.md
|
@ -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*.
|
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.
|
- `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.
|
- `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.
|
- `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.
|
- `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.
|
- `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
|
## Environment Variables
|
||||||
|
|
||||||
|
|
|
@ -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 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=()
|
COMPREPLY=()
|
||||||
|
|
||||||
|
|
18
bspwm.1
18
bspwm.1
|
@ -275,6 +275,7 @@ Restore the history of each desktop from the content of FILE_PATH.
|
||||||
.BI quit " [EXIT_STATUS]"
|
.BI quit " [EXIT_STATUS]"
|
||||||
Quit.
|
Quit.
|
||||||
.SH SETTINGS
|
.SH SETTINGS
|
||||||
|
.P
|
||||||
Colors are either
|
Colors are either
|
||||||
.B X
|
.B X
|
||||||
color names (cf.
|
color names (cf.
|
||||||
|
@ -285,6 +286,10 @@ or
|
||||||
.I #RRGGBB
|
.I #RRGGBB
|
||||||
, booleans are
|
, booleans are
|
||||||
.IR "true " "or " false .
|
.IR "true " "or " false .
|
||||||
|
.P
|
||||||
|
All the boolean settings are
|
||||||
|
.I false
|
||||||
|
by default.
|
||||||
.TP
|
.TP
|
||||||
.I focused_border_color
|
.I focused_border_color
|
||||||
Color of the border of a focused window of a focused monitor.
|
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.
|
property of the root window.
|
||||||
.TP
|
.TP
|
||||||
.I borderless_monocle
|
.I borderless_monocle
|
||||||
Whether to remove borders for tiled windows in monocle mode.
|
Remove borders for tiled windows in monocle mode.
|
||||||
.TP
|
.TP
|
||||||
.I gapless_monocle
|
.I gapless_monocle
|
||||||
Whether to remove gaps for tiled windows in monocle mode.
|
Remove gaps for tiled windows in monocle mode.
|
||||||
.TP
|
.TP
|
||||||
.I focus_follows_pointer
|
.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
|
.TP
|
||||||
.I adaptative_raise
|
.I adaptative_raise
|
||||||
Prevent floating windows from being raised when they might cover other floating windows.
|
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.
|
property.
|
||||||
.TP
|
.TP
|
||||||
.I auto_alernate
|
.I auto_alernate
|
||||||
Whether to interpret two consecutive identical
|
Interpret two consecutive identical
|
||||||
.B use
|
.B use
|
||||||
messages as an
|
messages as an
|
||||||
.B alternate
|
.B alternate
|
||||||
message.
|
message.
|
||||||
.TP
|
.TP
|
||||||
.I focus_by_distance
|
.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
|
.SH ENVIRONMENT VARIABLES
|
||||||
.TP
|
.TP
|
||||||
.I BSPWM_SOCKET
|
.I BSPWM_SOCKET
|
||||||
|
|
|
@ -571,6 +571,11 @@ void set_setting(char *name, char *value, char *rsp)
|
||||||
focus_follows_pointer = b;
|
focus_follows_pointer = b;
|
||||||
}
|
}
|
||||||
return;
|
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) {
|
} else if (strcmp(name, "adaptative_raise") == 0) {
|
||||||
bool b;
|
bool b;
|
||||||
if (parse_bool(value, &b))
|
if (parse_bool(value, &b))
|
||||||
|
@ -644,6 +649,8 @@ void get_setting(char *name, char* rsp)
|
||||||
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(gapless_monocle));
|
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(gapless_monocle));
|
||||||
else if (strcmp(name, "focus_follows_pointer") == 0)
|
else if (strcmp(name, "focus_follows_pointer") == 0)
|
||||||
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(focus_follows_pointer));
|
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)
|
else if (strcmp(name, "adaptative_raise") == 0)
|
||||||
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(adaptative_raise));
|
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(adaptative_raise));
|
||||||
else if (strcmp(name, "apply_shadow_property") == 0)
|
else if (strcmp(name, "apply_shadow_property") == 0)
|
||||||
|
|
|
@ -63,6 +63,7 @@ void load_settings(void)
|
||||||
borderless_monocle = BORDERLESS_MONOCLE;
|
borderless_monocle = BORDERLESS_MONOCLE;
|
||||||
gapless_monocle = GAPLESS_MONOCLE;
|
gapless_monocle = GAPLESS_MONOCLE;
|
||||||
focus_follows_pointer = FOCUS_FOLLOWS_POINTER;
|
focus_follows_pointer = FOCUS_FOLLOWS_POINTER;
|
||||||
|
pointer_follows_monitor = POINTER_FOLLOWS_MONITOR;
|
||||||
adaptative_raise = ADAPTATIVE_RAISE;
|
adaptative_raise = ADAPTATIVE_RAISE;
|
||||||
apply_shadow_property = APPLY_SHADOW_PROPERTY;
|
apply_shadow_property = APPLY_SHADOW_PROPERTY;
|
||||||
auto_alternate = AUTO_ALTERNATE;
|
auto_alternate = AUTO_ALTERNATE;
|
||||||
|
|
16
settings.h
16
settings.h
|
@ -20,13 +20,14 @@
|
||||||
#define WINDOW_GAP 6
|
#define WINDOW_GAP 6
|
||||||
#define SPLIT_RATIO 0.5
|
#define SPLIT_RATIO 0.5
|
||||||
|
|
||||||
#define BORDERLESS_MONOCLE false
|
#define BORDERLESS_MONOCLE false
|
||||||
#define GAPLESS_MONOCLE false
|
#define GAPLESS_MONOCLE false
|
||||||
#define FOCUS_FOLLOWS_POINTER false
|
#define FOCUS_FOLLOWS_POINTER false
|
||||||
#define ADAPTATIVE_RAISE false
|
#define POINTER_FOLLOWS_MONITOR false
|
||||||
#define APPLY_SHADOW_PROPERTY false
|
#define ADAPTATIVE_RAISE false
|
||||||
#define AUTO_ALTERNATE false
|
#define APPLY_SHADOW_PROPERTY false
|
||||||
#define FOCUS_BY_DISTANCE false
|
#define AUTO_ALTERNATE false
|
||||||
|
#define FOCUS_BY_DISTANCE false
|
||||||
|
|
||||||
char focused_border_color[MAXLEN];
|
char focused_border_color[MAXLEN];
|
||||||
char active_border_color[MAXLEN];
|
char active_border_color[MAXLEN];
|
||||||
|
@ -53,6 +54,7 @@ double split_ratio;
|
||||||
bool borderless_monocle;
|
bool borderless_monocle;
|
||||||
bool gapless_monocle;
|
bool gapless_monocle;
|
||||||
bool focus_follows_pointer;
|
bool focus_follows_pointer;
|
||||||
|
bool pointer_follows_monitor;
|
||||||
bool adaptative_raise;
|
bool adaptative_raise;
|
||||||
bool apply_shadow_property;
|
bool apply_shadow_property;
|
||||||
bool auto_alternate;
|
bool auto_alternate;
|
||||||
|
|
3
tree.c
3
tree.c
|
@ -766,6 +766,9 @@ void select_monitor(monitor_t *m)
|
||||||
last_mon = mon;
|
last_mon = mon;
|
||||||
mon = m;
|
mon = m;
|
||||||
|
|
||||||
|
if (pointer_follows_monitor)
|
||||||
|
center_pointer(m);
|
||||||
|
|
||||||
ewmh_update_current_desktop();
|
ewmh_update_current_desktop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
window.c
7
window.c
|
@ -614,3 +614,10 @@ void clear_input_focus(void)
|
||||||
{
|
{
|
||||||
xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, root, XCB_CURRENT_TIME);
|
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);
|
||||||
|
}
|
||||||
|
|
1
window.h
1
window.h
|
@ -50,5 +50,6 @@ void enable_motion_recorder(void);
|
||||||
void disable_motion_recorder(void);
|
void disable_motion_recorder(void);
|
||||||
void update_motion_recorder(void);
|
void update_motion_recorder(void);
|
||||||
void clear_input_focus(void);
|
void clear_input_focus(void);
|
||||||
|
void center_pointer(monitor_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue