Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Fvwm: ACPI, Gmail & emerge menus
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Mon Oct 25, 2004 3:14 am    Post subject: Fvwm: ACPI, Gmail & emerge menus Reply with quote

ACPI Script
I modified GaMMas ACPI script for OpenBox to work with FVWM.
Basically it allows you to set the cpu frequency scheduling, see remaining battery capacity, temperature...
You must have ACPI Battery, Thermal Zone and CPU Frequency Scaling Support compiled in the kernel for this to work.
Here's a screenshot of it in action

What you need to do is:


1/ Download the script from here.
2/ Put it in the directory of your choice and chmod +x
3/ You should open the file in an editor and check that rootcmd is propoerly set for your needs
4/ Add the following to your root_menu definition in your FVWM config files:
Code:
+ "ACPI"         Popup acpi


5/ In the same file as above, add the following at the end of the file:
Code:
DestroyMenu acpi
AddToMenu acpi ACPI title
+ DynamicPopupAction Function GetAcpi

DestroyFunc GetAcpi
AddToFunc GetAcpi
+ I DestroyMenu recreate acpi
+ I AddToMenu acpi ACPI title
+ I Piperead 'echo "`/path/to/get-acpi`"'


6/ There, you should be good to go

Gov: displays the current scaling_governor, when clicked if scaling_gov is performance it'll switch to powersave, and if it's anything else it goes to performance.

Gmail Script
The gmail script is also modified from one of GaMMas OpenBox scripts

1/ Download the script from here.
2/ Put it in the directory of your choice and chmod +x
3/ You should open the file in an editor and setup your username password etc...
4/ Add the following to your root_menu definition in your FVWM config files:
Code:
+ "Gmail"         Popup gmail


5/ In the same file as above, add the following at the end of the file:
Code:
DestroyMenu gmail
AddToMenu gmail Gmail title
+ DynamicPopupAction Function Getgmail

DestroyFunc Getgmail
AddToFunc Getgmail
+ I DestroyMenu recreate gmail
+ I AddToMenu gmail Gmail title
+ I Piperead 'echo "`/path/to/gmail`"'


6/ You need to grab libgmail (http://libgmail.sf.net/) and untar it in the directory where the script is then overwrite libgmail.py with the cvs version (http://cvs.sourceforge.net/viewcvs.py/libgmail/libgmail/libgmail.py)

7/ There, you should be good to go

Clicking on the entry will open up gmail in your browser.

Emerge script

This script is a modified version of Skennedys system update menu for openbox. You can see what it does here

1/ Download the script from here.
2/ Put it in the directory of your choice and chmod +x
3/ You should open the file in an editor and change the $term variable
4/ Add the following to your root_menu definition in your FVWM config files:
Code:
+ "Updates"         Popup sysup


5/ In the same file as above, add the following at the end of the file:
Code:
DestroyMenu sysup
AddToMenu sysup Updates title
+ DynamicPopupAction Function Getsysup

DestroyFunc Getsysup
AddToFunc Getsysup
+ I DestroyMenu recreate sysup
+ I AddToMenu sysup Updates title
+ I Piperead 'echo "`/path/to/sysup`"'


6/ There, you should be good to go

Clicking on "update all" will obviously update all the packages, clicking on an individual one will only update that one.
The script store the results of emerge -uDp world in a cache file to allow fast loading of the menu, you can clear the cache by clicking on "clear cache".
_________________
http://blog.chaostrophy.org


Last edited by s3ntient on Tue Oct 26, 2004 3:26 pm; edited 7 times in total
Back to top
View user's profile Send private message
blue.sca
l33t
l33t


Joined: 28 Aug 2003
Posts: 680
Location: Mainz, Germany

PostPosted: Mon Oct 25, 2004 6:35 am    Post subject: Reply with quote

cool, thank you ;)
_________________
geek by nature, linux by choice
i want my avatar back... thank you
:wq
Back to top
View user's profile Send private message
Ruzbeh
Apprentice
Apprentice


Joined: 23 Jun 2004
Posts: 223

PostPosted: Mon Oct 25, 2004 12:27 pm    Post subject: Reply with quote

COULD YOU DO THE SAME FOR THE OPENBOX GMAIL CHECKER (which is also in python).

Thanks!
Back to top
View user's profile Send private message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Tue Oct 26, 2004 2:15 am    Post subject: Reply with quote

Quote:
COULD YOU DO THE SAME FOR THE OPENBOX GMAIL CHECKER (which is also in python).

Thanks!


No problem, i added the script to my first post but I don't have Gmail so could you cinfirm it works?
_________________
http://blog.chaostrophy.org
Back to top
View user's profile Send private message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Tue Oct 26, 2004 1:02 pm    Post subject: Reply with quote

Ok, I added the third script to my initial post.
Unfortunately I'm in Slackware right now, so I'm not entirely sure it works, if someone could confirm that would be great :D
_________________
http://blog.chaostrophy.org
Back to top
View user's profile Send private message
Ruzbeh
Apprentice
Apprentice


Joined: 23 Jun 2004
Posts: 223

PostPosted: Tue Oct 26, 2004 2:13 pm    Post subject: Reply with quote

What the hell does the third script do?
Back to top
View user's profile Send private message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Tue Oct 26, 2004 2:39 pm    Post subject: Reply with quote

Ruzbeh wrote:
What the hell does the third script do?


I updated the screenshot:
http://www.awarmplace.net/emerge.jpg

Basically it gives you the output of emerge -uDp world and lets you update one or all of the packages depending on what you click on.
_________________
http://blog.chaostrophy.org
Back to top
View user's profile Send private message
Ruzbeh
Apprentice
Apprentice


Joined: 23 Jun 2004
Posts: 223

PostPosted: Tue Oct 26, 2004 2:48 pm    Post subject: Reply with quote

Zyklon wrote:
Ruzbeh wrote:
What the hell does the third script do?


I updated the screenshot:
http://www.awarmplace.net/emerge.jpg

Basically it gives you the output of emerge -uDp world and lets you update one or all of the packages depending on what you click on.


Don't you need root access for that?

And btw the gmail script isn't working! I get some error in line 62!
Back to top
View user's profile Send private message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Tue Oct 26, 2004 2:58 pm    Post subject: Reply with quote

Not if you have sudo.

Could you be more specific about the error?
_________________
http://blog.chaostrophy.org
Back to top
View user's profile Send private message
Ruzbeh
Apprentice
Apprentice


Joined: 23 Jun 2004
Posts: 223

PostPosted: Tue Oct 26, 2004 3:11 pm    Post subject: Reply with quote

Well if I do ctrl+alt+f1 I can see the error but how do I copy it over?

It says something in Line 62

AttributeError: 'module' object has no attribute 'GmailSessionState'
Back to top
View user's profile Send private message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Tue Oct 26, 2004 3:29 pm    Post subject: Reply with quote

Yeah sorry I forgot a step in the instruction :P
Go back and do step 6, that should fix the problem
_________________
http://blog.chaostrophy.org
Back to top
View user's profile Send private message
Ruzbeh
Apprentice
Apprentice


Joined: 23 Jun 2004
Posts: 223

PostPosted: Tue Oct 26, 2004 3:36 pm    Post subject: Reply with quote

Now I'm getting a syntax error in line 6 or something!!!
Back to top
View user's profile Send private message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Tue Oct 26, 2004 3:47 pm    Post subject: Reply with quote

That's strange...

