Skip to content

Commit

Permalink
add: Arc browser support.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarashino authored and glacambre committed Jun 21, 2023
1 parent e2d5a0f commit 9a39ceb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Turn your browser¹ into a Neovim client (demos: [justinmk 🇺🇸](https://www.youtube.com/watch?v=suvh0yFfIB8), [Sean Feng 🇨🇳](https://www.youtube.com/watch?v=dNQJONKnJrg)).

¹ <sub>Firefox and Chrome are specifically supported. Other Chromium based browsers such as Brave, Vivaldi, and Opera should also work but are not specifically tested.</sub>
¹ <sub>Firefox and Chrome are specifically supported. Other Chromium based browsers such as Brave, Vivaldi, Opera, and Arc should also work but are not specifically tested.</sub>

![Firenvim demo](firenvim.gif)

Expand Down Expand Up @@ -77,7 +77,7 @@ If you would rather build and install Firenvim from source, check [CONTRIBUTING.

#### Other browsers

Other browsers aren't supported for now. Opera, Vivaldi and other Chromium-based browsers should however work just like in Chromium and have similar install steps. Brave and Edge might work, Safari doesn't (it doesn't support Webextensions).
Other browsers aren't supported for now. Opera, Vivaldi and other Chromium-based browsers should however work just like in Chromium and have similar install steps. Brave, Edge, and Arc might work, Safari doesn't (it doesn't support Webextensions).

## Permissions

Expand Down
21 changes: 21 additions & 0 deletions autoload/firenvim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@ function! s:get_librewolf_manifest_dir_path() abort
return s:build_path([$HOME, '.librewolf', 'native-messaging-hosts'])
endfunction

function! s:arc_config_exists() abort
let l:p = [$HOME, '.config', 'Arc']
if has('mac')
let l:p = [$HOME, 'Library', 'Application Support', 'Arc']
end
return isdirectory(s:build_path(l:p))
endfunction

function! s:brave_config_exists() abort
let l:p = [$HOME, '.config', 'BraveSoftware']
if has('mac')
Expand Down Expand Up @@ -464,6 +472,13 @@ function! s:get_chrome_dev_manifest_dir_path() abort
return s:build_path([$HOME, '.config', 'google-chrome-unstable', 'NativeMessagingHosts'])
endfunction

function! s:get_arc_manifest_dir_path() abort
if has('mac')
return s:get_chrome_manifest_dir_path()
end
return throw 'No Arc on any other than mac.'
endfunction

function! s:get_brave_manifest_dir_path() abort
if has('mac')
return s:get_chrome_manifest_dir_path()
Expand Down Expand Up @@ -694,6 +709,12 @@ endfunction
function! s:get_browser_configuration() abort
" Brave, Opera and Vivaldi all rely on Chrome's native messenger
let l:browsers = {
\'arc': {
\ 'has_config': s:arc_config_exists(),
\ 'manifest_content': function('s:get_chrome_manifest'),
\ 'manifest_dir_path': function('s:get_arc_manifest_dir_path'),
\ 'registry_key': 'HKCU:\Software\Google\Chrome\NativeMessagingHosts\firenvim',
\},
\'brave': {
\ 'has_config': s:brave_config_exists(),
\ 'manifest_content': function('s:get_chrome_manifest'),
Expand Down

0 comments on commit 9a39ceb

Please sign in to comment.