Skip to content

Commit

Permalink
Change to bl- alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
capn-damo committed Apr 23, 2015
1 parent eb0030d commit ed611f7
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 205 deletions.
4 changes: 3 additions & 1 deletion bl-compositor
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ if [[ $1 = '--edit' ]]; then
[[ ! -f $HOME/.config/compton.conf ]] &&
cp '/etc/xdg/compton.conf' "$HOME/.config/compton.conf"

if ! bl-text-editor "$HOME/.config/compton.conf"; then
if type bl-text-editor >/dev/null;then
bl-text-editor "$HOME/.config/compton.conf"
else
x-terminal-emulator -e nano "$HOME/.config/compton.conf"
fi
elif [[ $1 = '--toggle' || $1 = '--start' ]]; then # Toggle compositing with compton.
Expand Down
156 changes: 78 additions & 78 deletions bl-graphics-pipemenu
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#
# Modified by <damo> for BunsenLabs Linux April 2015
#
# To change the entries shown in the Graphics pipemenu:
# edit ".config/openbox/pipemenus.rc"
# To change the entries shown in the Graphics pipemenu:
# edit ".config/openbox/pipemenus.rc"
#
# ---------------------------------------------------------------------

Expand All @@ -21,111 +21,111 @@ USR_CFG='.config/openbox/pipemenus.rc'
#if test -f "/usr/bin/xdg-user-dir";then

if type xdg-user-dir &>/dev/null; then
IMGDIR=$(xdg-user-dir PICTURES)
IMGDIR=$(xdg-user-dir PICTURES)
else
IMGDIR="~/Pictures"
IMGDIR="~/Pictures"
fi
# test for screenshots dir, create if it doesn't exist
SCROTSDIR="$IMGDIR/screenshots"
if ! [[ -d $SCROTSDIR ]];then
mkdir "$SCROTSDIR"
mkdir "$SCROTSDIR"
fi

# If the package needs additional configuration before installation
# create a function called setupappName, it will be called automatically.

if ! . "$BL_COMMON_LIBDIR/bl-include.cfg" 2> /dev/null; then
echo $"Error: Failed to locate bl-include.cfg in $BL_COMMON_LIBDIR" >&2
exit 1
echo $"Error: Failed to locate bl-include.cfg in $BL_COMMON_LIBDIR" >&2
exit 1
elif ! . "$USR_CFG" 2> /dev/null; then
echo $"Error: Failed to locate pipemenus.rc in $USR_CFG" >&2
exit 1
echo $"Error: Failed to locate pipemenus.rc in $USR_CFG" >&2
exit 1
fi

appExists() {

for curApp in "${GRAPHICS_APPS[@]}"; do # if $packageName exists in tools array
[[ $curApp = "$1" ]] &&
return 0
done
say "Unable to install $1. There is no such application that I know of." 1 >&2
say "You can try one of these: ${GRAPHICS_APPS[*]}" 2 >&2
return 1
for curApp in "${GRAPHICS_APPS[@]}"; do # if $packageName exists in tools array
[[ $curApp = "$1" ]] &&
return 0
done
say "Unable to install $1. There is no such application that I know of." 1 >&2
say "You can try one of these: ${GRAPHICS_APPS[*]}" 2 >&2
return 1
}

screenshooterExists() {
for curScrot in "${GRAPHICS_SCROTS[@]}"; do # if $packageName exists in scrots array
[[ $curScrot = "$1" ]] &&
return 0
done
say "Unable to install $1. There is no such application that I know of." 1 >&2
say "You can try one of these: ${GRAPHICS_SCROTS[*]}" 2 >&2
return 1
for curScrot in "${GRAPHICS_SCROTS[@]}"; do # if $packageName exists in scrots array
[[ $curScrot = "$1" ]] &&
return 0
done
say "Unable to install $1. There is no such application that I know of." 1 >&2
say "You can try one of these: ${GRAPHICS_SCROTS[*]}" 2 >&2
return 1
}

