You are not logged in.
Hi, I have two monitor now (separate X screen) and I want to have 4 tags on monitor 0 and only 1 tag on monitor 1. How to set it? I was testing xinerama-init brach but it wasn't what I want. Is it even possible?
Offline
Hello,
First off, monsterwm does not have tags. It has desktops/workspaces.
xinerama-init allows you to set the initial properties for your desktops on all monitors.
You cannot differenciate the number of desktops per monitor.
What you can do though, is ignore the desktops you're not going to be using.
If you're using a panel/statusbar you can also ignore those desktops and not even have them show up on the panel.
.:[ git me! ] :.
Offline
c00kiemon5ter, thanks for explain. My first idea about workarounds the problem was however good. Thanks one more time for help.
Offline
hey C00kie,
when trying to build your mstatusbar I get this error:
[andreas@andreas-pc mstatusbar]$ make
creating config.h from config.def.h
CC mstatusbar.c
In file included from /usr/include/alsa/asoundlib.h:49:0,
from mstatusbar.c:12:
/usr/include/alsa/pcm.h:944:1: Fehler: unbekannter Typname: »u_int8_t«
/usr/include/alsa/pcm.h:945:1: Fehler: unbekannter Typname: »u_int16_t«
/usr/include/alsa/pcm.h:946:1: Fehler: unbekannter Typname: »u_int32_t«
/usr/include/alsa/pcm.h:947:1: Fehler: unbekannter Typname: »u_int64_t«
make: *** [mstatusbar.o] Fehler 1
Offline
New install. New system. Still arch. Bar? Nope, does not compute. I cant get the F-ing bar to show up.
My barcode:
#!/usr/bin/env bash
wm=monsterwm
ff="/tmp/$RANDOM.monsterwm.fifo"
tags=('null' 'irc' 'foo' 'pr0n')
layouts=('T' 'M' 'B' 'G' 'F')
[[ -p $ff ]] || mkfifo -m 600 "$ff"
function statusbar {
# Date
date=$(date +"%a %d/%m %R")
#cpu=$(sh /home/paul/bin/cpu.sh)
cpu=$(awk 'BEGIN{i=0}
{sum[i]=$2+$3+$4+$5; idle[i++]=$5}
END {printf "%d\n", 100*( (sum[1]-sum[0]) - (idle[1]-idle[0]) ) / (sum[1]-sum[0])}
' <( head -n 1 /proc/stat; sleep 0.5; head -n 1 /proc/stat))
# Battery
#bat=$(sh /home/paul/bin/battery.sh)
bat=$(acpi -b|awk 'sub(/,/,"") {print $3, $5}')
# Volume
vol=$(amixer get PCM | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')
# Music status
#music="$(mpc current -f "%artist% - %title%")"
#if [ -z "$music" ]; then music="stopped" mstat="\ue0ae"
#else
#mstat="$(mpc | sed -rn '2s/\[([[:alpha:]]+)].*/\1/p')"
#[ "$mstat" == "paused" ] && mstat="\ue059" || mstat="\ue0aa"
#fi
echo "\r \f4\▒\fr $cpu% \f4\\\fr $bat \f4\\fr \f4\\fr $date "
}
while read -t 1 -r wmout || true; do
if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
read -ra desktops <<< "$wmout"
tmp=
for desktop in "${desktops[@]}"; do
IFS=':' read -r d w m c u <<< "$desktop"
# Tags labels
label=${tags[$d]}
# Current desktop color and enclosing char (yes/no)
((c)) && fg="9" bg="2" lc="\u4 " rc=" \ur" && layout=${layouts[$m]} || fg="1" bg="0" lc=" " rc=" "
# Has windows ?
((w)) && ((! c)) && fg="6" lc="\u6 " rc=" \ur"
# Urgent windows ?
((u)) && fg="9" bg="3" lc="\u4 " rc=" \ur"
tmp+="\f$fg\b$bg$lc$label$rc\fr\br"
done
# Merge the clients indications and the tile mode
tmp+=" $layout"
fi
echo "$tmp $(statusbar)"
done < "$ff" | bar &
#while :; do "$wm" || break; done | tee -a "$ff"
$wm > "$ff"
rm $ff
I cant get it to show.
other conf's.
.xinitrc
setxkbmap se &
/home/gholen/monster1.sh &
monsterwm
bar's config.h
/* The height of the bar (in pixels) */
#define BAR_HEIGHT 18
/* The width of the bar. Set to -1 to fit screen */
#define BAR_WIDTH -1
/* Offset from the left. Set to 0 to have no effect */
#define BAR_OFFSET 0
/* Choose between an underline or an overline */
#define BAR_UNDERLINE 1
/* The thickness of the underline (in pixels). Set to 0 to disable. */
#define BAR_UNDERLINE_HEIGHT 2
/* Default bar position, overwritten by '-b' switch */
#define BAR_BOTTOM 0
/* The fonts used for the bar, comma separated. Only the first 2 will be used. */
#define BAR_FONT "-Misc-Stlarch-Medium-R-Normal--10-100-75-75-C-80-ISO10646-1","-*-termsyn-medium-r-*-*-14-*-*-*-*-*-*-*"
#define BAR_FONT_FALLBACK_WIDTH 6
/* Color palette */
#define COLOR0 0x151515 /* Background */
#define COLOR1 0xddeedd /* Foreground */
#define COLOR2 0x282830 /* Black'n'Gray */
#define COLOR3 0xcc0f16 /* Red */
#define COLOR4 0x92b03e /* Green */
#define COLOR5 0xdc7802 /* Orange */
#define COLOR6 0x007799 /* Blue */
#define COLOR7 0x7d1b66 /* Magenta */
#define COLOR8 0x426870 /* Cyan */
#define COLOR9 0xeeeeee /* White */
All i get is a whole lot of nothing. What am I doing wrong?
Offline
@andmars
Who are the genius people behind alsa ?
Why would anyone be using such custom types ?
I just pushed a fix for that.
Last edited by c00kiemon5ter (2013-02-18 09:32:38)
.:[ git me! ] :.
Offline
@gholen
first things first, make sure 'bar' is on your PATH
what does 'which bar' return ?
make sure the script is executable
'chmod +x monster1.sh'
and finally your .xinitrc should be
setxkbmap se &
exec /home/gholen/monster1.sh
as the script invokes the wm already (last line)
.:[ git me! ] :.
Offline
Yes, script is executabale
@gholen
first things first, make sure 'bar' is on your PATH
what does 'which bar' return ?make sure the script is executable
'chmod +x monster1.sh'and finally your .xinitrc should be
setxkbmap se & exec /home/gholen/monster1.sh
as the script invokes the wm already (last line)
bar is in /usr/bin/bar.
As i did
setxkbmap se &
exec /home/gholen/monster1.sh
monster starts, but no bar, and upon commands inside (start a terminal) it craches. Really dont know whats wrong here.
Last edited by gholen (2013-02-18 10:04:44)
Offline
Trying your script here, along with monsterwm (master branch) works just fine.
So.. is monsterwm in your PATH ? what does 'which monsterwm' say ?
If you skip the script and do
setxkbmap se &
exec monsterwm
does that work ?
if you try
$ echo "\cfoo \rbar -- $(date)" | bar -p
does that bring up 'bar' ?
edit
It seems that if I hide bar from PATH, then I can reproduce the described behavior.
ie I get a blank screen and if I try anything it crashes.
What is the error message startx returns ?
Here it will say things like:
[....]
Initializing built-in extension XFree86-DRI
Initializing built-in extension DRI2
Loading extension GLX
resize called 1280 1024
setversion 1.4 failed
resize called 3200 1080
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning: Symbol map for key <KPDL> redefined
> Using last definition for conflicting fields
Errors from xkbcomp are not fatal to the X server
/tmp/monster1.sh: line 57: br: command not found <----- (intentionally -- supposed to be bar)
xinit: connection to X server lost
waiting for X server to shut down xterm: fatal IO error 11 (Resource temporarily unavailable) or KillClient on X server ":1"
Server terminated successfully (0). Closing log file.
Last edited by c00kiemon5ter (2013-02-18 11:06:44)
.:[ git me! ] :.
Offline
Updated $PATH. And behold, a Monsterwm
Thanks a lot. (and I should really really not mess with good installs thinking they could be better).
Offline
Hey, any idea if it's possible to use this script with dual monitor setup without showing other monitor's desktops because it messes things up. What I need to do and/or want is that it only shows one monitor's desktops I can achieve this with Cloudef's C panel but I'm more interested in bash method.
#!/usr/bin/env sh
# expects a line from monsterwm's output as argument ("$1")
# prints formatted output to be used as input for bar
# reference: bar by LemonBoy -- https://github.com/LemonBoy/bar
# desktop status
for desk; do
d="${desk%%:*}" desk="${desk#*:}" # desktop id
w="${desk%%:*}" desk="${desk#*:}" # window count
l="${desk%%:*}" desk="${desk#*:}" # layout mode
c="${desk%%:*}" desk="${desk#*:}" # is current desktop
u="$desk" # has urgent hint
# desktop id
case "$d" in
0) d=" term" ;; 1) d=" web" ;;
2) d=" img" ;;
esac
# current desktop
if [ $c -ne 0 ]
then bg="\b7" un="\u6" fg="\f9"
case "$l" in
0) s="" ;; 1) s="" ;; 2) s="" ;;
3) s="" ;; 4) s="" ;;
esac && s="\b8\u8 $s \br\ur"
fi
# has urgent hint or no windows
[ $u -ne 0 ] && un="\u2"
[ $w -eq 0 ] && w="-"
in="$in$bg$fg$un $d \f8[$w] \ur\br\fr"
unset bg fg un
done
# music status
music="$(mpc current -f "%artist% - [%title%|%file%]")"
if [ -z "$music" ]; then music="nothing to see here" mstat=""
else
mstat="$(mpc | sed -rn '2s/\[([[:alpha:]]+)].*/\1/p')"
[ "$mstat" == "paused" ] && mstat="" || mstat=""
fi
# volume status
if [ "$(amixer get Master | sed -nr '$ s:.*\[(.+)]$:\1:p')" == "off" ]
then vol="[m]" vstat=""
else
vol="$(amixer get PCM | sed -nr '$ s:.*\[(.+%)].*:\1:p')"
if [ "${vol%\%}" -le 10 ]; then vstat=""
elif [ "${vol%\%}" -le 20 ]; then vstat=""; else vstat=""; fi
fi
# date and time
date="$(date +"%R")" dstat=""
# symbols
arrow=""
printf '%s %s %s' "$in" "$arrow " "$s" "\r"
printf ' \\b7\\u6\\f1 %s \\br\\ur\\fr %s' "$mstat" "$music" "$vstat" "$vol" "$dstat" "$date "
printf '\n'
Offline
The script is sh, so I guess you want the sh method.
By "only show one monitor's desktops" I assume you want the /active/ monitor's desktops, right ?
(or only one of the monitor's desktops ? if yes, which monitor's ?)
..edit comming soon..
.:[ git me! ] :.
Offline
I want panel only to show up in my main monitor and it shows my main monitor desktops. I don't want to see left monitor desktops at all because I just spawn couple of terminals there. Thanks for the fast reply
EDIT1. I always mix sh and bash
Here's a screenshot what I mean
Last edited by Shinryuu (2013-02-22 14:24:31)
Offline
Alright, I guess all you need then is to skip the first monitor (monitor with id '0')
or in other words, only process info for monitor with id '1' (or the otherway around)
and otherwise keep things as they are, so:
# desktop status
for desk; do
m="${desk%%:*}" desk="${desk#*:}" # monitor id # <-- added
[ "$m" -ne 1 ] && continue # <-- added
n="${desk%%:*}" desk="${desk#*:}" # is current monitor # <-- added
d="${desk%%:*}" desk="${desk#*:}" # desktop id
w="${desk%%:*}" desk="${desk#*:}" # window count
l="${desk%%:*}" desk="${desk#*:}" # layout mode
c="${desk%%:*}" desk="${desk#*:}" # is current desktop
u="$desk" # has urgent hint
# desktop id
case "$d" in
0) d=" term" ;; 1) d=" web" ;;
2) d=" img" ;;
esac
# current desktop
if [ $c -ne 0 ]
then bg="\b7" un="\u6" fg="\f9"
case "$l" in
0) s="" ;; 1) s="" ;; 2) s="" ;;
3) s="" ;; 4) s="" ;;
esac && s="\b8\u8 $s \br\ur"
fi
# has urgent hint or no windows
[ $u -ne 0 ] && un="\u2"
[ $w -eq 0 ] && w="-"
in="$in$bg$fg$un $d \f8[$w] \ur\br\fr"
unset bg fg un
done
# music status
music="$(mpc current -f "%artist% - [%title%|%file%]")"
if [ -z "$music" ]; then music="nothing to see here" mstat=""
else
mstat="$(mpc | sed -rn '2s/\[([[:alpha:]]+)].*/\1/p')"
[ "$mstat" == "paused" ] && mstat="" || mstat=""
fi
# volume status
if [ "$(amixer get Master | sed -nr '$ s:.*\[(.+)]$:\1:p')" == "off" ]
then vol="[m]" vstat=""
else
vol="$(amixer get PCM | sed -nr '$ s:.*\[(.+%)].*:\1:p')"
if [ "${vol%\%}" -le 10 ]; then vstat=""
elif [ "${vol%\%}" -le 20 ]; then vstat=""; else vstat=""; fi
fi
# date and time
date="$(date +"%R")" dstat=""
# symbols
arrow=""
printf '%s %s %s' "$in" "$arrow " "$s" "\r"
printf ' \\b7\\u6\\f1 %s \\br\\ur\\fr %s' "$mstat" "$music" "$vstat" "$vol" "$dstat" "$date "
printf '\n'
Last edited by c00kiemon5ter (2013-02-22 14:56:23)
.:[ git me! ] :.
Offline
Once again, thanks a ton. It works just as it should also I love the way how I can modify things etc. on the fly. Heh, guess I need to learn more about simple coding. Guess I'll send you 1000kg worth of cookies as soon as possible!
Last edited by Shinryuu (2013-02-22 15:02:28)
Offline
Shinryuu, what did you do not to show bar on left monitor? I'm playing with c00kiemon5ter's script and wmrun from your DotShare, but bar stretches across both monitors
and if I compile it with fixed width, there is still empty space on top of the second monitor.
c00kiemon5ter, would it be difficult to show bar only on main monitor (just like Shinryuu wants), but display desktop information from currently focused monitor and show
focus indicator (eg. 1 or 0).
And is sh status script suposed to be faster/leaner/whatever than bash?
EDIT:
Any hints on integrating statusbar function from my old single monitor startup script?
#!/usr/bin/env bash
ff="/tmp/$RANDOM.monsterwm.fifo"
tags=('one' 'two' 'three' 'four' 'five')
layouts=('' '' '' '' '')
[[ -p $ff ]] || mkfifo -m 600 "$ff"
function statusbar {
wireless_check=$(awk '/ESSID:off/ {print $4 }' <(iwconfig wlan0))
if [ -n "$wireless_check" ]; then
wireless=$(echo "not connected")
else
wireless=$(awk '/ESSID/ {print $4 }' <(iwconfig wlan0) | cut -d '"' -f 2)
fi
ram=$(free -m | awk '/buffers\/cache/ {print $3 MB}')
temp=$(sensors | grep -A 1 'temp1' | cut -c16-17 | sed '/^$/d')
load=$(cut -d " " -f1-3 /proc/loadavg)
bat=$(acpi | awk 'sub(/,/,"") {print $3" "$4}' | sed -r 's/,//')
date=$(date +"%a %d")
time=$(date +"%H:%M")
[ -f "/tmp/.info" ] && extra="$load - $temp° - $ram - $wireless - $bat"
echo "\f9\c$extra \f2\r$date - \f9$time "
unset extra
}
while read -t 1 -r wmout || true; do
if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
read -ra desktops <<< "$wmout"
tmp=
for desktop in "${desktops[@]}"; do
IFS=':' read -r d w m c u <<< "$desktop"
# Tags labels
label=${tags[$d]}
# Current desktop color and enclosing char (yes/no) 9
((c)) && fg="9" bg="7" lc="\u9 " rc=" \ur" && layout="\f2"${layouts[$m]} || fg="2" bg="0" lc=" " rc=" "
# Has windows ? 2
((w)) && ((! c)) && fg="2" lc="\u2 " rc=" \ur"
# Urgent windows ?
((u)) && fg="9" bg="0" lc="\u3 " rc=" \ur"
tmp+="\f$fg\b$bg$lc$label$rc\fr\br"
done
tmp+=" $layout"
fi
echo "$tmp $(statusbar)"
done < "$ff" | bar &
while true; do monsterwm > "$ff" || break; done
rm $ff
Thanks.
Last edited by Šaran (2013-02-23 21:18:28)
Offline
hi, I'm away atm so I'll look at the script later.
bash should be faster than sh, mainly because bash has more syntax structs and builtins.
to get bar show up only on the 2nd monitor you should set the OFFSET in its config to the first's monitor's width.
to get bar show up on the 1st monitor you should set WIDTH in its config to the length of the 1st monitor.
.:[ git me! ] :.
Offline
@Šaran
Sorry for the late reply. You have to edit bar's config.def.h to use offset. Let's say I want to show panel only in my main monitor and my left monitor is 1280x1024 and main monitor is 1920x1080. I have to add 1280px for the offset in order to make panel only to show up in my main monitor.
...
/* Offset from the left. Set to 0 to have no effect */
#define BAR_OFFSET 1280
Offline
I think this should do it. It will only show the current monitor's desktops.
[...]
while read -t 1 -r wmout || true; do
if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
read -ra desktops <<< "$wmout"
tmp=
for desktop in "${desktops[@]}"; do
IFS=':' read -r mi cm d w m c u <<< "$desktop" # <-- changed
((cm == 0)) && continue # only process current monitor # <-- added
# Tags labels
label=${tags[$d]}
[...]
btw, if you're using bash, you should be using `[[` instead of `[`
Last edited by c00kiemon5ter (2013-02-24 02:05:47)
.:[ git me! ] :.
Offline
@Šaran
Sorry for the late reply. You have to edit bar's config.def.h to use offset. Let's say I want to show panel only in my main monitor and my left monitor is 1280x1024 and main monitor is 1920x1080. I have to add 1280px for the offset in order to make panel only to show up in my main monitor.... /* Offset from the left. Set to 0 to have no effect */ #define BAR_OFFSET 1280
I had already set the width, but problem was empty space where bar should be on second monitor. Defining bar to false in xinerama-init branch for every desktop on second monitor did the trick.
I think this should do it. It will only show the current monitor's desktops.
[...] while read -t 1 -r wmout || true; do if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then read -ra desktops <<< "$wmout" tmp= for desktop in "${desktops[@]}"; do IFS=':' read -r mi cm d w m c u <<< "$desktop" # <-- changed ((cm == 0)) && continue # only process current monitor # <-- added # Tags labels label=${tags[$d]} [...]
btw, if you're using bash, you should be using `[[` instead of `[`
Thank you very much, this is exactly what I wanted!
I found my startup script in this thread way back (made by Stlarch, I think) so I'm not sure where I should be using '[[' instead of '['.
Offline
Ok, guys, don't laugh at me too hard, but as a learning experience I'm trying to port my monsterwm bash scripts to python and piping the result to Lemonboy's bar. I'm having troubles getting any output from the python script to show up in the bar, and I'm pretty sure it's because of my FIFO handling. Can anyone provide any insight here?
monsterstat.py to process the monsterwm output from the FIFO
startwm.sh to create the fifo and call monsterwm (based on cookie's existing scripts)
I know my bar config is correct, because I can use bar with the regular bash startwm.sh scripts and it works fine. With the above scripts I get a blank bar with nothing in it. If I just print the output of monsterstat.py, it prints fine to the terminal, but only will print the result for the current desktop the terminal is in. It doesn't show the output for desktop 2 if I switch to desktop 2 then back to 0.
Any ideas?
Thanks!
Scott
More information here
Edit 2: Solved. See above link.
Last edited by firecat53 (2013-03-06 16:57:19)
Offline
Could some one please have a look at https://github.com/NPerry/dotfiles/blob … in/monster and see what I'm doing wrong.
Whenever I change the layout, the icon never changes. I'm using MS for the layout icons and reading 'm' is this still valid way of checking?
Offline
on a multimonitor setup you must also check if the desktop is the current in the active monitor
((c)) && fg="\f1" i="${ms[$m]}" || fg="\f9" # change this to
((c && y)) && fg="\f1" i="${ms[$m]}" || fg="\f9"
.:[ git me! ] :.
Offline
on a multimonitor setup you must also check if the desktop is the current in the active monitor
((c)) && fg="\f1" i="${ms[$m]}" || fg="\f9" # change this to ((c && y)) && fg="\f1" i="${ms[$m]}" || fg="\f9"
Thanks, always fixing my mistakes :-)
Last edited by nperry (2013-03-12 09:00:55)
Offline
I was wondering is there a way to disable output about workspaces and layouts that monsterwm sends in tty? I'm wondering about this because i'm not sure where is that info written and i just got new netbook with cheap ssd so i want to minimize input/output in every app and in every possible way. I dont think that piping monsterwm output to /dev/null will do the trick!?
p.s. I believe monsterwm uses fifo and that info is in buffer (as in ram memory) right?
Offline