SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2015-03-18 10:59:48

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Graphics pipemenu

This is the cb-graphics-pipemenu I use in my Crunchbang respin.

#!/bin/bash
# ---------------------------------------------------------------------
# Written by Erik Westre aka (ew) <xxxxxxx@gmail.com> feb.2014
# License: Do whatever you want with it! Just add "modified by yourname and email"!
# ---------------------------------------------------------------------
#
# Modified by damo March 2014  xxxxxxx@gmail.com

pathto=$(readlink -f "$0" | sed 's%/*[^/]\+/*$%%')

if [[ -f $pathto/cb-include.cfg ]]
then
    source "$pathto/cb-include.cfg"
else
    echo "  Failed to locate cb-include.cfg"
    exit 1
fi


I=0

########### INSTALL GIMP ###############################################

if [ "$1" = "--gimp" ]; then
    terminator --title="Install GIMP" --command="cb-graphics-pipemenu --install-gimp"
    exit 0
fi


if [ "$1" = "--install-gimp" ]; then
    clear
    echo ""
    echo "  INSTALL GIMP"
    echo "  ------------------------"
    echo "  This script will install GIMP."
    echo ""
    echo -n "  Run the installer now? (Y|n) > "
    read a
    if [ "$a" = "y" ] || [ "$a" = "Y" ] || \
    [ "$a" = "" ]; then

        connectiontest
        clear
        echo "  Updating sources..."
		sleep 2s
		sudo apt-get update
		clear
 
        if ! sudo apt-get install gimp gimp-gmic; then
            clear
            echo ""
            echo "  There was a problem installing GIMP."
            echo ""
            echo "  Hit any key to try again, or \"q\" to quit..."
            read -n1 a
            if [ "$a" = "q" ] || [ "$a" = "Q" ]; then
                clear
                exit 0
            else
                cb-graphics-pipemenu --install-gimp
                exit 0
            fi
        else
            clear
            echo ""
            echo "  GIMP has been installed successfully."
            echo ""
            echo "  Hit any key to exit..."
            read -n1 a
            exit 0
        fi
    else
        exit 0
    fi
fi


################ INSTALL BLENDER #######################################

if [ "$1" = "--blender" ]; then
    terminator --title="Install Blender 3D" --command="cb-graphics-pipemenu --install-blender"
    exit 0
fi


if [ "$1" = "--install-blender" ]; then
    clear
    echo ""
    echo "  INSTALL BLENDER"
    echo "  ------------------------"
    echo "  This script will install Blender."
    echo ""
    echo -n "  Run the installer now? (Y|n) > "
    read a
    if [ "$a" = "y" ] || [ "$a" = "Y" ] || \
    [ "$a" = "" ]; then

        connectiontest
        clear
        echo "  Updating sources..."
		sleep 2s
		sudo apt-get update
		clear

        if ! sudo apt-get install blender; then
            clear
            echo ""
            echo "  There was a problem installing Blender."
            echo ""
            echo "  Hit any key to try again, or \"q\" to quit..."
            read -n1 a
            if [ "$a" = "q" ] || [ "$a" = "Q" ]; then
                clear
                exit 0
            else
                cb-graphics-pipemenu --install-blender
                exit 0
            fi
        else
            clear
            echo ""
            echo "  Blender has been installed successfully."
            echo ""
            echo "  Hit any key to exit..."
            read -n1 a
            exit 0
        fi
    else
        exit 0
    fi
fi


############### INSTALL INKSCAPE #######################################

if [ "$1" = "--inkscape" ]; then
    terminator --title="Install Inkscape SVG" --command="cb-graphics-pipemenu --install-inkscape"
    exit 0
fi


if [ "$1" = "--install-inkscape" ]; then
    clear
    echo ""
    echo "  INSTALL INKSCAPE"
    echo "  ----------------"
    echo "  This script will install Inkscape."
    echo ""
    echo -n "  Run the installer now? (Y|n) > "
    read a
    if [ "$a" = "y" ] || [ "$a" = "Y" ] || \
    [ "$a" = "" ]; then
        
        connectiontest
        clear
        echo "  Updating sources..."
		sleep 2s
		sudo apt-get update
		clear
        
        
        if ! sudo apt-get install inkscape; then
            clear
            echo ""
            echo "  There was a problem installing Inkscape."
            echo ""
            echo "  Hit any key to try again, or \"q\" to quit..."
            read -n1 a
            if [ "$a" = "q" ] || [ "$a" = "Q" ]; then
                clear
                exit 0
            else
                cb-graphics-pipemenu --install-inkscape
                exit 0
            fi
        else
            clear
            echo ""
            echo "  Inkscape has been installed successfully."
            echo ""
            echo "  Hit any key to exit..."
            read -n1 a
            exit 0
        fi
    else
        exit 0
    fi
