diff options
author | Mike Crute <mike@crute.us> | 2019-02-09 17:18:31 -0800 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2019-02-09 17:18:31 -0800 |
commit | 4ff4a7a6621028c71537f92de79579fb83462af4 (patch) | |
tree | 376a164cc0bb8e3e2f779f3f52683cd10f481e84 /.config | |
parent | 217634f576893a094f6dcc22c8720fde6a9320ac (diff) | |
download | dotfiles-4ff4a7a6621028c71537f92de79579fb83462af4.tar.bz2 dotfiles-4ff4a7a6621028c71537f92de79579fb83462af4.tar.xz dotfiles-4ff4a7a6621028c71537f92de79579fb83462af4.zip |
Allow vertical/horizontal splits
Diffstat (limited to '.config')
-rw-r--r-- | .config/awesome/mcrute.lua | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/.config/awesome/mcrute.lua b/.config/awesome/mcrute.lua index 1ff6158..5449ac0 100644 --- a/.config/awesome/mcrute.lua +++ b/.config/awesome/mcrute.lua | |||
@@ -435,17 +435,30 @@ function get_layouts() | |||
435 | } | 435 | } |
436 | end | 436 | end |
437 | 437 | ||
438 | -- split_screen creates a virtual screen and splits the main screen in half. | 438 | -- split_screen_vertical creates a virtual screen and splits the main screen in |
439 | -- This is mostly useful for the ultra-widescreen curved monitors. It makes | 439 | -- half vertically. This is mostly useful for the ultra-widescreen curved |
440 | -- Awesome treat the monitor as containing two totally independent screens as | 440 | -- monitors. It makes Awesome treat the monitor as containing two totally |
441 | -- if it were two different monitors. | 441 | -- independent screens as if it were two different monitors. |
442 | function split_screen(s) | 442 | function split_screen_vertical(s) |
443 | local s = s or 1 | ||
443 | local geo = screen[s].geometry | 444 | local geo = screen[s].geometry |
444 | local new_width = math.ceil(geo.width/2) | 445 | local new_width = math.ceil(geo.width/2) |
445 | local new_width2 = geo.width - new_width | ||
446 | 446 | ||
447 | screen[s]:fake_resize(geo.x, geo.y, new_width, geo.height) | 447 | screen[s]:fake_resize(geo.x, geo.y, new_width, geo.height) |
448 | screen.fake_add(geo.x + new_width, geo.y, new_width2, geo.height) | 448 | screen.fake_add(geo.x + new_width, geo.y, geo.width - new_width, geo.height) |
449 | end | ||
450 | |||
451 | -- split_screen_horizontal creates a virtual screen and splits the main screen | ||
452 | -- in half horizontally. This is mostly useful for the ultra-high-resolution | ||
453 | -- monitors. It makes Awesome treat the monitor as containing two totally | ||
454 | -- independent screens as if it were two different monitors. | ||
455 | function split_screen_horizontal(s) | ||
456 | local s = s or 1 | ||
457 | local geo = screen[s].geometry | ||
458 | local new_height = math.ceil(geo.height/2) | ||
459 | |||
460 | screen[s]:fake_resize(geo.x, geo.y, geo.width, new_height) | ||
461 | screen.fake_add(geo.x, geo.y + new_height, geo.width, geo.height - new_height) | ||
449 | end | 462 | end |
450 | 463 | ||
451 | -- get_clock creates a textclock widget for the wibox. It's basically the | 464 | -- get_clock creates a textclock widget for the wibox. It's basically the |
@@ -566,6 +579,10 @@ return { | |||
566 | get_layouts = get_layouts, | 579 | get_layouts = get_layouts, |
567 | battery = battery, | 580 | battery = battery, |
568 | 581 | ||
582 | -- Public functions that are occasionally useful | ||
583 | split_screen_vertical = split_screen_vertical, | ||
584 | split_screen_horizontal = split_screen_horizontal, | ||
585 | |||
569 | -- Public functions that are useful on import | 586 | -- Public functions that are useful on import |
570 | configure_displays = configure_displays, | 587 | configure_displays = configure_displays, |
571 | dump = dump, | 588 | dump = dump, |