Commit Graph

219 Commits

Author SHA1 Message Date
oga
1a74c54fd8 Reduce duplciation of code for checking modifiers in key/mouse bindings.
shaves a bunch of bytes.

ok okan@
2009-08-25 01:44:39 +00:00
oga
9924c77a57 Instead of calling conf_bind*() 50 gazillion times in a row, store an
array with all the parameters in and just loop over that to setup the
default keybindings - it's so much easier to read.

okan@ "love love love"ed this
2009-08-25 01:42:05 +00:00
oga
081d2deacd Add a keybinding to allow horizontal maximisation of a window (CMS-enter).
based on a diff by Thomas Pfaff; thanks!

ok okan@
2009-08-24 23:54:41 +00:00
okan
d893a97dee static local functions and data; almost identical diff from Thomas Pfaff
ok oga@
2009-06-26 12:21:58 +00:00
okan
a7dfb91b88 unroll XCALLOC/XMALLOC macros; since we use xcalloc/xmalloc all over the
place anyway, this makes things a bit more consistent; from Thomas Pfaff

ok oga@
2009-06-20 00:22:39 +00:00
okan
0230e26854 spacing 2009-06-20 00:19:56 +00:00
okan
f18194f34c 'no' is the answer to the comment question: cc->name can't be NULL at
this point due to client_setname()'s work; remove this check.

ok oga@
2009-05-30 00:30:27 +00:00
okan
60e9431c86 redraw all borders at once on reload
"sure" oga@
2009-05-17 23:54:17 +00:00
okan
d3c904a333 a long time coming - re-work the way we deal with colors: since we're
using Xft(3), use it to select the font color as well instead of trying
to build one; properly allocate and free colors at-will, e.g. we now
have configurable colors.

feedback and ok's todd@ and oga@
2009-05-17 23:40:57 +00:00
sthen
5dd486dee8 add a "movetogroup" function, which hides the current window from
display and moves it to another group. useful with the recently added
"grouponly" function, giving the ability to use groups as simple
virtual desktops (similar to e.g. xmonad, dwm and scrotwm).

this doesn't have default keyboard bindings; cwmrc(5) now shows how
you could use these functions (use M-1...9 for grouponly1...9 and
MS-1...9 for movetogroup1...9 to emulate the default dwm bindings).

ok oga@
2009-05-17 17:04:59 +00:00
oga
873b5b8ebb Add a new command (currently no default keybindings for it), grouponly[1-9].
This works like the group select binding, but hides all other groups.

So, the people who've been complaining that they don't get "virtual
desktops" in cwm may want to try this out in cwmrc (from memory, untested):

---

#cwmrc

# add new windows to the current group
set sticky

# automatically sticky windows. xclock for now.
# to make more windows sticky use group_toggle to unset their group
autogroup 0 xclock

# make the group selection keys hide other groups, emulate virtual desktops
bind CM-1 grouponly1
bind CM-2 grouponly2
bind CM-3 grouponly3
bind CM-4 grouponly4
bind CM-5 grouponly5
bind CM-6 grouponly6
bind CM-7 grouponly7
bind CM-8 grouponly8
bind CM-9 grouponly9

---

mostly by sthen, tweaks from me.

ok todd@, "if it works i'm ok with it" okan@, ok sthen@
2009-05-14 16:24:04 +00:00
okan
fcc63352ee no need to use the global here.
ok todd@ oga@
2009-05-04 19:13:33 +00:00
martynas
af87ed9631 add 'moveamount' to cwmrc; it sets keyboard movement amount, making
it more useful on large screens
manpage tweak & ok jmc@
ok okan@, oga@
2009-02-07 21:07:00 +00:00
okan
95be5acd6a passing a null pointer to free() is valid; sprinkle a few free->xfree.
ok oga@
2009-01-23 20:47:45 +00:00
okan
479c9127c8 move conf_clear() and add proto.
ok todd@ oga@
2009-01-23 19:00:59 +00:00
oga
9908d2b7cb Move the keybinding argument to a union to prevent warnings where
sizeof(int) != sizeof(void *). This has been annoying me for ages.

ok okan@, todd@
2009-01-23 18:58:40 +00:00
todd
eeba7da292 borderwidth as a cwmrc(5) keyword, really helps debugging
from okan@
ok oga@
2009-01-21 15:04:38 +00:00
okan
77631d0413 remove pwin, bringing us to one client, one window. we no longer have
to push attributes around, so things get a lot simplier, while fixing a
few issues in the meantime; original suggestion by Edd Barrett many many
moons ago.

annoying window placement and race, found in c2k8 by todd, fix by oga!

lots of feedback from todd and oga - thanks!

"commit that bad boy" oga@
2009-01-16 15:24:14 +00:00
oga
d6ad440728 If the mousebutton is unknown when we go to grab, don't just print a
warning, but also skip the XGrabButton call. Noticed by code inspection
by okan@, but we agreed my fix was cleaner.

ok okan.
2009-01-08 21:35:19 +00:00
oga
cdb45f007b We've been handling grabbing wrong all this time (noticed at c2k8).
add conf_grab() and conf_ungrab, and use them in the keybinding manipulation
functions to {,un}grab the binding for all screens we have defined.

the lovely little ordering problem comes in here, since when we parse
the config initially Screenq is empty, so regrab after we fill the
queue, hopefully later reordering will remove this little need and there
will be much rejoicing.

ok okan.
2008-07-22 20:51:54 +00:00
okan
d9407b888b no more hidden (and mysterious) config reloads and allow binding a key
to a config reload; CMS-r by default.

ok oga@
2008-07-11 15:18:29 +00:00
okan
2e276584ab replace snprintf with strlcpy
ok oga@
2008-07-11 14:24:34 +00:00
okan
cfb9c394cb spacing, declaration lineup to be consistent throughout cwm,
readability, and a bit of knf.

ok oga@
2008-07-11 14:21:28 +00:00
oga
ff24dcbd56 Allow a mouse binding to hide a window, and add a default keybinding for CMS-M3,
so it's hard to press by accident, but there if you need it.

requested (in a way) and tested by johan and todd.
2008-06-25 22:44:42 +00:00
oga
553a7ea586 Support mod4 (windows key) in mouse bindings too. 2008-06-25 22:40:27 +00:00
oga
ff29a8e71a Support shift in mouse bindings. There's really no reason not to.
tested by johan@ and todd@.
2008-06-25 22:38:36 +00:00
oga
5c700f8601 Actually grab the correct mouse buttons for a window, instead of doing the
old hardcoded ones (which now can be wrong).

tested by todd@ and johan@.
2008-06-25 22:37:29 +00:00
oga
81e6cb3e95 Ignore caps lock and numlock for keyboard bindings. The way Xlib makes
you do this is ugly. Also remove mod2 (numlock) and mod3 (odd) from the
list of keybinding modifiers. They don't make much sense here.

based on a heavily modified diff from Martynas.

ok okan.
2008-06-17 23:40:33 +00:00
mk
3d8c29aa2b Make this not crash when compiled with -g.
Found by myself, analysis by kurt@, fix by me with input from otto.

``Just get some fix in...'' deraadt
2008-06-16 19:09:48 +00:00
oga
4ef73665d3 Rip out and burn the HASH_* stuff. We don't need a SPLAY tree for one font.
makes the code a lot simpler. While here rearrange the font handling functions
to be less shit.

ok and help okan@.
2008-06-15 02:47:46 +00:00
okan
a880cefb2e unbreak 2008-06-14 21:59:09 +00:00
okan
b48fb0f64d slightly alter the semantics of config files:
- if no config file, continue silently and apply defaults
 - if config file, parse and move on
 - if config file specified but not found, error out

ok oga@
2008-06-14 21:51:00 +00:00
okan
4a6468a264 confable menu and window mouse bindings from rivo nurges (thanks!) with
some minor fixups, man page bits and knf.

ok oga@
2008-06-14 21:48:54 +00:00
okan
9005249c59 actually honor termpath and lockpath if specified in cwmrc.
"now" oga@
2008-06-05 00:07:05 +00:00
oga
f8b4088fad General cleanup.
ok okan@.
2008-05-19 18:53:09 +00:00
okan
7f3adeacc7 as done with cycle/rcycle, make prev/next group switching one kbfuncs
and use a flag; adjusted to match and rename to {r,}cycle.

"ok, since i came up with the same thing" oga@
2008-05-19 17:11:19 +00:00
oga
80fd601708 Use the XGrabKeyboard hack in for alt-tabbing as well. This stops the
mru getting the order messed up when gvim/xpdf et all steal key events.

