summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2022-09-28 18:36:50 -0700
committerMike Crute <mike@crute.us>2022-09-28 18:36:50 -0700
commit923447cf8039a57f7cc086c7821465bca2ef85d7 (patch)
tree0e2f11bb5463efa947c6bd1c11fddd8678200a5c
parentd9fa5661ea5e5bfbd1e348a2a6d970a2f0e2cd1e (diff)
downloaddotfiles-923447cf8039a57f7cc086c7821465bca2ef85d7.tar.bz2
dotfiles-923447cf8039a57f7cc086c7821465bca2ef85d7.tar.xz
dotfiles-923447cf8039a57f7cc086c7821465bca2ef85d7.zip
Major cleanup of display handling
-rw-r--r--.config/awesome/mcrute.lua101
1 files changed, 65 insertions, 36 deletions
diff --git a/.config/awesome/mcrute.lua b/.config/awesome/mcrute.lua
index ae7056b..a9ec8b3 100644
--- a/.config/awesome/mcrute.lua
+++ b/.config/awesome/mcrute.lua
@@ -39,8 +39,27 @@ if gears.filesystem.file_readable(tz_file) then
39 timezone = io.open(tz_file, "r"):read():gsub("^%s*(.-)%s*$", "%1") 39 timezone = io.open(tz_file, "r"):read():gsub("^%s*(.-)%s*$", "%1")
40end 40end
41 41
42-- EDIDs for simple displays that disable the internal screen and set
43-- the external display to auto resolution
44local simple_external_display_ids = {
45 ["DELL U3219Q"] = true, -- 32" 4k Dell monitor
46 ["49S405"] = true, -- 32" 4k Dell monitor
47 ["LF32TU87"] = true, -- 32" 4k Samsung F32TU87x monitor
48 ["DELL U3415W"] = true, -- 34" curved widescreen Dell monitors
49 ["DELL U3417W"] = true, -- 34" curved widescreen Dell monitors
50 ["GOOGLE JN32A"] = true, -- 32" Google Branded Monitor
51}
52
53-- EDIDs for internal displays that don't reconfigure themselves
54local internal_display_ids = {
55 AUO_11048 = true,
56 BOE_51207 = true,
57 SHP_20757 = true,
58 SDC_20289 = true,
59}
60
42-- Good clear zoom stops for the Dell XPS 13 93{7,8}0 61-- Good clear zoom stops for the Dell XPS 13 93{7,8}0
43local edp_zoom_modes = { 62local edp_zoom_modes_9380 = {
44-- "2880x1620", 63-- "2880x1620",
45-- "2560x1440", 64-- "2560x1440",
46-- "2048x1152", 65-- "2048x1152",
@@ -56,15 +75,13 @@ local edp_zoom_modes = {
56} 75}
57 76
58-- Good clear daily driver modes for the Dell XPS 13 93{7,8}0 77-- Good clear daily driver modes for the Dell XPS 13 93{7,8}0
59local edp_display_modes = { 78local edp_display_modes_9380 = {
60 "1600x900", 79 "1600x900",
61 "1920x1080", 80 "1920x1080",
62 "2048x1152", 81 "2048x1152",
63 "2560x1440", 82 "2560x1440",
64 "2560x1600", 83 "2560x1600",
65 "2880x1620", 84 "2880x1620",
66
67
68} 85}
69 86
70local edp_display_modes_9320 = { 87local edp_display_modes_9320 = {
@@ -77,15 +94,33 @@ local edp_display_modes_9320 = {
77 "3840x2400", 94 "3840x2400",
78} 95}
79 96
97local edp_display_modes_9310 = {
98-- "3456x2160",
99 "2560x1600",
100 "1920x1200",
101 "1680x1050",
102 "1400x900",
103 "1280x800",
104}
105
80local default_edp_display_modes = { 106local default_edp_display_modes = {
81 BOE_51207 = edp_display_modes[3], -- Dell XPS 13 93{7,8}0 107 BOE_51207 = edp_display_modes_9380[3], -- Dell XPS 13 93{7,8}0
82 AUO_11048 = edp_display_modes[3], -- X1 Carbon Display 108 AUO_11048 = edp_display_modes_9380[3], -- X1 Carbon Display
83 SHP_20757 = edp_display_modes[5], -- Dell XPS 13 9320 109 SHP_20757 = edp_display_modes_9380[5], -- Dell XPS 13 9320
110 SDC_20289 = edp_display_modes_9310[1], -- Dell XPS 13 9310
111}
112
113local default_edp_zoom_modes = {
114 BOE_51207 = edp_zoom_modes_9380,
115 AUO_11048 = edp_zoom_modes_9380,
116 SHP_20757 = edp_display_modes_9320,
117 SDC_20289 = edp_display_modes_9310,
84} 118}
85 119
86-- Preferred daily driver mode 120-- Preferred daily driver mode
87-- This is populated by the get_default_edp_mode function, below 121-- This is populated by the get_default_edp_mode function, below
88local default_edp_mode = edp_display_modes[3] 122local default_edp_mode = edp_display_modes_9380[3]
123local edp_zoom_modes = edp_zoom_modes_9380
89 124
90-- dumps is a debugging tool that prints text representations of lua objects 125-- dumps is a debugging tool that prints text representations of lua objects
91function dump(o) 126function dump(o)
@@ -610,6 +645,18 @@ end
610 645
611default_edp_mode = get_default_edp_mode() 646default_edp_mode = get_default_edp_mode()
612 647
648-- get_default_zoom_modes enumerates the displays and returns the proffered
649-- zoom mode table for the eDP-1 device.
650--
651-- This function overrides the default set in the top of the file at first
652-- runtime with the correct version for the first display.
653function get_default_zoom_modes()
654 local displays = get_displays()
655 return default_edp_zoom_modes[displays[1].edid]
656end
657
658edp_zoom_modes = get_default_zoom_modes()
659
613-- configure_displays uses xrandr to configure the displays connected to the 660-- configure_displays uses xrandr to configure the displays connected to the
614-- system when they are connected for removed. 661-- system when they are connected for removed.
615-- 662--
@@ -625,8 +672,8 @@ default_edp_mode = get_default_edp_mode()
625function configure_displays() 672function configure_displays()
626 local displays = get_displays() 673 local displays = get_displays()
627 674
628 -- Only built-in (XPS 13) display is connected 675 -- Only an internal display is connected
629 if #displays == 1 and (displays[1].edid == "AUO_11048" or displays[1].edid == "BOE_51207" or displays[1].edid == "SHP_20757") then 676 if #displays == 1 and internal_display_ids[displays[1].edid] then
630 awful.spawn.spawn("xrandr " .. 677 awful.spawn.spawn("xrandr " ..
631 "--output eDP-1 --mode " .. default_edp_mode .. " " .. 678 "--output eDP-1 --mode " .. default_edp_mode .. " " ..
632 "--output DP-1 --off " .. 679 "--output DP-1 --off " ..
@@ -644,35 +691,17 @@ function configure_displays()
644 "--output DP-2 --auto --right-of DP-1 " .. 691 "--output DP-2 --auto --right-of DP-1 " ..
645 "--output eDP-1 --off") 692 "--output eDP-1 --off")
646 return 693 return
647 elseif s.edid == "DELL U3219Q" then -- 32" 4k Dell monitor 694 elseif s.edid == "LG TV" then -- Home TV
648 awful.spawn.spawn("xrandr --output " .. s.card .. " --auto --output eDP-1 --off") 695 awful.spawn.spawn("xrandr " ..
649 --split_screen_vertical() 696 "--output eDP-1 --mode " .. default_edp_mode ..
650 elseif s.edid == "LF32TU87" then -- 32" 4k Samsung monitor 697 " --output " .. s.card .. " --mode 1920x1080 " ..
651 awful.spawn.spawn("xrandr --output " .. s.card .. " --auto --output eDP-1 --off") 698 "--right-of eDP-1")
652 --split_screen_vertical() 699 return
653 elseif s.edid == "49S405" then -- 32" 4k Dell monitor 700 elseif simple_external_display_ids[s.edid] then
654 awful.spawn.spawn("xrandr --output " .. s.card .. " --auto --output eDP-1 --off")
655 --split_screen_vertical()
656 elseif s.edid == "LF32TU87" then -- 32" 4k Samsung F32TU87x monitor
657 awful.spawn.spawn("xrandr --output " .. s.card .. " --auto --output eDP-1 --off")
658 --split_screen_vertical()
659 elseif s.edid == "DELL U3415W" then -- 34" curved widescreen Dell monitors
660 awful.spawn.spawn("xrandr --output " .. s.card .. " --auto --output eDP-1 --off")
661 --split_screen_vertical()
662 return
663 elseif s.edid == "DELL U3417W" then -- 34" curved widescreen Dell monitors
664 awful.spawn.spawn("xrandr --output " .. s.card .. " --auto --output eDP-1 --off")
665 --split_screen_vertical()
666 return
667 elseif s.edid == "GOOGLE JN32A" then -- XPS 13 Built-in display
668 awful.spawn.spawn("xrandr --output " .. s.card .. " --auto --output eDP-1 --off") 701 awful.spawn.spawn("xrandr --output " .. s.card .. " --auto --output eDP-1 --off")
669 return 702 return
670 elseif s.edid == "BOE_51207" then -- XPS 13 Built-in display 703 elseif internal_display_ids[s.edid] then
671 -- continue 704 -- continue
672 elseif s.edid == "AUO_11048" then -- X1 Carbon Built-in display
673 -- continue
674 elseif s.edid == "LG TV" then -- Home TV
675 awful.spawn.spawn("xrandr --output eDP-1 --mode " .. default_edp_mode .. " --output " .. s.card .. " --mode 1920x1080 --right-of eDP-1")
676 else 705 else
677 default_display_handler(s.card, default_edp_mode) 706 default_display_handler(s.card, default_edp_mode)
678 return 707 return