Use tabs consistently

This commit is contained in:
Bastien Dejean 2014-01-21 20:48:49 +01:00
parent d90955d28a
commit a1dc440d7d
18 changed files with 502 additions and 503 deletions

View file

@ -6,17 +6,17 @@
# Installation
make && make install
make && make install
# Removal
make uninstall
make uninstall
# Packages
- Arch Linux
- [bspwm-git](https://aur.archlinux.org/packages/bspwm-git)
- [bspwm](https://aur.archlinux.org/packages/bspwm)
- [bspwm-git](https://aur.archlinux.org/packages/bspwm-git)
- [bspwm](https://aur.archlinux.org/packages/bspwm)
- Gentoo Linux
- [bspwm-git](https://github.com/milomouse/ebuilds)
- [bspwm-git](https://github.com/milomouse/ebuilds)

View file

@ -8,7 +8,7 @@ If a node has two children it is an internal node, otherwise a leaf.
Fundamental theorem:
Let I be the number of internal nodes and L the number of leaves, then:
L = I + 1
L = I + 1
(It can be proved by induction on the number of internal nodes.)

View file

@ -2,12 +2,12 @@
.\" Title: bspwm
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 01/04/2014
.\" Date: 01/21/2014
.\" Manual: Bspwm Manual
.\" Source: Bspwm 0.8.8
.\" Language: English
.\"
.TH "BSPWM" "1" "01/04/2014" "Bspwm 0\&.8\&.8" "Bspwm Manual"
.TH "BSPWM" "1" "01/21/2014" "Bspwm 0\&.8\&.8" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------

View file

@ -29,13 +29,13 @@ Options
-------
*-h*::
Print the synopsis and exit.
Print the synopsis and exit.
*-v*::
Print the version and exit.
Print the version and exit.
*-c* 'CONFIG_PATH'::
Use the given configuration file.
Use the given configuration file.
Configuration
-------------
@ -122,7 +122,7 @@ can either describe the target relatively or name it globally.
Descriptive (relative) selectors consist of a primary selector and any number
of non-conflicting modifiers as follows:
PRIMARY_SELECTOR[.MODIFIER]*
PRIMARY_SELECTOR[.MODIFIER]*
For obvious reasons, neither desktops nor monitors names may be valid
descriptive selectors.
@ -141,50 +141,49 @@ Primary Selectors
^^^^^^^^^^^^^^^^^
'DIR'::
Selects the window in the given (spacial) direction relative to the active
window.
Selects the window in the given (spacial) direction relative to the active window.
'CYCLE_DIR'::
Selects the window in the given (cyclic) direction.
Selects the window in the given (cyclic) direction.
biggest::
Selects the biggest window on the current desktop.
Selects the biggest window on the current desktop.
last::
Selects the previously focused window.
Selects the previously focused window.
focused::
Selects the currently focused window.
Selects the currently focused window.
older::
Selects the window older than the focused window in the history.
Selects the window older than the focused window in the history.
newer::
Selects the window newer than the focused window in the history.
Selects the window newer than the focused window in the history.
Modifiers
^^^^^^^^^
floating::
Only consider floating windows.
Only consider floating windows.
tiled::
Only consider tiled windows.
Only consider tiled windows.
like::
Only consider windows that have the same class as the current window.
Only consider windows that have the same class as the current window.
unlike::
Only consider windows that have a different class than the current window.
Only consider windows that have a different class than the current window.
manual::
Only consider windows in manual splitting mode (see *--presel*).
Only consider windows in manual splitting mode (see *--presel*).
local::
Only consider windows of the current desktop.
Only consider windows of the current desktop.
urgent::
Only consider urgent windows.
Only consider urgent windows.
Desktop
~~~~~~~
@ -201,40 +200,40 @@ Primary Selectors
^^^^^^^^^^^^^^^^^
<desktop_name>::
Selects the desktop with the given name.
Selects the desktop with the given name.
^<n>::
Selects the nth desktop.
Selects the nth desktop.
'CYCLE_DIR'::
Selects the desktop in the given direction relative to the active desktop.
Selects the desktop in the given direction relative to the active desktop.
last::
Selects the previously focused desktop.
Selects the previously focused desktop.
focused::
Selects the currently focused desktop.
Selects the currently focused desktop.
older::
Selects the desktop older than the focused desktop in the history.
Selects the desktop older than the focused desktop in the history.
newer::
Selects the desktop newer than the focused desktop in the history.
Selects the desktop newer than the focused desktop in the history.
Modifiers
^^^^^^^^^
occupied::
Only consider occupied desktops.
Only consider occupied desktops.
free::
Only consider free desktops.
Only consider free desktops.
urgent::
Only consider urgent desktops.
Only consider urgent desktops.
local::
Only consider desktops of the current monitor.
Only consider desktops of the current monitor.
Monitor
~~~~~~~
@ -251,62 +250,62 @@ Primary Selectors
^^^^^^^^^^^^^^^^^
<monitor_name>::
Selects the monitor with the given name.
Selects the monitor with the given name.
^<n>::
Selects the nth monitor.
Selects the nth monitor.
'DIR'::
Selects the monitor in the given (spacial) direction relative to the active monitor.
Selects the monitor in the given (spacial) direction relative to the active monitor.
'CYCLE_DIR'::
Selects the monitor in the given (cyclic) direction relative to the active monitor.
Selects the monitor in the given (cyclic) direction relative to the active monitor.
primary::
Selects the primary monitor.
Selects the primary monitor.
last::
Selects the previously focused monitor.
Selects the previously focused monitor.
focused::
Selects the currently focused monitor.
Selects the currently focused monitor.
older::
Selects the monitor older than the focused monitor in the history.
Selects the monitor older than the focused monitor in the history.
newer::
Selects the monitor newer than the focused monitor in the history.
Selects the monitor newer than the focused monitor in the history.
Modifiers
^^^^^^^^^
occupied::
Only consider monitors where the focused desktop is occupied.
Only consider monitors where the focused desktop is occupied.
free::
Only consider monitors where the focused desktop is free.
Only consider monitors where the focused desktop is free.
Window States
-------------
floating::
Is above any tiled window and can be moved/resized freely. Although it doesn't occupy any tiling space, it is still part of the window tree.
Is above any tiled window and can be moved/resized freely. Although it doesn't occupy any tiling space, it is still part of the window tree.
pseudo_tiled::
Has a libre size while being centered in its tiling space.
Has a libre size while being centered in its tiling space.
fullscreen::
Fills its monitor rectangle, is above all the other windows and has no borders.
Fills its monitor rectangle, is above all the other windows and has no borders.
locked::
Ignores the *close* message.
Ignores the *close* message.
sticky::
Stays in the focused desktop of its monitor.
Stays in the focused desktop of its monitor.
private::
Tries to keep the same tiling position/size.
Tries to keep the same tiling position/size.
Commands
@ -323,40 +322,40 @@ window ['WINDOW_SEL'] 'OPTIONS'
Options
^^^^^^^
*-f*, *--focus* ['WINDOW_SEL']::
Focus the selected or given window.
Focus the selected or given window.
*-d*, *--to-desktop* 'DESKTOP_SEL'::
Send the selected window to the given desktop.
Send the selected window to the given desktop.
*-m*, *--to-monitor* 'MONITOR_SEL'::
Send the selected window to the given monitor.
Send the selected window to the given monitor.
*-w*, *--to-window* 'WINDOW_SEL'::
Transplant the selected window to the given window.
Transplant the selected window to the given window.
*-s*, *--swap* 'WINDOW_SEL'::
Swap the selected window with the given window.
Swap the selected window with the given window.
*-p*, *--presel* 'DIR'|cancel::
Preselect the splitting area of the selected window (or cancel the preselection).
Preselect the splitting area of the selected window (or cancel the preselection).
*-r*, *--ratio* 'RATIO'::
Set the splitting ratio of the selected window (0 < 'RATIO' < 1).
Set the splitting ratio of the selected window (0 < 'RATIO' < 1).
*-e*, *--edge* 'DIR' 'RATIO'|±'PIXELS'::
Set or change the splitting ratio of the edge located in the given direction in relation to the selected window.
Set or change the splitting ratio of the edge located in the given direction in relation to the selected window.
*-R*, *--rotate* 'DIR' '90|270|180'::
Rotate the tree holding the edge located in the given direction in relation to the selected window.
Rotate the tree holding the edge located in the given direction in relation to the selected window.
*-t*, *--toggle* floating|fullscreen|pseudo_tiled|locked|sticky|private[=on|off]::
Set or toggle the given state for the selected window.
Set or toggle the given state for the selected window.
*-c*, *--close*::
Close the selected window.
Close the selected window.
*-k*, *--kill*::
Kill the selected window.
Kill the selected window.
Desktop
~~~~~~~
@ -369,43 +368,43 @@ desktop ['DESKTOP_SEL'] 'OPTIONS'
Options
^^^^^^^
*-f*, *--focus* ['DESKTOP_SEL']::
Focus the selected or given desktop.
Focus the selected or given desktop.
*-m*, *--to-monitor* 'MONITOR_SEL'::
Send the selected desktop to the given monitor.
Send the selected desktop to the given monitor.
*-l*, *--layout* 'CYCLE_DIR'|monocle|tiled::
Set or cycle the layout of the selected desktop.
Set or cycle the layout of the selected desktop.
*-n*, *--rename* <new_name>::
Rename the selected desktop.
Rename the selected desktop.
*-s*, *--swap* 'DESKTOP_SEL'::
Swap the selected desktop with the given desktop.
Swap the selected desktop with the given desktop.
*-r*, *--remove*::
Remove the selected desktop.
Remove the selected desktop.
*-c*, *--cancel-presel*::
Cancel the preselection of all the windows of the selected desktop.
Cancel the preselection of all the windows of the selected desktop.
*-F*, *--flip* 'horizontal|vertical'::
Flip the tree of the selected desktop.
Flip the tree of the selected desktop.
*-R*, *--rotate* '90|270|180'::
Rotate the tree of the selected desktop.
Rotate the tree of the selected desktop.
*-E*, *--equalize*::
Reset the split ratios of the tree of the selected desktop.
Reset the split ratios of the tree of the selected desktop.
*-B*, *--balance*::
Adjust the split ratios of the tree of the selected desktop so that all windows occupy the same area.
Adjust the split ratios of the tree of the selected desktop so that all windows occupy the same area.
*-C*, *--circulate* forward|backward::
Circulate the leaves of the tree of the selected desktop.
Circulate the leaves of the tree of the selected desktop.
*-t*, *--toggle* floating[=on|off]::
Set or toggle the given state for the selected desktop.
Set or toggle the given state for the selected desktop.
Monitor
@ -419,25 +418,25 @@ monitor ['MONITOR_SEL'] 'OPTIONS'
Options
^^^^^^^
*-f*, *--focus* ['MONITOR_SEL']::
Focus the selected or given monitor.
Focus the selected or given monitor.
*-a*, *--add-desktops* <name>...::
Create desktops with the given names in the selected monitor.
Create desktops with the given names in the selected monitor.
*-r*, *--remove-desktops* <name>...::
Remove desktops with the given names.
Remove desktops with the given names.
*-o*, *--reorder-desktops* <name>...::
Reorder the desktops of the selected monitor to match the given order.
Reorder the desktops of the selected monitor to match the given order.
*-d*, *--reset-desktops* <name>...::
Rename, add or remove desktops depending on whether the number of given names is equal, superior or inferior to the number of existing desktops.
Rename, add or remove desktops depending on whether the number of given names is equal, superior or inferior to the number of existing desktops.
*-n*, *--rename* <new_name>::
Rename the selected monitor.
Rename the selected monitor.
*-s*, *--swap* 'MONITOR_SEL'::
Swap the selected monitor with the given monitor.
Swap the selected monitor with the given monitor.
Query
~~~~~
@ -450,25 +449,25 @@ query 'OPTIONS'
Options
^^^^^^^
*-W*, *--windows*::
List matching windows.
List matching windows.
*-D*, *--desktops*::
List matching desktops.
List matching desktops.
*-M*, *--monitors*::
List matching monitors.
List matching monitors.
*-T*, *--tree*::
Print tree rooted at query.
Print tree rooted at query.
*-H*, *--history*::
Print the history as it relates to the query.
Print the history as it relates to the query.
*-S*, *--stack*::
Print the window stacking order.
Print the window stacking order.
[*-m*,*--monitor* ['MONITOR_SEL']] | [*-d*,*--desktop* ['DESKTOP_SEL']] | [*-w*, *--window* ['WINDOW_SEL']]::
Constrain matches to the selected monitor, desktop or window.
Constrain matches to the selected monitor, desktop or window.
Restore
~~~~~~~
@ -482,13 +481,13 @@ Options
^^^^^^^
*-T*, *--tree* <file_path>::
Load the desktop trees from the given file.
Load the desktop trees from the given file.
*-H*, *--history* <file_path>::
Load the focus history from the given file.
Load the focus history from the given file.
*-S*, *--stack* <file_path>::
Load the window stacking order from the given file.
Load the window stacking order from the given file.
Control
~~~~~~~
@ -502,16 +501,16 @@ Options
^^^^^^^
*--adopt-orphans*::
Manage all the unmanaged windows remaining from a previous session.
Manage all the unmanaged windows remaining from a previous session.
*--toggle-visibility*::
Toggle the visibility of all the windows.
Toggle the visibility of all the windows.
*--record-history* on|off::
Enable or disable the recording of window focus history.
Enable or disable the recording of window focus history.
*--subscribe*::
Continuously print status informations on standard output.
Continuously print status informations on standard output.
Pointer
~~~~~~~
@ -525,13 +524,13 @@ Options
^^^^^^^
*-g*, *--grab* focus|move|resize_side|resize_corner::
Initiate the given pointer action.
Initiate the given pointer action.
*-t*, *--track* <x> <y>::
Pass the pointer root coordinates for the current pointer action.
Pass the pointer root coordinates for the current pointer action.
*-u*, *--ungrab*::
Terminate the current pointer action.
Terminate the current pointer action.
Rule
~~~~
@ -545,13 +544,13 @@ Options
^^^^^^^
*-a*, *--add* <class_name>|<instance_name>|* [*-o*|*--one-shot*] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|window=WINDOW_SEL] [(floating|fullscreen|pseudo_tiled|locked|sticky|private|center|lower|follow|manage|focus)=(true|false)]::
Create a new rule.
Create a new rule.
*-r*, *--remove* ^<n>|head|tail|<class_name>|<instance_name>|*...::
Remove the given rules.
Remove the given rules.
*-l*, *--list* [<class_name>|<instance_name>|*]::
List the rules.
List the rules.
Config
~~~~~~
@ -560,7 +559,7 @@ General Syntax
^^^^^^^^^^^^^^
config [-m 'MONITOR_SEL'|-d 'DESKTOP_SEL'] <key> [<value>]::
Get or set the value of <key>.
Get or set the value of <key>.
Quit
~~~~
@ -569,7 +568,7 @@ General Syntax
^^^^^^^^^^^^^^
quit [<status>]::
Quit with an optional exit status.
Quit with an optional exit status.
Settings
--------
@ -581,85 +580,85 @@ Global Settings
~~~~~~~~~~~~~~~
'focused_border_color'::
Color of the border of a focused window of a focused monitor.
Color of the border of a focused window of a focused monitor.
'active_border_color'::
Color of the border of a focused window of an unfocused monitor.
Color of the border of a focused window of an unfocused monitor.
'normal_border_color'::
Color of the border of an unfocused window.
Color of the border of an unfocused window.
'presel_border_color'::
Color of the *presel* message feedback.
Color of the *presel* message feedback.
'focused_locked_border_color'::
Color of the border of a focused locked window of a focused monitor.
Color of the border of a focused locked window of a focused monitor.
'active_locked_border_color'::
Color of the border of a focused locked window of an unfocused monitor.
Color of the border of a focused locked window of an unfocused monitor.
'normal_locked_border_color'::
Color of the border of an unfocused locked window.
Color of the border of an unfocused locked window.
'focused_sticky_border_color'::
Color of the border of a focused sticky window of a focused monitor.
Color of the border of a focused sticky window of a focused monitor.
'active_sticky_border_color'::
Color of the border of a focused sticky window of an unfocused monitor.
Color of the border of a focused sticky window of an unfocused monitor.
'normal_sticky_border_color'::
Color of the border of an unfocused sticky window.
Color of the border of an unfocused sticky window.
'focused_private_border_color'::
Color of the border of a focused private window of a focused monitor.
Color of the border of a focused private window of a focused monitor.
'active_private_border_color'::
Color of the border of a focused private window of an unfocused monitor.
Color of the border of a focused private window of an unfocused monitor.
'normal_private_border_color'::
Color of the border of an unfocused private window.
Color of the border of an unfocused private window.
'urgent_border_color'::
Color of the border of an urgent window.
Color of the border of an urgent window.
'split_ratio'::
Default split ratio.
Default split ratio.
'status_prefix'::
Prefix prepended to each of the status lines.
Prefix prepended to each of the status lines.
'external_rules_command'::
External command used to retrieve rule consequences. The command will receive the the ID of the window being processed as its first argument and the class and instance names as second and third arguments. The output of that command must have the following format: *key1=value1 key2=value2 ...* (the valid key/value pairs are given in the description of the 'rule' command).
External command used to retrieve rule consequences. The command will receive the the ID of the window being processed as its first argument and the class and instance names as second and third arguments. The output of that command must have the following format: *key1=value1 key2=value2 ...* (the valid key/value pairs are given in the description of the 'rule' command).
'history_aware_focus'::
Give priority to the focus history when focusing nodes.
Give priority to the focus history when focusing nodes.
'borderless_monocle'::
Remove borders for tiled windows in monocle mode.
Remove borders for tiled windows in monocle mode.
'gapless_monocle'::
Remove gaps for tiled windows in monocle mode.
Remove gaps for tiled windows in monocle mode.
'focus_follows_pointer'::
Focus the window under the pointer.
Focus the window under the pointer.
'pointer_follows_monitor'::
When focusing a monitor, put the pointer at its center.
When focusing a monitor, put the pointer at its center.
'auto_alternate'::
Interpret two consecutive identical *use* messages as an *alternate* message.
Interpret two consecutive identical *use* messages as an *alternate* message.
'auto_cancel'::
Interpret two consecutive identical *presel* messages as a *cancel* message.
Interpret two consecutive identical *presel* messages as a *cancel* message.
'apply_floating_atom'::
Set the value of the '_BSPWM_FLOATING_WINDOW' atom of each window according to its floating state.
Set the value of the '_BSPWM_FLOATING_WINDOW' atom of each window according to its floating state.
'ignore_ewmh_focus'::
Ignore EWMH requests to focus a window.
Ignore EWMH requests to focus a window.
'remove_disabled_monitor'::
Consider disabled monitors as disconnected.
Consider disabled monitors as disconnected.
Monitor and Desktop Settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -668,16 +667,16 @@ Monitor and Desktop Settings
'right_padding'::
'bottom_padding'::
'left_padding'::
Padding space added at the sides of the monitor or desktop.
Padding space added at the sides of the monitor or desktop.
Desktop Settings
~~~~~~~~~~~~~~~~
'window_gap'::
Size of the gap that separates windows.
Size of the gap that separates windows.
'border_width'::
Window border width.
Window border width.
Status Format
@ -688,37 +687,37 @@ Status informations are composed of items separated by colons.
Each item has the form '<type><value>' where '<type>' is the first character of the item.
'M<monitor_name>'::
Focused monitor.
Focused monitor.
'm<monitor_name>'::
Unfocused monitor.
Unfocused monitor.
'O<desktop_name>'::
Occupied focused desktop.
Occupied focused desktop.
'o<desktop_name>'::
Occupied unfocused desktop.
Occupied unfocused desktop.
'F<desktop_name>'::
Free focused desktop.
Free focused desktop.
'f<desktop_name>'::
Free unfocused desktop.
Free unfocused desktop.
'U<desktop_name>'::
Urgent focused desktop.
Urgent focused desktop.
'u<desktop_name>'::
Urgent unfocused desktop.
Urgent unfocused desktop.
'L(tiled|monocle)'::
Layout of the focused desktop of the focused monitor.
Layout of the focused desktop of the focused monitor.
Environment Variables
---------------------
'BSPWM_SOCKET'::
The path of the socket used for the communication between *bspc* and *bspwm*. If it isn't defined, then the following path is used: '/tmp/bspwm<display_name>-socket'.
The path of the socket used for the communication between *bspc* and *bspwm*. If it isn't defined, then the following path is used: '/tmp/bspwm<display_name>-socket'.
Panels
------

View file

@ -5,10 +5,10 @@ class=$2
instance=$3
if [ "$instance" = fontforge ] ; then
title=$(xtitle "$wid")
case "$title" in
Layers|Tools|Warning)
echo "focus = off"
;;
esac
title=$(xtitle "$wid")
case "$title" in
Layers|Tools|Warning)
echo "focus = off"
;;
esac
fi

View file

@ -18,25 +18,25 @@ Shared
~~~~~~
*-h*::
Print the synopsis and exit.
Print the synopsis and exit.
*-p* 'PORT'::
Set the socket port.
Set the socket port.
Client
~~~~~~
*-a* 'HYPOT' 'CONSEQ' ['[duration=DURATION][,delay=DELAY]']::
Create a new rule. 'HYPOT' is a Lua expression that represent the rule hypothesis and involves the following strings: 'class', 'instance', 'title', 'type' and 'state'.
Create a new rule. 'HYPOT' is a Lua expression that represent the rule hypothesis and involves the following strings: 'class', 'instance', 'title', 'type' and 'state'.
*-r* 'STRING'|head|tail::
Remove the rules containing 'STRING' in their hypothesis or remove the first or last rule.
Remove the rules containing 'STRING' in their hypothesis or remove the first or last rule.
*-l*::
List the rules.
List the rules.
*-t* 'CLASS' 'INSTANCE' 'TITLE' 'TYPE' 'STATE'::
Test the rules for the given window informations.
Test the rules for the given window informations.
*-q*::
Kill the server.
Kill the server.

View file

@ -1,16 +1,16 @@
#! /bin/sh
if ! rulc -l > /dev/null ; then
(setsid ruld &)
while ! rulc -l > /dev/null ; do
sleep 0.1
done
(setsid ruld &)
while ! rulc -l > /dev/null ; do
sleep 0.1
done
fi
rules=$(rulc -l)
if [ -z "$rules" ] ; then
rulc -a 'class=="Gimp"' 'desktop=^8, follow=on, floating=on'
rulc -a 'class=="Chromium"' 'desktop=^2'
rulc -a 'instance=="mpv"' 'floating=on'
rulc -a 'class=="Kupfer.py"' 'focus=on'
rulc -a 'class=="Screenkey"' 'manage=off'
rulc -a 'class=="Gimp"' 'desktop=^8, follow=on, floating=on'
rulc -a 'class=="Chromium"' 'desktop=^2'
rulc -a 'instance=="mpv"' 'floating=on'
rulc -a 'class=="Kupfer.py"' 'focus=on'
rulc -a 'class=="Screenkey"' 'manage=off'
fi

View file

@ -5,64 +5,64 @@ local port = 54321
local short = "hp:arltq"
local long = {
{"help", "none", 'h'},
{"port", "required", 'p'},
{"add", "none", 'a'},
{"remove", "none", 'r'},
{"list", "none", 'l'},
{"test", "none", 't'},
{"quit", "none", 'q'}
{"help", "none", 'h'},
{"port", "required", 'p'},
{"add", "none", 'a'},
{"remove", "none", 'r'},
{"list", "none", 'l'},
{"test", "none", 't'},
{"quit", "none", 'q'}
}
local cmd_assoc = {
a = "add",
r = "remove",
l = "list",
t = "test",
q = "quit"
a = "add",
r = "remove",
l = "list",
t = "test",
q = "quit"
}
local cmd
local data_idx = 1
for opt, optarg, optind, longind in p.getopt(arg, short, long) do
if opt == '?' then
print("Unrecognized option")
os.exit(1)
elseif opt == 'h' then
print("Usage: rulc [-h|-p PORT|-a|-r|-l|-t|-q] DATA ...")
os.exit(0)
elseif opt == 'p' then
port = optarg
else
cmd = cmd_assoc[opt]
end
data_idx = optind
if opt == '?' then
print("Unrecognized option")
os.exit(1)
elseif opt == 'h' then
print("Usage: rulc [-h|-p PORT|-a|-r|-l|-t|-q] DATA ...")
os.exit(0)
elseif opt == 'p' then
port = optarg
else
cmd = cmd_assoc[opt]
end
data_idx = optind
end
if not cmd then
os.exit(1)
os.exit(1)
end
local msg = cmd
if cmd == "test" then
msg = string.format("%s {class=%q, instance=%q, title=%q, type=%q, state=%q}", msg, arg[data_idx], arg[data_idx+1], arg[data_idx+2], arg[data_idx+3], arg[data_idx+4])
msg = string.format("%s {class=%q, instance=%q, title=%q, type=%q, state=%q}", msg, arg[data_idx], arg[data_idx+1], arg[data_idx+2], arg[data_idx+3], arg[data_idx+4])
elseif cmd == "add" then
msg = string.format("%s {%q, %q, %s}", msg, arg[data_idx], arg[data_idx+1], arg[data_idx+2] and string.format("{%s}", arg[data_idx+2]) or "")
msg = string.format("%s {%q, %q, %s}", msg, arg[data_idx], arg[data_idx+1], arg[data_idx+2] and string.format("{%s}", arg[data_idx+2]) or "")
elseif cmd == "remove" then
msg = string.format("%s %s", msg, arg[data_idx])
msg = string.format("%s %s", msg, arg[data_idx])
end
local fd = p.socket(p.AF_INET, p.SOCK_STREAM, 0)
local s = p.connect(fd, {family=p.AF_INET, addr="127.0.0.1", port=port})
if not s then
p.close(fd)
os.exit(1)
p.close(fd)
os.exit(1)
end
p.send(fd, msg)
rsp = p.recv(fd, p.BUFSIZ)
if rsp and #rsp > 0 then
print(rsp)
print(rsp)
end
p.close(fd)

View file

@ -5,64 +5,64 @@ local port = 54321
local short = "hp:"
local long = {
{"help", "none", 'h'},
{"port", "required", 'p'},
{"help", "none", 'h'},
{"port", "required", 'p'},
}
local rules = {}
for opt, optarg, optind, longind in p.getopt(arg, short, long) do
if opt == '?' then
print("Unrecognized option")
os.exit(1)
elseif opt == 'h' then
print("Usage: ruld [-h|-p PORT]")
os.exit(0)
elseif opt == 'p' then
port = optarg
end
if opt == '?' then
print("Unrecognized option")
os.exit(1)
elseif opt == 'h' then
print("Usage: ruld [-h|-p PORT]")
os.exit(0)
elseif opt == 'p' then
port = optarg
end
end
function eval(exp, env)
local f
local value = "return " .. exp
if env then
f = load(value, nil, nil, env)
else
f = load(value)
end
return f and f()
local f
local value = "return " .. exp
if env then
f = load(value, nil, nil, env)
else
f = load(value)
end
return f and f()
end
function test(env)
local rsp = ""
for index = #rules, 1, -1 do
local entry = rules[index]
if eval(entry[1], env) then
local delay, duration
if entry[3] then
delay = entry[3].delay
duration = entry[3].duration
if delay and delay > 0 then
entry[3].delay = delay - 1
end
if ((not delay) or delay == 0) and duration and duration > 0 then
entry[3].duration = duration - 1
end
end
if (((not delay) or delay == 0) and ((not duration) or duration > 0)) then
if #rsp > 0 then
rsp = rsp .. " " .. entry[2]
else
rsp = entry[2]
end
end
if duration and duration <= 1 then
table.remove(rules, index)
end
end
end
return rsp
local rsp = ""
for index = #rules, 1, -1 do
local entry = rules[index]
if eval(entry[1], env) then
local delay, duration
if entry[3] then
delay = entry[3].delay
duration = entry[3].duration
if delay and delay > 0 then
entry[3].delay = delay - 1
end
if ((not delay) or delay == 0) and duration and duration > 0 then
entry[3].duration = duration - 1
end
end
if (((not delay) or delay == 0) and ((not duration) or duration > 0)) then
if #rsp > 0 then
rsp = rsp .. " " .. entry[2]
else
rsp = entry[2]
end
end
if duration and duration <= 1 then
table.remove(rules, index)
end
end
end
return rsp
end
local fd = p.socket(p.AF_INET, p.SOCK_STREAM, 0)
@ -72,64 +72,64 @@ p.listen(fd, p.SOMAXCONN)
local running = true
while running do
ret_fd = p.accept(fd)
if ret_fd then
local msg = p.recv(ret_fd, p.BUFSIZ)
if msg then
local cmd, data = nil
sep = msg:find(" ")
if sep then
cmd = msg:sub(1, sep - 1)
data = msg:sub(sep + 1)
else
cmd = msg
end
if cmd == "test" then
local env = eval(data)
if env then
rsp = test(env)
p.send(ret_fd, rsp)
end
elseif cmd == "add" then
local value = eval(data)
if value then
table.insert(rules, value)
end
elseif cmd == "remove" then
if data == "tail" then
table.remove(rules, #rules)
elseif data == "head" then
table.remove(rules, 1)
else
for index = #rules, 1, -1 do
if rules[index][1]:find(data) then
table.remove(rules, index)
end
end
end
elseif cmd == "quit" then
running = false
elseif cmd == "list" then
local rsp = ""
for index, entry in pairs(rules) do
rsp = rsp .. string.format("%s => %s", entry[1], entry[2])
if entry[3] then
if entry[3].delay then
rsp = rsp .. string.format(" @%i", entry[3].delay)
end
if entry[3].duration then
rsp = rsp .. string.format(" +%i", entry[3].duration)
end
end
if index < #rules then
rsp = rsp .. "\n"
end
end
p.send(ret_fd, rsp)
end
end
p.close(ret_fd)
end
ret_fd = p.accept(fd)
if ret_fd then
local msg = p.recv(ret_fd, p.BUFSIZ)
if msg then
local cmd, data = nil
sep = msg:find(" ")
if sep then
cmd = msg:sub(1, sep - 1)
data = msg:sub(sep + 1)
else
cmd = msg
end
if cmd == "test" then
local env = eval(data)
if env then
rsp = test(env)
p.send(ret_fd, rsp)
end
elseif cmd == "add" then
local value = eval(data)
if value then
table.insert(rules, value)
end
elseif cmd == "remove" then
if data == "tail" then
table.remove(rules, #rules)
elseif data == "head" then
table.remove(rules, 1)
else
for index = #rules, 1, -1 do
if rules[index][1]:find(data) then
table.remove(rules, index)
end
end
end
elseif cmd == "quit" then
running = false
elseif cmd == "list" then
local rsp = ""
for index, entry in pairs(rules) do
rsp = rsp .. string.format("%s => %s", entry[1], entry[2])
if entry[3] then
if entry[3].delay then
rsp = rsp .. string.format(" @%i", entry[3].delay)
end
if entry[3].duration then
rsp = rsp .. string.format(" +%i", entry[3].duration)
end
end
if index < #rules then
rsp = rsp .. "\n"
end
end
p.send(ret_fd, rsp)
end
end
p.close(ret_fd)
end
end
p.close(fd)

View file

@ -1,6 +1,6 @@
#! /bin/sh
if [ -e "$BSPWM_TREE" ] ; then
bspc restore -T "$BSPWM_TREE" -H "$BSPWM_HISTORY" -S "$BSPWM_STACK"
rm "$BSPWM_TREE" "$BSPWM_HISTORY" "$BSPWM_STACK"
bspc restore -T "$BSPWM_TREE" -H "$BSPWM_HISTORY" -S "$BSPWM_STACK"
rm "$BSPWM_TREE" "$BSPWM_HISTORY" "$BSPWM_STACK"
fi

View file

@ -1,5 +1,5 @@
super + alt + {_,shift + }Escape
{bspc query -T > "$BSPWM_TREE"; \
bspc query -H > "$BSPWM_HISTORY"; \
bspc quit,\
bspc quit 1}
{bspc query -T > "$BSPWM_TREE"; \
bspc query -H > "$BSPWM_HISTORY"; \
bspc quit,\
bspc quit 1}

View file

@ -1,5 +1,5 @@
#! /bin/sh
while true ; do
bspwm || break
bspwm || break
done

View file

@ -4,5 +4,5 @@ BW=3
bspc config border_width $BW
bspc config window_gap -$BW
for side in top right bottom left ; do
bspc config ${side}_padding $BW
bspc config ${side}_padding $BW
done

View file

@ -1,8 +1,8 @@
#! /bin/sh
if [ $(pgrep -cx panel) -gt 1 ] ; then
printf "%s\n" "The panel is already running." >&2
exit 1
printf "%s\n" "The panel is already running." >&2
exit 1
fi
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
@ -19,15 +19,15 @@ xtitle -sf 'T%s' > "$PANEL_FIFO" &
clock -sf 'S%a %H:%M' > "$PANEL_FIFO" &
case "$flavor" in
bar)
cat "$PANEL_FIFO" | panel_bar | bar &
;;
dzen2)
. panel_colors
FONT_FAMILY='DejaVu Sans'
FONT_SIZE=11
cat "$PANEL_FIFO" | panel_dzen2 -f "$FONT_FAMILY" -s "$FONT_SIZE" | dzen2 -h $PANEL_HEIGHT -dock -ta l -title-name panel -fn "${FONT_FAMILY}:pixelsize=${FONT_SIZE}" -fg "$COLOR_FOREGROUND" -bg "$COLOR_BACKGROUND" &
;;
bar)
cat "$PANEL_FIFO" | panel_bar | bar &
;;
dzen2)
. panel_colors
FONT_FAMILY='DejaVu Sans'
FONT_SIZE=11
cat "$PANEL_FIFO" | panel_dzen2 -f "$FONT_FAMILY" -s "$FONT_SIZE" | dzen2 -h $PANEL_HEIGHT -dock -ta l -title-name panel -fn "${FONT_FAMILY}:pixelsize=${FONT_SIZE}" -fg "$COLOR_FOREGROUND" -bg "$COLOR_BACKGROUND" &
;;
esac
wait

View file

@ -3,57 +3,57 @@
# Example panel for LemonBoy's bar
while read -r line ; do
case $line in
S*)
# clock output
sys_infos="\\br\\f7${line#?}"
;;
T*)
# xtitle output
title="\\br\\f4${line#?}"
;;
W*)
# bspwm internal state
wm_infos=""
IFS=':'
set -- ${line#?}
while [ $# -gt 0 ] ; do
item=$1
name=${item#?}
case $item in
O*)
# focused occupied desktop
wm_infos="$wm_infos \\u3\\br\\fr${name}\\ur"
;;
F*)
# focused free desktop
wm_infos="$wm_infos \\u4\\br\\f7${name}\\ur"
;;
U*)
# focused urgent desktop
wm_infos="$wm_infos \\u9\\br\\fr${name}\\ur"
;;
o*)
# occupied desktop
wm_infos="$wm_infos \\br\\fr${name}"
;;
f*)
# free desktop
wm_infos="$wm_infos \\br\\f7${name}"
;;
u*)
# urgent desktop
wm_infos="$wm_infos \\b1\\fr${name}"
;;
L*)
# layout
layout=$(printf "%s" "${name}" | sed 's/\(.\).*/\U\1/')
wm_infos="$wm_infos \\br\\f2$layout"
;;
esac
shift
done
;;
esac
printf "%s\n" "\\l $wm_infos \\c $title \\r $sys_infos "
case $line in
S*)
# clock output
sys_infos="\\br\\f7${line#?}"
;;
T*)
# xtitle output
title="\\br\\f4${line#?}"
;;
W*)
# bspwm internal state
wm_infos=""
IFS=':'
set -- ${line#?}
while [ $# -gt 0 ] ; do
item=$1
name=${item#?}
case $item in
O*)
# focused occupied desktop
wm_infos="$wm_infos \\u3\\br\\fr${name}\\ur"
;;
F*)
# focused free desktop
wm_infos="$wm_infos \\u4\\br\\f7${name}\\ur"
;;
U*)
# focused urgent desktop
wm_infos="$wm_infos \\u9\\br\\fr${name}\\ur"
;;
o*)
# occupied desktop
wm_infos="$wm_infos \\br\\fr${name}"
;;
f*)
# free desktop
wm_infos="$wm_infos \\br\\f7${name}"
;;
u*)
# urgent desktop
wm_infos="$wm_infos \\b1\\fr${name}"
;;
L*)
# layout
layout=$(printf "%s" "${name}" | sed 's/\(.\).*/\U\1/')
wm_infos="$wm_infos \\br\\f2$layout"
;;
esac
shift
done
;;
esac
printf "%s\n" "\\l $wm_infos \\c $title \\r $sys_infos "
done

