mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-10-05 14:41:33 +00:00
Various fixes
This commit is contained in:
5 files changed
+27
-19
No files matched your search
@@ -25,13 +25,19 @@ public class ClipboardHelper {
|
||||
|
||||
private static void apply(Map<DataFormat, Object> map, boolean showNotification) {
|
||||
Clipboard clipboard = Clipboard.getSystemClipboard();
|
||||
var hasText = map.containsKey(DataFormat.PLAIN_TEXT);
|
||||
var hasUrl = map.containsKey(DataFormat.URL);
|
||||
Map<DataFormat, Object> contents = Stream.of(
|
||||
DataFormat.PLAIN_TEXT,
|
||||
DataFormat.URL,
|
||||
DataFormat.RTF,
|
||||
DataFormat.HTML,
|
||||
// When we copy textual content, erase RTF and HTML clipboard to
|
||||
// not keep different variants of text in the clipboard
|
||||
hasText || hasUrl ? null : DataFormat.RTF,
|
||||
hasText || hasUrl ? null : DataFormat.HTML,
|
||||
// Do the same for text and URLs
|
||||
hasUrl && !hasText ? null : DataFormat.PLAIN_TEXT,
|
||||
hasText && !hasUrl ? null : DataFormat.URL,
|
||||
DataFormat.IMAGE,
|
||||
DataFormat.FILES)
|
||||
.filter(dataFormat -> dataFormat != null)
|
||||
.map(dataFormat -> {
|
||||
try {
|
||||
// This can fail if the clipboard data is invalid
|
||||
|
||||
@@ -65,7 +65,7 @@ public interface ExternalApplicationType extends PrefsValue {
|
||||
getApplicationName()))
|
||||
.readStdoutIfPossible();
|
||||
return out.isPresent() && !out.get().isBlank() && out.get().contains(getApplicationName() + ".app")
|
||||
? out.map(s -> Path.of(s))
|
||||
? out.map(s -> Path.of(s.lines().toList().getFirst()))
|
||||
: Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class DataStorageQuery {
|
||||
try {
|
||||
return Pattern.compile(toRegex(exact ? globPattern.toLowerCase() : "**" + globPattern.toLowerCase() + "**"));
|
||||
} catch (Throwable e) {
|
||||
return Pattern.compile(Pattern.quote(globPattern));
|
||||
return Pattern.compile(Pattern.quote(globPattern.toLowerCase()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,12 @@ public interface SingletonSessionStoreProvider extends DataStoreProvider {
|
||||
|
||||
t.setCustomVisibility(Bindings.createBooleanBinding(
|
||||
() -> {
|
||||
// This can be called while reloading the storage
|
||||
// where an entry is made invalid
|
||||
if (sec.getEntry().getStore() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SingletonSessionStore<?> s =
|
||||
sec.getWrapper().getEntry().getStore().asNeeded();
|
||||
return supportsSession(s) && (showToggleWhenInactive(s) || s.isSessionEnabled());
|
||||
|
||||
@@ -31,23 +31,19 @@ public class BooleanScope implements AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BooleanScope start() {
|
||||
synchronized (prop) {
|
||||
if (wait) {
|
||||
while (prop.get()) {
|
||||
ThreadHelper.sleep(50);
|
||||
}
|
||||
public synchronized BooleanScope start() {
|
||||
if (wait) {
|
||||
while (prop.get()) {
|
||||
ThreadHelper.sleep(50);
|
||||
}
|
||||
prop.setValue(true);
|
||||
|
||||
return this;
|
||||
}
|
||||
prop.setValue(true);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
synchronized (prop) {
|
||||
prop.setValue(false);
|
||||
}
|
||||
public synchronized void close() {
|
||||
prop.setValue(false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user