Xonotic Forums
Could someone reccomend me a tiling WM - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Community (https://forums.xonotic.org/forumdisplay.php?fid=6)
+--- Forum: Off Topic (https://forums.xonotic.org/forumdisplay.php?fid=15)
+--- Thread: Could someone reccomend me a tiling WM (/showthread.php?tid=3591)

Pages: 1 2


RE: Could someone reccomend me a tiling WM - machine! - 10-21-2012

Sorry. Tongue


RE: Could someone reccomend me a tiling WM - Mr. Bougo - 10-21-2012

(10-20-2012, 06:10 PM)machine! Wrote: I bet both OS X and Win32 have tiling window-managers too though.

OS X can run some *NIX WMs with X11. I've seen guides for DWM.

Win32 has no third-party window manager that I know, but it does have AutoHotKey which has been used to implement a dwm-like system for managing your windows: bug.n


RE: Could someone reccomend me a tiling WM - machine! - 10-21-2012

Some I found...

http://www.brain-dump.org/projects/dwm-win32/

http://www.tylerwm.com/


RE: Could someone reccomend me a tiling WM - anark10n - 10-24-2012

What would be a good way to start using a WM coming from a DE, currently using XFCE on Arch (switched distros recently, loving it Cool )?


RE: Could someone reccomend me a tiling WM - machine! - 10-24-2012

Well, depends on what you looking for...

Why do you want to switch using another WM from the one included in XFCE?


RE: Could someone reccomend me a tiling WM - Mr. Bougo - 10-24-2012

Yep, what machine said. Why do you want to move away, and do you expect to love the interface even more with just a WM?


RE: Could someone reccomend me a tiling WM - anark10n - 10-24-2012

i'm looking into dwm actually, it looks like it meets some of my requirements, and i'm pretty handy with C\C++. just looking to cut down on desktop clutter and fewer reasons to touch my mouse.


RE: Could someone reccomend me a tiling WM - Mr. Bougo - 10-24-2012

EDIT: As always, there's an arch wiki page for that: https://wiki.archlinux.org/index.php/Dwm


Well, on Arch the basics are pretty straightforward, you just change your .xinitrc if you're using startx or look for info on how to configure your desktop manager if you're using one.

As for actually compiling dwm, that's straightforward too. Just get its source, configure config.mk to install it somewhere in your home (I put it in ~/usr/bin/ and the manpage in ~/usr/share/man) configure config.h to your liking, make, make install. Then do the same with dmenu (or install it from the arch repos if you don't need to configure that).

Then you need to set up something that sets the status bar text if you want something down there. This is done using xsetroot -name "$message".

The way I do it (but it's very hackish) is to launch dwm from my .xinitrc by sourcing this script with DWM's path as argument.
Code:
#!/bin/bash

dwmmsg () {
    read msg
    xsetroot -name "$msg"
}

wmpath=$1
shift

msgfile=$HOME/var/run/dwm/message
statusline=$HOME/bin/dwmstatus
defmsg=''

while true; do
    if [[ -r "$msgfile" ]]; then
        dwmmsg < "$msgfile"
    elif [[ -r "$statusline" ]]; then
        { source "$statusline"; } | dwmmsg
    else
        echo "$defmsg" | dwmmsg
    fi

    sleep 1
done &

while true; do
    "$wmpath"
    [[ -e "$HOME/var/run/dwm/loop" ]] || break
done

exit

Note that this uses bash, which is not very portable...

It sources $HOME/bin/statusline to generate my status line every second. Whatever is in $HOME/var/run/dwm/message overrides the status line, and whatever is in $defmsg is the default if the two others somehow don't work. I don't really use that.

It also runs the WM in a loop if the $HOME/var/run/dwm/loop exists, which is handy when I recompile DWM and don't want to kill X when I quit it.

Here's a smaller (untested) version for you, you could simply copypaste that into your .xinitrc (if that's what you use) and configure the three variables at the top.
Code:
#!/bin/sh
dwm=$HOME/usr/bin/dwm
statusline=$HOME/bin/dwmstatus
loopfile=$HOME/var/run/dwm/loop

dwmmsg () {
    read msg
    xsetroot -name "$msg"
}

while true; do
    if [ -r "$statusline" ]; then
        { source "$statusline"; } | dwmmsg
    else
        echo "$statusline not found" | dwmmsg
    fi

    sleep 1
done &

while true; do
    "$dwm"
    [ -e "$loopfile" ] || break
done

exit
and the dwmstatus script I use:
Code:
echo -n \
'Volume: '\
    $(amixer sget Master | sed -nr "s/.*\[([-.0-9]*dB)\].*/\1/p" | { amixer sget Master | grep '\[off\]' > /dev/null && sed 's/.*/(&)/' || cat; })\
' | '\
$(date +"%a %b %d %T")


Note that there's something better to set the root window's name (i.e. the status bar contents) that's made in C, so that's less overhead. See: http://dwm.suckless.org/dwmstatus/


RE: Could someone reccomend me a tiling WM - machine! - 10-24-2012

Cool MrBougo! I hope you don't mind if I use that too, currently my dwm only shows time and date.


RE: Could someone reccomend me a tiling WM - Mr. Bougo - 10-24-2012

Sure, the scripts in my previous post in this thread are licensed under WTFPL.

I'll try to explain the volume bit though:
$(amixer sget Master | sed -nr "s/.*\[([-.0-9]*dB)\].*/\1/p" | { amixer sget Master | grep '\[off\]' > /dev/null && sed 's/.*/(&)/' || cat; })

amixer sget Master gives me this:
Quote:Simple mixer control 'Master',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 64
Mono: Playback 42 [66%] [-22.00dB] [on]

I filter that using sed, whose -n flag disable the default action of printing every line that goes through it, and the -r flag means to use extended regex.
Then I have it filter the bit that's made of dashes, commas and digits followed by "dB", so that's the last line in my case. Then I pipe it through something strange-looking: if grep finds '[off]' in amixer sget Master, then sed is run, takes the standard input from the pipe and adds parentheses around it, outputting that. Otherwise it's just cat, so the standard input is copied to the output. So if Master is off (i.e. sound is muted), the volume is put in parentheses.

I wrote this a while ago and now I think it's awful. I don't like how it's running amixer twice and I also don't like that it's taking a handful of characters out of the four lines of output. There's got to be a more efficient way.

EDIT: Also, I should use grep -Fq '[off]' instead of grep with an escaped regex and a redirect to /dev/null. In fact I'm changing this now:
Code:
$(amixer sget Master | sed -nr "s/.*\[([-.0-9]*dB)\].*/\1/p" | { amixer sget Master | grep -qF '[off]' && sed 's/.*/(&)/' || cat; })



RE: Could someone reccomend me a tiling WM - machine! - 10-24-2012

=o I admire your great use of of those UNIX commands. I have to learn sed and grep!


RE: Could someone reccomend me a tiling WM - aa - 10-24-2012

I know my question is stupid, but what is "tiling WM"?


RE: Could someone reccomend me a tiling WM - rocknroll237 - 10-24-2012

I'll do what Maddin did to me:

http://lmgtfy.com/?q=tiling+wm

Tongue


RE: Could someone reccomend me a tiling WM - aa - 10-24-2012

rocknroll237, that's simply cruel!


RE: Could someone reccomend me a tiling WM - anark10n - 10-24-2012

@aa previous page has a tl;dr explanation from machine! and one more comprehensive from MrBougo if you're not up to the dry stuff on wikipedia
@MrBougo thanks for the kickstart with that script, it's close to what i am after. I won't lie though, while i'm comfortable with C, i can never seem to get the hang of bash scripting, guess this is one reason to. now to find that thread to showing off desktops ...