Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added brave browser #111

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,40 @@

> Chrome/Canary/Chromium bookmarks search workflow for Alfred

- [x] Google Chrome (`chrome`, `chrome-profiles`)
- [x] Google Chrome Canary (`canary`, `canary-profiles`)
- [x] Chromium (`chromium`, `chromium-profiles`)
- [x] Microsoft Edge (`edge`, `edge-profiles`)
- [x] Microsoft Edge Canary (`edge-canary`, `edge-canary-profiles`)
- [x] Vivaldi (`vivaldi`, `vivaldi-profiles`)
- [x] Google Chrome (`chrome`, `chrome-profiles`)
- [x] Google Chrome Canary (`canary`, `canary-profiles`)
- [x] Chromium (`chromium`, `chromium-profiles`)
- [x] Microsoft Edge (`edge`, `edge-profiles`)
- [x] Microsoft Edge Canary (`edge-canary`, `edge-canary-profiles`)
- [x] Vivaldi (`vivaldi`, `vivaldi-profiles`)
- [x] Brave Browser (`brave`, `brave-profiles`)

![Screenshot](./screenshot.png)

## Commands

| Command | Description |
|:--|:--|
| `<browser>` | Searches bookmarks using `query`. If you would like to show bookmark folder please press Command (or Cmd) ⌘. |
| `<browser>-profiles` | Sets active user profile. `Auto` options checks active user profile and uses it to search bookmarks. |
| Command | Description |
| :------------------- | :----------------------------------------------------------------------------------------------------------- |
| `<browser>` | Searches bookmarks using `query`. If you would like to show bookmark folder please press Command (or Cmd) ⌘. |
| `<browser>-profiles` | Sets active user profile. `Auto` options checks active user profile and uses it to search bookmarks. |

## Setup

- Run `brew install go`
- Run `make deps`
- Run `brew install go`
- Run `make deps`

## Develop

- Run `make build`
- Install `./build/chrome-bookmarks.alfredworkflow`
- Run `make build`
- Install `./build/chrome-bookmarks.alfredworkflow`

## Test

- Run `make test`
- Run `make test`

## Cover

- Run `make cover` or `make cover-html`
- Run `make cover` or `make cover-html`

## QA

Expand Down
Binary file added assets/brave.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions cmd/workflow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package main
import (
"flag"
"fmt"
"github.com/deanishe/awgo"
"os"
"path"
"strings"

aw "github.com/deanishe/awgo"
"github.com/mdreizin/chrome-bookmarks-alfred-workflow/pkg/bookmarks"
"github.com/mdreizin/chrome-bookmarks-alfred-workflow/pkg/browsers"
"github.com/mdreizin/chrome-bookmarks-alfred-workflow/pkg/profiles"
"github.com/mdreizin/chrome-bookmarks-alfred-workflow/pkg/workflows"
"os"
"path"
"strings"
)

var (
Expand Down Expand Up @@ -113,6 +114,8 @@ func run() error {

if profile.IsVirtual {
title = profile.DisplayName
} else if profile.UserName != "" {
title = profile.UserName
} else if profile.Name != "" {
title = profile.Name
}
Expand Down
6 changes: 6 additions & 0 deletions configs/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@
iconUrl: "vivaldi.png"
profileName: "Default"

- name: "brave"
fullName: "com.brave.Browser"
description: "Brave Browser"
path: "~/Library/Application Support/BraveSoftware/Brave-Browser"
iconUrl: "brave.png"
profileName: "Default"
6 changes: 6 additions & 0 deletions configs/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ vivaldi:
bookmarkOpenId: "05008a94-3fd7-44d4-aa10-b0f2a495d360"
profileListId: "093cb3e1-761a-4f34-83f6-36507c8c6eff"
profileSetId: "0d4fbc34-60ed-4223-98c9-5a93a103aa5c"

brave:
bookmarkListId: "f7cb33ad-15d9-4fa9-b723-524f5ad191a0"
bookmarkOpenId: "681d644f-4ce9-4d26-8846-dd1a35eda744"
profileListId: "74df3946-baf6-402b-ac8f-9bad696a617a"
profileSetId: "fa89a6db-ef1b-4b50-96fb-957750e391ef"
16 changes: 0 additions & 16 deletions pkg/workflows/default_workflow_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,6 @@ func (s *DefaultWorkflowService) GetProfiles(b *browsers.Browser, query string)
}

func (s *DefaultWorkflowService) GetBookmarks(browser *browsers.Browser, query string) (bookmarks.BookmarkSlice, error) {
profileSlice, err := s.ProfileService.GetProfiles(browser)

if err != nil {
return nil, err
}

profileName := profiles.DefaultProfileName

if browser.ProfileName == "" {
if profile, err := profileSlice.FirstActive(); err == nil && profile.Name != "" {
profileName = profile.Name
}
}

browser.ProfileName = profileName

Comment on lines -39 to -54
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain why you have remove that block?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just need to set profile via -profiles command.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the current problem:
First I made sure that the default browser is selected:
Screenshot 2021-11-20 at 10 05 24
Screenshot 2021-11-20 at 10 07 10

Then I searched for a bookmark and the results were from the Default browser:
Screenshot 2021-11-20 at 10 05 31

But when i switched to Profile 1 an made sure that it was activated
Screenshot 2021-11-20 at 10 11 29
It also saved the change to the browser.yml file:
Screenshot 2021-11-20 at 10 06 56

But after that when I searched for a bookmark and the results were still from the Default browser
Screenshot 2021-11-20 at 10 05 55

Copy link
Author

@Paul-creator Paul-creator Nov 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And removing that code resolved this problem

bookmarkSlice, err := s.BookmarkService.GetBookmarks(browser)

if err != nil {
Expand Down