cleanup, update
parent
6371a45ee0
commit
18742cd373
|
@ -24,19 +24,19 @@ case $LANG in
|
||||||
;;
|
;;
|
||||||
es*)
|
es*)
|
||||||
TITLE="Menu/Panel lateral"
|
TITLE="Menu/Panel lateral"
|
||||||
ICONS="Icons"
|
ICONS="Iconos"
|
||||||
CIRCLE="Circle icons"
|
CIRCLE="Circle icons"
|
||||||
SQUARE="Square icons"
|
SQUARE="Square icons"
|
||||||
SHOW_ICONS=""
|
SHOW_ICONS="Mostrar iconos"
|
||||||
HIDE_ICONS=""
|
HIDE_ICONS="Ocultar iconos"
|
||||||
SIZE="Tamaño de Menu/Panel lateral"
|
SIZE="Tamaño de Menu/Panel lateral"
|
||||||
TINY="Diminuto"
|
TINY="Diminuto"
|
||||||
SMALL="Pequeño"
|
SMALL="Pequeño"
|
||||||
NORMAL="Normal"
|
NORMAL="Normal"
|
||||||
BIG="Grande"
|
BIG="Grande"
|
||||||
HUGE="Muy Grande"
|
HUGE="Muy Grande"
|
||||||
FONT_FAMILY="Font Family"
|
FONT_FAMILY="Familia tipográfica"
|
||||||
COLOR_SCHEME="Color scheme"
|
COLOR_SCHEME="Esquema de colores"
|
||||||
EDIT_CURRENT="Edit current"
|
EDIT_CURRENT="Edit current"
|
||||||
FOLLOW_OB="Same as OpenBox theme"
|
FOLLOW_OB="Same as OpenBox theme"
|
||||||
CHOOSE="Choose..."
|
CHOOSE="Choose..."
|
||||||
|
@ -97,9 +97,6 @@ out+=("^sep()")
|
||||||
out+=("$FONT_FAMILY,^checkout(fonty)")
|
out+=("$FONT_FAMILY,^checkout(fonty)")
|
||||||
|
|
||||||
case $menu_font_family in
|
case $menu_font_family in
|
||||||
Ubuntu)
|
|
||||||
ub=""
|
|
||||||
;;
|
|
||||||
"Noto Sans Light")
|
"Noto Sans Light")
|
||||||
nol=""
|
nol=""
|
||||||
;;
|
;;
|
||||||
|
@ -127,7 +124,6 @@ esac
|
||||||
|
|
||||||
out2+=("^tag(fonty)")
|
out2+=("^tag(fonty)")
|
||||||
out2+=("^sep($FONT_FAMILY)")
|
out2+=("^sep($FONT_FAMILY)")
|
||||||
out2+=("<span size=\"x-large\" font_family=\"Ubuntu\">$ub Ubuntu</span>,mb-setvar menu_font_family=Ubuntu;mb-jgtools settings")
|
|
||||||
out2+=("<span size=\"x-large\" font_family=\"Noto Sans Light\">$nol Noto Sans Light</span>,mb-setvar \"menu_font_family='Noto Sans Light'\";mb-jgtools settings")
|
out2+=("<span size=\"x-large\" font_family=\"Noto Sans Light\">$nol Noto Sans Light</span>,mb-setvar \"menu_font_family='Noto Sans Light'\";mb-jgtools settings")
|
||||||
out2+=("<span size=\"x-large\" font_family=\"Noto Sans Medium\">$nom Noto Sans Medium</span>,mb-setvar \"menu_font_family='Noto Sans Medium'\";mb-jgtools settings")
|
out2+=("<span size=\"x-large\" font_family=\"Noto Sans Medium\">$nom Noto Sans Medium</span>,mb-setvar \"menu_font_family='Noto Sans Medium'\";mb-jgtools settings")
|
||||||
out2+=("<span size=\"x-large\" font_family=\"JetBrains Mono Regular\">$je JetBrains Mono Regular</span>,mb-setvar \"menu_font_family='JetBrains Mono Regular'\";mb-jgtools settings")
|
out2+=("<span size=\"x-large\" font_family=\"JetBrains Mono Regular\">$je JetBrains Mono Regular</span>,mb-setvar \"menu_font_family='JetBrains Mono Regular'\";mb-jgtools settings")
|
||||||
|
@ -146,14 +142,18 @@ else
|
||||||
out+=("$SHOW_ICONS,mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
|
out+=("$SHOW_ICONS,mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
|
||||||
fi
|
fi
|
||||||
out+=("^sep()")
|
out+=("^sep()")
|
||||||
out+=("$SQUARE,mb-setvar jgmenu_icon_theme=Numix-Square;mb-jgtools settings")
|
out+=("$SQUARE,mb-setvar jgmenu_icon_theme=Numix-Square;mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
|
||||||
out+=("$CIRCLE,mb-setvar jgmenu_icon_theme=Numix-Circle;mb-jgtools settings")
|
out+=("$CIRCLE,mb-setvar jgmenu_icon_theme=Numix-Circle;mb-setvar jgmenu_use_icons=true;mb-jgtools settings")
|
||||||
|
|
||||||
########## THEMES
|
########## THEMES
|
||||||
out+=("^sep($COLOR_SCHEME)")
|
out+=("^sep($COLOR_SCHEME)")
|
||||||
out+=("$CHOOSE,^checkout(motywy)")
|
out+=("$CHOOSE,^checkout(motywy)")
|
||||||
if [ $jgmenu_theme != obtheme ]; then
|
if [ $jgmenu_theme != obtheme ]; then
|
||||||
out+=("$EDIT_CURRENT: (<i>$jgmenu_theme</i>),geany $HOME/.config/mabox/jgobthemes/$jgmenu_theme.colorrc,geany")
|
out+=("$EDIT_CURRENT: (<i>$jgmenu_theme</i>),geany $HOME/.config/mabox/jgobthemes/$jgmenu_theme.colorrc,geany")
|
||||||
|
else
|
||||||
|
ob_file=$HOME/.config/openbox/rc.xml
|
||||||
|
[[ -f $ob_file ]] && wm_theme=$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/)){l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$ob_file")
|
||||||
|
out+=("$EDIT_CURRENT: (<i>$wm_theme</i>),geany $HOME/.config/mabox/jgobthemes/$wm_theme.colorrc,geany")
|
||||||
fi
|
fi
|
||||||
out2+=("^tag(motywy)")
|
out2+=("^tag(motywy)")
|
||||||
out2+=("$FOLLOW_OB,mb-setvar jgmenu_theme=obtheme;mb-jgtools settings
|
out2+=("$FOLLOW_OB,mb-setvar jgmenu_theme=obtheme;mb-jgtools settings
|
||||||
|
|
|
@ -1,125 +0,0 @@
|
||||||
#!/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
|
|
|
@ -1,118 +0,0 @@
|
||||||
#!/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
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
case $LANG in
|
|
||||||
pl*)
|
|
||||||
NOTFOUND="Nie znaleziono pliku recently-used.xbel"
|
|
||||||
CLEAR="Wyczyść ostatnio używane"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
NOTFOUND="Cannot find a readable recently-used.xbel file"
|
|
||||||
CLEAR="Clear recently used file list"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# 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="'$NOTFOUND'" />
|
|
||||||
</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}'">
|
|
||||||
<action name="Execute">
|
|
||||||
<command>
|
|
||||||
''"$0"'' --clear
|
|
||||||
</command>
|
|
||||||
</action>
|
|
||||||
</item>
|
|
||||||
</openbox_pipe_menu>
|
|
||||||
'
|
|
||||||
printf '%s' "$output" # printf because echo sometimes eats backslashes
|
|
|
@ -1,71 +0,0 @@
|
||||||
#!/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>'
|
|
|
@ -1,139 +0,0 @@
|
||||||
#!/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