[solved] awesome WM - how to check if current tag is empty?
Been trying to obtain this behaviour with Awesome:-
Start off with one tag. When an app is started, push it to the next tag and change tag to that tag.
I've got that part going using this:-
{ rule = { type = "normal" },
except_any = { class = { "Keepassx", "Gmrun" } },
--if clients > 0 then
callback = function(c)
awful.client.movetotag(tags[mouse.screen][awful.tag.getidx()+1], c)
awful.tag.viewonly(tags[mouse.screen][awful.tag.getidx()+1])
end
--end
So basically it only works on 'normal' windows except windows that I'll probably like to have in the current tag (Gmrun and Keepassx obviously). I use this in conjunction with eminent so as to ensure that I only see as many tags as there are active. Eventually I'd like to maybe use shifty and only generate tags on-the-fly.
What I want to do, however, is for the app to start in the current tag if its empty. For that, I need to detect that state, and I can't seem to do it. This is the code fragment from eminent.lua that seems to do it:-
function gettags(screen)
local tags = {}
for k, t in ipairs(capi.screen[screen]:tags()) do
if t.selected or #t:clients() > 0 then
awful.tag.setproperty(t, "hide", false)
table.insert(tags, t)
else
awful.tag.setproperty(t, "hide", true)
end
end
return tags
end
As far as I can understand, screen[screen]:tags() returns a table of tags. ipairs splits it up into a range of values, and then the :clients() method is called to determine what clients there are. I presume # is for 'number-of' but I'm not sure.
Any advise on how I can achieve this count? I just want to put an 'if' as commented in my first code snippet.
Last edited by ngoonee (2012-09-03 08:05:04)
Thanks Wey for pointing the way (no pun intended), after some playing around I've obtained the following:-
-- Function to count number of clients in a tag
function is_empty(tag,client)
count = 0
for _, c in pairs(tag:clients()) do
-- client is used so that won't match against self
if client.class ~= c.class then
count = count + 1
end
end
if count > 0 then
return false
end
return true
end
Which is called by the following callback:-
callback = function(c)
current_tag = tags[mouse.screen][awful.tag.getidx()]
next_tag = tags[mouse.screen][awful.tag.getidx()+1]
if is_empty(current_tag,c) then
tag = current_tag
else
tag = next_tag
end
awful.client.movetotag(tag, c)
awful.tag.viewonly(tag)
end
I didn't want to use a rule since I didn't actually manage to figure out how to call rules, and just manually hard-coding c.class etc. seemed easier to me at the time. I realize I'm basically coding lua as if its C, but that's basically all I know programming wise so far .
I'd also like to set a signal function which would rearrange all clients to lower-numbered tags when a client exist (so say if there are three clients in tag 2, 2 clients in tag 3, 1 client in tag 4 and 1, and the client in tag 1 exits, all three clients from tag 2 move to tag 1, the 2 in tag 3 move to tag 2, etc). This MAY be more easily handled by shifty though, currently don't have the time to look into it unfortunately. Once again, thanks for your help in [solve]ng this question.
Similar Messages
-
How to check the current EHP stack level? in SAP
Dear All,
How to check the current EHP stack level? in SAP . i have checked forum before i am posting but still comfused .
same one said SAP_APPL , EA_Appl and SAP _HR is 60n if n=1.2.3.4. if n =1 is enhanced package 1 similarly 2,3,4 .
some one said SAP_BASIS 701,702,703,704 . according ehp1,2,3,4.
Pls check the details and confirm either is ehp1 or ehp4 .
Component version is simply shows SAP ECC 6.0 in system -> status.
Software Component - Release - SP level
SAP_ABA 701 0007
SAP_BASIS 701 0007
PI_BASIS 701 0007
ST-PI 2008_1_700 0003
SAP_BS_FND 701 0008
SAP_BW 701 0007
SAP_AP 700 0021
WEBCUIF 700 0008
SAP_APPL 604 0008
SAP_HR 604 0029
SAP_HRCAR 604 0029
SAP_HRCAT 604 0029
SAP_HRCAU 604 0029
SAP_HRCBE 604 0029
SAP_HRCBR 604 0029
SAP_HRCCA 604 0029
SAP_HRCCH 604 0029
SAP_HRCCL 604 0029
SAP_HRCCN 604 0029
SAP_HRCDE 604 0029
SAP_HRCDK 604 0029
SAP_HRCES 604 0029
SAP_HRCFI 604 0029
SAP_HRCFR 604 0029
SAP_HRCGB 604 0031
SAP_HRCHK 604 0029
SAP_HRCID 604 0029
SAP_HRCIE 604 0029
SAP_HRCIN 604 0029
SAP_HRCIT 604 0029
SAP_HRCJP 604 0029
SAP_HRCKR 604 0029
SAP_HRCMX 604 0029
SAP_HRCMY 604 0029
SAP_HRCNL 604 0029
SAP_HRCNO 604 0029
SAP_HRCNZ 604 0029
SAP_HRCPH 604 0029
SAP_HRCPT 604 0029
SAP_HRCRU 604 0029
SAP_HRCSE 604 0029
SAP_HRCSG 604 0029
SAP_HRCTH 604 0029
SAP_HRCTW 604 0029
SAP_HRCUN 604 0029
SAP_HRCUS 604 0029
SAP_HRCVE 604 0029
SAP_HRCZA 604 0029
SAP_HRGXX 604 0029
SAP_HRRXX 604 0029
EA-IPPE 400 0018
EA-APPL 604 0008
EA-DFPS 600 0018
EA-FINSERV 604 0007
EA-GLTRADE 604 0008
EA-HR 604 0029
EA-HRCAR 604 0029
EA-HRCAT 604 0029
EA-HRCAU 604 0029
EA-HRCBE 604 0029
EA-HRCBR 604 0029
EA-HRCCA 604 0029
EA-HRCCH 604 0029
EA-HRCCN 604 0029
EA-HRCDE 604 0029
EA-HRCDK 604 0029
EA-HRCES 604 0029
EA-HRCFI 604 0029
EA-HRCFR 604 0029
EA-HRCGB 604 0029
EA-HRCHK 604 0029
EA-HRCID 604 0029
EA-HRCIE 604 0029
EA-HRCIN 604 0029
EA-HRCIT 604 0029
EA-HRCJP 604 0029
EA-HRCKR 604 0029
EA-HRCMX 604 0029
EA-HRCMY 604 0029
EA-HRCNL 604 0029
EA-HRCNO 604 0029
EA-HRCNZ 604 0029
EA-HRCPH 604 0029
EA-HRCPT 604 0029
EA-HRCRU 604 0029
EA-HRCSE 604 0029
EA-HRCSG 604 0029
EA-HRCTH 604 0029
EA-HRCTW 604 0029
EA-HRCUN 604 0029
EA-HRCUS 604 0029
EA-HRCVE 604 0029
EA-HRCZA 604 0029
EA-HRGXX 604 0029
EA-HRRXX 604 0029
EA-PS 604 0007
EA-RETAIL 604 0007
FINBASIS 604 0008
ECC-DIMP 600 0018
ERECRUIT 604 0008
FI-CA 604 0008
FI-CAX 604 0007
INSURANCE 600 0018
IS-CWM 600 0018
IS-H 600 0024
IS-M 600 0018
IS-OIL 600 0018
IS-PS-CA 604 0007
IS-UT 600 0018
LSOFE 600 0018
SEM-BW 604 0008
ST-A/PI 01M_ECC600 0001
Regards
Edited by: satheesh0812 on Nov 17, 2011 7:57 AMHi Sateesh,
SAP_ABA 701 0007
SAP_BASIS 701 0007
PI_BASIS 701 0007
ST-PI 2008_1_700 0003
SAP_BS_FND 701 0008
SAP_BW 701 0007
SAP_AP 700 0021
WEBCUIF 700 0008
SAP_APPL 604 0008
Based on the component information provided by you, I can conclude that your system is ECC 6.0 EHP4.
EHP4 is derived from your component SAP_APPL 604.
In addition to this your EHP4 system has NW stack on NW 7.0 EHP1.
Hence your system is ECC 6.0 EHP4 with NW 7.0 EHP1.
Hope this answers your query.
Regards,
Deepak Kori -
How to check the current open period
Hello ABAP Gurus,
Could you help on how to check the current open period...
Sample would be
current date = may 1, 2009 but period for may is not yet open
so open would be april period
Thanks in advance....
Edited by: nanz ruiz on May 27, 2009 3:34 AMHi,
Check the fieldas FRYE2,FRPE2,TOYE2,TOPE2 of table T001B for a given varient.
Regards
Vishnu Gupta -
SAP Script - How to check a text element is empty in Script.
Hello Friends,
I like to display a text element when it is not empty, otherwise I like to display some other text.
I know how to read text element in Script, but
How to check a text element is empty in Script
Thank you for your time.
SenthilHi Senthil,
Inside text element, we print the variables.
Variables actually gets printed in the form.
if the variable contains value the variable gets printed on script. if not, then variable not gets printed.
hope this helps. -
How to check whether current time satisfies the schedule?
I am working on a task, which is opposite of cron tab. My application is in groovy but can call all Java api. Can you please provide some pointers?
User is allowed to schedule a rule to be executed the way crontab gives the options. For example he wants the rule to be executed from Monday to Friday from 8 am to 5 pm.
I cans schedule in crontabe or Quartz. At run time I have to match, whether the current time satisfy the time condition entered by user.
I may have to store this information in the database the way we put in the cron. Eg. my tables will have following
Id|| Policy Id|| seconds|| minutes|| hours|| Day|| Date|| month|| year
1 || 5 || 1 || 1 || 8-17 || M-F||? || * ||*
Now while my code is getting executing, how can I match whether the current time matches the condition mentioned above.
Thanks in advance.[Using Span|http://tus.svn.sourceforge.net/viewvc/tus/tjacobs/util/] would make this easy
-
How to check the current time with a Stored time in string format
Hi All
I would like to compare the system time with an existing time values which is allready there in String format..
i mean i would like to check if the SysTime is inbetween 6:30 and 14:00
I accomplished this in Oracle ..
Select 'Y' from dual where to_date(to_char(sysdate,'HH24:MI '),'HH24:MI') between to_date('06:30','HH24:MI') and to_date('14:00','HH24:MI')
But instead of checking the DB each and every time , the perfomance would be better if we can do this in our java code..
Could some one provide me with a code to accomplish the above scenario..
Thanks in advance..,.,import java.util.Calendar;
Calendar rightNow = Calendar.getInstance(); // gets the current date and time to millisec
Calendar earlyTime = Calendar.getInstance().set(Calendar.HOUR_OF_DAY, 6).set(Calendar.MINUTE, 30);
Calendar lateTime = Calendar.getInstance().set(Calendar.HOUR_OF_DAY, 8).set(Calendar.MINUTE, 0);
if (rightNow.compareTo(earlyTime)> 0 && rightNow.compareTo(lateTime) < 0){
// do something
}Try this. -
How to check WebTool Current version
Hi
I am trying to figure out the current version of the Webtools. In the Admin area it gives me the following details.
Components
NetPoint 2007.0.622.0
NetPoint.API 2007.0.622.0
NetPoint.CreditCards 2007.0.622.0
NetPoint.WebControls 2007.0.622.0
Web Tools Database 622
In the documentation version number is given as NetPoint 5.97. I have know clue how to match 2007.0.622.0 with NetPoint 5.97.
Backgound: I am trying to upgrade WebTools to Web CRM 6 SP1 and document says my current version should be at least 5.97. That why i am trying to mach these version number.
Thank You
SanjayaThe document is only suggesting that if you are upgrading from Netpoint you have to be on version 5.9.7.
You are not using Netpoint, the old version of the Web tools product.
You are on a pre-release version of Web tools that was only available during Ramp Up in 2007.
Download and install the SP1 Patch 1 setup.exe and install the installer and synch manager, and upgrade your webtools instances in the installer.
When you're finished the about page should be 2007.1.651.1 which is SP1 patch 1. -
How to check the current networks on receiver with SHAREit?
1. Launch SHAREit and click Receive; 2. The page will change to "Waiting to receive", and click the "Friends cannot find you?" button; 3. The "Current networks" will pop up, as follows: .lan .EjrpN-........etc.
For the most part, sender can find receiver automatically. Under narrow cases, sender may need to join the same network as receiver.
-
How to check a xml data is empty or not
Hi All,
I am building a BPEL process. I want to make a check on empty xml. Can anyone please suggest How can I make that check.Hi.
another way, is to use the countNodes function. For example:
ora:countNodes('inputVariable','payload','/ns1:mensajeEmail/ns1:cuerpoAttachment') = 0
If that is true, then I know that the element is not present, and that could mean that ur XML is empty.
Hope this helps
best -
How to check whether the Resultset is empty or not ??
I wanna check whether my Result set is empty or not ( I don't want the no of rows it contains..) i'm using this function...
boolean result=myResultSet.isAfterLast() | myResultSet.isBeforeFirst() ;
if (result == true)
{//Result Set is populated
else
{//ResultSet Blank
Is it ok to do like this ?? Or is there any other functanality to do this, since in big appl..i'm using it more than 10-15 times & it's working fine evrywhere except for one jsp where it is returing TRUE everytime ...
Help Appreciated !!try,
rs = pstmt.executeQuery();
boolean b = false;
if( b = rs.next() ) {
while( b ) {
//... rs.getXXX( YYY );
b = rs.next();
else {
//...empty rs processing
or,
ResultSet rs = ps.executeQuery();
if(rs.next()) {
do {
System.out.println(rs.getString(1));
} while(rs.next());
} else {
System.out.println('empty result set');
but I usually avoid using do...while although this may be an exception. -
How to check whether a value is empty in ABAP Sql
Select matnr from mara where
MARA~LVORM is null
Basically if LVORM is blank, i.e., not popoulated, I want to get matnr.
Will above query accomplish this in ABAP OPEN SQL.Hi,
LVORM column is defined as a NOT NULL column.. so the values will be either a initial value (space, in this case) or filled with some value
SELECT matnr
INTO TABLE t_matnr
FROM mara
WHERE LVORM = space.
https://cw.sdn.sap.com/cw/docs/DOC-40206
http://learnsapmdm.blogspot.com/2009/01/data-modelling-and-database-design-in.html
regards,
Paulo Carvalho -
How to check current input/output rate on router subintenterface via SNMP?
How to check current input/output rate on router (2821, etc..) subintenterface via SNMP, like cacti monitoring system.
I cant find OID to make this with snmpwalk.
Or there is no way to check current load by this way? Only polling?
P.S. Ethernet subinterface, of course.
With great respect, S.A.Hi,
Try to use:
1.3.6.1.4.1.9.2.2.1.1.6 - InBitRate
1.3.6.1.4.1.9.2.2.1.1.8 - OutBitRate
1.3.6.1.4.1.9.2.2.1.1.28 - ifDescription -
How to check ..the user who is currently logged in ..
... suppose i m logged in as HR schema ...so while using SLLplus * environment ...how to check ...that which use is currently logged in..
If you want to use the name in some program then you can use
select user into :variable from dual;
Regards
Kaustubh -
How to check lock status of field in current document?
Hi,
How to check the status of field in current document(master agreement), that is whether its locked or not.
I locked "Publish to Supplier" checkbox after MA is saved first time. Now, I want to check the status whether this field is locked or not in the same document.
IsLockOwner( ) is not returning the correct value. Its not giving the current document field lock status.
Is there any way to get current document field status?
Thanks,
SaloniHi,
If I understand correctly, your requirement is to get the value of this field "Publish to Supplier on". It can be achieved by writing the below:
isVendorVisible = doc.getExtensionField("VENDOR_VISIBLE").get();
Meaning, if the box is checked, it will return a value = true and if not then false.
Hope this helps,
Regards,
Vikram Shukla -
How to check/find the size of current ROLLBACK segment in oracle 10g
How to check/find the size of current ROLLBACK segment in oracle 10g ? Kindly help
A rollback segment name like "_SYSSMU231$" is used when you have Automatic Undo Management enabled.
The only relevant parameters are :
1. UNDO_MANAGEMENT=AUTO
2. UNDO_RETENTION=n minutes ==> this is what everyone should be interested in
3. The sizes of the Undo Tablespace datafiles and whether AUTOEXTEND is ON or OFF
No one should be interested in the size of a single undo segment when Automatic Undo Management is enabled.
Possible causes of ORA-01555 errors in Automatic Undo Management
a. UNDO_RETENTION is too low
b. Undo tablespace is too small
Hemant K Chitale
Maybe you are looking for
-
How do I fix an Apple mail account that is "confused"
Last week I moved a mail account from one host provider to godaddy. I updated the incoming and outgoing mail servers in Apple Mail and did a "Get Mail". Two new messages came in so it appeared everything was fine, however I realized Mail was not retr
-
Dear Friends, My friend got installed sap in his system he customised enterprise structure ..Now while creating order he is getting an error saying VA01 is locked and prompt says go to SM01 After going there what next..how to unlock? Any other proced
-
Photoshop CC won't open Adobe Camera Raw because of disk error
When I try to open a raw file from a Canon 60D, Photoshop CC does not open the file and displays an error: "Could not complete your request because of a disk error". It does not matter whether you drag the file onto the Photoshop icon to open it, or
-
I lost Adobe Acrobat X Standard when I restored my system. How can I reinstall it?
I lost Adobe Acrobat X Standard when I restored my system. How can I reinstall it and activate it? It came already installed (OEM) with my new DELL PC. I do have a serial-number.
-
Database link from one Oracle database to another
Hi everyone! I have 2 databases. I need to create a database link to copy a table from one of the database to another. Both of them are Oracle 10g v2 Please advice me on how can I go about it. I am trying to avoid import and export. What are the opti