fi


############### INSTALL MANDELBULBER #######################################

if [ "$1" = "--mandelbulber" ]; then
    terminator --title="Install Mandelbulber Fractal Generator" --command="cb-graphics-pipemenu --install-mandelbulber"
    exit 0
fi


if [ "$1" = "--install-mandelbulber" ]; then
    clear
    echo ""
    echo "  INSTALL MANDELBULBER"
    echo "  --------------------"
    echo "  This script will install Mandelbulber."
    echo ""
    echo -n "  Run the installer now? (Y|n) > "
    read a
    if [ "$a" = "y" ] || [ "$a" = "Y" ] || \
    [ "$a" = "" ]; then

        connectiontest
        clear
        echo "  Updating sources..."
		sleep 2s
		sudo apt-get update
		clear

        if ! sudo apt-get install mandelbulber; then
            clear
            echo ""
            echo "  There was a problem installing Mandelbulber."
            echo ""
            echo "  Hit any key to try again, or \"q\" to quit..."
            read -n1 a
            if [ "$a" = "q" ] || [ "$a" = "Q" ]; then
                clear
                exit 0
            else
                cb-graphics-pipemenu --install-mandelbulber
                exit 0
            fi
        else
            clear
            echo ""
            echo "  Mandelbulber has been installed successfully."
            echo ""
            echo "  Hit any key to exit..."
            read -n1 a
            exit 0
        fi
    else
        exit 0
    fi
fi

############### INSTALL MIRAGE #######################################

if [ "$1" = "--mirage" ]; then
    terminator --title="Install Mirage Image viewer" --command="cb-graphics-pipemenu --install-mirage"
    exit 0
fi


if [ "$1" = "--install-mirage" ]; then
    clear
    echo ""
    echo "  INSTALL MIRAGE"
    echo "  --------------------"
    echo "  This script will install Mirage."
    echo ""
    echo -n "  Run the installer now? (Y|n) > "
    read a
    if [ "$a" = "y" ] || [ "$a" = "Y" ] || \
    [ "$a" = "" ]; then

        connectiontest
        clear
        echo "  Updating sources..."
		sleep 2s
		sudo apt-get update
		clear

        if ! sudo apt-get install mirage; then
            clear
            echo ""
            echo "  There was a problem installing Mirage."
            echo ""
            echo "  Hit any key to try again, or \"q\" to quit..."
            read -n1 a
            if [ "$a" = "q" ] || [ "$a" = "Q" ]; then
                clear
                exit 0
            else
                cb-graphics-pipemenu --install-mirage
                exit 0
            fi
        else
            clear
            echo ""
            echo "  Mirage has been installed successfully."
            echo ""
            echo "  Hit any key to exit..."
            read -n1 a
            exit 0
        fi
    else
        exit 0
    fi
fi
########### WRITE PIPE MENU ############################################
# Start pipemenu
echo "    <openbox_pipe_menu>"

# GIMP
if [ -x "/usr/bin/gimp" ];then
    I=$((I+1))
    cat << _menu_
	    <item label="GIMP">
            <action name="Execute">
				<command>
					gimp
				</command>
			</action>
		</item>
_menu_
else
	cat << _menu_
	    <item label="Install GIMP">
            <action name="Execute">
				<command>
					cb-graphics-pipemenu --gimp
				</command>
			</action>
		</item>
_menu_
fi
# BLENDER
if [ -x "/usr/bin/blender" ];then
    I=$((I+1))
    cat << _menu_
	    <item label="Blender">
            <action name="Execute">
				<command>
					blender
				</command>
			</action>
		</item>
_menu_
else
	cat << _menu_
	    <item label="Install Blender">
            <action name="Execute">
				<command>
					cb-graphics-pipemenu --blender
				</command>
			</action>
		</item>
