Modules (loading)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Modules (loading)

Kete Foy
I cannot figure out how to load the battery module (%b) for the modeline.
I went to ~/stumpwm and ran `make install-modules´.
In my ~/.stumpwmrc, I have the following:
(add-to-load-path "~/.stumpwm.d/modules")

(load-module "battery")

(setf stumpwm:*screen-mode-line-format*
      (list "%n |%w | %b | %d"))
I have C-c C-j all of them in Emacs, but the %b shows up literally as %b.
I can't tell how to set up the modules.

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Lucas Pandolfo
I have all the modules under ~/stumpwm, then in .stumpwmrc

(add-to-load-path "~/stumpwm/contrib/modeline/battery/")
(load-module "battery")


On 7 January 2015 at 17:47, Kete Foy <[hidden email]> wrote:
I cannot figure out how to load the battery module (%b) for the modeline.
I went to ~/stumpwm and ran `make install-modules´.
In my ~/.stumpwmrc, I have the following:
(add-to-load-path "~/.stumpwm.d/modules")

(load-module "battery")

(setf stumpwm:*screen-mode-line-format*
      (list "%n |%w | %b | %d"))
I have C-c C-j all of them in Emacs, but the %b shows up literally as %b.
I can't tell how to set up the modules.

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel



_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Kete Foy
Thanks, I got the following error:
fmt-bat-charge unavailable argument
On 01/07/2015 05:02 PM, Lucas Pandolfo wrote:
I have all the modules under ~/stumpwm, then in .stumpwmrc

(add-to-load-path "~/stumpwm/contrib/modeline/battery/")
(load-module "battery")




_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

David Bjergaard
Hi,

I see that you're re-evaluating in emacs. If you just restart stumpwm
completely do you get the same errors?

    Dave

Kete Foy <[hidden email]> writes:

> Thanks, I got the following error:
>
>     fmt-bat-charge unavailable argument
>    
>
> On 01/07/2015 05:02 PM, Lucas Pandolfo wrote:
>
>     I have all the modules under ~/stumpwm, then in .stumpwmrc
>    
>    
>     (add-to-load-path "~/stumpwm/contrib/modeline/battery/")
>     (load-module "battery")
>    
>    
>
>    
>
>
> _______________________________________________
> Stumpwm-devel mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Lucas Pandolfo
Could you provide a backtrace?

I think i had a similar problem. I use the same config (automatically synced) for my desktop and notebook, and the Desktop was having some trouble with fmt-bat-charge. I had to make some changes to the module to make it behave properly.

Anyways, a backtrace could help.

On 8 January 2015 at 10:13, David Bjergaard <[hidden email]> wrote:
Hi,

I see that you're re-evaluating in emacs. If you just restart stumpwm
completely do you get the same errors?

    Dave

Kete Foy <[hidden email]> writes:

> Thanks, I got the following error:
>
>     fmt-bat-charge unavailable argument
>
>
> On 01/07/2015 05:02 PM, Lucas Pandolfo wrote:
>
>     I have all the modules under ~/stumpwm, then in .stumpwmrc
>
>
>     (add-to-load-path "~/stumpwm/contrib/modeline/battery/")
>     (load-module "battery")
>
>
>
>
>
>
> _______________________________________________
> Stumpwm-devel mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Kete Foy
I can't find how to do a backtrace.

On 01/08/2015 05:30 PM, Lucas Pandolfo wrote:
> Could you provide a backtrace?


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Lucas Pandolfo
The command copy-unhandled-error should copy it to the X11 clipboard (or you could use copy-last-message).

If you are having trouble getting the backtrace, eval (or add to the init file)  the following:

