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

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

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

alias -l hidle.version {
return v0.5
}

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

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

; Lets hide inactive windows after xx seconds on AdiIRC startup?!
on *:START: {
if ($exists($hidle.file)) hload -m hidle $hidle.file
else {
freshstart
}
.timerhidle -o 0 1 hidle
}

alias -l freshstart {
hmake hidle
}

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

alias -l hidle.save {
hsave hidle $hidle.file
}

; Global timeout
alias -l hidle.timeout {
return 60
}

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

alias F3 {
hidle -u
}

alias hidle {
scon -a dohidle $1
}

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

while (%w) {
%wtype = $istok(channel query,$window(*,%w).type,32)
%wid = $window(*,%w).wid
%wname = $window(@ $+ %wid)
%wcid = $window(@ $+ %wid).cid
%wcolor = $istok(message highlight,$window(@ $+ %wid).sbcolor,32)
%widle = $($+(%,hidle_,%wid),2)
%wstate = $window(@ $+ %wid).tbstate

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

if (%widle) dec %hidle_ $+ %wid
if (u isin $1) {
window -w3 %wname
set -e %hidle_ $+ %wid $hidle.timeout()
}
elseif (!%wcolor) && (!%widle) && (%wstate) {

; 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.
if ($active == Status Window) && (%wcid == $activecid) { }
else {
window -w0 %wname
set -e %hidle_ $+ %wid $hidle.timeout()
}
}
}
dec %w
}
}

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

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

; Unhide on activity
on *:TEXT:*:#,?: {
if (!$halted) {
wunhide
}
}

on *:ACTION:*:#,?: {
if (!$halted) {
wunhide
}
}

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

menu menubar {
-
Idle Windows
.$style(2) $chr(91) Global config - hidle $hidle.version $chr(93):noop
.-
.$chr(28) Auto hide control $chr(9) $iif($timer(Hidle),On,Off):toggle
.$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
.$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
.-
.$iif($window($active).type isin channel query,$style(2) $chr(91) $active @ $network $chr(93) custom rules):noop
.-
.$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
.$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
.-
.$style(2) $chr(91) Manual tools $chr(93):noop
.-
.$chr(28) Hide read windows (no new message): hidle
.$chr(28) Force unhide all: hidle -u
}

alias -l toggle {
if ($timer(hidle)) {
scon -a hidle -u
.timerhidle off
}
else {
.timerhidle 0 1 hidle
}
}
(8-8/11)