Refreshing a status bar with a shell script

Hello,
I use the lemonbar to display some informations about my system. The lemonbar
use a shell script to display informations. Sometimes I want to refresh my status bar.
To be brief: is it possible to refresh the status bar without checking for example every 2 seconds with
a "sleep 2" command ?
Let's take an example: with my window manager I switch
from desktop 1 to desktop 2. At the moment I use a sleep command and I refresh the information
every 2 seconds. Is there a way my shell script get notified about the switch from desktop 1 to desktop 2 and can refresh
the information in my status bar ? So it would be not necessary to execute a sleep command every two seconds.
Until now I found nothing. An idea is to react to a keyboard shortcut (the switch from desktop 1 to desktop 2), but
I don't know if it's possible.  Perhaps something with a signal ? I also know some X events are generated by creating or closing windows
for example. I don't know if reacting to X events would be another possibility.
Thank you!

kokoko3k wrote:Eg: if a WM writes the current desktop in a file, then you can just watch that file via inotify and do an event driven action.
I will keep it in mind. I have to check, but it's possible I can use that solution.
kokoko3k wrote:As a side note: how do you switch "desktops" without a WM? Was it just an example?
Yes, it was an example. If I change in the future I could use the solution for the chosen wm.
But at the moment I can create groups. Each groups get a number and I can raise or hide all applications
in that group. So it's the same problem.

