Project

General

Profile

[script] Hide all idle channels and querys (no new messag... » Hide all idle channels and querys (no new message color) v0.5.ini

Mr. BS, 09/10/2017 03:37 AM

 
1
; http://dev.adiirc.com/boards/5/topics/475
2
; Version 0.5
3

    
4
; TODO MAKE CHANGE WINDOW HIDE STATUS ONLY IF NEED TO AVOID UNCOLAPSING AND OTHER THINGS
5

    
6
alias -l hidle.version {
7
  return v0.5
8
}
9

    
10
; Hide all idle channels and querys (no new message color):
11
;  /hidle
12

    
13
; Force unhide all windows if need:
14
;  /hidle -u
15

    
16
; Lets hide inactive windows after xx seconds on AdiIRC startup?!
17
on *:START: {
18
  if ($exists($hidle.file)) hload -m hidle $hidle.file
19
  else {
20
    freshstart
21
  }
22
  .timerhidle -o 0 1 hidle
23
}
24

    
25
alias -l freshstart {
26
  hmake hidle
27
}
28

    
29
alias -l hidle.file {
30
  return $qt($adiircdir\hidle_Windows.dat)
31
}
32

    
33
alias -l hidle.save {
34
  hsave hidle $hidle.file
35
}
36

    
37
; Global timeout
38
alias -l hidle.timeout {
39
  return 60
40
}
41

    
42
; Restore windows on unloading script
43
on *:UNLOAD: hidle -u
44

    
45
alias F3 {
46
  hidle -u
47
}
48

    
49
alias hidle {
50
  scon -a dohidle $1
51
}
52

    
53
alias -l dohidle {
54
  var %w $window(*,0), %wtype, %wname, %wid, %wcolor, %widle, %wstate
55

    
56
  while (%w) {
57
    %wtype = $istok(channel query,$window(*,%w).type,32)
58
    %wid = $window(*,%w).wid
59
    %wname = $window(@ $+ %wid)
60
    %wcid = $window(@ $+ %wid).cid
61
    %wcolor = $istok(message highlight,$window(@ $+ %wid).sbcolor,32)
62
    %widle = $($+(%,hidle_,%wid),2)
63
    %wstate = $window(@ $+ %wid).tbstate
64

    
65
    if (%wtype) && ($activewid != %wid) {
66

    
67
      if (%widle) dec %hidle_ $+ %wid
68
      
69
      if (u isin $1) {
70
        window -w3 %wname
71
        set -e %hidle_ $+ %wid $hidle.timeout()
72
      }
73
      elseif (!%wcolor) && (!%widle) && (%wstate) {
74

    
75
        ; skip hidding if Status is active and window is from same network, otherwise you will need to togle focus to get 'Unhide windows on focus network status' working.
76
        if ($active == Status Window) && (%wcid == $activecid) { }
77
        else {
78
          window -w0 %wname
79
          set -e %hidle_ $+ %wid $hidle.timeout()
80
        }
81
      }
82
      
83
    }
84
    
85
    dec %w
86
  }
87
}
88

    
89
; Unhide on focus
90
on *:ACTIVE:*: {
91
  if ($hget(hidle,unhide_on_status_focus).data == $null) return
92
  
93
  var %lwid = $lactivewid
94

    
95
  if ($window(@ $+ %lwid).type isin channel query) && (%lwid != $wid) set -e %hidle_ $+ %lwid $hidle.timeout()  
96
  if (!$window($active).tbstate) && ($window($active).type isin channel query) window -w3 $active
97
  if ($window($active).type == status) && (%lwid != $wid) .timer -m 1 1 dohidle -u
98
  
99
}
100

    
101
; Unhide on activity
102
on *:TEXT:*:#,?: {
103
  if (!$halted) {
104
    wunhide
105
  }
106
}
107

    
108
on *:ACTION:*:#,?: {
109
  if (!$halted) {
110
    wunhide
111
  }
112
}
113

    
114
alias -l wunhide {
115
  var %w = @ $+ $wid
116
  if (!$window(%w).tbstate) window -w3 %w
117
}
118

    
119
menu menubar {
120
  -
121
  Idle Windows
122
  .$style(2) $chr(91) Global config - hidle $hidle.version $chr(93):noop
123
  .-
124
  .$chr(28) Auto hide control $chr(9) $iif($timer(Hidle),On,Off):toggle
125
  .$chr(28) Global timeout in seconds $chr(9) $iif($hget(hidle,global_timeout).data,$v1,$hidle.timeout())): var %v $input(Global timeout in seconds for $crlf $+ $crlf $+ Send empty value to restore original config,oeq,hidle,$iif($hget(hidle,global_timeout).data,$v1)) | if (%v isnum 1-) hadd -m hidle global_timeout %v | if ($remove(%v,$chr(32)) == $null) hadd -m hidle global_timeout $hidle.timeout() | hidle.save
126
  .$chr(28) Unhide windows on focus network status $chr(9) $iif($hget(hidle,unhide_on_status_focus).data,$v1,No)): var %v $input(Unhide windows on focus network status?,oqm,hidle,,Yes,No) | hadd -m hidle unhide_on_status_focus %v | hidle.save
127
  .-
128
  .$iif($window($active).type isin channel query,$style(2) $chr(91) $active @ $network $chr(93) custom rules):noop
129
  .-
130
  .$iif($window($active).type isin channel query,$chr(28) Timeout $chr(9) $iif($hget(hidle,# $+ @ $+ $network).data,$v1,Follow global)): var %v $input(Timeout in seconds for $active $crlf $+ $crlf $+ Send empty value to follow global config,oeq,hidle,$iif($hget(hidle,# $+ @ $+ $network).data,$v1)) | if (%v isnum 1-) hadd -m hidle # $+ @ $+ $network %v | if ($remove(%v,$chr(32)) == $null) hdel hidle # $+ @ $+ $network | hidle.save
131
  .$iif($window($active).type isin channel query,$chr(28) Exclude channel (stay visible) $chr(9) $iif(# $+ @ $+ $network isin $hget(hidle,exclusions).data,Yes,No)): hadd -m hidle exclusions $iif(# $+ @ $+ $network isin $hget(hidle,exclusions).data, $remtok($hget(hidle,exclusions).data,# $+ @ $+ $network,1,32) , $addtok($hget(hidle,exclusions).data,# $+ @ $+ $network,32) )) | hidle.save
132
  .-
133
  .$style(2) $chr(91) Manual tools $chr(93):noop
134
  .-
135
  .$chr(28) Hide read windows (no new message): hidle
136
  .$chr(28) Force unhide all: hidle -u
137
}
138

    
139
alias -l toggle {
140
  if ($timer(hidle)) {
141
    scon -a hidle -u
142
    .timerhidle off
143
  }
144
  else {
145
    .timerhidle 0 1 hidle
146
  }
147
}
(8-8/11)