aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-06 06:40:18 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-06 06:40:18 (GMT)
commitc52a84a1704a2963b3d454a43617d8911778fb72 (patch)
tree256f5d56ab4e19912661e383fc645de57f642432
parent9e259590a2a59b89471bf3f42366c2209c69bf9c (diff)
downloadfluxbox-c52a84a1704a2963b3d454a43617d8911778fb72.zip
fluxbox-c52a84a1704a2963b3d454a43617d8911778fb72.tar.bz2
make wallpapers do The Right Thing (tm)
-rw-r--r--ChangeLog3
-rw-r--r--src/RootTheme.cc74
-rw-r--r--src/RootTheme.hh2
-rw-r--r--util/fbsetbg39
-rwxr-xr-xutil/startfluxbox.in24
5 files changed, 72 insertions, 70 deletions
diff --git a/ChangeLog b/ChangeLog
index f5020fc..8a6a8f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.1 2Changes for 1.1
3*08/08/06:
4 * Automatically restore the previous background on startup (Mark)
5 RootTheme.cc/hh util/fbsetbg startfluxbox.in
3*08/08/05: 6*08/08/05:
4 * Fixed Focus key command (Mark) 7 * Fixed Focus key command (Mark)
5 CurrentWindowCmd.cc/hh FocusableList.cc/hh 8 CurrentWindowCmd.cc/hh FocusableList.cc/hh
diff --git a/src/RootTheme.cc b/src/RootTheme.cc
index 617c3d5..c09957f 100644
--- a/src/RootTheme.cc
+++ b/src/RootTheme.cc
@@ -150,7 +150,8 @@ RootTheme::RootTheme(FbTk::ImageControl &image_control):
150 FbTk::Theme(image_control.screenNumber()), 150 FbTk::Theme(image_control.screenNumber()),
151 m_background(new BackgroundItem(*this, "background", "Background")), 151 m_background(new BackgroundItem(*this, "background", "Background")),
152 m_opgc(RootWindow(FbTk::App::instance()->display(), image_control.screenNumber())), 152 m_opgc(RootWindow(FbTk::App::instance()->display(), image_control.screenNumber())),
153 m_image_ctrl(image_control) { 153 m_image_ctrl(image_control),
154 m_first(true) {
154 155
155 Display *disp = FbTk::App::instance()->display(); 156 Display *disp = FbTk::App::instance()->display();
156 m_opgc.setForeground(WhitePixel(disp, screenNum())^BlackPixel(disp, screenNum())); 157 m_opgc.setForeground(WhitePixel(disp, screenNum())^BlackPixel(disp, screenNum()));
@@ -183,10 +184,6 @@ void RootTheme::reconfigTheme() {
183 if (!m_background->changed()) 184 if (!m_background->changed())
184 return; 185 return;
185 186
186 // style doesn't wish to change the background
187 if (strstr(m_background->options().c_str(), "none") != 0)
188 return;
189
190 // 187 //
191 // Else parse background from style 188 // Else parse background from style
192 // 189 //
@@ -197,37 +194,35 @@ void RootTheme::reconfigTheme() {
197 std::string filename = m_background->filename(); 194 std::string filename = m_background->filename();
198 FbTk::StringUtil::removeTrailingWhitespace(filename); 195 FbTk::StringUtil::removeTrailingWhitespace(filename);
199 FbTk::StringUtil::removeFirstWhitespace(filename); 196 FbTk::StringUtil::removeFirstWhitespace(filename);
197
200 // if background argument is a file then 198 // if background argument is a file then
201 // parse image options and call image setting 199 // parse image options and call image setting
202 // command specified in the resources 200 // command specified in the resources
203 filename = FbTk::StringUtil::expandFilename(filename); 201 filename = FbTk::StringUtil::expandFilename(filename);
204 if (FbTk::FileUtil::isRegularFile(filename.c_str())) { 202 std::string cmd = realProgramName("fbsetbg") + (m_first ? " -z " : " -Z ");
203
204 // style doesn't wish to change the background
205 if (strstr(m_background->options().c_str(), "none") != 0) {
206 if (!m_first)
207 return;
208 } else if (FbTk::FileUtil::isRegularFile(filename.c_str())) {
205 // parse options 209 // parse options
206 std::string options = "-F ";
207 if (strstr(m_background->options().c_str(), "tiled") != 0) 210 if (strstr(m_background->options().c_str(), "tiled") != 0)
208 options = "-T "; 211 cmd += "-t ";
209 if (strstr(m_background->options().c_str(), "centered") != 0) 212 else if (strstr(m_background->options().c_str(), "centered") != 0)
210 options = "-C "; 213 cmd += "-c ";
211 if (strstr(m_background->options().c_str(), "aspect") != 0) 214 else if (strstr(m_background->options().c_str(), "aspect") != 0)
212 options = "-A "; 215 cmd += "-a ";
213 216 else
214 // compose wallpaper application "fbsetbg" with argumetns 217 cmd += "-f ";
215 std::string commandargs = realProgramName("fbsetbg") + " " + options + 218
216 filename; 219 cmd += filename;
217
218 // call command with options
219 FbCommands::ExecuteCmd exec(commandargs, screenNum());
220 exec.execute();
221
222 } else if (FbTk::FileUtil::isDirectory(filename.c_str()) && 220 } else if (FbTk::FileUtil::isDirectory(filename.c_str()) &&
223 strstr(m_background->options().c_str(), "random") != 0) { 221 strstr(m_background->options().c_str(), "random") != 0) {
224 std::string commandargs = realProgramName("fbsetbg") + " -R " + 222 cmd += "-r " + filename;
225 filename;
226 FbCommands::ExecuteCmd exec(commandargs, screenNum());
227 exec.execute();
228 } else { 223 } else {
229 // render normal texture with fbsetroot 224 // render normal texture with fbsetroot
230 225 cmd += "-b ";
231 226
232 // Make sure the color strings are valid, 227 // Make sure the color strings are valid,
233 // so we dont pass any `commands` that can be executed 228 // so we dont pass any `commands` that can be executed
@@ -240,23 +235,26 @@ void RootTheme::reconfigTheme() {
240 235
241 std::string options; 236 std::string options;
242 if (color_valid) 237 if (color_valid)
243 options += "-foreground '" + m_background->colorString() + "' "; 238 cmd += "-foreground '" + m_background->colorString() + "' ";
244 if (color_to_valid) 239 if (color_to_valid)
245 options += "-background '" + m_background->colorToString() + "' "; 240 cmd += "-background '" + m_background->colorToString() + "' ";
246 241
247 if (strstr(m_background->options().c_str(), "mod") != 0) 242 if (strstr(m_background->options().c_str(), "mod") != 0)
248 options += "-mod " + m_background->modX() + " " + m_background->modY(); 243 cmd += "-mod " + m_background->modX() + " " + m_background->modY();
249 else if ((*m_background)->type() & FbTk::Texture::SOLID && color_valid) 244 else if ((*m_background)->type() & FbTk::Texture::SOLID && color_valid)
250 options += "-solid '" + m_background->colorString() + "' "; 245 cmd += "-solid '" + m_background->colorString() + "' ";
251
252 else if ((*m_background)->type() & FbTk::Texture::GRADIENT) { 246 else if ((*m_background)->type() & FbTk::Texture::GRADIENT) {
253 options += "-gradient '" + m_background->options() + "'"; 247 // remove whitespace from the options, since fbsetroot doesn't care
248 // and dealing with sh and fbsetbg is impossible if we don't
249 std::string options = m_background->options();
250 options = FbTk::StringUtil::replaceString(options, " ", "");
251 options = FbTk::StringUtil::replaceString(options, "\t", "");
252 cmd += "-gradient " + options;
254 } 253 }
255
256 std::string commandargs = realProgramName("fbsetroot") + " " + options;
257
258 FbCommands::ExecuteCmd exec(commandargs, screenNum());
259 exec.execute();
260 } 254 }
261 255
256 // call command with options
257 FbCommands::ExecuteCmd exec(cmd, screenNum());
258 m_first = false;
259 exec.execute();
262} 260}
diff --git a/src/RootTheme.hh b/src/RootTheme.hh
index 5ae5165..09c752c 100644
--- a/src/RootTheme.hh
+++ b/src/RootTheme.hh
@@ -64,7 +64,7 @@ private:
64 BackgroundItem *m_background;///< background image/texture 64 BackgroundItem *m_background;///< background image/texture
65 FbTk::GContext m_opgc; 65 FbTk::GContext m_opgc;
66 FbTk::ImageControl &m_image_ctrl; ///< image control for rendering background texture 66 FbTk::ImageControl &m_image_ctrl; ///< image control for rendering background texture
67 67 bool m_first;
68}; 68};
69 69
70#endif // ROOTTHEME_HH 70#endif // ROOTTHEME_HH
diff --git a/util/fbsetbg b/util/fbsetbg
index 0f38d4c..a12d427 100644
--- a/util/fbsetbg
+++ b/util/fbsetbg
@@ -155,14 +155,14 @@ remembercommand() {
155 grep -vs "|${DISPLAY}$" ${lastwallpaper} > ${lastwallpaper}.tmp 155 grep -vs "|${DISPLAY}$" ${lastwallpaper} > ${lastwallpaper}.tmp
156 mv -f ${lastwallpaper}.tmp ${lastwallpaper} 156 mv -f ${lastwallpaper}.tmp ${lastwallpaper}
157 if [ "$option" = fbsetroot ]; then 157 if [ "$option" = fbsetroot ]; then
158 echo $option"|$wallpaper|"$DISPLAY >> $lastwallpaper 158 echo $option"|$wallpaper|$style|"$DISPLAY >> $lastwallpaper
159 return 159 return
160 fi 160 fi
161 # Make dir/../../path/file.jpg work 161 # Make dir/../../path/file.jpg work
162 case $wallpaper in 162 case $wallpaper in
163 # no spaces allowed between the varname and '|' 163 # no spaces allowed between the varname and '|'
164 /*) echo $option $option2"|$wallpaper|"$DISPLAY >> $lastwallpaper ;; 164 /*) echo $option $option2"|$wallpaper|$style|"$DISPLAY >> $lastwallpaper ;;
165 *) echo $option $option2"|$PWD/$wallpaper|"$DISPLAY >> $lastwallpaper ;; 165 *) echo $option $option2"|$PWD/$wallpaper|$style|"$DISPLAY >> $lastwallpaper ;;
166 esac 166 esac
167} 167}
168 168
@@ -252,13 +252,11 @@ while [ $# -gt 0 ]; do
252 -b) option=fbsetroot 252 -b) option=fbsetroot
253 shift 253 shift
254 wallpaper=$* 254 wallpaper=$*
255 use_fbsetroot
256 break ;; 255 break ;;
257 -B) option=fbsetroot 256 -B) option=fbsetroot
258 shift 257 shift
259 wallpaper=$* 258 wallpaper=$*
260 remember=false 259 remember=false
261 use_fbsetroot
262 break ;; 260 break ;;
263 -r) option2=$option 261 -r) option2=$option
264 option=random 262 option=random
@@ -285,15 +283,36 @@ while [ $# -gt 0 ]; do
285 message "No previous wallpaper recorded for display ${DISPLAY}" 283 message "No previous wallpaper recorded for display ${DISPLAY}"
286 exit 1 284 exit 1
287 fi 285 fi
288 if [ "$option" = "fbsetroot" ]; then
289 use_fbsetroot
290 fi
291 else 286 else
292 message "No previous wallpaper recorded for display ${DISPLAY}" 287 message "No previous wallpaper recorded for display ${DISPLAY}"
293 exit 1 288 exit 1
294 fi 289 fi
295 remember=false 290 remember=false
296 break ;; 291 break ;;
292 -z)
293 if [ -r "$lastwallpaper" ]; then
294 option=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f1`
295 option2=`echo $option|cut -d' ' -f2`
296 option=`echo $option|cut -d' ' -f1`
297 style=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f3`
298 wallpaper=`grep "|${DISPLAY}$" $lastwallpaper|cut -d'|' -f2`
299 if [ -z "$wallpaper" ]; then
300 option=`grep "|${DISPLAY}.0$" $lastwallpaper|cut -d'|' -f1`
301 option2=`echo $option|cut -d' ' -f2`
302 option=`echo $option|cut -d' ' -f1`
303 style=`grep "|${DISPLAY}.0$" $lastwallpaper|cut -d'|' -f3`
304 wallpaper=`grep "|${DISPLAY}.0$" $lastwallpaper|cut -d'|' -f2`
305 fi
306 fi
307 if [ "$style" != "style" -a -n "$wallpaper" ]; then
308 remember=false
309 break
310 fi
311 style="style"
312 shift ;;
313 -Z)
314 style="style"
315 shift ;;
297 -p) display_tips ; exit 0 ;; 316 -p) display_tips ; exit 0 ;;
298 -h) display_help ; exit 0 ;; 317 -h) display_help ; exit 0 ;;
299 --) 318 --)
@@ -323,6 +342,10 @@ while [ $# -gt 0 ]; do
323 esac 342 esac
324done 343done
325 344
345if [ "$option" = "fbsetroot" ]; then
346 use_fbsetroot
347fi
348
326# Find the default wallpapersetter 349# Find the default wallpapersetter
327if [ "$setterfromcommandline" != true ]; then 350if [ "$setterfromcommandline" != true ]; then
328 if [ -r "$lastwallpaper" ]; then 351 if [ -r "$lastwallpaper" ]; then
diff --git a/util/startfluxbox.in b/util/startfluxbox.in
index 64c48e3..3c083f3 100755
--- a/util/startfluxbox.in
+++ b/util/startfluxbox.in
@@ -39,30 +39,8 @@ else
39# 39#
40# Lines starting with a '#' are ignored. 40# Lines starting with a '#' are ignored.
41 41
42# This sets a black background
43
44@pkgprefix@fbsetroot@pkgsuffix@ -solid black
45
46# You can set your favourite wallpaper here. You will also need to uncomment the
47# line in $HOME/.@pkgprefix@fluxbox@pkgsuffix@/overlay or else your style will override it.
48#
49# @pkgprefix@fbsetbg@pkgsuffix@ -f $HOME/.@pkgprefix@fluxbox@pkgsuffix@/backgrounds/wallpaper.png
50
51# Other examples. Check man xset for details.
52#
53# Turn off beeps:
54# xset -b
55#
56# Increase the keyboard repeat-rate:
57# xset r rate 195 35
58#
59# Your own fonts-dir:
60# xset +fp "$HOME/.fonts"
61#
62# Change your keymap: 42# Change your keymap:
63# xmodmap "$HOME/.Xmodmap" 43xmodmap "$HOME/.Xmodmap"
64
65
66 44
67# Applications you want to run with fluxbox. 45# Applications you want to run with fluxbox.
68# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END. 46# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END.