Compare commits
10 Commits
295cdd33e9
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 27f4b1dd38 | |||
|
|
d7de4ff112 | ||
|
|
0e0fa13f32 | ||
|
|
d36e287884 | ||
|
|
4a072964ec | ||
|
|
d26a0a50f3 | ||
|
|
7ae527002b | ||
|
|
3338221805 | ||
|
|
de1043ece3 | ||
|
|
62136f2977 |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.env
|
||||||
|
xoat
|
||||||
|
xoat-debug
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
xoat
|
xoat
|
||||||
====
|
====
|
||||||
|
|
||||||
|
Fork of [seanpringle](https://github.com/seanpringle)/[xoat](https://github.com/seanpringle/xoat)
|
||||||
|
|
||||||
*X Obstinate Asymmetric Tiler*
|
*X Obstinate Asymmetric Tiler*
|
||||||
|
|
||||||
* Designed for wide screens, including multi-head support.
|
* Designed for wide screens, including multi-head support.
|
||||||
|
|||||||
19
action.c
19
action.c
@@ -27,8 +27,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
void action_move(void *data, int num, Client *cli)
|
void action_move(void *data, int num, Client *cli)
|
||||||
{
|
{
|
||||||
if (!cli) return;
|
if (!cli) return;
|
||||||
client_raise_family(cli);
|
|
||||||
client_place_spot(cli, num, cli->monitor, 1);
|
client_place_spot(cli, num, cli->monitor, 1);
|
||||||
|
client_raise_family(cli);
|
||||||
current_spot = cli->spot; current_mon = cli->monitor;
|
current_spot = cli->spot; current_mon = cli->monitor;
|
||||||
spot_warp_pointer(cli->spot, cli->monitor);
|
spot_warp_pointer(cli->spot, cli->monitor);
|
||||||
}
|
}
|
||||||
@@ -36,8 +36,8 @@ void action_move(void *data, int num, Client *cli)
|
|||||||
void action_move_direction(void *data, int num, Client *cli)
|
void action_move_direction(void *data, int num, Client *cli)
|
||||||
{
|
{
|
||||||
if (!cli) return;
|
if (!cli) return;
|
||||||
client_raise_family(cli);
|
|
||||||
client_place_spot(cli, spot_choose_by_direction(cli->spot, cli->monitor, num), cli->monitor, 1);
|
client_place_spot(cli, spot_choose_by_direction(cli->spot, cli->monitor, num), cli->monitor, 1);
|
||||||
|
client_raise_family(cli);
|
||||||
current_spot = cli->spot; current_mon = cli->monitor;
|
current_spot = cli->spot; current_mon = cli->monitor;
|
||||||
spot_warp_pointer(cli->spot, cli->monitor);
|
spot_warp_pointer(cli->spot, cli->monitor);
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ void action_find_or_start(void *data, int num, Client *cli)
|
|||||||
{
|
{
|
||||||
int i; Client *c; char *class = data;
|
int i; Client *c; char *class = data;
|
||||||
for_windows(i, c)
|
for_windows(i, c)
|
||||||
if (c->visible && c->manage && c->class && !strcasecmp(c->class, class))
|
if (c->visible && c->manage && c->class && strcasestr(c->class, class))
|
||||||
{ client_activate(c); spot_warp_pointer(c->spot, c->monitor); return; }
|
{ client_activate(c); spot_warp_pointer(c->spot, c->monitor); return; }
|
||||||
exec_cmd(class);
|
exec_cmd(class);
|
||||||
}
|
}
|
||||||
@@ -100,16 +100,16 @@ void action_find_or_start(void *data, int num, Client *cli)
|
|||||||
void action_move_monitor(void *data, int num, Client *cli)
|
void action_move_monitor(void *data, int num, Client *cli)
|
||||||
{
|
{
|
||||||
if (!cli) return;
|
if (!cli) return;
|
||||||
client_raise_family(cli);
|
cli->monitor = monitor_choose_by_direction(current_mon, num);
|
||||||
cli->monitor = MAX(0, MIN(current_mon+num, nmonitors-1));
|
|
||||||
client_place_spot(cli, cli->spot, cli->monitor, 1);
|
client_place_spot(cli, cli->spot, cli->monitor, 1);
|
||||||
|
client_raise_family(cli);
|
||||||
current_mon = cli->monitor;
|
current_mon = cli->monitor;
|
||||||
spot_warp_pointer(cli->spot, cli->monitor);
|
spot_warp_pointer(cli->spot, cli->monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_focus_monitor(void *data, int num, Client *cli)
|
void action_focus_monitor(void *data, int num, Client *cli)
|
||||||
{
|
{
|
||||||
int i, mon = MAX(0, MIN(current_mon+num, nmonitors-1));
|
int i, mon = monitor_choose_by_direction(current_mon, num);
|
||||||
if (!spot_focus_top_window(current_spot, mon, None))
|
if (!spot_focus_top_window(current_spot, mon, None))
|
||||||
for_spots(i) if (spot_focus_top_window(i, mon, None)) break;
|
for_spots(i) if (spot_focus_top_window(i, mon, None)) break;
|
||||||
spot_warp_pointer(current_spot, current_mon);
|
spot_warp_pointer(current_spot, current_mon);
|
||||||
@@ -152,6 +152,13 @@ void action_maximize_horz(void *data, int num, Client *cli)
|
|||||||
client_place_spot(cli, cli->spot, cli->monitor, 1);
|
client_place_spot(cli, cli->spot, cli->monitor, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void action_above(void *data, int num, Client *cli)
|
||||||
|
{
|
||||||
|
if (!cli) return;
|
||||||
|
cli->above = client_toggle_state(cli, atoms[_NET_WM_STATE_ABOVE]);
|
||||||
|
client_place_spot(cli, cli->spot, cli->monitor, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void action_menu(void *data, int num, Client *cli)
|
void action_menu(void *data, int num, Client *cli)
|
||||||
{
|
{
|
||||||
menu_create(current_spot, current_mon);
|
menu_create(current_spot, current_mon);
|
||||||
|
|||||||
1
atom.c
1
atom.c
@@ -53,6 +53,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
X(_NET_WM_STATE_MAXIMIZE_VERT),\
|
X(_NET_WM_STATE_MAXIMIZE_VERT),\
|
||||||
X(_NET_WM_STATE_MAXIMIZE_HORZ),\
|
X(_NET_WM_STATE_MAXIMIZE_HORZ),\
|
||||||
X(_NET_WM_STATE_DEMANDS_ATTENTION),\
|
X(_NET_WM_STATE_DEMANDS_ATTENTION),\
|
||||||
|
X(_NET_WM_STATE_ABOVE),\
|
||||||
X(WM_NAME),\
|
X(WM_NAME),\
|
||||||
X(WM_DELETE_WINDOW),\
|
X(WM_DELETE_WINDOW),\
|
||||||
X(WM_CLIENT_LEADER),\
|
X(WM_CLIENT_LEADER),\
|
||||||
|
|||||||
10
client.c
10
client.c
@@ -112,6 +112,7 @@ Client* window_build_client(Window win)
|
|||||||
c->full = client_has_state(c, atoms[_NET_WM_STATE_FULLSCREEN]);
|
c->full = client_has_state(c, atoms[_NET_WM_STATE_FULLSCREEN]);
|
||||||
c->maxv = client_has_state(c, atoms[_NET_WM_STATE_MAXIMIZE_VERT]);
|
c->maxv = client_has_state(c, atoms[_NET_WM_STATE_MAXIMIZE_VERT]);
|
||||||
c->maxh = client_has_state(c, atoms[_NET_WM_STATE_MAXIMIZE_HORZ]);
|
c->maxh = client_has_state(c, atoms[_NET_WM_STATE_MAXIMIZE_HORZ]);
|
||||||
|
c->above = client_has_state(c, atoms[_NET_WM_STATE_ABOVE]);
|
||||||
|
|
||||||
GETPROP_LONG(win, atoms[XOAT_MAXIMIZE], &c->max, 1);
|
GETPROP_LONG(win, atoms[XOAT_MAXIMIZE], &c->max, 1);
|
||||||
|
|
||||||
@@ -297,8 +298,13 @@ void client_raise_family(Client *c)
|
|||||||
if (!c) return;
|
if (!c) return;
|
||||||
int i; Client *o; STACK_INIT(raise); STACK_INIT(family);
|
int i; Client *o; STACK_INIT(raise); STACK_INIT(family);
|
||||||
|
|
||||||
for_windows(i, o) if (o->type == atoms[_NET_WM_WINDOW_TYPE_DOCK])
|
for_windows(i, o)
|
||||||
client_stack_family(o, &raise);
|
{
|
||||||
|
if (o->type == atoms[_NET_WM_WINDOW_TYPE_DOCK])
|
||||||
|
client_stack_family(o, &raise);
|
||||||
|
if (o->above && c->spot != SPOT3 && o->spot == SPOT3)
|
||||||
|
client_stack_family(o, &raise);
|
||||||
|
}
|
||||||
|
|
||||||
while (c->transient && (o = window_build_client(c->transient)) && o->manage)
|
while (c->transient && (o = window_build_client(c->transient)) && o->manage)
|
||||||
c = family.clients[family.depth++] = o;
|
c = family.clients[family.depth++] = o;
|
||||||
|
|||||||
13
config.c
13
config.c
@@ -37,9 +37,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
#define CONFIG_MENU "menu"
|
#define CONFIG_MENU "menu"
|
||||||
|
|
||||||
#define CONFIG_UINT_NAMES CONFIG_BORDER "|" CONFIG_GAP "|" CONFIG_TITLE_ELLIPSIS
|
#define CONFIG_UINT_NAMES CONFIG_BORDER "|" CONFIG_GAP "|" CONFIG_TITLE_ELLIPSIS
|
||||||
#define CONFIG_STR_NAMES CONFIG_BORDER_BLUR "|" CONFIG_BORDER_FOCUS "|" CONFIG_BORDER_URGENT "|" CONFIG_TITLE "|" CONFIG_TITLE_BLUR "|" CONFIG_TITLE_FOCUS "|" CONFIG_MENU
|
#define CONFIG_STR_NAMES CONFIG_BORDER_BLUR "|" CONFIG_BORDER_FOCUS "|" CONFIG_BORDER_URGENT "|" CONFIG_TITLE "|" \
|
||||||
|
CONFIG_TITLE_BLUR "|" CONFIG_TITLE_FOCUS "|" CONFIG_MENU
|
||||||
|
|
||||||
#define CONFIG_ACTIONS "action_move_direction|action_focus_direction|action_move|action_focus|action_close|action_cycle|action_raise_nth|action_command|action_find_or_start|action_move_monitor|action_focus_monitor|action_fullscreen|action_maximize_vert|action_maximize_horz|action_maximize|action_menu"
|
#define CONFIG_ACTIONS "action_move_direction|action_move_monitor|action_focus_monitor|action_focus_direction" \
|
||||||
|
"|action_move|action_focus|action_close|action_cycle|action_raise_nth|action_command|action_find_or_start" \
|
||||||
|
"|action_fullscreen|action_maximize_vert|action_maximize_horz|action_maximize|action_above|action_menu"
|
||||||
|
|
||||||
void
|
void
|
||||||
rtrim(char *str)
|
rtrim(char *str)
|
||||||
@@ -370,6 +373,7 @@ configure()
|
|||||||
"action_maximize_vert",
|
"action_maximize_vert",
|
||||||
"action_maximize_horz",
|
"action_maximize_horz",
|
||||||
"action_maximize",
|
"action_maximize",
|
||||||
|
"action_above",
|
||||||
"action_menu",
|
"action_menu",
|
||||||
};
|
};
|
||||||
void *actions[] = {
|
void *actions[] = {
|
||||||
@@ -388,6 +392,7 @@ configure()
|
|||||||
action_maximize_vert,
|
action_maximize_vert,
|
||||||
action_maximize_horz,
|
action_maximize_horz,
|
||||||
action_maximize,
|
action_maximize,
|
||||||
|
action_above,
|
||||||
action_menu,
|
action_menu,
|
||||||
};
|
};
|
||||||
for (i = 0; i < sizeof(names) / sizeof(char*); i++)
|
for (i = 0; i < sizeof(names) / sizeof(char*); i++)
|
||||||
@@ -406,7 +411,7 @@ configure()
|
|||||||
if (strcmp(regex_matches[3], "spot3") == 0) num = SPOT3;
|
if (strcmp(regex_matches[3], "spot3") == 0) num = SPOT3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (0 == strcmp(regex_matches[2], "action_move_direction") || 0 == strcmp(regex_matches[2], "action_focus_direction"))
|
if (0 == strcmp(regex_matches[2], "action_move_direction") || 0 == strcmp(regex_matches[2], "action_focus_direction") || 0 == strcmp(regex_matches[2], "action_move_monitor") || 0 == strcmp(regex_matches[2], "action_focus_monitor"))
|
||||||
{
|
{
|
||||||
if (strcmp(regex_matches[3], "left" ) == 0) num = LEFT;
|
if (strcmp(regex_matches[3], "left" ) == 0) num = LEFT;
|
||||||
if (strcmp(regex_matches[3], "right") == 0) num = RIGHT;
|
if (strcmp(regex_matches[3], "right") == 0) num = RIGHT;
|
||||||
@@ -419,7 +424,7 @@ configure()
|
|||||||
data = regex_matches[3];
|
data = regex_matches[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (0 == strcmp(regex_matches[2], "action_raise_nth") || 0 == strcmp(regex_matches[2], "action_move_monitor") || 0 == strcmp(regex_matches[2], "action_focus_monitor"))
|
if (0 == strcmp(regex_matches[2], "action_raise_nth"))
|
||||||
{
|
{
|
||||||
num = strtol(regex_matches[3], NULL, 10);
|
num = strtol(regex_matches[3], NULL, 10);
|
||||||
}
|
}
|
||||||
|
|||||||
11
config.h
11
config.h
@@ -49,8 +49,9 @@
|
|||||||
|
|
||||||
Layout layouts[] = {
|
Layout layouts[] = {
|
||||||
// Look at xrandr output to determine your monitor order.
|
// Look at xrandr output to determine your monitor order.
|
||||||
{ .spot_start = SMART, .spot1_align = LEFT, .spot1_width_pct = 60, .spot2_height_pct = 60 }, // primary monitor
|
{ .spot_start = SMART, .spot1_align = LEFT, .spot1_width_pct = 60, .spot2_height_pct = 50 }, // primary monitor
|
||||||
{ .spot_start = SMART, .spot1_align = RIGHT, .spot1_width_pct = 60, .spot2_height_pct = 60 }, // secondary monitor, etc...
|
{ .spot_start = SMART, .spot1_align = LEFT, .spot1_width_pct = 60, .spot2_height_pct = 60 }, // secondary monitor, etc...
|
||||||
|
{ .spot_start = SMART, .spot1_align = LEFT, .spot1_width_pct = 60, .spot2_height_pct = 60 }, // secondary monitor, etc...
|
||||||
};
|
};
|
||||||
|
|
||||||
// Available actions...
|
// Available actions...
|
||||||
@@ -62,12 +63,13 @@ Layout layouts[] = {
|
|||||||
// action_cycle
|
// action_cycle
|
||||||
// action_command
|
// action_command
|
||||||
// action_find_or_start
|
// action_find_or_start
|
||||||
// action_move_monitor
|
// action_move_monitor .num = UP/DOWN/LEFT/RIGHT
|
||||||
// action_focus_monitor
|
// action_focus_monitor .num = UP/DOWN/LEFT/RIGHT
|
||||||
// action_fullscreen
|
// action_fullscreen
|
||||||
// action_maximize_vert
|
// action_maximize_vert
|
||||||
// action_maximize_horz
|
// action_maximize_horz
|
||||||
// action_maximize
|
// action_maximize
|
||||||
|
// action_above
|
||||||
// action_menu
|
// action_menu
|
||||||
|
|
||||||
// If using "AnyModifier" place those keys at the end of the array.
|
// If using "AnyModifier" place those keys at the end of the array.
|
||||||
@@ -102,6 +104,7 @@ Binding keys[] = {
|
|||||||
{ .mod = Mod4Mask, .key = XK_v, .act = action_maximize_vert },
|
{ .mod = Mod4Mask, .key = XK_v, .act = action_maximize_vert },
|
||||||
{ .mod = Mod4Mask, .key = XK_h, .act = action_maximize_horz },
|
{ .mod = Mod4Mask, .key = XK_h, .act = action_maximize_horz },
|
||||||
{ .mod = Mod4Mask, .key = XK_m, .act = action_maximize },
|
{ .mod = Mod4Mask, .key = XK_m, .act = action_maximize },
|
||||||
|
{ .mod = Mod4Mask, .key = XK_a, .act = action_above },
|
||||||
|
|
||||||
// Launcher
|
// Launcher
|
||||||
{ .mod = Mod4Mask, .key = XK_x, .act = action_command, .data = "dmenu_run" },
|
{ .mod = Mod4Mask, .key = XK_x, .act = action_command, .data = "dmenu_run" },
|
||||||
|
|||||||
22
event.c
22
event.c
@@ -102,7 +102,8 @@ void map_notify(XEvent *e)
|
|||||||
{
|
{
|
||||||
client_raise_family(c);
|
client_raise_family(c);
|
||||||
client_update_border(c);
|
client_update_border(c);
|
||||||
client_set_focus(c);
|
if (!c->menu) // Only set focus if it's not a menu/popup
|
||||||
|
client_set_focus(c);
|
||||||
client_free(a);
|
client_free(a);
|
||||||
ewmh_client_list();
|
ewmh_client_list();
|
||||||
update_bars();
|
update_bars();
|
||||||
@@ -113,12 +114,14 @@ void map_notify(XEvent *e)
|
|||||||
|
|
||||||
void unmap_notify(XEvent *e)
|
void unmap_notify(XEvent *e)
|
||||||
{
|
{
|
||||||
// if this window was focused, find something else
|
Client *c = window_build_client(e->xunmap.window);
|
||||||
if (e->xunmap.window == current && !spot_focus_top_window(current_spot, current_mon, current))
|
// if this window was focused, and it's not a menu/popup, find something else
|
||||||
|
if (c && !c->menu && e->xunmap.window == current && !spot_focus_top_window(current_spot, current_mon, current))
|
||||||
{
|
{
|
||||||
int i; for_spots(i)
|
int i; for_spots(i)
|
||||||
if (spot_focus_top_window(i, current_mon, current)) break;
|
if (spot_focus_top_window(i, current_mon, current)) break;
|
||||||
}
|
}
|
||||||
|
client_free(c);
|
||||||
ewmh_client_list();
|
ewmh_client_list();
|
||||||
update_bars();
|
update_bars();
|
||||||
menu_update();
|
menu_update();
|
||||||
@@ -126,7 +129,8 @@ void unmap_notify(XEvent *e)
|
|||||||
|
|
||||||
void key_press(XEvent *ev)
|
void key_press(XEvent *ev)
|
||||||
{
|
{
|
||||||
XKeyEvent *e = &ev->xkey; latest = e->time;
|
XKeyEvent *e = &ev->xkey;
|
||||||
|
latest_action = e->time;
|
||||||
KeySym key = XkbKeycodeToKeysym(display, e->keycode, 0, 0);
|
KeySym key = XkbKeycodeToKeysym(display, e->keycode, 0, 0);
|
||||||
unsigned int state = e->state & ~(LockMask|NumlockMask);
|
unsigned int state = e->state & ~(LockMask|NumlockMask);
|
||||||
while (XCheckTypedEvent(display, KeyPress, ev));
|
while (XCheckTypedEvent(display, KeyPress, ev));
|
||||||
@@ -163,17 +167,18 @@ void key_press(XEvent *ev)
|
|||||||
void button_press(XEvent *ev)
|
void button_press(XEvent *ev)
|
||||||
{
|
{
|
||||||
int i, j; Monitor *m;
|
int i, j; Monitor *m;
|
||||||
XButtonEvent *e = &ev->xbutton; latest = e->time;
|
XButtonEvent *e = &ev->xbutton;
|
||||||
|
latest_action = e->time;
|
||||||
Client *c = window_build_client(e->subwindow);
|
Client *c = window_build_client(e->subwindow);
|
||||||
if (c && c->manage)
|
if (c && c->manage)
|
||||||
client_activate(c);
|
client_activate(c);
|
||||||
else
|
else
|
||||||
if (TITLE)
|
if (settings.title)
|
||||||
for_monitors(i, m) for_spots(j)
|
for_monitors(i, m) for_spots(j)
|
||||||
if (m->bars[j]->window == e->subwindow)
|
if (m->bars[i] && m->bars[j]->window == e->subwindow)
|
||||||
spot_focus_top_window(j, i, None);
|
spot_focus_top_window(j, i, None);
|
||||||
client_free(c);
|
client_free(c);
|
||||||
XAllowEvents(display, ReplayPointer, CurrentTime);
|
XAllowEvents(display, ReplayPointer, latest_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_message(XEvent *ev)
|
void client_message(XEvent *ev)
|
||||||
@@ -195,7 +200,6 @@ void client_message(XEvent *ev)
|
|||||||
if (e->message_type == atoms[_NET_ACTIVE_WINDOW])
|
if (e->message_type == atoms[_NET_ACTIVE_WINDOW])
|
||||||
{
|
{
|
||||||
client_activate(c);
|
client_activate(c);
|
||||||
spot_warp_pointer(c->spot, c->monitor);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (e->message_type == atoms[_NET_CLOSE_WINDOW])
|
if (e->message_type == atoms[_NET_CLOSE_WINDOW])
|
||||||
|
|||||||
71
monitor.c
Normal file
71
monitor.c
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
MIT/X11 License
|
||||||
|
Copyright (c) 2016 Sean Pringle <sean.pringle@gmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
int monitor_choose_by_direction(int cmon, int dir)
|
||||||
|
{
|
||||||
|
int mon = cmon;
|
||||||
|
int i; Monitor *m;
|
||||||
|
if (dir == LEFT)
|
||||||
|
{
|
||||||
|
for_monitors(i, m)
|
||||||
|
if (OVERLAP(m->y, m->h, monitors[cmon].y, monitors[cmon].h) && m->x < monitors[cmon].x && (mon == cmon || m->x >= monitors[mon].x))
|
||||||
|
mon = i;
|
||||||
|
if (mon == cmon) for_monitors(i, m)
|
||||||
|
if (m->x < monitors[cmon].x && (mon == cmon || m->x >= monitors[mon].x))
|
||||||
|
mon = i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (dir == RIGHT)
|
||||||
|
{
|
||||||
|
for_monitors(i, m)
|
||||||
|
if (OVERLAP(m->y, m->h, monitors[cmon].y, monitors[cmon].h) && m->x >= monitors[cmon].x + monitors[cmon].w && (mon == cmon || m->x <= monitors[mon].x))
|
||||||
|
mon = i;
|
||||||
|
if (mon == cmon) for_monitors(i, m)
|
||||||
|
if (m->x >= monitors[cmon].x + monitors[cmon].w && (mon == cmon || m->x <= monitors[mon].x))
|
||||||
|
mon = i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (dir == UP)
|
||||||
|
{
|
||||||
|
for_monitors(i, m)
|
||||||
|
if (OVERLAP(m->x, m->w, monitors[cmon].x, monitors[cmon].w) && m->y < monitors[cmon].y && (mon == cmon || m->y >= monitors[mon].y))
|
||||||
|
mon = i;
|
||||||
|
if (mon == cmon) for_monitors(i, m)
|
||||||
|
if (m->y < monitors[cmon].y && (mon == cmon || m->y >= monitors[mon].y))
|
||||||
|
mon = i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (dir == DOWN)
|
||||||
|
{
|
||||||
|
for_monitors(i, m)
|
||||||
|
if (OVERLAP(m->x, m->w, monitors[cmon].x, monitors[cmon].w) && m->y >= monitors[cmon].y + monitors[cmon].h && (mon == cmon || m->y <= monitors[mon].y))
|
||||||
|
mon = i;
|
||||||
|
if (mon == cmon) for_monitors(i, m)
|
||||||
|
if (m->y >= monitors[cmon].y + monitors[cmon].h && (mon == cmon || m->y <= monitors[mon].y))
|
||||||
|
mon = i;
|
||||||
|
}
|
||||||
|
return mon;
|
||||||
|
}
|
||||||
4
setup.c
4
setup.c
@@ -103,6 +103,10 @@ void setup()
|
|||||||
}
|
}
|
||||||
memmove(monitors, padded, sizeof(Monitor) * MONITORS);
|
memmove(monitors, padded, sizeof(Monitor) * MONITORS);
|
||||||
|
|
||||||
|
// if spot_start is CURRENT, first window needs somewhere to go
|
||||||
|
current_spot = SPOT1;
|
||||||
|
current_mon = 0;
|
||||||
|
|
||||||
// calculate spot boxes
|
// calculate spot boxes
|
||||||
for_monitors(i, m)
|
for_monitors(i, m)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ void textbox_extents(Textbox *tb)
|
|||||||
int length = strlen(tb->text) + strlen(tb->prompt);
|
int length = strlen(tb->text) + strlen(tb->prompt);
|
||||||
char *line = calloc(length + 1, sizeof(char));
|
char *line = calloc(length + 1, sizeof(char));
|
||||||
sprintf(line, "%s%s", tb->prompt, tb->text);
|
sprintf(line, "%s%s", tb->prompt, tb->text);
|
||||||
XftTextExtents8(display, tb->font, (unsigned char*)line, length, &tb->extents);
|
XftTextExtentsUtf8(display, tb->font, (unsigned char*)line, length, &tb->extents);
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ void textbox_draw(Textbox *tb)
|
|||||||
if (length > 0 && isspace(line[length-1])) line[length-1] = '.';
|
if (length > 0 && isspace(line[length-1])) line[length-1] = '.';
|
||||||
|
|
||||||
// calc cursor position
|
// calc cursor position
|
||||||
XftTextExtents8(display, tb->font, (unsigned char*)line, cursor_offset, &extents);
|
XftTextExtentsUtf8(display, tb->font, (unsigned char*)line, cursor_offset, &extents);
|
||||||
cursor_x = extents.width;
|
cursor_x = extents.width;
|
||||||
|
|
||||||
// restore correct text string
|
// restore correct text string
|
||||||
@@ -206,7 +206,7 @@ void textbox_draw(Textbox *tb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calc full input text width
|
// calc full input text width
|
||||||
XftTextExtents8(display, tb->font, (unsigned char*)line, length, &extents);
|
XftTextExtentsUtf8(display, tb->font, (unsigned char*)line, length, &extents);
|
||||||
int line_width = extents.width;
|
int line_width = extents.width;
|
||||||
|
|
||||||
int x = 0, y = tb->font->ascent;
|
int x = 0, y = tb->font->ascent;
|
||||||
@@ -214,7 +214,7 @@ void textbox_draw(Textbox *tb)
|
|||||||
if (tb->flags & TB_CENTER) x = MAX(0, (tb->w - line_width) / 2);
|
if (tb->flags & TB_CENTER) x = MAX(0, (tb->w - line_width) / 2);
|
||||||
|
|
||||||
// draw the text, including any prompt in edit mode
|
// draw the text, including any prompt in edit mode
|
||||||
XftDrawString8(draw, &tb->color_fg, tb->font, x, y, (unsigned char*)line, length);
|
XftDrawStringUtf8(draw, &tb->color_fg, tb->font, x, y, (unsigned char*)line, length);
|
||||||
|
|
||||||
// draw the cursor
|
// draw the cursor
|
||||||
if (tb->flags & TB_EDITABLE)
|
if (tb->flags & TB_EDITABLE)
|
||||||
|
|||||||
2
window.c
2
window.c
@@ -92,7 +92,7 @@ int window_send_clientmessage(Window target, Window subject, Atom atom, unsigned
|
|||||||
e.xclient.message_type = atom;
|
e.xclient.message_type = atom;
|
||||||
e.xclient.window = subject;
|
e.xclient.window = subject;
|
||||||
e.xclient.data.l[0] = protocol;
|
e.xclient.data.l[0] = protocol;
|
||||||
e.xclient.data.l[1] = latest;
|
e.xclient.data.l[1] = latest_action;
|
||||||
e.xclient.send_event = True;
|
e.xclient.send_event = True;
|
||||||
e.xclient.format = 32;
|
e.xclient.format = 32;
|
||||||
int r = XSendEvent(display, target, False, mask, &e) ?1:0;
|
int r = XSendEvent(display, target, False, mask, &e) ?1:0;
|
||||||
|
|||||||
6
xoat.c
6
xoat.c
@@ -89,7 +89,7 @@ typedef struct _Client {
|
|||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
Window transient, leader;
|
Window transient, leader;
|
||||||
Atom type, states[ATOMLIST+1];
|
Atom type, states[ATOMLIST+1];
|
||||||
short monitor, visible, manage, input, urgent, full, ours, maxv, maxh, bar, menu;
|
short monitor, visible, manage, input, urgent, full, ours, maxv, maxh, bar, menu, above;
|
||||||
unsigned long spot, max;
|
unsigned long spot, max;
|
||||||
char *class;
|
char *class;
|
||||||
} Client;
|
} Client;
|
||||||
@@ -153,6 +153,7 @@ void action_fullscreen(void*, int, Client*);
|
|||||||
void action_maximize_vert(void*, int, Client*);
|
void action_maximize_vert(void*, int, Client*);
|
||||||
void action_maximize_horz(void*, int, Client*);
|
void action_maximize_horz(void*, int, Client*);
|
||||||
void action_maximize(void*, int, Client*);
|
void action_maximize(void*, int, Client*);
|
||||||
|
void action_above(void*, int, Client*);
|
||||||
void action_menu(void*, int, Client*);
|
void action_menu(void*, int, Client*);
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -189,7 +190,7 @@ void action_menu(void*, int, Client*);
|
|||||||
#define for_monitors(i, m)\
|
#define for_monitors(i, m)\
|
||||||
for ((i) = 0; (i) < nmonitors && (m = &monitors[(i)]); (i)++)
|
for ((i) = 0; (i) < nmonitors && (m = &monitors[(i)]); (i)++)
|
||||||
|
|
||||||
Time latest;
|
Time latest_action;
|
||||||
char *self;
|
char *self;
|
||||||
unsigned int NumlockMask;
|
unsigned int NumlockMask;
|
||||||
Monitor monitors[MONITORS];
|
Monitor monitors[MONITORS];
|
||||||
@@ -215,6 +216,7 @@ void exec_cmd(char *cmd)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "monitor.c"
|
||||||
#include "window.c"
|
#include "window.c"
|
||||||
#include "ewmh.c"
|
#include "ewmh.c"
|
||||||
#include "client.c"
|
#include "client.c"
|
||||||
|
|||||||
8
xoatrc
8
xoatrc
@@ -110,12 +110,12 @@ bind Mod4+h action_maximize_horz
|
|||||||
bind Mod4+m action_maximize
|
bind Mod4+m action_maximize
|
||||||
|
|
||||||
# Switch focus between monitors.
|
# Switch focus between monitors.
|
||||||
bind Mod4+Next action_focus_monitor -1
|
bind Mod4+Next action_focus_monitor right
|
||||||
bind Mod4+Prior action_focus_monitor +1
|
bind Mod4+Prior action_focus_monitor left
|
||||||
|
|
||||||
# Move windows between monitors.
|
# Move windows between monitors.
|
||||||
bind Mod4+Shift+Next action_move_monitor -1
|
bind Mod4+Shift+Next action_move_monitor right
|
||||||
bind Mod4+Shift+Prior action_move_monitor +1
|
bind Mod4+Shift+Prior action_move_monitor left
|
||||||
|
|
||||||
# Launchers
|
# Launchers
|
||||||
bind Mod4+x action_command dmenu_run
|
bind Mod4+x action_command dmenu_run
|
||||||
|
|||||||
Reference in New Issue
Block a user