Skip to content

Commit

Permalink
Bump to 0.0.6, update docs, improve mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
dzirtusss committed Jan 24, 2025
1 parent 99aa433 commit 8a98b09
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [0.0.6] - 2025-01-24

- Add support for StartPage (bookmarks, etc)
- Add fallback to mouse click when no AXPress action is available
- Improve root element detection
- Improve char mapping to other non-common symbols
- Add default mapping of Delete (backspace) to history back

## [0.0.5] - 2025-01-22

- Fix release version
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ Vimium/Vimari for Safari without browser extension in pure Lua.
- Not a browser extension - works via accessability API, so most probably will work with
any Safari version despite past or future Plugin API changes. Theoretically, it
is even easily adjustable for other browsers. Works in all Safari parts - e.g. doesn't
stall on empty pages (plans are even to make `f`/`F` work on bookmarks and similar pages,
scrolling already works there).
stall on empty pages, works on Start Page (for bookmarks), etc.

- No Swift/XCode - only Lua. Just a single text file.

- No need for Apple Developer account, etc. No distribution.
- No need for Apple Developer account, etc. No distribution via App Store.

- Fully trustable from security perspective, because it is FOSS with Lua readable by any programmer.
No keylogging risk and ok to run on sensitive sites with credentials/tokens/etc.
Expand Down Expand Up @@ -107,6 +106,7 @@ x - close tab
t - new tab
o - open
[] - back and forward in history
del (backspace) - back in history
g1-8 - go to tab 1-8
g9, g$ - go to last tab
Expand Down Expand Up @@ -144,8 +144,7 @@ g/f/F/t/y/... - or other symbols show multi-key combination start

- If something unsolvable happens - hit reload config in Hammerspoon.

- Atm, there is a config for Spotlight and Raycast (as I have those). If somebody will send configs for other
app launchers, I will happily add those.
- Bookmarks, reading list, iCloud tabs, etc. are accessible via Start Page where `f` works (not `F`).

## Known issues

Expand All @@ -154,9 +153,8 @@ happens in times of Safari's unresponsiveness - e.g. processing a heavy page jus

## Possible next todo ideas

- Extend marks to bookmarks, reading list, etc. non-web items.
- Analog of `f` command but for toolbar, tabbar, etc.
- Bitwarden support by keypress
- Bitwarden/1Password support by keypress

## Similar projects

Expand Down
11 changes: 8 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ obj.__index = obj
--------------------------------------------------------------------------------

obj.name = "vifari"
obj.version = "0.0.5"
obj.version = "0.0.6"
obj.author = "Sergey Tarasov <dzirtusss@gmail.com>"
obj.homepage = "https://github.com/dzirtusss/vifari"
obj.license = "MIT - https://opensource.org/licenses/MIT"
Expand Down Expand Up @@ -34,6 +34,7 @@ local mapping = {
["t"] = { "cmd", "t" }, -- new tab
["o"] = { "cmd", "l" }, -- open
["["] = { "cmd", "[" }, -- history back
["\x7f"] = { "cmd", "[" }, -- history back (backspace)
["]"] = { "cmd", "]" }, -- history forward
["g1"] = { "cmd", "1" },
["g2"] = { "cmd", "2" },
Expand Down Expand Up @@ -66,6 +67,10 @@ local config = {
smoothScrollHalfPage = true,
axEditableRoles = { "AXTextField", "AXComboBox", "AXTextArea" },
axJumpableRoles = { "AXLink", "AXButton", "AXPopUpButton", "AXComboBox", "AXTextField", "AXMenuItem", "AXTextArea", "AXCheckBox" },
-- chars that are acceptable for vimLoop
-- feel free to add more if needed, and ping me on GH to add to the repo
-- \x7f is delete (backspace) on MacBook keyboard
acceptableChars = "[%a%d%[%]%$\x7f\"\\']",
}

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -533,7 +538,7 @@ local function vimLoop(char)
elseif mappingPrefixes[char] then
setMode(modes.MULTI, char)
else
logWithTimestamp("Unknown char " .. char)
logWithTimestamp("Unknown char " .. char .. " (hex: " .. string.format("%02x", string.byte(char)) .. ")")
end
end

Expand Down Expand Up @@ -569,7 +574,7 @@ local function eventHandler(event)
if current.mode == modes.INSERT or isEditableControlInFocus() then return false end

local char = event:getCharacters()
if not char:match("[%a%d%[%]%$]") then return false end
if not char:match(config.acceptableChars) then return false end

hs.timer.doAfter(0, function() vimLoop(char) end)
return true
Expand Down

0 comments on commit 8a98b09

Please sign in to comment.