Skip to content

Commit f515f93

Browse files
Synchronized Sync (Mode 2026) (#576)
* fix: use mode 2026 for sync updates * progress * add cava output to gitignore * it works now! * deprecate sync_updates * fix * end frame * synchronized_sync config option * fix: check for config properly
1 parent 395b36e commit f515f93

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ missing
2323
version
2424
config_file.h
2525
.*
26+
cava

cava.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1109,8 +1109,9 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
11091109
// output: draw processed input
11101110
#ifdef NDEBUG
11111111
if (p.sync_updates) {
1112-
printf("\033P=1s\033\\");
1112+
printf("\033[2026h\033\\");
11131113
fflush(stdout);
1114+
printf("\033[2026l\033\\");
11141115
}
11151116
int rc;
11161117
#ifdef _MSC_VER
@@ -1170,11 +1171,12 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
11701171
default:
11711172
exit(EXIT_FAILURE); // Can't happen.
11721173
}
1174+
11731175
if (p.sync_updates) {
1174-
printf("\033P=2s\033\\");
1176+
printf("\033[2026h\033\\");
11751177
fflush(stdout);
1178+
printf("\033[2026l\033\\");
11761179
}
1177-
11781180
// terminal has been resized breaking to recalibrating values
11791181
if (rc == -1)
11801182
resizeTerminal = true;

config.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ bool load_config(char configPath[PATH_MAX], struct config_params *p, bool colors
687687

688688
p->waveform = iniparser_getint(ini, "output:waveform", 0);
689689

690-
p->sync_updates = iniparser_getint(ini, "output:alacritty_sync", 0);
690+
p->sync_updates = iniparser_getint(ini, "output:synchronized_sync", 0);
691691

692692
vertexShader = strdup(iniparser_getstring(ini, "output:vertex_shader", "pass_through.vert"));
693693
fragmentShader =
@@ -832,7 +832,7 @@ bool load_config(char configPath[PATH_MAX], struct config_params *p, bool colors
832832
p->sdl_x = GetPrivateProfileInt("output", "sdl_x", -1, configPath);
833833
p->sdl_y = GetPrivateProfileInt("output", "sdl_y", -1, configPath);
834834

835-
p->sync_updates = GetPrivateProfileInt("output", "alacritty_sync", 0, configPath);
835+
p->sync_updates = GetPrivateProfileInt("output", "synchronized_sync", 0, configPath);
836836
p->show_idle_bar_heads = GetPrivateProfileInt("output", "show_idle_bar_heads", 1, configPath);
837837
p->waveform = GetPrivateProfileInt("output", "waveform", 0, configPath);
838838

example_files/config

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@
189189
# 'frequency' displays the lower cut off frequency of the bar above.
190190
# Only supported on ncurses and noncurses output.
191191
; xaxis = none
192-
193-
# enable alacritty synchronized updates. 1 = on, 0 = off
192+
193+
# enable synchronized sync. 1 = on, 0 = off
194194
# removes flickering in alacritty terminal emulator.
195195
# defaults to off since the behaviour in other terminal emulators is unknown
196-
; alacritty_sync = 0
196+
; synchronized_sync = 0
197197

198198
# Shaders for sdl_glsl, located in $HOME/.config/cava/shaders
199199
; vertex_shader = pass_through.vert

0 commit comments

Comments
 (0)