Hook Compatibility with Waterfox

Tried copying the same URL schemes from Firefox but it did not work for me.


Managed to concoct a working “Get Address” script for Waterfox.

Although the integration shows a strange behavior. Every time “Get Address” it’s called, it expands the address bar tile menu.

use framework "AppKit"
-- classes, constants, and enums used
property NSShiftKeyMask : a reference to 131072
property NSAlternateKeyMask : a reference to 524288
property NSControlKeyMask : a reference to 262144
property NSEvent : a reference to current application's NSEvent

set modifier_down to true
repeat while modifier_down
	set modifier_flags to NSEvent's modifierFlags()
	set option_down to ((modifier_flags div (get NSAlternateKeyMask)) mod 2) = 1
	set shift_down to ((modifier_flags div (get NSShiftKeyMask)) mod 2) = 1
	set control_down to ((modifier_flags div (get NSControlKeyMask)) mod 2) = 1
	set modifier_down to option_down or shift_down or control_down
end repeat

tell application "Waterfox"
	delay 0.05
	set myName to get name of front window
	if version > 72 and myName ends with " - Waterfox" then
		if length of myName > 18 then
			set myName to text 1 through -19 of myName
			set myName to ""
		end if
	end if
end tell

	set theUrl to ""
	tell application "Waterfox"
		if version ≥ 87 then
			tell application "System Events"
				set theUrl to get value of UI element 1 of combo box 1 of toolbar "Navigation" of first group of front window of application process "Waterfox"
				return ("[" & myName & "](" & theUrl) & ")"
			end tell
		end if
	end tell
end try

tell application "System Events"
	keystroke "l" using {command down}
	keystroke (key code 53)
	keystroke (key code 53)
	--keystroke "c" using {command down}
	tell process "Waterfox"
		click menu item "Copy" of menu "Edit" of menu bar 1
	end tell
	delay 0.05
	set theClipboard to current application's NSPasteboard's generalPasteboard's stringForType:(current application's NSPasteboardTypeString)
	return ("[" & myName & "](" & the theClipboard as string) & ")"
end tell

1 Like