Class: Roebe::GenerateXorgConf

Inherits:
Base show all
Defined in:
lib/roebe/classes/generate_xorg_conf/constants.rb,
lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb

Overview

Roebe::GenerateXorgConf

Constant Summary collapse

COMMENT =
#

COMMENT

#
'# ====================================================================== #'+N
COMPUTER_NAME =
#

COMPUTER_NAME

#
use_this_as_the_new_computer_name
DISTRIBUTION_NAME =
#

DISTRIBUTION_NAME

#
'GoboLinux'
HOME_DIRECTORY_FOR_USER_X =
#

YAML_BASE

#
'/home/x/'
YAML_BASE =
#

YAML_BASE

#
HOME_DIRECTORY_FOR_USER_X+'data/PC/OS/LINUX/yaml/'
DISPLAY_SETTINGS =
#

DISPLAY_SETTINGS

#
Roebe.project_base_directory?+'yaml/display_settings/display_settings.yml'
HASH_DISPLAY_SETTINGS =

bl $LINUX/YAML/display_settings.yml

{}
MONITORS_YAML_FILE =
#

MONITORS_YAML_FILE

#
Roebe.project_yaml_directory?+'monitors/monitors.yml'
MONITORS_YAML =
{}
FILE_COMPUTER_HARDWARE_YAML =
#

FILE_COMPUTER_HARDWARE_YAML

#
"/home/x/data/personal/yaml/my_hardware/computers.yml"
COMPUTER_HARDWARE =
nil
TEMP =
#

TEMP

#
ENV['MY_TEMP'].to_s
KEYBOARD_SECTION =
#

KEYBOARD_SECTION

#
HASH_DISPLAY_SETTINGS['keyboard']
MOUSE_SECTION =
#

MOUSE_SECTION

#
HASH_DISPLAY_SETTINGS['mouse']
ARRAY_XORG_MODULES =
HASH_DISPLAY_SETTINGS['xorg_modules']
NVIDIA_SECTION =

nvidia related stuff

HASH_DISPLAY_SETTINGS['nvidia']
DEFAULT_MONITOR =
HASH_DISPLAY_SETTINGS['default_monitor'].to_sym
DEFAULT_DEPTH =
HASH_DISPLAY_SETTINGS['default_depth'].to_s
FONTS_SECTION =
HASH_DISPLAY_SETTINGS['fonts']
ENABLE_TWINVIEW =
HASH_DISPLAY_SETTINGS['enable_twinview']
HASH_POSSIBLE_MODES =
MONITORS_YAML['possible_modes']
ARRAY_AVAILABLE_MONITORS =
#

ARRAY_AVAILABLE_MONITORS

These monitors are available. :fujitsu is the laptop. GenerateXorgConf::ARRAY_AVAILABLE_MONITORS

#
[
  :acer, :acer_widescreen, :belinea, :vaiotix, :fujitsu, :benq
]

Constants inherited from Base

Base::COLOURS, Base::HOME_DIRECTORY_OF_USER_X, Base::N, Base::NAMESPACE

Instance Method Summary collapse

Methods inherited from Base

