SEARCH

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

You are not logged in.

#1 2009-12-18 15:02:59

Kookaburra
#! CrunchBanger
From: Orléans - France
Registered: 2009-09-03
Posts: 234

"OBkey" running on #! 9.04

I test it on #! 9.04, simple way to edit the 'rc.xml' tongue

http://code.google.com/p/obkey/

Usage :

Simply unpack it (or clone git repo) and run as the python script, by default it uses ~/.config/openbox/rc.xml as a config file containing keyboard setup.

./obkey

1261148519.png

wink

Last edited by Kookaburra (2009-12-18 15:06:01)

Offline

Be excellent to each other!

#2 2009-12-18 15:18:50

danielrmt
#! CrunchBanger
Registered: 2009-11-13
Posts: 102

Re: "OBkey" running on #! 9.04

This is something I always missed in Openbox, a GUI to edit keybindings. Thanks for sharing.

It works fine, but its interface need some love, it is kinda cluttered. It could look more like obmenu.

Last edited by danielrmt (2009-12-18 15:20:06)

Offline

#3 2009-12-18 15:59:15

benj1
Wiki Wizard
From: Yorkshire, England
Registered: 2009-09-05
Posts: 1,084

Re: "OBkey" running on #! 9.04

ive already played around with this, seems to work ok as far as i can see.

i sent corenominal a PM about the possibility of including it in #! 9.10, don't know if it will make it tho.

fyi
Slitaz has an openbox utility for modifying autostart.sh, i tried to get ahold of the source but could only find it running the livecd, should be portable (it was a bash script) if i can manage to get ahold of it.


- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Offline

#4 2009-12-18 17:35:44

anonymous
The Mystery Member
From: Arch Linux Forums
Registered: 2008-11-29
Posts: 8,930

Re: "OBkey" running on #! 9.04

@benj1 - here is the script:

#! /bin/sh
#
# Multi-call script providing GTK boxes to manage a desktop following
# Freedesktop standards.
#
# (C) GNU gpl v3 - SliTaz GNU/Linux 2008.
#
VERSION=20080719

# Glade XML file path.
GLADE_XML=/usr/share/slitaz-tools/glade
# Export script path and other if needed so we can use them in 'quote'.
export BIN=$0
export AUTOSTART_SCRIPT=$HOME/.config/openbox/autostart.sh

# Standard directories.
mkdir -p $HOME/Desktop $HOME/.local/share/applications

# Get the active locale (default to English).
case $LANG in
    es*)
        lang="es"
        NEW_FOLDER_LABEL="Create a new folder on the desktop:"
        FOLDER_ENTRY_MSG="dirname"
        NEW_FILE_LABEL="Create a new file on the desktop:"
        FILE_ENTRY_MSG="filename"
        ADD_ICON_LABEL="Add some desktop icons"
        CHARS_SIZE="64"
        DESKTOP_DIALOG_TAZUSB="Save filesystem using compression"
        DESKTOP_DIALOG_LABEL="Session logout, system shutdown or reboot"
        DESKTOP_LOGOUT_BUTTON="Logout X session"
        DESKTOP_SHUTDOWN_BUTTON="Shutdown computer"
        DESKTOP_REBOOT_BUTTON="Reboot system" ;;
    fr*)
        lang="fr"
        NEW_FOLDER_LABEL="Créer un nouveau dossier sur le bureau:"
        FOLDER_ENTRY_MSG="dossier"
        NEW_FILE_LABEL="Créer un nouveau fichier sur le bureau:"
        FILE_ENTRY_MSG="fichier"
        ADD_ICON_LABEL="Ajouter des icônes de bureau"
        CHARS_SIZE="72"
        DESKTOP_DIALOG_TAZUSB="Enregistrer le système avec la compression"
        DESKTOP_DIALOG_LABEL="Déconnexion, arrêt ou redémarrage du système"
        DESKTOP_LOGOUT_BUTTON="Fermer la session X"
        DESKTOP_SHUTDOWN_BUTTON="Eteindre le système"
        DESKTOP_REBOOT_BUTTON="Redémarrer le système" ;;
    *)
        lang=""
        NEW_FOLDER_LABEL="Create a new folder on the desktop:"
        FOLDER_ENTRY_MSG="dirname"
        NEW_FILE_LABEL="Create a new file on the desktop:"
        FILE_ENTRY_MSG="filename"
        ADD_ICON_LABEL="Add some desktop icons"
        CHARS_SIZE="64"
        DESKTOP_DIALOG_TAZUSB="Save filesystem using compression"
        DESKTOP_DIALOG_LABEL="Session logout, system shutdown or reboot"
        DESKTOP_LOGOUT_BUTTON="Logout X session"
        DESKTOP_SHUTDOWN_BUTTON="Shutdown computer"
        DESKTOP_REBOOT_BUTTON="Reboot system" ;;
