Skip to content

Commit f1ab644

Browse files
new shortcut. minor tweaks. (#23)
1 parent d0dd0a3 commit f1ab644

File tree

5 files changed

+61
-20
lines changed

5 files changed

+61
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Privacy focused, cross-platform clipboard manager",
55
"author": "Daniel Railean <me@ddlele.com>",
66
"license": "No licence, rights reserved",
7-
"version": "0.8.5-8sep2024",
7+
"version": "0.8.6-2april2025",
88
"main": "dist/index.js",
99
"repository": {
1010
"type": "git",

src/frontend/Components/SearchBar.svelte

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
function handleChange() {
2222
currentSearchedText.set(text)
2323
}
24+
currentSearchedText.subscribe((v) => {
25+
if (v == '') {
26+
text = ''
27+
}
28+
})
29+
let searchFocused = false
2430
</script>
2531

2632
{#if $currentPage == IPages.items}
@@ -33,19 +39,27 @@
3339
type="text"
3440
placeholder="Search"
3541
bind:value={text}
42+
on:blur={() => {
43+
searchFocused = false
44+
}}
45+
on:focus={() => {
46+
searchFocused = true
47+
}}
3648
on:input={handleChange}
3749
/>
3850
<div class="ml-1 flex h-6">
39-
<Icons
40-
icon="tint"
41-
on:click={() => {
42-
console.log('clicked')
43-
currentPage.set(IPages.search)
44-
}}
45-
title="Advanced search"
46-
stopPropagation={false}
47-
size="6"
48-
/>
51+
{#if searchFocused}
52+
<Icons
53+
icon="tint"
54+
on:click={() => {
55+
console.log('clicked')
56+
currentPage.set(IPages.search)
57+
}}
58+
title="Advanced search"
59+
stopPropagation={false}
60+
size="6"
61+
/>
62+
{/if}
4963
<Icons
5064
icon="gear"
5165
on:click={() => {

src/frontend/Components/Settings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
label={item.displayName}
5555
title={item.description}
5656
fontSize={12}
57-
defaultValue={item.value}
57+
value={item.value}
5858
selectOptions={item.selectableOptions}
5959
on:change={(e) => {
6060
sendChange(key, { key, value: e.detail })

src/frontend/Components/ShortcutsHandler.svelte

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { delay } from '../KeyboardEventUtil'
44
import { sendShortcuts } from '../backendActions'
55
import { events, eventsToBackend } from '../events'
6-
import { currentPage, isAppHidden, isFocused, pressedKeysSizeLimit, shortcutsJson, userPreferences } from '../stores'
6+
import { currentPage, currentSearchedText, isAppHidden, isFocused, pressedKeysSizeLimit, shortcutsJson, userPreferences } from '../stores'
77
import { IPages, type IShortCut } from '../types'
88
import { clipListFiltered, currentScrollIndex, pressedKeys, selectedClipId } from './../stores'
99
import Button from './Button.svelte'
@@ -63,6 +63,7 @@
6363
6464
interface IShortcuts {
6565
scroll: IShortCut
66+
scroll_up: IShortCut
6667
close_and_paste: IShortCut
6768
search: IShortCut
6869
paste1: IShortCut
@@ -115,6 +116,27 @@
115116
combinationChangeHandler: (newCombination: string[][][]) => {}
116117
},
117118
119+
scroll_up: {
120+
combinations: [[['Left Command', 'Left Shift', '`']]],
121+
editVisible: false,
122+
delayMsBetweenTriggers: 100,
123+
handler: async () => {
124+
if ($currentPage != IPages.items) {
125+
return
126+
}
127+
if ($isAppHidden) {
128+
return
129+
}
130+
events.notifyBackend(eventsToBackend.windowUnhide)
131+
if ($clipListFiltered && $currentScrollIndex - 1 >= 0 && $clipListFiltered[$currentScrollIndex - 1][0]) {
132+
$currentScrollIndex--
133+
$selectedClipId = $clipListFiltered[$currentScrollIndex][0]
134+
scrollIntoView($selectedClipId)
135+
}
136+
},
137+
combinationChangeHandler: (newCombination: string[][][]) => {}
138+
},
139+
118140
close_and_paste: {
119141
combinations: [[['Left Command', '`'], ['Left Command'], []]],
120142
editVisible: false,
@@ -124,6 +146,7 @@
124146
return
125147
}
126148
events.notifyBackend(eventsToBackend.pasteHash, $selectedClipId)
149+
currentSearchedText.set('')
127150
$currentScrollIndex = -1
128151
$selectedClipId = ''
129152
},
@@ -151,6 +174,7 @@
151174
combinations: [[['Left Command', '1']]],
152175
handler: async () => {
153176
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[0][1].hash)
177+
currentSearchedText.set('')
154178
},
155179
combinationChangeHandler: () => {}
156180
},
@@ -161,6 +185,7 @@
161185
combinations: [[['Left Command', '2']]],
162186
handler: async () => {
163187
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[1][1].hash)
188+
currentSearchedText.set('')
164189
},
165190
combinationChangeHandler: () => {}
166191
},
@@ -170,6 +195,7 @@
170195
combinations: [[['Left Command', '3']]],
171196
handler: async () => {
172197
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[2][1].hash)
198+
currentSearchedText.set('')
173199
},
174200
combinationChangeHandler: () => {}
175201
},
@@ -180,6 +206,7 @@
180206
combinations: [[['Left Command', '4']]],
181207
handler: async () => {
182208
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[3][1].hash)
209+
currentSearchedText.set('')
183210
},
184211
combinationChangeHandler: () => {}
185212
},
@@ -190,6 +217,7 @@
190217
combinations: [[['Left Command', '5']]],
191218
handler: async () => {
192219
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[4][1].hash)
220+
currentSearchedText.set('')
193221
},
194222
combinationChangeHandler: () => {}
195223
},
@@ -200,6 +228,7 @@
200228
combinations: [[['Left Command', '6']]],
201229
handler: async () => {
202230
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[5][1].hash)
231+
currentSearchedText.set('')
203232
},
204233
combinationChangeHandler: () => {}
205234
},
@@ -210,6 +239,7 @@
210239
combinations: [[['Left Command', '7']]],
211240
handler: async () => {
212241
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[6][1].hash)
242+
currentSearchedText.set('')
213243
},
214244
combinationChangeHandler: () => {}
215245
},
@@ -220,6 +250,7 @@
220250
combinations: [[['Left Command', '8']]],
221251
handler: async () => {
222252
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[7][1].hash)
253+
currentSearchedText.set('')
223254
},
224255
combinationChangeHandler: () => {}
225256
},
@@ -230,6 +261,7 @@
230261
combinations: [[['Left Command', '9']]],
231262
handler: async () => {
232263
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[8][1].hash)
264+
currentSearchedText.set('')
233265
},
234266
combinationChangeHandler: () => {}
235267
},
@@ -240,6 +272,7 @@
240272
combinations: [[['Left Command', '0']]],
241273
handler: async () => {
242274
events.notifyBackend(eventsToBackend.pasteHash, $clipListFiltered[9][1].hash)
275+
currentSearchedText.set('')
243276
},
244277
combinationChangeHandler: () => {}
245278
}
@@ -304,12 +337,10 @@
304337
return { exists: false, name: '' }
305338
}
306339
export const getNameFromKey = (key: string): string => {
307-
return key.toUpperCase().replaceAll('_', ' ')
340+
return key.toUpperCase().replace(/_/g, ' ')
308341
}
309342
export const resetRecorded = () => {
310-
console.log('reseted!')
311343
simplestShortcut = []
312-
// recordedShortcuts = [[]]
313344
pressedKeys.set([[]])
314345
}
315346
currentPage.subscribe((v) => {

src/frontend/Components/Switch.svelte

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@
88
export let selectOptions: undefined | string[] = undefined
99
export let type: string
1010
export let value: any = undefined
11-
export let defaultValue: any = undefined
1211
export let title: string | undefined = undefined
1312
1413
onMount(() => {
15-
if (!value && defaultValue) {
16-
value = defaultValue
17-
}
1814
})
1915
2016
function handleClick(event) {

0 commit comments

Comments
 (0)