2bwm(1)

πŸ“¦ version 0.3, in alpine 3.24, nixos 26.05, nixpkgs unstable

πŸ’… 2bwm(1) β€” the bestie manual ✨

okay so this is the 2bwm(1) page, and it is literally giving β€œsmall, fast, keyboard-driven window manager with two borders” energy. Slay.


✨ NAME ✨

2bwm β€” a small and fast keyboard driven window manager with two borders.


πŸ’– DESCRIPTION πŸ’–

2bwm is a fast floating WM with the particularity of having 2 borders, written over the XCB library and derived from mcwm written by Michael Cardell. In 2bWM everything is accessible from the keyboard, but a pointing device can be used for move, resize and raise/lower. No cap.


πŸŽ€ USE πŸŽ€

Nota bene: it is highly recommended to check the config.h file at least once. 2bWM is configured at compile time and anything you might want to change is in the config.h file, from colors to keybinds. Fr fr, go look at it.

With the default configuration:

πŸ–±οΈ MOUSEMODKEY + mouse buttons

  • 1 β€” move
  • 3 β€” resize window

πŸ–±οΈ MOUSEMODKEY + CTRL + mouse buttons

  • 3 β€” starts the menu (you have to set the menu in the config file)

πŸ–±οΈ MOUSEMODKEY + ALT + mouse buttons

  • 3 β€” next screen
  • 1 β€” previous screen

⌨️ MODKEY + key

  • 0-9 β€” go to workspace n, 0-9.
  • shift+0-9 β€” Move window to workspace.
  • Tab or shift+Tab β€” go to next window in the current workspace window ring.
  • Q β€” close/kill a window.
  • shift+J β€” resize down.
  • shift+K β€” resize up.
  • shift+L β€” resize right.
  • shift+H β€” resize left.
  • shift+ctrl+H β€” resize slow left.
  • shift+ctrl+J β€” resize slow down.
  • shift+ctrl+K β€” resize slow up.
  • shift+ctrl+L β€” resize slow right.
  • h β€” move left.
  • j β€” move down.
  • k β€” move up.
  • l β€” move right.
  • ctrl+h β€” move left slow.
  • ctrl+j β€” move down slow.
  • ctrl+k β€” move up slow.
  • ctrl+l β€” move right slow.
  • y β€” move to upper left corner of monitor.
  • u β€” move to upper right corner of monitor.
  • b β€” move to lower left corner of monitor.
  • n β€” move to lower right corner of monitor.
  • g β€” move to the center of the monitor.
  • Home β€” Grow keeping aspect.
  • End β€” Shrink keeping aspect.
  • x β€” maximize/full screen (toggles).
  • shift+x β€” maximize/full screen overriding offsets (toggles).
  • m β€” maximize vertically (toggles).
  • shift+m β€” maximize horizontally (toggles).
  • shift+y/shift+u/shift+b/shift+n β€” move to the left/right/bottom/top while maxvert/maxhor and half max horizontal/vertical
  • shift+ctrl+b/n β€” fold or Unfold horizontally
  • shift+ctrl+y/u β€” fold or Unfold vertically
  • . β€” move window to next monitor/screen.
  • , β€” move window to previous monitor.
  • r β€” raise or lower (toggles).
  • v/c β€” Go to next/previous workspace
  • shift+v/c β€” move to next/previous workspace
  • i β€” iconify (or hide) window from the display.
  • a β€” Make a window unkillable (toggles).
  • t β€” Make a window stay on top.
  • f β€” fix window so it is visible on all workspaces (toggles).
  • arrows (+shift) β€” Move the cursor (with shift fast).
  • w β€” start the menu program (to be set in the config file)
  • ctr+q, ctrl+r β€” quit or restart 2bwm
  • space β€” half the screen and centered
  • ctrl+(up/down/right) β€” emulate click 1,2,3 (depends on xdotool(1))

Note that all functions activated from the keyboard work on the currently focused window regardless of the position of the mouse cursor. Iconic.

You can change the keybinds and colors in the config.h file and then recompile and restart to see changes.


🌈 EXTERNAL PROGRAMS 🌈

2bwm does not come with a bar, or panel. 2bwm will respect some EWMH hints such as _NET_WM_WINDOW_TYPE_DOCK. Thus, most panels should work. The followinds were tested (their spelling, not mine πŸ’€):

🧚 Panels

  • cairo-dock
  • fbpanel
  • hpanel
  • lxpanel
  • tint2
  • xfce4-panel

🧚 Bars

  • bar
  • dzen2

If you set up a bar don't forget to add the space at the bottom or at the top of the screen in the configs. Also, if you want to know the current workspace you can use xprop -root _NET_CURRENT_DESKTOP| sed -e 's/_NET_CURRENT_DESKTOP(CARDINAL) = //' πŸ’…


🚨 SIGNALS 🚨

  • SIGINT - SIGTERM β€” Cleanup and exit (with the signal number as exit code)
  • SIGHUP β€” Cleanup and restart

🫢 RETURN VALUE 🫢

0 on success, anything else on error or on signal received.


πŸ¦‹ ENVIRONMENT πŸ¦‹

2bwm obeys the $DISPLAY variable.


😭 ERRORS AND TROUBLESHOOTING 😭

🏁 Race Condition

There is currently a race condition when switching worskpaces really fast. This may be due to the asynchronous nature of the X11 protocol. A fix was tried using locks without much luck (using atomic variables.) Not me crying over async X11 πŸ’€

β˜• White java windows

If you experience problems with java GUI you can refer to http://awesome.naquadah.org/wiki/Problems_with_Java β€” most probably adding _JAVA_AWT_WM_NONREPARENTING=1 to the environment variable will resolve the problem. (export _JAVA_AWT_WM_NONREPARENTING=1)

πŸ™ˆ Raising hidden windows

2bWM comes with the hidden(1) program. hidden(1) lists all the hiden windows so you can pipe it into a menu program such as 9menu(1).

hidden -c|xargs 9menu -popup -label Iconics -font "terminus12-10"

You might also be interested in the following shell function that might come in handy to give your terminal emulators good titles before hiding them.

# Set the title and icon name of an xterm or clone.
function title
{
     # icon name
     echo -e '\033]1;'$1'\007'
     # title
     echo -e '\033]2;'$1'\007'
}

Use it like this:

% title 'really descriptive title'

πŸ›‘οΈ Preventing X11 Crash

Typically the window manager is started from a script, either run by startx(1) or a login manager such as xdm(1).

If you start from the console, you need an .xinitrc file. Here's a complete example:

#! /bin/sh

# Set nice background.
xsetroot -bg
# Set nice pointer cursor.
xsetroot -cursor_name plus -fg white -bg black

# Load resources.
xrdb -load ~/.Xresources

# Start window manager in the background. If it dies, X still lives.
2bwm &

# Start a terminal in the foreground. If this dies, X dies.
exec urxvt

πŸ‘€ SEE ALSO πŸ‘€

hidden(1) xdotool(1) 9menu(1) startx(1) xdm(1)


πŸ‘‘ AUTHOR πŸ‘‘

Venam | Patrick Louis <patrick at iotek do org>

Big thanks for the help of the following persons:

  • Yrmt
  • maxrp
  • z3bra
  • cicku
  • tbck
  • crshd
  • anshin

Thanks to the UnixHub/Nixers community for the support and ideas.

Thanks to Michael Cardell <mc@hack.org> for starting it all.


That’s the whole 2bwm(1) manual page, bestie β€” dated Jun 10, 2014 πŸŒΈπŸ’– periodt.

πŸ“¦ where this page comes from