From 18742cd373aa91828117b7a30913b586eff14906 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Thu, 10 Sep 2020 14:58:34 +0200 Subject: [PATCH] cleanup, update --- usr/bin/jgmenusettings-pipe | 22 ++--- usr/bin/mabox-dropbox-pipemenu | 125 ------------------------ usr/bin/mabox-recent-files-pipemenu | 118 ----------------------- usr/bin/mabox-sshconfig-pipemenu | 71 -------------- usr/bin/mabox-x-www-browser-pipemenu | 139 --------------------------- 5 files changed, 11 insertions(+), 464 deletions(-) delete mode 100755 usr/bin/mabox-dropbox-pipemenu delete mode 100755 usr/bin/mabox-recent-files-pipemenu delete mode 100755 usr/bin/mabox-sshconfig-pipemenu delete mode 100755 usr/bin/mabox-x-www-browser-pipemenu diff --git a/usr/bin/jgmenusettings-pipe b/usr/bin/jgmenusettings-pipe index 9085534..359c12e 100755 --- a/usr/bin/jgmenusettings-pipe +++ b/usr/bin/jgmenusettings-pipe @@ -24,19 +24,19 @@ case $LANG in ;; es*) TITLE="Menu/Panel lateral" - ICONS="Icons" + ICONS="Iconos" CIRCLE="Circle icons" SQUARE="Square icons" - SHOW_ICONS="" - HIDE_ICONS="" + SHOW_ICONS="Mostrar iconos" + HIDE_ICONS="Ocultar iconos" SIZE="Tamaño de Menu/Panel lateral" TINY="Diminuto" SMALL="Pequeño" NORMAL="Normal" BIG="Grande" HUGE="Muy Grande" - FONT_FAMILY="Font Family" - COLOR_SCHEME="Color scheme" + FONT_FAMILY="Familia tipográfica" + COLOR_SCHEME="Esquema de colores" EDIT_CURRENT="Edit current" FOLLOW_OB="Same as OpenBox theme" CHOOSE="Choose..." @@ -97,9 +97,6 @@ out+=("^sep()") out+=("$FONT_FAMILY,^checkout(fonty)") case $menu_font_family in - Ubuntu) - ub="" - ;; "Noto Sans Light") nol="" ;; @@ -127,7 +124,6 @@ esac out2+=("^tag(fonty)") out2+=("^sep($FONT_FAMILY)") -out2+=("$ub Ubuntu,mb-setvar menu_font_family=Ubuntu;mb-jgtools settings") out2+=("$nol Noto Sans Light,mb-setvar \"menu_font_family='Noto Sans Light'\";mb-jgtools settings") out2+=("$nom Noto Sans Medium,mb-setvar \"menu_font_family='Noto Sans Medium'\";mb-jgtools settings") out2+=("$je JetBrains Mono Regular,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") fi out+=("^sep()") -out+=("$SQUARE,mb-setvar jgmenu_icon_theme=Numix-Square;mb-jgtools settings") -out+=("$CIRCLE,mb-setvar jgmenu_icon_theme=Numix-Circle;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-setvar jgmenu_use_icons=true;mb-jgtools settings") ########## THEMES out+=("^sep($COLOR_SCHEME)") out+=("$CHOOSE,^checkout(motywy)") if [ $jgmenu_theme != obtheme ]; then out+=("$EDIT_CURRENT: ($jgmenu_theme),geany $HOME/.config/mabox/jgobthemes/$jgmenu_theme.colorrc,geany") +else +ob_file=$HOME/.config/openbox/rc.xml +[[ -f $ob_file ]] && wm_theme=$(awk '// {while (getline n) {if (match(n, //)){l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$ob_file") +out+=("$EDIT_CURRENT: ($wm_theme),geany $HOME/.config/mabox/jgobthemes/$wm_theme.colorrc,geany") fi out2+=("^tag(motywy)") out2+=("$FOLLOW_OB,mb-setvar jgmenu_theme=obtheme;mb-jgtools settings diff --git a/usr/bin/mabox-dropbox-pipemenu b/usr/bin/mabox-dropbox-pipemenu deleted file mode 100755 index 223efd0..0000000 --- a/usr/bin/mabox-dropbox-pipemenu +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -# -------------------------------------------------------------------- -# An Openbox pipemenu for use with Dropbox and CrunchBang Linux. -# Written for CrunchBang Linux -# by Philip Newborough (aka corenominal) -# Ported to #!++ -# by Ben Young -# Ported to Manjaro -# by Daniel Napora -# -------------------------------------------------------------------- - -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 diff --git a/usr/bin/mabox-recent-files-pipemenu b/usr/bin/mabox-recent-files-pipemenu deleted file mode 100755 index 2586832..0000000 --- a/usr/bin/mabox-recent-files-pipemenu +++ /dev/null @@ -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 #!++ -# by Ben Young -# Ported to Manjaro -# by Daniel Napora - -# Usage: add -# -# 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 ' - -' - exit 1 -fi - -# if argument is --clear, empty .recently-used.xbel -[ "$1" = '--clear' ] && { - cat <<':EOF' > "${file_path}" - - - -:EOF - exit -} - -maximum_entries=$((maximum_entries+2)) - -pre=' - ' -post=' - ' - -files=$( tac "${file_path}" | awk -v MAX="$maximum_entries" -v PR="$pre" -v MI="$mid" -v PO="$post" 'BEGIN { - RS=""; - FS=""; -} -(NR == MAX) {exit} -!/ - - - - ''"$0"'' --clear - - - - -' -printf '%s' "$output" # printf because echo sometimes eats backslashes diff --git a/usr/bin/mabox-sshconfig-pipemenu b/usr/bin/mabox-sshconfig-pipemenu deleted file mode 100755 index ac7507f..0000000 --- a/usr/bin/mabox-sshconfig-pipemenu +++ /dev/null @@ -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 '\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 '' - print ' ' - print ' ' - print ' ' - print ' lxterminal -e "ssh '+user+port[0]+h['hostname']+'"' - print ' ' - print ' ' - print ' \n' - print ' ' - print ' ' - print ' ' - print ' pcmanfm ssh://'+h['hostname']+port[1] - print ' ' - print ' ' - print ' \n' - print '\n' - print '\n' - -print '' -print ' ' -print ' ' -print ' geany ~/.ssh/config' -print ' ' -print ' ' -print '\n' - -print '' diff --git a/usr/bin/mabox-x-www-browser-pipemenu b/usr/bin/mabox-x-www-browser-pipemenu deleted file mode 100755 index 674e0ab..0000000 --- a/usr/bin/mabox-x-www-browser-pipemenu +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------- -# Written for CrunchBang Linux -# by Philip Newborough (aka corenominal) -# Ported to #!++ -# by Ben Young -# Ported to Manjaro -# by Daniel Napora -# --------------------------------------------------------------------- - - -# 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