howm
howm
client.c File Reference

Operations that are to be performed on clients, such as moving them around in the client list. More...

#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <xcb/xcb.h>
#include <xcb/xcb_ewmh.h>
#include <xcb/xcb_icccm.h>
#include "client.h"
#include "helper.h"
#include "howm.h"
#include "layout.h"
#include "scratchpad.h"
#include "workspace.h"
#include "xcb_help.h"

Functions

static void move_down (client_t *c)
 Move a client down in its client list. More...
 
client_tprev_client (client_t *c, workspace_t *w)
 Find the client before the given client. More...
 
client_tnext_client (client_t *c)
 Find the next client. More...
 
void update_focused_client (client_t *c)
 Sets c to the active window and gives it input focus. Sorts out border colours as well. More...
 
int get_non_tff_count (monitor_t *m)
 Count how many clients aren't Transient, Floating or Fullscreen. More...
 
client_tget_first_non_tff (monitor_t *m)
 Returns the first client that isn't transient, floating or fullscreen. More...
 
void remove_client (monitor_t *m, workspace_t *w, client_t *c)
 Remove a client from its workspace client list. More...
 
void move_up (client_t *c)
 Move a client up in its client list. More...
 
void focus_next_client (void)
 brief Move focus onto the client next in the client list. More...
 
void focus_prev_client (void)
 brief Move focus onto the client previous in the client list. More...
 
void kill_client (monitor_t *m, workspace_t *w, client_t *c)
 Kill a client. More...
 
void move_client (int cnt, bool up)
 Moves a client either upwards or down. More...
 
void move_current_down (void)
 Moves the current client down. More...
 
void move_current_up (void)
 Moves the current client up. More...
 
void client_to_ws (client_t *c, workspace_t *ws, bool follow)
 Moves a client from one workspace to another. More...
 
void draw_clients (void)
 Arrange the client's windows on the screen. More...
 
void change_client_geom (client_t *c, uint16_t x, uint16_t y, uint16_t w, uint16_t h)
 Change the size and location of a client. More...
 
void change_client_gaps (client_t *c, int size)
 A helper function to change the size of a client's gaps. More...
 
client_tcreate_client (xcb_window_t w)
 Convert a window into a client. More...
 
void set_fullscreen (client_t *c, bool fscr)
 Set the fullscreen state of the client. Change its geometry and border widths. More...
 
void set_urgent (client_t *c, bool urg)
 
void teleport_client (const int direction)
 Teleport a floating client's window to a location on the screen. More...
 
void current_to_ws (workspace_t *ws)
 Moves the current client to the workspace passed in. More...
 
void toggle_float (void)
 Toggle a client between being in a floating or non-floating state. More...
 
void resize_float_width (const int dw)
 Change the width of a floating client. More...
 
void resize_float_height (const int dh)
 Change the height of a floating client. More...
 
void move_float_y (const int dy)
 Change a floating window's y coordinate. More...
 
void move_float_x (const int dx)
 Change a floating window's x coordinate. More...
 
void make_master (void)
 Moves the current window to the master window, when in stack mode. More...
 
void toggle_fullscreen (void)
 Toggle the fullscreen state of the current client. More...
 
void focus_urgent (void)
 Focus a client that has an urgent hint. More...
 
void resize_master (const int ds)
 Resize the master window of a stack for the current workspace. More...
 
void paste (void)
 Remove a list of clients from howm's delete register stack and paste them after the currently focused window. More...
 
void toggle_bar (void)
 Toggle the space reserved for a status bar. More...
 

Detailed Description

Operations that are to be performed on clients, such as moving them around in the client list.

Author
Harvey Hunt
Date
2015

Function Documentation

void change_client_gaps ( client_t c,
int  size 
)

A helper function to change the size of a client's gaps.

Parameters
cThe client who's gap size should be changed.
sizeThe size by which the gap should be changed.
void change_client_geom ( client_t c,
uint16_t  x,
uint16_t  y,
uint16_t  w,
uint16_t  h 
)

Change the size and location of a client.

Parameters
cThe client to be changed.
xThe x coordinate of the client's window.
yThe y coordinate of the client's window.
wThe width of the client's window.
hThe height of the client's window.
void client_to_ws ( client_t c,
workspace_t ws,
bool  follow 
)

Moves a client from one workspace to another.

Parameters
cThe client to be moved.
wsThe ws that the client should be moved to.
followShould focus follow the client that has been moved?
client_t* create_client ( xcb_window_t  w)

Convert a window into a client.

Parameters
wA valid xcb window.
Returns
A client that has already been inserted into the linked list of clients.
void draw_clients ( void  )

Arrange the client's windows on the screen.

This function takes some strain off of the layout handlers by passing the client's dimensions to move_resize. This splits the layout handlers into smaller, more understandable parts.

client_t* get_first_non_tff ( monitor_t m)

Returns the first client that isn't transient, floating or fullscreen.

Parameters
mThe monitor to be searched.
Returns
The first client that isn't TFF. NULL if none.
int get_non_tff_count ( monitor_t m)

Count how many clients aren't Transient, Floating or Fullscreen.

Parameters
mThe monitor to be searched.
Returns
The amount of clients in the current workspace that aren't TFF.
void kill_client ( monitor_t m,
workspace_t w,
client_t c 
)

Kill a client.

Parameters
mThe monitor that the client to be killed is on.
wThe workspace that the client to be killed is on.
cThe client to be killed.
void move_client ( int  cnt,
bool  up 
)

Moves a client either upwards or down.

Moves a single client or multiple clients either up or down. The op_move_* functions serves as simple wrappers to this.

Parameters
cntHow many clients to move.
upWhether to move the clients up or down. True is up.
static void move_down ( client_t c)
static

Move a client down in its client list.

Parameters
cThe client to be moved.
void move_up ( client_t c)

Move a client up in its client list.

Parameters
cThe client to be moved down.
client_t* next_client ( client_t c)

Find the next client.

Note: This function wraps around the end of the list of clients. If c is the last item in the list of clients, then the head of the list is returned.

Parameters
cThe client which needs to have its next found.
Returns
The next client, if c is the last client in the list then this will be head. If c is NULL or there is only one client in the client list, NULL will be returned.
client_t* prev_client ( client_t c,
workspace_t w 
)

Find the client before the given client.

Parameters
cThe client which needs to have its previous found.
wThe workspace that the client is on.
Returns
The previous client, so long as the given client isn't NULL and there is more than one client. Else, NULL.
void remove_client ( monitor_t m,
workspace_t w,
client_t c 
)

Remove a client from its workspace client list.

Parameters
mThe monitor that the client to be removed is on.
wThe workspace that the client to be removed is on.
cThe client to be removed.
void set_fullscreen ( client_t c,
bool  fscr 
)

Set the fullscreen state of the client. Change its geometry and border widths.

Parameters
cThe client which should have its fullscreen state altered.
fscrThe fullscreen state that the client should be changed to.
void set_urgent ( client_t c,
bool  urg 
)
void update_focused_client ( client_t c)

Sets c to the active window and gives it input focus. Sorts out border colours as well.

WARNING: Do NOT use this to focus a client on another workspace. Instead, set ws->c to the client that you want focused.

Parameters
cThe client that is currently in focus.