(stumpwm:redirect-all-output #p"/tmp/stumpwm.log")
(setf stumpwm:*debug-level* 10)

Then "/tmp/stumpwm.log" will have all the relevant info (and lots of non relevant info).


On 9 January 2015 at 09:20, Kete Foy <[hidden email]> wrote:
I can't find how to do a backtrace.


On 01/08/2015 05:30 PM, Lucas Pandolfo wrote:
Could you provide a backtrace?



_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Kete Foy
The value "" is not of type HASH-TABLE.
Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10044CE433}>
0: (SB-IMPL::GETHASH3 "present" "" NIL) [tl,external]
1: (BATTERY::CURRENT-BATTERY-CHARGE)
2: (BATTERY::FMT-BAT-CHARGE #<unavailable argument>)
3: (FORMAT-EXPAND ((#\b BATTERY::FMT-BAT-CHARGE) (#\h STUMPWM::FMT-HEAD)
(#\w STUMPWM::FMT-WINDOW-LIST) (#\W STUMPWM::FMT-HEAD-WINDOW-LIST) (#\g
STUMPWM::FMT-GROUP-LIST) (#\n STUMPWM::FMT-GROUP) (#\u
STUMPWM::FMT-URGENT-WINDOW-LIST) (#\v
STUMPWM::FMT-HEAD-WINDOW-LIST-HIDDEN-WINDOWS) (#\d
STUMPWM::FMT-MODELINE-TIME)) "%n |%w | %b | %d" #S(MODE-LINE :SCREEN
#1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD
#S(frame 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40001C>
:FORMAT *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Default |
1+Flow - MediaWiki - Iceweasel  2*emacs@parabola | Sat Jan 10 13:57:23 |
Battery 75%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0
40001E> :GC #<XLIB:GCONTEXT #2#:0 4194333> :DEFAULT-FG 8355711
:DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP
NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE
:STUMP))
4: ((:METHOD STUMPWM::MODE-LINE-FORMAT-ELT (LIST)) ("%n |%w | %b | %d"))
[fast-method]
5: (STUMPWM::REDRAW-MODE-LINE #S(MODE-LINE :SCREEN #1=#S<screen
#<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame 0 NIL 0 0
1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40001C> :FORMAT
*SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Default | 1+Flow -
MediaWiki - Iceweasel 2*emacs@parabola | Sat Jan 10 13:57:23 | Battery 75%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0
40001E> :GC #<XLIB:GCONTEXT #2#:0 4194333> :DEFAULT-FG 8355711
:DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP
NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE
:STUMP) NIL)
6: (STUMPWM::UPDATE-MODE-LINES #S<screen #<XLIB:SCREEN :0.0 1280x800x24
TRUE-COLOR>>)
7: (STUMPWM::UPDATE-ALL-MODE-LINES)
8: (STUMPWM::RUN-EXPIRED-TIMERS)
9: (STUMPWM::STUMPWM-INTERNAL-LOOP)
10: (STUMPWM::STUMPWM-INTERNAL ":0")
11: (STUMPWM ":0")
12: ((LAMBDA NIL :IN "/home/kete/stumpwm/make-image.lisp"))
13: ((FLET #:WITHOUT-INTERRUPTS-BODY-89 :IN SB-EXT:SAVE-LISP-AND-DIE))
14: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))

On 01/09/2015 11:59 AM, Lucas Pandolfo wrote:
> The command copy-unhandled-error should copy it to the X11 clipboard
> (or you could use copy-last-message).
>


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Lucas Pandolfo
Yep. That's the exact same problem i was having.

Is it a notebook?

If it is, what does  'ls /proc/acpi/battery/ -l' return?

Else the solution is here. Just change those lines. (Even if it is a notebook this will fix the error, but you wont get any battery info)


