-
Notifications
You must be signed in to change notification settings - Fork 6
/
oyranos-monitor-white-point.c
2097 lines (1842 loc) · 78.9 KB
/
oyranos-monitor-white-point.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/** @file oyranos-monitor-white-point.c
*
* Oyranos is an open source Color Management System
*
* Copyright (C) 2017-2023 Kai-Uwe Behrmann
*
*/
/**
* @brief night vision admin tool
* @internal
* @author Kai-Uwe Behrmann <ku.b@gmx.de> and others
* @par License:
* BSD-3-Clause <http://www.opensource.org/licenses/BSD-3-Clause>
* @since 2017/09/19
*
* A tool to set the white point dependent on local state of the sun.
*
*/
# include <stddef.h>
#include <stdio.h> /* popen() */
#include <math.h>
#include <string.h>
#include <time.h>
#include <unistd.h> /* usleep() */
#include "oyranos_color.h"
#include "oyranos_color_internal.h"
#include "oyranos_conversion.h"
#include "oyranos_debug.h"
#include "oyranos_helper.h"
#include "oyranos_helper_macros.h"
#include "oyranos_internal.h"
#include "oyranos_json.h"
#include "oyranos_monitor_effect.h"
#include "oyranos_config.h"
#include "oyranos_version.h"
#include "oyranos_sentinel.h"
#include "oyranos_string.h"
#include "oyranos_texts.h"
#include "oyranos_threads.h"
#include "oyProfiles_s.h"
#include <X11/Xcm/XcmVersion.h>
#define DBG_S_ if(oy_debug >= 1)DBG_S
#define DBG1_S_ if(oy_debug >= 1)DBG1_S
#define DBG2_S_ if(oy_debug >= 1)DBG2_S
#define DBG3_S_ if(oy_debug >= 1)DBG3_S
int __sunriset__( int year, int month, int day, double lon, double lat,
double altit, int upper_limb, double *trise, double *tset );
int findLocation(oySCOPE_e scope, int dry, int verbose);
int getLocation( double * lon, double * lat);
double getSunHeight( double year, double month, double day, double gmt_hours, double lat, double lon, int verbose, oyjl_val root );
int getSunriseSunset( double * rise, double * set, int dry, const char * format, char ** text, int verbose );
int isNight(int dry);
int runDaemon(int dmode, int verbose);
int setWtptMode( oySCOPE_e scope, int wtpt_mode, int dry, int verbose );
void pingNativeDisplay();
int checkWtptState();
void updateVCGT(int verbose);
// Dark/Bright Desktop backgrounds
char * getCurrentColorScheme();
void setColorScheme( const char * scheme );
char ** listColorSchemes( int * count );
#define OYJL_IS_NOT_O( x ) (!o->o || strcmp(o->o,x) != 0)
#define OYJL_IS_O( x ) (o->o && strcmp(o->o,x) == 0)
static uint32_t icc_profile_flags = 0;
static oyjlOptionChoice_s * linear_effect_choices_ = NULL;
static oyjlOptionChoice_s * getLinearEffectProfileChoices (
oyjlOption_s * o,
int * selected,
oyjlOptions_s * opts OY_UNUSED )
{
int choices = 0;
oyProfiles_s * patterns = oyProfiles_New( NULL ),
* profiles = 0;
const char * man_page = getenv("DISPLAY");
if(!selected && linear_effect_choices_)
return linear_effect_choices_;
if(man_page && strcmp(man_page,"man_page") == 0)
{
oyjlOptionChoice_s * c = calloc(1+2+1, sizeof(oyjlOptionChoice_s));
if(c)
{
/* first entry is for unsetting */
int i = 0;
c[i].nick = strdup("-");
c[i].name = strdup(_("[none]"));
c[i].description = strdup("");
c[i].help = strdup("");
/* example profile choices */
c[++i].nick = strdup("Effect-1");
c[i].name = strdup("Example Effect 1");
c[i].description = strdup("ICC profile of class abstract, wich affects gamma");
c[i].help = strdup("");
c[++i].nick = strdup("Effect-2");
c[i].name = strdup("Example Effect 2");
c[i].description = strdup("ICC profile of class abstract, wich affects gamma");
c[i].help = strdup("");
/* empty choice for end of list */
c[++i].nick = malloc(4);
c[i].nick[0] = '\000';
}
return c;
}
else
{
int i;
char * value = NULL;
oyjlOptionChoice_s * c;
// only linear effects
oyProfile_s * pattern = oyProfile_FromFile( "meta:EFFECT_linear;yes", OY_NO_LOAD, NULL );
oyProfiles_MoveIn( patterns, &pattern, -1 );
if(icc_profile_flags == 0)
icc_profile_flags = oyICCProfileSelectionFlagsFromOptions(
OY_CMM_STD, "//" OY_TYPE_STD "/icc_color",
NULL, 0 );
profiles = oyProfiles_Create( patterns, icc_profile_flags, NULL );
oyProfiles_Release( &patterns );
choices = oyProfiles_Count( profiles );
if(!choices)
{
oyProfiles_Release( &profiles );
return NULL;
}
c = calloc(1+choices+1, sizeof(oyjlOptionChoice_s));
if(OYJL_IS_O("g") && selected)
value = oyGetPersistentString( OY_DISPLAY_STD "/night_effect", 0, oySCOPE_USER_SYS, oyAllocateFunc_ );
else if(OYJL_IS_O("e") && selected)
value = oyGetPersistentString( OY_DISPLAY_STD "/sunlight_effect", 0, oySCOPE_USER_SYS, oyAllocateFunc_ );
else if(selected)
*selected = 0;
if(c)
{
linear_effect_choices_ = c;
/* first entry is for unsetting */
i = 0;
c[i].nick = strdup("-");
c[i].name = strdup(_("[none]"));
c[i].description = strdup("");
c[i].help = strdup("");
/* profile choices */
for(i = 0; i < choices; ++i)
{
oyProfile_s * p = oyProfiles_Get( profiles, i );
const char * nick = oyProfile_GetFileName( p, -1 );
if(strchr(nick, OY_SLASH_C))
nick = strrchr(nick, OY_SLASH_C) + 1;
c[i+1].nick = strdup(nick);
c[i+1].name = strdup(oyProfile_GetText( p, oyNAME_DESCRIPTION ));
c[i+1].description = strdup("");
c[i+1].help = strdup("");
if(selected && value && strcmp(value, nick) == 0)
*selected = i+1;
oyProfile_Release( &p );
}
/* empty choice for end of list */
c[i+1].nick = malloc(4);
c[i+1].nick[0] = '\000';
}
return c;
}
return NULL;
}
double getDoubleFromDB ( const char * key,
double fallback )
{
double d = fallback, tmp = 0;
char * value = oyGetPersistentString( key, 0, oySCOPE_USER_SYS, oyAllocateFunc_ );
if(value && oyjlStringToDouble( value, &tmp, 0,0 ) == 0)
d = tmp;
if(value)
oyDeAllocateFunc_( value );
return d;
}
#define OYJL_IS_NOT_O( x ) (!o->o || strcmp(o->o,x) != 0)
#define OYJL_IS_O( x ) (o->o && strcmp(o->o,x) == 0)
#define OYJL_IS_OPTION( x ) (o->option && strcmp(o->option,x) == 0)
static oyjlOptionChoice_s * white_point_choices_ = NULL;
static int white_point_choices_selected_ = -1;
oyjlOptionChoice_s * getWhitePointChoices ( oyjlOption_s * o,
int * selected,
oyjlOptions_s * opts OY_UNUSED )
{
uint32_t flags = 0;
int choices = 0, current = -1;
const char ** choices_string_list = NULL;
int error = 0;
if(!selected && white_point_choices_)
return white_point_choices_;
error = oyOptionChoicesGet2( oyWIDGET_DISPLAY_WHITE_POINT, flags,
oyNAME_NAME, &choices,
&choices_string_list, ¤t );
if(!error)
{
int i;
long l = -1;
char * value = NULL;
const char * man_page = getenv("DISPLAY");
int skip_temperature_info = man_page && strcmp(man_page,"man_page") == 0;
oyjlOptionChoice_s * c = calloc(choices+1, sizeof(oyjlOptionChoice_s));
if(c)
{
white_point_choices_ = c;
for(i = 0; i < choices; ++i)
{
char * v = malloc(12);
sprintf(v, "%d", i);
c[i].nick = v;
c[i].name = strdup(choices_string_list[i]);
c[i].description = strdup("");
c[i].help = strdup("");
if(i == 1 && !skip_temperature_info) /* automatic */
{
double temperature = oyGetTemperature(0);
if(temperature)
oyStringAddPrintf( &c[i].name, 0,0, " %g %s ", temperature, _("Kelvin") );
}
if((int)i == current && OYJL_IS_O("w") && 0 /* not possible, as the result is used over different options */)
oyStringAddPrintf( &c[i].name, 0,0, " *" );
}
c[i].nick = malloc(4);
c[i].nick[0] = '\000';
}
oyOptionChoicesFree( oyWIDGET_DISPLAY_WHITE_POINT, &choices_string_list, choices );
white_point_choices_selected_ = current;
if(selected)
*selected = current;
if(OYJL_IS_O("n") && selected)
{
value = oyGetPersistentString( OY_DISPLAY_STD "/display_white_point_mode_night", 0, oySCOPE_USER_SYS, oyAllocateFunc_ );
if(value && oyjlStringToLong( value, &l, 0 ) <= 0)
*selected = l;
} else if(OYJL_IS_O("s") && selected)
{
value = oyGetPersistentString( OY_DISPLAY_STD "/display_white_point_mode_sunlight", 0, oySCOPE_USER_SYS, oyAllocateFunc_ );
if(value && oyjlStringToLong( value, &l, 0 ) <= 0)
*selected = l;
}
return c;
} else
return NULL;
}
char ** listColorSchemes( int * count )
{
int n = 0, size = 0, i;
char ** list, ** result_list = NULL;
char * result = oyjlReadCommandF( &size, "r", malloc, "LANG=C.UTF-8 plasma-apply-colorscheme --list-schemes" );
list = oyjlStringSplit( result, '\n', &n, 0 );
*count = 0;
if(list)
{
for(i = 0; i < n; ++i)
{
char * t = list[i];
if(strstr(t, "You have the"))
continue;
if(strchr(t, '*') != NULL)
t = strchr(t, '*') + 1;
if(t[0] == ' ')
++t;
if(strstr(t, " (current color scheme)"))
{
char * txt = strstr(t, " (current color scheme)");
txt[0] = '\000';
}
oyjlStringListPush( &result_list, count, t, oyAllocateFunc_, oyDeAllocateFunc_ );
}
oyjlStringListRelease( &list, n, free );
}
return result_list;
}
static oyjlOptionChoice_s * getColorSchemeChoices (
oyjlOption_s * o,
int * selected,
oyjlOptions_s * opts OY_UNUSED )
{
const char * man_page = getenv("DISPLAY");
int i = 0, n = 0;
char ** list;
char * value;
int night;
oyjlOptionChoice_s * c = NULL;
if(man_page && strcmp(man_page,"man_page") == 0)
{
c = calloc(1+2+1, sizeof(oyjlOptionChoice_s));
if(c)
{
/* first entry is for unsetting */
c[i].nick = strdup("-");
c[i].name = strdup(_("[none]"));
c[i].description = strdup("");
c[i].help = strdup("");
/* example choice */
c[++i].nick = strdup("Breeze");
c[i].name = strdup("Breeze");
c[i].description = strdup("Detected Color Scheme");
c[i].help = strdup("");
c[++i].nick = strdup("BreezeDark");
c[i].name = strdup("Breeze Dark");
c[i].description = strdup("2. detected Color Scheme");
c[i].help = strdup("");
/* empty choice for end of list */
c[++i].nick = malloc(4);
c[i].nick[0] = '\000';
}
return c;
}
night = OYJL_IS_OPTION("night-color-scheme");
if(night)
value = oyGetPersistentString( OY_DISPLAY_STD "/night_color_scheme", 0, oySCOPE_USER_SYS, oyAllocateFunc_ );
else
value = oyGetPersistentString( OY_DISPLAY_STD "/sunlight_color_scheme", 0, oySCOPE_USER_SYS, oyAllocateFunc_ );
list = listColorSchemes( &n );
if(list)
{
c = calloc(n+2, sizeof(oyjlOptionChoice_s));
if(c)
{
int pos = 1;
/* first entry is for unsetting */
c[i].nick = strdup("-");
c[i].name = strdup(_("[none]"));
c[i].description = strdup("");
c[i].help = strdup("");
for(i = 0; i < n; ++i)
{
char * t = list[i];
c[pos].nick = strdup( t );
c[pos].name = strdup("");
c[pos].description = strdup("");
c[pos].help = strdup("");
if(selected && value && strcasecmp(t, value) == 0)
*selected = pos;
++pos;
}
}
oyjlStringListRelease( &list, n, oyDeAllocateFunc_ );
}
if(selected && *selected > 0 && c)
fprintf( stderr, "%s %s selected: %d %s\n", o->option, value, *selected, c[*selected].nick );
return c;
}
char * getCurrentColorScheme()
{
int n = 0,i, size = 0;
char * result = oyjlReadCommandF( &size, "r", malloc, "LANG=C.UTF-8 plasma-apply-colorscheme --list-schemes" );
char ** list = oyjlStringSplit( result, '\n', &n, 0 );
char * current = NULL;
if(list)
{
for(i = 0; i < n; ++i)
{
char * t = list[i];
if(strstr(t, "You have the"))
continue;
if(strchr(t, '*') != NULL)
t = strchr(t, '*') + 1;
if(t[0] == ' ')
++t;
if(strstr(t, " (current color scheme)"))
{
char * txt = strstr(t, " (current color scheme)");
txt[0] = '\000';
current = strdup( t );
break;
}
}
oyjlStringListRelease( &list, n, free );
}
return current;
}
void setColorScheme( const char * scheme )
{
int size = 0;
char * command = NULL;
char * result;
const char * home = oyGetHomeDir_();
const char * ThemeName = strstr(scheme, "dark") == NULL && strstr(scheme, "Dark") == NULL?"Adwaita":"Adwaita-dark";
int list_n = 0;
char ** list = listColorSchemes( &list_n );
int pos = oyjlStringListFind( list, &list_n, scheme, OYJL_COMPARE_CASE, 0 );
scheme = pos >= 0 ? list[pos] : scheme;
oyjlStringAdd( &command, 0,0, "plasma-apply-colorscheme %s; export THEME=%s; sed -i \"/Net\\/ThemeName/cNet\\/ThemeName \\\"$THEME\\\"\" %s/.config/xsettingsd/xsettingsd.conf; xsettingsd & (sleep 1; killall xsettingsd)", scheme, ThemeName, home );
result = oyjlReadCommandF( &size, "r", malloc, command );
free(result);
free(command);
}
const char * jcommands = "{\n\
\"command_set\": \"oyranos-monitor-white-point\",\n\
\"comment\": \"command_set_delimiter - build key:value; default is '=' key=value\",\n\
\"comment\": \"command_set_option - use \\\"-s\\\" \\\"key\\\"; skip \\\"--\\\" direct in front of key\",\n\
\"command_get\": \"oyranos-monitor-white-point\",\n\
\"command_get_args\": [\"-X\",\"json+command\"]\n\
}";
void myOptionsRelease ( oyjlOptions_s ** opts )
{
if(*opts) free(*opts);
*opts = NULL;
}
oySCOPE_e scope = oySCOPE_USER;
double hour_ = -1.0; /* ignore this default value */
int myMain( int argc , const char** argv )
{
unsigned i;
int error = 0;
/* the functional switches */
int wtpt_mode = -1;
int wtpt_mode_night = -1;
int wtpt_mode_sunlight = -1;
const char * sunlight_effect = NULL;
const char * sunlight_color_scheme = NULL;
const char * night_effect = NULL;
const char * night_color_scheme = NULL;
double night_backlight = -1;
double temperature = 0.0, temperature_man = 2800.0; // 2800 kelvin is near candel light
int show = 0;
const char * export = NULL;
int dry = 0;
int system_wide = 0;
int location = 0;
double longitude = 360;
double latitude = 360;
const char * sunrise = NULL;
double twilight = -1000;
char * value = NULL;
double rise = 0.0,
set = 0.0;
int daemon = -1;
int check = 0;
const char * help = NULL;
int verbose = 0;
int version = 0;
int state = 0;
int worked = 0;
oyjlOptions_s * opts;
const char * render = NULL;
oyjlUi_s * ui;
oyjlUiHeaderSection_s * info;
const char * man_page = getenv("DISPLAY");
int man = 0;
if( man_page && strcmp(man_page,"man_page") == 0 )
man = 1;
if(oy_debug)
fprintf(stderr, " %.06g %s\n", DBG_UHR_, oyPrintTime() );
if(!man)
temperature_man = oyGetTemperature(5000);
DBG_S_( oyPrintTime() );
opts = oyjlOptions_New( argc, (const char **)argv );
/* nick, name, description, help */
oyjlOptionChoice_s r_choices[] = {{"TEXT", "TEXT", NULL, NULL},
{"JSON", "JSON", NULL, NULL},
{NULL,NULL,NULL,NULL}};
oyjlOptionChoice_s d_choices[] = {{"0", _("Disable"), _("Deactivate"), ""},
{"1", _("Autostart"), _("Autostart"), ""},
{"2", _("Activate"), _("Activate"), ""},
{NULL,NULL,NULL,NULL}};
oyjlOptionChoice_s env_vars[]={{"OY_DEBUG", _("set the Oyranos debug level."), _("Alternatively the -v option can be used."), _("Valid integer range is from 1-20.")},
{"OY_MODULE_PATH", _("route Oyranos to additional directories containing modules."), "", ""},
{NULL,NULL,NULL,NULL}};
oyjlOptionChoice_s examples[]={{_("Enable the daemon, set night white point to 3000 Kelvin and use that in night mode"), "oyranos-monitor-white-point -d 2 -a 3000 -n 1", "", ""},
{_("Switch all day light intereference off such as white point and effect"), "oyranos-monitor-white-point -s 0 -e 0", "", ""},
{NULL,NULL,NULL,NULL}};
oyjlOptionChoice_s see_as_well[]={{"oyranos-monitor(1) oyranos-config(1) oyranos(3)", "", "", ""},
{"https://gitlab.com/oyranos/oyranos","","",""},
{NULL,NULL,NULL,NULL}};
oyjlOption_s oarray[] = {
/* type, flags, o, option, key, name, description, help, value_name, value_type, values, var_type, variable */
{"oiwi", OYJL_OPTION_FLAG_ACCEPT_NO_ARG, "d", "daemon", NULL, _("daemon"), _("Control user daemon"), NULL, "0|1|2", oyjlOPTIONTYPE_CHOICE, {.choices.list = (oyjlOptionChoice_s*)oyjlStringAppendN( NULL, (const char*)d_choices, sizeof(d_choices), 0 )}, oyjlINT, {.i=&daemon},NULL},
{"oiwi", 0, "m", "modes", NULL, _("Modes"), _("Show white point modes"), NULL, NULL, oyjlOPTIONTYPE_NONE, {}, oyjlINT, {.i=&show},NULL},
{"oiwi", 0, "w", "white-point", NULL, _("Mode"), _("Set white point mode"), NULL, "0|1|2|3|4|5|6|7", oyjlOPTIONTYPE_FUNCTION, {.getChoices = getWhitePointChoices}, oyjlINT,{.i=&wtpt_mode},NULL},
{"oiwi", 0, "n", "night-white-point", NULL, _("Night Mode"), _("Set night time mode"), _("A white point temperature of around 4000K and lower allows to get easier into sleep. Enable by setting this option to Automatic (-n=1) and Temperature to 3000 (-a=3000)."), "0|1|2|3|4|5|6|7", oyjlOPTIONTYPE_FUNCTION, {.getChoices = getWhitePointChoices}, oyjlINT, {.i=&wtpt_mode_night},NULL},
{"oiwi", 0, "s", "sun-white-point", NULL, _("Day Mode"), _("Set day time mode"), NULL, "0|1|2|3|4|5|6|7", oyjlOPTIONTYPE_FUNCTION, {.getChoices = getWhitePointChoices}, oyjlINT, {.i=&wtpt_mode_sunlight},NULL},
{"oiwi", 0, "a", "automatic", NULL, _("Temperature"), _("A value from 2700 till 8000 Kelvin is expected to show no artefacts"), NULL,
/* The white point profiles will be generated in many different shades, which will explode
* conversion cache. Thus we limit the possible shades to 100 kelvin steps, which in turn
* limits to around 100 profiles per monitor white point. */
_("KELVIN"), oyjlOPTIONTYPE_DOUBLE, {.dbl.start = 1100, .dbl.end = 10100, .dbl.tick = 100, .dbl.d = temperature_man}, oyjlDOUBLE, {.d=&temperature},NULL},
{"oiwi", 0, "g", "night-effect", NULL, _("Night effect"), _("Set night time effect"), _("A ICC profile of class abstract. Ideally the effect profile works on 1D RGB curves only and is marked meta:EFFECT_linear=yes ."), _("ICC_PROFILE"), oyjlOPTIONTYPE_FUNCTION, {.getChoices = getLinearEffectProfileChoices}, oyjlSTRING, {.s=&night_effect},NULL},
{"oiwi", 0, "e", "sunlight-effect", NULL, _("Sun light effect"), _("Set day time effect"), _("A ICC profile of class abstract. Ideally the effect profile works on 1D RGB curves only and is marked meta:EFFECT_linear=yes ."), _("ICC_PROFILE"), oyjlOPTIONTYPE_FUNCTION, {.getChoices = getLinearEffectProfileChoices}, oyjlSTRING, {.s=&sunlight_effect},NULL},
{"oiwi", 0, "b", "night-backlight", NULL, _("Night Backlight"), _("Set Nightly Backlight"), _("The option needs xbacklight installed and supporting your device for dimming the monitor lamp."), _("PERCENT"), oyjlOPTIONTYPE_DOUBLE,
{.dbl.start = 0, .dbl.end = 100, .dbl.tick = 1, .dbl.d = man?4:getDoubleFromDB( OY_DISPLAY_STD "/display_backlight_night", 0 )}, oyjlDOUBLE, {.d=&night_backlight},NULL},
{"oiwi", 0, NULL, "sunlight-color-scheme", NULL, _("Sun light color scheme"), _("Set day time typical brighter color scheme"), _("Use this to switch color scheme day/night dependent. plasma-apply-colorscheme --list-schemes"), _("STRING"), oyjlOPTIONTYPE_FUNCTION, {.getChoices = getColorSchemeChoices}, oyjlSTRING, {.s=&sunlight_color_scheme},NULL},
{"oiwi", 0, NULL, "night-color-scheme", NULL, _("Night color scheme"), _("Set nightly typical darker color scheme"), _("Use this to switch color scheme day/night dependent. plasma-apply-colorscheme --list-schemes"), _("STRING"), oyjlOPTIONTYPE_FUNCTION, {.getChoices = getColorSchemeChoices}, oyjlSTRING, {.s=&night_color_scheme},NULL},
{"oiwi", 0, "l", "location", NULL, _("location"), _("Detect location by IP adress"), NULL, NULL, oyjlOPTIONTYPE_NONE, {}, oyjlINT, {.i=&location},NULL},
{"oiwi", 0, "i", "latitude", NULL, _("Latitude"), _("Set Latitude"), NULL, _("ANGLE_IN_DEGREE"), oyjlOPTIONTYPE_DOUBLE,
{.dbl.start = -90, .dbl.end = 90, .dbl.tick = 1, .dbl.d = man?0.0:getDoubleFromDB( OY_DISPLAY_STD "/latitude", 0 )}, oyjlDOUBLE, {.d=&latitude},NULL},
{"oiwi", 0, "o", "longitude", NULL, _("Longitude"), _("Set Longitude"), NULL, _("ANGLE_IN_DEGREE"), oyjlOPTIONTYPE_DOUBLE,
{.dbl.start = -180, .dbl.end = 180, .dbl.tick = 1, .dbl.d = man?0.0:getDoubleFromDB( OY_DISPLAY_STD "/longitude", 0 )}, oyjlDOUBLE, {.d=&longitude},NULL},
{"oiwi", OYJL_OPTION_FLAG_ACCEPT_NO_ARG, "r", "sunrise", NULL, _("Sunrise"), _("Show local time, used geographical location, twilight height angles, sun rise and sun set times"), NULL, _("FORMAT"), oyjlOPTIONTYPE_CHOICE, {.choices.list = (oyjlOptionChoice_s*)oyjlStringAppendN( NULL, (const char*)r_choices, sizeof(r_choices), 0 )}, oyjlSTRING, {.s=&sunrise},NULL},
{"oiwi", 0, "t", "twilight", NULL, _("Twilight"), _("Set Twilight angle"), _("0:sunrise/sunset|-6:civil|-12:nautical|-18:astronomical"), _("ANGLE_IN_DEGREE"), oyjlOPTIONTYPE_DOUBLE,
{.dbl.start = -18, .dbl.end = 18, .dbl.tick = 1, .dbl.d = man?0.0:getDoubleFromDB( OY_DISPLAY_STD "/twilight", 0 )}, oyjlDOUBLE, {.d=&twilight},NULL},
{"oiwi", 0, "z", "system-wide", NULL, _("System Wide"), _("System wide DB setting"), NULL, NULL, oyjlOPTIONTYPE_NONE, {}, oyjlINT, {.i=&system_wide},NULL},
/* default option template -X|--export */
{"oiwi", 0, "X", "export", NULL, NULL, NULL, NULL, NULL, oyjlOPTIONTYPE_CHOICE, {.choices.list = NULL}, oyjlSTRING, {.s=&export},NULL},
/* The --render option can be hidden and used only internally. */
{"oiwi", OYJL_OPTION_FLAG_EDITABLE, "R", "render", NULL, NULL, NULL, NULL, NULL, oyjlOPTIONTYPE_CHOICE, {0}, oyjlSTRING, {.s=&render},NULL},
{"oiwi", OYJL_OPTION_FLAG_ACCEPT_NO_ARG, "h", "help",NULL,NULL,NULL,NULL, NULL, oyjlOPTIONTYPE_CHOICE, {0}, oyjlSTRING, {.s=&help},NULL},
{"oiwi", 0, NULL,"synopsis",NULL, NULL, NULL, NULL, NULL, oyjlOPTIONTYPE_NONE, {0}, oyjlNONE, {0},NULL},
{"oiwi", 0, "v", "verbose", NULL, _("Verbose"), _("Verbose"), NULL, NULL, oyjlOPTIONTYPE_NONE, {0}, oyjlINT, {.i=&verbose},NULL},
{"oiwi", 0, "V", "version", NULL, _("Version"), _("Version"), NULL, NULL, oyjlOPTIONTYPE_NONE, {0}, oyjlINT, {.i=&version},NULL},
{"oiwi", OYJL_OPTION_FLAG_MAINTENANCE|OYJL_OPTION_FLAG_IMMEDIATE, "y", "test", NULL, _("No Action"), NULL, NULL, NULL, oyjlOPTIONTYPE_NONE, {}, oyjlINT, {.i=&dry},NULL},
{"oiwi", 0, "u", "hour", NULL, "hour", "hour", NULL, NULL, oyjlOPTIONTYPE_DOUBLE, {.dbl.start = 0, .dbl.end = 48, .dbl.tick = 1, .dbl.d = 0}, oyjlDOUBLE, {.d=&hour_},NULL},
{"oiwi", OYJL_OPTION_FLAG_MAINTENANCE, "c", "check", NULL, "check", "check", NULL, NULL, oyjlOPTIONTYPE_NONE, {}, oyjlINT, {.i=&check},NULL},
/* blind options, useful only for man page generation */
{"oiwi", 0, "E", "man-environment_variables", NULL, "", "", NULL, NULL, oyjlOPTIONTYPE_CHOICE, {.choices.list = (oyjlOptionChoice_s*)oyjlStringAppendN( NULL, (const char*)env_vars, sizeof(env_vars), 0 )}, oyjlNONE, {.i=NULL},NULL},
{"oiwi", 0, "A", "man-examples", NULL, "", "", NULL, NULL, oyjlOPTIONTYPE_CHOICE, {.choices.list = (oyjlOptionChoice_s*)oyjlStringAppendN( NULL, (const char*)examples, sizeof(examples), 0 )}, oyjlNONE, {.i=NULL},NULL},
{"oiwi", 0, "S", "man-see_as_well", NULL, "", "", NULL, NULL, oyjlOPTIONTYPE_CHOICE, {.choices.list = (oyjlOptionChoice_s*)oyjlStringAppendN( NULL, (const char*)see_as_well, sizeof(see_as_well), 0 )}, oyjlNONE, {.i=NULL},NULL},
{"",0,0,0,0,0,0,0, NULL, oyjlOPTIONTYPE_END, {},0,{},0}
};
opts->array = (oyjlOption_s*)oyjlStringAppendN( NULL, (const char*)oarray, sizeof(oarray), 0 );
oyjlOptionGroup_s groups[] = {
/* type, flags, name, description, help, mandatory, optional, detail */
{"oiwg", 0, _("Mode"), _("Actual mode"), NULL, "w,a", "z,v", "w,a,y",NULL},
#if defined( XCM_HAVE_X11 )
{"oiwg", 0, _("Night Mode"), _("Nightly appearance"), _("The Night white point mode shall allow to reduce influence of blue light during night time. A white point temperature of around 4000K and lower allows to get easier into sleep and is recommended along with warm room illumination in evening and night times."), "n,g,b,night-color-scheme", "z,v,y", "n,g,b,night-color-scheme",NULL},
#else
{"oiwg", 0, _("Night Mode"), _("Nightly appearance"), _("The Night white point mode shall allow to reduce influence of blue light during night time. A white point temperature of around 4000K and lower allows to get easier into sleep and is recommended along with warm room illumination in evening and night times."), "n,g,night-color-scheme", "z,v,y", "n,g,night-color-scheme",NULL},
#endif
{"oiwg", 0, _("Day Mode"), _("Sun light appearance"), NULL, "s,e,sunlight-color-scheme", "z,v,y", "s,e,sunlight-color-scheme",NULL},
{"oiwg", OYJL_GROUP_FLAG_EXPLICITE, _("Location"), _("Location and Twilight"), NULL, "l|i,o", "t,z,v,y", "l,i,o,t",NULL},
{"oiwg", 0, _("Information"), _("Give Informations"), NULL, "r,m", "v", "r,m",NULL},
{"oiwg", 0, _("Daemon Service"), _("Run sunset daemon"), NULL, "d", "v", "d",NULL},
{"oiwg", OYJL_GROUP_FLAG_GENERAL_OPTS, _("Misc"), _("General options"), NULL, "X|h|V|R", "v", "h,X,R,V,z,y,v",NULL},
{"",0,0,0,0,0,0,0,0}
};
double night = isNight(0);
oyjlOptionGroup_s ng;
if(man) night = 1;
if(night == 1)
{
memcpy( &ng, &groups[0], sizeof(oyjlOptionGroup_s) );
memcpy( &groups[0], &groups[1], sizeof(oyjlOptionGroup_s) );
memcpy( &groups[1], &ng, sizeof(oyjlOptionGroup_s) );
} else if(night == 0)
{
memcpy( &ng, &groups[0], sizeof(oyjlOptionGroup_s) );
memcpy( &groups[0], &groups[2], sizeof(oyjlOptionGroup_s) );
memcpy( &groups[2], &ng, sizeof(oyjlOptionGroup_s) );
}
opts->groups = (oyjlOptionGroup_s*)oyjlStringAppendN( NULL, (const char*)groups, sizeof(groups), 0 );
info = oyUiInfo(_("The tool can set the actual white point or set it by local day and night time. A additional effect profile can be selected."),
"2018-10-11T12:00:00", "October 11, 2018");
ui = oyjlUi_Create( argc, (const char **)argv,
"oyranos-monitor-white-point", _("Night Manager"), _("Oyranos Night Manager handles the monitor white point"),
"oyNM-logo",
info, opts->array, opts->groups, &state );
if( state & oyjlUI_STATE_EXPORT &&
export &&
strcmp(export,"json+command") != 0)
{
free( opts );
return 0;
}
if(state & oyjlUI_STATE_HELP)
{
fprintf( stderr, "%s\n\tman oyranos-monitor-white-point\n\n", _("For more information read the man page:"));
free( opts );
return 0;
}
if(!ui)
{
free( opts );
return 1;
}
if((export && strcmp(export,"json+command") == 0))
{
char * json = NULL,
* json_commands = strdup(jcommands),
* text = NULL;
const char * t;
error = getSunriseSunset( &rise, &set, dry, "TEXT", &text, 0 );
t = oyjlTermColorToHtml( text, 0 );
free(text); text = oyjlStringCopy( t, 0 ); t = NULL;
ui->opts->groups[3].help = text;
json = oyjlUi_ToJson( ui, 0 ),
json_commands[strlen(json_commands)-2] = ',';
json_commands[strlen(json_commands)-1] = '\000';
oyjlStringAdd( &json_commands, malloc, free, "%s", &json[1] );
puts( json_commands );
return 0;
}
if(verbose)
{
char * json = oyjlOptions_ResultsToJson( opts, 0 );
if(json)
fputs( json, stderr );
fputs( "\n", stderr );
char * text = oyjlOptions_ResultsToText( opts );
if(text)
fputs( text, stderr );
fputs( "\n", stderr );
}
if(oy_debug)
fprintf( stderr, " Oyranos v%s\n",
oyNoEmptyName_m_(oyVersionString(1)));
#if !defined(NO_OYJL_ARGS_RENDER)
/* Render boilerplate */
if(render)
{
int debug = verbose;
oyjlTermColorInit( OYJL_RESET_COLORTERM | OYJL_FORCE_COLORTERM );
oyjlArgsRender( argc, argv, NULL, jcommands, NULL, debug, ui, myMain );
oyjlUi_Release( &ui);
return 0;
}
#endif
DBG_S_( oyPrintTime() );
if(verbose > 1)
oy_debug += verbose;
if(system_wide)
scope = oySCOPE_SYSTEM;
if(temperature != 0.0)
{
int i = (temperature - 1000) / 100;
double xyz[3] = { bb_100K[i][0], bb_100K[i][1], bb_100K[i][2] };
double XYZ[3] = { xyz[0]/xyz[1], 1.0, xyz[2]/xyz[1] }, oldXYZ[3];
double Lab[3], oldLab[3];
double cie_a = 0.0, cie_b = 0.0;
char * comment = NULL;
double old_temperature = 0;
double dist = 1.0;
oyXYZ2Lab( XYZ, Lab);
oyGetDisplayWhitePoint( 1 /* automatic */, oldXYZ );
oyXYZ2Lab( oldXYZ, oldLab);
cie_a = oldLab[1]/256.0 + 0.5;
cie_b = oldLab[2]/256.0 + 0.5;
old_temperature = oyEstimateTemperature( cie_a, cie_b, &dist );
if(old_temperature && dist < 0.0001)
oyStringAddPrintf( &comment, 0,0, "Old Temperature:: %g ", old_temperature );
oyStringAddPrintf( &comment, 0,0, "Old cie_a: %f cie_b: %f ", cie_a, cie_b );
cie_a = Lab[1]/256.0 + 0.5;
cie_b = Lab[2]/256.0 + 0.5;
oyStringAddPrintf( &comment, 0,0, "New Temperature: %.00f cie_a: %f cie_b: %f", temperature, cie_a, cie_b );
fprintf (stderr, "%s %s\n", _("Automatic white point"), comment );
if(dry == 0)
{
oySetDisplayWhitePoint( XYZ, scope, comment );
pingNativeDisplay();
}
oyFree_m_( comment );
++worked;
}
if(wtpt_mode >= 0)
{
error = setWtptMode( scope, wtpt_mode, dry, verbose );
return error;
}
if(show == 1)
{
uint32_t flags = 0;
int choices = 0, current = -1;
const char ** choices_string_list = NULL;
error = oyOptionChoicesGet2( oyWIDGET_DISPLAY_WHITE_POINT, flags,
oyNAME_NAME, &choices,
&choices_string_list, ¤t );
if(!error)
{
fprintf(stderr, "%s\n", _("Choices:"));
for(i = 0; (int)i < choices; ++i)
{
const char * t = "";
char * tmp = NULL;
int flag = (int)i == current ? oyjlBOLD:0;
if(i == 1) /* automatic */
{
double temperature = oyGetTemperature(0);
const char * man_page = getenv("DISPLAY");
int man = 0;
if(man_page && strcmp(man_page,"man_page") == 0)
man = 1;
if(temperature)
{
oyStringAddPrintf( &tmp, 0,0, "%g %s ", man?temperature_man:temperature, _("Kelvin") );
t = tmp;
}
}
printf("-w %u # %s %s%s\n", i, oyjlTermColor(flag,choices_string_list[i]), t, (int)i == current ? "*":" ");
if(tmp) oyFree_m_(tmp);
}
}
++worked;
}
if(location)
{
error = findLocation(scope, dry, verbose);
++worked;
}
if(twilight != -1000)
{
oyStringAddPrintfC(&value, 0,0, "%g", twilight);
if(dry == 0)
oySetPersistentString( OY_DISPLAY_STD OY_SLASH "/twilight", scope, value, NULL );
oyFree_m_(value);
++worked;
}
if(longitude != 360)
{
oyStringAddPrintfC(&value, 0,0, "%g", longitude);
if(dry == 0)
oySetPersistentString( OY_DISPLAY_STD "/longitude", scope, value, NULL );
oyFree_m_(value);
++worked;
}
if(latitude != 360)
{
oyStringAddPrintfC(&value, 0,0, "%g", latitude);
if(dry == 0)
oySetPersistentString( OY_DISPLAY_STD "/latitude", scope, value, NULL );
oyFree_m_(value);
++worked;
}
if(wtpt_mode_night != -1)
{
oyStringAddPrintf(&value, 0,0, "%d", wtpt_mode_night);
if(dry == 0)
oySetPersistentString( OY_DISPLAY_STD "/display_white_point_mode_night", scope, value, NULL );
oyFree_m_(value);
++worked;
}
if(wtpt_mode_sunlight != -1)
{
oyStringAddPrintf(&value, 0,0, "%d", wtpt_mode_sunlight);
if(dry == 0)
oySetPersistentString( OY_DISPLAY_STD "/display_white_point_mode_sunlight", scope, value, NULL );
oyFree_m_(value);
++worked;
}
if(night_effect != NULL && dry == 0)
{
oySetPersistentString( OY_DISPLAY_STD "/night_effect", scope,
(night_effect[0] && night_effect[0] != '-') ?
night_effect : NULL, NULL );
++worked;
}
if(night_color_scheme != NULL && dry == 0)
{
oySetPersistentString( OY_DISPLAY_STD "/night_color_scheme", scope,
(night_color_scheme[0] && night_color_scheme[0] != '-') ?
night_color_scheme : NULL, NULL );
++worked;
}
if(night_backlight != -1 && dry == 0)
{
oyStringAddPrintfC(&value, 0,0, "%g", night_backlight);
oySetPersistentString( OY_DISPLAY_STD "/display_backlight_night", scope,
night_backlight == 0 ? NULL : value, NULL );
oyFree_m_(value);
++worked;
}
if(sunlight_effect != NULL && dry == 0)
{
oySetPersistentString( OY_DISPLAY_STD "/sunlight_effect", scope,
(sunlight_effect[0] && sunlight_effect[0]!='-') ?
sunlight_effect : NULL, NULL );
++worked;
}
if(sunlight_color_scheme != NULL && dry == 0)
{
oySetPersistentString( OY_DISPLAY_STD "/sunlight_color_scheme", scope,
(sunlight_color_scheme[0] && sunlight_color_scheme[0]!='-') ?
sunlight_color_scheme : NULL, NULL );
++worked;
}
if(sunrise)
{
char * text = NULL;
if(strlen(sunrise) < 4) sunrise = "TEXT";
error = getSunriseSunset( &rise, &set, dry, sunrise, &text, verbose );
puts(text);
++worked;
}
if(daemon != -1)
{
error = runDaemon(daemon, verbose);
++worked;
}
if(check)
{
checkWtptState( dry, verbose );
++worked;
}
if(worked == 0)
{
FILE * f = NULL;
char * t = oyjlOptions_PrintHelp( ui->opts, ui, verbose, &f, NULL );
fputs( t, f ); free(t);
}
if(oy_debug)
fprintf(stderr, " %.06g %s\n", DBG_UHR_, oyPrintTime() );
free(info);
oyjlUi_Release( &ui);
return error;
}
int main( int argc_, char ** argv_)
{
int argc = argc_;
char ** argv = argv_;
#ifdef __ANDROID__
argv = calloc( argc + 2, sizeof(char*) );
memcpy( argv, argv_, (argc + 2) * sizeof(char*) );
argv[argc++] = "--render=gui"; /* start QML */
#endif
/* language needs to be initialised before setup of data structures */
#ifdef OYJL_USE_GETTEXT
#ifdef OYJL_HAVE_LOCALE_H
oyjlSetLocale(LC_ALL,"");
#endif
#endif
oyExportStart_(EXPORT_CHECK_NO);
myMain(argc, (const char **)argv);
#ifdef __ANDROID__
free( argv );
#endif
oyFinish_( FINISH_IGNORE_I18N | FINISH_IGNORE_CACHES );
return 0;
}
void pingNativeDisplay()
{
/* ping X11 observers about option change
* ... by setting a known property again to its old value
*/
oyOptions_s * opts = oyOptions_New(NULL), * results = 0;
oyOptions_Handle( "//" OY_TYPE_STD "/send_native_update_event",
opts,"send_native_update_event",
&results );
oyOptions_Release( &opts );
}
int setWtptMode( oySCOPE_e scope, int wtpt_mode, int dry, int verbose )
{
int choices = 0;
const char ** choices_string_list = NULL;
int error = 0;
if(dry == 0)
{
error = oySetBehaviour( oyBEHAVIOUR_DISPLAY_WHITE_POINT, scope, wtpt_mode );
updateVCGT(verbose);
/* ping X11 observers about option change
* ... by setting a known property again to its old value
*/
if(!error)
pingNativeDisplay();
else
fprintf(stderr, "error %d in oySetBehaviour(oyBEHAVIOUR_DISPLAY_WHITE_POINT,%d,%d)\n", error, scope, wtpt_mode);
}
{
int current = -1;
uint32_t flags = 0;
error = oyOptionChoicesGet2( oyWIDGET_DISPLAY_WHITE_POINT, flags,
oyNAME_NAME, &choices,
&choices_string_list, ¤t );
if(current == wtpt_mode)
fprintf (stderr, "%s => %s\n", _("New white point mode"),
(wtpt_mode<choices && choices_string_list) ? choices_string_list[wtpt_mode] : "----");
else
fprintf (stderr, "%s %s => %d != %d\n", _("!!! ERROR"), _("New white point mode"),
wtpt_mode, current);
oyOptionChoicesFree( oyWIDGET_DISPLAY_WHITE_POINT, &choices_string_list, choices );
}
return error;
}
void updateVCGT(int verbose)
{
int r = 0;
DBG_S_( oyPrintTime() );
if((r=oyDisplayColorServerIsActive()) > 0)
{
DBG2_S_( "color server is active(%d) - stop %s", r, oyPrintTime() );
return;
} else
DBG1_S_( "color server is inactive - continue %s", oyPrintTime() );
size_t size = 0;
char * result = oyReadCmdToMem_( "oyranos-monitor -l | wc -l", &size, "r", malloc );
char * tmpname = oyGetTempFileName_( NULL, "vcgt.icc", 0, oyAllocateFunc_ );
if(!result) return;
char * bt = verbose?oyjlBT(2):NULL;
int count = atoi(result), i;
char * cmd = NULL;
if(verbose)
fprintf(stderr, "%s", bt?bt:"");
else
fprintf( stderr, "%s [oy-wtpt] ", oyjlPrintTime(OYJL_BRACKETS, oyjlGREEN) );
fprintf(stderr, "%s %s\n", oyjlTermColor(oyjlBOLD,"monitor count:"), oyjlTermColorF(oyjlBLUE,"%d",count));
free(result);
if(count < 0) count = 0;
if(count > 200) count = 0;
DBG_S_( oyPrintTime() );
for(i = 0; i < count; ++i)
{
int r OY_UNUSED;
/* write VCGT to temporary profile */
oyStringAddPrintf(&cmd, 0,0, "oyranos-monitor -c -f vcgt -d %d -o %s%s", i, tmpname, verbose?" -v":"");
fprintf( stderr, "%s%s %s\n", bt?bt:"", oyjlTermColorF(oyjlBOLD,"[%d]",i), oyjlTermColor(oyjlITALIC,cmd) );
r = system( cmd );
oyFree_m_(cmd);
/* upload VCGT tag from temporary profile */
oyStringAddPrintf(&cmd, 0,0, "oyranos-monitor -g -d %d %s%s", i, tmpname, verbose?" -v":"");
fprintf( stderr, "%s%s %s\n", bt?bt:"", oyjlTermColorF(oyjlBOLD,"[%d]",i), oyjlTermColor(oyjlITALIC,cmd) );
r = system( cmd );
oyFree_m_(cmd);
if(getenv("OY_DEBUG_WRITE") == NULL)