View file

@ -14,102 +14,102 @@ FIELDIFS=':'
PADDING=' '
while getopts 'af:s:' opt ; do
case "$opt" in
a)
adaptive_centering=1
;;
f)
font_family=$OPTARG
;;
s)
font_size=$OPTARG
;;
esac
case "$opt" in
a)
adaptive_centering=1
;;
f)
font_family=$OPTARG
;;
s)
font_size=$OPTARG
;;
esac
done
shift $((OPTIND - 1))
while read -r line ; do
case $line in
S*)
# clock output
sys_infos="^fg($COLOR_STATUS_FG)^bg($COLOR_STATUS_BG)${PADDING}${line#?}${PADDING}^fg()^bg()${PADDING}"
;;
T*)
# xtitle output
title="^fg($COLOR_TITLE_FG)^bg($COLOR_TITLE_BG)${PADDING}${line#?}${PADDING}^fg()^bg()"
;;
W*)
# bspwm internal state
wm_infos="$PADDING"
IFS=$FIELDIFS
set -- ${line#?}
while [ $# -gt 0 ] ; do
item=$1
case $item in
[OoFfUu]*)
# desktops
name=${item#?}
case $item in
O*)
# focused occupied desktop
FG=$COLOR_FOCUSED_OCCUPIED_FG
BG=$COLOR_FOCUSED_OCCUPIED_BG
;;
F*)
# focused free desktop
FG=$COLOR_FOCUSED_FREE_FG
BG=$COLOR_FOCUSED_FREE_BG
;;
U*)
# focused urgent desktop
FG=$COLOR_FOCUSED_URGENT_FG
BG=$COLOR_FOCUSED_URGENT_BG
;;
o*)
# occupied desktop
FG=$COLOR_OCUPPIED_FG
BG=$COLOR_OCUPPIED_BG
;;
f*)
# free desktop
FG=$COLOR_FREE_FG
BG=$COLOR_FREE_BG
;;
u*)
# urgent desktop
FG=$COLOR_URGENT_FG
BG=$COLOR_URGENT_BG
;;
esac
wm_infos="${wm_infos}^fg(${FG})^bg(${BG})^ca(1, bspc desktop -f ${name})^ca(2, bspc window -d ${name})${PADDING}${name}${PADDING}^ca()^ca()"
;;
L*)
# layout
layout=$(printf "%s" "${item#?}" | sed 's/^\(.\).*/\U\1/')
wm_infos="${wm_infos}^fg()^bg()${PADDING}${PADDING}^fg($COLOR_LAYOUT_FG)^bg($COLOR_LAYOUT_BG)^ca(1, bspc desktop -l next)${PADDING}$layout${PADDING}^ca()"
;;
esac
shift
done
IFS=$NORMIFS
;;
esac
set -- $(printf '%s\0%s\0%s' "$wm_infos" "$title" "$sys_infos" | sed 's/\^[a-z]\+([^)]*)//g' | xargs -0 txtw -f "$font_family" -s "$font_size")
left_width=$1
center_width=$2
right_width=$3
left_indent=0
right_indent=$((screen_width - right_width))
available_center=$((screen_width - (left_width + right_width)))
if [ $available_center -lt $center_width ] ; then
center_indent=$((left_indent + left_width))
else
if [ $adaptive_centering -eq 1 ] ; then
center_indent=$((left_width + (available_center - center_width) / 2))
else
center_indent=$(( (screen_width - center_width) / 2 ))
fi
fi
printf "%s\n" "^pa($center_indent)$title^pa($left_indent)$wm_infos^pa($right_indent)$sys_infos"
case $line in
S*)
# clock output
sys_infos="^fg($COLOR_STATUS_FG)^bg($COLOR_STATUS_BG)${PADDING}${line#?}${PADDING}^fg()^bg()${PADDING}"
;;
T*)
# xtitle output
title="^fg($COLOR_TITLE_FG)^bg($COLOR_TITLE_BG)${PADDING}${line#?}${PADDING}^fg()^bg()"
;;
W*)
# bspwm internal state
wm_infos="$PADDING"
IFS=$FIELDIFS
set -- ${line#?}
while [ $# -gt 0 ] ; do
item=$1
case $item in
[OoFfUu]*)
# desktops
name=${item#?}
case $item in
O*)
# focused occupied desktop
FG=$COLOR_FOCUSED_OCCUPIED_FG
BG=$COLOR_FOCUSED_OCCUPIED_BG
;;
F*)
# focused free desktop
FG=$COLOR_FOCUSED_FREE_FG
BG=$COLOR_FOCUSED_FREE_BG
;;
U*)
# focused urgent desktop
FG=$COLOR_FOCUSED_URGENT_FG
BG=$COLOR_FOCUSED_URGENT_BG
;;
o*)
# occupied desktop
FG=$COLOR_OCUPPIED_FG
BG=$COLOR_OCUPPIED_BG
;;
f*)
# free desktop
FG=$COLOR_FREE_FG
BG=$COLOR_FREE_BG
;;
u*)
# urgent desktop
FG=$COLOR_URGENT_FG
BG=$COLOR_URGENT_BG
;;
esac
wm_infos="${wm_infos}^fg(${FG})^bg(${BG})^ca(1, bspc desktop -f ${name})^ca(2, bspc window -d ${name})${PADDING}${name}${PADDING}^ca()^ca()"
;;
L*)
# layout
layout=$(printf "%s" "${item#?}" | sed 's/^\(.\).*/\U\1/')
wm_infos="${wm_infos}^fg()^bg()${PADDING}${PADDING}^fg($COLOR_LAYOUT_FG)^bg($COLOR_LAYOUT_BG)^ca(1, bspc desktop -l next)${PADDING}$layout${PADDING}^ca()"
;;
esac
shift
done
IFS=$NORMIFS
;;
esac
set -- $(printf '%s\0%s\0%s' "$wm_infos" "$title" "$sys_infos" | sed 's/\^[a-z]\+([^)]*)//g' | xargs -0 txtw -f "$font_family" -s "$font_size")
left_width=$1
center_width=$2
right_width=$3
left_indent=0
right_indent=$((screen_width - right_width))
available_center=$((screen_width - (left_width + right_width)))
if [ $available_center -lt $center_width ] ; then
center_indent=$((left_indent + left_width))
else
if [ $adaptive_centering -eq 1 ] ; then
center_indent=$((left_width + (available_center - center_width) / 2))
else
center_indent=$(( (screen_width - center_width) / 2 ))
fi
fi
printf "%s\n" "^pa($center_indent)$title^pa($left_indent)$wm_infos^pa($right_indent)$sys_infos"
done

View file

@ -1,2 +1,2 @@
super + alt + Escape
pkill -x panel; bspc quit
pkill -x panel; bspc quit

View file

@ -3,89 +3,89 @@
#
super + alt + Escape
bspc quit
bspc quit
super + w
bspc window -c
bspc window -c
super + t
bspc desktop -l next
bspc desktop -l next
super + b
bspc desktop -B
bspc desktop -B
super + {s,f}
bspc window -t {floating,fullscreen}
bspc window -t {floating,fullscreen}
super + {grave,Tab}
bspc {window,desktop} -f last
bspc {window,desktop} -f last
super + apostrophe
bspc window -s last
bspc window -s last
super + {o,i}
bspc control --record-history off; \
bspc window {older,newer} -f; \
bspc control --record-history on
bspc control --record-history off; \
bspc window {older,newer} -f; \
bspc control --record-history on
super + y
bspc window -w last.manual
bspc window -w last.manual
super + m
bspc window -s biggest
bspc window -s biggest
super + {_,shift + }{h,j,k,l}
bspc window -{f,s} {left,down,up,right}
bspc window -{f,s} {left,down,up,right}
super + {_,shift + }c
bspc window -f {next,prev}
bspc window -f {next,prev}
super + {comma,period}
bspc desktop -C {backward,forward}
bspc desktop -C {backward,forward}
super + bracket{left,right}
bspc desktop -f {prev,next}
bspc desktop -f {prev,next}
super + ctrl + {h,j,k,l}
bspc window -p {left,down,up,right}
bspc window -p {left,down,up,right}
super + ctrl + {_,shift + }space
bspc {window -p cancel,desktop -c}
bspc {window -p cancel,desktop -c}
super + alt + {h,j,k,l}
bspc window -e {left -10,down +10,up -10,right +10}
bspc window -e {left -10,down +10,up -10,right +10}
super + alt + shift + {h,j,k,l}
bspc window -e {right -10,up +10,down -10,left +10}
bspc window -e {right -10,up +10,down -10,left +10}
super + ctrl + {1-9}
bspc window -r 0.{1-9}
bspc window -r 0.{1-9}
super + {_,shift + }{1-9,0}
bspc {desktop -f,window -d} ^{1-9,10}
bspc {desktop -f,window -d} ^{1-9,10}
~button1
bspc pointer -g focus
bspc pointer -g focus
super + button{1-3}
bspc pointer -g {move,resize_side,resize_corner}
bspc pointer -g {move,resize_side,resize_corner}
super + !button{1-3}
bspc pointer -t %i %i
bspc pointer -t %i %i
super + @button{1-3}
bspc pointer -u
bspc pointer -u
#
# wm independent hotkeys
#
super + Return
urxvt
urxvt
super + space
dmenu_run
dmenu_run
# make sxhkd reload its configuration files:
super + Escape
pkill -USR1 -x sxhkd
pkill -USR1 -x sxhkd