make wallpapers do The Right Thing (tm)
This commit is contained in:
parent
9e259590a2
commit
c52a84a170
5 changed files with 71 additions and 69 deletions
|
@ -1,5 +1,8 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 1.1
|
Changes for 1.1
|
||||||
|
*08/08/06:
|
||||||
|
* Automatically restore the previous background on startup (Mark)
|
||||||
|
RootTheme.cc/hh util/fbsetbg startfluxbox.in
|
||||||
*08/08/05:
|
*08/08/05:
|
||||||
* Fixed Focus key command (Mark)
|
* Fixed Focus key command (Mark)
|
||||||
CurrentWindowCmd.cc/hh FocusableList.cc/hh
|
CurrentWindowCmd.cc/hh FocusableList.cc/hh
|
||||||
|
|
|
@ -150,7 +150,8 @@ RootTheme::RootTheme(FbTk::ImageControl &image_control):
|
||||||
FbTk::Theme(image_control.screenNumber()),
|
FbTk::Theme(image_control.screenNumber()),
|
||||||
m_background(new BackgroundItem(*this, "background", "Background")),
|
m_background(new BackgroundItem(*this, "background", "Background")),
|
||||||
m_opgc(RootWindow(FbTk::App::instance()->display(), image_control.screenNumber())),
|
m_opgc(RootWindow(FbTk::App::instance()->display(), image_control.screenNumber())),
|
||||||
m_image_ctrl(image_control) {
|
m_image_ctrl(image_control),
|
||||||
|
m_first(true) {
|
||||||
|
|
||||||
Display *disp = FbTk::App::instance()->display();
|
Display *disp = FbTk::App::instance()->display();
|
||||||
m_opgc.setForeground(WhitePixel(disp, screenNum())^BlackPixel(disp, screenNum()));
|
m_opgc.setForeground(WhitePixel(disp, screenNum())^BlackPixel(disp, screenNum()));
|
||||||
|
@ -183,10 +184,6 @@ void RootTheme::reconfigTheme() {
|
||||||
if (!m_background->changed())
|
if (!m_background->changed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// style doesn't wish to change the background
|
|
||||||
if (strstr(m_background->options().c_str(), "none") != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Else parse background from style
|
// Else parse background from style
|
||||||
//
|
//
|
||||||
|
@ -197,37 +194,35 @@ void RootTheme::reconfigTheme() {
|
||||||
std::string filename = m_background->filename();
|
std::string filename = m_background->filename();
|
||||||
FbTk::StringUtil::removeTrailingWhitespace(filename);
|
FbTk::StringUtil::removeTrailingWhitespace(filename);
|
||||||
FbTk::StringUtil::removeFirstWhitespace(filename);
|
FbTk::StringUtil::removeFirstWhitespace(filename);
|
||||||
|
|
||||||
// if background argument is a file then
|
// if background argument is a file then
|
||||||
// parse image options and call image setting
|
// parse image options and call image setting
|
||||||
// command specified in the resources
|
// command specified in the resources
|
||||||
filename = FbTk::StringUtil::expandFilename(filename);
|
filename = FbTk::StringUtil::expandFilename(filename);
|
||||||
if (FbTk::FileUtil::isRegularFile(filename.c_str())) {
|
std::string cmd = realProgramName("fbsetbg") + (m_first ? " -z " : " -Z ");
|
||||||
|
|
||||||
|
// style doesn't wish to change the background
|
||||||
|
if (strstr(m_background->options().c_str(), "none") != 0) {
|
||||||
|
if (!m_first)
|
||||||
|
return;
|
||||||
|
} else if (FbTk::FileUtil::isRegularFile(filename.c_str())) {
|
||||||
// parse options
|
// parse options
|
||||||
std::string options = "-F ";
|
|
||||||
if (strstr(m_background->options().c_str(), "tiled") != 0)
|
if (strstr(m_background->options().c_str(), "tiled") != 0)
|
||||||
options = "-T ";
|
cmd += "-t ";
|
||||||
if (strstr(m_background->options().c_str(), "centered") != 0)
|
else if (strstr(m_background->options().c_str(), "centered") != 0)
|
||||||
options = "-C ";
|
cmd += "-c ";
|
||||||
if (strstr(m_background->options().c_str(), "aspect") != 0)
|
else if (strstr(m_background->options().c_str(), "aspect") != 0)
|
||||||
options = "-A ";
|
cmd += "-a ";
|
||||||
|
else
|
||||||
// compose wallpaper application "fbsetbg" with argumetns
|
cmd += "-f ";
|
||||||
std::string commandargs = realProgramName("fbsetbg") + " " + options +
|
|
||||||
filename;
|
|
||||||
|
|
||||||
// call command with options
|
|
||||||
FbCommands::ExecuteCmd exec(commandargs, screenNum());
|
|
||||||
exec.execute();
|
|
||||||
|
|
||||||
|
cmd += filename;
|
||||||
} else if (FbTk::FileUtil::isDirectory(filename.c_str()) &&
|
} else if (FbTk::FileUtil::isDirectory(filename.c_str()) &&
|
||||||
strstr(m_background->options().c_str(), "random") != 0) {
|
strstr(m_background->options().c_str(), "random") != 0) {
|
||||||
std::string commandargs = realProgramName("fbsetbg") + " -R " +
|
cmd += "-r " + filename;
|
||||||
filename;
|
|
||||||
FbCommands::ExecuteCmd exec(commandargs, screenNum());
|
|
||||||
exec.execute();
|
|
||||||
} else {
|
} else {
|
||||||
// render normal texture with fbsetroot
|
// render normal texture with fbsetroot
|
||||||
|
cmd += "-b ";
|
||||||
|
|
||||||
// Make sure the color strings are valid,
|
// Make sure the color strings are valid,
|
||||||
// so we dont pass any `commands` that can be executed
|
// so we dont pass any `commands` that can be executed
|
||||||
|
@ -240,23 +235,26 @@ void RootTheme::reconfigTheme() {
|
||||||
|
|
||||||
std::string options;
|
std::string options;
|
||||||
if (color_valid)
|
if (color_valid)
|
||||||
options += "-foreground '" + m_background->colorString() + "' ";
|
cmd += "-foreground '" + m_background->colorString() + "' ";
|
||||||
if (color_to_valid)
|
if (color_to_valid)
|
||||||
options += "-background '" + m_background->colorToString() + "' ";
|
cmd += "-background '" + m_background->colorToString() + "' ";
|
||||||
|
|
||||||
if (strstr(m_background->options().c_str(), "mod") != 0)
|
if (strstr(m_background->options().c_str(), "mod") != 0)
|
||||||
options += "-mod " + m_background->modX() + " " + m_background->modY();
|
cmd += "-mod " + m_background->modX() + " " + m_background->modY();
|
||||||
else if ((*m_background)->type() & FbTk::Texture::SOLID && color_valid)
|
else if ((*m_background)->type() & FbTk::Texture::SOLID && color_valid)
|
||||||
options += "-solid '" + m_background->colorString() + "' ";
|
cmd += "-solid '" + m_background->colorString() + "' ";
|
||||||
|
|
||||||
else if ((*m_background)->type() & FbTk::Texture::GRADIENT) {
|
else if ((*m_background)->type() & FbTk::Texture::GRADIENT) {
|
||||||
options += "-gradient '" + m_background->options() + "'";
|
// remove whitespace from the options, since fbsetroot doesn't care
|
||||||
|
// and dealing with sh and fbsetbg is impossible if we don't
|
||||||
|
std::string options = m_background->options();
|
||||||
|
options = FbTk::StringUtil::replaceString(options, " ", "");
|
||||||
|
options = FbTk::StringUtil::replaceString(options, "\t", "");
|
||||||
|
cmd += "-gradient " + options;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string commandargs = realProgramName("fbsetroot") + " " + options;
|
// call command with options
|
||||||
|
FbCommands::ExecuteCmd exec(cmd, screenNum());
|
||||||
FbCommands::ExecuteCmd exec(commandargs, screenNum());
|
m_first = false;
|
||||||
exec.execute();
|
exec.execute();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ private:
|
||||||
BackgroundItem *m_background;///< background image/texture
|
BackgroundItem *m_background;///< background image/texture
|
||||||
FbTk::GContext m_opgc;
|
FbTk::GContext m_opgc;
|
||||||
FbTk::ImageControl &m_image_ctrl; ///< image control for rendering background texture
|
FbTk::ImageControl &m_image_ctrl; ///< image control for rendering background texture
|
||||||
|
bool m_first;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ROOTTHEME_HH
|
#endif // ROOTTHEME_HH
|
||||||
|
|
39
util/fbsetbg
39
util/fbsetbg
|
@ -155,14 +155,14 @@ remembercommand() {
|
||||||
grep -vs "|${DISPLAY}$" ${lastwallpaper} > ${lastwallpaper}.tmp
|
grep -vs "|${DISPLAY}$" ${lastwallpaper} > ${lastwallpaper}.tmp
|
||||||
mv -f ${lastwallpaper}.tmp ${lastwallpaper}
|
mv -f ${lastwallpaper}.tmp ${lastwallpaper}
|
||||||
if [ "$option" = fbsetroot ]; then
|
if [ "$option" = fbsetroot ]; then
|
||||||
echo $option"|$wallpaper|"$DISPLAY >> $lastwallpaper
|
echo $option"|$wallpaper|$style|"$DISPLAY >> $lastwallpaper
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
# Make dir/../../path/file.jpg work
|
# Make dir/../../path/file.jpg work
|
||||||
case $wallpaper in
|
case $wallpaper in
|
||||||
# no spaces allowed between the varname and '|'
|
# no spaces allowed between the varname and '|'
|
||||||
/*) echo $option $option2"|$wallpaper|"$DISPLAY >> $lastwallpaper ;;
|
/*) echo $option $option2"|$wallpaper|$style|"$DISPLAY >> $lastwallpaper ;;
|
||||||
*) echo $option $option2"|$PWD/$wallpaper|"$DISPLAY >> $lastwallpaper ;;
|
*) echo $option $option2"|$PWD/$wallpaper|$style|"$DISPLAY >> $lastwallpaper ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,13 +252,11 @@ while [ $# -gt 0 ]; do
|
||||||
-b) option=fbsetroot
|
-b) option=fbsetroot
|
||||||
shift
|
shift
|
||||||
wallpaper=$*
|
wallpaper=$*
|
||||||
use_fbsetroot
|
|
||||||
break ;;
|
break ;;
|
||||||
-B) option=fbsetroot
|
-B) option=fbsetroot
|
||||||
shift
|
shift
|
||||||
wallpaper=$*
|
wallpaper=$*
|
||||||
remember=false
|
remember=false
|
||||||
use_fbsetroot
|
|
||||||
break ;;
|
break ;;
|
||||||
-r) option2=$option
|
-r) option2=$option
|
||||||
option=random
|
option=random
|
||||||
|
@ -285,15 +283,36 @@ while [ $# -gt 0 ]; do
|
||||||
message "No previous wallpaper recorded for display ${DISPLAY}"
|
message "No previous wallpaper recorded for display ${DISPLAY}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$option" = "fbsetroot" ]; then
|
|
||||||
use_fbsetroot
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
message "No previous wallpaper recorded for display ${DISPLAY}"
|
message "No previous wallpaper recorded for display ${DISPLAY}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
remember=false
|
remember=false
|
||||||
break ;;
|
break ;;
|
||||||
|
-z)
|
||||||
|
if [ -r "$lastwallpaper" ]; then
|
||||||
|
option=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f1`
|
||||||
|
option2=`echo $option|cut -d' ' -f2`
|
||||||
|
option=`echo $option|cut -d' ' -f1`
|
||||||
|
style=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f3`
|
||||||
|
wallpaper=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f2`
|
||||||
|
if [ -z "$wallpaper" ]; then
|
||||||
|
option=`grep "|${DISPLAY}.0$" $lastwallpaper|cut -d'|' -f1`
|
||||||
|
option2=`echo $option|cut -d' ' -f2`
|
||||||
|
option=`echo $option|cut -d' ' -f1`
|
||||||
|
style=`grep "|${DISPLAY}.0$" $lastwallpaper|cut -d'|' -f3`
|
||||||
|
wallpaper=`grep "|${DISPLAY}.0$" $lastwallpaper|cut -d'|' -f2`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$style" != "style" -a -n "$wallpaper" ]; then
|
||||||
|
remember=false
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
style="style"
|
||||||
|
shift ;;
|
||||||
|
-Z)
|
||||||
|
style="style"
|
||||||
|
shift ;;
|
||||||
-p) display_tips ; exit 0 ;;
|
-p) display_tips ; exit 0 ;;
|
||||||
-h) display_help ; exit 0 ;;
|
-h) display_help ; exit 0 ;;
|
||||||
--)
|
--)
|
||||||
|
@ -323,6 +342,10 @@ while [ $# -gt 0 ]; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$option" = "fbsetroot" ]; then
|
||||||
|
use_fbsetroot
|
||||||
|
fi
|
||||||
|
|
||||||
# Find the default wallpapersetter
|
# Find the default wallpapersetter
|
||||||
if [ "$setterfromcommandline" != true ]; then
|
if [ "$setterfromcommandline" != true ]; then
|
||||||
if [ -r "$lastwallpaper" ]; then
|
if [ -r "$lastwallpaper" ]; then
|
||||||
|
|
|
@ -39,30 +39,8 @@ else
|
||||||
#
|
#
|
||||||
# Lines starting with a '#' are ignored.
|
# Lines starting with a '#' are ignored.
|
||||||
|
|
||||||
# This sets a black background
|
|
||||||
|
|
||||||
@pkgprefix@fbsetroot@pkgsuffix@ -solid black
|
|
||||||
|
|
||||||
# You can set your favourite wallpaper here. You will also need to uncomment the
|
|
||||||
# line in $HOME/.@pkgprefix@fluxbox@pkgsuffix@/overlay or else your style will override it.
|
|
||||||
#
|
|
||||||
# @pkgprefix@fbsetbg@pkgsuffix@ -f $HOME/.@pkgprefix@fluxbox@pkgsuffix@/backgrounds/wallpaper.png
|
|
||||||
|
|
||||||
# Other examples. Check man xset for details.
|
|
||||||
#
|
|
||||||
# Turn off beeps:
|
|
||||||
# xset -b
|
|
||||||
#
|
|
||||||
# Increase the keyboard repeat-rate:
|
|
||||||
# xset r rate 195 35
|
|
||||||
#
|
|
||||||
# Your own fonts-dir:
|
|
||||||
# xset +fp "$HOME/.fonts"
|
|
||||||
#
|
|
||||||
# Change your keymap:
|
# Change your keymap:
|
||||||
# xmodmap "$HOME/.Xmodmap"
|
xmodmap "$HOME/.Xmodmap"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Applications you want to run with fluxbox.
|
# Applications you want to run with fluxbox.
|
||||||
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END.
|
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END.
|
||||||
|
|
Loading…
Reference in a new issue