#actions, #append_this_onto_that_file, #append_what_into, #be_silent, #be_verbose?, #beautiful_url, #burlywood, #call_next, #chdir, #cheerful_guy, #cliner, #complex_esystem, #convert_global_env, #copy_directory, #copy_file, #cornflowerblue, #create_directory, #crimson, #current_month?, #current_time?, #current_year?, #cyan, #darkcyan, #darkgreen, #darkkhaki, #darkslateblue, #deeppink, #delete_symlink, #do_not_use_the_base_colours, #do_use_the_base_colours, #e, #ecomment, #editor_to_use?, #efancy, #eimp, #emphasis, #ensure_main_encoding, #ensure_utf_encoding, #eparse, #erev, #esteelblue, #etomato, #ewarn, #exit_program, #firebrick, #get_current_day, #get_current_month, #get_files_and_directories, #get_files_from, #get_german_name_for_this_weekday, #gold, #green, #grey, #hh_mm_ss, #hh_mm_ss_day_month_year, #home_dir?, #home_directory_of_user_x?, #infer_the_namespace, #internal_hash?, #is_a_directory?, #is_a_file?, #is_a_jpg_file?, #is_an_image_file?, #is_archive?, #is_audio_file?, #is_in_studium_dir?, #is_multimedia_file?, #is_on_roebe?, #is_on_windows?, #is_studium_available?, #is_symlink?, #is_this_a_ruby_file?, #is_video_file?, #iso_encoding?, #le, #left_colour, #lightblue, #lightgreen, #lightseagreen, #lightsteelblue, #lime, #limegreen, #localhost_to_data, #log_directory?, #main_encoding?, #mediumorchid, #mediumpurple, #mediumseagreen, #mediumslateblue, #mediumspringgreen, #mediumturquoise, #mkdir_p, #mv, #n_days_in_this_month, #n_pages_in_this_pdf_file?, #namespace?, #no_file_exists_at, #ogrey, #olive, #olivedrab, #open_in_browser, #opne, #opnesystem, #opnn, #orange, #orchid, #orev, #palegoldenrod, #palevioletred, #pink, #powderblue, #programs_dir?, #project_base_dir?, #random_html_colour, #rds, #read_file_in_iso_encoding, #read_file_via_the_default_encoding, #read_lines_via_iso_encoding, #readlines_with_main_encoding, #red, #register_sigint, #remove, #remove_directory, #remove_file, #rename_kde_konsole_tab, #replace_localhost_with_data, #report_pwd, #require_rescue, #reset_the_internal_hash, #return_all_directories_from_this_directory, #return_all_files_from_this_directory, #return_current_directory, #return_dd_mm_yyyy, #return_file_or_directory_of, #return_files_from_pwd, #return_last_part_of_the_current_directory, #return_utc, #rev, #right_arrow?, #right_colour, #roebe_log_directory?, #rosybrown, #royalblue, #ruby_base_directory?, #run_in_background, #run_rcfiles_then_run_ata_via_qdbus, #sandybrown, #sdir, #seagreen, #set_be_verbose, #set_xorg_buffer, #sfancy, #sfile, #show_help, #silent_redirection?, #simp, #simple_esystem, #skyblue, #slateblue, #slategray, #springgreen, #steelblue, #string_italic, #swarn, #symlink, #teal, #temp_dir?, #to_camelcase, #to_counted_hash, #tomato, #touch, #try_to_require_the_beautiful_url_gem, #try_to_require_the_html_template, #try_to_require_the_open_gem, #try_to_require_the_program_information_gem, #try_to_require_the_xorg_buffer, #use_colours?, #verbose_truth, #weekday?, #word_wrap, #write_what_into, #yellow

Methods included from Base::CommandlineArguments

#append_onto_the_commandline_arguments, #clear_commandline_arguments, #commandline_arguments?, #commandline_arguments_as_string?, #commandline_arguments_without_leading_hyphens?, #first_argument?, #first_argument_without_leading_hyphens?, #has_an_argument_been_passed?, #remove_hyphened_arguments_from_the_commandline_arguments, #return_commandline_arguments_with_leading_hyphens, #second_argument?, #set_commandline_arguments

Constructor Details

#initialize(what_to_do = nil, location = return_pwd+'xorg.conf', create_xorg_file = true) ⇒ GenerateXorgConf

#

initialize

#


31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 31

def initialize(
    what_to_do       = nil, 
    location         = return_pwd+'xorg.conf',
    create_xorg_file = true
  )
  reset
  menu(what_to_do)
  # Ok, we finally finished sanitizing. Lets move to other things.
  set_create_xorg_file(create_xorg_file)
  set_location(location)
  run if @create_xorg_file # check so you can lateron try again
end

Instance Method Details

#_(i = N) ⇒ Object

#

_

Use this method to append to the main string.

#


624
625
626
627
628
629
630
631
632
633
634
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 624

def _(i = N)
  i = i.dup if i.frozen?
  unless i.end_with? N # Ensure that a newline is appended.
    i << N
  end
  case i.encoding.name
  when 'UTF-8'
    i.force_encoding('ISO-8859-1')
  end
  @xorg_string << i.to_s.dup
end

#generate_commentsObject

#

generate_comments

comment tag

#


555
556
557
558
559
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 555