esac

# Command line usage.
usage()
{
    echo -e "\nSliTaz Freedesktop Box - Version: $VERSION\n
\033[1mUsage: \033[0m `basename $0` command
\033[1mCommands: \033[0m\n
  new-folder   Create a new folder on the desktop with mkdir.
  new-file     Create a new empty file or SHell script on the desktop.
  add-icons    Add a system icon to the desktop.
  calendar     Display a calendar under mouse pointer.
  notify       Display a notification message (center/no decoration).
               Ex: `basename $0` notify \"Message to display\" 4
  autostart    Manage autostarted applications with Openbox.
  logout       Prompt for X session exit or system halt/reboot.\n"
}

# Openbox autostart functions, first column is used for icon
autostart_list()
{
    # Enabled
    for app in `cat $AUTOSTART_SCRIPT | grep ^[a-z] | awk '{ print $1 }'`
    do
        comment=`grep -B 1 "^$app" $AUTOSTART_SCRIPT | grep '^# ' | sed s/'#'//`
        [ -x /usr/bin/$app ] && echo "go-next | $app | $comment"
    done
    # Disabled
    for app in `cat $AUTOSTART_SCRIPT | grep ^#[a-z] | awk '{ print $1 }'`
    do
        comment=`grep -B 1 "^$app" $AUTOSTART_SCRIPT | grep '^# ' | sed s/'#'//`
        app=${app#\#}
        [ -x /usr/bin/$app ] && echo "stop | $app | $comment"
    done
}

# Enable or disbale autostarted applications.
autostart_actions()
{
    if grep -q "^$APPLICATION" $AUTOSTART_SCRIPT; then
        sed -i s/"^$APPLICATION"/"\#$APPLICATION"/ $AUTOSTART_SCRIPT
    else
        sed -i s/"^\#$APPLICATION"/"$APPLICATION"/ $AUTOSTART_SCRIPT
    fi
}

add_autostarted_app()
{
    if ! grep -q "^$NEW_APP" $AUTOSTART_SCRIPT; then
        NEW_APP=`echo $NEW_APP | sed s/'&'/''/`
        echo "" >> $AUTOSTART_SCRIPT
        echo "# $NEW_COMMENT" >> $AUTOSTART_SCRIPT
        echo "$NEW_APP &" >> $AUTOSTART_SCRIPT
    fi
}

add_autostarted_app_box()
{
    export ADD_AUTO_START_BOX='
<window title="Add auto started applications" icon-name="preferences-system-session">
<vbox>
    <text width-chars="54">
        <label>"
Add a new application starting with your session
        "</label>
    </text>
    <hbox>
        <text>
            <label>"Application:"</label>
        </text>
        <entry>
            <variable>NEW_APP</variable>
        </entry>
    </hbox>
    <hbox>
        <text>
            <label>"Comment:  "</label>
        </text>
        <entry>
            <variable>NEW_COMMENT</variable>
        </entry>
    </hbox>
    <hbox>
        <button ok>
            <action>$BIN add_autostarted_app</action>
            <action type="exit">exit</action>
        </button>
        <button cancel></button>
    </hbox>
</vbox>
</window>'
    gtkdialog --center --program=ADD_AUTO_START_BOX
}

# Box commands.

case $1 in
    new-folder)
        # Create a directory on the ~/Desktop.
        #
        DESKTOP_DIALOG="
<window title=\"Desktopbox - mkdir\" icon-name=\"folder-new\">
<vbox>

    <text use-markup=\"true\" width-chars=\"40\">
        <label>\"
<b>$NEW_FOLDER_LABEL</b>\"
        </label>
    </text>

    <hbox>
        <entry>
            <default>$FOLDER_ENTRY_MSG</default>
            <variable>DIR</variable>
        </entry>
    </hbox>"
        ACTIONS='
    <hbox>
        <button>
            <label>Mkdir</label>
            <input file icon="folder-new"></input>
            <action>mkdir -p "$HOME/Desktop/$DIR"</action>
            <action type="exit">Exit</action>
        </button>
        <button cancel>
            <action type="exit">Exit</action>
        </button>
    </hbox>

</vbox>
</window>'
        export DESKTOP_DIALOG="${DESKTOP_DIALOG}${ACTIONS}" ;;
    new-file)
        # Create a file on the ~/Desktop.
        #
        DESKTOP_DIALOG="
<window title=\"Desktopbox - touch/cat\" icon-name=\"document-new\">
<vbox>
    <text use-markup=\"true\" width-chars=\"40\">
        <label>\"
<b>$NEW_FILE_LABEL</b>\"
        </label>
    </text>

    <hbox>
        <entry>
            <default>$FILE_ENTRY_MSG</default>
            <variable>FILE</variable>
        </entry>
    </hbox>"
        ACTIONS='
    <hbox>
        <button>
            <label>SH script</label>
            <input file icon="document-new"></input>
            <action>echo "#!/bin/sh" > "$HOME/Desktop/$FILE"</action>
            <action>echo "#" >> "$HOME/Desktop/$FILE"</action>
            <action>chmod +x "$HOME/Desktop/$FILE"</action>
            <action type="exit">Exit</action>
        </button>
        <button>
            <label>Empty</label>
            <input file icon="document-new"></input>
            <action>touch "$HOME/Desktop/$FILE"</action>
            <action type="exit">Exit</action>
        </button>
        <button cancel>
            <action type="exit">Exit</action>
        </button>
    </hbox>
</vbox>
</window>'
        export DESKTOP_DIALOG="${DESKTOP_DIALOG}${ACTIONS}" ;;
    add-icons)
        # Add new icons on the ~/Desktop from /usr/share/applications.
        #
        DESKTOP_DIALOG="
<window title=\"$ADD_ICON_LABEL\" icon-name=\"document-new\">
<vbox>
    <text use-markup=\"true\" width-chars=\"40\">
        <label>\"
<b>$ADD_ICON_LABEL</b>
\"
        </label>
    </text>
    <tree headers_visible=\"false\">
        <width>420</width><height>200</height>
        <variable>ICON</variable>
        <label>Filename|Application</label>"
        # Get application name and icon.
        cd /usr/share/applications
        for file in *.desktop
        do
            # Try to get the name in the right locale.
            NAME=`grep ^Name $file | grep $lang || grep ^Name= $file`
            NAME=`echo $NAME | cut -d "=" -f 2`
            ICON=`grep ^Icon= $file | cut -d "=" -f 2`
            ICON=`basename $ICON`
            ICON=${ICON%.*}
            FILE=${file%.desktop}
            ITEM="<item icon=\"$ICON\">$FILE | $NAME</item>"
            DESKTOP_DIALOG="${DESKTOP_DIALOG}${ITEM}"
        done
        ACTIONS='<action>cp /usr/share/applications/$ICON.desktop ~/Desktop</action>
    </tree>
    <hbox>
        <button>
            <label>Add</label>
            <input file icon="gtk-add"></input>
            <action>cp /usr/share/applications/$ICON.desktop ~/Desktop</action>
        </button>
        <button>
            <label>Exit</label>
            <input file icon="exit"></input>
            <action type="exit">Exit</action>
        </button>
    </hbox>
</vbox>
</window>'
        export DESKTOP_DIALOG=${DESKTOP_DIALOG}${ACTIONS} ;;
    calendar)
        # Calendar using glade file.
        #
        gtkdialog --glade-xml=$GLADE_XML/calendar.glade \
            --program=MAIN_WINDOW ;;
    logout)
        # X session/system logout.
        #
        DESKTOP_DIALOG="
<window title=\"SliTaz Desktop logout\" icon-name=\"user-desktop\" skip_taskbar_hint=\"true\">
<vbox>
    <pixmap>
        <input file>/usr/share/icons/Tango/32x32/places/user-desktop.png</input>
    </pixmap>
    <hbox>
        <text use-markup=\"true\" width-chars=\"$CHARS_SIZE\">
            <label>
\"<b>$DESKTOP_DIALOG_LABEL</b>
\"
            </label>
        </text>
    </hbox>"
        TAZUSB_DIALOG="
    <hbox>
        <checkbox>
            <label>$DESKTOP_DIALOG_TAZUSB</label>
            <variable>TAZUSB_WRITE</variable>
            <default>false</default>
        </checkbox>
        <radiobutton>
            <label>lzma</label>
            <variable>LZMA</variable>
        </radiobutton>
        <radiobutton active=\"true\">
            <label>gzip</label>
            <variable>GZIP</variable>
        </radiobutton>
        <radiobutton>
            <label>none</label>
            <variable>NONE</variable>
        </radiobutton>
    </hbox>"
        EXTRA="COMP=none; [ \$LZMA = true ] && COMP=lzma; [ \$GZIP = true ] && COMP=gzip; [ \$TAZUSB_WRITE = true ] && { subox \"xterm -e '/usr/bin/tazusb writefs \$COMP'\"; sleep 1; while ps x | grep -v grep | grep -q tazusb; do sleep 1; done; };"
        [ -f /home/boot/rootfs.gz ] || { TAZUSB_DIALOG=""; EXTRA=""; }
        # Logout for Openbox or JWM and system shutdown or reboot.
        ACTIONS="
    <hbox>
        <button>
            <label>$DESKTOP_LOGOUT_BUTTON</label>
            <input file icon=\"video-display\"></input>
            <action>$EXTRA openbox --exit || jwm -exit</action>
            <action type=\"exit\">Exit</action>
        </button>
        <button>
            <label>$DESKTOP_SHUTDOWN_BUTTON</label>
            <input file icon=\"system-shutdown\"></input>
            <action>$EXTRA poweroff</action>
            <action type=\"exit\">Exit</action>
        </button>
        <button>
            <label>$DESKTOP_REBOOT_BUTTON</label>
            <input file icon=\"reload\"></input>
            <action>$EXTRA reboot</action>
            <action type=\"exit\">Exit</action>
        </button>
        <button cancel>
            <action type=\"exit\">Exit</action>
        </button>
    </hbox>
