More Advanced Conditions

Hi

im starting to make a version of enhanced dock for alt tab (application switcher). currently i can identify is alt tab visible with

tell application "System Events" to tell process "Dock" to try
	if subrole of list 2 is "AXProcessSwitcherList" then return true
on error
	return false
end try

i can identify other ones with

delay 2
tell application "System Events" to tell process "Dock"
	if (UI elements count) > 1 then
		try
			return name of group "Mission Control"
		end try
		try
			return name of group "App Expose"
		end try
		try
			return name of group "Launchpad"
		end try
		try
			list 2
			return "App Switcher"
		end try
	end if
end tell

im sure a variable for these would be useful
missioncontrol_active (currently returns true on Application Switcher and Application Expose)
appexpose_active
launchpad_active
appswitcher_active

im planing to use appswitcher_active

Thanks

I don't think there is a way to know whether app expose is active, as it triggers the same effects as mission control. Unfortunately I'm not aware of any way to differentiate between mission control and app expose ;-(

Same goes for Launchpad and app switcher - maybe there is a way to identify them via the visible window list variable

I hope dock windows has same naming on all macs, it works ok on mine
Conditions can be change if there is a different UI related to dock

Mission Control
Dock - Dock - 20
Dock - (null) - 20
Dock - (null) - 18

visible_window_list CONTAINS "Dock - Dock - 20" AND visible_window_list CONTAINS "Dock - (null) - 20" AND visible_window_list CONTAINS "Dock - (null) - 18"

App Expose
Dock - Dock - 20
Dock - (null) - 18

(visible_window_list CONTAINS "Dock - Dock - 20" AND visible_window_list CONTAINS "Dock - (null) - 18") AND (NOT (visible_window_list CONTAINS "Dock - (null) - 20"))

App Switcher
Dock - (null) - 20

(visible_window_list CONTAINS "Dock - (null) - 20") AND (NOT (visible_window_list CONTAINS "Dock - (null) - 18" OR visible_window_list CONTAINS "Dock - Dock - 20"))

Launchpad
Dock - Dock - 29

visible_window_list CONTAINS "Dock - Dock - 29"

3 Likes

Hehe that's quite crazy but I think it should work - at least on all macOS Ventura installations. The window levels sometimes change between versions unfortunately...

1 Like

found "Dock - Dock - 20" used for dock itself, here is updated version,

Mission Control
Dock - (null) - 20
Dock - (null) - 18
Dock - (null) - 0 => visible if it has focused item?

visible_window_list CONTAINS "Dock - (null) - 20" AND visible_window_list CONTAINS "Dock - (null) - 18"

App Expose
Dock - (null) - 18

(NOT (visible_window_list CONTAINS "Dock - (null) - 20")) AND visible_window_list CONTAINS "Dock - (null) - 18"

App Switcher
Dock - (null) - 20

(NOT (visible_window_list CONTAINS "Dock - (null) - 18")) AND visible_window_list CONTAINS "Dock - (null) - 20"

Launchpad
Dock - Dock - 29

visible_window_list CONTAINS "Dock - Dock - 29"

Dock
Dock - Dock - 20

visible_window_list CONTAINS "Dock - Dock - 20"
2 Likes