def generate_comments
  _ COMMENT+'# Automagically created Xorg.conf file for '+DISTRIBUTION_NAME+N
  _ "# For #{@for_which_monitor.to_s.capitalize} Monitor"+N
  _ COMMENT+N
end

#generate_everythingObject

#

generate_everything

General wrapper to install everything.

#


706
707
708
709
710
711
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 706

def generate_everything
  reset_main_string
  generate_comments
  generate_subsections
  generate_xorg_file
end

#generate_section_deviceObject

#
=== generate_section_device (device tag dev tag)

Section “Device”

#


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
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 457

def generate_section_device
  _ make_subsection_header('Section "Device" '+
  "for #{@for_which_monitor.to_s.capitalize} Monitor")
  _ 'Section "Device"'+N+N
  _ '  Identifier "Videocard1"
# Identifier "VESA Framebuffer" # für VESA
# Driver "mga"
# Driver "via" for elitix

# ================================================================ #
# The following is needed to prevent some bug
# ================================================================ #
Option "AccelMethod" "EXA"

# Option      "AddARGBGLXVisuals" "true"
# This option must be either undeclared or
# false, in order to avoid periodic short-term
# freezes on beryl and other OpenGL intensive
# programs
# Option      "UseEvents"         "false"
# Option      "RenderAccel"       "true"
'+N

  unless @for_which_monitor.to_s == 'vaiotix'
    _ '  Driver "nvidia" # nv nvidia treiber für meine GeForce, auf dem Hauptrechner'+N
  end
  # dont use case menu here because of different defaults.
  if @for_which_monitor.to_s == 'fujitsu'
    _ '  Driver    "via" # for Laptop'+N
    _ '  Option    "VBEModes"   "true"'+N
    _ '  Option    "DisableIRQ"'+N
    _ '  Option    "EnableAGPDMA"'+N
  else
    _ '  # Driver       "nvidia" # i believe "nvidia" is the same as "nv"'+N
  end

  # comment the following if not vaiotix
  unless @for_which_monitor.to_s == 'vaiotix' # pass through
    _ '  # '
  end    
  _ '  Driver      "sis" # integrated silicon for '+@for_which_monitor.to_s.capitalize+'
# Driver "via"  
# Driver      "vesa"
# Option "VideoOverlay" "on"  # for video overlay, not sure what this is 
# Option "OpenGLOverlay" "on" # not yet needed
'+N
  case @for_which_monitor.to_s
  when 'vaiotix'
    _ '  VendorName  "Silicon Integrated Systems [SiS]"'+N+N
  when 'billigix', 'belinea'
    _ '  VendorName  "nVidia Corporation"'+N+N
  else # else default
    _ '  VendorName "VIA Technologies, Inc."'+N+N
  end

  _ '  # BoardName "NVIDIA GeForce FX (generic)" # nvidia GeForce '+N
  _ '  '+@hash_board_name[@for_which_monitor].to_s+N
  
  # Add BusID here. Please note, for AGP you would need a 
  # line such as this:
  #   BusID "AGP:01:00:0"
  case @for_which_monitor    
  when :vaiotix # multimedia workstation
    _ '  BusID "PCI:1:0:0"'+N
  when :fujitsu, :belinea # laptop 
    _ '  BusID "PCI:1:0:0"'+N
  end

  if ENABLE_TWINVIEW
    _ '  Option "TwinView" "True"'+N
    _ '  Option "TwinViewOrientation" "RightOf"'+N   
    _ '  Option "UseEdidFreqs" "True" # Not sure what this is'+N
    # No idea what MetaModes does, but on 05.06.2008 it caused a problem, and was picked
    # automagically. Thus i disabled it.
    _ '  # Option "MetaModes" "1440x900,720x480; 1280x1024,1280x1024; 1024x768,1024x768"'+N
    # The following could also be:
    #   Option "ConnectedMonitor" "CRT,CRT"
    _ '  Option "ConnectedMonitor" "DFP, DFP"'+N
    _ '  Option "UseDisplayDevice" "DFP" # the value here can be either 
  # DFP (Digital flat panel connected via DVI port), CRT (any monitor that 
  # is connected via VGA ports) or TV'+N
  end

  _  '  # BoardName "Matrox Millennium G200" # No Clue