On 10 January 2015 at 16:07, Kete Foy <[hidden email]> wrote:
The value "" is not of type HASH-TABLE.
Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10044CE433}>
0: (SB-IMPL::GETHASH3 "present" "" NIL) [tl,external]
1: (BATTERY::CURRENT-BATTERY-CHARGE)
2: (BATTERY::FMT-BAT-CHARGE #<unavailable argument>)
3: (FORMAT-EXPAND ((#\b BATTERY::FMT-BAT-CHARGE) (#\h STUMPWM::FMT-HEAD) (#\w STUMPWM::FMT-WINDOW-LIST) (#\W STUMPWM::FMT-HEAD-WINDOW-LIST) (#\g STUMPWM::FMT-GROUP-LIST) (#\n STUMPWM::FMT-GROUP) (#\u STUMPWM::FMT-URGENT-WINDOW-LIST) (#\v STUMPWM::FMT-HEAD-WINDOW-LIST-HIDDEN-WINDOWS) (#\d STUMPWM::FMT-MODELINE-TIME)) "%n |%w | %b | %d" #S(MODE-LINE :SCREEN #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40001C> :FORMAT *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Default | 1+Flow - MediaWiki - Iceweasel  2*emacs@parabola | Sat Jan 10 13:57:23 | Battery 75%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0 40001E> :GC #<XLIB:GCONTEXT #2#:0 4194333> :DEFAULT-FG 8355711 :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE :STUMP))
4: ((:METHOD STUMPWM::MODE-LINE-FORMAT-ELT (LIST)) ("%n |%w | %b | %d")) [fast-method]
5: (STUMPWM::REDRAW-MODE-LINE #S(MODE-LINE :SCREEN #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40001C> :FORMAT *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Default | 1+Flow - MediaWiki - Iceweasel 2*emacs@parabola | Sat Jan 10 13:57:23 | Battery 75%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0 40001E> :GC #<XLIB:GCONTEXT #2#:0 4194333> :DEFAULT-FG 8355711 :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE :STUMP) NIL)
6: (STUMPWM::UPDATE-MODE-LINES #S<screen #<XLIB:SCREEN :0.0 1280x800x24 TRUE-COLOR>>)
7: (STUMPWM::UPDATE-ALL-MODE-LINES)
8: (STUMPWM::RUN-EXPIRED-TIMERS)
9: (STUMPWM::STUMPWM-INTERNAL-LOOP)
10: (STUMPWM::STUMPWM-INTERNAL ":0")
11: (STUMPWM ":0")
12: ((LAMBDA NIL :IN "/home/kete/stumpwm/make-image.lisp"))
13: ((FLET #:WITHOUT-INTERRUPTS-BODY-89 :IN SB-EXT:SAVE-LISP-AND-DIE))
14: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))


On 01/09/2015 11:59 AM, Lucas Pandolfo wrote:
The command copy-unhandled-error should copy it to the X11 clipboard (or you could use copy-last-message).




_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Kete Foy
On 01/10/2015 03:51 PM, Lucas Pandolfo wrote:
Is it a notebook?

Yes


If it is, what does  'ls /proc/acpi/battery/ -l' return?

I don't have the battery directory in Parabola ("ArchLinux").

By the way, here is the shell command that I use to monitor the battery charge (requires the acpi package):
(setf stumpwm:*screen-mode-line-format*
      (list "%n |%w | %d | Battery"
      '(:eval (stumpwm:run-shell-command "acpi |cut -d ',' -f 2" t))))

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Lucas Pandolfo
Oh, i see.

I suppose you have the directory /sys/class/power_supply/BAT0.
The battery module uses the /proc/acpi/battery/ path.

Try replacing /proc/acpi/battery/ with  /sys/class/power_supply/ in the battery.lisp file (line 28).





If this works the module can be refactored to export another variable *battery-path*. Something like:

=====================================

(export '(*battery-path*))
(defvar *battery-path* nil)

(defun read-battery-file (battery fname)
  (let ((fields (make-hash-table :test #'equal)))
    (with-open-file (s (or *battery-path* (concatenate 'string "/proc/acpi/battery/" battery "/" fname)
                                 :if-does-not-exist nil)
 ....)))

=================================

And then users could do (setf *battery-path* "/sys/class/power_supply/BAT0") after loading the module.

That or just make the module check for /proc/acpi/ and then /sys/class/power_supply/ or wathever.

On 14 January 2015 at 00:41, Kete Foy <[hidden email]> wrote:
On 01/10/2015 03:51 PM, Lucas Pandolfo wrote:
Is it a notebook?

Yes


If it is, what does  'ls /proc/acpi/battery/ -l' return?

I don't have the battery directory in Parabola ("ArchLinux").

By the way, here is the shell command that I use to monitor the battery charge (requires the acpi package):
(setf stumpwm:*screen-mode-line-format*
      (list "%n |%w | %d | Battery"
      '(:eval (stumpwm:run-shell-command "acpi |cut -d ',' -f 2" t))))


_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Kete Foy
What's the difference between the battery and battery-portable modules?
On 01/14/2015 07:31 AM, Lucas Pandolfo wrote:
Oh, i see.

I suppose you have the directory /sys/class/power_supply/BAT0.
The battery module uses the /proc/acpi/battery/ path.

Try replacing /proc/acpi/battery/ with  /sys/class/power_supply/ in the battery.lisp file (line 28).





If this works the module can be refactored to export another variable *battery-path*. Something like:

=====================================

(export '(*battery-path*))
(defvar *battery-path* nil)

(defun read-battery-file (battery fname)
  (let ((fields (make-hash-table :test #'equal)))
    (with-open-file (s (or *battery-path* (concatenate 'string "/proc/acpi/battery/" battery "/" fname)
                                 :if-does-not-exist nil)
 ....)))

=================================

And then users could do (setf *battery-path* "/sys/class/power_supply/BAT0") after loading the module.

That or just make the module check for /proc/acpi/ and then /sys/class/power_supply/ or wathever.

On 14 January 2015 at 00:41, Kete Foy <[hidden email]> wrote:
On 01/10/2015 03:51 PM, Lucas Pandolfo wrote:
Is it a notebook?

Yes


If it is, what does  'ls /proc/acpi/battery/ -l' return?

I don't have the battery directory in Parabola ("ArchLinux").

By the way, here is the shell command that I use to monitor the battery charge (requires the acpi package):
(setf stumpwm:*screen-mode-line-format*
      (list "%n |%w | %d | Battery"
      '(:eval (stumpwm:run-shell-command "acpi |cut -d ',' -f 2" t))))



_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Kete Foy
In reply to this post by Lucas Pandolfo
had an error, and the modeline said no battery

The value "" is not of type HASH-TABLE.
Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10044CE433}>
0: (SB-IMPL::GETHASH3 "present" "" NIL) [tl,external]
1: (BATTERY::CURRENT-BATTERY-CHARGE)
2: (BATTERY::FMT-BAT-CHARGE #<unavailable argument>)
3: (FORMAT-EXPAND ((#\b BATTERY::FMT-BAT-CHARGE) (#\h STUMPWM::FMT-HEAD) (#\w STUMPWM::FMT-WINDOW-LIST) (#\W STUMPWM::FMT-HEAD-WINDOW-LIST) (#\g STUMPWM::FMT-GROUP-LIST) (#\n STUMPWM::FMT-GROUP) (#\u STUMPWM::FMT-URGENT-WINDOW-LIST) (#\v STUMPWM::FMT-HEAD-WINDOW-LIST-HIDDEN-WINDOWS) (#\d STUMPWM::FMT-MODELINE-TIME)) "%n |%w | %b | %d" #S(MODE-LINE :SCREEN #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40000A> :FORMAT *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Grp3 | [hidden email] | Wed Jan 14  8:24:47 | Battery 100%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0 40000C> :GC #<XLIB:GCONTEXT #2#:0 4194315> :DEFAULT-FG 8355711 :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE :STUMP))
4: ((:METHOD STUMPWM::MODE-LINE-FORMAT-ELT (LIST)) ("%n |%w | %b | %d")) [fast-method]
5: (STUMPWM::REDRAW-MODE-LINE #S(MODE-LINE :SCREEN #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40000A> :FORMAT *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Grp3 | [hidden email] | Wed Jan 14  8:24:47 | Battery 100%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0 40000C> :GC #<XLIB:GCONTEXT #2#:0 4194315> :DEFAULT-FG 8355711 :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE :STUMP) NIL)
6: (STUMPWM::UPDATE-MODE-LINES #S<screen #<XLIB:SCREEN :0.0 1280x800x24 TRUE-COLOR>>)
7: (STUMPWM::UPDATE-ALL-MODE-LINES)
8: (STUMPWM::RUN-EXPIRED-TIMERS)
9: (STUMPWM::STUMPWM-INTERNAL-LOOP)
10: (STUMPWM::STUMPWM-INTERNAL ":0")
11: (STUMPWM ":0")
12: ((LAMBDA NIL :IN "/home/kete/stumpwm/make-image.lisp"))
13: ((FLET #:WITHOUT-INTERRUPTS-BODY-89 :IN SB-EXT:SAVE-LISP-AND-DIE))
14: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))

On 01/14/2015 07:31 AM, Lucas Pandolfo wrote:
Oh, i see.

I suppose you have the directory /sys/class/power_supply/BAT0.
The battery module uses the /proc/acpi/battery/ path.

Try replacing /proc/acpi/battery/ with  /sys/class/power_supply/ in the battery.lisp file (line 28).





If this works the module can be refactored to export another variable *battery-path*. Something like:

=====================================

(export '(*battery-path*))
(defvar *battery-path* nil)

(defun read-battery-file (battery fname)
  (let ((fields (make-hash-table :test #'equal)))
    (with-open-file (s (or *battery-path* (concatenate 'string "/proc/acpi/battery/" battery "/" fname)
                                 :if-does-not-exist nil)
 ....)))

=================================

And then users could do (setf *battery-path* "/sys/class/power_supply/BAT0") after loading the module.

That or just make the module check for /proc/acpi/ and then /sys/class/power_supply/ or wathever.

On 14 January 2015 at 00:41, Kete Foy <[hidden email]> wrote:
On 01/10/2015 03:51 PM, Lucas Pandolfo wrote:
Is it a notebook?

Yes


If it is, what does  'ls /proc/acpi/battery/ -l' return?

I don't have the battery directory in Parabola ("ArchLinux").

By the way, here is the shell command that I use to monitor the battery charge (requires the acpi package):
(setf stumpwm:*screen-mode-line-format*
      (list "%n |%w | %d | Battery"
      '(:eval (stumpwm:run-shell-command "acpi |cut -d ',' -f 2" t))))



_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Lucas Pandolfo
In reply to this post by Kete Foy
Portability mostly :P

Well, it supports both /proc and /sys methods for linux (the default is sys, but proc can be used changing *prefer-sysfs*).  Also supports OpenBSD.

Other than that, the code is almost 3 times longer (well, no surprises here) and the formatter is different.

On 14 January 2015 at 10:07, Kete Foy <[hidden email]> wrote:
What's the difference between the battery and battery-portable modules?

On 01/14/2015 07:31 AM, Lucas Pandolfo wrote:
Oh, i see.

I suppose you have the directory /sys/class/power_supply/BAT0.
The battery module uses the /proc/acpi/battery/ path.

Try replacing /proc/acpi/battery/ with  /sys/class/power_supply/ in the battery.lisp file (line 28).





If this works the module can be refactored to export another variable *battery-path*. Something like:

=====================================

(export '(*battery-path*))
(defvar *battery-path* nil)

(defun read-battery-file (battery fname)
  (let ((fields (make-hash-table :test #'equal)))
    (with-open-file (s (or *battery-path* (concatenate 'string "/proc/acpi/battery/" battery "/" fname)
                                 :if-does-not-exist nil)
 ....)))

=================================

And then users could do (setf *battery-path* "/sys/class/power_supply/BAT0") after loading the module.

That or just make the module check for /proc/acpi/ and then /sys/class/power_supply/ or wathever.

On 14 January 2015 at 00:41, Kete Foy <[hidden email]> wrote:
On 01/10/2015 03:51 PM, Lucas Pandolfo wrote:
Is it a notebook?

Yes


If it is, what does  'ls /proc/acpi/battery/ -l' return?

I don't have the battery directory in Parabola ("ArchLinux").

By the way, here is the shell command that I use to monitor the battery charge (requires the acpi package):
(setf stumpwm:*screen-mode-line-format*
      (list "%n |%w | %d | Battery"
      '(:eval (stumpwm:run-shell-command "acpi |cut -d ',' -f 2" t))))




_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Lucas Pandolfo
In reply to this post by Kete Foy
Replacing the said line?

Then i suppose the battery files in /proc and /sys are different, so the battery module wont work. Also the proposed fix wont work.



On 14 January 2015 at 10:32, Kete Foy <[hidden email]> wrote:
had an error, and the modeline said no battery

The value "" is not of type HASH-TABLE.
Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10044CE433}>
0: (SB-IMPL::GETHASH3 "present" "" NIL) [tl,external]
1: (BATTERY::CURRENT-BATTERY-CHARGE)
2: (BATTERY::FMT-BAT-CHARGE #<unavailable argument>)
3: (FORMAT-EXPAND ((#\b BATTERY::FMT-BAT-CHARGE) (#\h STUMPWM::FMT-HEAD) (#\w STUMPWM::FMT-WINDOW-LIST) (#\W STUMPWM::FMT-HEAD-WINDOW-LIST) (#\g STUMPWM::FMT-GROUP-LIST) (#\n STUMPWM::FMT-GROUP) (#\u STUMPWM::FMT-URGENT-WINDOW-LIST) (#\v STUMPWM::FMT-HEAD-WINDOW-LIST-HIDDEN-WINDOWS) (#\d STUMPWM::FMT-MODELINE-TIME)) "%n |%w | %b | %d" #S(MODE-LINE :SCREEN #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40000A> :FORMAT *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Grp3 | [hidden email] | Wed Jan 14  8:24:47 | Battery 100%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0 40000C> :GC #<XLIB:GCONTEXT #2#:0 4194315> :DEFAULT-FG 8355711 :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE :STUMP))
4: ((:METHOD STUMPWM::MODE-LINE-FORMAT-ELT (LIST)) ("%n |%w | %b | %d")) [fast-method]
5: (STUMPWM::REDRAW-MODE-LINE #S(MODE-LINE :SCREEN #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40000A> :FORMAT *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Grp3 | [hidden email] | Wed Jan 14  8:24:47 | Battery 100%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0 40000C> :GC #<XLIB:GCONTEXT #2#:0 4194315> :DEFAULT-FG 8355711 :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE :STUMP) NIL)
6: (STUMPWM::UPDATE-MODE-LINES #S<screen #<XLIB:SCREEN :0.0 1280x800x24 TRUE-COLOR>>)
7: (STUMPWM::UPDATE-ALL-MODE-LINES)
8: (STUMPWM::RUN-EXPIRED-TIMERS)
9: (STUMPWM::STUMPWM-INTERNAL-LOOP)
10: (STUMPWM::STUMPWM-INTERNAL ":0")
11: (STUMPWM ":0")
12: ((LAMBDA NIL :IN "/home/kete/stumpwm/make-image.lisp"))
13: ((FLET #:WITHOUT-INTERRUPTS-BODY-89 :IN SB-EXT:SAVE-LISP-AND-DIE))
14: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))

On 01/14/2015 07:31 AM, Lucas Pandolfo wrote:
Oh, i see.

I suppose you have the directory /sys/class/power_supply/BAT0.
The battery module uses the /proc/acpi/battery/ path.

Try replacing /proc/acpi/battery/ with  /sys/class/power_supply/ in the battery.lisp file (line 28).





If this works the module can be refactored to export another variable *battery-path*. Something like:

=====================================

(export '(*battery-path*))
(defvar *battery-path* nil)

(defun read-battery-file (battery fname)
  (let ((fields (make-hash-table :test #'equal)))
    (with-open-file (s (or *battery-path* (concatenate 'string "/proc/acpi/battery/" battery "/" fname)
                                 :if-does-not-exist nil)
 ....)))

=================================

And then users could do (setf *battery-path* "/sys/class/power_supply/BAT0") after loading the module.

That or just make the module check for /proc/acpi/ and then /sys/class/power_supply/ or wathever.

On 14 January 2015 at 00:41, Kete Foy <[hidden email]> wrote:
On 01/10/2015 03:51 PM, Lucas Pandolfo wrote:
Is it a notebook?

Yes


If it is, what does  'ls /proc/acpi/battery/ -l' return?

I don't have the battery directory in Parabola ("ArchLinux").

By the way, here is the shell command that I use to monitor the battery charge (requires the acpi package):
(setf stumpwm:*screen-mode-line-format*
      (list "%n |%w | %d | Battery"
      '(:eval (stumpwm:run-shell-command "acpi |cut -d ',' -f 2" t))))




_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Lucas Pandolfo
Upon further inspection, the /proc and /sys interfaces are different (both in path and format) :(

Well, it was fun while it lasted. In the end you'll have to stick to your own method or the battery-portable module.

On 14 January 2015 at 10:35, Lucas Pandolfo <[hidden email]> wrote:
Replacing the said line?

Then i suppose the battery files in /proc and /sys are different, so the battery module wont work. Also the proposed fix wont work.



On 14 January 2015 at 10:32, Kete Foy <[hidden email]> wrote:
had an error, and the modeline said no battery

The value "" is not of type HASH-TABLE.
Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10044CE433}>
0: (SB-IMPL::GETHASH3 "present" "" NIL) [tl,external]
1: (BATTERY::CURRENT-BATTERY-CHARGE)
2: (BATTERY::FMT-BAT-CHARGE #<unavailable argument>)
3: (FORMAT-EXPAND ((#\b BATTERY::FMT-BAT-CHARGE) (#\h STUMPWM::FMT-HEAD) (#\w STUMPWM::FMT-WINDOW-LIST) (#\W STUMPWM::FMT-HEAD-WINDOW-LIST) (#\g STUMPWM::FMT-GROUP-LIST) (#\n STUMPWM::FMT-GROUP) (#\u STUMPWM::FMT-URGENT-WINDOW-LIST) (#\v STUMPWM::FMT-HEAD-WINDOW-LIST-HIDDEN-WINDOWS) (#\d STUMPWM::FMT-MODELINE-TIME)) "%n |%w | %b | %d" #S(MODE-LINE :SCREEN #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40000A> :FORMAT *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Grp3 | [hidden email] | Wed Jan 14  8:24:47 | Battery 100%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0 40000C> :GC #<XLIB:GCONTEXT #2#:0 4194315> :DEFAULT-FG 8355711 :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE :STUMP))
4: ((:METHOD STUMPWM::MODE-LINE-FORMAT-ELT (LIST)) ("%n |%w | %b | %d")) [fast-method]
5: (STUMPWM::REDRAW-MODE-LINE #S(MODE-LINE :SCREEN #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40000A> :FORMAT *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Grp3 | [hidden email] | Wed Jan 14  8:24:47 | Battery 100%
" :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP #2#:0 40000C> :GC #<XLIB:GCONTEXT #2#:0 4194315> :DEFAULT-FG 8355711 :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE :STUMP) NIL)
6: (STUMPWM::UPDATE-MODE-LINES #S<screen #<XLIB:SCREEN :0.0 1280x800x24 TRUE-COLOR>>)
7: (STUMPWM::UPDATE-ALL-MODE-LINES)
8: (STUMPWM::RUN-EXPIRED-TIMERS)
9: (STUMPWM::STUMPWM-INTERNAL-LOOP)
10: (STUMPWM::STUMPWM-INTERNAL ":0")
11: (STUMPWM ":0")
12: ((LAMBDA NIL :IN "/home/kete/stumpwm/make-image.lisp"))
13: ((FLET #:WITHOUT-INTERRUPTS-BODY-89 :IN SB-EXT:SAVE-LISP-AND-DIE))
14: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))

On 01/14/2015 07:31 AM, Lucas Pandolfo wrote:
Oh, i see.

I suppose you have the directory /sys/class/power_supply/BAT0.
The battery module uses the /proc/acpi/battery/ path.

Try replacing /proc/acpi/battery/ with  /sys/class/power_supply/ in the battery.lisp file (line 28).





If this works the module can be refactored to export another variable *battery-path*. Something like:

=====================================

(export '(*battery-path*))
(defvar *battery-path* nil)

(defun read-battery-file (battery fname)
  (let ((fields (make-hash-table :test #'equal)))
    (with-open-file (s (or *battery-path* (concatenate 'string "/proc/acpi/battery/" battery "/" fname)
                                 :if-does-not-exist nil)
 ....)))

=================================

And then users could do (setf *battery-path* "/sys/class/power_supply/BAT0") after loading the module.

That or just make the module check for /proc/acpi/ and then /sys/class/power_supply/ or wathever.

On 14 January 2015 at 00:41, Kete Foy <[hidden email]> wrote:
On 01/10/2015 03:51 PM, Lucas Pandolfo wrote:
Is it a notebook?

Yes


If it is, what does  'ls /proc/acpi/battery/ -l' return?

I don't have the battery directory in Parabola ("ArchLinux").

By the way, here is the shell command that I use to monitor the battery charge (requires the acpi package):
(setf stumpwm:*screen-mode-line-format*
      (list "%n |%w | %d | Battery"
      '(:eval (stumpwm:run-shell-command "acpi |cut -d ',' -f 2" t))))





_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Modules (loading)

Kete Foy
On 01/14/2015 08:40 AM, Lucas Pandolfo wrote:
Well, it was fun while it lasted. In the end you'll have to stick to your own method or the battery-portable module.

Yes, I was just about to reply that the battery-portable module works "out of the box", but it is not as descriptive (or as accurate) as my "hack" :P It says ~ 113%. Thanks

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel