forked from MX-Linux/mxfb-accessories
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmxfb-look
executable file
·764 lines (536 loc) · 19.3 KB
/
mxfb-look
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
#!/bin/bash
#MXFB-Look is a tool to save and restore desktop setups in MX-Linux Fluxbox
#Version 230620 by Melber and MX Devs
#License: GPL-3.0+
#mxcr-icon based on yad icon from papirus icon set
##Changelog##
#fixed conky for mxfb23
# add locale
TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAIN="mxfb-accessories"
source gettext.sh
#define some variables
TITLE="$(gettext 'MXFB-Look')"
CLASS="mxfblook"
MXLKPATH="$HOME/.config/MX-Linux/mxfb-look"
ICONPATH="/usr/share/pixmaps/mxcr-icon.png"
#delete stylelist and tempclr after use
trap "rm -r "$MXLKPATH/tempdir" " EXIT
#create path
if [ ! -d $MXLKPATH ]; then
mkdir $MXLKPATH
fi
#create looks folder
if [ ! -d $MXLKPATH/looks ]; then
mkdir -p $MXLKPATH/looks
fi
#create tempdir
if [ ! -d $MXLKPATH/tempdir ]; then
mkdir -p $MXLKPATH/tempdir
fi
#remove mxfb21 Default look
if [ -f $MXLKPATH/looks/MXFB-default.look ]; then
rm $MXLKPATH/looks/MXFB-default.look $MXLKPATH/looks/MXFB-default.png
fi
#make Default look file
if [ ! -f $MXLKPATH/looks/MX23-default.look ]; then
printf "gtk-theme-name=mx-comfort
gtk-icon-theme-name=Papirus-mxblue-darkpanes
gtk-font-name=Sans 11
gtk-theme-name=\"mx-comfort\"
gtk-icon-theme-name=\"Papirus-mxblue-darkpanes\"
gtk-font-name=\"Sans 11\"
session.styleFile: ~/.fluxbox/styles/MX-comfort
1
$\HOME/.config/tint2/tint2rc
None
@theme \"$HOME/.config/rofi/themes/MX-comfort.rasi\"
file=/usr/share/backgrounds/THE_Dark_Metal.png
cd \"/home/\$USER/.conky/MX-CowonMildBlue\"
conky -c \"/home/\$USER/.conky/MX-CowonMildBlue/MX-Cowon_MildBlue\" &
Hidden=false" > $MXLKPATH/looks/MX23-default.look
fi
#copy image for Default look
if [ ! -f $MXLKPATH/looks/MX23-default.png ]; then
cp /usr/share/pixmaps/MX23-default.png $MXLKPATH/looks/
fi
#make torre look file
if [ ! -f $MXLKPATH/looks/torre-di-libretti.look ]; then
printf "gtk-theme-name=mx-comfort-dark
gtk-icon-theme-name=Faba
gtk-font-name=Rounded Elegance 11
gtk-theme-name=\"mx-comfort-dark\"
gtk-icon-theme-name=\"Faba\"
gtk-font-name=\"Rounded Elegance 11\"
session.styleFile: ~/.fluxbox/styles/MX-comfort-dark
1
$\HOME/.config/tint2/MX-workspaces.tint2rc
None
@theme \"$HOME/.config/rofi/themes/MX-fancy.rasi\"
file=/usr/share/backgrounds/torre-di-libretti-blu.png
cd \"/home/\$USER/.conky/MX-Comfort\"
conky -c \"/home/\$USER/.conky/MX-Comfort/MX-Comfort\" &
Hidden=false" > $MXLKPATH/looks/torre-di-libretti.look
fi
#copy image for torre look
if [ ! -f $MXLKPATH/looks/torre-di-libretti.png ]; then
cp /usr/share/pixmaps/torre-di-libretti.png $MXLKPATH/looks/
fi
#################################
#fix rasi
cd $HOME/.config/rofi
ROFICHECK1="$(grep "@import" config.rasi)"
if [ "$ROFICHECK1" = "" ]; then
sed -i "s/@import/@theme/g" config.rasi
fi
ROFICHECK2="$(grep "//width" config.rasi)"
if [ "$ROFICHECK2" = "" ]; then
sed -i 's/width\:/\/\/width\:/g' config.rasi
sed -i 's/lines\:/\/\/lines\:/g' config.rasi
sed -i 's/fake-transparency\:/\/\/fake-transparency\:/g' config.rasi
fi
#################################
# function save look
save_look() {
#define some variables
TITLE="$(gettext 'MXFB-Look')"
CLASS="mxfblook"
MXLKPATH="$HOME/.config/MX-Linux/mxfb-look"
ICONPATH="/usr/share/pixmaps/mxcr-icon.png"
source gettext.sh
#read current look components
#theme and icons
LKTHEME="$(grep "gtk-theme-name" $HOME/.config/gtk-3.0/settings.ini)"
LKICON="$(grep "gtk-icon-theme-name" $HOME/.config/gtk-3.0/settings.ini)"
LKFONT="$(grep "gtk-font-name" $HOME/.config/gtk-3.0/settings.ini)"
LKTHEME2="$(grep "gtk-theme-name" $HOME/.gtkrc-2.0)"
LKICON2="$(grep "gtk-icon-theme-name" $HOME/.gtkrc-2.0)"
LKFONT2="$(grep "gtk-font-name" $HOME/.gtkrc-2.0)"
#fluxbox style
LKFLUXSTYLE="$(grep "styles" $HOME/.fluxbox/init)"
#tint2
TINTNUM="$(wc -l < $HOME/.config/tint2/tint2-sessionfile)"
LKTINT1="$(grep "tint2" $HOME/.config/tint2/tint2-sessionfile | sed -n 1p)"
LKTINT1=$(echo "${LKTINT1}" | sed -e 's/$HOME/\$HOME/g' )
LKTINT2="$(grep "tint2" $HOME/.config/tint2/tint2-sessionfile | sed -n 2p)"
LKTINT2=$(echo "${LKTINT2}" | sed -e 's/$HOME/\$HOME/g' )
if [ $TINTNUM = 0 ]; then
LKTINT1="None"
LKTINT2="None"
fi
if [ $TINTNUM = 1 ]; then
LKTINT2="None"
fi
#rofi
LKROFI="$(grep '@theme' $HOME/.config/rofi/config.rasi | tail -1)"
#background
CHECKFEH=$(grep '#nitrogen' $HOME/.fluxbox/startup)
if [ -z "$CHECKFEH" ]; then
LKBACK="$(grep "file=" $HOME/.config/nitrogen/bg-saved.cfg | sed -n 2p)"
if [ -z "$LKBACK" ]; then
LKBACK="$(grep "file=" $HOME/.config/nitrogen/bg-saved.cfg)"
fi
else
LKBACK=$(grep "feh" $HOME/.fehbg)
LKBACK=$(echo "${LKBACK}" | sed -e "s/'/|/g")
LKBACK=$(echo "$LKBACK" | cut -d '|' -f 2)
LKBACK="file="$LKBACK""
fi
#conky
LKCONK1="$(grep "conky" $HOME/.conky/conky-startup.sh | sed -n 2p)"
LKCONK2="$(grep "conky" $HOME/.conky/conky-startup.sh | sed -n 3p)"
CONKYSTATE="$(grep "Hidden" "$HOME/.config/autostart/conky.desktop")"
#make temp file
echo ""$LKTHEME"|"$LKICON"|"$LKFONT"|"$LKTHEME2"|"$LKICON2"|"$LKFONT2"|"$LKFLUXSTYLE"|"$TINTNUM"|"$LKTINT1"|"$LKTINT2"|"$LKROFI"|"$LKBACK"|"$LKCONK1"|"$LKCONK2"|"$CONKYSTATE"" > $MXLKPATH/tempdir/looktmp.txt
#amend temp
cd $MXLKPATH/tempdir
sed -i "s/gtk-theme-name\=/ /g" looktmp.txt
sed -i "s/gtk-icon-theme-name\=/ /g" looktmp.txt
sed -i "s/gtk-font-name\=/ /g" looktmp.txt
sed -i "s/session\.styleFile\:/ /g" looktmp.txt
sed -i "s/\$HOME\/\.config\/tint2\// /g" looktmp.txt
sed -i "s/\@theme//g" looktmp.txt
sed -i "s/file\=/ /g" looktmp.txt
sed -i "s/\"//g" looktmp.txt
sed -i "s/cd //g" looktmp.txt
#read temp
OLDIFS="$IFS"
IFS="|"
read -r -a YADFILL < looktmp.txt
LKTH="${YADFILL[0]}"
LKIC="${YADFILL[1]}"
LKFO="${YADFILL[2]}"
LKFS="${YADFILL[6]}"
LKTI1="${YADFILL[8]}"
LKTI2="${YADFILL[9]}"
LKRO="${YADFILL[10]}"
LKBG="${YADFILL[11]}"
LKCO1="${YADFILL[12]}"
LKCO2="${YADFILL[13]}"
LKCOST="${YADFILL[14]}"
LKRO=$(echo "${LKRO}" | sed -e "s/ //g" )
LKCOSTSV=$(echo "${LKCOST}" | sed -e 's/Hidden=//g' | sed -e "s/\ //g" )
if [ -z "$LKCO1" ]; then
LKCO1="$(gettext 'None')"
fi
if [ $LKCOSTSV = "false" ]; then
LKCOSTSV="$(gettext 'toggled on')"
else
LKCOSTSV="$(gettext 'toggled off')"
fi
#MAIN
TEXTMAIN0="$(gettext 'Current Settings')"
TEXTMAIN1="$(gettext 'GTK Theme')"
TEXTMAIN2="$(gettext 'GTK Icons')"
TEXTMAIN3="$(gettext 'GTK Font')"
TEXTMAIN4="$(gettext 'Fluxbox Style')"
TEXTMAIN5="$(gettext '1st Tint2 Panel')"
TEXTMAIN6="$(gettext '2nd Tint2 Panel')"
TEXTMAIN7="$(gettext 'Rofi Theme')"
TEXTMAIN8="$(gettext 'Wallpaper')"
TEXTMAIN9="$(gettext 'Conky')"
TEXTMAIN10="$(gettext 'Conky State')"
MAIN=(yad --title="$TITLE" --class="$CLASS" --window-icon="$ICONPATH" --borders=20 --center --width=600 --height=400 --fixed --form --columns=1 --align=left --separator="" --button="gtk-quit":1 --button="$(gettext 'Save Look')":0 \
--text=$"\n<b>"$TEXTMAIN0".\n</b>\n
"$TEXTMAIN1": <b>"$LKTH"</b>\n
"$TEXTMAIN2": <b>"$LKIC"</b>\n
"$TEXTMAIN3": <b>"$LKFO"</b>\n
"$TEXTMAIN4": <b>"$LKFS"</b>\n
"$TEXTMAIN5": <b>"$LKTI1"</b>\n
"$TEXTMAIN6": <b>"$LKTI2"</b>\n
"$TEXTMAIN7": <b>"$LKRO"</b>\n
"$TEXTMAIN8": <b>"$LKBG"</b>\n
"$TEXTMAIN9": <b>"$LKCO1"</b>\n
"$TEXTMAIN10": <b>"$LKCOSTSV"</b>\n"
--field="$(eval_gettext 'Save Look as')" $"New-Look-Name"\
)
NEWNAME=$("${MAIN[@]}")
(($?==0)) && echo "$NEWNAME" > $MXLKPATH/tempdir/tempname.txt
GETOUT=$(echo "$?")
if [ "$GETOUT" != 0 ]; then
exit
elif [ "$GETOUT" = 0 ]; then
read NEWNAME < $MXLKPATH/tempdir/tempname.txt
unset IFS
fi
NEWNAME=$(echo "$NEWNAME" | sed -e 's/ /-/g')
#check new Look name is not empty and forbid MXFB-default overwrite
while [ -z "$NEWNAME" -o "$NEWNAME" = 'MXFB-default' ]; do
NEWNAME=$(yad --title="$TITLE" --class="$CLASS" --window-icon="$ICONPATH" --width=400 --height=200 --fixed --text="$(eval_gettext 'Look name $NEWNAME is protected. Choose another name.')" --form --center --borders=20 --separator="" \
--field="$(gettext '<b>Name for new style</b>')":LBL " " \
--field=$" " "$NEWNAME-new" )
GETOUT=$(echo "$?")
if [ "$GETOUT" != 0 ]; then
exit
fi
done
#check if new Look name exists, if yes ask if overwrite or different name
cd $MXLKPATH/looks
while [ -f $NEWNAME.look ]; do
message="$(eval_gettext 'A Look with this name already exists.\n\nDo you want to overwrite $NEWNAME or save as a new name?\n')"
yad --title="$TITLE" --class="$CLASS" --window-icon="$ICONPATH" --width=400 --fixed --text="$message" --button="$(eval_gettext 'Overwrite $NEWNAME')":2 --button="$(gettext 'Save as different name')":3 --text-align=center --center --borders=20\
case $? in
2) rm -r $MXLKPATH/looks/$NEWNAME.look ;;
3) NEWNAME=$(yad --title="$TITLE" --class="$CLASS" --window-icon="$ICONPATH" --width=400 --height=200 --fixed --form --center --borders=20 --separator="" \
--field="$(gettext '<b>Name for New Look</b>')":LBL " " \
--field=$" " "$NEWNAME-new" ) ;;
252) exit 0 ;;
esac
done
##################################
#make look file
echo ""$LKTHEME"
"$LKICON"
"$LKFONT"
"$LKTHEME2"
"$LKICON2"
"$LKFONT2"
session.styleFile: "$LKFS"
"$TINTNUM"
"$LKTINT1"
"$LKTINT2"
@theme \""$LKRO"\"
"$LKBACK"
"$LKCONK1"
"$LKCONK2"
"$LKCOST"" > $MXLKPATH/looks/"$NEWNAME".look
#make preview image
WINLIST=$(wmctrl -l | grep -v tint2 | grep -v conky | awk '{ print$1 }')
for i in $WINLIST;
do
WINNUM=$i
wmctrl -i -r "$i" -b add,hidden
done
sleep 0.5
scrot $MXLKPATH/looks/"$NEWNAME".png -b -o -t 20
rm $MXLKPATH/looks/"$NEWNAME".png
mv $MXLKPATH/looks/"$NEWNAME"-thumb.png $MXLKPATH/looks/"$NEWNAME".png
sleep 0.5
for i in $WINLIST;
do
WINNUM=$i
wmctrl -i -r "$i" -b toggle,hidden
done
#all done
ALLDONE="$(eval_gettext 'All done!\n\nLook has been saved as <b>$NEWNAME</b>')"
yad --title="$TITLE" --class="$CLASS" --window-icon="$ICONPATH" --width=400 --height=250 --fixed --center --borders=20 --text="$ALLDONE" --text-align=center --button="gtk-ok" \
exit
}
############################################################
#function restore look
restore_look() {
#define some variables
TITLE="$(gettext 'MXFB-Look')"
CLASS="mxfblook"
MXLKPATH="$HOME/.config/MX-Linux/mxfb-look"
ICONPATH="/usr/share/pixmaps/mxcr-icon.png"
source gettext.sh
#read saved looks
cd $MXLKPATH/looks
ls -f *.look > $MXLKPATH/tempdir/looklist.txt
#select look to restore
while [ -z "$LOOKRESTORE" ]; do
LOOKRESTORE=$( yad --title="$TITLE" --class="$CLASS" --window-icon="$ICONPATH" --text="$(gettext '\n<b> Choose which look to restore</b>\n')" --center --width=400 --height=300 --center --list --no-headers --column=Style --separator="" < $MXLKPATH/tempdir/looklist.txt )
GETOUT=$(echo "$?")
if [ "$GETOUT" != 0 ]; then
exit
fi
if [ -z "$LOOKRESTORE" ]; then
yad --title="$TITLE" --class="$CLASS" --window-icon="$ICONPATH" --text="$(gettext '\n<b> You need to select a look !</b>\n')" --center --width=400 --height=300
fi
done
#read Settings for new look
cd $MXLKPATH/looks
mapfile LKRE < $LOOKRESTORE
LKTHEMENEW="${LKRE[0]}"
LKICONNEW="${LKRE[1]}"
LKFONTNEW="${LKRE[2]}"
LKTHEMENEW2="${LKRE[3]}"
LKICONNEW2="${LKRE[4]}"
LKFONTNEW2="${LKRE[5]}"
LKFSNEW="${LKRE[6]}"
TINTNUMNEW="${LKRE[7]}"
LKTINT1NEW="${LKRE[8]}"
LKTINT2NEW="${LKRE[9]}"
LKROFINEW1="${LKRE[10]}"
LKROFINEW2=$LKROFINEW1
LKBACKNEW="${LKRE[11]}"
LKCONK1NEW="${LKRE[12]}"
LKCONK2NEW="${LKRE[13]}"
LKCOSTNEW="${LKRE[14]}"
LKTHEMENEW=$(echo "${LKTHEMENEW}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKICONNEW=$(echo "${LKICONNEW}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKFONTNEW=$(echo "${LKFONTNEW}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKTHEMENEW2=$(echo "${LKTHEMENEW2}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKICONNEW2=$(echo "${LKICONNEW2}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKFONTNEW2=$(echo "${LKFONTNEW2}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKFSNEW=$(echo "${LKFSNEW}" | sed -e 's/[]$\/*[\^]/\\&/g' )
LKTINT1NEW=$(echo "${LKTINT1NEW}" | sed -e 's/$HOME/\$HOME/g' )
LKTINT2NEW=$(echo "${LKTINT2NEW}" | sed -e 's/$HOME/\$HOME/g' )
LKROFINEW1=$(echo "${LKROFINEW1}" | sed -e 's/[]$\/*[\^]/\\&/g' )
LKBACKNEW=$(echo "${LKBACKNEW}" | sed -e 's/[]$ \/*[\^]/\\&/g' )
#read current look components
#theme and icons
LKTHEMEOLD="$(grep "gtk-theme-name" $HOME/.config/gtk-3.0/settings.ini)"
LKICONOLD="$(grep "gtk-icon-theme-name" $HOME/.config/gtk-3.0/settings.ini)"
LKFONTOLD="$(grep "gtk-font-name" $HOME/.config/gtk-3.0/settings.ini)"
LKTHEMEOLD2="$(grep "gtk-theme-name" $HOME/.gtkrc-2.0)"
LKICONOLD2="$(grep "gtk-icon-theme-name" $HOME/.gtkrc-2.0)"
LKFONTOLD2="$(grep "gtk-font-name" $HOME/.gtkrc-2.0)"
#fluxbox style
LKFSOLD="$(grep "styles" $HOME/.fluxbox/init)"
#tint2
LKTINT1OLD="$(grep "tint2" $HOME/.config/tint2/tint2-sessionfile | sed -n 1p)"
LKTINT2OLD="$(grep "tint2" $HOME/.config/tint2/tint2-sessionfile | sed -n 2p)"
#rofi
LKROFIOLD="$(grep '@theme' $HOME/.config/rofi/config.rasi | tail -1)"
#background
CHECKFEH=$(grep '#nitrogen' $HOME/.fluxbox/startup)
if [ -z "$CHECKFEH" ]; then
LKBACKOLD="$(grep "file=" $HOME/.config/nitrogen/bg-saved.cfg | sed -n 2p)"
if [ -z "$LKBACKOLD" ]; then
LKBACKOLD="$(grep "file=" $HOME/.config/nitrogen/bg-saved.cfg)"
fi
fi
LKTHEMEOLD=$(echo "${LKTHEMEOLD}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKICONOLD=$(echo "${LKICONOLD}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKFONTOLD=$(echo "${LKFONTOLD}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKTHEMEOLD2=$(echo "${LKTHEMEOLD2}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKICONOLD2=$(echo "${LKICONOLD2}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKFONTOLD2=$(echo "${LKFONTOLD2}" | sed -e 's/[]$ .*[\^]/\\&/g' )
LKFSOLD=$(echo "${LKFSOLD}" | sed -e 's/[]$\/*[\^]/\\&/g' )
#LKTINTOLD=$(echo "${LKTINTOLD}" | sed -e 's/[]$\/*[\^]/\\&/g' )
#LKROFIOLD=$(echo "${LKROFIOLD}" | sed -e 's/[]$\/*[\^]/\\&/g' )
LKBACKOLD=$(echo "${LKBACKOLD}" | sed -e 's/[]$\/*[\^]/\\&/g' )
#conky
LKCOSTOLD="$(grep "Hidden" "$HOME/.config/autostart/conky.desktop")"
#make temp file
echo ""$LKTHEMENEW"|"$LKICONNEW"|"$LKFONTNEW"|"$LKTHEMENEW2"|"$LKICONNEW2"|"$LKFONTNEW2"|"$LKFSNEW"|"$TINTNUMNEW"|"$LKTINT1NEW"|"$LKTINT2NEW"|"$LKROFINEW1"|"$LKBACKNEW"|"$LKCONK1NEW"|"$LKCONK2NEW"|"$LKCOSTNEW"" > $MXLKPATH/tempdir/looktmp-new.txt
#amend temp
cd $MXLKPATH/tempdir
sed -i "s/gtk-theme-name\=/ /g" looktmp-new.txt
sed -i "s/gtk-icon-theme-name\=/ /g" looktmp-new.txt
sed -i "s/gtk-font-name\=/ /g" looktmp-new.txt
sed -i "s/session\.styleFile\:/ /g" looktmp-new.txt
sed -i "s/\$HOME\/\.config\/tint2\// /g" looktmp-new.txt
sed -i "s/\@theme/ /g" looktmp-new.txt
sed -i "s/file\=//g" looktmp-new.txt
sed -i "s/\"/ /g" looktmp-new.txt
sed -i "s/cd //g" looktmp-new.txt
#sed -i "s/hidden=//g" looktmp-new.txt
#read temp
OLDIFS="$IFS"
IFS="|"
read -r -a NEWFILL < looktmp-new.txt
NLKTH="${NEWFILL[0]}"
NLKIC="${NEWFILL[1]}"
NLKFO="${NEWFILL[2]}"
NLKFS="${NEWFILL[6]}"
NTINU="${NEWFILL[7]}"
NLKTI1="${NEWFILL[8]}"
NLKTI2="${NEWFILL[9]}"
NLKRO="${NEWFILL[10]}"
NLKBG="${NEWFILL[11]}"
NLKCO1="${NEWFILL[12]}"
NLKCO2="${NEWFILL[13]}"
NLKCOST="${NEWFILL[14]}"
#fix conky state
if [ $NLKCO1 = " " ]; then
NLKCO1="None"
fi
if [ $NLKCOST != LKCOSTOLD ]; then
sed -i "s/$LKCOSTOLD/$NLKCOST/g" $HOME/.config/autostart/conky.desktop
fi
NLKCOST=$(echo "${NLKCOST}" | sed -e 's/Hidden=//g' | sed -e "s/\ //g" )
if [ $NLKCOST = "false" ]; then
COST="$(gettext 'toggled on')"
else
COST="$(gettext 'toggled off')"
fi
PREVIEW="$MXLKPATH/looks/$LOOKRESTORE"
PREVIEW=$(echo "${PREVIEW}" | sed -e "s/\.look/\.png/g" )
#RESTOREMAIN
TEXTRESTORE0=$LOOKRESTORE
TEXTRESTORE1="$(gettext 'GTK Theme')"
TEXTRESTORE2="$(gettext 'GTK Icons')"
TEXTRESTORE3="$(gettext 'GTK Font')"
TEXTRESTORE4="$(gettext 'Fluxbox Style')"
TEXTRESTORE5="$(gettext '1st Tint2 Panel')"
TEXTRESTORE6="$(gettext '2nd Tint2 Panel')"
TEXTRESTORE7="$(gettext 'Rofi Theme')"
TEXTRESTORE8="$(gettext 'Wallpaper')"
TEXTRESTORE9="$(gettext 'Conky')"
TEXTRESTORE10="$(gettext 'Conky State')"
TEXTRESTORE11="$(gettext 'Wait 10 seconds for the conky to restart')"
yad --title="$TITLE" --class="$CLASS" --window-icon="$ICONPATH" --borders=20 --center --width=600 --height=400 --fixed --image="$PREVIEW" --button="gtk-quit":1 --button=$"Restore Look":0 \
--text=$"<b> "$TEXTRESTORE0"</b>\n
"$TEXTRESTORE1": <b>"$NLKTH"</b>\n
"$TEXTRESTORE2": <b>"$NLKIC"</b>\n
"$TEXTRESTORE3": <b>"$NLKFO"</b>\n
"$TEXTRESTORE4": <b>"$NLKFS"</b>\n
"$TEXTRESTORE5": <b>"$NLKTI1"</b>\n
"$TEXTRESTORE6": <b>"$NLKTI2"</b>\n
"$TEXTRESTORE7": <b>"$NLKRO"</b>\n
"$TEXTRESTORE8": <b>"$NLKBG"</b>\n
"$TEXTRESTORE9": <b>"$NLKCO1"</b>\n
"$TEXTRESTORE10": <b>"$COST"</b>\n
("$TEXTRESTORE11")"
GETOUT=$(echo "$?")
if [ "$GETOUT" != 0 ]; then
exit
elif [ "$GETOUT" = 0 ]; then
unset IFS
#Edit Config files
#gtk
cd ~/.config/gtk-3.0
sed -i -e "s/${LKTHEMEOLD}/${LKTHEMENEW}/g" settings.ini
sed -i -e "s/${LKICONOLD}/${LKICONNEW}/g" settings.ini
sed -i -e "s/${LKFONTOLD}/${LKFONTNEW}/g" settings.ini
cd ~
sed -i -e "s/${LKTHEMEOLD2}/${LKTHEMENEW2}/g" .gtkrc-2.0
sed -i -e "s/${LKICONOLD2}/${LKICONNEW2}/g" .gtkrc-2.0
sed -i -e "s/${LKFONTOLD2}/${LKFONTNEW2}/g" .gtkrc-2.0
#gtk bash
function reload_gtk_theme() {
theme=$(gsettings get org.gnome.desktop.interface gtk-theme)
gsettings set org.gnome.desktop.interface gtk-theme ''
sleep 1
gsettings set org.gnome.desktop.interface gtk-theme $theme
}
reload_gtk_theme
#fluxbox
cd ~/.fluxbox
sed -i -e "s/${LKFSOLD}/${LKFSNEW}/g" ~/.fluxbox/init
fluxbox-remote restart
#tint
cd ~/.config/tint2
if [ $TINTNUMNEW = 2 ]; then
rm tint2-sessionfile
killall tint2
LKTINTNEWA=$(basename "$LKTINT1NEW")
LKTINTNEWB=$(basename "$LKTINT2NEW")
echo "$LKTINT1NEW
$LKTINT2NEW" >> ~/.config/tint2/tint2-sessionfile
tint2 -c $HOME/.config/tint2/$LKTINTNEWA >/dev/null 2>&1 & disown
tint2 -c $HOME/.config/tint2/$LKTINTNEWB >/dev/null 2>&1 & disown
fi
if [ $TINTNUMNEW = 1 ]; then
rm tint2-sessionfile
killall tint2
LKTINTNEWA=$(basename "$LKTINT1NEW")
echo "$HOME/.config/tint2/$LKTINTNEWA" >> ~/.config/tint2/tint2-sessionfile
tint2 -c $HOME/.config/tint2/$LKTINTNEWA >/dev/null 2>&1 & disown
fi
if [ $TINTNUMNEW = 0 ]; then
rm tint2-sessionfile
killall tint2
echo "" >> ~/.config/tint2/tint2-sessionfile
fi
#rofi
cd $HOME/.config/rofi/
ROFIOLDCOMMENT="//$LKROFIOLD"
LKROFIOLD=$(echo "${LKROFIOLD}" | sed -e 's/[]$\/*[\^]/\\&/g' )
ROFIOLDCOMMENT=$(echo "${ROFIOLDCOMMENT}" | sed -e 's/[]$\/*[\^]/\\&/g' )
sed -i "s/$LKROFIOLD/$ROFIOLDCOMMENT/g" config.rasi
LKROFINEW2=$(echo "${LKROFINEW2}" | sed -e 's/@import/@theme/g' )
sed -i 's/\/\/\/\/@/\/\/@/g' config.rasi
echo $LKROFINEW2 >> config.rasi
#background
CHECKFEH=$(grep '#nitrogen' $HOME/.fluxbox/startup)
if [ -z "$CHECKFEH" ]; then
cd $HOME/.config/nitrogen
sed -i -e "s/${LKBACKOLD}/${LKBACKNEW}/g" bg-saved.cfg
cd $MXLKPATH/tempdir
echo "$LKBACKNEW" > nitrotemp.txt
sed -i "s/file\=//g" nitrotemp.txt
read LKNITRO < nitrotemp.txt
nitrogen --set-zoom-fill --save "$LKNITRO"
else
NLKBG=$(echo "${NLKBG}" | sed -e 's/\\//g')
NLKBG=$(echo "${NLKBG}" | sed -e "s/'/|/g")
NLKBG=$(echo "$NLKBG" | cut -d '|' -f 2)
feh --bg-scale "$NLKBG"
fi
#conky
cd ~/.conky
printf "#!/bin/sh
if [ x\"\${DESKTOP_SESSION##*/}\" = x\"fluxbox\" ]; then
sleep 10s
killall conky
$LKCONK1NEW
$LKCONK2NEW
exit 0
fi" > conky-startup.sh
if [ $NLKCOST = "false" ]; then
echo | sh conky-startup.sh
exit
exit
else
killall conky
fi
fi
exit
}
export -f save_look restore_look
TEXTMAIN="$(gettext '<b>You can save the current look or restore a saved look</b>\n\nA look is comprised of the following elements\n- Gtk-Theme\n- Gtk-Icon\n- Gtk-Font\n- Fluxbox Style\n- up to two Tint2 Panels\n- Rofi Theme\n- Wallpaper\n- One Conky\n\n')"
yad --title="$TITLE" --class="$CLASS" --window-icon="$ICONPATH" --width=400 --height=200 --fixed --center --borders=20 --text-align=center --text="$TEXTMAIN" --button="gtk-close" --button="$(gettext 'Restore Look')":"bash -c restore_look" --button="$(gettext 'Save Current Look')":"bash -c save_look" \