# BoardName "S3 UniChrome" # scheint integrated zu sein
VideoRam 8192'+N
  _ N+'  Option "dpms"'+N # add dpms entry
  _ '  Option "NoLogo" "'+NVIDIA_SECTION['remove_nvidia_logo'].to_s.capitalize+'" # Use or dont use nvidia logo
# Option  "UseEdidFreq" "on" #  if UseEdidFreq is set to false, it ignores what is reported and will use whats in the Monitor Section'+N+N

  _ 'EndSection'
end

#generate_section_driObject

#

generate_section_dri

generate the DRI section (dri tag)

#


441
442
443
444
445
446
447
448
449
450
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 441

def generate_section_dri
  _ make_subsection_header('Section "dri" '+
  "for #{@for_which_monitor.to_s.capitalize} Monitor")
  _ 'Section "dri"
# Access to OpenGL ICD is allowed for all users:
Mode 0666
# Access to OpenGL ICD is restricted to a specific user group:
#  Group 100    # users
EndSection'
end

#generate_section_extensionsObject

#

generate_section_extensions

#


207
208
209
210
211
212
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 207

def generate_section_extensions
  _ make_subsection_header('Section "Extensions" for '+@for_which_monitor.to_s+' Monitor')
  _ 'Section "Extensions"
Option "Composite" "Enable"
EndSection'+N
end

#generate_section_filesObject

#

generate_section_files (files tag)

Will generate files section.

FontPath provides the fonts. You can append more dirs to the list of available font paths. First written will be served first too, so mind the order :>

#


570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 570

def generate_section_files
  _ make_subsection_header('Section "Files" '+
  "for #{@for_which_monitor.to_s.capitalize} Monitor (Files tag)")
  _ 'Section "Files" '+N+N
  # The first line is for older Xorgs.
  _ '  ModulePath "'+HASH_DISPLAY_SETTINGS['xorg_module_path']+'"'+N
  _ '  RgbPath "'+HASH_DISPLAY_SETTINGS['xorg_rgb_path']+'"'+N
  
  font_dir = FONTS_SECTION['xorg_font_directory']

  FONTS_SECTION['xorg_font_path'].each {|font_directory|
    full_dir = ''.dup
    unless font_directory.start_with? '/' # means user gave absolute path to use
      full_dir << remove_double_slashes(font_dir+'/')
    end
    full_dir << remove_double_slashes(font_directory)      
    _ '  FontPath "'+full_dir+'"'+N
  }
  _ N
  _ '  # minimal fonts to allow X to run without xfs'+N
  _ '  FontPath "/usr/lib/X11/fonts/misc:unscaled"'+N+N
  _ 'EndSection'+N
end

#generate_section_inputdevicesObject

#

generate_section_inputdevices

Section “InputDevice”

#


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
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 254

def generate_section_inputdevices
  _ N
  _ make_subsection_header('Section "InputDevice" '+
  "for Mouse, for #{@for_which_monitor.to_s.capitalize} Monitor")
  _ 'Section "InputDevice"'+N+N
  _ '  Identifier "Mouse1"
Driver "mouse"
Option "Protocol" "'+MOUSE_SECTION['mouse_protocol']+'" # 
Option "Device" "'+MOUSE_SECTION['mouse_device_location']+'"
# Option "Device" "/dev/mouse" # some distributions use this instead.
# Option "Device" "/dev/psaux" # für ps/2 mäuse
Option "Emulate3Buttons" "'+MOUSE_SECTION['mouse_emulate_three_buttons']+'"
Option "ZAxisMapping"  "4 5" # to enable scroll wheel / Scrollrad

# Option "SendCoreEvents" "true" # keine ahnung'+N+N
  _ 'EndSection'+N
  # Add Keyboard1 InputDevice
  tmp = make_subsection_header(
    "Section \"InputDevice\" for keyboard (Monitor: #{@for_which_monitor.to_s.capitalize}")
  _ tmp
  _ 'Section "InputDevice"'+N+N
  _ '  Identifier "Keyboard1"

Driver "kbd" # is the same as Driver "keyboard" 