_menu_
fi
# INKSCAPE
if [ -x "/usr/bin/inkscape" ];then
    I=$((I+1))
    cat << _menu_
	    <item label="Inkscape">
            <action name="Execute">
				<command>
					inkscape
				</command>
			</action>
		</item>
_menu_
else
	cat << _menu_
	    <item label="Install Inkscape">
            <action name="Execute">
				<command>
					cb-graphics-pipemenu --inkscape
				</command>
			</action>
		</item>
_menu_
fi
# MANDELBULBER
if [ -x "/usr/bin/mandelbulber" ];then
    I=$((I+1))
    cat << _menu_
	    <item label="Mandelbulber">
            <action name="Execute">
				<command>
					mandelbulber
				</command>
			</action>
		</item>
_menu_
else
	cat << _menu_
	    <item label="Install Mandelbulber">
            <action name="Execute">
				<command>
					cb-graphics-pipemenu --mandelbulber
				</command>
			</action>
		</item>
_menu_
fi
# MIRAGE
if [ -x "/usr/bin/mirage" ];then
    I=$((I+1))
    cat << _menu_
	    <item label="Mirage">
            <action name="Execute">
				<command>
					mirage
				</command>
			</action>
		</item>
_menu_
else
	cat << _menu_
	    <item label="Install Mirage">
            <action name="Execute">
				<command>
					cb-graphics-pipemenu --mirage
				</command>
			</action>
		</item>
_menu_
fi
	cat << _menu_
	    <menu id="graphicsScreenshots" label="Take Screenshot">
				<item label="Screenshooter">
					<action name="Execute">
						<command>
							xfce4-screenshooter
						</command>
					</action>
				</item>
				<separator label="scrot"/>
				<item label="Now">
					<action name="Execute">
						<command>
							scrot ~/images/screenshots/'%F-%H-%M_scrot.png' -e 'mirage ~/images/screenshots/'
						</command>
					</action>
				</item>
				<item label="In 5 Seconds...">
					<action name="Execute">
						<command>
							scrot -d 5 ~/images/screenshots/'%F-%H-%M_scrot.png' -e 'mirage ~/images/screenshots/'
						</command>
					</action>
				</item>
				<item label="In 10 Seconds...">
					<action name="Execute">
						<command>
							scrot -d 10 ~/images/screenshots/'%F-%H-%M_scrot.png' -e 'mirage ~/images/screenshots/'
						</command>
					</action>
				</item>
				<item label="Selected Area... (click &amp; drag mouse)">
					<action name="Execute">
						<command>
							scrot -s ~/images/screenshots/'%F-%H-%M_scrot.png' -e 'mirage ~/images/screenshots/'
						</command>
					</action>
				</item>
			</menu>
_menu_


# End pipemenu
echo "    </openbox_pipe_menu>"
exit 0

Last edited by damo (2015-03-18 11:17:41)


BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator smile

Offline

Help fund CrunchBang, donate to the project!

#2 2015-03-19 00:53:34

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Graphics pipemenu

@damo, I should have mentioned this yesterday, but forgot till I'd gone to bed...

Take a look at the bunsen bl-x-www-browser-pipemenu. The code is pretty generic and should easily be adaptable to any other list of apps. Just remove the browser-specific functions like addAptKey, setupGoogleChromeStable etc, edit BROWSER round lines 83~85... There are some functions like promptInstall and the menu generators that are defined in bl-include.cfg that would help drastically reduce the length of your script.

Also, the location of bl-include.cfg has changed on bunsen - it's now at /usr/lib/bunsen/bunsen-common/ and provided by the bunsen-common package.

Of course all the above is about if a version of this script were to be used on BunsenLabs. Your script as-is would be needed for a CrunchBang clone. Goes to show how the two are gradually drifting apart I guess...


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
#! forum moderator    BunsenLabs

Offline

#3 2015-03-19 10:59:27

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Graphics pipemenu

@johnraff

The pipemenu is the one I use on my crunchbang installation - I put it up for comments/suggestions really.

I am in the process of converting it for BunsenLabs.    cool

EDIT: Now on github: bl-graphics-pipemenu

Last edited by damo (2015-03-19 17:46:09)


BunsenLabs Group on deviantArt
damo's gallery on deviantArt
Openbox themes
Forum Moderator smile

Offline

#4 2015-03-20 00:34:48

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Graphics pipemenu

Thank you!  cool


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
#! forum moderator    BunsenLabs

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo