Results 1 to 9 of 9

Thread: compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

  1. #1

    Default compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

    compositor is a simple script which enables/disables compositing under the different desktops. I wrote it originally to switch compositing on and off in order to test conky's transparency under KDE. Therefore it is also included in conkyconf, a script that writes a basic conky.conf tailored to the hardware (sensors, CPUs) and mounted filesystems, adds some lua functions to conky as well as other features (conkyweather). I haven't post an article about conkyconf except in some posts where I already mentioned it. It is available in my repo. The OBS page is here: https://build.opensuse.org/package/s...ease_try_again. To just use compositor, you can also copy/paste the code below.

    Code:
    #! /bin/bash
    #: Title       : compositor
    #: Date Created: Tue May 31 22:34:10 PDT 2011
    #: Last Edit   : Mon Aug 15 17:37:41 PDT 2011
    #: Author      : Agnelo de la Crotche (please_try_again)
    #: Version     : 1.1
    #: Description : a simple command line tool to switch compositing in 
    #:               kde, xfce, gnome 2/3, lxde/openbox and icewm
    #: Usage       : compositor [ xfce|kde|gnome ]
    #:               Without argument, switchs compositing of the current desktop
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    # number of workpsaces used in Gnome 3 fallback
    workspaces=9
    
    # options for xcompmgr (used with lxde and icewm)
    xcompmgr_options="-c -f -F"
    #xcompmgr_options="-c -t-5 -l-5 -r4.2 -o.55"
    
    ps nc -C X,Xorg >/dev/null || launch="dbus-launch --exit-with-session"
    
    gconf="$launch gconftool-2"
    
    ps nc -C plasma-desktop >/dev/null && de=kde
    ps nc -C xfce4-panel >/dev/null && de=xfce
    ps nc -C gnome-panel >/dev/null && de=gnome2
    ps nc -C gnome-shell >/dev/null && de=gnome3
    ps nc -C openbox,openbox-session >/dev/null && de=openbox
    ps nc -C icewm,icewm-session >/dev/null && de=icewm
    ps nc -C lxsession >/dev/null && de=lxde
    ps nc -C gconfd-2 >/dev/null || gconf="$gconf --direct --config-source xml:readwrite:$HOME/.gconf"
    
    # get Gnome major version (2 or 3)
    gnomever=2
    which gnome-shell &>/dev/null && gnomever=$(gnome-shell --version | awk '{ sub(/\..*/,"",$3) ; print $3}')
    
    
    args="xfce kde gnome"
    
    function no {
    case $1 in
    false) echo true ;;
    true) echo false ;;
    gnome) echo gnome-fallback ;;
    gnome-fallback) echo gnome ;;
    *) 
    	case $de in
    	gnome3) echo gnome-fallback ;;
    	*) echo false ;;
    	esac ;;
    esac
    }
    
    if [ $# -eq 1 ] ; then
    	de=$(echo $1 | tr "[:upper:]" "[:lower:]")
    	[ "${args#*$de}" == "$args" ] && exec echo valid arguments: $args
    	[ "$de" == "gnome" ] && de=gnome${gnomever}
    else
    	[ "$launch" ] && exec echo valid arguments: $args
    fi
    
    case $de in
    gnome2) $launch gsettings list-schemas | grep -q  shell && de=gnome3 ;;
    lxde|icewm|openbox) [ "$launch" ] && exec echo "X ist not running" 
    			which xcompmgr >/dev/null 2>&1 || exec echo "xcompmgr not found" ;;
    esac
    
    case $de in
    kde)    state=$(kreadconfig --file kwinrc --group Compositing --key Enabled) ;;
    xfce)   state=$($launch xfconf-query -c xfwm4 -p /general/use_compositing) ;;
    gnome2) state=$($gconf --get /apps/metacity/general/compositing_manager 2>/dev/null) ;;
    gnome3) state=$(dconf read /org/gnome/desktop/session/session-name | tr -d "'") ;;
    lxde|icewm|openbox) ps nc -C xcompmgr >/dev/null && state=true || state=false ;;
    esac
    
    state=$(no $state)
    
    case $de in
    
    kde) 
    D=$(qdbus org.kde.kwin /KWin org.kde.KWin.currentDesktop 2>/dev/null)
    kwriteconfig --file kwinrc --group Compositing --key Enabled --type bool $state
    [ "$D" ] && qdbus org.kde.kwin /KWin reconfigure ;;
    
    gnome2) $gconf --set /apps/metacity/general/compositing_manager --type bool $state ;;
    gnome3) $launch	gsettings set org.gnome.desktop.session session-name $state ;;
    xfce)   $launch xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s $state ;;
    
    lxde|icewm|openbox)
    if [ "$state" == "false" ] ; then  
    	killall -9 xcompmgr 2>/dev/null
    else 
    	xcompmgr $xcompmgr_options & 
    fi ;;
    
    esac
    
    case $state in
    true)  echo "Compositing enabled for $de" ;;
    false) echo "Compositing disabled for $de" ;;
    gnome) echo "Gnome 3 set to gnome-shell. Please restart Gnome." ;;
    gnome-fallback) $gconf --type=int --set /apps/metacity/general/num_workspaces $workspaces
    				echo "Gnome3 set to gnome-fallback. Please restart Gnome." ;;
    esac
    • When used without argument in Kde, Gnome or Xfce, compositor switches the DE compositing feature on and off.
    • In gome 3, it switches between gnome shell and gnome fallback
    • In lxde, openbox and icewm, it starts or kills the xcompmgr compositing manager (which has to be installed separately).
    • In console it takes one of the arguments kde, gnome or xfce to set/unset compositing for the given desktop. It can be very useful if for example kde doesn't start at all because of the desktop effects (which are enabled by default AFAIK).


    I recently discovered that enabling compositing solved the Flash fullscreen issue I had with the ATI driver since 11.3, issue that has been several times reported in the forum over the past months. That's why I decided to post the script, as it provides a very simple way to enable/disable compositing. When compositing is enabled, Xorg CPU usage falls under 50% and makes it possible to watch videos in fullscreen. When compositing is off, X eats 100% of the CPU resources and the video becomes extremely slow or freezes within seconds.

    Simply typing compositor in Gnome and icewm (so far tested) allowed me to watch the news in fullscreen with Flash/Firefox on iMac with Radeon HD 2400 XT using the latest ATI proprietary driver - to my big surprise, I should say. I wanted to make sure that it was not a DE issue (which I knew already) and tried under icewm. I happened to remember that I used xcompmgr under either NetBSD or FreeBSD to watch videos in fullscreen with the nouveau driver (a while ago). So I decided to run xcompmgr under icewm and it solves the Flash fullscreen issue by dividing the CPU usage by 2. Then I tried under Gnome and used compositor to activate metacity compositing and it worked too. Of course you don't need compositor to enable compositing. But the key for Flash fullscreen videos (at least on ATI hardware) seems to be compositing, no matter how you enable it.

  2. #2
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

    This is great stuff pleas_try_again. Normally, when I install the nVIDIA driver and use KDE, compositing is on by default. Why does this end up off with the AMD video driver?

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  3. #3

    Default Re: compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

    Quote Originally Posted by jdmcdaniel3 View Post
    This is great stuff pleas_try_again. Normally, when I install the nVIDIA driver and use KDE, compositing is on by default. Why does this end up off with the AMD video driver?
    Compositing is enabled by default on KDE in any case ... except in the skeletons of the systems I install - meaning I did change that default. The reason is that everyone can easily enable desktop effects, but not everyone is able to disable them if the desktop doesn't start (it happens) or the menus don't work properly.

    But compositing is off by default for fullscreen windows. This is what needs to be turned on on (some) ATI hardware in order to watch Flash videos in fullscreen under KDE. The news version of compositor below set compositing on fullscreen windows. If it's not desired, you can comment out the variable initialization (in red in the code) or set its value to 0.

    Code:
    #: Title       : compositor
    #: Date Created: Tue May 31 22:34:10 PDT 2011
    #: Last Edit   : Tue Aug 16 18:01:24 PDT 2011
    #: Author      : Agnelo de la Crotche (please_try_again)
    #: Version     : 1.2
    #: Description : a simple command line tool to switch compositing in 
    #:               kde, xfce, gnome 2/3, lxde/openbox and icewm
    #: Usage       : compositor [ xfce|kde|gnome ]
    #:               Without argument, switch compositing of the current desktop
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    declare -l KDE_FSCOMPOSITING
    
    # enable compositing for fullscreen windows under KDE
    # This is needed for fullscreen videos on (some) ATI hardware.
    # Comment out the line below or set the value to 0 to reverse 
    # to KDE default ( 'Suspend desktop effects for fullscreen windows').
    KDE_FSCOMPOSITING=1 
    
    # accept "true", "yes", "on" and 1 as valid values
    [ "x$KDE_FSCOMPOSITING" == "xtrue" -o "x$KDE_FSCOMPOSITING" == "xyes" -o "x$KDE_FSCOMPOSITING" == "xon" -o "x$KDE_FSCOMPOSITING" == "x1" ] || unset KDE_FSCOMPOSITING
     
    # number of workpsaces used in Gnome 3 fallback
    workspaces=9
    
    # options for xcompmgr (used with lxde and icewm)
    xcompmgr_options="-c -f -F"
    #xcompmgr_options="-c -t-5 -l-5 -r4.2 -o.55"
    
    ps nc -C X,Xorg >/dev/null || launch="dbus-launch --exit-with-session"
    
    gconf="$launch gconftool-2"
    
    ps nc -C plasma-desktop >/dev/null && de=kde
    ps nc -C xfce4-panel >/dev/null && de=xfce
    ps nc -C gnome-panel >/dev/null && de=gnome2
    ps nc -C gnome-shell >/dev/null && de=gnome3
    ps nc -C openbox,openbox-session >/dev/null && de=openbox
    ps nc -C icewm,icewm-session >/dev/null && de=icewm
    ps nc -C lxsession >/dev/null && de=lxde
    ps nc -C gconfd-2 >/dev/null || gconf="$gconf --direct --config-source xml:readwrite:$HOME/.gconf"
    
    # get Gnome major version (2 or 3)
    gnomever=2
    which gnome-shell &>/dev/null && gnomever=$(gnome-shell --version | awk '{ sub(/\..*/,"",$3) ; print $3}')
    
    args="xfce kde gnome"
    
    function no {
    case $1 in
    false) echo true ;;
    true) echo false ;;
    gnome) echo gnome-fallback ;;
    gnome-fallback) echo gnome ;;
    *) 
    	case $de in
    	gnome3) echo gnome-fallback ;;
    	*) echo false ;;
    	esac ;;
    esac
    }
    
    if [ $# -eq 1 ] ; then
    	de=$(echo $1 | tr "[:upper:]" "[:lower:]")
    	[ "${args#*$de}" == "$args" ] && exec echo valid arguments: $args
    	[ "$de" == "gnome" ] && de=gnome${gnomever}
    else
    	[ "$launch" ] && exec echo valid arguments: $args
    fi
    
    case $de in
    gnome2) $launch gsettings list-schemas | grep -q  shell && de=gnome3 ;;
    lxde|icewm|openbox) [ "$launch" ] && exec echo "X ist not running" 
    			which xcompmgr >/dev/null 2>&1 || exec echo "xcompmgr not found" ;;
    esac
    
    case $de in
    kde)    state=$(kreadconfig --file kwinrc --group Compositing --key Enabled) ;;
    xfce)   state=$($launch xfconf-query -c xfwm4 -p /general/use_compositing) ;;
    gnome2) state=$($gconf --get /apps/metacity/general/compositing_manager 2>/dev/null) ;;
    gnome3) state=$(dconf read /org/gnome/desktop/session/session-name | tr -d "'") ;;
    lxde|icewm|openbox) ps nc -C xcompmgr >/dev/null && state=true || state=false ;;
    esac
    
    state=$(no $state)
    
    case $de in
    
    kde) 
    D=$(qdbus org.kde.kwin /KWin org.kde.KWin.currentDesktop 2>/dev/null)
    kwriteconfig --file kwinrc --group Compositing --key Enabled --type bool $state
    [ $KDE_FSCOMPOSITING ] && kwriteconfig --file kwinrc --group Compositing --key UnredirectFullscreen --type bool $(no $state)
    [ "$D" ] && qdbus org.kde.kwin /KWin reconfigure ;;
    
    gnome2) $gconf --set /apps/metacity/general/compositing_manager --type bool $state ;;
    gnome3) $launch	gsettings set org.gnome.desktop.session session-name $state ;;
    xfce)   $launch xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s $state ;;
    
    lxde|icewm|openbox)
    if [ "$state" == "false" ] ; then  
    	killall -9 xcompmgr 2>/dev/null
    else 
    	xcompmgr $xcompmgr_options & 
    fi ;;
    
    esac
    
    case $state in
    true)  echo "Compositing enabled for $de" ;;
    false) echo "Compositing disabled for $de" ;;
    gnome) echo "Gnome 3 set to gnome-shell. Please restart Gnome." ;;
    gnome-fallback) $gconf --type=int --set /apps/metacity/general/num_workspaces $workspaces
    				echo "Gnome3 set to gnome-fallback. Please restart Gnome." ;;
    esac

  4. #4

    Default Re: compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

    compositor 1.3

    Code:
    #! /bin/bash
    #: Title       : compositor
    #: Date Created: Tue May 31 22:34:10 PDT 2011
    #: Last Edit   : Tue Sep  6 13:45:21 PDT 2011
    #: Author      : Agnelo de la Crotche (please_try_again)
    #: Version     : 1.3
    #: Description : a simple command line tool to switch compositing in 
    #:               kde, xfce, gnome 2/3, lxde/openbox and icewm
    #: Usage       : compositor [ xfce|kde|gnome ]
    #:               Without argument, switch compositing of the current desktop
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    declare -l KDE_FSCOMPOSITING
    
    # enable compositing for fullscreen windows under KDE
    # This is needed for fullscreen videos on (some) ATI hardware.
    # Comment out the line below or set the value to 0 to reverse 
    # to KDE default ( 'Suspend desktop effects for fullscreen windows').
    KDE_FSCOMPOSITING=1 
    
    # accept "true", "yes", "on" and 1 as valid values
    [ "x$KDE_FSCOMPOSITING" == "xtrue" -o "x$KDE_FSCOMPOSITING" == "xyes" -o "x$KDE_FSCOMPOSITING" == "xon" -o "x$KDE_FSCOMPOSITING" == "x1" ] || unset KDE_FSCOMPOSITING
     
    # number of workpsaces used in Gnome 3 fallback
    workspaces=9
    
    # options for xcompmgr (used with lxde and icewm)
    xcompmgr_options="-c -f -F"
    #xcompmgr_options="-c -t-5 -l-5 -r4.2 -o.55"
    
    ps nc -C X,Xorg >/dev/null || launch="dbus-launch --exit-with-session"
    
    gconf="$launch gconftool-2"
    
    ps nc -C plasma-desktop >/dev/null && de=kde
    ps nc -C xfce4-panel >/dev/null && de=xfce
    ps nc -C gnome-panel >/dev/null && de=gnome2
    ps nc -C gnome-shell >/dev/null && de=gnome3
    ps nc -C openbox,openbox-session >/dev/null && de=openbox
    ps nc -C icewm,icewm-session >/dev/null && de=icewm
    ps nc -C lxsession >/dev/null && de=lxde
    ps nc -C gconfd-2 >/dev/null || gconf="$gconf --direct --config-source xml:readwrite:$HOME/.gconf"
    
    # get Gnome major version (2 or 3)
    gnomever=2
    which gnome-shell &>/dev/null && gnomever=$(gnome-shell --version | awk '{ sub(/\..*/,"",$3) ; print $3}')
    
    args="xfce kde gnome gnome3"
    
    function no {
    case $1 in
    false) echo true ;;
    true) echo false ;;
    gnome) echo gnome-fallback ;;
    gnome-fallback) echo gnome ;;
    *) 
        case $de in
        gnome3) echo gnome-fallback ;;
        *) echo false ;;
        esac ;;
    esac
    }
    
    if [ $# -eq 1 ] ; then
        de=$(echo $1 | tr "[:upper:]" "[:lower:]")
        [ "${args#*$de}" == "$args" ] && exec echo valid arguments: $args
        [ "$de" == "gnome" ] && de=gnome${gnomever}
    else
        [ "$launch" ] && exec echo valid arguments: $args
    fi
    
    case $de in
    gnome2) [ "$1" == "gnome3" ] && $launch gsettings list-schemas | grep -q  shell && de=gnome3 ;;
    lxde|icewm|openbox) [ "$launch" ] && exec echo "X ist not running" 
                which xcompmgr >/dev/null 2>&1 || exec echo "xcompmgr not found" ;;
    esac
    
    case $de in
    kde)    state=$(kreadconfig --file kwinrc --group Compositing --key Enabled) ;;
    xfce)   state=$($launch xfconf-query -c xfwm4 -p /general/use_compositing) ;;
    gnome2) state=$($gconf --get /apps/metacity/general/compositing_manager 2>/dev/null) ;;
    gnome3) state=$(dconf read /org/gnome/desktop/session/session-name | tr -d "'") ;;
    lxde|icewm|openbox) ps nc -C xcompmgr >/dev/null && state=true || state=false ;;
    esac
    
    state=$(no $state)
    
    case $de in
    
    kde) 
    D=$(qdbus org.kde.kwin /KWin org.kde.KWin.currentDesktop 2>/dev/null)
    kwriteconfig --file kwinrc --group Compositing --key Enabled --type bool $state
    [ $KDE_FSCOMPOSITING ] && kwriteconfig --file kwinrc --group Compositing --key UnredirectFullscreen --type bool $(no $state)
    [ "$D" ] && qdbus org.kde.kwin /KWin reconfigure ;;
    
    gnome2) $gconf --set /apps/metacity/general/compositing_manager --type bool $state ;;
    gnome3) $launch    gsettings set org.gnome.desktop.session session-name $state ;;
    xfce)   $launch xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s $state ;;
    
    lxde|icewm|openbox)
    if [ "$state" == "false" ] ; then  
        killall -9 xcompmgr 2>/dev/null
    else 
        xcompmgr $xcompmgr_options & 
    fi ;;
    
    esac
    
    case $state in
    true)  echo "Compositing enabled for $de" ;;
    false) echo "Compositing disabled for $de" ;;
    gnome) echo "Gnome 3 set to gnome-shell. Please restart Gnome." ;;
    gnome-fallback) $gconf --type=int --set /apps/metacity/general/num_workspaces $workspaces
                    echo "Gnome3 set to gnome-fallback. Please restart Gnome." ;;
    esac
    This new version allows to enable metacity composiiting under gnome-fallback. Typing compositor under Gnome3 no longer switches between gnome-shell and gnome-fallback. I added the option "gnome3" for this purpose.

  5. #5

    Default Re: compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

    Had a bug in this version.

    Code:
    --- /usr/bin/compositor.orig    2011-09-07 12:50:56.000000000 -0700
    +++ /usr/bin/compositor 2011-09-09 00:21:54.580789663 -0700
    @@ -64,7 +64,8 @@
     if [ $# -eq 1 ] ; then
            de=$(echo $1 | tr "[:upper:]" "[:lower:]")
            [ "${args#*$de}" == "$args" ] && exec echo valid arguments: $args
    -       [ "$de" == "gnome" ] && de=gnome${gnomever}
    +       [ "$de" == "gnome3" -a $gnomever -eq 2 ] && exec echo "Gnome3 is not installed"
    +       [ "$de" == "gnome" ] && de=gnome2
     else
            [ "$launch" ] && exec echo valid arguments: $args
     fi
    It is fixed in version 1.3.1 below:

    Code:
    #: Title       : compositor
    #: Date Created: Tue May 31 22:34:10 PDT 2011
    #: Last Edit   : Fri Sep  9 00:21:37 PDT 2011
    #: Author      : Agnelo de la Crotche (please_try_again)
    #: Version     : 1.3.1
    #: Description : a simple command line tool to switch compositing in 
    #:               kde, xfce, gnome 2/3, lxde/openbox and icewm
    #: Usage       : compositor [ xfce|kde|gnome ]
    #:               Without argument, switch compositing of the current desktop
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    declare -l KDE_FSCOMPOSITING
    
    # enable compositing for fullscreen windows under KDE
    # This is needed for fullscreen videos on (some) ATI hardware.
    # Comment out the line below or set the value to 0 to reverse 
    # to KDE default ( 'Suspend desktop effects for fullscreen windows').
    KDE_FSCOMPOSITING=1 
    
    # accept "true", "yes", "on" and 1 as valid values
    [ "x$KDE_FSCOMPOSITING" == "xtrue" -o "x$KDE_FSCOMPOSITING" == "xyes" -o "x$KDE_FSCOMPOSITING" == "xon" -o "x$KDE_FSCOMPOSITING" == "x1" ] || unset KDE_FSCOMPOSITING
     
    # number of workpsaces used in Gnome 3 fallback
    workspaces=9
    
    # options for xcompmgr (used with lxde and icewm)
    xcompmgr_options="-c -f -F"
    #xcompmgr_options="-c -t-5 -l-5 -r4.2 -o.55"
    
    ps nc -C X,Xorg >/dev/null || launch="dbus-launch --exit-with-session"
    
    gconf="$launch gconftool-2"
    
    ps nc -C plasma-desktop >/dev/null && de=kde
    ps nc -C xfce4-panel >/dev/null && de=xfce
    ps nc -C gnome-panel >/dev/null && de=gnome2
    ps nc -C gnome-shell >/dev/null && de=gnome3
    ps nc -C openbox,openbox-session >/dev/null && de=openbox
    ps nc -C icewm,icewm-session >/dev/null && de=icewm
    ps nc -C lxsession >/dev/null && de=lxde
    ps nc -C gconfd-2 >/dev/null || gconf="$gconf --direct --config-source xml:readwrite:$HOME/.gconf"
    
    # get Gnome major version (2 or 3)
    gnomever=2
    which gnome-shell &>/dev/null && gnomever=$(gnome-shell --version | awk '{ sub(/\..*/,"",$3) ; print $3}')
    
    args="xfce kde gnome gnome3"
    
    function no {
    case $1 in
    false) echo true ;;
    true) echo false ;;
    gnome) echo gnome-fallback ;;
    gnome-fallback) echo gnome ;;
    *) 
    	case $de in
    	gnome3) echo gnome-fallback ;;
    	*) echo false ;;
    	esac ;;
    esac
    }
    
    if [ $# -eq 1 ] ; then
    	de=$(echo $1 | tr "[:upper:]" "[:lower:]")
    	[ "${args#*$de}" == "$args" ] && exec echo valid arguments: $args
    	[ "$de" == "gnome3" -a $gnomever -eq 2 ] && exec echo "Gnome3 is not installed"
    	[ "$de" == "gnome" ] && de=gnome2
    else
    	[ "$launch" ] && exec echo valid arguments: $args
    fi
    
    case $de in
    gnome2) [ "$1" == "gnome3" ] && $launch gsettings list-schemas | grep -q  shell && de=gnome3 ;;
    lxde|icewm|openbox) [ "$launch" ] && exec echo "X ist not running" 
    			which xcompmgr >/dev/null 2>&1 || exec echo "xcompmgr not found" ;;
    esac
    
    case $de in
    kde)    state=$(kreadconfig --file kwinrc --group Compositing --key Enabled) ;;
    xfce)   state=$($launch xfconf-query -c xfwm4 -p /general/use_compositing) ;;
    gnome2) state=$($gconf --get /apps/metacity/general/compositing_manager 2>/dev/null) ;;
    gnome3) state=$(dconf read /org/gnome/desktop/session/session-name | tr -d "'") ;;
    lxde|icewm|openbox) ps nc -C xcompmgr >/dev/null && state=true || state=false ;;
    esac
    
    state=$(no $state)
    
    case $de in
    
    kde) 
    D=$(qdbus org.kde.kwin /KWin org.kde.KWin.currentDesktop 2>/dev/null)
    kwriteconfig --file kwinrc --group Compositing --key Enabled --type bool $state
    [ $KDE_FSCOMPOSITING ] && kwriteconfig --file kwinrc --group Compositing --key UnredirectFullscreen --type bool $(no $state)
    [ "$D" ] && qdbus org.kde.kwin /KWin reconfigure ;;
    
    gnome2) $gconf --set /apps/metacity/general/compositing_manager --type bool $state ;;
    gnome3) $launch	gsettings set org.gnome.desktop.session session-name $state ;;
    xfce)   $launch xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s $state ;;
    
    lxde|icewm|openbox)
    if [ "$state" == "false" ] ; then  
    	killall -9 xcompmgr 2>/dev/null
    else 
    	xcompmgr $xcompmgr_options & 
    fi ;;
    
    esac
    
    case $state in
    true)  echo "Compositing enabled for $de" ;;
    false) echo "Compositing disabled for $de" ;;
    gnome) echo "Gnome 3 set to gnome-shell. Please restart Gnome." ;;
    gnome-fallback) $gconf --type=int --set /apps/metacity/general/num_workspaces $workspaces
    				echo "Gnome3 set to gnome-fallback. Please restart Gnome." ;;
    esac

  6. #6

    Default Re: compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

    compositor 1.4

    * Added support for sawfish and fvwm2.

    Code:
    #! /bin/bash
    #: Title       : compositor
    #: Date Created: Tue May 31 22:34:10 PDT 2011
    #: Last Edit   : Mon Sep 12 23:29:50 PDT 2011
    #: Author      : Agnelo de la Crotche (please_try_again)
    #: Version     : 1.4
    #: Description : a simple command line tool to switch compositing in 
    #:               kde, xfce, gnome 2/3, lxde/openbox and icewm
    #: Usage       : compositor [ xfce|kde|gnome ]
    #:               Without argument, switch compositing of the current desktop
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    declare -l KDE_FSCOMPOSITING
    
    # enable compositing for fullscreen windows under KDE
    # This is needed for fullscreen videos on (some) ATI hardware.
    # Comment out the line below or set the value to 0 to reverse 
    # to KDE default ( 'Suspend desktop effects for fullscreen windows').
    KDE_FSCOMPOSITING=1 
    
    # accept "true", "yes", "on" and 1 as valid values
    [ "x$KDE_FSCOMPOSITING" == "xtrue" -o "x$KDE_FSCOMPOSITING" == "xyes" -o "x$KDE_FSCOMPOSITING" == "xon" -o "x$KDE_FSCOMPOSITING" == "x1" ] || unset KDE_FSCOMPOSITING
     
    # number of workpsaces used in Gnome 3 fallback
    workspaces=9
    
    # options for xcompmgr (used with lxde and icewm)
    xcompmgr_options="-c -f -F"
    #xcompmgr_options="-c -t-5 -l-5 -r4.2 -o.55"
    
    ps nc -C X,Xorg >/dev/null || launch="dbus-launch --exit-with-session"
    
    gconf="$launch gconftool-2"
    
    ps nc -C plasma-desktop >/dev/null && de=kde
    ps nc -C xfce4-panel >/dev/null && de=xfce
    ps nc -C gnome-panel >/dev/null && de=gnome2
    ps nc -C gnome-shell >/dev/null && de=gnome3
    ps nc -C openbox,openbox-session >/dev/null && de=openbox
    ps nc -C icewm,icewm-session >/dev/null && de=icewm
    ps nc -C lxsession >/dev/null && de=lxde
    ps nc -C sawfish >/dev/null && de=sawfish
    ps nc -C fvwm2,fvwm >/dev/null && de=fvwm2
    ps nc -C gconfd-2 >/dev/null || gconf="$gconf --direct --config-source xml:readwrite:$HOME/.gconf"
    
    # get Gnome major version (2 or 3)
    gnomever=2
    which gnome-shell &>/dev/null && gnomever=$(gnome-shell --version | awk '{ sub(/\..*/,"",$3) ; print $3}')
    
    args="xfce kde gnome gnome3"
    
    function no {
    case $1 in
    false) echo true ;;
    true) echo false ;;
    gnome) echo gnome-fallback ;;
    gnome-fallback) echo gnome ;;
    *) 
    	case $de in
    	gnome3) echo gnome-fallback ;;
    	*) echo false ;;
    	esac ;;
    esac
    }
    
    if [ $# -eq 1 ] ; then
    	de=$(echo $1 | tr "[:upper:]" "[:lower:]")
    	[ "${args#*$de}" == "$args" ] && exec echo valid arguments: $args
    	[ "$de" == "gnome3" -a $gnomever -eq 2 ] && exec echo "Gnome3 is not installed"
    	[ "$de" == "gnome" ] && de=gnome2
    else
    	[ "$launch" ] && exec echo valid arguments: $args
    fi
    
    case $de in
    gnome2) [ "$1" == "gnome3" ] && $launch gsettings list-schemas | grep -q  shell && de=gnome3 ;;
    lxde|icewm|openbox|sawfish|fvwm2) [ "$launch" ] && exec echo "X ist not running" 
    			which xcompmgr >/dev/null 2>&1 || exec echo "xcompmgr not found" ;;
    esac
    
    case $de in
    kde)    state=$(kreadconfig --file kwinrc --group Compositing --key Enabled) ;;
    xfce)   state=$($launch xfconf-query -c xfwm4 -p /general/use_compositing) ;;
    gnome2) state=$($gconf --get /apps/metacity/general/compositing_manager 2>/dev/null) ;;
    gnome3) state=$(dconf read /org/gnome/desktop/session/session-name | tr -d "'") ;;
    lxde|icewm|openbox|sawfish|fvwm2) ps nc -C xcompmgr >/dev/null && state=true || state=false ;;
    esac
    
    state=$(no $state)
    
    case $de in
    
    kde) 
    D=$(qdbus org.kde.kwin /KWin org.kde.KWin.currentDesktop 2>/dev/null)
    kwriteconfig --file kwinrc --group Compositing --key Enabled --type bool $state
    [ $KDE_FSCOMPOSITING ] && kwriteconfig --file kwinrc --group Compositing --key UnredirectFullscreen --type bool $(no $state)
    [ "$D" ] && qdbus org.kde.kwin /KWin reconfigure ;;
    
    gnome2) $gconf --set /apps/metacity/general/compositing_manager --type bool $state ;;
    gnome3) $launch	gsettings set org.gnome.desktop.session session-name $state ;;
    xfce)   $launch xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s $state ;;
    
    lxde|icewm|openbox|sawfish|fvwm2)
    if [ "$state" == "false" ] ; then  
    	killall -9 xcompmgr 2>/dev/null
    else 
    	xcompmgr $xcompmgr_options & 
    fi ;;
    
    esac
    
    case $state in
    true)  echo "Compositing enabled for $de" ;;
    false) echo "Compositing disabled for $de" ;;
    gnome) echo "Gnome 3 set to gnome-shell. Please restart Gnome." ;;
    gnome-fallback) $gconf --type=int --set /apps/metacity/general/num_workspaces $workspaces
    				echo "Gnome3 set to gnome-fallback. Please restart Gnome." ;;
    esac

  7. #7

    Default Re: compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

    hey guys,

    i have an HP laptop, with a horrible ATI video card, and I'm using OpenSUSE 11.3, and I have issues with flash, and npviewer.bin
    I've found out about your script but unfortunately I don't know how to use it
    could you, please, post a more detailed ...how to use it...here?

    thanks

  8. #8

    Default Re: compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

    Like for any other script, you have to copy/paste the code in a file, put the file in your PATH and make it executable. So, for this particular script, name the file "compositor" and save it in the directory ~/bin (short for /home/yourname/bin), or anywhere in your PATH ( /usr/local/bin or /usr/bin). Then make the script executable with this command (assuming you saved it in ~/bin):

    Code:
    chmod 0755 ~/bin/compositor
    To use it, just type compositor in a terminal to switch compositing on and off, optionally followed by an argument: kde, gnome or xfce. Depending on the windows manager, you might have to log out and re log in (I actually don't remember).

    In KDE, these two commands are equivalent:
    Code:
    compositor
    compositor kde
    In Gnome, these two commands are equivalent:
    Code:
    compositor 
    compositor gnome
    But you would use the second form in you are in text mode for example. It can help when compositing (enabled by default udner KDE) prevents you from seeing anything on old harware and you have to disable it from the command line before starting X.
    I'm not sure it's going to solve the problem you're having - which can have many different causes. But to watch flash videos in fullscreen with the ATI proprietary driver, you need to enable metacity compositing for Gnome and allow desktop effects for fullscreen windows in KDE (which is normally disabled). That's what this script does.

    To make it clear, under KDE, compositing is enabled by default but "Suspend desktop effects for fullscreen windows" is checked, meaning that compositing is turned off for fullscreen windows. You need to uncheck that for Flash videos*. If that's all you need, it might be easier for you to just uncheck this option. It's under System Settings -> Desktop Effects -> Advanced.

    * Maybe not with all models of ATI, but it did solve the problem for me.

  9. #9

    Default Re: compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

    Quote Originally Posted by please_try_again View Post
    compositor is a simple script which enables/disables compositing under the different desktops. I wrote it originally to switch compositing on and off in order to test conky's transparency under KDE. Therefore it is also included in conkyconf, a script that writes a basic conky.conf tailored to the hardware (sensors, CPUs) and mounted filesystems, adds some lua functions to conky as well as other features (conkyweather). I haven't post an article about conkyconf except in some posts where I already mentioned it. It is available in my repo. The OBS page is here: https://build.opensuse.org/package/s...ease_try_again. To just use compositor, you can also copy/paste the code below.
    Used this and all is well - what no-one seems to tell you is that the session choice menu is invoked by a tiny cogwheel icon next to the sign-in button.
    Are the Gnome developers scared of people who don't want to use the latest (and imho, frankly appaling) shell? Where is the sign saying "Beware of the Leopard"?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •