feat: increase clipboard history limit to 1000 items
This commit is contained in:
parent
b2d9167b95
commit
380742a869
@ -14,4 +14,4 @@ logging:
|
||||
|
||||
clipboard:
|
||||
# Maximum number of items to keep in the clipboard history.
|
||||
max_items: 100
|
||||
max_items: 1000
|
||||
|
@ -77,16 +77,12 @@ func NewWatchCmd(history *models.History) *cobra.Command {
|
||||
log.Fatal().Err(err).Msg("Failed to initialize clipboard")
|
||||
}
|
||||
|
||||
var (
|
||||
lastText string
|
||||
lastImage []byte
|
||||
)
|
||||
var lastText string
|
||||
|
||||
for {
|
||||
time.Sleep(250 * time.Millisecond)
|
||||
|
||||
textOut := clipboard.Read(clipboard.FmtText)
|
||||
imgOut := clipboard.Read(clipboard.FmtImage)
|
||||
|
||||
if len(textOut) > 0 {
|
||||
text := string(textOut)
|
||||
@ -102,18 +98,6 @@ func NewWatchCmd(history *models.History) *cobra.Command {
|
||||
log.Info().Str("content", text).Msg("Text item added ")
|
||||
}
|
||||
}
|
||||
|
||||
if len(imgOut) > 0 && (lastImage == nil || string(imgOut) != string(lastImage)) {
|
||||
item := models.HistoryItem{
|
||||
Data: imgOut,
|
||||
DataType: 1, // 1 for image/png
|
||||
Timestamp: time.Now(),
|
||||
Pinned: false,
|
||||
}
|
||||
history.Add(item)
|
||||
lastImage = imgOut
|
||||
log.Info().Msg("Image item added")
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ func LoadConfig() (Config, string) {
|
||||
file.Close()
|
||||
}
|
||||
|
||||
cfg.Clipboard.MaxItems = 1000
|
||||
cfg.Logging.Format = "console"
|
||||
cfg.Logging.Level = "info"
|
||||
cfg.Logging.Path = logFilePath()
|
||||
|
Loading…
x
Reference in New Issue
Block a user