While i'm here, change the logic in client_cyclenext() to use break instead
of goto, it's nicer that way.

Thirdly, instead of two different kbfuncs, just use the one and a flag.

"put your cycle diff in so I can pkg_delete gvim" okan@
2008-05-19 15:17:50 +00:00
okan
0a4376b166 finally implement keyboard binding for group toggling
idea for the
    "slightly-less-abhorrent-hack-but-a-hack-nonetheless-TM" from oga@

grab and ungrab the keyboard to get around some silly X apps that like
stealing events

ok oga@
2008-05-19 12:56:58 +00:00
oga
ca54149838 Fix two problems with conf_unbind():
1) it used TAILQ_FOREACH() when it's removing entrys from the list, this
   is bad.
2) We didn't free key, so there was a small memleak too.

also rework conf_bindname's logic slightly to be more simple.

ok okan@
2008-05-18 19:47:19 +00:00
oga
61bdc5d36a Kill conf_get_int(), it was a silly function anyway.
Since it's only used once just put the (simplified) logic into
conf_client() instead. This  means we can kill an enum and
CONF_IGNORECASE, too.

ok okan@
2008-05-18 19:43:50 +00:00
oga
4539521994 KNF, no binary change.
From Pierre Riteau. Thanks!
2008-05-15 22:18:00 +00:00
oga
eb613a1bb7 merge kbfunc_{ptrmove,client_{move,resize}} into one function that takes a flag,
this code was almost identical...

ok okan.
2008-04-16 13:47:29 +00:00
oga
f062e958e0 Replace a few leftover calls to strdup and calloc with xstrdup and xcalloc
respectively.

ok okan.
2008-04-16 13:38:09 +00:00
oga
26beb05af2 hit it with the knf stick. 2008-04-15 20:24:41 +00:00
okan
fdb2248a19 better 'quit' keybinding default (CMS-q)
feedback from oga@ and simon@

ok oga@ simon@
2008-04-08 14:12:28 +00:00
simon
8797c69ac9 Add quit function, bind it per default to CM-q and change exec_wm
binding to CM-w.

Inital diff from Gleydson Soares
Feedback from oga@ and okan@

ok oga@
2008-04-07 23:47:09 +00:00
simon
0141485332 Replace the symlink configuration scheme with a simple yacc parser as
found in other places of the tree.  Remove sticky and font commandline
options and add another one for alternative config locations.
Split off cwmrc(5) from cwm(1), nuke #ifdef __OpenBSD__ while there.

tested by various kind people, feedback from oga@ and okan@ - thanks!
ok oga@, jasper@, okan@
2008-03-23 15:09:21 +00:00
oga
d8e2d259e2 Rip out, burn, and dance around the grave of group-edit mode.
I've yet to speak to anyone who uses it, so just kill it.

You can still add/remove from groups using the mouse binding.  Groups
may get a re-work sometime soon if i have a stroke of genius.

knocks about 4k off the i386 binary for me.

ok okan@, todd@.
2008-03-22 15:09:45 +00:00
oga
92c71b48a2 client_{,r}cycle() doens't need a client. so get rid of KBFUNC_NEEDSCLIENT.
this prevents the issue where you close or hide a window, and end up
with no client selected (you're on the root window). When that happened
alt-tab failed.  This, however, exposed to me a few more issues in the
alt-tabbing code:

-the code to detect how many lines we need looks bogus (you always get
three)

-alt-tabbing when everything is hidden always reawakes the most recent
window.

Fixes for these will be forthcoming.

ok simon@.
2008-03-18 00:48:56 +00:00
oga
78d222002b huge amount of cleanup and dead code removal.
full description of changes:
-remove fontlist, and all associated structures/calls, it's not needed.
 this also removes any doubt about leftover 9wm code (the list was
 borrowed from it). Since cwm now uses Xft for everything, the legacy
 font handling is just not needed.
-add /* FALLTHROUGH */ comments into grab_{label,menu}. I actually
 didn't intend grab_menu to be a fallthrough, but it actually works quite
 well there, so remove the extra rectangle drawing. I love it when that
 happens.
-remove a couple of unused prototypes that were obviously missed
 before.
-remove a bunch of commented out or if 0ed out code. It doesn't look to
 be coming back anytime soon.
-several functions returned an int, but this was never checked. most of
 them only failed if they failed to grab the pointer (thus the internal
 state didn't change), so just make them void and return early if this is
 the case.
-remove several unused functions and some useless variables.

knocks something like 200bytes off the stripped binary size for me.

ok marc@, tested by several others.
2008-01-16 11:39:20 +00:00
oga
1385b56548 - Remove the "all rights reserved" tag at the top of most of the source
files, and replace them with the actual ISC license.

- add license to the manpage (it was lacking before)

- correct license statement in the README

Permission given by Marius (copyright holder):
"1. please replace with the standard ISC license
2. you may add the ISC license to the man page
3. feel free to replace the information in the README as well"

and Dros (copyright holder for group.c):
"Please switch group.c to the ISC License."

ok ian@
2008-01-11 16:06:44 +00:00
oga
52cb71d16c Kill some warnings intoduced with the execwm feature.
ok marc@
2008-01-03 01:56:25 +00:00
okan
66ad53aad5 allow the search feature to work in the root window, like other similar ones.
ok todd@
2007-12-31 02:49:45 +00:00
ian
bb9a96e5b3 Add a "restart wm" function. ok oga@ 2007-11-28 16:35:52 +00:00
oga
cd016f1192 Another messed up keybinding.
I blame todd...

ok okan@
2007-11-28 16:02:37 +00:00
okan
b017f68352 re-add a lost group keybinding
ok oga@ todd@
2007-11-27 17:17:08 +00:00
oga
cc56ce7a75 Make cwm default keybindings always exist. Additional keybindings now
overlap with the new ones, overriding them. Also a new "unmap" keyword
in binding definitions now unmaps a binding without adding a new one.

This seriously shrinks the ~/.calmwm/.keys directory of anyone who defines
their own bindings whilst wanting some of the defaults.

Looked over, liked and ok todd@
2007-11-19 22:18:16 +00:00
todd
f18f596ede introduce conf_bindname() to drastically simplify conf.c
really liked by oga@
2007-11-13 23:26:04 +00:00
todd
87e41b32a9 enable pointer movement in cwm via C-<arrowkeys>
looked over by oga@
2007-11-13 23:08:49 +00:00
oga
d65837aad5 Document cwm's keybinding support. It was already there, but not in the manpage.
While I'm here add support for extra modifier keys.

"commit commit!" jasper@, ok todd@.
2007-11-07 22:00:26 +00:00
oga
7732ed6345 Add support to cwm for resizing the windows using Control-Meta-[hjkl].
Please note that this remaps Control-Meta-L (label) to Control-Meta-N (name).

ok jasper@, todd@.
2007-11-07 21:58:03 +00:00
todd
4253076c6b implement keyboard initiated movement of windows
enhanced version of diff originally from niallo@
man bits from niallo@
ok niallo@ japser@
2007-06-27 13:28:22 +00:00
niallo
b321a79f63 modify "exec" dialog so that it auto-completes based on executables in
_PATH_DEFPATH

add an "ssh-to" dialog which auto-completes based on contents of
 ~/.ssh/known_hosts (M-.)

testing and eyeballing by Simon Kuhnle <simonkuhnle at web.de>, todd@, pedro@
mk@ and David Cathcart <david at cathcart.cx>

ok todd@
2007-06-26 19:34:26 +00:00
jasper
f1ac24d0ea make it possible to cycle through the windows when non are selected.
(eg. when they're hidden, now you can cycle through them)

from aon@iki.fi
2007-06-05 19:03:20 +00:00
jasper
4c01ca1125 add two missing closedir()'s
from Antti Nykänen <aon at iki.fi> via bernd@

ok pedro@
2007-05-28 21:11:39 +00:00
jasper
857d1a8dab convert globals from G_foo to Foo, as per TODO.
"looks good" pedro@, ok matthieu@
2007-05-28 18:34:27 +00:00
jasper
c3fa8832ed full screen sized windows
ok matthieu@
2007-05-27 09:23:12 +00:00
bernd
7065381a5a Apply cwm-3-exec.diff from http://aon.iki.fi/cwm/. Document the new
key binding.
2007-04-27 18:08:14 +00:00
bernd
1d12f3d8c4 Initial import of cwm-3.
tested by sturm@, ok matthieu@
2007-04-27 17:58:48 +00:00