Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
add option to choose to copy or open url (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
blacs30 authored Mar 7, 2022
1 parent d511961 commit 0ef94e2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Install via Alfred keyword: `.bwautolock`
| MODIFIER_3_ACTION | Action executed by the third modifier | totp |
| MODIFIER_4_ACTION | Action executed by the fourth modifier | more |
| NO_MODIFIER_ACTION | Action executed without modifier pressed | password,card |
| OPEN_LOGIN_URL | If set to false the url of an item will be copied to the clipboard, otherwise it will be opened in the default browser. | true |
| OUTPUT_FOLDER | The folder to which attachments should be saved when the action is triggered. Default is \$HOME/Downloads. "~" can be used as well. | "" |
| PATH | The PATH env variable which is used to search for executables (like the Bitwarden CLI configured with BW_EXEC, security to get and set keychain objects) | /usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/bin:/usr/sbin |
| REORDERING_DISABLED | If set to false the items which are often selected appear further up in the results. | true |
Expand Down
13 changes: 10 additions & 3 deletions src/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,16 +388,23 @@ func setModAction(itemConfig itemsModifierActionRelationMap, item Item, itemType
continue
}
assignedIcon := iconLink
subtitle := "Copy URL"
subtitle := "Open URL"
loginUrlAction := "-open"
notification := " "
if !conf.OpenLoginUrl {
subtitle = "Copy URL"
loginUrlAction = "output"
notification = fmt.Sprintf("Copy url for user:\n%s", item.Login.Username)
}
if modMode == "nomod" {
assignedIcon = icon
subtitle = fmt.Sprintf("↩ or ⇥ copy URL, %s Password, %s Username %s %s Show more", passEmoji, userEmoji, totp, moreEmoji)
}
modItem := modifierActionContent{
Title: title,
Subtitle: subtitle,
Notification: " ",
Action: "-open",
Notification: notification,
Action: loginUrlAction,
Action2: " ",
Action3: " ",
Arg: item.Login.Uris[0].Uri,
Expand Down
1 change: 1 addition & 0 deletions src/config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type config struct {
SyncMaxCacheAge time.Duration
TitleWithUser bool `envconfig:"TITLE_WITH_USER" default:"true"`
TitleWithUrls bool `envconfig:"TITLE_WITH_URLS" default:"true"`
OpenLoginUrl bool `envconfig:"OPEN_LOGIN_URL" default:"true"`
}

type BwData struct {
Expand Down
4 changes: 3 additions & 1 deletion workflow/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2091,6 +2091,8 @@ Caching of the secret/item names (not the secret values itself) are cached so th
<string>password,card</string>
<key>OUTPUT_FOLDER</key>
<string></string>
<key>OPEN_LOGIN_URL</key>
<string>true</string>
<key>PATH</key>
<string>/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/bin:/usr/sbin</string>
<key>REORDERING_DISABLED</key>
Expand Down Expand Up @@ -2126,7 +2128,7 @@ Caching of the secret/item names (not the secret values itself) are cached so th
<string>SERVER_URL</string>
</array>
<key>version</key>
<string>2.4.2</string>
<string>2.4.3</string>
<key>webaddress</key>
<string>https://github.com/blacs30/bitwarden-alfred-workflow</string>
</dict>
Expand Down

0 comments on commit 0ef94e2

Please sign in to comment.