xaizek / euclid-wm (License: BSD 3-Clause) (since 2018-12-07)
A minimalist, tiling window manager for X11 that seeks to allow easy management of numerous windows entirely from the keyboard.
Commit ee854e9db98607cdb58f43319e471bdb93fd4417

Add support for _NET_CURRENT_DESKTOP
This allows querying current desktop id.
Author: xaizek
Author date (UTC): 2017-03-05 15:08
Committer name: xaizek
Committer date (UTC): 2017-03-05 15:08
Parent(s): 9904cbad2205170e5e6462550a4d12a8b934feea
Signing key: 99DC5E4DB05F6BE2
Tree: 2aa7ed171427551e964bf9f2b11c6c48b7fcf7b9
File Lines added Lines deleted
euclid-wm.c 16 3
File euclid-wm.c changed (mode: 100644) (index 8d40d51..214b72d)
... ... Atom wm_take_focus;
215 215 Atom wm_prot; Atom wm_prot;
216 216 Atom wm_change_state; Atom wm_change_state;
217 217 Atom wm_fullscreen; Atom wm_fullscreen;
218 Atom current_desktop;
219 Atom utf8;
218 220 char *dcmd = NULL; //string that gets passed to /bin/sh when we invoke the menu char *dcmd = NULL; //string that gets passed to /bin/sh when we invoke the menu
219 221 char *tcmd = NULL; //string that gets passed to /bin/sh when we invoke the terminal char *tcmd = NULL; //string that gets passed to /bin/sh when we invoke the terminal
220 222 char *ccmds[CCMDS]; //array of strings that can be set by the user to pass to /bin/sh char *ccmds[CCMDS]; //array of strings that can be set by the user to pass to /bin/sh
 
... ... void set_atoms() {
695 697 wm_prot = XInternAtom(dpy, "WM_PROTOCOLS", False); wm_prot = XInternAtom(dpy, "WM_PROTOCOLS", False);
696 698 wm_change_state = XInternAtom(dpy,"_NET_WM_STATE",False); wm_change_state = XInternAtom(dpy,"_NET_WM_STATE",False);
697 699 wm_fullscreen = XInternAtom(dpy,"_NET_WM_STATE_FULLSCREEN",False); wm_fullscreen = XInternAtom(dpy,"_NET_WM_STATE_FULLSCREEN",False);
700 current_desktop = XInternAtom(dpy,"_NET_CURRENT_DESKTOP",False);
701 utf8 = XInternAtom(dpy,"UTF8_STRING",False);
698 702 Atom wm_supported = XInternAtom(dpy,"_NET_SUPPORTED",False); Atom wm_supported = XInternAtom(dpy,"_NET_SUPPORTED",False);
699 703 Atom wm_check = XInternAtom(dpy,"_NET_SUPPORTING_WM_CHECK",False); Atom wm_check = XInternAtom(dpy,"_NET_SUPPORTING_WM_CHECK",False);
700 704 Atom wm_name = XInternAtom(dpy,"_NET_WM_NAME",False); Atom wm_name = XInternAtom(dpy,"_NET_WM_NAME",False);
701 Atom utf8 = XInternAtom(dpy,"UTF8_STRING",False);
702 Atom supported[] = {wm_supported, wm_name, wm_change_state, wm_fullscreen};
705 Atom supported[] = {wm_supported, wm_name, wm_change_state, wm_fullscreen, current_desktop};
703 706 XChangeProperty(dpy,root,wm_check,XA_WINDOW,32,PropModeReplace,(unsigned char *)&root,1); XChangeProperty(dpy,root,wm_check,XA_WINDOW,32,PropModeReplace,(unsigned char *)&root,1);
704 707 XChangeProperty(dpy,root,wm_name,utf8,8,PropModeReplace,(unsigned char *) "LG3D",strlen("LG3D")); XChangeProperty(dpy,root,wm_name,utf8,8,PropModeReplace,(unsigned char *) "LG3D",strlen("LG3D"));
705 XChangeProperty(dpy,root,wm_supported,XA_ATOM,32,PropModeReplace,(unsigned char *) supported,4);
708 XChangeProperty(dpy,root,wm_supported,XA_ATOM,32,PropModeReplace,(unsigned char *) supported,ARRAY_LEN(supported));
706 709 XSync(dpy,False); XSync(dpy,False);
707 710 } }
708 711
 
... ... struct view * find_view(int i) {
1768 1771 return(v); return(v);
1769 1772 } }
1770 1773
1774 void set_desktop_name(int i) {
1775 char desktop_name[128];
1776 snprintf(desktop_name, sizeof(desktop_name), "%d", i);
1777 XChangeProperty(dpy,root,current_desktop,utf8,8,PropModeReplace,(unsigned char *) desktop_name,strlen(desktop_name));
1778 }
1779
1771 1780 void goto_view(struct view *v) { void goto_view(struct view *v) {
1772 1781 //this just unmaps the windows of the current view //this just unmaps the windows of the current view
1773 1782 //sets cs->v //sets cs->v
 
... ... void goto_view(struct view *v) {
1820 1829 cs->v = v; cs->v = v;
1821 1830
1822 1831 gettimeofday(&last_redraw,0); gettimeofday(&last_redraw,0);
1832
1833 set_desktop_name(v->idx);
1823 1834 } }
1824 1835
1825 1836
 
... ... int main() {
3348 3359
3349 3360 layout(); layout();
3350 3361
3362 set_desktop_name(1);
3363
3351 3364 return (event_loop()); return (event_loop());
3352 3365 } }
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/euclid-wm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/euclid-wm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master