Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
linux:fluxbox [2006/12/16 13:31] cyril |
linux:fluxbox [2013/09/19 16:40] (current) |
| |
Fluxbox is a very light window manager, highly customizable (look, shortcuts, etc). | Fluxbox is a very light window manager, highly customizable (look, shortcuts, etc). |
| |
| ===== Links ===== |
| |
| Installation guide for Gentoo :\\ |
| [EN] [[http://www.gentoo.org/doc/en/fluxbox-config.xml]]\\ |
| [FR] [[http://www.gentoo.org/doc/fr/fluxbox-config.xml]] |
| |
===== Control your sound card with the keyboard and xosd ===== | ===== Control your sound card with the keyboard and xosd ===== |
| |
<code> | <code> |
| # mute Master and PCM |
Mod4 m :MacroCmd {ExecCommand amixer sset Master toggle} {ExecCommand amixer sset PCM toggle} {Exec sleep .1s} {Exec echo "Sound `amixer sget Master volume | grep Left: | cut -f 8 -d " "`" | osd_cat -d 1 -p middle -A center -s 1 -u blue -O5} | Mod4 m :MacroCmd {ExecCommand amixer sset Master toggle} {ExecCommand amixer sset PCM toggle} {Exec sleep .1s} {Exec echo "Sound `amixer sget Master volume | grep Left: | cut -f 8 -d " "`" | osd_cat -d 1 -p middle -A center -s 1 -u blue -O5} |
Mod4 Shift m :MacroCmd {ExecCommand amixer sset PCM toggle} {Exec sleep .1s} {Exec echo "Sound PCM `amixer sget Master volume | grep Left: | cut -f 8 -d " "`" | osd_cat -d 1 -p middle -A center -s 1 -u blue -O5} | Mod4 Shift m :MacroCmd {ExecCommand amixer sset PCM toggle} {Exec sleep .1s} {Exec echo "Sound PCM `amixer sget Master volume | grep Left: | cut -f 8 -d " "`" | osd_cat -d 1 -p middle -A center -s 1 -u blue -O5} |
| |
| #volume Master |
Mod4 o :MacroCmd {ExecCommand amixer sset Master 1+} {Exec sleep .1s} {Exec osd_cat -d 1 -p middle -A center -s 1 -u blue -O 6 -b percentage -P `amixer sget Master volume | grep Left: | cut -f 7 -d " " | cut -c 2-4` -T "Master: `amixer sget Master volume | grep Left: | cut -c 24-50`"} | Mod4 o :MacroCmd {ExecCommand amixer sset Master 1+} {Exec sleep .1s} {Exec osd_cat -d 1 -p middle -A center -s 1 -u blue -O 6 -b percentage -P `amixer sget Master volume | grep Left: | cut -f 7 -d " " | cut -c 2-4` -T "Master: `amixer sget Master volume | grep Left: | cut -c 24-50`"} |
Mod4 i :MacroCmd {ExecCommand amixer sset Master 1-} {Exec sleep .1s} {Exec osd_cat -d 1 -p middle -A center -s 1 -u blue -O 6 -b percentage -P `amixer sget Master volume | grep Left: | cut -f 7 -d " " | cut -c 2-4` -T "Master: `amixer sget Master volume | grep Left: | cut -c 24-50`"} | Mod4 i :MacroCmd {ExecCommand amixer sset Master 1-} {Exec sleep .1s} {Exec osd_cat -d 1 -p middle -A center -s 1 -u blue -O 6 -b percentage -P `amixer sget Master volume | grep Left: | cut -f 7 -d " " | cut -c 2-4` -T "Master: `amixer sget Master volume | grep Left: | cut -c 24-50`"} |
#Mod4 o :MacroCmd {ExecCommand amixer sset Master 1+} {Exec sleep .1s} {Exec echo Master | osd_cat -d 1 -p middle -A center -s 1 -u blue -O2 -l1} {Exec amixer sget Master volume | grep Left: | cut -c 24-50 | osd_cat -d 1 -p middle -A center -s 1 -u blue -O5 -l2} | |
#Mod4 i :MacroCmd {ExecCommand amixer sset Master 1-} {Exec sleep .1s} {Exec echo Master | osd_cat -d 1 -p middle -A center -s 1 -u blue -O2 -l1} {Exec amixer sget Master volume | grep Left: | cut -c 24-50 | osd_cat -d 1 -p middle -A center -s 1 -u blue -O5 -l2} | #volume PCM |
Mod4 Shift o :MacroCmd {ExecCommand amixer sset PCM 1+} {Exec sleep .1s} {Exec osd_cat -d 1 -p middle -A center -s 1 -u blue -O 6 -b percentage -P `amixer sget PCM volume | grep Left: | cut -f 7 -d " " | cut -c 2-4` -T "PCM: `amixer sget PCM volume | grep Left: | cut -c 24-50`"} | Mod4 Shift o :MacroCmd {ExecCommand amixer sset PCM 1+} {Exec sleep .1s} {Exec osd_cat -d 1 -p middle -A center -s 1 -u blue -O 6 -b percentage -P `amixer sget PCM volume | grep Left: | cut -f 7 -d " " | cut -c 2-4` -T "PCM: `amixer sget PCM volume | grep Left: | cut -c 24-50`"} |
Mod4 Shift i :MacroCmd {ExecCommand amixer sset PCM 1-} {Exec sleep .1s} {Exec osd_cat -d 1 -p middle -A center -s 1 -u blue -O 6 -b percentage -P `amixer sget PCM volume | grep Left: | cut -f 7 -d " " | cut -c 2-4` -T "PCM: `amixer sget PCM volume | grep Left: | cut -c 24-50`"} | Mod4 Shift i :MacroCmd {ExecCommand amixer sset PCM 1-} {Exec sleep .1s} {Exec osd_cat -d 1 -p middle -A center -s 1 -u blue -O 6 -b percentage -P `amixer sget PCM volume | grep Left: | cut -f 7 -d " " | cut -c 2-4` -T "PCM: `amixer sget PCM volume | grep Left: | cut -c 24-50`"} |
#Mod4 Shift o :MacroCmd {ExecCommand amixer sset PCM 1+} {Exec sleep .1s} {Exec echo PCM | osd_cat -d 1 -p middle -A center -s 1 -u blue -O2 -l1} {Exec amixer sget PCM volume | grep Left: | cut -c 24-50 | osd_cat -d 1 -p middle -A center -s 1 -u blue -O5 -l2} | |
#Mod4 Shift i :MacroCmd {ExecCommand amixer sset PCM 1-} {Exec sleep .1s} {Exec echo PCM | osd_cat -d 1 -p middle -A center -s 1 -u blue -O2 -l1} {Exec amixer sget PCM volume | grep Left: | cut -c 24-50 | osd_cat -d 1 -p middle -A center -s 1 -u blue -O5 -l2} | |
| |
Mod4 p :ExecCommand xmms -t | Mod4 p :ExecCommand xmms -t |
| </code> |
| |
| The ''sleep'' command is just used to print the new value after the change. ''cut'' is used to extract the value of the volume for the bar graph. |
| |
| ===== Configure TwinView/Xinerama/DualScreen ===== |
| |
| First, emerge fluxbox with the ''xinerama'' USE flag (and you should compile everything with this flag, so set it in ''/etc/make.conf''). |
| |
| It will work fine, except that your toolbar could be spread on both screens, then change in ''~/.fluxbox/init'' : |
| <code> |
| screen0.toolbar.onhead : 2 |
| </code> |
| |
| If you want to have different settings for the two screens, you can copy all ''screen0'' properties to have ''screen1'' properties too. |
| |
| ===== Apps ===== |
| |
| <code> |
| xprop |
</code> | </code> |
| |
Instead of shading the window. | Instead of shading the window. |
| |
For that, you have to modify the source code of fluxbox. Of course, it is easier if you use a source distribution such as Gentoo ([[linux:gentoo-portage|here]] is explained how to emerge a package and modify sources). | For that, you have to modify the source code of fluxbox. Of course, it is easier if you use a source distribution such as Gentoo ([[gentoo-portage#emerge_step-by-step_for_modifying_source|here]] is explained how to emerge a package and modify sources). |
| |
But you just have to modify one line in ''Window.cc'' : | But you just have to modify two lines in ''Window.cc'' : |
<code C++> | <code C++> |
Window.cc:4084 | Window.cc:3954 |
- frame().setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 | + CommandRef maximize_cmd(new WindowCmd(*this, &FluxboxWindow::maximizeFull)); |
+ frame().setOnClickTitlebar(maximize_cmd, 1, true); // doubleclick with button 1 | CommandRef shade_cmd(new WindowCmd(*this, &FluxboxWindow::shade)); |
| Window.cc:4021 |
| - frame().setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 |
| + frame().setOnClickTitlebar(maximize_cmd, 1, true); // doubleclick with button 1 |
</code> | </code> |
| |
===== Make Meta-Tab switch between all windows ===== | ===== Make Meta-Tab switch between all windows ===== |
| |
| NOTE: This is fixed in Fluxbox 1.0, this tip is useless now. |
| |
Instead of only switching between visible windows (not minimized). | Instead of only switching between visible windows (not minimized). |
| |
One more time, you have to modify the source code, this time there are two lines : | One more time, you have to modify the source code, this time there are two lines : |
<code> | <code cpp> |
FocusControl.cc:71 | FocusControl.cc:71 |
- (opts & FocusControl::CYCLESKIPSHADED) != 0 && win->isShaded() || | - (opts & FocusControl::CYCLESKIPSHADED) != 0 && win->isShaded() || |
| |
| |
===== Patch for double-click maximize and meta-tab ===== | |
| |
I've written to make the modifications for the two previous tips automatic. To apply the patch, copy it in the parent of the ''src'' folder, and enter : | ===== Reduce flickering ===== |
<code>patch -p0 < fluxbox.maximize.patch</code> | |
| |
The patch : | ... during workspace switch. |
<code DIFF> | |
diff -r -U 3 src.orig/FocusControl.cc src/FocusControl.cc | Fluxbox deals with workspaces in a quite simple manner: when switching workspace, it hides all windows of the old workspace, and then draw all windows of the new workspace. |
--- src.orig/FocusControl.cc 2006-07-08 01:00:05.000000000 +0200 | |
+++ src/FocusControl.cc 2006-07-08 00:58:21.000000000 +0200 | Most of the time when we switch workspace, we can see the background image, and then all new workspace windows displayed one after the other, what is very nasty. |
@@ -71,9 +71,9 @@ | |
// skip if not active client (i.e. only visit each fbwin once) | First thing, show new workspace's windows before hiding old workspace's ones: |
(opts & FocusControl::CYCLEGROUPS) != 0 && win->winClient().window() != winclient.window() || | <code cpp> |
// skip if shaded | Screen.cc:1208 |
- (opts & FocusControl::CYCLESKIPSHADED) != 0 && win->isShaded() || | - currentWorkspace()->hideAll(false); |
+ (opts & FocusControl::CYCLESKIPSHADED) != 0 && win->isShaded() //|| | Screen.cc:1223 |
// skip if hidden | currentWorkspace()->showAll(); |
- win->isFocusHidden() | + wksp->hideAll(false); |
+ // win->isFocusHidden() | </code> |
); | |
| Second thing, draw windows in their focusing order, in order to draw the front window first: |
| <code cpp> |
| void Workspace::showAll() { |
| - Windows::iterator it = m_windowlist.begin(); |
| - Windows::iterator it_end = m_windowlist.end(); |
| - for (; it != it_end; ++it) |
| - (*it)->unwithdraw(); |
| |
| + FocusControl::FocusedWindows::iterator it = m_screen.focusControl().focusedOrderList().begin(); |
| + FocusControl::FocusedWindows::iterator it_end = m_screen.focusControl().focusedOrderList().end(); |
| + int workspace = m_screen.currentWorkspaceID(); |
| + |
| + for (; it != it_end; ++it) { |
| + if ((*it)->fbwindow() && !(*it)->fbwindow()->isIconic() && |
| + (int)(*it)->fbwindow()->workspaceNumber() == workspace) |
| + (*it)->fbwindow()->unwithdraw(); |
| + } |
} | } |
| |
@@ -122,7 +122,7 @@ | |
break; | |
| |
FluxboxWindow *fbwin = (*it)->fbwindow(); | |
- if (fbwin && !fbwin->isIconic() && | |
+ if (fbwin && /*!fbwin->isIconic() &&*/ | |
(fbwin->isStuck() | |
|| fbwin->workspaceNumber() == m_screen.currentWorkspaceID())) { | |
// either on this workspace, or stuck | |
diff -r -U 3 src.orig/Window.cc src/Window.cc | |
--- src.orig/Window.cc 2006-07-08 01:00:06.000000000 +0200 | |
+++ src/Window.cc 2006-07-08 00:58:21.000000000 +0200 | |
@@ -4084,7 +4084,7 @@ | |
| |
// setup titlebar | |
frame().setOnClickTitlebar(raise_and_focus_cmd, 1, false, true); // on press with button 1 | |
- frame().setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 | |
+ frame().setOnClickTitlebar(maximize_cmd, 1, true); // doubleclick with button 1 | |
frame().setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3 | |
frame().setOnClickTitlebar(lower_cmd, 2); // on release with button 2 | |
</code> | </code> |
| |
| Third thing, only redraw what is necessary (seems to be faster, but I'm not completely sure, and I hope it doesn't break anything) by replacing the deiconify function by a unwithdraw function which does only a fraction of what deiconify does: |
| |
| <code cpp> |
| Workspace.cc:228 |
| - (*it)->deiconify(false, false); |
| + (*it)->unwithdraw(); |
| Window.hh:201 |
| void deiconify(bool reassoc = true, bool do_raise = true); |
| + void unwithdraw(); |
| Window.cc:1522 |
| +void FluxboxWindow::unwithdraw() { |
| + if (numClients() == 0) |
| + return; |
| + |
| + if (oplock) return; |
| + oplock = true; |
| + |
| + bool was_iconic = iconic; |
| + |
| + m_blackbox_attrib.flags &= ~ATTRIB_HIDDEN; |
| + |
| + setState(NormalState, false); |
| + |
| + show(); |
| + |
| + oplock = false; |
| +} |
| </code> |
| |
| I have also tried to draw and clear windows in their general order of focusing, in replacement of the 2 first enhancements, but surprisingly it's less convincing: |
| <code cpp> |
| Screen.cc:1211 |
| - currentWorkspace()->hideAll(false); |
| |
| + int workspace = currentWorkspaceID(); |
| |
| // set new workspace |
| m_current_workspace = getWorkspace(id); |
| |
| + FocusControl::FocusedWindows::iterator it2 = focusControl().focusedOrderList().begin(); |
| + FocusControl::FocusedWindows::iterator it2_end = focusControl().focusedOrderList().end(); |
| + |
| + for (; it2 != it2_end; ++it2) { |
| + if ((*it2)->fbwindow() && !(*it2)->fbwindow()->isIconic() && !(*it2)->fbwindow()->isStuck()) |
| + { |
| + if ((int)(*it2)->fbwindow()->workspaceNumber() == id) |
| + (*it2)->fbwindow()->unwithdraw(); |
| + if ((int)(*it2)->fbwindow()->workspaceNumber() == workspace) |
| + (*it2)->fbwindow()->withdraw(false); |
| + } |
| + } |
| |
| - currentWorkspace()->showAll(win->fbwindow()); |
| </code> |
| |
| ===== Full patch for previous tips ===== |
| |
| ie double click maximizes and reducing flickering. |
| |
| To apply the {{fluxbox.patch|patch}}, copy it in the parent of the ''src'' folder, and enter : |
| <code>patch -p0 < fluxbox.patch</code> |
| |
| |