Skip to content

Commit b3fb0a8

Browse files
committed
Add balloon notification settings and update versioning
- Introduced a setting to enable/disable balloon notifications for SSH key usage in the settings UI. - Updated the application version to 0.5.0 in the info.json file. - Enhanced the notification message to truncate long key names for better readability.
1 parent 4b5a994 commit b3fb0a8

File tree

5 files changed

+41
-4
lines changed

5 files changed

+41
-4
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
build/bin/
22
wailsjs/
33
hack/node_modules/
4+
omni-socat.zip
5+
build/windows/wails.exe.manifest
6+
cmd/agent-bench/agent-bench
7+
cmd/agent-bench/agent-bench.exe
8+
test*/
9+
pkg/muxconn
10+
pkg/stdioconn

app.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,14 @@ func (a *App) onSign(pubkey *agent.Key) error {
167167
return errors.New("private key not found")
168168
}
169169

170-
a.ti.ShowBalloonNotification(wintray.ID,
171-
fmt.Sprintf("SSH Key '%s' was used", privkey.PublicKey.Comment))
170+
name := privkey.PublicKey.Comment
171+
if len(name) == 0 {
172+
name = truncateString(privkey.PublicKey.SHA256)
173+
}
174+
msg := fmt.Sprintf("SSH Key '%s' was used", name)
175+
if a.settings.ShowBalloon {
176+
a.ti.ShowBalloonNotification(wintray.ID, msg)
177+
}
172178
return nil
173179
}
174180

@@ -256,7 +262,15 @@ func (a *App) Save(s store.SaveData) error {
256262
a.settings.SaveData.UnixSocketAgent = s.UnixSocketAgent
257263
a.settings.SaveData.UnixSocketPath = s.UnixSocketPath
258264
a.settings.SaveData.CygWinAgent = s.CygWinAgent
265+
a.settings.SaveData.ShowBalloon = s.ShowBalloon
259266
a.settings.SaveData.CygWinSocketPath = s.CygWinSocketPath
260267
a.settings.SaveData.ProxyModeOfNamedPipe = s.ProxyModeOfNamedPipe
261268
return a.settings.Save()
262269
}
270+
271+
func truncateString(s string) string {
272+
if len(s) <= 16 {
273+
return s
274+
}
275+
return s[:16] + "..."
276+
}

build/windows/info.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"fixed": {
3-
"file_version": "0.3.5"
3+
"file_version": "0.5.0"
44
},
55
"info": {
66
"0000": {
7-
"ProductVersion": "0.3.5",
7+
"ProductVersion": "0.5.0",
88
"CompanyName": "OmniSSHAgent",
99
"FileDescription": "OmniSSHAgent",
1010
"LegalCopyright": "Copyright.........",

frontend/src/Settings.svelte

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
NamedPipeAgent: false,
3434
UnixSocketAgent: false,
3535
CygWinAgent: false,
36+
ShowBalloon: false,
3637
UnixSocketPath: "",
3738
CygWinSocketPath: "",
3839
ProxyModeOfNamedPipe: false,
@@ -103,6 +104,19 @@
103104
>
104105
</FormField>
105106
</div>
107+
<div>
108+
<FormField>
109+
<Switch
110+
bind:checked={data.ShowBalloon}
111+
value="Show a balloon notification when an SSH key is used"
112+
/>
113+
<span
114+
>{data.ShowBalloon
115+
? "Show a balloon notification when an SSH key is used"
116+
: "Do not show a balloon notification when an SSH key is used"}</span
117+
>
118+
</FormField>
119+
</div>
106120
<div>
107121
<FormField>
108122
<Switch bind:checked={data.PageantAgent} value="Enable pageant" />

pkg/store/store.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type SaveData struct {
2626
NamedPipeAgent bool
2727
UnixSocketAgent bool
2828
CygWinAgent bool
29+
ShowBalloon bool
2930
UnixSocketPath string
3031
CygWinSocketPath string
3132

@@ -46,6 +47,7 @@ func initSetting() SaveData {
4647
NamedPipeAgent: true,
4748
UnixSocketAgent: true,
4849
CygWinAgent: true,
50+
ShowBalloon: true,
4951
UnixSocketPath: filepath.Join(home, "OmniSSHAgent.sock"),
5052
CygWinSocketPath: filepath.Join(home, "OmniSSHCygwin.sock"),
5153

0 commit comments

Comments
 (0)