Option "CoreKeyboard" # Main, and in most cases the only, keyboard
Option "AutoRepeat" "'+KEYBOARD_SECTION['auto_repeat_milliseconds'].to_s+' '+
                       KEYBOARD_SECTION['auto_repeat_n_per_second'].to_s+'" # set the AutoRepeat Rate. First value is in ms, second is n / Seconds

Option "XkbModel"   "pc'+KEYBOARD_SECTION['keyboard_model'].to_s+'"

Option "XkbLayout"  "'+KEYBOARD_SECTION['keyboard_layout']+'"
Option "XkbVariant" "'+KEYBOARD_SECTION['keyboard_variant']+'" # other variant for example "intl"
Option "XkbRules"   "xorg"
Option "XkbOptions" "compose:rwin" # compose key to do umlauts. Rarely hurts to enable this.
Option "XkbOptions" "ctrl:swapcaps" # We dont need caps
# Option "Xleds" "1 2 3" # Specify which keyboard LEDs can be user-controlled with xset'+N+N
_ 'EndSection'+N

_ N+N+'Section "InputDevice"
 Identifier "Touchpad1"
 Driver "synaptics"
 Option "Protocol"  "auto-dev"
 Option "Device"    "/dev/psaux" # /dev/input/mice
 Option "LeftEdge"      "1700"
 Option "RightEdge"     "5300"
 Option "TopEdge"       "1700"
 Option "BottomEdge"    "4200"
 Option "FingerLow"   "25"
 Option "FingerHigh"  "30"

 Option "MaxTapTime"  "180"
 Option "MaxTapMove"  "220"
 Option "MaxSpeed"    "0.12"
 Option "MinSpeed"    "0.06"
 
 Option "VertScrollDelta" "100"
 Option "AccelFactor" "0.0010"
 Option "SHMConfig" "on"
 # Option "Repeater"  "/dev/ps2mouse"
EndSection'+N if @use_touchpad
end

#generate_section_modesObject

#

generate_section_modes

Section “Modes” Not sure what this is used for.

#


413
414
415
416
417
418
419
420
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 413

def generate_section_modes
  _ make_subsection_header('Section "Modes" for '+
  "#{@for_which_monitor.to_s.capitalize} Monitor")
  _ '# Section "Modes"'+N+N
  _ '  # Identifier "name"
# weitere Einträge'+N+N
  _ '# EndSection'
end

#generate_section_modulesObject

#

generate_section_modules (Modules tag, module tag)

Will generate Section “Module”

#


427
428
429
430
431
432
433
434
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 427

def generate_section_modules
  _ N+make_subsection_header('Section "Module". Module tag, '+
  "mod tag. for #{@for_which_monitor.to_s.capitalize} Monitor")
  _ 'Section "Module"'+N+N
  ARRAY_XORG_MODULES.each { |xorg_module| _('  Load  "'+xorg_module+'"'+N) }
  _ N
  _ 'EndSection'+N
end

#generate_section_monitorObject

#

generate_section_monitor

Very important to have. Creates monitor subsection. The argument is to match my different monitor types.

#


642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 642

def generate_section_monitor
  _ make_subsection_header('Section "Monitor"'+N)
  _ "# Mon tag. For #{@for_which_monitor.to_s.capitalize} Monitor. (MaxRes: "
  _ '#   '+@hash_max_resolutions[@for_which_monitor].to_s
  _ '# )'
  _ N+COMMENT
  _ 'Section "Monitor"'+N+N
  _ '  Identifier "Monitor1"'+N
  _ '  VendorName "'+@hash_monitor_vendor_names[@for_which_monitor].to_s+'"'+N
  _ '  ModelName  "'+@hash_model_names[@for_which_monitor].to_s+'"'+N
  # _ '  Option "MonitorLayout" "'+@hash_monitor_layout[@for_which_monitor]+'"'+N
  _ '  '+@hash_display_size[which_monitor?]+N
  _ '  '+@hash_horic_sync[@for_which_monitor]+N
  _ '  '+@hash_vertic_refresh[@for_which_monitor]+N
  _ '  '+'Option "ReducedBlanking" "True"'+N
  _ N+'  Option "DPMS" "true" # Energiesparmodus'+N+N
  _ 'EndSection'+N
end

#generate_section_screenObject

#

generate_section_screen