writeScrot() { # Write scrot submenu items
IMG="$SCROTSDIR/%F-%H-%M-%S_scrot.png"
VIEW="'bl-image-viewer $IMG'"
menuSubmenu 'scrot' 'scrot Screenshooter'
menuItem "scrot Now" "scrot $IMG -e $VIEW"
menuItem "scrot In 5 secs..." "scrot -d 5 $IMG -e $VIEW"
menuItem "scrot In 10 secs" "scrot -d 10 $IMG -e $VIEW"
menuItem "scrot Select Area.." "scrot -s $IMG -e $VIEW"
menuItem "scrot Current Focus.." "scrot -u $IMG -e $VIEW"
menuItem "scrot multi-monitor" "scrot -m $IMG -e $VIEW"
menuSubmenuEnd
writeScrot() { # Write scrot submenu items
IMG="$SCROTSDIR/%F-%H-%M-%S_scrot.png"
VIEW="'bl-image-viewer $IMG'"
menuSubmenu 'scrot' 'scrot Screenshooter'
menuItem "scrot Now" "scrot $IMG -e $VIEW"
menuItem "scrot In 5 secs..." "scrot -d 5 $IMG -e $VIEW"
menuItem "scrot In 10 secs" "scrot -d 10 $IMG -e $VIEW"
menuItem "scrot Select Area.." "scrot -s $IMG -e $VIEW"
menuItem "scrot Current Focus.." "scrot -u $IMG -e $VIEW"
menuItem "scrot multi-monitor" "scrot -m $IMG -e $VIEW"
menuSubmenuEnd
}

if [[ $1 && ! $1 = --install-* ]]; then
packageName=${1#--}
read -ra words <<< "${packageName//-/ }"
x-terminal-emulator -T "Install ${words[*]^}" -e "$0" "--install-$packageName"
packageName=${1#--}
read -ra words <<< "${packageName//-/ }"
x-terminal-emulator -T "Install ${words[*]^}" -e "$0" "--install-$packageName"

elif [[ $1 = --install-* ]]; then
packageName=${1#--install-}
if [[ $1 = --install-scrot ]] || [[ $1 = --install-xfce4-screenshooter ]];then
screenshooterExists "$packageName" || exit 1
else
appExists "$packageName" || exit 1
fi
appName=${packageName//-/ }
read -ra words <<< "$appName"
appName=${words[*]^}
appNameUpper=${appName^^}
packageName=${1#--install-}
if [[ $1 = --install-scrot ]] || [[ $1 = --install-xfce4-screenshooter ]];then
screenshooterExists "$packageName" || exit 1
else
appExists "$packageName" || exit 1
fi
appName=${packageName//-/ }
read -ra words <<< "$appName"
appName=${words[*]^}
appNameUpper=${appName^^}

setupFunctionName="setup${appName//[^a-zA-Z]/}" # setupFunctionName should now be in format like 'setupBlender'
if [[ $(type -t "$setupFunctionName") = 'function' ]]; then
promptInstall --setup "$setupFunctionName" "${appNameUpper% APP} APP" "$appName" "$packageName"
else
promptInstall "${appNameUpper% APP} APP" "$appName" "$packageName"
fi
setupFunctionName="setup${appName//[^a-zA-Z]/}" # setupFunctionName should now be in format like 'setupBlender'
if [[ $(type -t "$setupFunctionName") = 'function' ]]; then
promptInstall --setup "$setupFunctionName" "${appNameUpper% APP} APP" "$appName" "$packageName"
else
promptInstall "${appNameUpper% APP} APP" "$appName" "$packageName"
fi

else # pipemenu
menuStart
for curApp in "${GRAPHICS_APPS[@]}"; do
read -ra words <<< "${curApp//-/ }"
curAppName=${words[*]^}
if type "$curApp" &> /dev/null; then
menuItem "$curAppName" "$curApp"
else
menuItem "Install $curAppName" "$0 --$curApp"
fi
done
menuSeparator 'Screenshots'
menuStart
for curApp in "${GRAPHICS_APPS[@]}"; do
read -ra words <<< "${curApp//-/ }"
curAppName=${words[*]^}
if type "$curApp" &> /dev/null; then
menuItem "$curAppName" "$curApp"
else
menuItem "Install $curAppName" "$0 --$curApp"
fi
done
menuSeparator 'Screenshots'

for curScrot in "${GRAPHICS_SCROTS[@]}"; do
read -ra words <<< "${curScrot//-/ }"
curScrotName=${words[*]^}
if type "$curScrot" &> /dev/null; then
if [[ "$curScrot" = scrot ]];then
writeScrot
else
menuItem "$curScrotName" "$curScrot"
fi
else
menuItem "Install $curScrotName" "$0 --$curScrot"
fi
done
menuEnd
for curScrot in "${GRAPHICS_SCROTS[@]}"; do
read -ra words <<< "${curScrot//-/ }"
curScrotName=${words[*]^}
if type "$curScrot" &> /dev/null; then
if [[ "$curScrot" = scrot ]];then
writeScrot
else
menuItem "$curScrotName" "$curScrot"
fi
else
menuItem "Install $curScrotName" "$0 --$curScrot"
fi
done
menuEnd
fi
exit 0
50 changes: 25 additions & 25 deletions bl-kb-pipemenu
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ RCPATH=".config/openbox/rc.xml"
KBTEXT=".config/openbox/kbinds.txt"

if ! . "$BL_COMMON_LIBDIR/bl-include.cfg" 2> /dev/null; then
echo $"Error: Failed to locate bl-include.cfg in $BL_COMMON_LIBDIR" >&2
exit 1
echo $"Error: Failed to locate bl-include.cfg in $BL_COMMON_LIBDIR" >&2
exit 1
fi

if ! [ -e "$KBTEXT" ];then # write keybinds to textfile, if it doesn't exist
# test if bl-kb.py exists in path
if type "$KBSCRIPT" &> /dev/null;then
# run script to write kbinds.txt, suppress terminal output
"$KBSCRIPT" > /dev/null
else
echo $"ERROR: bl-kb.py not found" >&2
exit 1
fi
# test if bl-kb.py exists in path
if type "$KBSCRIPT" &> /dev/null;then
# run script to write kbinds.txt, suppress terminal output
"$KBSCRIPT" > /dev/null
else
echo $"ERROR: bl-kb.py not found" >&2
exit 1
fi
fi

if [[ $1 = '--rcedit' ]];then # "Backup & Edit rc.xml" is chosen in menu
# backup rc.xml first
NOW=$(date +"%Y%m%d-%H%M")
RCBKP="$RCPATH.$NOW"
cp "$RCPATH" "$RCBKP"
bl-text-editor "$RCPATH" # open rc.xml in default editor
# backup rc.xml first
NOW=$(date +"%Y%m%d-%H%M")
RCBKP="$RCPATH.$NOW"
cp "$RCPATH" "$RCBKP"
bl-text-editor "$RCPATH" # open rc.xml in default editor

fi

Expand All @@ -45,20 +45,20 @@ menuItem "Backup and Edit rc.xml" "bl-kb-pipemenu --rcedit"
menuItem "Refesh keybinds list" "bl-kb.py" # use if rc.xml has been edited
menuSeparator
menuSeparator "Openbox window commands"
while read -r a b c;do # write out Openbox commands (not clickable)
if [[ "$a" = "o" ]];then
curItem=$(printf "%-20s %s" "$b" "$c")
menuItem "$curItem" "echo >/dev/null 2>&1"
fi
while read -r a b c;do # write out Openbox commands (not clickable)
if [[ "$a" = "o" ]];then
curItem=$(printf "%-20s %s" "$b" "$c")
menuItem "$curItem" "echo >/dev/null 2>&1"
fi
done < "$KBTEXT"

menuSeparator
menuSeparator "'Run' commands"
while read -r a b c;do # write out 'Run' commands (clickable)
if [[ "$a" = "x" ]];then
curItem=$(printf "%-20s %s" "$b" "$c")
menuItem "$curItem" "$c"
fi
while read -r a b c;do # write out 'Run' commands (clickable)
if [[ "$a" = "x" ]];then
curItem=$(printf "%-20s %s" "$b" "$c")
menuItem "$curItem" "$c"
fi
done < "$KBTEXT"

menuEnd
Expand Down
70 changes: 35 additions & 35 deletions bl-mmeditors-pipemenu
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,53 @@ source $USR_CFG
# create a function called setuptoolName, it will be called automatically.

if ! . "$BL_COMMON_LIBDIR/bl-include.cfg" 2> /dev/null; then
echo $"Error: Failed to locate bl-include.cfg in $BL_COMMON_LIBDIR" >&2
exit 1
echo $"Error: Failed to locate bl-include.cfg in $BL_COMMON_LIBDIR" >&2
exit 1
elif ! . "$USR_CFG" 2> /dev/null; then
echo $"Error: Failed to locate pipemenus.rc in $USR_CFG" >&2
exit 1
echo $"Error: Failed to locate pipemenus.rc in $USR_CFG" >&2
exit 1
fi

toolExists() {
for curTool in "${MM_EDITORS[@]}"; do # if $packageName exists in TOOLS array
[[ $curTool = "$1" ]] &&
return 0
done
say "Unable to install $1. There is no such application that I know of." 1 >&2
say "You can try one of these: ${MM_EDITORS[*]}" 2 >&2
return 1
for curTool in "${MM_EDITORS[@]}"; do # if $packageName exists in TOOLS array
[[ $curTool = "$1" ]] &&
return 0
done
say "Unable to install $1. There is no such application that I know of." 1 >&2
say "You can try one of these: ${MM_EDITORS[*]}" 2 >&2
return 1
}

if [[ $1 && ! $1 = --install-* ]]; then
packageName=${1#--}
read -ra words <<< "${packageName//-/ }"
x-terminal-emulator -T "Install ${words[*]^}" -e "$0" "--install-$packageName"
packageName=${1#--}
read -ra words <<< "${packageName//-/ }"
x-terminal-emulator -T "Install ${words[*]^}" -e "$0" "--install-$packageName"

elif [[ $1 = --install-* ]]; then
packageName=${1#--install-}
toolExists "$packageName" || exit 1
toolName=${packageName//-/ }
read -ra words <<< "$toolName"
toolName=${words[*]^}
toolNameUpper=${toolName^^}
packageName=${1#--install-}
toolExists "$packageName" || exit 1
toolName=${packageName//-/ }
read -ra words <<< "$toolName"
toolName=${words[*]^}
toolNameUpper=${toolName^^}

setupFunctionName="setup${toolName//[^a-zA-Z]/}" # setupFunctionName should now be in format like 'setupBlender'
if [[ $(type -t "$setupFunctionName") = 'function' ]]; then
promptInstall --setup "$setupFunctionName" "${toolNameUpper% TOOL} TOOL" "$toolName" "$packageName"
else
promptInstall "${toolNameUpper% TOOL} TOOL" "$toolName" "$packageName"
fi
setupFunctionName="setup${toolName//[^a-zA-Z]/}" # setupFunctionName should now be in format like 'setupBlender'
if [[ $(type -t "$setupFunctionName") = 'function' ]]; then
promptInstall --setup "$setupFunctionName" "${toolNameUpper% TOOL} TOOL" "$toolName" "$packageName"
else
promptInstall "${toolNameUpper% TOOL} TOOL" "$toolName" "$packageName"
fi

else # output for bl-multimedia-pipemenu
for curTool in "${MM_EDITORS[@]}"; do
read -ra words <<< "${curTool//-/ }"
curToolName=${words[*]^}
if type "$curTool" &> /dev/null; then
menuItem "$curToolName" "$curTool"
else
menuItem "Install $curToolName" "$0 --$curTool"
fi
done
for curTool in "${MM_EDITORS[@]}"; do
read -ra words <<< "${curTool//-/ }"
curToolName=${words[*]^}
if type "$curTool" &> /dev/null; then
menuItem "$curToolName" "$curTool"
else
menuItem "Install $curToolName" "$0 --$curTool"
fi
done

fi
exit 0
Loading

0 comments on commit ed611f7

Please sign in to comment.