Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1019040 // linux_parse_wmctrl_lpG_output

JavaX fragment (include)

1  
/*
2  
The first column always contains the window identity as a hexadecimal integer.
3  
The second column always contains the desktop number (a -1 is used to identify a sticky window).
4  
If the -p option is specified the next column will contain the PID for the window as a decimal integer.
5  
If the -G option is specified then four integer columns will follow: x-offset, y-offset, width and height.
6  
The next column always contains the client machine name.
7  
The remainder of the line contains the window title (possibly with multiple spaces in the title).
8  
*/
9  
10  
static L<wmctrl_Entry> linux_parse_wmctrl_lpG_output(S output) {
11  
  try {
12  
    ret map_pcall(tlft(output), func(S s) -> wmctrl_Entry {
13  
      L<IntRange> streaks = takeFirst(8, nonStreaks(f isSpace, characters(s)));
14  
      LS l = intRangeSubstrings(s, streaks);
15  
      ret nu(wmctrl_Entry,
16  
        windowTitle := trimSubstring(s, last(streaks).end),
17  
        windowIdentity := l.get(0),
18  
        desktopNumber := parseInt(l.get(1)),
19  
        pid := parseInt(l.get(2)),
20  
        bounds := rect(parseInt(l.get(3)), parseInt(l.get(4)), parseInt(l.get(5)), parseInt(l.get(6))),
21  
        machineName := l.get(7));
22  
    });
23  
  } on fail {
24  
    printIndent("wmctrl> " , output);
25  
  }
26  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019040
Snippet name: linux_parse_wmctrl_lpG_output
Eternal ID of this version: #1019040/7
Text MD5: 8f79924d3695b21a1cdfb921475a4507
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-04 00:13:21
Source code size: 1238 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 278 / 326
Version history: 6 change(s)
Referenced in: [show references]