Here comes the default res. Also you define which Monitor and Device to use.

#


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
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 220

def generate_section_screen
  _ make_subsection_header('Section "Screen" for '+@for_which_monitor.to_s+' Monitor')
  _ 'Section "Screen"

Identifier "Screen1"
Device "Videocard1"    # look for Identifier "Videocard1"
Monitor "Monitor1"     # look for Identifier "Monitor1"
DefaultDepth '+DEFAULT_DEPTH+' # 8 16 24 32  # using 24 is probably better

SubSection "Display" 
  # Viewport   0 0 # initial origin if mode is smaller than desktop
  Depth 32 '+N
  _ '    '+HASH_POSSIBLE_MODES[@for_which_monitor]+N
  _ '  EndSubSection
  
SubSection "Display" 
  # Viewport   0 0 # initial origin if mode is smaller than desktop
  Depth 24 '+N
  _ '    '+HASH_POSSIBLE_MODES[@for_which_monitor].dup+N
  _ '  EndSubSection

SubSection "Display"
  # Viewport 0 0 # initial origin if mode is smaller than desktop
  Depth 16 '+N
  _ '    '+HASH_POSSIBLE_MODES[@for_which_monitor]+N
  _ '  EndSubSection'+N+N
  _ 'EndSection'
end

#generate_section_serverflagsObject

#

generate_section_serverflags

Section “ServerFlags” (serverflags tag)

#


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
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 375

def generate_section_serverflags
  _ make_subsection_header('Section "ServerFlags" '+
  "for #{@for_which_monitor.to_s.capitalize} Monitor")
  _ 'Section "ServerFlags"'+N+N
  _ '  # Option "NoTrapSignals"  # verursacht einen core dump oder so :P
Option "DontZap" "false"  # if true, strg+alt+backspace wont close down xserver
Option "DontZoom" "false" # prevents keyboard-induced change of display size
  
# Option "DontVTSwitch" # kommentiere das aus um ctrl+alt+Fkeys auszuschalten
# Option "standby time" "120"
# Option "suspend time" "130"
# Option "off time" "160"
Option "AIGLX" "'+@use_aiglx.to_s+'"

Option "StandbyTime" "10"
Option "SuspendTime" "20"
Option "OffTime" "30"

Option "AllowEmptyInput" "false"

Option "AutoAddDevices" "false" # If set to true then this
  # will prevent any autodetection, which means that
  # xorg will use your previous setup from xorg.conf.   

Option "AllowMouseOpenFail" "true" # Allows the server to start 
# up even if the mouse does not work

Option "AllowNonLocalModInDev" "true" # Allows changes to keyboard and mouse settings
# from non-local clients. '+N+N
  _ 'EndSection'
end

#generate_section_serverlayoutObject

#

generate_section_serverlayout (ServerLayout tag)

Section “ServerLayout”

#


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
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 322

def generate_section_serverlayout
  _ make_subsection_header('Section "ServerLayout", lay '+
  "tag, for #{@for_which_monitor.to_s.capitalize} Monitor")
  _ 'Section "ServerLayout"'+N
  _ N
  _ '  Identifier "'+@for_which_monitor.to_s.capitalize.chomp+'"
Screen 0 "Screen1" 0 0

# InputDevice "Touchpad1" "AlwaysCore" # touchpad'+N

  _ '  InputDevice "Mouse1"    "CorePointer" # alias Name zu CorePointer'+N

  if @use_evdev
    _ '  InputDevice "evdevkeyboard" "CoreKeyboard" # For evdev'+N
  else 
    _ '  InputDevice "Keyboard1" "CoreKeyboard" # alias Name zu CoreKeyboard'+N
  end

  if @use_aiglx
    _ '# AIGLX support for Compiz 3D-Support with DRI and Composite.'
    _ '  Option   "AIGLX" "true"'+N
  else
    _ '  Option   "AIGLX" "false"'+N
  end

  _ '  #  InputDevice     "USB Mouse" "AlwaysCore" # if you have some USB mouse 
# Option "Xinerama" "off" # Do we have Xinerama?'+N+N
  _ 'EndSection'

  if @use_evdev
    _ '

 Section "InputDevice"  
 Identifier "evdevkeyboard"
 Driver "evdev"
 Option "Device"  "/dev/input/by-path/platform-i8042-serio-0-event-kbd" #<- set this path for your setting!
 Option "XkbModel"   "evdev"
 Option "XkbLayout"  "de,us"   #<- it is OK with just "us", but I use two layouts
 Option "XkbVariant" "altgr-intl,qwerty"       #<- for variants, have a look at e.g. /usr/share/X11/xkb/symbols/us
 Option "XkbOptions" "grp:menu_toggle,grp_led:caps"  #<- toggling layouts with win-menu key
 Option "XkbRules"   "xorg"
 Option "evBits"     "+1"
 Option "keyBits"    "~1-255 ~352-511"
 Option "Pass"       "3"
 EndSection'+N
  end
end

#generate_subsectionsObject

#

generate_subsections

Generates the various subsections.

#


133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 133

def generate_subsections
  generate_section_files       # for Files
  generate_section_device      # for device section
  generate_section_dri         # DRI stuff
  generate_section_extensions  # Extensions
  generate_section_inputdevices
  generate_section_modes
  generate_section_modules
  generate_section_monitor
  generate_section_serverflags
  generate_section_serverlayout
  generate_section_screen
end

#generate_xorg_file(at = @xorg_conf_file_location) ⇒ Object

#

generate_xorg_file

Generate our xorg file. Will generate a new xorg.conf file every timeit is called.

Default file location will be at:

ENV['MY_TEMP']+'/xorg.conf'
#


724
725
726
727
728
729
730
731
732
733
734
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 724

def generate_xorg_file(
    at = @xorg_conf_file_location
  )
  set_location(at)
  remove_file(at) if File.exist? at
  e 'Now generating xorg.conf file and storing it here:'
  e
  e "  #{sfile(@xorg_conf_file_location)}"
  e
  save_file(@xorg_string+N, at)
end

#make_subsection_header(input, padding = '') ⇒ Object

#

make_subsection_header

Makes a header with a proper leading comment.

make_subsection_header 'la'
#


192
193
194
195
196
197
198
199
200
201
202
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 192

def make_subsection_header(
    input, padding = ''
  )
  input = input.chomp.dup
  default_padding = padding
  string = N+default_padding
  string << COMMENT
  string << default_padding+'# '+input+N
  string << default_padding+COMMENT
  return string
end
#

menu (menu tag)

The user menu.

#


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 88

def menu(i)
  case i # case tag
  when '?' # feedback all available modes then exit
    pp ARRAY_AVAILABLE_MONITORS.map {|mode| mode.to_s }
    exit
  when /^OPEN/,'open'
    open_yaml_file
    exit
  when 'HELP','help','h','h?'
    show_help_and_exit
  when nil
    # fetch data from computer_hardware.yml
    i = SPECIFIC_MONITOR
  end
  # Some sanitizing going on here.
  i = DEFAULT_MONITOR  if i == :def
  i = SPECIFIC_MONITOR if i.nil?
  i = :benq            if i.to_s.empty?
  i = i.to_sym # finally, convert to symbol here.
  set_proper_mode(i)
end

#open_yaml_fileObject

#

open_yaml_file

#


75
76
77
78
79
80
81
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 75

def open_yaml_file
  if File.exist? MONITORS_YAML_FILE
    esystem('bluefish '+MONITORS_YAML_FILE)
  else
    ewarn 'The file at '+sfile(MONITORS_YAML_FILE)+' does not exist.'
  end
end

#remove_double_slashes(i) ⇒ Object

#

remove_double_slashes

This removes double slashes.

#


599
600
601
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 599

def remove_double_slashes(i)
  i.squeeze('/')
end

#resetObject

#

reset

#


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 47

