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
|
# FvwmScript Preferences Variable Editor
# A Variables Editor Fvwm-Crystal
# Copyright Dominique Michel <dominique_libre@users.sourceforge.net> 2013
# Released under the GNU GPL license v2 or later
# Usage: Script scripts/PrefVars/PrefVars
# Header ̣{{{1
UseGettext {$FVWM_USERDIR/locale;fvwm-crystal-script:$FVWM_SYSTEMDIR/locale;fvwm-crystal-script:+}
WindowLocaleTitle {FVWM-Crystal Variables Editor}
WindowSize 800 510
#WindowPosition 300 300
Colorset 1
# Dont change it or the text titles will be shorted:
Font "xft:$[panel_font]:pixelsize:$[panel_font_size]:style:$[panel_font_style]"
# Initialisation {{{1
Init
Begin
Set $FDIR = (GetOutput {echo "$FVWM_USERDIR"} 1 -1)
Set $PDIR = $FDIR {/preferences/}
# Load BROWSER variables
ChangeTitle 1 (GetOutput {cat $FVWM_USERDIR/preferences/BROWSER | sed -e 's:SetEnv BROWSER ::' -e 's:"::g' } 1 -1)
Set $browser = (GetTitle 1)
# Load DesktopDirs file
Set $dfile = $PDIR {DesktopDirs}
Set $cmd = {cat }$dfile{ | tr '\n' '|'}
ChangeTitle 2 (GetOutput $cmd 1 -1)
Set $desktopd = (GetTitle 2)
# Load IconDirs file
Set $icfile = $PDIR {IconDirs}
Set $cmd = {cat }$icfile{ | tr '\n' '|'}
ChangeTitle 3 (GetOutput $cmd 1 -1)
Set $iconsd = (GetTitle 3)
# Load MediaDirectories file
Set $mfile = $PDIR {MediaDirectories}
Set $cmd = {cat }$mfile{ | tr '\n' '|'}
ChangeTitle 4 (GetOutput $cmd 1 -1)
Set $mediad = (GetTitle 4)
# Load Startup file
#Do {AT "FVWM-Crystal Editor" "nano }$PDIR{Startup}
Do {Exec exec xdg-open }$PDIR{Startup}
End
# Periodic Tasks {{{1
PeriodicTasks
Begin
# use a timer for flickering {{{2
If (RemainderOfDiv (GetTime) 1) == 0 Then
Begin
# faster if we do nothing here
Do Nop
End
End
# Quit Function {{{1
QuitFunc
Begin
Do Nop
# Do {Echo The font: }$SetFont{ is xft:}$FontName{:pixelsize=}$Size{:}$Style
End
# Main {{{1
# BROWSER {{{2
Widget 1
Property
Flags NoReliefString
Position 130 5
Size 480 35
Type TextField
Title { }
#Value 1
Main
Case message of
SingleClic :
Begin
Set $browser = (GetTitle 1)
End
1 :
Begin
Set $browser = (GetTitle 1)
End
End
# Browser label
Widget 10
Property
Flags NoReliefString Center
Position 5 5
Size 120 35
Type ItemDraw
LocaleTitle {Browser}
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
# Save browser
Widget 11
Property
Flags NoReliefString
Position 625 5
Size 170 35
Type PushButton
LocaleTitle {Save}
Main
Case message of
SingleClic :
Begin
Do {SavePreferences BROWSER "SetEnv BROWSER \\\"}$browser{\\\""}
End
End
# Separation
Widget 12
Property
Flags NoReliefString
Position 20 45
Size 760 1
Type Rectangle
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
# Desktop directories {{{2
Widget 2
Property
Flags NoReliefString
Position 130 50
Size 480 105
Type List
# Font "xft:$[panel_font]:size=10:$[panel_font_style]"
Title { }
Main
Case message of
SingleClic :
Begin
Set $desktopd = (GetTitle 2)
Set $ddindex = (GetValue 2)
Set $cmd = {exec echo "}$desktopd{"|cut -d '|' -f }$ddindex
Set $DDstring = (GetOutput $cmd 1 -1)
Set $oldDDstring = $DDstring
HideWidget 24
ChangeTitle 24 $DDstring
ShowWidget 24
End
End
# Desktop directories label
Widget 20
Property
Flags NoReliefString Center
Position 5 50
Size 120 35
Type ItemDraw
LocaleTitle {Desktop}
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
Widget 21
Property
Flags NoReliefString Center
Position 5 90
Size 120 35
Type ItemDraw
LocaleTitle {Directories}
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
# Add line
Widget 22
Property
Flags NoReliefString
Position 625 80
Size 170 35
Type PushButton
LocaleTitle {Add line}
Main
Case message of
SingleClic :
Begin
Set $cmd = {echo "}$desktopd{"|sed -e "s:^.*$:&}$DDstring{|:"}
Set $desktopd = (GetOutput $cmd 1 -1)
HideWidget 2
ChangeTitle 2 $desktopd
ShowWidget 2
Set $oldDDstring = $DDstring
End
End
# Save desktop dirs
Widget 23
Property
Flags NoReliefString
Position 625 120
Size 170 35
Type PushButton
LocaleTitle {Save}
Main
Case message of
SingleClic :
Begin
Set $cmd = {PipeRead 'echo "}$desktopd{"| sed -e \'s:|$::\' | tr \'|\' \'\\n\'>}$dfile{'}
Do $cmd
# Do {Echo cmd: }$cmd
# WriteToFile $dfile $desktopd # crash
End
End
# Edit entry
Widget 24
Property
Flags NoReliefString
Position 130 160
Size 480 35
Type TextField
Title { }
#Value 1
Main
Case message of
SingleClic :
Begin
Set $DDstring = (GetTitle 24)
End
1 :
Begin
Set $DDstring = (GetTitle 24)
End
End
# Remove string
Widget 25
Property
Flags NoReliefString
Position 5 160
Size 120 35
Type PushButton
LocaleTitle {Remove}
Main
Case message of
SingleClic :
Begin
Set $cmd = {echo "}$desktopd{"|sed -e "s:}$oldDDstring{|::"}
Set $desktopd = (GetOutput $cmd 1 -1)
HideWidget 2
ChangeTitle 2 $desktopd
ShowWidget 2
End
End
# Update string
Widget 26
Property
Flags NoReliefString
Position 625 160
Size 170 35
Type PushButton
LocaleTitle {Update}
Main
Case message of
SingleClic :
Begin
Set $cmd = {echo "}$desktopd{"|sed -e "s:}$oldDDstring{:}$DDstring{:"}
Set $desktopd = (GetOutput $cmd 1 -1)
HideWidget 2
ChangeTitle 2 $desktopd
ShowWidget 2
Set $oldDDstring = $DDstring
End
End
# Separation
Widget 27
Property
Flags NoReliefString
Position 5 200
Size 780 1
Type Rectangle
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
# Icons directories {{{2
Widget 3
Property
Flags NoReliefString
Position 130 205
Size 480 105
Type List
# Font "xft:$[panel_font]:size=10:$[panel_font_style]"
Title { }
Main
Case message of
SingleClic :
Begin
Set $iconsd = (GetTitle 3)
Set $icindex = (GetValue 3)
Set $cmd = {exec echo "}$iconsd{"|cut -d '|' -f }$icindex
Set $ICstring = (GetOutput $cmd 1 -1)
Set $oldICstring = $ICstring
HideWidget 34
ChangeTitle 34 $ICstring
ShowWidget 34
End
End
# Desktop directories label
Widget 30
Property
Flags NoReliefString Center
Position 5 205
Size 120 35
Type ItemDraw
LocaleTitle {Icons}
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
Widget 31
Property
Flags NoReliefString Center
Position 5 245
Size 120 35
Type ItemDraw
LocaleTitle {Directories}
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
# Add line
Widget 32
Property
Flags NoReliefString
Position 625 235
Size 170 35
Type PushButton
LocaleTitle {Add line}
Main
Case message of
SingleClic :
Begin
Set $cmd = {echo "}$iconsd{"|sed -e "s:^.*$:&}$ICstring{|:"}
Set $iconsd = (GetOutput $cmd 1 -1)
HideWidget 3
ChangeTitle 3 $iconsd
ShowWidget 3
Set $oldICstring = $ICstring
End
End
# Save icons dirs
Widget 33
Property
Flags NoReliefString
Position 625 275
Size 170 35
Type PushButton
LocaleTitle {Save}
Main
Case message of
SingleClic :
Begin
Set $cmd = {PipeRead 'echo "}$iconsd{"| sed -e \'s:|$::\' | tr \'|\' \'\\n\'>}$icfile{'}
Do $cmd
End
End
# Edit entry
Widget 34
Property
Flags NoReliefString
Position 130 315
Size 480 35
Type TextField
Title { }
#Value 1
Main
Case message of
SingleClic :
Begin
Set $ICstring = (GetTitle 34)
End
1 :
Begin
Set $ICstring = (GetTitle 34)
End
End
# Remove string
Widget 35
Property
Flags NoReliefString
Position 5 315
Size 120 35
Type PushButton
LocaleTitle {Remove}
Main
Case message of
SingleClic :
Begin
Set $cmd = {echo "}$iconsd{"|sed -e "s:}$oldICstring{|::"}
Set $iconsd = (GetOutput $cmd 1 -1)
HideWidget 3
ChangeTitle 3 $iconsd
ShowWidget 3
End
End
# Update string
Widget 36
Property
Flags NoReliefString
Position 625 315
Size 170 35
Type PushButton
LocaleTitle {Update}
Main
Case message of
SingleClic :
Begin
Set $cmd = {echo "}$iconsd{"|sed -e "s:}$oldICstring{:}$ICstring{:"}
Set $iconsd = (GetOutput $cmd 1 -1)
HideWidget 3
ChangeTitle 3 $iconsd
ShowWidget 3
Set $oldICstring = $ICstring
End
End
# Separation
Widget 37
Property
Flags NoReliefString
Position 5 355
Size 780 1
Type Rectangle
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
# Media directories {{{2
Widget 4
Property
Flags NoReliefString
Position 130 360
Size 480 105
Type List
# Font "xft:$[panel_font]:size=10:$[panel_font_style]"
Title { }
Main
Case message of
SingleClic :
Begin
Set $mediad = (GetTitle 4)
Set $mindex = (GetValue 4)
Set $cmd = {exec echo "}$mediad{"|cut -d '|' -f }$mindex
Set $Mstring = (GetOutput $cmd 1 -1)
Set $oldMstring = $Mstring
HideWidget 44
ChangeTitle 44 $Mstring
ShowWidget 44
End
End
# Media directories label
Widget 40
Property
Flags NoReliefString Center
Position 5 360
Size 120 35
Type ItemDraw
LocaleTitle {Media}
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
Widget 41
Property
Flags NoReliefString Center
Position 5 400
Size 120 35
Type ItemDraw
LocaleTitle {Directories}
Main
Case message of
SingleClic :
Begin
Do Nop
End
End
# Add line
Widget 42
Property
Flags NoReliefString
Position 625 390
Size 170 35
Type PushButton
LocaleTitle {Add line}
Main
Case message of
SingleClic :
Begin
Set $cmd = {echo "}$mediad{"|sed -e "s:^.*$:&}$Mstring{|:"}
Set $mediad = (GetOutput $cmd 1 -1)
HideWidget 4
ChangeTitle 4 $mediad
ShowWidget 4
Set $oldMstring = $Mstring
End
End
# Save media dirs
Widget 43
Property
Flags NoReliefString
Position 625 430
Size 170 35
Type PushButton
LocaleTitle {Save}
Main
Case message of
SingleClic :
Begin
Set $cmd = {PipeRead 'echo "}$mediad{"| sed -e \'s:|$::\' | tr \'|\' \'\\n\'>}$mfile{'}
Do $cmd
End
End
# Edit entry
Widget 44
Property
Flags NoReliefString
Position 130 470
Size 480 35
Type TextField
Title { }
#Value 1
Main
Case message of
SingleClic :
Begin
Set $Mstring = (GetTitle 44)
End
1 :
Begin
Set $Mstring = (GetTitle 44)
End
End
# Remove string
Widget 45
Property
Flags NoReliefString
Position 5 470
Size 120 35
Type PushButton
LocaleTitle {Remove}
Main
Case message of
SingleClic :
Begin
Set $cmd = {echo "}$mediad{"|sed -e "s:}$oldMstring{|::"}
Set $mediad = (GetOutput $cmd 1 -1)
HideWidget 4
ChangeTitle 4 $mediad
ShowWidget 4
End
End
# Update string
Widget 46
Property
Flags NoReliefString
Position 625 470
Size 170 35
Type PushButton
LocaleTitle {Update}
Main
Case message of
SingleClic :
Begin
Set $cmd = {echo "}$mediad{"|sed -e "s:}$oldMstring{:}$Mstring{:"}
Set $mediad = (GetOutput $cmd 1 -1)
HideWidget 4
ChangeTitle 4 $mediad
ShowWidget 4
Set $oldMstring = $Mstring
End
End
# Separation
#Widget 47
#Property
# Flags NoReliefString
# Position 5 510
# Size 780 1
# Type Rectangle
#Main
# Case message of
# SingleClic :
# Begin
# Do Nop
# End
#End
# Startup {{{2
#Widget 5
#Property
# Flags NoReliefString
# Position 5 515
# Size 790 280
# Type SwallowExec
# Title {FVWM-Crystal Editor}
#Main
#Case message of
# SingleClic :
# Begin
# Do Nop
# End
#End
# vim:ft=fvwm
|