</vbox>
</window>"
        export DESKTOP_DIALOG=${DESKTOP_DIALOG}${TAZUSB_DIALOG}${ACTIONS} ;;
    notify)
        # Nofification message without window decoration.
        MSG="$2"
        SEC=$3
        [ -z $SEC ] && SEC=4
        export NOTIFY_BOX="
<window decorated=\"false\" skip_taskbar_hint=\"true\">
<vbox>
    <text width-chars=\"64\" use-markup=\"true\">
        <label>\"
<b>$MSG</b>
        \"</label>
    </text>
</vbox>
</window>"
        gtkdialog --center --program=NOTIFY_BOX >/dev/null &
        sleep $SEC
        pid=`ps | grep NOTIFY_BOX | awk '{ print $1 }'`
        kill $pid 2>/dev/null
        exit 0 ;;
    autostart)
        # Autostarted apps management. Functions are used for input 
        # and actions
        export DESKTOP_DIALOG='
<window title="Auto start applications with Openbox" icon-name="preferences-system-session">
<vbox>
    <tree>
        <width>540</width><height>200</height>
        <variable>APPLICATION</variable>
        <label>Application|Comment</label>
        <input icon_column="0">$BIN autostart_list</input>
        <action>$BIN autostart_actions</action>
        <action>refresh:APPLICATION</action>
    </tree>
    <hbox>
        <text width-chars="36">
                <label>
"Double click to enable/disable an application"
                </label>
            </text>
        <button>
            <label>Add</label>
            <input file icon="gtk-add"></input>
            <action>$BIN add_autostarted_app_box</action>
            <action>refresh:APPLICATION</action>
        </button>
        <button>
            <label>Configuration</label>
            <input file icon="accessories-text-editor"></input>
            <action>leafpad $AUTOSTART_SCRIPT</action>
            <action>refresh:APPLICATION</action>
        </button>
        <button>
            <label>Exit</label>
            <input file icon="exit"></input>    
            <action type="exit">exit</action>
        </button>
    </hbox>
</vbox>
</window>'
        ;;
    *_*)
        # Exec all function called by args (must have an underscore).
        $1
        exit 0 ;;
    *)
        # Usage if executed from cmdline.
        #
        usage
        exit 0 ;;
esac

gtkdialog --center --program=DESKTOP_DIALOG >/dev/null

exit 0

Supposedly its two programs in one. One is for changing GTK themes and the other for autostart. To start the autostart one, you run "scriptname autostart".


Note: ** Please read before posting **

BTW if you wish to contact me, send me an e-mail instead of a PM.

Offline

#5 2009-12-21 18:22:19

benj1
Wiki Wizard
From: Yorkshire, England
Registered: 2009-09-05
Posts: 1,084

Re: "OBkey" running on #! 9.04

thanks anonymous
i actually managed to find it, its quite a few programs, heres a chopped down version that should work:

#! /bin/sh
#
# Multi-call script providing GTK boxes to manage a desktop following
# Freedesktop standards.
#
# (C) GNU gpl v3 - SliTaz GNU/Linux 2008.
#
# VERSION=20090504
#
# chopped down a lot for CrunchBang Linux by Ben Holroyd 2009
#
export AUTOSTART_EDITOR=leafpad