def reset
  unless HASH_DISPLAY_SETTINGS.empty?
    @use_evdev = HASH_DISPLAY_SETTINGS['use_evdev'] # if true we use evdev.
    @use_aiglx = HASH_DISPLAY_SETTINGS['use_aiglx'] # AIGLX for compiz 3D-Support with DRI & Composite. This option doesnt hurt even if it is not supported by the individual card
    @use_touchpad = HASH_DISPLAY_SETTINGS['use_touchpad'] # should be true for my laptop
  end
  @use_touchpad = true if COMPUTER_NAME == 'laptopix' # overrule for laptop.
  @display_size = '' # string that has our display size
  if MONITORS_YAML
    unless MONITORS_YAML.empty?
      @hash_model_names          = MONITORS_YAML['model_names']
      @hash_monitor_layout       = MONITORS_YAML['monitor_layout']
      @hash_monitor_vendor_names = MONITORS_YAML['vendor_names']
      @hash_horic_sync           = MONITORS_YAML['horizontal_sync']
      # @hash_vertic_refresh[@for_which_monitor]
      @hash_vertic_refresh       = MONITORS_YAML['vertical_sync']
      # @hash_display_size[@for_which_monitor]
      @hash_display_size         = MONITORS_YAML['display_size']
      @hash_max_resolutions      = MONITORS_YAML['maximum_resolution']
      # @hash_board_name[@for_which_monitor]
      @hash_board_name           = MONITORS_YAML['board_name']
    end
  end
end

#reset_main_stringObject

#

reset_main_string

Reset the main string again.

#


124
125
126
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 124

def reset_main_string
  @xorg_string = ''.dup
end

#runObject

#

run

#


739
740
741
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 739

def run
  generate_everything
end

#set_create_xorg_file(i) ⇒ Object

#

set_create_xorg_file

Simply set @create_xorg_file.

#


115
116
117
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 115

def set_create_xorg_file(i)
  @create_xorg_file = i
end

#set_location(i) ⇒ Object

#

set_location

Use this method to assign to @xorg_conf_file_location.

#


682
683
684
685
686
687
688
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 682

def set_location(i)
  i = return_pwd+'xorg.conf' if i == :def or i.empty?
  i = TEMP+'/xorg.conf' if i.to_s.downcase == 'temp'
  i = remove_double_slashes(i)
  i << 'xorg.conf' if File.directory? i
  @xorg_conf_file_location = i # default
end

#set_proper_mode(which_mode) ⇒ Object

#

set_proper_mode

Which mode should be a symbol.

#


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
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 160

def set_proper_mode(which_mode)
  unless which_mode.is_a? Symbol
    raise 'Need a symbol (generate_xorg.conf.rb)'
  end
  case which_mode
  when :hardware # if we pass hardware
    get_hardware_data # then we fetch the hardware info    
    exit # And exit.
  # else, we just continue, and sanitize shortcuts
  when :belinea, :bel, :beli, :std, :normal, # belinea mode, HauptRechner
       :default, :else, :computer2, :anything # else mode
    @for_which_monitor = :belinea
  when :ace, :ac, :widescreen, :wide # acer widescreen mode. is bei nali.
    @for_which_monitor = :acer_widescreen
  when :realacer, :real, :real_acer, :acer # real, smaller acer.
    @for_which_monitor = :acer
  when :vaio, :vai, :v
    @for_which_monitor = :vaiotix
  when :laptop1, :lap, :fujits, :fuj, :fu # mein fujitsu
    @for_which_monitor = :fujitsu
  else
    @for_which_monitor = which_mode # stores which mode to use
  end
  @for_which_monitor = @for_which_monitor.to_s.downcase.to_sym
end

#show_help_and_exitObject

#

show_help_and_exit (help tag)

#


150
151
152
153
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 150

def show_help_and_exit
  e 'Use ? to get all available monitors.'
  exit
end

#which_monitor?Boolean

#

which_monitor?

#

Returns:

  • (Boolean)


664
665
666
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 664

def which_monitor?
  @for_which_monitor
end

#xorg_conf_file_location?Boolean Also known as: xorg_conf_file_location, location?

#

xorg_conf_file_location?

This reader-method will return the full location as to where xorg.conf will be stored at.

#

Returns:

  • (Boolean)


696
697
698
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 696

def xorg_conf_file_location?
  @xorg_conf_file_location
end

#xorg_string?Boolean Also known as: xorg_string

#

xorg_string?

This is actually an Array that contains the final xorg.conf data.

#

Returns:

  • (Boolean)


673
674
675
# File 'lib/roebe/classes/generate_xorg_conf/generate_xorg_conf.rb', line 673

def xorg_string?
  @xorg_string
end