Fix color sync
This commit is contained in:
@@ -137,6 +137,14 @@ fi
|
||||
|
||||
rows_payload=${rows//$'\t'/$'\f'}
|
||||
rows_payload=${rows_payload//$'\n'/$'\v'}
|
||||
colors_file=${colors_file:-$HOME/.config/omarchy/current/theme/background-switcher-colors.json}
|
||||
colors_payload=""
|
||||
|
||||
if [[ -f $colors_file ]]; then
|
||||
colors_payload=$(<"$colors_file")
|
||||
colors_payload=${colors_payload//$'\t'/$'\f'}
|
||||
colors_payload=${colors_payload//$'\n'/$'\v'}
|
||||
fi
|
||||
|
||||
if [[ $cache_only == true ]]; then
|
||||
exit 0
|
||||
@@ -165,7 +173,7 @@ if [[ ! -S $socket_path ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\t%s\t%s\t%s\t%s\n' "$rows_payload" "$selected_list_image" "$selection_file" "$done_file" "$colors_file" |
|
||||
printf '%s\t%s\t%s\t%s\t%s\n' "$rows_payload" "$selected_list_image" "$selection_file" "$done_file" "$colors_payload" |
|
||||
socat -u - "UNIX-CONNECT:$socket_path"
|
||||
|
||||
while [[ ! -e $done_file ]]; do
|
||||
|
||||
@@ -83,13 +83,15 @@ ShellRoot {
|
||||
list.forceActiveFocus()
|
||||
}
|
||||
|
||||
function openSelector(nextImageDirs, nextImageRows, nextSelectedImage, nextSelectionFile, nextDoneFile, nextColorsFile) {
|
||||
function openSelector(nextImageDirs, nextImageRows, nextSelectedImage, nextSelectionFile, nextDoneFile, nextColorsFile, nextColorsRaw) {
|
||||
imageDirs = nextImageDirs
|
||||
imageRows = nextImageRows
|
||||
selectedImage = nextSelectedImage
|
||||
selectionFile = nextSelectionFile
|
||||
doneFile = nextDoneFile
|
||||
colorsFile = nextColorsFile || (Quickshell.env("HOME") + "/.config/omarchy/current/theme/background-switcher-colors.json")
|
||||
if (nextColorsRaw)
|
||||
loadColors(nextColorsRaw)
|
||||
imageModel.clear()
|
||||
selectedIndex = 0
|
||||
list.currentIndex = 0
|
||||
@@ -148,14 +150,14 @@ ShellRoot {
|
||||
|
||||
Component.onCompleted: {
|
||||
if (selectionFile)
|
||||
openSelector(imageDirs, "", selectedImage, selectionFile, Quickshell.env("OMARCHY_IMAGE_SELECTOR_DONE_FILE"), colorsFile)
|
||||
openSelector(imageDirs, "", selectedImage, selectionFile, Quickshell.env("OMARCHY_IMAGE_SELECTOR_DONE_FILE"), colorsFile, "")
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "image-selector"
|
||||
|
||||
function open(imageDirs: string, imageRows: string, selectedImage: string, selectionFile: string, doneFile: string, colorsFile: string): void {
|
||||
root.openSelector(imageDirs, imageRows, selectedImage, selectionFile, doneFile, colorsFile)
|
||||
root.openSelector(imageDirs, imageRows, selectedImage, selectionFile, doneFile, colorsFile, "")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +170,7 @@ ShellRoot {
|
||||
parser: SplitParser {
|
||||
onRead: function(message) {
|
||||
var fields = message.split("\t")
|
||||
root.openSelector("", root.decodeField(fields[0]), fields[1] || "", fields[2] || "", fields[3] || "", fields[4] || "")
|
||||
root.openSelector("", root.decodeField(fields[0]), fields[1] || "", fields[2] || "", fields[3] || "", "", root.decodeField(fields[4]))
|
||||
clientSocket.connected = false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user