Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: HOWTO: toggle xwinwrap with script

Hybrid View

  1. #1
    Join Date
    Dec 2006
    Beans
    181

    HOWTO: toggle xwinwrap with script

    You can find instructions on building xwinwrap here


    I've written a script that will
    • remove the current background and start xwinwrap, if xwinwrap is not running
    • restore the current background and kill xwinwrap, if xwinwrap is running


    I use this script as a launcher on my gnome panel, so I can toggle my background between a wallpaper and xwinwrap. The script is currently hard coded to run the electricsheep screensaver hack. If you use xwinwrap, You can modify the script for whatever your preferred hack is by editing the xwinwrap_string.

    Code:
    #!/bin/bash
    #
    # xwinset.sh version 1.0
    # Created: 3/23/07 by mugwump67
    #
    # This script will:
    #    turn on xwinwrap if it is off and set background option to 'none'
    #    turn off xwinwrap if it is on and set background option to stretched
    #
    # future enhancements
    #	Currently only switches between none and stretched
    #		- better to save all current background settings to config file and restore from there
    #	Add right-click integration with nautilus (i.e. click mpeg/hack to set)
    #	
    #---------------------------
    # outline:
    #---------------------------
    
    #   If xwinwrap is running, 
    # 	shut off xwinwrap
    #	set background option to stretched
    # 	If xwinwrap is off
    #		If current background is not "none"
    #			set current background to "none"
    #		start xwinwrap
    # --------------------------
    
    xwinwrap_string="nice -n 15 xwinwrap -ni -o 0.11 -fs -s -sp -st -b -nf -- /usr/bin/electricsheep --root 1 --nick mugwump67 --zoom 1 --max-megabytes 5000  -window-id WID"
    
    # if xwinwrap is running, 	
    if [ -n "$(ps  | grep xwinwrap)" ]
    	then
    	# shut off xwinwrap, set backgound option to 'stretched'
    		killall xwinwrap
    		gconftool-2 --type string -s /desktop/gnome/background/picture_options stretched
    
    else
    # xwinwrap is off
    # 		save current background option to 'none'
    # 	start xwinwrap
    	gconftool-2 --type string -s /desktop/gnome/background/picture_options none
    	$xwinwrap_string &
    fi
    This is the first significant shell script that I've ever written, and its missing a few things because I couldn't figure out how to do them yet (these are listed in future enhancements). Nonetheless, I hope others find it useful
    Attached Files Attached Files
    Last edited by muguwmp67; September 27th, 2007 at 08:53 PM.
    If you're not part of the solution, you're part of the precipitate.
    I'm Steve and I'm a super-villain.

  2. #2
    Join Date
    Dec 2006
    Beans
    174

    Re: HOWTO: toggle xwinwrap with script

    Great job! I got some problems though. I can't make xwinwrap play videos as background without sound properly (I know it's not your scripts fault ). The problem is that the background image still remains, or atleast the main colour. I use gnome, know any way to set it to transparent or just completely turn it off?

  3. #3
    Join Date
    Dec 2006
    Beans
    181

    Re: HOWTO: toggle xwinwrap with script

    Here's my example xwinwrap string:

    Code:
    nice -n 15 xwinwrap -ni -o 0.11 -fs -s -sp -st -b -nf -- /usr/bin/electricsheep --root 1 --nick mugwump67 --zoom 1 --max-megabytes 5000  -window-id WID"
    the -o 0.11 parameter controls the transparency of xwinwrap. The lower it is, the more transparent xwinwrap is.

    After a lot of experimentation, due to an obsessive/compulsive nature, I found for me that a background color of G66, R66 and B67 on the color chooser worked best for me with the 0.11 transparency. I was looking for a subtle moving color image in the background, Be aware that as you make it more opaque, you will begin to fade the icons on your desktop, if any.

    Obviously your preferences will be different, but I found that it took tweaking of both the opacity then the background color to get things they way I wanted.

    Using the script will cause the background image to be replaced by whatever the desktop color setting is for the selected background image.
    Last edited by muguwmp67; April 30th, 2007 at 05:32 PM.
    If you're not part of the solution, you're part of the precipitate.
    I'm Steve and I'm a super-villain.

  4. #4
    Join Date
    Dec 2006
    Beans
    174

    Re: HOWTO: toggle xwinwrap with script

    Quote Originally Posted by muguwmp67 View Post
    Here's my example xwinwrap string:

    Code:
    nice -n 15 xwinwrap -ni -o 0.11 -fs -s -sp -st -b -nf -- /usr/bin/electricsheep --root 1 --nick mugwump67 --zoom 1 --max-megabytes 5000  -window-id WID"
    the -o 0.11 parameter controls the transparency of xwinwrap. The lower it is, the more transparent xwinwrap is.

    After a lot of experimentation, due to an obsessive/compulsive nature, I found for me that a background color of G66, R66 and B67 on the color chooser worked best for me with the 0.11 transparency. I was looking for a subtle moving color image in the background, Be aware that as you make it more opaque, you will begin to fade the icons on your desktop, if any.

    Obviously your preferences will be different, but I found that it took tweaking of both the opacity then the background color to get things they way I wanted.

    Using the script will cause the background image to be replaced by whatever the desktop color setting is for the selected background image.
    So -o 1.00 is totally overwriting the desktop background? =) I found out that if you add the -nosound string to the mplayer string you don't need to have any sound in the video background! =D

  5. #5
    Join Date
    Mar 2007
    Location
    Villenave d'Ornon, France
    Beans
    1,016

    Re: HOWTO: toggle xwinwrap with script

    Ther's no xwinwrap file in my OS, nor in the repos. Where do you find it?

  6. #6
    Join Date
    Dec 2006
    Beans
    181

    Re: HOWTO: toggle xwinwrap with script

    I'm not ready to write a new howto on xwinwrap installation yet, but I added a couple of links at the top for more information.
    If you're not part of the solution, you're part of the precipitate.
    I'm Steve and I'm a super-villain.

  7. #7
    Join Date
    Dec 2006
    Beans
    181

    Re: HOWTO: toggle xwinwrap with script

    Yup, 1.00 is full opacity. The nosound thing is good to know.
    If you're not part of the solution, you're part of the precipitate.
    I'm Steve and I'm a super-villain.

  8. #8
    Join Date
    Mar 2007
    Location
    Villenave d'Ornon, France
    Beans
    1,016

    Re: HOWTO: toggle xwinwrap with script

    So... where do we gownload this xwinwrap guys?

  9. #9
    Join Date
    Mar 2007
    Location
    Florida
    Beans
    53
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO: toggle xwinwrap with script

    Thanks, I had wondered how that guy on you tube did it.

    Thanks!
    Roses are red, Violets are blue, Windows and I are through!

  10. #10
    Join Date
    Feb 2007
    Beans
    23,875
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: HOWTO: toggle xwinwrap with script

    Quote Originally Posted by muguwmp67 View Post
    Xwinwrap is available in some 3rd-party repositories, or you can find instructions on building it here


    I've written a script that will
    • remove the current background and start xwinwrap, if xwinwrap is not running
    • restore the current background and kill xwinwrap, if xwinwrap is running


    I use this script as a launcher on my gnome panel, so I can toggle my background between a wallpaper and xwinwrap. The script is currently hard coded to run the electricsheep screensaver hack. If you use xwinwrap, You can modify the script for whatever your preferred hack is by editing the xwinwrap_string.

    Code:
    #!/bin/bash
    #
    # xwinset.sh version 1.0
    # Created: 3/23/07 by mugwump67
    #
    # This script will:
    #    turn on xwinwrap if it is off and set background option to 'none'
    #    turn off xwinwrap if it is on and set background option to stretched
    #
    # future enhancements
    #	Currently only switches between none and stretched
    #		- better to save all current background settings to config file and restore from there
    #	Add right-click integration with nautilus (i.e. click mpeg/hack to set)
    #	
    #---------------------------
    # outline:
    #---------------------------
    
    #   If xwinwrap is running, 
    # 	shut off xwinwrap
    #	set background option to stretched
    # 	If xwinwrap is off
    #		If current background is not "none"
    #			set current background to "none"
    #		start xwinwrap
    # --------------------------
    
    xwinwrap_string="nice -n 15 xwinwrap -ni -o 0.11 -fs -s -sp -st -b -nf -- /usr/bin/electricsheep --root 1 --nick mugwump67 --zoom 1 --max-megabytes 5000  -window-id WID"
    
    # if xwinwrap is running, 	
    if [ -n "$(ps  | grep xwinwrap)" ]
    	then
    	# shut off xwinwrap, set backgound option to 'stretched'
    		killall xwinwrap
    		gconftool-2 --type string -s /desktop/gnome/background/picture_options stretched
    
    else
    # xwinwrap is off
    # 		save current background option to 'none'
    # 	start xwinwrap
    	gconftool-2 --type string -s /desktop/gnome/background/picture_options none
    	$xwinwrap_string &
    fi
    This is the first significant shell script that I've ever written, and its missing a few things because I couldn't figure out how to do them yet (these are listed in future enhancements). Nonetheless, I hope others find it useful
    Thanks, works like a charm!

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

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