Similar Messages

  • Schedule workbook using with Unix shell script

    Hi,
    Can we schedule workbook using with Unix shell script?
    Thanks,
    Jay

    I can't imagine how.
    1. You can schedule Disco workbooks via Disco itself.
    2. You can schedule Disco workbooks to run and output in different file formats automatically via batch scheduler in Windows running Disco Desktop directly (or can user VBasic).
    3. You can schedule Disco workbooks to run and output in different file formats automatically via a Java program running the Java Command Line interface.
    Moving forward, Oracle has announced that with a further interfacing of Disco with XML Publisher, you'll be able to use Oracle Apps concurrent manager and scheduling. But that's coming supposedly at the end of this year.
    And I think that's about it.
    Russ

  • Trying to run program off network location using GPO with Power shell script.

    Hello All,
    Not much of a script writer. I am giving it a shot.  My issue is that I need to run a application update across our network and I am trying to do it with as little hands on as possible. So I was planning to push a GPO with a power shell script in it
    to run the program with elevated privileges. 
    Little background:
    We are running on a domain and end users do not have admin rights.
    The application is stored on a share on our network that is open to all domain users.
    The installer user name and password is a temp one and will only be valid for the 30 min window when everyone logs in at the beginning of the day.
    So this is what I have so far.
    $username = "USER"
    $password = "PASSWORD"
    $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
    Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDirectory \\Server\Folder\Folder1\Folder2\filder3\PSQLv11sp3_x32\
    But for some reason I keep getting :
    Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
    At line:10 char:1
    + Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDir ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    Any help you could give would be great.
    Thanks,
    jdfmonkey

    Hi jdfmonkey,
    Has anyone provided an answer to your original question?  I am trying to use Start-Process to launch a process using another logged in user's credentials, and am not able to get it working:
    $cred=Get-Credential
    start-process Process.exe-WorkingDirectoryC:\Scripts-Credential$cred
    I get the same error that you mentioned:
    start-process : This command cannot be run due to the error: The system cannot find the file specified.
    At C:\Scripts\Process.ps1:2 char:1
    + start-process Process.exe -WorkingDirectory C:\Scripts -Credential ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    When I leave off the credentials:
    start-processProcess.exe-WorkingDirectoryC:\Scripts
    It works correctly.  Does anyone have a solution to make this work correctly?
    Please ask your own question.  You issue is nothing like the current thread.  You clearly are using a user account that has no access to the folder.  It is a permissions issue.  It is not a scripting issue.
    If you need further help please start your own question.
    ¯\_(ツ)_/¯

  • JFrames withous status bar with "Java Applet Window" ?

    Hello.
    I call a JFrame from JApplet. All my JFrames with a status bar where string "Java Applet Window" is showing. How can I creat JFrames without that status bar?
    Thank you in advance.

    This shows as a security measure because your applet isn't "signed". Your applet must be signed in order for this to not show.
    Refer to the following for a how-to:
    http://java.sun.com/developer/qow/archive/167/index.jsp

  • Trying to close an app with a shell script which was launched by same app.

    This may be simple, but is confusing me. I have an app that executes a shell script at launch. The script is designed to check for the existence of files and if not found, I want to display a message and close the application. The problem seems to be that I can't close the app with the script, since the script was called by the app and the shell is tied up. Does that make sense? I can't close the app because the script/shell is still active. Any ideas?

    Just have the script output some value for the app to read and then quit. Once the app reads the value, it will wait for the script to quit (shouldn't take long, especially if the script isn't running anymore) and then, if the value is a flag to quit, quit.

  • Editing question, preferably with "do shell script"

    I would like to edit an expression
    from: blah blah /Paragraphs/one two three
    to: blah blah /Paragraphs/one-two-three
    where "/Paragraphs/" is always present
    but "one" might be anything
    Using sed with regexp seems like a way to go, but I don't know how to designate "one," which will vary. Viz.:
    set T to "blah blah /Paragraphs/one two three"
    set T1 to do shell script "echo " & quoted form of T & " | sed 's/\\/Paragraphs\\/{anything}/\\/Paragraphs\\/{anything}(change all subsequent spaces to "-")/g'"

    Hi,
    Can't believe I did it with sed! My test.txt file looks like this:
    blah blah #one here's some text
    blah blah #two more text
    blah blah #three and even more text
    #four number begins this line
    Here's the sed part:
    sed 's/#/\
    #/' < test.txt | sed '/#/ s/ /-/g' | sed '
    N
    s/\n#/#/
    Here I used "#" instead of "/Paragraphs/". Now, you translate this into a do shell script. If you need help with that, then write back. I now understand the N command for working with multiple line processing. Here's the tutorial I used:
    http://www.grymoire.com/Unix/Sed.html
    Edited: and here's the output
    blah blah #one-here's-some-text
    blah blah #two-more-text
    blah blah #three-and-even-more-text
    #four-number-begins-this-line
    gl,

  • Having problems with a shell script

    I'm trying to write a shell script that will echo back the command, and ask for confirmation before proceeding with the command.
    Here is what I have so far:
    Josh:~ josh$ cat ~/Desktop/safe
    #!/bin/sh
    echo "You have typed: "$1 $2 $3 $4"."
    read -p "Are you sure you want to continue? (y/n)" a
    if [ "$a" = "y" ]; then
    $1 $2 $3 $4
    elif [ "a" = "n" ]; then
    exit
    elif [ "a" != "y" ] [ "a" != "n" ];then
    echo "Type y or n."
    fi
    When I run it, and type n, (y works fine) I get a syntax error: ./safe: line 10: [: too many arguments
    Could you please help me fix it?
    Thanks!
    EDIT: If I change the last "elif" statement to a simple "else", it automatically does that statement anyway when the user types "n".
    Is there any better way to end the script when the user types "n"?
    Message was edited by: joshz
    Message was edited by: joshz
    Message was edited by: joshz
    Message was edited by: joshz

    joshz wrote:
    A few q's.
    1. you have "n=$#", but never use n. What is that for?
    Er... because I originally did it differently and then forgot to go back and delete this line!
    2. Why do you set list to a blank string? Just to initialize it?
    Yes. Habit. Sometimes it is an error to use an unassigned variable. It would not matter in this case because echo will not complain, but it still appeals to my sense of logic/tidiness. It also means that if I later change something in my script so that an unassigned variable will cause an error, I won't be stymied by a failure I can't explain. (Not really an issue in a script this short but might well be in a longer script.)
    3. "sed 's+, $+ and all enclosed files/folders+'" What does it do? What is s supposed to do? I know that s treats a string as a single line, but what's the purpose of that (and the +)? $+ would stand for the end of a line, but repeated one or more times. Why have the +'s?
    In this case, s is for substitute. The + is an arbitrary delimeter. A forward slash is standard, but if I use + I don't have to escape the slash in the phrase "and... files/folders". The whole thing says:
    Take the piped output from echo and find every occurrence of the pattern consisting of a comma followed by a space followed by an end of line (on every line of the piped input, but there's only one here). Substitute the first occurrence you find (on every line of the piped input, but there's only one here) with a space followed by "and... files/folders".
    Also, I ideally want the "and all enclosed files/folders" to appear only if there is a recursive option turned on, not all the time. (I guess it would be good enough to have it turn on if there's an r OR R option, because it would be too hard to program it in based on each command).
    To do that properly, you need to do things differently so that you can distinguish between arguments to the command and occurrences of strings in the names of files and folders. For example, you might have a folder named "My Folder-Revised". There are ways of doing this but they are not as simple as the sort of framework you're using here.
    If you are concerned about accidentally deleting files, have you considered using an alias called "rm" for "rm -i". That way, you do not have to remember to use "safe" either. Unfortunately, that won't work for "sudo rm". On the other hand, "sudo safe" won't necessarily work either. Where are you planning to install your script?
    - cfr

  • Issue with calling Shell Script using DBMS_SCHEDULER

    Hi All,
    I am executing a shell script using DBMS_SCHEDULER from APEX web page. Execution part is working fine without any issues.
    In my shell script file (abc.sh) I have few oracle sql procedure calls which connects back to same database and that SQL call is not executing some reason, it not giving any errors.
    Inside my shell script code looks like this.
    sqlplus -silent $USER/$PASSCODE@$SCONNECT > /dev/null <<END
    set pagesize 0 feedback off verify off heading off serveroutput on
    echo off linesize 1000
    WHENEVER SQLERROR EXIT 9
    BEGIN     
    dbms_output.enable(1000000);
    do_enable_cons();
    dbms_output.disable;
    END;
    spool off;
    exit;
    END
    When I run this shell script file from backend it works fine now issues.
    Is there any restrictions in executing sql code using DBMS_SCHEDULER? Any ones help is much appreciated.
    -Regards

    james. wrote:
    Thanks you sb and Sybrand . It is problem with environment variables. After running .bash_profile in the beginning of the shell script, it is working fine.
    One issue is when I check the process it is showing two entries with two different process id's.
    The command I used
    ps -ef | grep <my script> is COPY & PASTE broken for you?
    any reason why you did not show us EXACTLY was produced by OS command above?
    >
    Is it something wrong with my code or is it normal? Is it really executing two times ?
    -Regards
    bcm@bcm-laptop:~$ sqlplus user1/user1
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 20 15:14:15 2012
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    15:14:15 SQL> !ps -ef | grep sqlplus
    bcm      24577  1903  1 15:14 pts/0    00:00:00 sqlplus           
    bcm      24579 24577  0 15:14 pts/0    00:00:00 /bin/bash -c ps -ef | grep sqlplus
    bcm      24581 24579  0 15:14 pts/0    00:00:00 grep sqlplus
    15:14:23 SQL> how many different copies of "sqlplus" running on my laptop based upon actual output above?

  • Assistance with Automator Shell Scripting

    Is there a way to take the Ask for text, set the returned value as a variable and use that variable later on in a Shell Script action?
    Thanks in Advance

    This is showing how you would access your variables. $@ will contain all the command line variables and the for do loop intinerates over each one one at a time.
    So you would replace this with your script of course but thats how you would access the arguments.

  • Status bar with opera style page loading statistics?

    Anyone ever seen an app or terminal code or something that allows us to see page loading stats (seconds taken, # images loaded, speed, etc) like the status bar in Opera or one you can load in FF? I would love to have this ability in Safari. I found one that gives instant feedback on W3C compliance of the loaded page, but not about page loading stats.

    I want simple and quick view of time took page to load, how many images, speed, etc...
    Load times can be found under Develop > Show Network Timeline, or by clicking on the Network icon located in the left-side column of the main Web Inspector window.
    I use it sometimes BUT it is a stand alone window...
    You might try clicking on the window-merge toggle button found in the extreme lower left corner of the Web Inspector window, directly underneath the Network icon. Good luck.

  • Problem with executing shell script on linux through java code.

    i am facing problem to kill jboss process on linux that is my application requirement. for that i created one shell script that will get all the process for jboss instance and kill them when i am running that script from command prompt on linux its working perfectly.
    The command i am using ---
    /opt/RW9/jboss/v4.0.5.GA/bin/restartjboss.sh.
    but when i am running through java code its not working.
    the java code i am using is:-
    pp = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", "/opt/RW9/jboss/v4.0.5.GA/bin/restartjboss.sh"});
    could anyone tell me what is the problem ?
    Edited by: akm198110 on Sep 2, 2008 9:24 AM

    I got the problem after long struggle ,after doing proper path i am able to execute the shell script..

  • Trouble with: "do shell script" password

    Here's the code I'm trying to use to unlock my login.keychain via Applescript:
    do shell script "security unlock-keychain login.keychain" password "mypasswordgoeshere"
    I'm getting the following error message in AppleScript Editor:
    error "password to unlock login.keychain:
    security: SecKeychainUnlock login.keychain: The user name or passphrase you entered is not correct." number 51
    Any suggestions on how to get this working?

    That function uses the password differently. Run the following:
    do shell script "security unlock-keychain -p password login.keychain"
    (52720)

  • Problems with executing shell script within oracle procedure

    I have procedure that's owned by Semantic user. This procedure calls job scheduler (owned by USER1) which in turn executes a shell script load_semantic.sh (owned by USER1).
    Now, there is a shell script(checkCount.sh)inside of this one (owned by this USER1) that has following contents:
    checkCount.sh
    #!/bin/bash
    MODEL=$1
    sqlplus -S user/pass << EOF
    whenever sqlerror exit 1;
    set echo on
    set verify off
    MERGE INTO SEMANTIC.COUNT_STATISTICS s
    USING (SELECT '$MODEL' AS MODEL, 0 AS NEW_COUNT, SYSDATE AS NEW_DATE, 0 AS OLD_COUNT, SYSDATE AS OLD_DATE FROM dual) t
    on (s.MODEL = t.MODEL)
    when not matched then
    INSERT (s.MODEL, s.NEW_COUNT, s.NEW_DATE, s.OLD_COUNT, s.OLD_DATE)
    VALUES (t.MODEL, t.NEW_COUNT, t.NEW_DATE, t.OLD_COUNT, t.OLD_DATE);
    COMMIT;
    UPDATE SEMANTIC.COUNT_STATISTICS SET  MODEL = '$MODEL', NEW_COUNT = (SELECT COUNT(*) FROM TABLE(SEM_MATCH('{?s ?p ?o}',SEM_Models('$MODEL'),NULL,SEM_ALIASES(SEM_ALIAS('','http://VISION/DataSource/SEMANTIC#')),NULL)) ),NEW_DATE  = SYSDATE,
    OLD_COUNT = NEW_COUNT, OLD_DATE  = NEW_DATE WHERE MODEL = '$MODEL' AND NEW_DATE = (select max(NEW_DATE) from SEMANTIC.COUNT_STATISTICS where MODEL = '$MODEL');
    COMMIT;
    exit;
    EOF
    So when I execute SEMANTIC.PROCEDURE:
    SEMANTIC.PROCEDURE => USER1.JOBSCHEDULER =>USER1.load_semantic.sh =>USER1.checkCount.sh
    It never populates the table SEMANTIC.COUNT_STATISTICS.
    I tried giving all of the permissions but I am probably missing something...
    Maybe fresh eyes can see something that I can't.

    I can't believe I am going to say this but the reason it was not working was because I removed oracle environment path from my script by mistake.
    . /etc/profile.d/oracle.sh
    Ugh...
    Now it is working perfectly.
    Btw, sqlplus does know about shell environment variables.
    THANK YOU GUYS!!! YOU ARE THE BEST!!!!!!!!!!!!!!!!!!
    I ONLY HAVE YOU TO TALK TO WHEN I AM STUCK ON A PROBLEM.

  • Help with broken shell script

    Hi,
    We had the shell script below created for our school last year to keep the students from jumping off of our wireless network so they had to go through our content filters. We put the script on all of the student laptops (MacBooks and MacBook pros) so it ran as a process in the background. It worked beautifully for the  whole year.
    Now we are in the process of upgrading our laptops from Snow Leopard to Lion and we've discovered that the script no longer works in Lion. I am guessing it is something simple but I don't see it. Does anyone know what about the OS changed that would cause this script to stop working?
    Thanks
    Tim
    #!/bin/sh
    currentSSID=`networksetup -getairportnetwork Airport | awk {'print $4'}`
    if [ "$currentSSID" = "optimumwifi" ] ; then
            echo "Disassociating.."
            /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/ai rport --disassociate
            networksetup -setairportnetwork Airport "Student" "only4study!"
    fi
    if [ "$currentSSID" = "timewarnercablewifi" ] ; then
            echo "Disassociating.."
            /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/ai rport --disassociate
            networksetup -setairportnetwork Airport "Student" "only4study!"
    fi
    if [ "$currentSSID" = "xfinitywifi" ] ; then
            echo "Disassociating.."
            /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/ai rport --disassociate
            networksetup -setairportnetwork Airport "Student" "only4study!"
    fi

    Brilliant, that worked perfectly! Thanks for the your help Linc.
    Coincidentally, I found a posting on the website stackexchange.com that helped explain why it stopped working in the first placed and why "Airport" alone used to work in Snow Leopard.
    Note what it says at the bottom:
    "the port name is Wi-Fi on 10.7 and AirPort on 10.6. The device name can be at least en0,en1, or en2 depending on your setup."
    http://apple.stackexchange.com/questions/36891/bash-script-to-toggle-wifi-in-lio n

  • How can I get OffLine ContentDB with Power Shell Script

    Hello All,
    How  can I get details of the all content database associated with specific Web application.  I am trying following command.
    Get-SPContentDatabase –WebApplication “http://spf2013dev1:3001”
    This is return results of database which are in ready state. I needs all the database which are in Offline status. Please post a comment.
    Thanks.

    Alternatively:
    $wa = Get-SPWebApplication http://webAppUrl
    foreach($db in ($wa.ContentDatabases | where {$_.Status -eq "Offline")){$db.Name}
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

Maybe you are looking for

  • Instalment Payment terms

    Hi, May i know if it is possible payment terms with Decimal percentages like 42.67% Intial payment 32.98% second payment and so on. i know cash discount is possible with decimal percentages. But i would like to know if this also works Thanks in advan

  • Pricing condition type lenth

    Hi Gurus, I want to maintain condition record for say PR00 for value 1280000000 system is giving message Entry too long (enter in the format ___,___,__~.__V) system is accepting only  128000000 so it is reducing by one zero that means it is taking 12

  • How to display last 10 minutes data  only using sql query

    Hi, Presently, I'm using version is, Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production PL/SQL Release 11.1.0.6.0 - Production CORE 11.1.0.6.0 Production TNS for 32-bit Windows: Version 11.1.0.6.0 - Production NLSRTL Version 11.1.

  • Create button in Device Configuration

    Hi ALL We are not getting the Create, Delete, Copy button in Device Configurations in Mobile Administrator web Console. Any idea how to get the missing buttons? Regards Manish

  • Two Filter on Two dimensions without constraining the fact table

    Hi All, does anybody know how to avoid the fact constraint when creating a report with two filters on different dimensions? I have a big fact table with more than 10 Million rows. In the starmodel the is the dimension customer and products. I create