Friday, June 13, 2014

Compiz Fusion

Compiz is an amazing extension to the Unix desktop.
There's nothing closer in Windows.

I'd like to take note of a just a few things that works on my desktop.
Some features doesn't seem to work or I may have an issue with my keyboard.
Anyway, my intention is to cover a very few basics that once worked for me.

If compiz is installed one sees at least:

$ pkg info -r compiz
          Name: desktop/compiz
       Summary: OpenGL compositing window manager
      Category: Desktop (GNOME)/Window Managers
         State: Installed
     Publisher: solaris
       Version: 0.8.4
 Build Release: 5.11
        Branch: 0.175.0.0.0.0.0
Packaging Date: September 27, 2011 08:26:54 AM
          Size: 5.67 MB
          FMRI: pkg://...


$ pkg info -r compiz-fusion-extra
          Name: desktop/compiz/plugin/compiz-fusion-extra
       Summary: extra effects plugins for compiz
      Category: Applications/Plug-ins and Run-times
         State: Installed
     Publisher: solaris
       Version: 0.8.4
 Build Release: 5.11
        Branch: 0.175.0.0.0.0.0
Packaging Date: September 27, 2011 08:25:35 AM
          Size: 6.83 MB
          FMRI: pkg://...


However, a pkg search compiz may reveal more packages.
At this time I don't know or have time to deal with IPS dependencies.

In case things get out of control, to revert to defaults:
  • Go to System | Preferences | CompizConfig Settings Manager
  • Go to Preferences and click the Reset to defaults button.

But better than reverting to defaults is to use Compiz profiles.
Hence, before changing any settings, create a new Compiz profile.
This way you'll be sure to have an easy fall-back in case of trouble.
Go to CompizConfig Settings Manager | Preferences | Profile & Backend.
Click on the + button and create a new Compiz profile:

 

Now it's much safer to proceed trying out several options!

But if you really mess it up at some point restart from the scratch.
Go to System | Preferences | Appearance | Visual Effects and choose None.
Wait a while, then choose Extra to reenable Compiz.
Clean up previous Compiz profiles and try again.

I think that the Extra settings are quite reasonable.
I only choose to add Gnome Compatibility for the Alt + F2 functionality.
Here's what one gets:









Here's a partial list of the categories items
(with some keyboard shortcuts): 

  • DESKTOP 
    Expo[ Win+e or Ctrl+MB ]


  • WINDOW MANAGEMENT
    Maximumize[ Win+m/h/v ]
    Shift Switcher[ Alt+Tab or Win+LB ]
    Resize Window[ Alt+MB or Alt+F8]
    Shelf[ Win+l/p/o or Win+Alt+L/RB]

NOTE
For quite a long time, more than a couple of years(!), very few times during a gnome-session, but always after initiating a logout or shutdown I saw the annoying message below which I offered no much clues on how to address the warning, except by accepting its hint of not displaying it anymore (which isn't a good practice in case of error or warning messages):
One these days I finally did some progress in coming to a solution, all by myself, which I gladly share with you as no one deserves this hurdles! 😎 The secret lies on running /usr/lib/compiz/compiz-configure.  This configuration tool will reveal and, if possible, fix the issue:
Finally something meaningful! The warning message could have told me about this configuration tool long before! Now, with all making sense, I clicked on the modify configuration button to let the tool fix things for me:
I confess that the message above was somewhat puzzling. The first sentence told me the tool had succeed, yet the last sentence told me there were no configuration file (xorg.conf in /etc/X11). I can confirm that the configuration file (at least as I understand it) was always there. I think the confusion was because I ran the tool as a regular user instead of root with the DISPLAY and xauth adjusted and as such it couldn't access the configuration file as needed (read/write). Anyway the tool proposed the following changes:
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "RenderAccel" "True"
    Option         "AllowGLXWithComposite" "True"
    Option         "AddARGBGLXVisuals" "True"

    SubSection     "Display"
        Depth       24
        Modes      "nvidia-auto-select"
    EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "Enable"
EndSection
I substituted the proposed xorg.conf in /etc/X11 and restarted X so that the tool reported everything was now Ok, but I still see the annoying warning message! (now I'm wondering if at logout or shutdown the warning could be considered harmless as the gnome-session is the process of being dropped down — but I definitely shall not see the message anymore during the sessions — and I haven't, which is a good indication). At least I know I'm closer to the perfect solution.
But I shouldn't have replaced my previously working xorg.conf. I should have just added what compiz-configration told me to be missing. Hence, I manually reintegraded a few settings that became absent in the newly proposed xorg.conf. As I know this X configuration file is sensible and may be a source of many headaches, I fully transcribe mine with the Compiz fix:
# nvidia-xconfig: X config file ... by nvidia-xconfig
# nvidia-xconfig:  version 346.35  ...

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
    FontPath        "catalogue:/etc/X11/fontpath.d"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/mouse"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5 6 7"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "keyboard"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Samsung"
    ModelName      "SyncMaster 225MS"
    HorizSync       30.0 - 80.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GT 610"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "metamodes" "nvidia-auto-select +0+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    Option         "RenderAccel" "True"
    Option         "AllowGLXWithComposite" "True"
    Option         "AddARGBGLXVisuals" "True"
    SubSection     "Display"
        Depth       24
        Modes      "nvidia-auto-select"
    EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "Enable"
EndSection
NOTE
On my old TFT-LCD Samsung SyncMaster 225MS the best result (native resolution) comes only from the DVI connection (1680x1050), not the HDMI (1920x1080). That cause me some headaches until I realize that!
$ xrandr
Screen 0: minimum 8 x 8, current 1680 x 1050, ...
DVI-I-0 disconnected primary (...)
VGA-0 disconnected (...)
DVI-I-1 connected 1680x1050+0+0
(normal left inverted right x axis y axis) 477mm x 300mm
   1680x1050      59.9*+
   1280x1024      75.0     60.0 
   1280x960       60.0 
   1152x864       75.0 
   1024x768       75.0     70.1     60.0 
   800x600        75.0     72.2     60.3     56.2 
   640x480        75.0     72.8     59.9 
HDMI-0 disconnected (...)
NOTE
Just note that when multiple monitors are involved, there may be (multiple 😉) additional issues, for instance, with "metamodes" conflicting with GNOME where there are rotations.