update from Han

This commit is contained in:
fluxgen 2003-08-17 13:30:35 +00:00
parent d101fdb770
commit 5baf2304df
2 changed files with 75 additions and 36 deletions

View file

@ -23,20 +23,26 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
# $Id: fbsetbg,v 1.14 2003/08/04 16:49:25 fluxgen Exp $ # $Id: fbsetbg,v 1.15 2003/08/17 13:27:44 fluxgen Exp $
#
# Portability notes: # Portability notes:
# To guarantee this script works on all platforms that support fluxbox # To guarantee this script works on all platforms that support fluxbox
# please keep the following restrictions in mind: # please keep the following restrictions in mind:
# #
# don't use [ -e file ], use [ -r file ] # - don't use if ! command;, use command; if [ $? -ne 0 ];
# don't use $(), use `` # - don't use [ -e file ] use [ -r file ]
# don't use ~, use ${HOME} # - don't use $(), use ``
# don't use id -u, use whoami # - don't use ~, use ${HOME}
# getopts won't work on all platforms, but the config-file can # - don't use id -u, use whoami
# compensate for that. # - getopts won't work on all platforms, but the config-file can
# # compensate for that.
# - various software like grep/sed/perl may be not present or not
# the version you have. for example grep '\W' only works on gnu-grep.
# Keep this in mind, use bare basic defaults.
# - Do _NOT_ suggest to use #!/bin/bash. Not everybody uses bash.
# Non portable features like getopts in this script can be achieved in
# other ways.
# The wallpapersetter is selected in this order # The wallpapersetter is selected in this order
wpsetters='chbg Esetroot wmsetbg display qiv xv xsri xli xsetbg' # broken icewmbg' wpsetters='chbg Esetroot wmsetbg display qiv xv xsri xli xsetbg' # broken icewmbg'
@ -50,7 +56,7 @@ WHOAMI=`whoami`
# Functions # Functions
display_usage() { display_usage() {
cat << EOF cat << EOF
Usage: fbsetbg [ -fcta /path/to/wallpaper ] [ -l ] [ -h ] [ -d ] Usage: fbsetbg [ -fFcCtTaA /path/to/wallpaper ] [ -l ] [ -h ] [ -d ] [ -p ]
EOF EOF
} }
@ -67,49 +73,63 @@ Options:
( if your bgsetter doesn't support this ( if your bgsetter doesn't support this
fbsetbg falls back to -f ) fbsetbg falls back to -f )
-F,-C,-T,-A same as uncapsed but without remembering.
-h Display this help -h Display this help
-l Set previous wallpaper -l Set previous wallpaper
-d Debug fbsetbg -d Debug fbsetbg
-T Tips -p Tips
Files: Files:
In this file the wallpaper you set will be stored, for the -l option:
~/.fluxbox/lastwallpaper ~/.fluxbox/lastwallpaper
EOF EOF
} }
display_tips(){ display_tips() {
cat<< EOF cat << EOF
To replace all occurrences of bsetbg in a file use this command: 1) To replace all occurrences of bsetbg in a file use this command:
perl -pi -e 's,([^f]|^)bsetbg,fbsetbg,' filename perl -pi -e 's,([^f]|^)bsetbg,fbsetbg,' filename
If you want the style to set the wallpaper and you want fbsetbg to 2) If you want the style to set the wallpaper and you want fbsetbg to
remember the previous wallpaper put this in your ~/.fluxbox/init remember the previous wallpaper put this in your ~/.fluxbox/init
session.screen0.rootCommand: fbsetbg -l session.screen0.rootCommand: fbsetbg -l
3) Use fbsetbg -d to find out what wallpapersetter fbsetbg will use and
what he thinks about it.
EOF EOF
} }
# ugly code for solaris compat. # ugly code for solaris compat.
find_it() { case `uname` in
file=`which $1 2> /dev/null` Linux|*BSD)
if [ -x "$file" ]; then find_it() {
if [ $# -gt 1 ]; then which $1 > /dev/null 2>&1 && shift && $*
shift }
$* ;;
fi *)
return 0 find_it() {
else file=`which $1 2> /dev/null`
return 1 if [ -x "$file" ]; then
fi if [ $# -gt 1 ]; then
} shift
$*
fi
return 0
else
return 1
fi
}
;;
esac
message() { message() {
xmessage -center "$@" xmessage -center "$@"
@ -126,7 +146,7 @@ remembercommand() {
esac esac
} }
debugfbsetbg (){ debugfbsetbg() {
echo echo
echo $debugstory echo $debugstory
echo echo
@ -232,7 +252,7 @@ recommend you install the package provided by your distro."
esac esac
#Get options. #Get options.
getopts ":a:f:c:t:Tdlh-" COMMAND_LINE_ARGUMENT getopts ":a:f:c:t:A:F:C:T:pdlh-" COMMAND_LINE_ARGUMENT
case "${COMMAND_LINE_ARGUMENT}" in case "${COMMAND_LINE_ARGUMENT}" in
d) debugfbsetbg d) debugfbsetbg
exit 0 exit 0
@ -249,6 +269,23 @@ case "${COMMAND_LINE_ARGUMENT}" in
t) option=$tile t) option=$tile
wallpaper=$OPTARG wallpaper=$OPTARG
;; ;;
A) option=$aspect
wallpaper=$OPTARG
remember=false
;;
F) option=$full
wallpaper=$OPTARG
remember=false
;;
C) option=$center
wallpaper=$OPTARG
remember=false
;;
T) option=$tile
wallpaper=$OPTARG
remember=false
;;
l) l)
if [ -r $lastwallpaper ]; then if [ -r $lastwallpaper ]; then
option=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f1` option=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f1`
@ -260,7 +297,7 @@ case "${COMMAND_LINE_ARGUMENT}" in
remember=false remember=false
;; ;;
h) display_help ; exit 0 ;; h) display_help ; exit 0 ;;
T) display_tips ; exit 0 ;; p) display_tips ; exit 0 ;;
-) echo "fbsetbg doesn't recognize -- gnu-longopts." -) echo "fbsetbg doesn't recognize -- gnu-longopts."
echo 'Use fbsetbg -h for a long help message.' echo 'Use fbsetbg -h for a long help message.'
display_usage display_usage
@ -292,3 +329,5 @@ $WPSETTER $option "$wallpaper" || message "Something went wrong while setting th
Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what." Run '$WPSETTER $option "$wallpaper"' from an xterm to find out what."
#remember previous wallpaper #remember previous wallpaper
[ ! "$remember" = false ] && remembercommand [ ! "$remember" = false ] && remembercommand
# Off course this returns 1 most of the time.
exit 0

View file

@ -22,7 +22,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE. # DEALINGS IN THE SOFTWARE.
# #
# $Id: fluxbox-generate_menu,v 1.49 2003/08/07 10:35:19 fluxgen Exp $ # $Id: fluxbox-generate_menu,v 1.50 2003/08/17 13:30:35 fluxgen Exp $
# #
# Portability notes: # Portability notes:
@ -769,7 +769,7 @@ append_menu_end
append_submenu "${NETMENU}" append_submenu "${NETMENU}"
append_submenu "${BROWSERMENU}" append_submenu "${BROWSERMENU}"
normal_find netscape galeon mozilla dillo normal_find mozilla-firebird netscape galeon mozilla dillo
find_it opera append "[exec] (opera) {env QT_XFT=true opera}" find_it opera append "[exec] (opera) {env QT_XFT=true opera}"
find_it konqueror append "[exec] (konqueror) {kfmclient openProfile webbrowsing}" find_it konqueror append "[exec] (konqueror) {kfmclient openProfile webbrowsing}"
find_it links append "[exec] (links) {${DEFAULT_TERM} -e links ${HOMEPAGE}}" find_it links append "[exec] (links) {${DEFAULT_TERM} -e links ${HOMEPAGE}}"