# Export script path and other if needed so we can use them in 'quote'.
export BIN=$0
export AUTOSTART_SCRIPT=$HOME/.config/openbox/autostart.sh

# Openbox autostart functions, first column is used for icon
autostart_list()
{
    # Enabled
    for app in `cat $AUTOSTART_SCRIPT | grep ^[a-z] | awk '{ print $1 }'`
    do
        comment=`grep -B 1 "^$app" $AUTOSTART_SCRIPT | grep '^# ' | sed s/'#'//`
        [ -x /usr/bin/$app ] && echo "go-next | $app | $comment"
    done
    # Disabled
    for app in `cat $AUTOSTART_SCRIPT | grep ^#[a-z] | awk '{ print $1 }'`
    do
        comment=`grep -B 1 "^$app" $AUTOSTART_SCRIPT | grep '^# ' | sed s/'#'//`
        app=${app#\#}
        [ -x /usr/bin/$app ] && echo "stop | $app | $comment"
    done
}

# Enable or disbale autostarted applications.
autostart_actions()
{
    if grep -q "^$APPLICATION" $AUTOSTART_SCRIPT; then
        sed -i s/"^$APPLICATION"/"\#$APPLICATION"/ $AUTOSTART_SCRIPT
    else
        sed -i s/"^\#$APPLICATION"/"$APPLICATION"/ $AUTOSTART_SCRIPT
    fi
}

add_autostarted_app()
{
    if ! grep -q "^$NEW_APP" $AUTOSTART_SCRIPT; then
        NEW_APP=`echo $NEW_APP | sed s/'&'/''/`
        echo "" >> $AUTOSTART_SCRIPT
        echo "# $NEW_COMMENT" >> $AUTOSTART_SCRIPT
        echo "$NEW_APP &" >> $AUTOSTART_SCRIPT
    fi
}

add_autostarted_app_box()
{
    export ADD_AUTO_START_BOX='
<window title="Add auto started applications" icon-name="preferences-system-session">
<vbox>
    <text width-chars="54">
        <label>"
Add a new application starting with your session
        "</label>
    </text>
    <hbox>
        <text>
            <label>"Application:"</label>
        </text>
        <entry>
            <variable>NEW_APP</variable>
        </entry>
    </hbox>
    <hbox>
        <text>
            <label>"Comment:  "</label>
        </text>
        <entry>
            <variable>NEW_COMMENT</variable>
        </entry>
    </hbox>
    <hbox>
        <button ok>
            <action>$BIN add_autostarted_app</action>
            <action type="exit">exit</action>
        </button>
        <button cancel></button>
    </hbox>
</vbox>
</window>'
    gtkdialog --center --program=ADD_AUTO_START_BOX
}

# Box commands.

case $1 in
    *_*)
        # Exec all function called by args (must have an underscore).
        $1
        exit 0 ;;
    *)
    # Autostarted apps management. Functions are used for input 
    # and actions
        export DESKTOP_DIALOG='
<window title="Auto start applications with Openbox" icon-name="preferences-system-session">
<vbox>
    <tree>
        <width>540</width><height>200</height>
        <variable>APPLICATION</variable>
        <label>Application|Comment</label>
        <input icon_column="0">$BIN autostart_list</input>
        <action>$BIN autostart_actions</action>
        <action>refresh:APPLICATION</action>
    </tree>
    <hbox>
        <text width-chars="36">
                <label>
"Double click to enable/disable an application"
                </label>
            </text>
        <button>
            <label>Add</label>
            <input file icon="gtk-add"></input>
            <action>$BIN add_autostarted_app_box</action>
            <action>refresh:APPLICATION</action>
        </button>
        <button>
            <label>Configuration</label>
            <input file icon="accessories-text-editor"></input>
            <action>AUTOSTART_EDITOR $AUTOSTART_SCRIPT</action>
            <action>refresh:APPLICATION</action>
        </button>
        <button>
            <label>Exit</label>
            <input file icon="exit"></input>    
            <action type="exit">exit</action>
        </button>
    </hbox>
</vbox>
</window>'
    ;;
esac

gtkdialog --center --program=DESKTOP_DIALOG >/dev/null
exit 0

if anyones interested, you need to install 'gtkdialog' first

also if it doesn't read you config file correctly (~/.config/openbox/autostart.sh) it treats commented out commands as '#command' (no space) and comments for a command are interpreted as '# comment' (with a space) preceding a command.


- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

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.

Debian Logo