Advertisement
Guest User

chwn.c

a guest
Jan 25th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. /* See LICENSE file for copyright and license details. */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <err.h>
  6. #include <xcb/xcb.h>
  7. #include <string.h>
  8.  
  9. #include "util.h"
  10.  
  11. static xcb_connection_t *conn;
  12.  
  13. static void usage(char *);
  14. static void set_name(char *,char *);
  15.  
  16. static void
  17. usage (char *name)
  18. {
  19.     fprintf(stderr, "usage: %s <name> <wid>\n", name);
  20.     exit(1);
  21. }
  22.  
  23. static void
  24. set_name(char *name,char *wid)
  25. {
  26.     xcb_window_t w = strtoul(wid++,NULL,16);
  27.     xcb_change_property(conn,XCB_PROP_MODE_REPLACE,w,XCB_ATOM_WM_NAME,XCB_ATOM_STRING,8,strlen(name),name);
  28. }
  29.  
  30. int
  31. main(int argc, char **argv)
  32. {
  33.     if(argc < 3)
  34.         usage(argv[0]);
  35.  
  36.     init_xcb(&conn);
  37.     set_name(argv[1],argv[2]);
  38.     xcb_flush(conn);
  39.     kill_xcb(&conn);
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement