add scratch window support
This commit is contained in:
parent
8567009d22
commit
b2e004b453
|
@ -87,6 +87,10 @@ Client
|
|||
Move client window with mouse.
|
||||
*client_resizemouse*::
|
||||
Resize client window with mouse.
|
||||
*client_setscratch*::
|
||||
Set or unset client as being the scratch window.
|
||||
*client_togglescratch*::
|
||||
Toggle scratch window.
|
||||
|
||||
Tag
|
||||
~~~
|
||||
|
|
12
awesomerc.in
12
awesomerc.in
|
@ -316,6 +316,18 @@ keys
|
|||
command = "client_togglefloating"
|
||||
}
|
||||
key
|
||||
{
|
||||
modkey = {"Mod4"}
|
||||
key = "s"
|
||||
command = "client_togglescratch"
|
||||
}
|
||||
key
|
||||
{
|
||||
modkey = {"Mod4", "Control"}
|
||||
key = "s"
|
||||
command = "client_setscratch"
|
||||
}
|
||||
key
|
||||
{
|
||||
modkey = {"Mod4", "Shift"}
|
||||
key = "c"
|
||||
|
|
40
client.c
40
client.c
|
@ -704,6 +704,9 @@ client_isvisible(Client *c, int screen)
|
|||
if(!c || c->screen != screen)
|
||||
return False;
|
||||
|
||||
if(globalconf.scratch.client == c)
|
||||
return globalconf.scratch.isvisible;
|
||||
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
if(tag->selected && is_client_tagged(c, tag))
|
||||
return True;
|
||||
|
@ -1079,4 +1082,41 @@ uicb_client_togglefloating(int screen __attribute__ ((unused)),
|
|||
client_setfloating(globalconf.focus->client, !globalconf.focus->client->isfloating);
|
||||
}
|
||||
|
||||
/** Toggle scratch client attribute
|
||||
* \param screen screen number
|
||||
* \param arg unused argument
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_setscratch(int screen,
|
||||
char *arg __attribute__ ((unused)))
|
||||
{
|
||||
if(!globalconf.focus->client)
|
||||
return;
|
||||
|
||||
if(globalconf.scratch.client == globalconf.focus->client)
|
||||
globalconf.scratch.client = NULL;
|
||||
else
|
||||
globalconf.scratch.client = globalconf.focus->client;
|
||||
|
||||
widget_invalidate_cache(screen, WIDGET_CACHE_CLIENTS | WIDGET_CACHE_TAGS);
|
||||
globalconf.screens[screen].need_arrange = True;
|
||||
}
|
||||
|
||||
/** Toggle scratch client visibility
|
||||
* \param screen screen number
|
||||
* \param arg unused argument
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_client_togglescratch(int screen __attribute__ ((unused)),
|
||||
char *arg __attribute__ ((unused)))
|
||||
{
|
||||
if(globalconf.scratch.client)
|
||||
{
|
||||
globalconf.scratch.isvisible = !globalconf.scratch.isvisible;
|
||||
globalconf.screens[globalconf.scratch.client->screen].need_arrange = True;
|
||||
widget_invalidate_cache(globalconf.scratch.client->screen, WIDGET_CACHE_CLIENTS);
|
||||
}
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
2
client.h
2
client.h
|
@ -52,6 +52,8 @@ Uicb uicb_client_zoom;
|
|||
Uicb uicb_client_focusnext;
|
||||
Uicb uicb_client_focusprev;
|
||||
Uicb uicb_client_togglefloating;
|
||||
Uicb uicb_client_togglescratch;
|
||||
Uicb uicb_client_setscratch;
|
||||
|
||||
DO_SLIST(Client, client, p_delete);
|
||||
|
||||
|
|
4
config.c
4
config.c
|
@ -19,10 +19,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup ui_callback User Interface Callbacks
|
||||
*/
|
||||
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#include "config.h"
|
||||
|
|
|
@ -314,6 +314,12 @@ struct AwesomeConf
|
|||
Cursor cursor[CurLast];
|
||||
/** Clients list */
|
||||
Client *clients;
|
||||
/** Scratch client */
|
||||
struct
|
||||
{
|
||||
Client *client;
|
||||
Bool isvisible;
|
||||
} scratch;
|
||||
/** Path to config file */
|
||||
char *configpath;
|
||||
/** Selected clients history */
|
||||
|
|
4
uicb.c
4
uicb.c
|
@ -19,6 +19,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup ui_callback User Interface Callbacks
|
||||
*/
|
||||
|
||||
#include "awesome.h"
|
||||
#include "xutil.h"
|
||||
#include "tag.h"
|
||||
|
|
|
@ -40,8 +40,9 @@ isoccupied(Tag *t)
|
|||
Client *c;
|
||||
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(is_client_tagged(c, t) && !c->skip)
|
||||
if(is_client_tagged(c, t) && !c->skip && c != globalconf.scratch.client)
|
||||
return True;
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,15 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
|||
widget->font->height / 2, widget->font, c->name,
|
||||
d->fg, d->bg);
|
||||
|
||||
if(c->isfloating || c->ismax)
|
||||
if(c == globalconf.scratch.client)
|
||||
{
|
||||
area.x = widget->area.x + icon_width + box_width * i;
|
||||
area.y = widget->area.y;
|
||||
area.width = (widget->font->height + 2) / 3;
|
||||
area.height = (widget->font->height + 2) / 3;
|
||||
draw_rectangle(ctx, area, c->isfloating, d->fg);
|
||||
}
|
||||
else if(c->isfloating || c->ismax)
|
||||
draw_circle(ctx, widget->area.x + icon_width + box_width * i,
|
||||
widget->area.y,
|
||||
(widget->font->height + 2) / 4,
|
||||
|
|
Loading…
Reference in New Issue