# Notion scripts collection

Here are some scripts for Notion. All of them are in the public domain unless otherwise mentioned in the source file.

- Scripts
- Key bindings
- Styles
- Statusbar monitors
- Instructions
  - Using
  - Downloading
  - Contributing
- Legacy
  - Scripts
  - Statusbar monitors

## Scripts

app.lua
  Start an application if it's not running, but go to it if it's already started. There's also a function to replace query_editfile which will use a running emacs instance (starting it if necessary, of course).
autoprop.lua
  Automatically create a winprop for the given client targeted to the given frame. Allows them to be saved and reloaded automatically.
bookmarks.lua
  Bookmarks support
cfg_dock2.lua
  A dock configuration with lots of added control.
collapse.lua
  Collapse frames on a WTiling into a single frame
exec_show.lua
  Execute some shell-command (tail, head, grep etc) and display the result.
float-sb.lua
  Example of a floating toggleable statusbar.
goto_by_tag.lua
  Sets focus to the first client with a given tag. This tag is defined using a winprop. For example you might give the tag "B" to your browser and then use the binding META+U B to directly jump to your browser.
lock_frame.lua
  'Lock' selected frames so they don't close via the keyboard.
min_tabs.lua
  Show tabs precisely when two or more windows in an notion frame
move_current.lua
  Move current window in a frame to another frame in specified direction
mp.lua
  Mark next mapped window to be attached to a specified object
mpd.lua
  Control a MusicPD server
named_scratchpad.lua
  Toggle (and create) scratchpads by name.
net_client_list.lua
  Maintain the _NET_CLIENT_LIST property (and the _NET_CLIENT_LIST_STACKING property incorrectly) on the root window.
nowarp_scratchpad.lua
  Keeps notion from warping the pointer when activating a scratchpad region.
panel.lua
  Facilitates placing arbitrary windows with the `is_panel` winprop set to true, as the stdisp.
query_url.lua
  Open a URL, completing on Opera bookmark file. Should be easy to support other browsers.
rss_feed.lua
  A simple rss-reader script
rss_feed_hh.lua
  Some small improvements to match rss_feed my personal taste.
schedule.lua
  Schedule some messages to show up at specified times in the statusbar.
send_to_ws.lua
  Quickly send to another workspace.
show_submap.lua
  Displays an infowin with the currently active submap.
simple_bindings.lua
  Add a first pass at the simple bindings script.
stock.lua
  An applet for retrieving and displaying stock market information from http://finance.yahoo.com. You can set up a portfolio and monitor its intraday performance.
switch_bindings.lua
  Switch between key-bindings. You can temporarily disable keybindings and restore them later when necessary.
tabmenu.lua
  A grabmenu-based alternative to tabs.
weather.lua
  This script allows you to retreive weather information from one or more weather observation stations and display it in the statusbar.
wrap_workspace_or_screen.lua
  When switching focus over the border of a workspace, wrap to the next workspace or screen.
xkbion.lua
  This script allows you to use independent keyboard layouts for different windows in Notion. It uses a window property to store the XKB groups, so you can restart Notion without losing settings for each window.
zoom.lua
  Simulates larswm-like window zooming.

## Key bindings

cfg_mouse.lua
  Make the mouse pull its weight.
dans_bindings.lua
  Keybindings for more intuitive WIonWS navigation.
emacs_bindings.lua
  Emacs-like keybindings
vim_bindings.lua
  Vim-like keybindings for Notion queries.

## Styles

look_alex.lua
  Black tabs, green text and borders.
look_asm.lua
  A clean grey-blue theme with not too big tabs.
look_atme.lua
  A style which just looks nice.
look_awesome.lua
  Inspired by look_clean, comes fully-equipped with big, friendly tabs, tasty single-pixel borders, and a sprinkling of transparency. Makes use of the Terminus font.
look_awesome_sm.lua
  A style based on look_awesome above, but with smaller fonts and paddings and no transparency by default. This style makes use of the 'nexus' font for tabs.
look_awesome_yaarg.lua
  A style based on look-awesome-sm above, but with darker colours to give a more somber feel.
look_bas.lua
  A style which colors fit the mozilla-bb background. It makes use of the techy artwiz font.
look_blue.lua
  A blue/gray theme based on look_violet.lua, with a nice clean look.
look_bluecurve.lua
  A theme that fits the colors of the bluecurve-theme by Redhat
look_cleanpastel.lua
  Similar to stock look-clean* styles, but greenish.
look_cleansteel.lua
  The stock look-brownsteel style with borders removed on tiled workspaces for cleaner look.
look_cleansteel_trans.lua
  Based on look_cleansteel, but with transparent backgrounds, smaller font sizes, and a coloured notification.
look_cleanwhite.lua
  A bright theme that fits white terminals and white Emacs windows.
look_cool.lua
  A style based on look-awesome, made to fit the KDE color scheme "plastic-grey". Made by Steffen Liebergeld (26.08.2004).
look_gtk2.lua
  A theme that fits the default GTK+2 colors. It makes use of the terminus and artwiz fonts.
look_minimalist.lua
  A simple gold/red style with relatively large frame borders designed to increase usability with the minimal tabs modification.
look_moy.lua
  Grey and violet simple theme.
look_ootput.lua
  A non-obtrusive style with clear distinctions between active borders and less active borders. This style makes use of the Profont font.
look_ootput_dark.lua
  A darker version of look_ootput that is easier on the eyes.
look_outback.lua
  A warm style with sandy hints and distinctive contrast. Screenshot.
look_qt.lua
  A drawing engine configuration file that reads settings from Qt configuration file ~/.qt/qtrc.
look_tibi.lua
  A style which clearly emphasizes active elements and thus lets you quickly recognize them. The `accent' color is configurable.
look_tiny.lua
  A major modification of look_minimalist, aiming to keep everything small while not making anything unattractive.
look_tiny_min_tabs.lua
  A major modification of look_minimalist, aiming to keep everything small while not making anything unattractive. For use with min_tabs.
look_whitecode.lua
  Clean white/light grey theme. Comes handy for glare displays as reflection is not as evil as with a dark theming. I recommend background color #808080 for a cool look in floating workspaces. (Tested only on my LCD, so no idea what it looks like on a CRT)

## Statusbar

All statusbar monitors are loaded automatically based on the statusbar template. Do not attempt to load them manually (especially not the statusd scripts). Please see instructions below for more information.

### Internal monitors

statusbar_act.lua
  Activity (urgency flag, new unacted-upon transients, etc.) display for the statusbar.
statusbar_external.lua
  Show output of external programs or scripts in statusbar. If you are using ion-3ds-20060107 or later, using statusd_exec.lua instead of this old version is suggested.
statusbar_fname.lua
  Show the focused frame name in the statusbar.
statusbar_wsname.lua
  Shows the current workspace name in the statusbar, can also show a list of workspaces and indicate the current one. The current workspace indicator is customizable. This script also allows for per-head workspace information.

### Notion-statusd monitors

These monitors are run within the separate `notion-statusd` program. Note that many of them depend on the Linux `/proc` filesystem and thus will not work on other systems.

statusd_amarok.lua
  Notion-statusd monitor reporting the current song from Amarok.
statusd_binclock.lua
  Notion-statusd binary clock in two possible modes: Plain binary (numbers) and character mode (dots, lines, etc).
statusd_bitcoin.lua
  Notion-statusd monitor reporting bitcoin speed in khash/s and balance
statusd_bsdbatt.lua
  Notion-statusd monitor for FreeBSD ACPI CMBATT status. Uses the sysctl interface.
statusd_cpufreq.lua
  Notion-statusd monitor reporting current CPU speed in KHz, MHz, or GHz. Uses the `/proc` filesystem and `cpufreq`.
statusd_cpuspeed.lua
  Notion-statusd monitor reporting current CPU speed; works with apm.
statusd_cpustat.lua
  Notion-statusd monitor reporting current CPU stats using the Linux `/proc/stat` interface.
statusd_df.lua
  Notion-statusd monitor reporting free disk space. Depends on `df`.
statusd_dgs.lua
  Notion-statusd monitor reporting on any games waiting for a move on www.dragongoserver.net.
statusd_drives.lua
  Notion-statusd monitor reporting on connected drives
statusd_exec.lua
  Show output of external programs or scripts in statusbar. Uses non-blocking reads and can be used with both continously outputting and periodically run programs. Allows highlighting with regexp matching.
statusd_flashing.lua
  Notion-statusd multi-purpose monitor. Show blinking alarms when some defined files or directories have changed. It can be used to monitor email inboxes, security logs, etc.
statusd_fortune.lua
  Notion-statusd monitor displaying fortunes.
statusd_inetaddr.lua
  Notion-statusd monitor reporting current IP address from ifconfig.
statusd_iwinfo.lua
  Notion-statusd monitor reporting minimal wireless info.
statusd_laptopstatus.lua
  Notion-statusd monitor reporting CPU speed & temperature and battery status; works with acpi.
statusd_maildir.lua
  Notion-statusd monitor showing mailcount of a Maildir.
statusd_mem.lua
  Notion-statusd monitor reporting current memory usage with selective alarms and non blocking I/O. Depends on Linux `free` command.
statusd_meminfo.lua
  Notion-statusd monitor reporting current memory and swap usage. Depends on the Linux `/proc/meminfo` interface.
statusd_moc.lua
  Notion-statusd monitor reporting moc information and status.
statusd_mocmon.lua
  Notion-statusd monitor reporting moc information. This is actually just a modification of statusd_xmmsip.lua using the idea of non-blocking I/O as shown in statusd_mocp.lua.
statusd_mocp.lua
  Notion-statusd monitor reporting moc status. This is a stripped down, non-blocking I/O version of the above. It is useful with rotate_statusbar.lua.
statusd_mpd-socket.lua
  Notion-statusd monitor reporting mpd information and status. Uses a socket interface to avoid some performance issues with the original.
statusd_mpd.lua
  Notion-statusd monitor reporting mpd information and status.
statusd_netmon.lua
  Notion-statusd network monitor reporting network activity.
statusd_nginfo.lua
  Notion-statusd monitor reporting Nagios server(s) status.
statusd_nmaild.lua
  Notion-statusd Maildir monitor with selective alarms, counters for different filters and optional command launcher when a new email is detected.
statusd_orpheus.lua
  Notion-statusd monitor reporting song currently being played by orpheus.
statusd_pytone.lua
  Notion-statusd monitor reporting song currently being played by pytone.
statusd_ticker.lua
  Notion-statusd monitor which scrolls the output of specified programs.
statusd_uname.lua
  Notion-statusd monitor for reporting uname. It is primarily a simple example of how to use statusd.popen_bgread() with coroutines for non-blocking I/O.
statusd_uptime.lua
  Notion-statusd monitor reporting the system uptime.
statusd_volume.lua
  Notion-statusd monitor reporting sound volume values (currently, master and pcm). Depends on aumix.
statusd_weather.lua
  Notion-statusd monitor reporting weather.
statusd_xmms.lua
  Notion-statusd monitor reporting song currently selected in xmms' playlist.
statusd_xmms2.lua
  Song as "Artist - Title"
statusd_xmmsip.lua
  Notion-statusd monitor(s) reporting information from a xmms-infopipe-plugin's pipe. Can be customized in various ways.

## Instructions

### Using

To use any of the scripts, follow these directions.

1. Create the directory `~/.notion/`, if it does not exist yet.
2. Copy the script in this directory.
3. Depending on the type of script, do the following.
   Proper scripts
     Copy `cfg_notion.lua` in `~/.notion/`, if it does not contain one already. This file can usually be found in either `/usr/local/etc/notion/` or `/etc/X11/notion/`. Then add the suitably modified line

         dopath("name of script without extension")

     at the end of the file (in `~/.notion/`).
   Statusbar
     Make sure you have `cfg_statusbar.lua` in `~/.notion/`, and add one of the monitors provided by the script in the template without the `statusd_` or such prefix.
   Styles
     That's it. You can choose `styles/refresh-list` from the F12 main menu to have a running instance of Ion find it, and then choose the style from the same menu.

Some scripts may need further setup. For more information, see the scripts themselves, and the documentation.

### Downloading a copy

A copy of this collection is shipped with each release of Notion. If you really need the latest version get it from git:

    git clone git://notion.git.sourceforge.net/gitroot/notion/contrib

This will get you a fully functional copy of the repository in the directory `contrib`.

To update a previously downloaded repository, use `git pull`. The command `git log` can be used to view the list of changes, and there is also an RSS feed of the most recent changes.

### Contributing

This section needs to be improved. For now, create a patch and submit it to the sf.net patches tracker, publish it on the mailinglists, or both.

## Legacy

The scripts below are known to be broken and are only included for curiosity's sake. They range from being completely outdated and irrelevant to only requiring a minor fix. If you discover a legacy script whose functionality you would find useful, please file a bug report asking for the script to be fixed, or, even better, fix the script yourself. :-)

### Scripts

adapt_menus.lua
  Functions for creating a hierarchy of menus for various clients available. Key features are an attempt to organise by type hints (from the window titles) and collapse submenus when they contain only a few items.
alt_resize.lua
  Possibly more intuitive resizing bindings.
bindsearch.lua
  Search the current bindings table by key or by command.
closeorkill.lua
  Kill client on second close try if it did not respond to close
ctrl_statusbar.lua
  Menu-driven controller for the statusbar. Modules can be enabled/ disabled from the menu, without requiring to edit the configuration file.
cwin_sp.lua
  Create per-clientwin scratchpads
document_menus.lua
  Navigate the filesystem using notion menus.
enumerate.lua
  Adds "X." in front of the client windows, which may make switching between client-windows with MOD+n a little easier .
environment_placement_hook.lua
  Linux-only placement hook which detects the presence of an ION_USE_WS environment variable in the processes of new windows, and uses that to determine where to place them.
frame_client_menu.lua
  Adds a 'Client windows' submenu to a frame's context menu, the menu contains all the clients in the current frame.
go_frame_or_desk.lua
  Replaced by wrap_workspace_or_screen. (selects frame in the specified direction. If there is no frame at that location, instead the next workspace in the direction becomes active)
goto_multihead.lua
  A version of `goto_dir` that may be useful on multihead setups.
heuristics.lua
  Window placement heuristics for tiled workspaces
histcompl.lua
  History completion support for the line editor
named_floating_groupws.lua
  Toggle (and create) floating WGroupWS:s by name.
nest_ws.lua
  Attach workspaces to windows, to e.g. have a WIonWS inside a WFloatWS, or vice versa
nextact.lua
  Go to first found region with activity flag set.
notifybox.lua
  Show notification boxes, similar to the activity notification.
rotate_statusbar.lua
  Rotate the statusbar between different templates. This will automatically load all of the modules for notion-statusd.
xinerama_switcher.lua
  Replaced by wrap_workspace_or_screen. (This is similar to (and based on) go_frame_or_desk.lua but adds the ability to move between screens too. Left/right switch between screens, up/down between workspaces.)

### Statusbar monitors

#### Internal monitors

statusbar_workspace.lua
  Show current workspace name in statusbar, or a list of workspace numbers with the active one indicated.

#### Notion-statusd monitors

statusd_apm.lua
  Notion-statusd monitor reporting APM status; works on OpenBSD 4.0 by executing external program every minute. Now with hints for battery state and external A/C connection.
statusd_apm2.lua
  Notion-statusd monitor reporting APM status; works on FreeBSD by executing apm as an external program every minute. Added hints for a bit more color. Even though this is apm2, save it as statusd_apm.lua.
statusd_batt.lua
  Notion-statusd monitor reporting battery status; works with apm.
statusd_iface.lua
  Notion-statusd monitor reporting currently used network interface.
statusd_info.lua
  Notion-statusd monitor reporting current CPU, RAM, and swap usage. Depends on `top` and `free`.
statusd_linuxbatt.lua
  Notion-statusd monitor reporting battery percentage and status using the Linux `/proc/acpi` interface.
statusd_mcpu.lua
  Notion-statusd monitor reporting multiple CPUs usage (average and per-CPU); works with `/proc/stat`.
statusd_sysmon.lua
  Notion-statusd monitor for reporting various system resources.
statusd_volume2.lua
  Notion-statusd monitor reporting master sound volume and state (on or muted). Depends on `amixer`. Despite being named "statusd_volume2.lua", the script needs to be relabeled "statusd_volume.lua" to work.