You are not logged in.

#1 2006-06-24 08:42:40

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

The wmii thread

To avoid floading the desktop thread, the discussion that was going here, let's continue it here smile

Just a reminder of some important links,
- Scripting the wmii-3 window manager with Ruby
- ruby-wmii: Ruby configuration/scripting for the wmii window manager
- My wmii-3 configs (always up-to-date)

Some screenshots from the desktop thread:
- _Gandalf_ :
[URL=http://Serv3.imagehigh.com/view.php?id=13890_22_06_2006.png&path=/imgs/04]13890_22_06_2006.th.png[/URL][URL=http://Serv3.imagehigh.com/view.php?id=4708_22_06_2006_2.png&path=/imgs/04]4708_22_06_2006_2.th.png[/URL]
[URL=http://Serv1.imagehigh.com/view.php?id=13275_1.png&path=/imgs//ih000001]13275_1.th.png[/URL][URL=http://Serv1.imagehigh.com/view.php?id=15919_mess.png&path=/imgs//ih000001]15919_mess.th.png[/URL]

- codemac :
screen2006.06.22_00.54t.png

- AllTom :
2006-06-thumb.png

Offline

#2 2006-06-24 10:03:52

Borosai
Member
From: Sandy Appendix, U.S.A.
Registered: 2006-06-15
Posts: 227

Re: The wmii thread

Although I don't feel that wmii works all that well for me at this point, I can't help being interested. It seems useful in certain cases...who knows, maybe I will give it a try. I was just wondering how wmii handles a dual-head setup (spec. TwinView). Does it "see" the monitor edges, or does it treat it as one huge desktop and place columns in the center of the monitors?

Offline

#3 2006-06-24 10:10:03

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: The wmii thread

I'm not sure about dual-head, I use Xinerema (my card does not support TwinView) I haven't tried it yet but if u want i can see how it does handle it...

Offline

#4 2006-06-24 10:13:31

ingvildr
Member
From: Brighton, England
Registered: 2005-04-19
Posts: 203

Re: The wmii thread

_Gandalf_ wrote:

I'm not sure about dual-head, I use Xinerema (my card does not support TwinView) I haven't tried it yet but if u want i can see how it does handle it...

wmii doesn't support xinerema you would have to start two instances of wmiiwm on the two screens i think.

Offline

#5 2006-06-24 13:46:32

sf.
Member
Registered: 2006-04-29
Posts: 23

Re: The wmii thread

So, as I incorrectly asked in the desktop thread; is it possible to get a "taskbar" in wmii?
I don't imagine it would be too difficult, if I knew anything about Ruby.

If......

Offline

#6 2006-06-24 15:25:21

AllTom
Member
Registered: 2006-01-02
Posts: 60
Website

Re: The wmii thread

You missed my screenshot. :?

sf.: I don't know about you, but between tags and the bars I already have, a task bar wouldn't fit that well. I imagine that if you capture all of the CreateClient events, you could generate the task bar, but I don't see any events that you could capture to remove the closed windows.

Offline

#7 2006-06-24 16:17:00

sf.
Member
Registered: 2006-04-29
Posts: 23

Re: The wmii thread

It would probably work better as a menu. Just something to see/switch to what I have open in the current view when everything is maximized

Offline

#8 2006-06-24 17:14:39

nogoma
Member
From: Cranston, RI
Registered: 2006-03-01
Posts: 217

Re: The wmii thread

A couple of small snippets/edits:

First, I modified the MPD stuff so I can change which host I'm monitoring (sometimes, I'm listening on my laptop, and sometimes I'm controlling my Media PC from my laptop). You can use MODKEY-Ctrl-m to change hosts. Note: This doesn't have all the play/pause/skip functionality; I really just want it so I can glance and see what's playing. Also, I use some tricky hackery to record when I'm changing servers; if you guys know a cleaner way to do that, let me know.

  setup_bar("01_mpd", normcolors) do |bar|
      bar.data = "Connecting: #{`hostname`.chomp}"
      serv_name = bar.data.split[1]
      mpd_serv = MPD.new(serv_name)
      mpd_update = lambda do
          if bar.data =~ /^Connecting/
              serv_name = bar.data.split[1]
              mpd_serv = MPD.new(serv_name)
          end
          text = "#{serv_name}: "
          begin
            case mpd_serv.status["state"]
            when "play"
                text << ">>: "
            when "pause"
                text << "||: "
            else
                text << "[]: "
            end
            text << mpd_serv.strf("%a - %t (%e/%l)")
          rescue
              text << "MPD not running"
          end
          bar.data = text
      end
      Thread.new do
          loop do
              begin
                mpd_update.call
              rescue
                bar.data = "Error!"
              end
              sleep 3
          end
      end
      on_key("MODKEY-Control-m") { wmiimenu("hostname:") { |server| bar.data = "Connecting: #{server}" } }
  end

Here's another relatively brain-dead one for use on my laptop, that just shows the current CPU speed:

# {{{ CPU info
  setup_bar("80_cpuinfo", normcolors, "CPUINFO --- init") do |bar|
      Thread.new do
          loop do
              cpuinfo = `cat /proc/cpuinfo`.split("n")[6].split[-1].sub(/..*$/,'')
              bar.data = cpuinfo.chomp + " Mhz"
              sleep 5
          end
      end
  end

-nogoma
---
Code Happy, Code Ruby!
http://www.last.fm/user/nogoma/

Offline

#9 2006-06-24 17:45:07

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: The wmii thread

@AllTom: screenshot added but your site ain't working, please fix... big_smile

@nogoma: Thanks for the CPU info Applet big_smile

Offline

#10 2006-06-25 01:30:17

nogoma
Member
From: Cranston, RI
Registered: 2006-03-01
Posts: 217

Re: The wmii thread

Modularization, FTW! Personally, I don't like having my config as a giant file w/ color settings and code snippets, so I refactored my wmiirc to allow me to place snippets (like the MPD controller) in a subdirectory (~/.wmii-3/snippets), and have them loaded via an array. This also makes rearranging them in the bar simpler (instead of having to modify the numbers, the order they appear in the array determines the order in the bar.) On to the code:

First, I added a simple global var to hold the location of the snippets; this code goes near the beginning of my wmiirc:

WMIIRC_VERSION = "0.2.1"
WMIIRC_HOME = ENV["HOME"] + "/.wmii-3/"
SNIPPET_DIR = WMIIRC_HOME + "snippets"

Next, I added a small chunk of code to load each listed snippet:

# Loads mpd.rb, then cpuinfo.rb, etc. This array
# determines the order of the snippets in the bar.
  %w{mpd cpuinfo mode volume status}.each_with_index do |snippet, index|
      setup_bar("#{"%02d" % (index+1)}_#{snippet}") do |bar|
          eval(IO.read("#{SNIPPET_DIR}/#{snippet}.rb"), binding)
      end
  end

Finally, into my ~/.wmii-3/snippets dir I put all the applets; each of which is basically the lines that would appear between the do/end of setup_bar block; for example, for the MPD applet I posted earlier, I copy the following code into ~/.wmii-3/snippets/mpd.rb:

bar.data = "Connecting: #{`hostname`.chomp}"
serv_name = bar.data.split[1]
mpd_serv = MPD.new(serv_name)
mpd_update = lambda do
    if bar.data =~ /^Connecting/
        serv_name = bar.data.split[1]
        mpd_serv = MPD.new(serv_name)
    end
    text = "#{serv_name}: "
    begin
        case mpd_serv.status["state"]
        when "play"
            text << ">>: "
        when "pause"
            text << "||: "
        else
            text << "[]: "
        end
        text << mpd_serv.strf("%a - %t (%e/%l)")
    rescue
        text << "MPD_BAR not running"
    end
    bar.data = text
end
Thread.new do
    loop do
        begin
            mpd_update.call
        rescue
            bar.data = "Error!"
        end
        sleep 3
    end
end
on_key("MODKEY-Control-m") { wmiimenu("hostname:") { |server| bar.data = "Connecting: #{server}" } }

Of course, the code for each snippet should now be commented out/removed from the wmiirc itself.


-nogoma
---
Code Happy, Code Ruby!
http://www.last.fm/user/nogoma/

Offline

#11 2006-06-25 01:35:12

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: The wmii thread

Nice job nogoma, mfp (the ruby script author) is doing the same idea AFAIK from the last mail but I send him another maybe save him time or maybe another idea smile

Thx

Offline

#12 2006-06-25 01:40:03

nogoma
Member
From: Cranston, RI
Registered: 2006-03-01
Posts: 217

Re: The wmii thread

Man, Mauricio is modularizing wmiirc? I'm sure his results will be much better, his Ruby-foo is much stronger than mine  wink. Oh well, I'll stick to this until the next release, I guess. This solution is pretty hack-y; for example, if you modify the array of snippets to load, it doesn't do a good job of removing the old ones. Also, it probably doesn't fail gracefully if you type, for example "mpf" instead of "mpd", and it can't find mpf.rb.


-nogoma
---
Code Happy, Code Ruby!
http://www.last.fm/user/nogoma/

Offline

#13 2006-06-25 01:43:35

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: The wmii thread

Yeah of course he is smile, I also wait till next release, Oh BTW
to all ruby-wmii ver 0.2.1 users please apply this patch -> http://pastebin.ca/70973

If you haven't noticed your .wmii-3/wmiirc.log is a huge file (maybe not, the bug wasn't reported by everyone)...
more information -> http://eigenclass.org/hiki.rb?ruby-wmii+0.2.1

P.S: did I ever mention that I HATE phpbb more than anything in this life ?? if not -> big_smile

Offline

#14 2006-06-25 01:53:34

nogoma
Member
From: Cranston, RI
Registered: 2006-03-01
Posts: 217

Re: The wmii thread

Nice; I probably should have commented when I noticed my logfile was 2.1G (seriously  :shock: !)


-nogoma
---
Code Happy, Code Ruby!
http://www.last.fm/user/nogoma/

Offline

#15 2006-06-25 01:55:01

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: The wmii thread

nogoma wrote:

This solution is pretty hack-y; for example, if you modify the array of snippets to load, it doesn't do a good job of removing the old ones. Also, it probably doesn't fail gracefully if you type, for example "mpf" instead of "mpd", and it can't find mpf.rb.

My idea wasn't about creating a static array, I mean this is Ruby, lovely code can be done.

Anyway My idea was to have ~/.wmii-3/plugins and ~/.wmii-3/bars, then in ~/.wmii-3/wmiirc, have something like
Dir[ENV["HOME"] + '.wmii-3/plugins/*.rb'].each do |plugin|
# Do stuff...
end

Got the idea smile

Offline

#16 2006-06-25 02:07:09

nogoma
Member
From: Cranston, RI
Registered: 2006-03-01
Posts: 217

Re: The wmii thread

Yeah, good point. The only reason I didn't do that is that sometimes I'll have some extra code (e.g. the dictionary snippet) that I don't want to include, but I'm (apparently) too lazy to move/disable the code; having an explicit array of snippets to include seemed easier at the time. Also, the array solution made re-ordering on the bar a little easier. Of course, this latter concern could be dealt with by naming the files, e.g. 01_mpd.rb, 02_cpuinfo.rb, etc (which kind of makes more sense, as this is how "wmiir read /bar" will report them). So, yeah, there is certainly a better (or at least different) way to do this. This is a question I should probably direct at mfp, but do you know how far along his efforts are? I'm sort of interested in pulling out the appropriate code into a separate module, as has been suggested in the eignenclass comments, but I don't really want to duplicate work. It'd certainly make my silly modularization hack easier, as I wouldn't have to rely on stuff like "eval(IO.read(file),binding)", etc. Making a little WMII::Snippet class probably makes more sense. Anyway, I should probably stop hijacking this thread from being a wmiirc discussion into a ruby library dev thread wink .


-nogoma
---
Code Happy, Code Ruby!
http://www.last.fm/user/nogoma/

Offline

#17 2006-06-25 02:56:44

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: The wmii thread

hehe smile
no i don't know his progress yet, but we'll just wait to see his latest code smile

Offline

#18 2006-06-25 05:04:32

twiistedkaos
Member
Registered: 2006-05-20
Posts: 666

Re: The wmii thread

Hmm, wmii doesn't seem all that great to me. I looked at the screenshots it it seems far to simple based to me. Nothing wrong with that, but I like my captions to have a littl more detail than completely flat. I think I'll stick to OB3 until I research this wm more smile.

Offline

#19 2006-06-25 05:54:34

AllTom
Member
Registered: 2006-01-02
Posts: 60
Website

Re: The wmii thread

Hey, I'd modularized my version of 0.2.1 in pretty much the same way, so it should be interesting to see how the original author does it. tongue

With the release as downloaded from the wiki, I've had lots of problems with terminals resizing improperly. When I have only one tag and more than one terminal open, if I close any of them or restart the window manager, they fly all over the place until I change the mode of each of the columns. I don't get that with the shell script provided with wmii... I'm still trying to track that one down. It happens with urxvt and xterm.

I haven't had problems with my site today, but I was joking about the screenshot. lol

Offline

#20 2006-06-25 06:13:41

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: The wmii thread

I have the same issue with urxvt flying around when I close/open something, Plus a lot of times when i close something WMII just close...

Offline

#21 2006-06-25 15:09:53

SleepyDog
Member
Registered: 2004-10-15
Posts: 114

Re: The wmii thread

_Gandalf_ wrote:

I have the same issue with urxvt flying around when I close/open something, Plus a lot of times when i close something WMII just close...

In the default wmiirc, programs are run with wmiisetsid(There's a setsid binary in linux that does the same thing). If you don't do this, programs that don't set a separate session id from wmii will take the wm down  when they close.

Offline

#22 2006-06-25 16:12:06

Loke
Member
From: Denmark
Registered: 2005-10-21
Posts: 139

Re: The wmii thread

Little question to wmii:
How about virtual desktops? Somehow managed to assign them "Terminals" which is in the bar in the bottom of screen, and "1". I am using Gandalf's config, but virtual desktops means a lot to me smile Tried some researching without any luck.

Offline

#23 2006-06-25 16:18:45

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: The wmii thread

Thx SleepyDog we need eventually a run program function instead of system"..." to take care of it...

Loke wmii-3 does not have virtual desktops, but Tags, You can tag a windows via Alt+Shit+t and choose the Tag (or type the new one) Tags can be a number or a name...

Offline

#24 2006-06-25 16:24:43

Loke
Member
From: Denmark
Registered: 2005-10-21
Posts: 139

Re: The wmii thread

Great, just what I was looking for, thanks smile
Just one last question, keyboard shortcut to close a window? Wasn't able to find it anywhere

Offline

#25 2006-06-25 16:44:24

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: The wmii thread

Close window = Alt + Shift + c

I added a function called run_cmd which basicly run the command but vie wmiisetsid, For those using my config can you please re-download the file and tell me if there's any problems with it now???
Thx.

Offline

Board footer

Powered by FluxBB