mirror of
https://github.com/0intro/wmii
synced 2024-11-22 13:52:17 +03:00
Fix build on GCC.
This commit is contained in:
parent
56d4c9af9f
commit
125e75173a
@ -301,7 +301,7 @@ TColMap(Biobuf *b, va_list *ap) {
|
|||||||
};
|
};
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
key = va_arg(ap, int);
|
key = va_arg(*ap, int);
|
||||||
Bprint(b, "%s", search(list, key, strign));
|
Bprint(b, "%s", search(list, key, strign));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
config.mk
14
config.mk
@ -9,20 +9,20 @@ LIBDIR = ${PREFIX}/lib
|
|||||||
INCLUDE = ${PREFIX}/include
|
INCLUDE = ${PREFIX}/include
|
||||||
|
|
||||||
# Includes and libs
|
# Includes and libs
|
||||||
INCPATH = .:${HOME}/libixp/include:${ROOT}/include:${INCLUDE}:/usr/include
|
INCPATH = .:${ROOT}/include:${INCLUDE}:/usr/include
|
||||||
LIBS = -L/usr/lib -lc -L${ROOT}/lib -L${HOME}/libixp/lib
|
LIBS = -L/usr/lib -lc -L${ROOT}/lib
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
#include ${ROOT}/mk/gcc.mk
|
include ${ROOT}/mk/gcc.mk
|
||||||
CFLAGS = -wF -DVARARGCK
|
CFLAGS += -g -O0
|
||||||
LDFLAGS += ${LIBS}
|
LDFLAGS += -g ${LIBS}
|
||||||
STATIC = -static
|
STATIC = -static
|
||||||
MKDEP = cpp -M
|
MKDEP = cpp -M
|
||||||
|
|
||||||
# Compiler
|
# Compiler
|
||||||
CC = 8cc
|
CC = cc -c
|
||||||
# Linker (Under normal circumstances, this should *not* be 'ld')
|
# Linker (Under normal circumstances, this should *not* be 'ld')
|
||||||
LD = : 8l
|
LD = cc
|
||||||
# Archiver
|
# Archiver
|
||||||
AR = ar crs
|
AR = ar crs
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ char *str_nil(char *s);
|
|||||||
uint strlcat(char *dst, const char *src, unsigned int siz);
|
uint strlcat(char *dst, const char *src, unsigned int siz);
|
||||||
|
|
||||||
char *argv0;
|
char *argv0;
|
||||||
static void *__p;
|
void *__p;
|
||||||
static int __i;
|
int __i;
|
||||||
#undef ARGBEGIN
|
#undef ARGBEGIN
|
||||||
#undef ARGEND
|
#undef ARGEND
|
||||||
#undef ARGF
|
#undef ARGF
|
||||||
|
@ -145,6 +145,7 @@ fn Action {
|
|||||||
}
|
}
|
||||||
fn Action-rehash { proglist $PATH >$progs_file }
|
fn Action-rehash { proglist $PATH >$progs_file }
|
||||||
fn Action-quit { wmiir xwrite /ctl quit }
|
fn Action-quit { wmiir xwrite /ctl quit }
|
||||||
|
fn Action-exec { wmiir xwrite /ctl exec $* }
|
||||||
fn Action-status {
|
fn Action-status {
|
||||||
flag x -
|
flag x -
|
||||||
flag r -
|
flag r -
|
||||||
|
118
rc/sh.wmii
118
rc/sh.wmii
@ -69,9 +69,19 @@ subfn lines {
|
|||||||
result = `{$arg}
|
result = `{$arg}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn 'fn?' {
|
||||||
|
args := $*
|
||||||
|
~ ("{rescue '*' {} {whatis $args >[2]/dev/null}}
|
||||||
|
'load std; fn '*)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ifx {
|
||||||
|
(pred fn val args) := $*
|
||||||
|
if {$pred $val} {$fn $val $args}
|
||||||
|
}
|
||||||
|
|
||||||
fn dofn {
|
fn dofn {
|
||||||
(cmd args) := $*
|
ifx 'fn?' {$*} $*
|
||||||
if {~ "{whatis $cmd >[2]/dev/null} 'load std; fn '*} {$cmd $args;{}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_command {
|
fn run_command {
|
||||||
@ -87,44 +97,45 @@ subfn config_whatis {
|
|||||||
result=${lines {os rc -c 'PATH=$WMII_CONFPATH which $*' $* </dev/null} $*}
|
result=${lines {os rc -c 'PATH=$WMII_CONFPATH which $*' $* </dev/null} $*}
|
||||||
}
|
}
|
||||||
|
|
||||||
local := $home/.wmii-3.5/sh.wmii.local
|
|
||||||
if {ftest -x $local} {run $local}
|
|
||||||
|
|
||||||
# Status Bar Info
|
# Status Bar Info
|
||||||
fn status {
|
fn status {
|
||||||
echo ${re mg '[0-9]+\.[0-9]+' "{os uptime}} '|' `{date}
|
echo ${re mg '[0-9]+\.[0-9]+' "{os uptime}} '|' `{date}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(i in Key Event Action) {
|
||||||
|
'{fn $i { fn '$i'-$1 ${tl $*} }}'
|
||||||
|
}
|
||||||
|
|
||||||
# Events
|
# Events
|
||||||
fn Event-Start {
|
Event Start {
|
||||||
if {~ $1 wmiirc} {
|
if {~ $1 wmiirc} {
|
||||||
rm -f $progs_file
|
rm -f $progs_file
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Event-Key {
|
Event Key {
|
||||||
dprint Key-$1
|
dprint Key-$1
|
||||||
Key-$1 $1
|
Key-$1 $1
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Event-CreateTag { echo $WMII_NORMCOLORS $* > /lbar/$"* }
|
Event CreateTag { echo $WMII_NORMCOLORS $* > /lbar/$"* }
|
||||||
fn Event-DestroyTag { rm /lbar/$"* }
|
Event DestroyTag { rm /lbar/$"* }
|
||||||
fn Event-FocusTag { echo $WMII_FOCUSCOLORS $* > /lbar/$"* }
|
Event FocusTag { echo $WMII_FOCUSCOLORS $* > /lbar/$"* }
|
||||||
fn Event-UnfocusTag { echo $WMII_NORMCOLORS $* > /lbar/$"* }
|
Event UnfocusTag { echo $WMII_NORMCOLORS $* > /lbar/$"* }
|
||||||
fn Event-UrgentTag { echo '*'${ftl $*} > /lbar/${ftl $*} }
|
Event UrgentTag { echo '*'${ftl $*} > /lbar/${ftl $*} }
|
||||||
fn Event-NotUrgentTag { echo ${tl $*} > /lbar/${ftl $*} }
|
Event NotUrgentTag { echo ${tl $*} > /lbar/${ftl $*} }
|
||||||
|
|
||||||
fn Event-LeftBarClick {
|
Event LeftBarClick {
|
||||||
(button name) := $*
|
(button name) := $*
|
||||||
if {~ $button 1} { echo view $name >/ctl }
|
if {~ $button 1} { echo view $name >/ctl }
|
||||||
}
|
}
|
||||||
fn Event-LeftBarMouseDown {
|
Event LeftBarMouseDown {
|
||||||
(button name) := $*
|
(button name) := $*
|
||||||
if {~ $button 3} { echo view "{9menu ${lines read_tags}} >/ctl & }
|
if {~ $button 3} { echo view "{9menu ${lines read_tags}} >/ctl & }
|
||||||
}
|
}
|
||||||
lastcmd=''
|
lastcmd=''
|
||||||
fn Event-ClientMouseDown {
|
Event ClientMouseDown {
|
||||||
(client button) := $*
|
(client button) := $*
|
||||||
if {~ $button 3} {
|
if {~ $button 3} {
|
||||||
lastcmd = `{9menu -initial $lastcmd Nop Delete Fullscreen}
|
lastcmd = `{9menu -initial $lastcmd Nop Delete Fullscreen}
|
||||||
@ -137,28 +148,30 @@ fn Event-ClientMouseDown {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Actions
|
# Actions
|
||||||
fn Action {
|
Action quit { echo quit >>/ctl }
|
||||||
(action args) := $*
|
Action rehash {
|
||||||
or {dofn Action-$action $args} {run_command ${config_whatis $action} $args}
|
|
||||||
}
|
|
||||||
fn Action-quit { echo quit >>/ctl }
|
|
||||||
fn Action-rehash {
|
|
||||||
flag x -
|
flag x -
|
||||||
proglist ${hostenv PATH} >$progs_file
|
proglist ${hostenv PATH} >$progs_file
|
||||||
}
|
}
|
||||||
fn Action-status {
|
Action status {
|
||||||
flag x -
|
flag x -
|
||||||
if {rm /rbar/status >[2]/dev/null} { sleep 1 }
|
if {rm /rbar/status >[2]/dev/null} { sleep 1 }
|
||||||
echo $WMII_NORMCOLORS >/rbar/status
|
echo $WMII_NORMCOLORS >/rbar/status
|
||||||
while {status >/rbar/status} { sleep 1 }
|
while {status >/rbar/status} { sleep 1 }
|
||||||
}
|
}
|
||||||
fn Action-sh.wmii {
|
|
||||||
os -b inferno $argv0 &
|
ifx {ftest -x $*} {run $*} $home/.wmii-3.5/sh.wmii.local
|
||||||
exit
|
fn Key { ifx {! 'fn?' $*} {fn $*} Key-$1 ${tl $*} }
|
||||||
|
|
||||||
|
fn Action {
|
||||||
|
(action args) := $*
|
||||||
|
or {dofn Action-$action $args} {
|
||||||
|
ifx {! ~ $#* 0} {run_command $*} ${config_whatis $action} $args
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Key Bindings
|
# Key Bindings
|
||||||
fn Key-$MODKEY-Control-t {
|
Key $MODKEY-Control-t {
|
||||||
if { ~ `{wc -l /keys} 0 1} {
|
if { ~ `{wc -l /keys} 0 1} {
|
||||||
initkeys
|
initkeys
|
||||||
grabmod $MODKEY >/ctl
|
grabmod $MODKEY >/ctl
|
||||||
@ -168,36 +181,36 @@ fn Key-$MODKEY-Control-t {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Key-$MODKEY-$LEFT { echo select left >/tag/sel/ctl }
|
Key $MODKEY-$LEFT { echo select left >/tag/sel/ctl }
|
||||||
fn Key-$MODKEY-$RIGHT { echo select right >/tag/sel/ctl }
|
Key $MODKEY-$RIGHT { echo select right >/tag/sel/ctl }
|
||||||
fn Key-$MODKEY-$UP { echo select up >/tag/sel/ctl }
|
Key $MODKEY-$UP { echo select up >/tag/sel/ctl }
|
||||||
fn Key-$MODKEY-$DOWN { echo select down >/tag/sel/ctl }
|
Key $MODKEY-$DOWN { echo select down >/tag/sel/ctl }
|
||||||
|
|
||||||
fn Key-$MODKEY-Shift-$LEFT { echo send sel left >/tag/sel/ctl }
|
Key $MODKEY-Shift-$LEFT { echo send sel left >/tag/sel/ctl }
|
||||||
fn Key-$MODKEY-Shift-$RIGHT { echo send sel right >/tag/sel/ctl }
|
Key $MODKEY-Shift-$RIGHT { echo send sel right >/tag/sel/ctl }
|
||||||
fn Key-$MODKEY-Shift-$DOWN { echo send sel down >/tag/sel/ctl }
|
Key $MODKEY-Shift-$DOWN { echo send sel down >/tag/sel/ctl }
|
||||||
fn Key-$MODKEY-Shift-$UP { echo send sel up >/tag/sel/ctl }
|
Key $MODKEY-Shift-$UP { echo send sel up >/tag/sel/ctl }
|
||||||
|
|
||||||
fn Key-$MODKEY-space { echo select toggle >/tag/sel/ctl }
|
Key $MODKEY-space { echo select toggle >/tag/sel/ctl }
|
||||||
fn Key-$MODKEY-Shift-space { echo send sel toggle >/tag/sel/ctl }
|
Key $MODKEY-Shift-space { echo send sel toggle >/tag/sel/ctl }
|
||||||
|
|
||||||
fn Key-$MODKEY-d { echo colmode sel default >/tag/sel/ctl }
|
Key $MODKEY-d { echo colmode sel default >/tag/sel/ctl }
|
||||||
fn Key-$MODKEY-s { echo colmode sel stack >/tag/sel/ctl }
|
Key $MODKEY-s { echo colmode sel stack >/tag/sel/ctl }
|
||||||
fn Key-$MODKEY-m { echo colmode sel max >/tag/sel/ctl }
|
Key $MODKEY-m { echo colmode sel max >/tag/sel/ctl }
|
||||||
|
|
||||||
fn Key-$MODKEY-Shift-c { echo kill >/client/sel/ctl }
|
Key $MODKEY-Shift-c { echo kill >/client/sel/ctl }
|
||||||
|
|
||||||
fn Key-$MODKEY-a { Action `{actionlist | wmiimenu} & }
|
Key $MODKEY-a { Action `{actionlist | wmiimenu} & }
|
||||||
fn Key-$MODKEY-p { run_command rc -c "{wmiimenu <$progs_file} & }
|
Key $MODKEY-p { run_command rc -c "{wmiimenu <$progs_file} & }
|
||||||
fn Key-$MODKEY-Return { run_command $WMII_TERM & }
|
Key $MODKEY-Return { run_command $WMII_TERM & }
|
||||||
fn Key-$MODKEY-t { echo view `{read_tags | wmiimenu} >/ctl & }
|
Key $MODKEY-t { echo view `{read_tags | wmiimenu} >/ctl & }
|
||||||
fn Key-$MODKEY-Shift-t {
|
Key $MODKEY-Shift-t {
|
||||||
sel := "{cat /client/sel/ctl}
|
sel := "{cat /client/sel/ctl}
|
||||||
read_tags | wmiimenu >/client/$sel/tags
|
read_tags | wmiimenu >/client/$sel/tags
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Key-$MODKEY-^${seq 0 9} { echo view ${tl ${splitr $1 -}} >/ctl }
|
Key $MODKEY-^${seq 0 9} { echo view ${tl ${splitr $1 -}} >/ctl }
|
||||||
fn Key-Shift-$MODKEY-${seq 0 9} { echo ${tl ${splitr $1 -}} >/client/sel/tags}
|
Key Shift-$MODKEY-${seq 0 9} { echo ${tl ${splitr $1 -}} >/client/sel/tags}
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
fn proglist {
|
fn proglist {
|
||||||
@ -238,12 +251,13 @@ fn read_tags {
|
|||||||
|
|
||||||
# Misc Setup
|
# Misc Setup
|
||||||
os xsetroot -solid $WMII_BACKGROUND </dev/null
|
os xsetroot -solid $WMII_BACKGROUND </dev/null
|
||||||
|
|
||||||
|
dofn Local-Overrides
|
||||||
|
|
||||||
Action status &
|
Action status &
|
||||||
progs_file=/tmp/proglist.${pid}
|
progs_file=/tmp/proglist.${pid}
|
||||||
Action rehash &
|
Action rehash &
|
||||||
|
|
||||||
dofn Local-Overrides
|
|
||||||
|
|
||||||
# Tag Bar Setup
|
# Tag Bar Setup
|
||||||
seltag=${lines sed 1q /tag/sel/ctl}
|
seltag=${lines sed 1q /tag/sel/ctl}
|
||||||
comm -13 ${pipe from {read_tags}} ${pipe from {ls -p /lbar/*}} |
|
comm -13 ${pipe from {read_tags}} ${pipe from {ls -p /lbar/*}} |
|
||||||
@ -266,9 +280,7 @@ getlines {
|
|||||||
(event args) := ${split ' ' $line}
|
(event args) := ${split ' ' $line}
|
||||||
dprint Event-$event: $args
|
dprint Event-$event: $args
|
||||||
rescue '*' { dprint Exception: $exception } {
|
rescue '*' { dprint Exception: $exception } {
|
||||||
if {whatis Event-$event >/dev/null >[2=1]} {
|
dofn Event-$event $args
|
||||||
Event-$event $args
|
|
||||||
}
|
|
||||||
} </dev/null
|
} </dev/null
|
||||||
dprint loop
|
dprint loop
|
||||||
} </event
|
} </event
|
||||||
|
Loading…
Reference in New Issue
Block a user