could you post the error? (go into the directory where you put the script and type ./gmail in a terminal, you'll be albe to copy the output that way ;) )
_________________
http://blog.chaostrophy.org
Back to top
View user's profile Send private message
Ruzbeh
Apprentice
Apprentice


Joined: 23 Jun 2004
Posts: 223

PostPosted: Tue Oct 26, 2004 4:29 pm    Post subject: Reply with quote

Code:
Traceback (most recent call last):
  File "./gmail", line 24, in ?
    import libgmail
  File "/usr/lib/python2.3/site-packages/libgmail.py", line 6
    <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"
    ^
SyntaxError: invalid syntax
Back to top
View user's profile Send private message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Tue Oct 26, 2004 5:18 pm    Post subject: Reply with quote

did you replace libgmail.py by the cvs version? If so, try asking GaMMa:
https://forums.gentoo.org/viewtopic.php?t=216604
_________________
http://blog.chaostrophy.org
Back to top
View user's profile Send private message
robet
l33t
l33t


Joined: 06 Sep 2004
Posts: 807
Location: Earth/NorthAmerica/USA/NY

PostPosted: Tue Jan 18, 2005 8:08 pm    Post subject: Reply with quote

Ruzbeh wrote:
Code:
Traceback (most recent call last):
  File "./gmail", line 24, in ?
    import libgmail
  File "/usr/lib/python2.3/site-packages/libgmail.py", line 6
    <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"
    ^
SyntaxError: invalid syntax
Same problem... emerge script works nicely though!
_________________
no software patents in europe! | adopt an unanswered post.
Back to top
View user's profile Send private message
robet
l33t
l33t


Joined: 06 Sep 2004
Posts: 807
Location: Earth/NorthAmerica/USA/NY

PostPosted: Wed Jan 19, 2005 7:42 pm    Post subject: Reply with quote

Alright figured it out. The link http://cvs.sourceforge.net/viewcvs.py/libgmail/libgmail/libgmail.py that you/Zyklon gave in the FVWM howto is actually a link to a webpage with the libgmail.py files on it, though it would seem that it is a file because of the name and extension. Downloaded the version properly FROM that page, and it works fine. Just a miscommunication. Works like a charm now!
_________________
no software patents in europe! | adopt an unanswered post.
Back to top
View user's profile Send private message
Digital Storm
Tux's lil' helper
Tux's lil' helper


Joined: 07 Mar 2003
Posts: 116
Location: Toronto, Canada

PostPosted: Thu Jan 20, 2005 7:56 pm    Post subject: Reply with quote

I'm using the Emerge script except I have a problem...

I editted the files correctly and I have a new menu called "Updates" clicking on it lists all possible updates I need but...Clicking any update/update all results in nothing...Dropping back to CLI I have an error "Invalid Argument: sudo"

Now I'm confused...because I installed and setup sudo just fine and "sudo emerge -up world" works fine...Any ideas?
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Fri Jan 21, 2005 9:12 pm    Post subject: Reply with quote

There were some errors with the ACPI script. I was getting a double sudo (like, sudo sudo command) in the menu entry and, to make things worse, there was a newline between "Gov: xxx" and Exec exec... so when I clicked on it nothing happened. Of course I am giving back the modified version. Thanks for your work.

Code:
#!/usr/bin/python2.3
# Authors: zyklon@gmx.net, cduquette@gmail.com
# License: GPL 2.0

# This script is a port for FVWM of GaMMas ACPI script for OpenBox
# available here: http://forums.gentoo.org/viewtopic.php?t=240213
# Go to the following thread on the Gentoo Forums for information
# on how to use this script:
# http://forums.gentoo.org/viewtopic.php?p=1687824

# Make sure to edit rootcmd, some may want to use 'xterm -e sudo'

import string

rootcmd = "aterm -shading 30 -e sudo "

file = open('/proc/acpi/battery/BAT0/state','r')
tmp = file.readlines()
state = tmp[4].split()[2]
file.close()

file = open('/proc/acpi/thermal_zone/THRM/temperature','r')
temp = file.readline().split()[1]
file.close()

file = open('/proc/acpi/battery/BAT0/info','r')
tmp = file.readlines()
maxcapacity = tmp[1].split()[2]
capacity = tmp[2].split()[3]
file.close()

remaining = round(((float(state) / float(capacity)) * 100),1)

file = open('/proc/acpi/ac_adapter/AC/state','r')
ac = file.readline().split()[1]
file.close()

file = open('/proc/cpuinfo','r')
tmp = file.readlines()
cpu = tmp[6].split()[3]
file.close()

file = open('/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor','r')
governor = file.readline().split()[0]
file.close()

if ac == "on-line":
   if remaining > 100:
      remaining = 100
   print "  AddToMenu acpi \"Bat: " + str(remaining) + " (AC)\""
else:
   print "  AddToMenu acpi \"Bat: " + str(remaining) + "%\""

print "  AddToMenu acpi \"Cpu: " + str(cpu) + " MHz\""
print "  AddToMenu acpi \"Temp: " + str(temp) + " C\""

print ""
if governor == "performance":
   print "   AddToMenu acpi \"Gov: " + governor + "\" Exec " + rootcmd + "ondemand"
else:
   print "   AddToMenu acpi \"Gov: " + governor + "\" Exec " + rootcmd + "speedup"


Some of the changes are customized to my needs, indeed I'm using aterm and I use two bash scripts, "speedup" and "ondemand", to change governor. I hope I've been helpful.

EDIT: whoops, I introduced an error myself ^^ corrected
_________________
It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox!


Last edited by Lepaca Kliffoth on Fri Jan 21, 2005 9:25 pm; edited 1 time in total
Back to top
View user's profile Send private message
Lepaca Kliffoth
l33t
l33t


Joined: 28 Apr 2004
Posts: 737
Location: Florence, Italy

PostPosted: Fri Jan 21, 2005 9:17 pm    Post subject: Reply with quote

Digital Storm wrote:
I'm using the Emerge script except I have a problem...

I editted the files correctly and I have a new menu called "Updates" clicking on it lists all possible updates I need but...Clicking any update/update all results in nothing...Dropping back to CLI I have an error "Invalid Argument: sudo"

Now I'm confused...because I installed and setup sudo just fine and "sudo emerge -up world" works fine...Any ideas?


I didn't check the emerge script but if the error is the same I was getting, your menu is probably running a "sudo sudo command"; or, there may be a newline between "AddToMenu etc etc" and "Exec exec etc.". You can check the actual output of the script with "python /path/to/script_file", see if you're getting one of those errors.
_________________
It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox!
Back to top
View user's profile Send private message
mascanho
Veteran
Veteran


Joined: 21 Dec 2004
Posts: 1241
Location: On my Bmx Bike on a Concrete Park Flatlanding ...

PostPosted: Wed May 25, 2005 4:49 pm    Post subject: Reply with quote

Can someone give me a hand and give me the current url because the one above is no longer there .
Im searching for the i2c script for reading temps on fvwm menu

Code:

ACPI Script
I modified GaMMas ACPI script for OpenBox to work with FVWM.
Basically it allows you to set the cpu frequency scheduling, see remaining battery capacity, temperature...
You must have ACPI Battery, Thermal Zone and CPU Frequency Scaling Support compiled in the kernel for this to work.
Here's a screenshot of it in action

What you need to do is:


1/ Download the script from here.
2/ Put it in the directory of your choice and chmod +x
3/ You should open the file in an editor and check that rootcmd is propoerly set for your needs
4/ Add the following to your root_menu definition in your FVWM config files:
Code:
+ "ACPI"         Popup acpi


5/ In the same file as above, add the following at the end of the file:
Code:
DestroyMenu acpi
AddToMenu acpi ACPI title
+ DynamicPopupAction Function GetAcpi

DestroyFunc GetAcpi
AddToFunc GetAcpi
+ I DestroyMenu recreate acpi
+ I AddToMenu acpi ACPI title
+ I Piperead 'echo "`/path/to/get-acpi`"'



but the URL metioned is no longer that one .
Does anyone has that script or the url so that i can download it ??
_________________
Flatland Life is a Choice !
emerge avatar
Back to top
View user's profile Send private message
pilla
Bodhisattva
Bodhisattva


Joined: 07 Aug 2002
Posts: 7729
Location: Underworld

PostPosted: Wed May 25, 2005 5:01 pm    Post subject: Reply with quote

Moved from GC
_________________
"I'm just very selective about the reality I choose to accept." -- Calvin
Back to top
View user's profile Send private message
s3ntient
Guru
Guru


Joined: 13 Apr 2003
Posts: 304
Location: Lyon, France

PostPosted: Thu May 26, 2005 1:56 am    Post subject: Reply with quote

If all who are looking for these scripts, they've been unavailable since I switched hosts back in December.
I've added two of the three to my homepage ( http://82.67.23.100/ ) under the "scripts" section, I'll add the third one shortly. The instructions are in french but they're the same as in this thread.
_________________
http://blog.chaostrophy.org
Back to top
View user's profile Send private message
mascanho
Veteran
Veteran


Joined: 21 Dec 2004
Posts: 1241
Location: On my Bmx Bike on a Concrete Park Flatlanding ...

PostPosted: Thu May 26, 2005 9:57 am    Post subject: Reply with quote

hehehehe tanks very much , but i bang my head so many times that i ended up making it myself, with your post help of course tks very much !!
_________________
Flatland Life is a Choice !
emerge avatar
Back to top
View user's profile Send private message
jspeybro
Tux's lil' helper
Tux's lil' helper


Joined: 06 Apr 2004
Posts: 121
Location: Brussels

PostPosted: Fri Aug 12, 2005 11:44 am    Post subject: Reply with quote

Are these scripts still available somewhere? I'm interested in the gmail script.
I have the script for openbox, so if someone can give me directions on how to change it I might be able to do it myself.


EDIT: never mind, I already changed the script myself.
I'll post the modified script here in case somebody is intersted:
Code:
#!/usr/bin/python2.3
# Authors: cduquette@gmail.com follower@myrealbox.com
# License: GPL 2.0

# modified by jspeybro to work in FVWM
# this has been done by others, but the script was not available anymore
# I didn't test this very well
# Usage in FVWM:
# put an entry in your fvwm-menu like this:
# + "Gmail"         Popup gmail
# add the folowing code below the menu-part
# DestroyMenu gmail
# AddToMenu gmail Gmail title
# + DynamicPopupAction Function Getgmail
#
# DestroyFunc Getgmail
# AddToFunc Getgmail
# + I DestroyMenu recreate gmail
# + I AddToMenu gmail Gmail title
# + I Piperead 'echo "`$[fvwm_scripts]/gmail.py`"'
# change the line above to point it to this script
# change the name,pw and browser variable in this script

import os
import sys
import logging

name = "username"
pw = "password"
browser = "firefox"
filename = "/tmp/.gmail.cache"
# jspeybro: I changed &amp; to & to make it work for me
login = "\'https://www.google.com/accounts/ServiceLoginBoxAuth?service=mail&continue=https%3A%2F%2Fgmail.google.com%2Fgmail&Email=" + name + "&Passwd=" + pw + "\'"

# Allow us to run using installed `libgmail` or the one in parent directory.
try:
    import libgmail
except ImportError:
    # Urghhh...
    sys.path.insert(1,
                    os.path.realpath(os.path.join(os.path.dirname(__file__),
                                                  os.path.pardir)))

    import libgmail

   
if __name__ == "__main__":
    import sys
    from getpass import getpass

    if not os.path.isfile(filename):
        ga = libgmail.GmailAccount(name, pw)

        try:
            ga.login()
        except libgmail.GmailLoginFailure:
       print "+ \"login failed\" Exec exec " +browser + " " + login
            print "+ \"Open gmail in " + browser + "\" Exec exec" + browser + " " + login
       raise SystemExit

    else:
        ga = libgmail.GmailAccount(
            state = libgmail.GmailSessionState(filename = filename))
   
    msgtotals = ga.getUnreadMsgCount()
   
    if msgtotals == 0:
   print "+ \"0 unread messages\" Exec exec " +browser + " " + login
    elif msgtotals == 1:
        print " + \"1 new message.\" Exec exec " + browser + " " + login
    else:
        print "+ \"" + str(msgtotals) + " new messages.\" Exec exec " + browser + " " + login

    state = libgmail.GmailSessionState(account = ga).save(filename)


I modified it so that it just shows how many messages you have in your inmox. when you click on it, it wil open your account in the specified browser.

Johan
_________________
http://counter.li.org - Registered Linux user #295636
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum