import
commit
919ed5554e
|
@ -0,0 +1,8 @@
|
|||
# manjaro-pipemenus
|
||||
An Openbox pipemenus for use with Manjaro Linux (port of CrunchBang pipemenus)
|
||||
|
||||
Work in progress
|
||||
|
||||
TO DO
|
||||
|
||||
x-www-browser-pipemenus
|
|
@ -0,0 +1,70 @@
|
|||
#!/bin/bash
|
||||
# mabox-compton
|
||||
# Openbox Pipe Menu for use with compton compositor
|
||||
# Written for CrunchBang Linux <http://crunchbang.org/>
|
||||
# by Philip Newborough <corenominal@corenominal.org>
|
||||
# Ported to #!++ <https://crunchbangplusplus.org>
|
||||
# by Ben Young <computermouth@crunchbangplusplus.org>
|
||||
# Ported to Manjaro <https://manjaro.github.io/>
|
||||
# by Daniel Napora <napcok@gmail.com>
|
||||
|
||||
RESTART_ATTEMPTS=20
|
||||
|
||||
if ! . mabox-include.cfg 2> /dev/null; then
|
||||
echo ' Failed to locate mabox-include.cfg in PATH' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ------------- Set xcompmgr command options -----------------------------------
|
||||
EXECXCOMP='compton'
|
||||
if glxinfo | egrep -iq 'direct rendering: yes'; then
|
||||
EXECXCOMP+=' --vsync opengl'
|
||||
fi
|
||||
|
||||
# Edit xcompmgr settings
|
||||
if [[ $1 = '--edit' ]]; then
|
||||
[[ ! -f $HOME/.config/compton.conf ]] &&
|
||||
cp '/etc/xdg/compton.conf' "$HOME/.config/compton.conf"
|
||||
|
||||
if [[ -x /usr/bin/geany ]]; then
|
||||
geany "$HOME/.config/compton.conf" &
|
||||
else
|
||||
terminator --command='nano "$HOME/.config/compton.conf"'
|
||||
fi
|
||||
elif [[ $1 = '--toggle' || $1 = '--start' ]]; then # Toggle compositing with compton.
|
||||
# TODO why --toggle and --start act exactly the same?
|
||||
if ! pidof compton > /dev/null; then
|
||||
$EXECXCOMP &
|
||||
else
|
||||
killall compton
|
||||
fi
|
||||
elif [[ $1 = '--restart' ]]; then
|
||||
killall -q compton
|
||||
for (( i=0; i < RESTART_ATTEMPTS; i++ )); do
|
||||
pidof compton > /dev/null || # no process found! Safe to start again
|
||||
break
|
||||
|
||||
(( i == RESTART_ATTEMPTS - 1 )) && # still didn't die? Probably hangs. Force it to die!
|
||||
killall -q -S KILL compton
|
||||
|
||||
sleep 0.25
|
||||
done
|
||||
mabox-compositor --start
|
||||
elif [[ $1 = '--watch' ]]; then
|
||||
while inotifywait -e modify "$HOME/.config/compton.conf"; do
|
||||
mabox-compositor --restart # TODO move this to function?
|
||||
done
|
||||
else
|
||||
# Output Openbox menu
|
||||
menuStart
|
||||
if ! pidof compton > /dev/null; then
|
||||
menuItem 'Enable Compositing' 'mabox-compositor --start'
|
||||
else
|
||||
menuItem 'Restart Compositing' 'mabox-compositor --restart'
|
||||
menuItem 'Disable Compositing' 'mabox-compositor --toggle'
|
||||
menuSeparator
|
||||
fi
|
||||
menuItem 'Edit Compositing Settings' 'mabox-compositor --edit'
|
||||
menuEnd
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,125 @@
|
|||
#!/bin/bash
|
||||
# --------------------------------------------------------------------
|
||||
# An Openbox pipemenu for use with Dropbox and CrunchBang Linux.
|
||||
# Written for CrunchBang Linux <http://crunchbanglinux.org/>
|
||||
# by Philip Newborough (aka corenominal) <mail@philipnewborough.co.uk>
|
||||
# Ported to #!++ <https://crunchbangplusplus.org>
|
||||
# by Ben Young <computermouth@crunchbangplusplus.org>
|
||||
# Ported to Manjaro <https://manjaro.github.io/>
|
||||
# by Daniel Napora <napcok@gmail.com>
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
PROMPT_DELAY_TEXT='It is a good idea to add a delay before autostarting Dropbox
|
||||
so that your system can establish a working network connection.
|
||||
|
||||
Select the number of seconds to delay Dropbox autostarting.
|
||||
Click "Cancel" if you do not want to add a delay.'
|
||||
PROMPT_DELAY_VARIANTS=(FALSE 10 FALSE 20 FALSE 30 FALSE 40 FALSE 50 TRUE 60)
|
||||
|
||||
USERDBDIR="$HOME/.dropbox-dist/"
|
||||
|
||||
|
||||
if ! . mabox-include.cfg 2> /dev/null; then
|
||||
echo ' Failed to locate mabox-include.cfg in PATH' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# manipulation
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
if [[ $1 = '--start-dropbox' ]]; then
|
||||
"$USERDBDIR/dropboxd" &
|
||||
|
||||
elif [[ $1 = '--stop-dropbox' ]]; then
|
||||
killall dropbox
|
||||
|
||||
elif [[ $1 = '--install-dropbox' ]]; then
|
||||
zenity --question --title='Dropbox Installation' --text 'This script will install Dropbox.\nDo you want to proceed?' || exit 0
|
||||
|
||||
if ! cd "$HOME"; then # TODO Change directory? What for? Better use absolute paths
|
||||
echo "Unable to change directory to $HOME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
platform=$(uname -m)
|
||||
platform=${platform,,}
|
||||
|
||||
case $platform in
|
||||
'x86_64')
|
||||
#DROPBOXURL='http://packages.crunchbang.org/waldorf-files/dropbox/64/dropbox.tar.gz'
|
||||
DROPBOXURL='http://www.dropbox.com/download?plat=lnx.x86_64'
|
||||
;;
|
||||
*)
|
||||
#DROPBOXURL='http://packages.crunchbang.org/waldorf-files/dropbox/32/dropbox.tar.gz'
|
||||
DROPBOXURL='http://www.dropbox.com/download?plat=lnx.x86'
|
||||
;;
|
||||
esac
|
||||
|
||||
shitTemp=$(mktemp -u)
|
||||
curl -s -I "$DROPBOXURL" > "$shitTemp"
|
||||
if [[ $? = 0 ]]; then # TODO this check is just wrong. It doesn't even make sure if it is possible to download a file or not.
|
||||
read _ RESPONSE _ <<< $(head -n 1 "$shitTemp")
|
||||
|
||||
#if [ $RESPONSE -ne "200" ]; then
|
||||
if [[ RESPONSE != 302 ]]; then
|
||||
zenity --warning --title='Dropbox Installation' --text 'Error, failed to contact server. Please try again later.'
|
||||
exit 1
|
||||
else
|
||||
dropboxFile=$(mktemp -u)
|
||||
wget "$DROPBOXURL" -O "$dropboxFile" 2>&1 | \
|
||||
sed -u 's/^.* \+\([0-9]\+%\) \+\([0-9.]\+[GMKB]\) \+\([0-9hms.]\+\).*$/\1\n# Downloading... \2 (\3)/' | \
|
||||
zenity --progress --title='Installing Dropbox' --auto-kill --auto-close
|
||||
fi
|
||||
else
|
||||
zenity --warning --title='Dropbox Installation' --text 'Error, failed to contact server. Please try again later.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#extract binary
|
||||
tar -xf "$dropboxFile"
|
||||
#delete binary archive
|
||||
rm "$dropboxFile"
|
||||
|
||||
#quick sanity check
|
||||
if [[ ! -x $USERDBDIR/dropboxd ]]; then
|
||||
zenity --warning --title='Dropbox Installation' --text 'Oops! There was an error, Dropbox could not be installed. Sorry.'
|
||||
exit 1
|
||||
fi
|
||||
zenity --info --title='Dropbox Installation' --text "Dropbox has been installed to:\n$USERDBDIR"
|
||||
zenity --question --title='Dropbox Installation' --text 'Dropbox can be started automatically when you start your session. Would you like to autostart Dropbox when you login?'
|
||||
if [[ $? = 0 ]]; then # add to autostart!
|
||||
ans=$(zenity --title='Dropbox Installation' --list --text "$PROMPT_DELAY_TEXT" --radiolist --column 'Pick' --column 'Seconds:' "${PROMPT_DELAY_VARIANTS[@]}")
|
||||
if [[ $? = 0 ]]; then
|
||||
echo >> "$HOME/.config/openbox/autostart"
|
||||
echo '# Autostart the Dropbox deamon' >> "$HOME/.config/openbox/autostart"
|
||||
echo "(sleep ${ans}s && \"\$HOME/.dropbox-dist/dropboxd\") &" >> "$HOME/.config/openbox/autostart"
|
||||
echo >> "$HOME/.config/openbox/autostart"
|
||||
fi
|
||||
fi
|
||||
zenity --question --title='Dropbox Installation' --text 'Do you wish to start the Dropbox client now?' || exit 0
|
||||
|
||||
"$USERDBDIR/dropboxd" &
|
||||
else
|
||||
# pipemenu stuff
|
||||
menuStart
|
||||
if [[ ! -d $USERDBDIR ]]; then
|
||||
menuItem 'Install Dropbox' 'mabox-dropbox-pipemenu --install-dropbox'
|
||||
menuSeparator
|
||||
menuItem 'Find out more about Dropbox' 'x-www-browser http://db.tt/5mJg9lb'
|
||||
else
|
||||
[[ -d $HOME/Dropbox ]] &&
|
||||
menuItem 'Open Dropbox Folder' 'thunar $HOME/Dropbox'
|
||||
|
||||
if ! pidof dropbox > /dev/null; then
|
||||
menuItem 'Start Dropbox' 'mabox-dropbox-pipemenu --start-dropbox'
|
||||
else
|
||||
menuItem 'Stop Dropbox' 'mabox-dropbox-pipemenu --stop-dropbox'
|
||||
fi
|
||||
menuSeparator
|
||||
menuItem 'Launch Dropbox Website' 'x-www-browser https://www.dropbox.com/home'
|
||||
fi
|
||||
menuItem 'Dropbox Terms' 'x-www-browser https://www.dropbox.com/terms'
|
||||
menuEnd
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
if ! . mabox-include.cfg 2> /dev/null; then
|
||||
echo ' Failed to locate mabox-include.cfg in PATH' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
menuStart
|
||||
menuSeparator 'Online Help'
|
||||
|
||||
menuSubmenu 'ManjaroWWW' 'Manjaro Linux'
|
||||
menuItem 'Manjaro Linux Homepage' 'x-www-browser https://manjaro.github.io/'
|
||||
menuItem 'Manjaro Linux Wiki Pages' 'x-www-browser https://wiki.manjaro.org/'
|
||||
menuItem 'Manjaro Linux Forums' 'x-www-browser https://forum.manjaro.org/'
|
||||
menuSubmenuEnd
|
||||
|
||||
menuSubmenu 'OpenboxWWW' 'Openbox'
|
||||
menuItem 'Openbox Homepage' 'x-www-browser "http://openbox.org/wiki/Main_Page"'
|
||||
menuItem 'Openbox Documentation' 'x-www-browser "http://openbox.org/wiki/Help:Contents"'
|
||||
menuItem 'Openbox FAQ' 'x-www-browser "http://openbox.org/wiki/Help:FAQ"'
|
||||
menuItem 'Openbox Getting Started' 'x-www-browser "http://openbox.org/wiki/Help:Getting_started"'
|
||||
menuItem 'Openbox Community Portal' 'x-www-browser "http://openbox.org/wiki/Openbox:Community_portal"'
|
||||
menuSubmenuEnd
|
||||
menuEnd
|
|
@ -0,0 +1,151 @@
|
|||
# cbpp-include.cfg - Variables and functions commonly used in custom scripts for
|
||||
# CrunchBang GNU/Linux <http://crunchbanglinux.org/>.
|
||||
# Ported to #!++ <https://crunchbangplusplus.org>
|
||||
# by Ben Young <computermouth@crunchbangplusplus.org>
|
||||
# Ported to Manjaro <https://manjaro.github.io/>
|
||||
# by Daniel Napora <napcok@gmail.com>
|
||||
|
||||
# Usage: say text [delayAfterText]
|
||||
say() {
|
||||
fold -s -w 76 <<< "$1" | sed 's/^/ /' # wraps text nicely and adds two leading spaces
|
||||
sleep "${2-0}"
|
||||
}
|
||||
|
||||
# Usage: prompt text [Y | N | Q]
|
||||
prompt() {
|
||||
local answer prompt default
|
||||
if [[ ${2^} = Q* ]]; then
|
||||
#say "$1"
|
||||
read -srn1 -p "$1" answer
|
||||
echo
|
||||
[[ ${answer,} = 'q' ]] && return 0 || return 1
|
||||
fi
|
||||
|
||||
if [[ ! $2 || ${2^} = Y* ]]; then
|
||||
prompt='Y/n'
|
||||
default='Y'
|
||||
elif [[ ${2^} = N* ]]; then
|
||||
prompt='y/N'
|
||||
default='N'
|
||||
fi
|
||||
|
||||
while true; do
|
||||
read -r -p "$1 [$prompt] " answer
|
||||
|
||||
[[ ! $answer ]] &&
|
||||
answer=$default
|
||||
|
||||
if [[ ${answer^} = Y* ]]; then
|
||||
say
|
||||
return 0
|
||||
elif [[ ${answer^} = N* ]]; then
|
||||
say
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Check the connection by downloading a file from ftp.debian.org. No disk space used.
|
||||
# Usage: connectiontest [attempts]
|
||||
# If attempt count is not specified or 0, then it will loop forever and exit(!) your main program with 1 exit status.
|
||||
connectiontest() {
|
||||
local TEXT_CHECKING='Checking internet connection...'
|
||||
local TEXT_FAILED='Internet connection test failed!'
|
||||
local TEXT_ASK_RETRY=$'\n\nThis script requires a working internet connection. Please configure your internet connection, then hit any key to continue, else hit "q" to quit.'
|
||||
local TEXT_ABORT='Script aborted.'
|
||||
local TEXT_OK='Internet connection test passed!'
|
||||
|
||||
local -i i attempts=${1-0}
|
||||
for (( i=0; i < attempts || attempts == 0; i++ )); do
|
||||
say "$TEXT_CHECKING"
|
||||
if wget -O - 'http://ftp.debian.org/debian/README' &> /dev/null; then
|
||||
say "$TEXT_OK" 1
|
||||
return 0
|
||||
fi
|
||||
say "$TEXT_FAILED"
|
||||
if (( i == attempts - 1 )); then # if last attempt
|
||||
return 1
|
||||
elif prompt "$TEXT_ASK_RETRY" Q; then # if user wants to quit
|
||||
say "$TEXT_ABORT" 2
|
||||
(( attempts == 0 )) && exit 1 || return 1
|
||||
fi
|
||||
clear
|
||||
done
|
||||
}
|
||||
|
||||
menuStart() {
|
||||
echo ' <openbox_pipe_menu>'
|
||||
}
|
||||
|
||||
# Usage: menuItem label command
|
||||
menuItem() {
|
||||
echo " <item label=\"$1\">"
|
||||
echo ' <action name="Execute">'
|
||||
echo ' <command>'
|
||||
echo " $2"
|
||||
echo ' </command>'
|
||||
echo ' </action>'
|
||||
echo ' </item>'
|
||||
}
|
||||
|
||||
# Usage: menuSeparator [label]
|
||||
menuSeparator() {
|
||||
if [[ $1 ]]; then
|
||||
echo " <separator label=\"$1\"/>"
|
||||
else
|
||||
echo ' <separator/>'
|
||||
fi
|
||||
}
|
||||
|
||||
# Usage menuSubmenu id label # http://openbox.org/wiki/Help:Menus
|
||||
menuSubmenu() {
|
||||
echo " <menu id=\"$1\" label=\"$2\">"
|
||||
}
|
||||
|
||||
menuSubmenuEnd() {
|
||||
echo ' </menu>'
|
||||
}
|
||||
|
||||
menuEnd() {
|
||||
echo ' </openbox_pipe_menu>'
|
||||
}
|
||||
|
||||
# Usage: promptInstall title description package...
|
||||
promptInstall() {
|
||||
while true; do # Repeat until there are no errors
|
||||
if [[ $TRYAGAIN ]]; then # previous try failed
|
||||
say
|
||||
say "There was a problem installing ${2,,}."
|
||||
say
|
||||
prompt ' Hit any key to try again, or "q" to quit...' Q && return 1
|
||||
fi
|
||||
local TRYAGAIN=true
|
||||
|
||||
clear
|
||||
say
|
||||
say "INSTALL ${1^^}"
|
||||
say '------------------------'
|
||||
say "This script will install ${2,,}."
|
||||
say
|
||||
prompt ' Run the installer now?' || return 0
|
||||
|
||||
clear
|
||||
connectiontest || continue
|
||||
|
||||
clear
|
||||
say 'Updating sources...' 1
|
||||
sudo pacman -Syu
|
||||
|
||||
clear
|
||||
say 'Installing package...' 1
|
||||
sudo pacman -S "${@:3}" || continue
|
||||
|
||||
clear
|
||||
say
|
||||
say "${2^} has been installed successfully."
|
||||
say
|
||||
say 'Hit any key to exit...'
|
||||
read -srn1
|
||||
return 0
|
||||
done
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------
|
||||
# An Openbox pipemenu for use with LibreOffice and CrunchBang Linux.
|
||||
# Written for CrunchBang Linux <http://crunchbang.org/>
|
||||
# by Philip Newborough (aka corenominal) <mail@philipnewborough.co.uk>
|
||||
# Ported to #!++ <https://crunchbangplusplus.org>
|
||||
# by Ben Young <computermouth@crunchbangplusplus.org>
|
||||
# Ported to Manjaro <https://manjaro.github.io/>
|
||||
# by Daniel Napora <napcok@gmail.com>
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
if ! . mabox-include.cfg 2> /dev/null; then
|
||||
echo ' Failed to locate mabox-include.cfg in PATH' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $1 = '--install' ]]; then
|
||||
terminator --title='Install LibreOffice' --command='mabox-libreoffice-pipemenu --install-lo'
|
||||
|
||||
elif [[ $1 = '--install-lo' ]]; then
|
||||
promptInstall 'LIBREOFFICE' 'LibreOffice' 'libreoffice-still'
|
||||
|
||||
else
|
||||
# Pipemenu
|
||||
menuStart
|
||||
|
||||
tools=('writer' 'calc' 'impress' 'draw' 'base')
|
||||
|
||||
for curTool in "${tools[@]}"; do
|
||||
if type "lo$curTool" &> /dev/null; then
|
||||
INSTALLED=true
|
||||
menuItem "${curTool^}" "lo$curTool"
|
||||
fi
|
||||
done
|
||||
|
||||
[[ ! $INSTALLED ]] &&
|
||||
menuItem 'Install LibreOffice' 'mabox-libreoffice-pipemenu --install'
|
||||
|
||||
menuEnd
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,178 @@
|
|||
#!/bin/sh
|
||||
# cb-places-pipemenu - a places openbox pipe menu
|
||||
# Copyright (C) 2010 John Crawley
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# Version 2012/09/27-cb
|
||||
|
||||
|
||||
# Ported to #!++ <https://crunchbangplusplus.org>
|
||||
# by Ben Young <computermouth@crunchbangplusplus.org>
|
||||
# Ported to Manjaro <https://manjaro.github.io/>
|
||||
# by Daniel Napora <napcok@gmail.com>
|
||||
|
||||
# NB The shell, not bash, is invoked in the hope that
|
||||
# dash will be used, as it is much faster.
|
||||
|
||||
# Usage: add
|
||||
# <menu id="places" label="Places" execute="/path/to/mabox-places-pipemenu ~/" />
|
||||
# to your .config/openbox/menu.xml
|
||||
|
||||
# or, if you want the "recent files" menu incorporated at the top, use:
|
||||
# <menu id="places" label="Places" execute="/path/to/mabox-places-pipemenu --recent ~/" />
|
||||
# make sure you have mabox-recent-files-pipemenu somewhere, and enter its path below.
|
||||
|
||||
# path to your "recent files" script, if you want to incorporate it:
|
||||
recent_script=/usr/bin/mabox-recent-files-pipemenu
|
||||
|
||||
# Command to open folders at "Browse here..." - any file manager
|
||||
open_folder_cmd=pcmanfm
|
||||
# Default command to open files with - others might be xdg-open, gnome-open, pcmanfm...
|
||||
default_open_cmd=exo-open # exo-open comes with thunar
|
||||
# Text editor of choice
|
||||
text_editor=geany
|
||||
|
||||
# function to open files with default open command, or alternative command for certain files
|
||||
# - add other conditions to choice
|
||||
open_file() {
|
||||
[ -x "$1" ] && exec "$text_editor" "$1" # comment out this line if you don't want to edit executables instead of executing
|
||||
#[ -x "$1" ] && exec "terminator -e" "$1" # uncomment this and comment out previous line to run executables in terminal instead of editing
|
||||
[ "${1##*.}" = desktop ] && exec "$text_editor" "$1" # comment out this line if you don't want to edit .desktop files instead of executing
|
||||
exec "$default_open_cmd" "$1" # use default open command if above conditions not satisfied
|
||||
}
|
||||
|
||||
# extra dotfiles to display in HOME folder (dotfiles are hidden by default)
|
||||
# edit the list (space separated, surrounded by single quotes) or comment this line out, to taste:
|
||||
shown_dotfiles='.config .local .Xdefaults .bash_aliases .bashrc .fonts.conf .gtkrc-2.0.mine .profile .xsession-errors'
|
||||
|
||||
# By default, this script will display directories separately, before files.
|
||||
# To change this behaviour, see NOTE1, NOTE2 and NOTE3 below, near end of page.
|
||||
|
||||
#######################################################################
|
||||
|
||||
case $1 in
|
||||
# if "--open" option is sent as $1, open file ($2) instead of generating menu
|
||||
--open)
|
||||
open_file "$2"
|
||||
echo "$0 : failed to open $2" >&2
|
||||
exit;; # in case exec command fails
|
||||
# if "--recent" option is sent, incorporate "recent files" menu
|
||||
--recent)
|
||||
shift
|
||||
output='<openbox_pipe_menu>
|
||||
'
|
||||
if [ -x "$recent_script" ]
|
||||
then
|
||||
output="$output"'<separator label="Recently opened..." />
|
||||
<menu execute="'"$recent_script"'" id="recent" label="files" />
|
||||
'
|
||||
else
|
||||
echo "$0 : cannot find executable script $recent_script" >&2
|
||||
fi;;
|
||||
*)
|
||||
output='<openbox_pipe_menu>
|
||||
';;
|
||||
esac
|
||||
|
||||
path="${1:-$HOME}" # default starting place is ~, otherwise $1
|
||||
path="$( echo "${path}"/ | tr -s '/' )" # ensure one final slash
|
||||
[ -d "$path" ] || { echo "$0 : $path is not a directory" >&2; exit 1; }
|
||||
|
||||
case "$path" in # only escape if string needs it
|
||||
*\&*|*\<*|*\>*|*\"*|*\'*) pathe=$(sed "s/\&/\&/g;s/</\</g;s/>/\>/g;s/\"/\"/g;s/'/\'/g;" <<XXX
|
||||
$path
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*)pathe=$path;;
|
||||
esac
|
||||
|
||||
case "$pathe" in
|
||||
*\&apos\;*) pathe_apos=$(sed 's/\'/\'\"\'\"\'/g;'<<XXX
|
||||
$pathe
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*) pathe_apos=$pathe;;
|
||||
esac
|
||||
|
||||
output="$output"'<separator label="'$pathe'" />
|
||||
<item label="Browse here...">
|
||||
<action name="Execute">
|
||||
<command>
|
||||
''"$open_folder_cmd"'' ''"$pathe_apos"''
|
||||
</command>
|
||||
</action>
|
||||
</item>
|
||||
<separator />
|
||||
'
|
||||
|
||||
unset extra_entries directories_menu files_menu
|
||||
[ "$path" = "$HOME"/ ] && extra_entries="$shown_dotfiles"
|
||||
for i in "$path"* $extra_entries
|
||||
do
|
||||
[ -e "$i" ] || continue # only output code if file exists
|
||||
shortname="${i##*/}"
|
||||
case $shortname in
|
||||
*\&*|*\<*|*\>*|*\"*|*\'*) shortnamee=$(sed "s/\&/\&/g;s/</\</g;s/>/\>/g;s/\"/\"/g;s/'/\'/g;" <<XXX
|
||||
$shortname
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*) shortnamee=$shortname;;
|
||||
esac
|
||||
case $shortnamee in
|
||||
*\&apos\;*) shortnamee_apos=$(sed 's/\'/\'\"\'\"\'/g;'<<XXX
|
||||
$shortnamee
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*) shortnamee_apos=$shortnamee;;
|
||||
esac
|
||||
case $shortnamee in
|
||||
*_*) shortnamee_label=$(sed 's/_/__/g;'<<XXX
|
||||
$shortnamee
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*) shortnamee_label=$shortnamee;;
|
||||
esac
|
||||
[ -d "$i" ] && {
|
||||
# NOTE1 If you want directories and files listed together
|
||||
# change next line (directories_menu="$directories_menu"') to read: files_menu="$files_menu"' (note the one single quote at the end)
|
||||
directories_menu="$directories_menu"'
|
||||
<menu id="'"${pathe_apos}${shortnamee_apos}"'" label="'"$shortnamee_label"'" execute="''"$0"'' ''"${pathe_apos}${shortnamee_apos}"''" />'; continue; }
|
||||
files_menu="$files_menu"'
|
||||
<item label="'"$shortnamee_label"'">
|
||||
<action name="Execute">
|
||||
<command>
|
||||
''"$0"'' --open ''"${pathe_apos}${shortnamee_apos}"''
|
||||
</command>
|
||||
</action>
|
||||
</item>'
|
||||
done
|
||||
|
||||
[ -n "$directories_menu" ] && {
|
||||
# NOTE2 comment out next 2 lines if you don't want "Directories" label
|
||||
output="${output}"'<separator label="Directories" />
|
||||
'
|
||||
output="${output}${directories_menu}"'
|
||||
'; }
|
||||
[ -n "$files_menu" ] && {
|
||||
# NOTE3 comment out next 2 lines if you don't want "Files" label
|
||||
output="${output}"'<separator label="Files" />
|
||||
'
|
||||
output="${output}${files_menu}"'
|
||||
'; }
|
||||
output="${output}"'</openbox_pipe_menu>
|
||||
'
|
||||
printf '%s' "$output"
|
||||
exit
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------
|
||||
# An Openbox pipemenu for configuring printing under CrunchBang Linux.
|
||||
# Written for CrunchBang Linux <http://crunchbanglinux.org/>
|
||||
# by Philip Newborough (aka corenominal) <mail@philipnewborough.co.uk>
|
||||
# Ported to #!++ <https://crunchbangplusplus.org>
|
||||
# by Ben Young <computermouth@crunchbangplusplus.org>
|
||||
# Ported to Manjaro <https://manjaro.github.io/>
|
||||
# by Daniel Napora <napcok@gmail.com>
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
if ! . mabox-include.cfg 2> /dev/null; then
|
||||
echo ' Failed to locate mabox-include.cfg in PATH' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $1 = '--install' ]]; then
|
||||
terminator --title='Install Printer Support' --command='mabox-printing-pipemenu --install-printing'
|
||||
|
||||
elif [[ $1 = '--install-printing' ]]; then
|
||||
promptInstall 'PRINTING SUPPORT' 'printing support' 'manjaro-printer'
|
||||
|
||||
else
|
||||
# Pipemenu
|
||||
menuStart
|
||||
if type 'system-config-printer' &> /dev/null; then
|
||||
menuItem 'Configure Printers' 'gksudo system-config-printer'
|
||||
else
|
||||
menuItem 'Install Printing Support' 'mabox-printing-pipemenu --install'
|
||||
fi
|
||||
menuEnd
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,108 @@
|
|||
#!/bin/sh
|
||||
# cb-recent-files-pipemenu - a script to parse .recently-used.xbel
|
||||
# and generate openbox pipe menu
|
||||
# Copyright (C) 2010 John Crawley
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# version 2012/07/01-cb
|
||||
|
||||
# Ported to #!++ <https://crunchbangplusplus.org>
|
||||
# by Ben Young <computermouth@crunchbangplusplus.org>
|
||||
# Ported to Manjaro <https://manjaro.github.io/>
|
||||
# by Daniel Napora <napcok@gmail.com>
|
||||
|
||||
# Usage: add
|
||||
# <menu id="recent" label="Recent Files" execute="/path/to/mabox-recent-files-pipemenu" />
|
||||
# to your .config/openbox/menu.xml, or use with mabox-places-pipemenu (see comments there)
|
||||
|
||||
maximum_entries=15 # max. number of entries in menu
|
||||
|
||||
#######################################################################
|
||||
|
||||
# look for recently-used.xbel
|
||||
if [ $XDG_DATA_HOME ] && [ -r "${XDG_DATA_HOME}/recently-used.xbel" ]
|
||||
then
|
||||
file_path="${XDG_DATA_HOME}/recently-used.xbel"
|
||||
elif [ -r "${HOME}/.local/share/recently-used.xbel" ]
|
||||
then
|
||||
file_path="${HOME}/.local/share/recently-used.xbel"
|
||||
elif [ -r "${HOME}/.recently-used.xbel" ]
|
||||
then
|
||||
file_path="${HOME}/.recently-used.xbel"
|
||||
else
|
||||
echo "$0: cannot find a readable recently-used.xbel file" >&2
|
||||
echo '<openbox_pipe_menu>
|
||||
<separator label="No recently-used.xbel file found." />
|
||||
</openbox_pipe_menu>'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if argument is --clear, empty .recently-used.xbel
|
||||
[ "$1" = '--clear' ] && {
|
||||
cat <<':EOF' > "${file_path}"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xbel version="1.0"
|
||||
xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"
|
||||
xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
|
||||
>
|
||||
</xbel>
|
||||
:EOF
|
||||
exit
|
||||
}
|
||||
|
||||
maximum_entries=$((maximum_entries+2))
|
||||
|
||||
pre=' <item label="'
|
||||
mid='">
|
||||
<action name="Execute"><command>'
|
||||
post='</command></action>
|
||||
</item>'
|
||||
|
||||
files=$( tac "${file_path}" | awk -v MAX="$maximum_entries" -v PR="$pre" -v MI="$mid" -v PO="$post" 'BEGIN {
|
||||
RS="</bookmark>";
|
||||
FS="<info>";
|
||||
}
|
||||
(NR == MAX) {exit}
|
||||
!/<bookmark/ {next}
|
||||
!/href=[\"'\'']file:\/\// {next}
|
||||
# $1 is the command, $2 the file path
|
||||
{
|
||||
sub(/^.*exec=\"\&apos\;/,"",$1)
|
||||
sub(/\&apos\;.*$/,"",$1)
|
||||
sub(/ *%./,"",$1)
|
||||
sub(/^.*file:\/\//,"",$2)
|
||||
sub(/[\"'\''].*$/,"",$2)
|
||||
gsub(/%22/,"\\"",$2)
|
||||
gsub(/%3C/,"\\<",$2)
|
||||
gsub(/%3E/,"\\>",$2)
|
||||
name=$2
|
||||
sub(/^.*\//,"",name)
|
||||
gsub(/_/,"__",name)
|
||||
gsub(/\'/,"\\'\\"\\'\\"\\'",$2)
|
||||
print (PR name MI $1 " '"'"'" $2 "'"'"'" PO)
|
||||
}' )
|
||||
|
||||
# use perl to decode urlencoded characters
|
||||
files=$(perl -MURI::Escape -e 'print uri_unescape($ARGV[0]);' "$files")
|
||||
|
||||
output='<openbox_pipe_menu>
|
||||
'"$files"'
|
||||
<separator />
|
||||
<item label="Clear Recent Files">
|
||||
<action name="Execute">
|
||||
<command>
|
||||
''"$0"'' --clear
|
||||
</command>
|
||||
</action>
|
||||
</item>
|
||||
</openbox_pipe_menu>
|
||||
'
|
||||
printf '%s' "$output" # printf because echo sometimes eats backslashes
|
|
@ -0,0 +1,71 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os, warnings
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore")
|
||||
from paramiko.config import SSHConfig
|
||||
|
||||
cfgdir = os.getenv("HOME")+"/.ssh"
|
||||
cfgfile = cfgdir+"/config"
|
||||
|
||||
try:
|
||||
config_file = file(cfgfile)
|
||||
except IOError:
|
||||
if not os.path.exists(cfgdir):
|
||||
os.makedirs(cfgdir,0700)
|
||||
f = open(cfgfile,'w')
|
||||
o = '# SSH config file, \'man ssh_config\' for more details.\n\n'
|
||||
o += '#Host example\n'
|
||||
o += '# hostname example.com\n'
|
||||
o += '# user joebloggs\n'
|
||||
f.write(o)
|
||||
f.close()
|
||||
os.chmod(cfgfile, 0600)
|
||||
config_file = file(cfgfile)
|
||||
config = SSHConfig()
|
||||
config.parse(config_file)
|
||||
hosts = config._config
|
||||
else:
|
||||
config = SSHConfig()
|
||||
config.parse(config_file)
|
||||
hosts = config._config
|
||||
|
||||
print '<openbox_pipe_menu>\n'
|
||||
|
||||
if len(hosts) >= 2:
|
||||
for h in hosts[1:]:
|
||||
if h.has_key('host') and h.has_key('hostname'):
|
||||
user = ''
|
||||
if h.has_key('user'):
|
||||
user = '-l '+h['user']+ ' '
|
||||
port = ['','']
|
||||
if h.has_key('port'):
|
||||
port[0] = '-p '+h['port']+ ' '
|
||||
port[1] = ':'+h['port']
|
||||
print '<menu id="ssh-'+h['host']+'" label="'+h['host']+'">'
|
||||
print ' <item label="Start terminal session">'
|
||||
print ' <action name="Execute">'
|
||||
print ' <command>'
|
||||
print ' lxterminal -e "ssh '+user+port[0]+h['hostname']+'"'
|
||||
print ' </command>'
|
||||
print ' </action>'
|
||||
print ' </item>\n'
|
||||
print ' <item label="Browse with PCManFM">'
|
||||
print ' <action name="Execute">'
|
||||
print ' <command>'
|
||||
print ' pcmanfm ssh://'+h['hostname']+port[1]
|
||||
print ' </command>'
|
||||
print ' </action>'
|
||||
print ' </item>\n'
|
||||
print '</menu>\n'
|
||||
print '<separator/>\n'
|
||||
|
||||
print '<item label="Edit ~/.ssh/config">'
|
||||
print ' <action name="Execute">'
|
||||
print ' <command>'
|
||||
print ' geany ~/.ssh/config'
|
||||
print ' </command>'
|
||||
print ' </action>'
|
||||
print '</item>\n'
|
||||
|
||||
print '</openbox_pipe_menu>'
|
|
@ -0,0 +1,139 @@
|
|||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------
|
||||
# Written for CrunchBang Linux <http://crunchbang.org/>
|
||||
# by Philip Newborough (aka corenominal) <corenominal@corenominal.org>
|
||||
# Ported to #!++ <https://crunchbangplusplus.org>
|
||||
# by Ben Young <computermouth@crunchbangplusplus.org>
|
||||
# Ported to Manjaro <https://manjaro.github.io/>
|
||||
# by Daniel Napora <napcok@gmail.com>
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
|
||||
# In order to add another browser, simply add it to this array:
|
||||
TOOLS=('chromium' 'google-chrome-stable' 'opera')
|
||||
# If the package needs additional configuration before installation simply create a function called setupBrowserName, it will be called automatically.
|
||||
|
||||
KEY_URLS_GOOGLE=('https://dl-ssl.google.com/linux/linux_signing_key.pub' 'http://packages.crunchbangplusplus.org/chrome.pub')
|
||||
KEY_URLS_OPERA=('http://deb.opera.com/archive.key' 'http://packages.crunchbangplusplus.org/opera.key')
|
||||
|
||||
if ! . mabox-include.cfg 2> /dev/null; then
|
||||
say 'Failed to locate mabox-include.cfg in PATH' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
browserExists() {
|
||||
for curTool in "${TOOLS[@]}"; do # if $packageName exists in tools array
|
||||
[[ $curTool = "$1" ]] &&
|
||||
return 0
|
||||
done
|
||||
say "Unable to install $1. There is no such browser that I know of." >&2
|
||||
say "You can try one of these: ${TOOLS[@]}" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
addAptKey() {
|
||||
clear
|
||||
say 'Adding APT key...'
|
||||
keyFile=$(mktemp -u)
|
||||
for curKey; do
|
||||
wget -O "$keyFile" "$curKey" 2> /dev/null && break; # success. No need to try other keys
|
||||
say "Failed to retrieve key from $curKey . Trying another source..."
|
||||
done
|
||||
if [[ $? != 0 ]]; then
|
||||
say 'Failed to retrieve APT key!' >&2
|
||||
return 1
|
||||
fi
|
||||
sudo apt-key add "$keyFile"
|
||||
rm -f "$keyFile"
|
||||
return 0
|
||||
}
|
||||
|
||||
setupGoogleChromeStable() {
|
||||
addAptKey "${KEY_URLS_GOOGLE[@]}" || return 1
|
||||
say 'Creating APT sources file...' 1
|
||||
echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee '/etc/apt/sources.list.d/google-chrome.list'
|
||||
}
|
||||
|
||||
setupOpera() {
|
||||
addAptKey "${KEY_URLS_OPERA[@]}" || return 1
|
||||
say 'Creating APT sources file...' 1
|
||||
echo 'deb http://deb.opera.com/opera/ stable non-free' | sudo tee '/etc/apt/sources.list.d/opera.list'
|
||||
}
|
||||
|
||||
if [[ $1 && ! $1 =~ --install-* ]]; then
|
||||
browserName=${1#--}
|
||||
browserExists "$browserName" || exit 1
|
||||
read -ra words <<< "${browserName//-/ }"
|
||||
terminator --title="Install ${words[*]^}" --command="mabox-x-www-browser-pipemenu --install-$browserName"
|
||||
|
||||
elif [[ $1 = --install-* ]]; then
|
||||
packageName=${1#--install-}
|
||||
browserExists "$packageName" || exit 1
|
||||
browserName=${packageName//-/ }
|
||||
read -ra words <<< "$browserName"
|
||||
browserName=${words[*]^}
|
||||
browserNameUpper=${browserName^^}
|
||||
|
||||
while true; do # do it until the package is successfully installed or user wants to exit
|
||||
if [[ $TRYAGAIN ]]; then # previous try failed
|
||||
say
|
||||
say "There was a problem installing $browserName."
|
||||
say
|
||||
prompt ' Hit any key to try again, or "q" to quit...' Q && break
|
||||
fi
|
||||
TRYAGAIN=true
|
||||
|
||||
clear
|
||||
say
|
||||
say "INSTALL ${browserNameUpper% BROWSER} BROWSER"
|
||||
say '------------------------'
|
||||
say "This script will install $browserName."
|
||||
say
|
||||
prompt ' Run the installer now?' || break
|
||||
|
||||
clear
|
||||
connectiontest 1 || continue
|
||||
|
||||
setupFunctionName="setup${browserName//[^a-zA-Z]/}" # setupFunctionName should now be in format like 'setupChromiumBrowser'
|
||||
if [[ $(type -t "$setupFunctionName") == 'function' ]]; then
|
||||
"$setupFunctionName" || continue # run setup function if it exists
|
||||
fi
|
||||
|
||||
clear
|
||||
say 'Updating sources...' 1
|
||||
sudo apt-get update
|
||||
|
||||
clear
|
||||
say 'Installing package...' 1
|
||||
sudo apt-get install -y "$packageName" || continue
|
||||
|
||||
clear
|
||||
say
|
||||
say "$browserName has been installed successfully."
|
||||
say
|
||||
say 'Hit any key to exit...'
|
||||
read -srn1
|
||||
break
|
||||
done
|
||||
else # pipemenu
|
||||
menuStart
|
||||
for curTool in "${TOOLS[@]}"; do
|
||||
read -ra words <<< "${curTool//-/ }"
|
||||
curToolName=${words[*]^}
|
||||
if type "$curTool" &> /dev/null; then
|
||||
INSTALLED=true
|
||||
menuItem "$curToolName" "$curTool"
|
||||
[[ $curToolName =~ 'Chrom' ]] &&
|
||||
menuItem "$curToolName (Private Mode)" "$curTool --incognito" # Incognito mode for chrome and chromium
|
||||
else
|
||||
menuItem "Install $curToolName" "mabox-x-www-browser-pipemenu --$curTool"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $INSTALLED ]]; then
|
||||
menuSeparator
|
||||
menuItem 'Select default browser' 'terminator --command="sudo update-alternatives --config x-www-browser"'
|
||||
fi
|
||||
menuEnd
|
||||
fi
|
||||
exit 0
|
Loading…
Reference in New Issue