C dwm statusbar app

Hey
I'm trying to configure my dwm setup, and I read the posts on this forum and found out that you have to pipe things to dwm to show things on the statusbar. Trying to find a suitable script I found a C program at http://spaceinvader.rofl.org.uk/. It showed the date, time and load, and some other stuff. I modified it to show the song played by mpd, the date and time, the temperature of the processor and the load. Here's the modified version: http://pastebin.archlinux.org/13104
My problem is the mpd part, nothing mpd-related is showed at all, but I cannot figure out why, so I was wondering if you could help me fix it
Here's the mpd-related part of the program, the problem is most likely in here, and it may well be a stupid error because my C knowledge is limited
//... snip ...//
#define MPC_INFO "/usr/bin/mpc"
//... snip ...//
FILE *dwm, *mpd, *tempP;
//... snip ...//
for (;;) {
getloadavg(&load, 1);
// Run mpc command to get song playing
if ((mpd = popen(MPC_INFO, "r")) == NULL) {
perror("couldn't execute "MPC_INFO);
exit(EXIT_FAILURE);
setvbuf(dwm, NULL, _IOLBF, BUFSIZ);
// Check info read
if (fgets(song_buf, SONG_BUF_SIZE, mpd) == NULL) {
if (ferror(mpd)) {
printf("couldn't read line");
sprintf(song_buf, "error");
clearerr(mpd);
pclose(mpd);
//... snip ...//

I'm far OT here but I'm really impressed to see so many other Archers use the great combo of dwm & mpd!
Here's my .xinitrc. It's ugly but works great. Output:
[ Moby - Bodyrock @ 71% ] [ /:688M ~/:574M c:358M d:616M e:531M ] [ 86% = 1:55 ] [ 800MHz ] [ 27.08.07 - 19:41 ]
#!/bin/sh
# DWM #
space=`echo " "`
timeout=0.2
while true
do
# Battery calc
rem=`cat /proc/acpi/battery/BAT0/state | grep remaining | tr -s " " | cut -d " " -f 3`
voll=`cat /proc/acpi/battery/BAT0/info | grep "design capacity:" | tr -s " " | cut -d " " -f 3`
bat=`echo "100*$rem/$voll" | bc` &> /dev/null
# Battery time
capacity=`cat /proc/acpi/battery/BAT0/state | grep "capacity:" | tr -s " " | cut -d " " -f 3`
rate=`cat /proc/acpi/battery/BAT0/state | grep "rate:" | tr -s " " | cut -d " " -f 3`
thour=`echo "scale=0;$capacity/$rate" | bc` &> /dev/null
tmin=`echo "scale=0;60*$capacity/$rate-60*$thour" | bc` &> /dev/null
if [ `cat /proc/acpi/battery/BAT0/info | grep tech | wc -l` == 0 ];then
batt=""
elif [ `expr $tmin` -le 9 ]; then
tmin="0$tmin"
elfi
elif [ `expr $rate` -gt 0 ];then
batt=`echo "[ ${bat}% = $thour:$tmin ] "`
elfi
fi
# cpufreqd
freq=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq`
cpuf=`echo "scale=2;$freq/1000000" | bc`
if [ $freq == 800000 ];then
cpu=`echo " [ 800MHz ] "`
else
cpu=`echo " [ ${cpuf}GHz ] "`
fi
if [ $freq == 1866000 ];then
cpu=""
fi
echo [ `mpc | sed -n '1,1p' | cut -c -70` @ `mpc volume | sed -e 's#volume: ##'` ]${space}[ /:`df -h | grep sda7 | tr -s " " | cut -d " " -f 4` \~/:`df -h | grep home | tr -s " " | cut -d " " -f 4` c:`df -h | grep win/c | tr -s " " | cut -d " " -f 4` d:`df -h | grep win/d | tr -s " " | cut -d " " -f 4` e:`df -h | grep win/e | tr -s " " | cut -d " " -f 4` ]${space}${batt}${cpu}[ `date +%d.%m.%y` - `date +%k:%M` ]
sleep $timeout
done 2> /dev/null | dwm | eval `cat ~/.fehbg`

Similar Messages

  • DWM statusbar produces strange gap to the right

    I'm using dwm-5.9 patched with statuscolors and when I use color codes with something like
    xsetroot -name "\x05$somestring\x01"
    the statusbar gets a bigger gap to the right even though there's nothing set to display there. A picture would explain this better: (the statusbar script used is displayed in the terminal)
    The gap gets bigger when adding more colored elements to the output string. This does not happen when not using statuscolor codes. What's wrong here?
    Last edited by hesse (2012-03-15 14:54:58)

    Ok. I forgot to say that I patched dwm-5.9 with the statuscolor-5.9 patch. You say there are separate spacing issues on different versions - would it be worth trying to patch with an older version of statuscolor? My guess is it will require an older version of dwm..
    Last edited by hesse (2012-03-15 16:32:14)

  • A dwm statusbar in C

    Hello everyone,
    When I moved to dwm couple months ago, the very first thing to do was to ditch conky and write it's replacement. Here is mine statusbar program written in C
    Source code
    Last edited by router (2015-06-01 15:25:55)

    Hello guys,
    Please accept my apologies. Had to create a new account as my old one was using xxx email provider that blocked my account and wasn't able to retrieve my lengthy password.
    @bstaletic dwm-bar is independent program, you can run both programs flawlessly if you want to. Have a look at my xinitrc which executes the dwm-start script every 5 seconds.
    There is a typo in the title, DWM is the nsa-friendly desktop window manager, and dwm is the dynamic window manager.
    edit: CPU 0% is the overall cpu load, not the frequency (@3Ghz). Start some cpu intensive program and you'll see how the numbers raise.
    Cheers
    Last edited by router (2015-06-01 15:25:19)

  • Can't get conky-cli and bash scripts to both display in dwm statusbar!

    I'm trying to configure my dwm status bar to display some simple information using conky-cli and bash scripts. At first I tried just letting conky run the bash scripts (for network and volume state), but this increased my cpu usage by about 5%, which is significant considering I normally have 1-3% usage when idle. Also, I wanted to keep conky because it makes the display of certain information easy, such as cpu & RAM usage.
    The problem is I'm having trouble getting both to display side by side. Here are the relevant parts of my .xinitrc:
    network(){
    iwconfig wlan0 2>&1 | grep -q no\ wireless\ extensions\. && {
    echo wired
    exit 0
    essid=`iwconfig wlan0 | awk -F '"' '/ESSID/ {print $2}'`
    stngth=`iwconfig wlan0 | awk -F '=' '/Quality/ {print $2}' | cut -d '/' -f 1`
    bars=`expr $stngth / 10`
    case $bars in
    0) bar='[-------]' ;;
    1) bar='[#------]' ;;
    2) bar='[##-----]' ;;
    3) bar='[###----]' ;;
    4) bar='[####---]' ;;
    5) bar='[#####--]' ;;
    6) bar='[######-]' ;;
    7) bar='[#######]' ;;
    *) bar='[--!!!--]' ;;
    esac
    echo $essid$bar
    exit 0
    volume(){
    vol=$(amixer get Master | awk -F'[]%[]' '/%/ {if ($7 == "off") { print "MM" } else { print $2 }}' | head -n 1)
    echo Vol: $vol%
    exit 0
    conky | while true; read line; do xsetroot -name "`$line` `volume` `network` `date '+%a %m-%d-%Y %I:%M%p'`"; done &
    exec dwm
    (let me know if it would help to post any other files)
    For some reason when I run this I only get the network/volume scripts and date running, updating every second (I think). The conky line just doesn't show up. I don't know what could be wrong, since I didn't see any error messages.
    An even better solution would be to just have shell scripts to display CPU and MEM usage. I have a dual-core cpu, cpu0 and cpu1. I'd like to see both percentages if possible, or at least a percentage that is an accurate average of the two or something. In conky-cli I have something that shows:
    cpu0/1: xx% xx%
    Also, seeing RAM usage would help a lot. In conky it shows:
    mem: xx% (xxxMB)
    These are the ways I would like to have bash scripts show them, if possible, but I have zero skill in bash programming. I made this an option in case it's easier/cleaner/less resource hungry than a conky solution. Personally, if they're about the same in these aspects, I would prefer something with conky and the shell scripts because conky is so extensible, yet it's only flaw is executing scripts with minimal resource usage.
    Help?

    Thanks. I was thinking of using load average to save a few characters, but I didn't quite understand the numbers. I'll try that once I get to my Linux box, but could you please explain or post a link to something that explains load average (what's low, high, normal, etc.)?
    EDIT: I found a website that explains loadavg. I now have my dwm status bar displaying it perfectly (yay!). Now I just need to add a few more things like battery status, etc. and I might be done. I'll probably post here if I have more questions, though.
    Thanks for your help!
    Last edited by Allamgir (2009-07-18 14:41:11)

  • DWM. Apps Can't open X display

    Hi! im having a problem with scrot for taking screenshots, he's refusing im now using dwm and before i use wmii, with wmii i can take screenshots with no problem
    [aleyscha@aleyscha 13 ~]$ scrot -d 5 -q 75 -t 25 -c ~/desktop.jpg
    giblib error: Can't open X display. It *is* running, yeah?
    i suspect it has something to do with the way i have my .xinitrc...
    .xinitrc
    #!/bin/sh
    # ~/.xinitrc
    # Executed by startx (run your window manager from here)
    ### Wallpaper set command ###
    eval `cat ~/.fehbg`
    ### Autostart applications ###
    numlockx &
    ### Window Manager set ###
    # exec startkde
    # fusion-icon &
    # exec wmaker
    # exec startxfce4
    # exec icewm
    # exec fvwm
    # exec openbox
    # exec startfluxbox
    # exec awesome
    # exec wmii
    # exec ratpoison
    # dwm
    while true
    do
    echo '|' CPU:$(get_cputemp Core0)C/$(get_cputemp Core1)C '|' Ram:$(get_freemem)/Swap:$(get_freeswap) '|' /downloads:$(get_diskinfo sdb1) /sdd1:$(get_diskinfo sdd1) /sde1:$(get_diskinfo sde1) /cdrom:$(get_cdrominfo cdrom) '|' PCM:$(get_volume PCM)% '|' $(date +'%R %d/%m/%Y')
    sleep 2
    done | dwm
    Thanks!
    Last edited by leo2501 (2008-06-25 02:20:06)

    I'm having the same issue in other programs as well when i try to open the game "N" it says:
    [aleyscha@aleyscha 42 ~]$ n
    Gtk-WARNING **: cannot open display:
    [aleyscha@aleyscha 43 ~]$
    i think it has to do with DISPLAY=my_host:0 exec dwm in /etc/X11/xinit/xinitrc as says here -> http://wiki.archlinux.org/index.php/Dwm
    but i dont know if i need to edit that file because my says twm, i think that is the default, and if i have an .xinitrc file at my home dir, it jumps that file, right?
    Post Installation
    After you have downloaded and installed dwm using pacman you go ahead and get started using it. It should be noted that currently dwm is configured through its source. If you simply download and install it, then you'll be given the default setup.
    Fire up your favorite text editor and add dwm to your xinitrc script:
    su
    nano -w /etc/X11/xinit/xinitrc
    Your's should look something like this:
    #!/bin/sh
    # $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
    userresources=$HOME/.Xresources
    usermodmap=$HOME/.Xmodmap
    sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
    sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
    # merge in defaults and keymaps
    if [ -f $sysresources ]; then
        xrdb -merge $sysresources
    fi
    if [ -f $sysmodmap ]; then
        xmodmap $sysmodmap
    fi
    if [ -f $userresources ]; then
        xrdb -merge $userresources
    fi
    if [ -f $usermodmap ]; then
        xmodmap $usermodmap
    fi
    # start some nice programs
    exec dwm
    When I installed it on my laptop I had to use the following line:
    DISPLAY=my_host:0 exec dwm
    instead of
    exec dwm
    Finally, now all you need to do is
    startx
    at the command line.
    Enjoy.

  • DWM / Powerline / Font ?

    So... I stole all the patches from this github rep: https://github.com/SushiDesu/dwm
    All the patches applied nicely. But... I cant get the glyph's to work.
    It gave me 2 questions:
    1: How can I really test it? The wierd thing is that the glyph is showing in vim in terminal termite. But I can't echo it in the terminal? or in the dwm statusbar.
    2: How can I find out what the "name/reference" is when telling a given program to use a specific font. By that I mean some times it *~*~*~fontname~*~*size etc.  and in this stolen config.h it is Menlo for Powerline:size=9. Cant seem to find out how to know that? tried to search the wiki, duckduckgo etc. But im kind of lost here...

    Are you asking how to generate lines like *~*~*~fontname~*~*size? Use xfontsel.
    There are powerline fonts in the AUR https://aur.archlinux.org/packages.php?K=powerline

  • Dwm reading from stdin?

    Hej,
    everywhere I read dwm would display what it reads on stdin. but everything I see is the version number and nothing I send to the fifo, it should actually read from, appears. Is the wiki-way (setting xsetroot -name) the right way to display something in the bar? I'd find the stdin solution more elegant.
    this is how I start dwm:
    mkfifo $fifo &
    displayinfo.sh > $fifo &
    exec dwm < $fifo 2> $errorlog

    Please note that with xsetroot you get exactly the same result (stdin is displayed in dwm statusbar). I was following the suckless mailing list in that period but I am not sure to remember the reason of this change, perhaps code simplification (since one can get the same result with xsetroot which comes with any X installation).

  • Can't get panes to re-size with hotkeys

    I have a small annoyance whereby sometimes my hotkeys to re-size existing panes doesn't work.  I had changed the hotkeys to move from pane to pane to be Alt-Left (arrow) and Alt-Right (arrow) key.  After looking at the default settings by running tmux's in-pane help (the hotkey shift-?) I commented those two keys out thinking that would reset tmux to its default behaviour.  It hasn't worked so far and I'm not sure where else to look aside from my .tmux.conf file.  It's based on Thayer's own config:
    #~/.tmux.conf - tmux terminal multiplexer config
    # Based heavily on Thayer Williams' (http://cinderwick.ca)
    ## Environmental Options
    # Enable tmux to use a 256 colour terminal
    # Provided the underlying terminal supports 256 colours, it is usually sufficient to add the following to ~/.tmux.conf:
    set -g default-terminal "screen-256color"
    set -g terminal-overrides 'xterm*:smcup@:rmcup@'
    # If you SSH into a host in a tmux window, you'll notice the window title of your terminal emulator remains to be user@localhost
    # rather than user@server. To allow the title bar to adapt to whatever host you connect to, set the following in ~/.tmux.conf
    set -g set-titles on
    set -g set-titles-string "#T"
    # open a man page in new window
    bind m command-prompt "split-window 'exec man %%'"
    ## By default, all windows in a session are constrained to the size of the
    ## smallest client connected to that session, even if both clients are
    ## looking at different windows. It seems that in this particular case, Screen
    ## has the better default where a window is only constrained in size if a
    ## smaller client is actively looking at it. This behaviour can be fixed by
    ## setting tmux's aggressive-resize option.
    setw -g aggressive-resize on
    # mouse-select-pane [on | off]
    # # If on, tmux captures the mouse and when a window is
    # # split into multiple panes the mouse may be used to
    # # select the current pane. The mouse click is also
    # # passed through to the application as normal.
    set -g mouse-select-pane on
    ## Upon starting to use tmux, I noticed that I had to add a noticeable delay
    ## between two characters in a command sequence for it to recognize the
    ## command, for example between the C-a and n in C-a n. This is because tmux is
    ## waiting for an escape sequence. Fix that by setting escape time to zero.
    set -s escape-time 0
    ### Hotkeys and Commands
    ## Binds
    # set prefix key to ctrl+a
    unbind C-b
    set -g prefix C-a
    ## Quick way to mosh/ssh into another system bound to S [Shift-S]
    bind S command-prompt -p 'SSH to:' "new-window -n %1 'mosh %1'"
    # reload config without killing server
    bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
    # toggle last window like screen
    bind-key C-a last-window
    # more intuitive keybindings for splitting
    unbind %
    bind v split-window -v
    bind - split-window -v
    unbind '"'
    bind h split-window -h
    bind \ split-window -h
    # send the prefix to client inside window (ala nested sessions)
    bind-key a send-prefix
    # confirm before killing a window or the server
    bind-key k confirm kill-window
    bind-key K confirm kill-server
    # toggle statusbar
    bind-key b set-option status
    # ctrl+left/right cycles thru windows
    #bind-key -n C-right next
    #bind-key -n C-left prev
    #bind-key -n M-right next
    #bind-key -n M-left prev
    # open a man page in new window
    bind m command-prompt "split-window 'exec man %%'"
    # quick view of processes
    bind '~' split-window "exec htop"
    # scrollback buffer n lines
    set -g history-limit 5000
    # listen for activity on all windows
    set -g bell-action any
    set -g bell-on-alert on
    set -g visual-bell off
    # on-screen time for display-panes in ms
    set -g display-panes-time 4000
    # start window indexing at one instead of zero
    set -g base-index 1
    # disable wm window titles
    set -g set-titles off
    # disable auto renaming
    #setw -g automatic-rename on
    # border colours
    set -g pane-active-border-bg default
    #set -g pane-border-fg blue
    # wm window title string (uses statusbar variables)
    set -g set-titles-string "tmux:#I [ #W ]"
    #set -g set-titles-string "tmux"
    # session initialization
    #new -s0 -nTTYtter 'ttytter'
    #neww -t0:1 -nvifm 'vifm'
    #selectw -t 1
    ### default statusbar colors
    set -g status-fg white
    set -g status-bg default
    set -g status-attr bright
    ### White Yunzi - statusbar
    set -g status-interval 1
    set -g status-justify centre # center align window list
    set -g status-left-length 30
    set -g status-left '#[fg=white,bright] [ #[fg=green,bright]#H#[fg=white,bright] ]#[fg=white] Up #(uptime | cut -f 4-5 -d " "|cut -f 1 -d ",")'
    set -g status-right-length 30
    set -g status-right '#[fg=green,bright][#[fg=white,bright] %a %m-%d-%Y %H:%M #[fg=green,bright]]'
    ### Silver Yunzi - statusbar
    # set -g status-interval 1
    # set -g status-justify centre # center align window list
    # set -g status-left-length 30
    # set -g status-left '#[fg=white,bright][ #[fg=blue,bright]#H#[fg=white,bright] ]#[fg=white] Up #(uptime | cut -f 4-5 -d " "|cut -f 1 -d ",")'
    # set-option -g status-right '#[fg=yellow]%k:%M #[fg=blue]%a,%d-%b#[default] '
    # set -g status-right-length 30
    # set -g status-right '#[fg=blue,bright][#[fg=white,bright] %a %b-%d-%Y %H:%M #[fg=blue,bright]]'
    # set-option -g status-right '#[fg=yellow]%a:%M #[fg=blue]%a,%d-%b#[default] '
    ### Pink Yunzi - statusbar
    # set -g status-interval 1
    # set -g status-justify centre # center align window list
    # set -g status-left-length 30
    # set -g status-left '#[fg=white,bright] [ #[fg=magenta,bright]#H#[fg=white,bright] ]#[fg=white] Up #(uptime | cut -f 4-5 -d " "|cut -f 1 -d ",")'
    # set -g status-right-length 30
    # set -g status-right '#[fg=magenta,bright][#[fg=white,dim] %a %m-%d-%Y %H:%M #[fg=magenta,bright]]'
    ### White Yunzi - active window title colors
    set-window-option -g window-status-current-fg green
    set-window-option -g window-status-current-attr bright
    set-window-option -g window-status-current-bg black
    set-window-option -g window-status-current-attr bright
    ### Silver Yunzi - active window title colors
    # set-window-option -g window-status-current-fg blue
    # set-window-option -g window-status-current-attr bright
    # set-window-option -g window-status-current-bg default
    # set-window-option -g window-status-current-attr bright
    ### Pink Yunzi - active window title colors
    # set-window-option -g window-status-current-fg magenta
    # set-window-option -g window-status-current-attr bright
    # set-window-option -g window-status-current-bg black
    # set-window-option -g window-status-current-attr bright
    ### default window title colors
    # set-window-option -g window-status-fg white
    # set-window-option -g window-status-bg default
    # set-window-option -g window-status-attr bright
    ### Silver Yunzi - command/message line colors
    set -g message-fg white
    set -g message-bg black
    set -g message-attr bright
    # show some useful stats but only when tmux is started
    # outside of Xorg, otherwise dwm statusbar shows these already
    #set -g status-right ""
    #set -g status-left ""
    #if '[ -z "$DISPLAY" ]' 'set -g status-left "[#[fg=green] #H #[default]]"'
    #if '[ -z "$DISPLAY" ]' 'set -g status-right "[ #[fg=magenta]#(cat /proc/loadavg | cut -d \" \" -f 1,2,3)#[default] ][ #[fg=cyan,bright]%a %Y-%m-%d %H:%M #[default]]"'
    #if '[ -z "$DISPLAY" ]' 'set -g status-right-length 50'
    Insights appreciated! 

    No--
    In the Motion tab... right click the video in the sequence and send to viewer...
    Then under the MOTION tab... twirl down the DISTORT triangle and then check the aspect ratio there... set either to 0, 33 or -33.
    Good luck,
    CaptM

  • [SOLVED] MPD is not starting with .xinitrc

    Hi!
    This is my first post on this forum, so hello everyone!
    Let me explain you what my problem is:
    I just can't get MPD to start with. xinitrc or systemd. When I launch it from terminal it works like a charm, but when it should start with X (I am using Slim), it just doesn't.
    Here is my .xinitrc:
    #!/bin/sh
    # ~/.xinitrc
    # Executed by startx (run your window manager from here)
    if [ -d /etc/X11/xinit/xinitrc.d ]; then
    for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
    done
    unset f
    fi
    #mpd
    mpd --no-daemon &
    #fonts
    xset +fp ~/.fonts
    xset +fp /usr/share/fonts/local
    xset fp rehash
    #wallpaper
    $HOME/.fehbg
    #conky
    conky &
    #statusbar
    $HOME/dwm-statusbar &
    #dwm
    exec dwm
    # exec gnome-session
    # exec startkde
    # exec startxfce4
    # ...or the Window Manager of your choice
    I hope somebody can help me.
    Last edited by fabledpig (2013-03-15 18:38:19)

    Systemd has a great journal that can be accessed with journalctl.
    Have you looked over the mpd wiki page? I actually start mpd with the service file it includes. If you want to start it as your user, copy it to the appropriate place in /etc rename it [email protected] and put a "User=%i" (I think that is the right variable...not at my computer ATM) in the [Service] section.
    The great thing about systemd is that it is super easy to configure service files... so if you want to start mpd this way you.may want to try that.
    The other option with a service file is to use the new feature insystemd 198 that allows an appropriately named directory to hold all kinds of configuration changes to a given unit. Again, I am not at my computer, so you are going to have to use the man pages for this (which you should be doing anyway). This feature is like a more advanced ".include" though. So you could just add a user line to the existing unit.

  • Achieve this in dzen2

    Hi, I was browsing the screenshots in this forum and I really like the menu bar like this:
    http://imagebin.org/index.php?mode=image&id=226275
    This is in DWM, and I'm loving XMonad and just starting to use dzen2/conky instead of xmobar.  Is this possible? I cant seem to figure this out
    In case you don't know what I am refering to, its the part on the right(Time/speaker) with the < to separate it.
    I think I should use terminus2 via http://archlinux.me/w0ng/2012/05/01/dwm … statusbar/
    But... no idea after that.

    Yup it's terminus 2.  I had the same thing in my dwm status bar.
    For dzen2*, you'd need to be able to set foreground and background colors - can you do that?
    If so, it's just: {fg1,bg1} some text {fg2,bg1} < {fg3,bg2} other text
    where bg2=fg2. and the < symbol is actually the full triangle.
    *I've never really used dzen
    Last edited by Trilby (2012-08-29 13:09:40)

  • Catch private message event in irssi/weechat?

    I'm using dwm at the moment, and I really like it. I have an own desktop for irssi/weechat (i have to decide which of them is the better choice) and using Bitlbee in it.
    Now I wanted to ask, if it is possible to catch the event that a private/highlighted message in irssi/weechat arrived and maybe write it into a file so that I can pipe it into my dwm-statusbar. The file may get removed by a shortcut if i switch to my irc-desktop.
    If anyone have written a sript to handle this, please share it . To all the others, please share your ideas. And note: I'm not very experienced with scripting and things like that...
    Mo.

    Mo wrote:
    I'm using dwm at the moment, and I really like it. I have an own desktop for irssi/weechat (i have to decide which of them is the better choice) and using Bitlbee in it.
    Now I wanted to ask, if it is possible to catch the event that a private/highlighted message in irssi/weechat arrived and maybe write it into a file so that I can pipe it into my dwm-statusbar. The file may get removed by a shortcut if i switch to my irc-desktop.
    If anyone have written a sript to handle this, please share it . To all the others, please share your ideas. And note: I'm not very experienced with scripting and things like that...
    Mo.
    Just look into bash scripting, and use grep, That's what I'd do. I've never used dwm though, so I don't really know how it's statusbar works. I can make the script for you with bash using just irssi and having the bash script output the username.

  • Set statusbar in DWM

    Hi!
    I wonder if anyone could tell me how i could load a statusbar in  c withing the .xinitrc file...
    the files i want to load can be found here: http://dwm.suckless.org/dwmstatus/
    I don't seem to figure out how to do it, so help would be apreciated!! Although i know it's a noob question....

    Have you tried e.g.
    <~/.xinitrc content>
    dwmst &
    exec dwm
    assuming the app you're using is named dwmst?

  • Setting Default apps with minimal WMs (dwm, awesome, etc)

    How are folks running WMs like awesome and dwm setting their default applications (I'm particularly interested in the web-browser setting)?
    On past systems, I've had GNOME installed, and just used the preferred applications dialogue, but that's not the case in my current system.
    Does anyone know where dwm/awesome look for default app settings, and how I'm able to change those settings?

    For example, in your shell config:
    export BROWSER="your-browser"
    There's nothing like that in either Awesome or dwm. And I don't think one really needs it. In case you want to open certain file types in dedicated applications, you can e.g. define aliases to achieve this. (Everything depends on the shell you use, or the file manager. In my case Midnight Commander together with zsh does the job well.)
    Edit: consider me slowww, always a couple of minutes slowwwer.
    Last edited by bohoomil (2011-03-15 21:57:44)

  • [SOLVED] dwm + gkrellm. gkrellm in all tags + apps not over it

    hi! i'm using dwm right now, and it's here to stay in my config, but i'm a convert from fluxbox, and on it, i used to run gkrellm, it was beautifull to have it showed in every desktop, so right now i think if it's posible to have gkrellm in dwm, in the exact same behavior, so it shows in every tag, and the opened apps, dont get over it, like the slit in fluxbox...
    here's my config.h, i've added gkrellm to the floating apps list, but don't know how to edit it so gkrellm show in every tag
    /* See LICENSE file for copyright and license details. */
    /* appearance */
    /* static const char font[] = "-*-terminus-medium-r-normal-*-18-*-*-*-*-*-*-*"; */
    static const char font[] = "-*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-*";
    static const char normbordercolor[] = "#111111";
    static const char normbgcolor[] = "#000000";
    static const char normfgcolor[] = "#ffffff";
    static const char selbordercolor[] = "#777777";
    static const char selbgcolor[] = "#222222";
    static const char selfgcolor[] = "#ffffff";
    static unsigned int borderpx = 1; /* border pixel of windows */
    static unsigned int snap = 32; /* snap pixel */
    static Bool showbar = True; /* False means no bar */
    static Bool topbar = False; /* False means bottom bar */
    /* tagging */
    static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
    static Rule rules[] = {
    /* class instance title tags mask isfloating */
    { "Gimp", NULL, NULL, 0, True },
    { "Firefox", NULL, NULL, 1 << 8, True },
    { "MPlayer", NULL, "MPlayer", 0, True },
    { "feh", NULL, "feh", 0, True },
    { "glxgears", "glxgears", "glxgears", 0, True },
    { "vlc", NULL, "vlc", 0, True },
    { "xine", NULL, "xine", 0, True },
    { "gkrellm", NULL, "gkrellm", 0, True },
    { "galculator", NULL, NULL, 0, True },
    { "xcalc", NULL, NULL, 0, True },
    { "winff", NULL, "winff", 0, True },
    { "snes9x", NULL, "snes9x", 0, True },
    /* layout(s) */
    static float mfact = 0.55;
    static Bool resizehints = True; /* False means respect size hints in tiled resizals */
    static Layout layouts[] = {
    /* symbol arrange function */
    { "[]=", tile }, /* first entry is default */
    { "><>", NULL }, /* no layout function means floating behavior */
    { "[M]", monocle },
    /* key definitions */
    #define MODKEY Mod1Mask
    #define TAGKEYS(KEY,TAG) \
    { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
    { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
    /* helper for spawning shell commands in the pre dwm-5.0 fashion */
    #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
    /* commands */
    static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
    static const char *termcmda[] = { "urxvt", NULL };
    static const char *termcmdb[] = { "urxvt", "-sh", "50", NULL };
    static const char *amixcmdua[] = { "amixer", "-q", "set", "PCM", "20+", NULL };
    static const char *amixcmdda[] = { "amixer", "-q", "set", "PCM", "20-", NULL };
    static const char *amixcmdub[] = { "amixer", "-q", "set", "Front", "10+", NULL };
    static const char *amixcmddb[] = { "amixer", "-q", "set", "Front", "10-", NULL };
    static Key keys[] = {
    /* modifier key function argument */
    { MODKEY, XK_p, spawn, {.v = dmenucmd } },
    { MODKEY, XK_Return, spawn, {.v = termcmda } },
    { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmdb } },
    { MODKEY, XK_z, spawn, {.v = amixcmdda } },
    { MODKEY, XK_x, spawn, {.v = amixcmdua } },
    { MODKEY|ShiftMask, XK_z, spawn, {.v = amixcmddb } },
    { MODKEY|ShiftMask, XK_x, spawn, {.v = amixcmdub } },
    { MODKEY, XK_b, togglebar, {0} },
    { MODKEY, XK_j, focusstack, {.i = +1 } },
    { MODKEY, XK_k, focusstack, {.i = -1 } },
    { MODKEY, XK_h, setmfact, {.f = -0.05} },
    { MODKEY, XK_l, setmfact, {.f = +0.05} },
    { MODKEY|ControlMask, XK_Return, zoom, {0} },
    { MODKEY, XK_Tab, view, {0} },
    { MODKEY, XK_q, killclient, {0} },
    { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
    { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
    { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
    { MODKEY, XK_space, setlayout, {0} },
    { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
    { MODKEY, XK_0, view, {.ui = ~0 } },
    { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
    TAGKEYS( XK_1, 0)
    TAGKEYS( XK_2, 1)
    TAGKEYS( XK_3, 2)
    TAGKEYS( XK_4, 3)
    TAGKEYS( XK_5, 4)
    TAGKEYS( XK_6, 5)
    TAGKEYS( XK_7, 6)
    TAGKEYS( XK_8, 7)
    TAGKEYS( XK_9, 8)
    { MODKEY|ShiftMask, XK_q, quit, {0} },
    /* button definitions */
    /* click can be a tag number (starting at 0),
    * ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    static Button buttons[] = {
    /* click event mask button function argument */
    { ClkLtSymbol, 0, Button1, setlayout, {0} },
    { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
    { ClkWinTitle, 0, Button2, zoom, {0} },
    { ClkStatusText, 0, Button2, spawn, {.v = termcmda } },
    { ClkClientWin, MODKEY, Button1, movemouse, {0} },
    { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
    { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
    { ClkTagBar, 0, Button1, view, {0} },
    { ClkTagBar, 0, Button3, toggleview, {0} },
    { ClkTagBar, MODKEY, Button1, tag, {0} },
    { ClkTagBar, MODKEY, Button3, toggletag, {0} },
    THANKS!!
    Last edited by leo2501 (2008-08-08 11:01:14)

    i will answer myself, someone get me the "key" in the ML. lol...
    On 8/4/08, Anselm R Garbe <[EMAIL PROTECTED]> wrote:
    > Also you might patch dwm.c to leave some space on the right for the
    > window, e.g. in updategeom:
    >
    > wh-=200;
    decreasing window area height would leave space at the _bottom_
    ww-=200;
    is probably what you meant
    Anselm R Garbe
    Mon, 04 Aug 2008 04:29:45 -0700
    You need to define a rule to make it floating and tag it with all tags.
    { "gkrellm",  NULL,       "gkrellm",  ~0,            True },
    Also you might patch dwm.c to leave some space on the right for the
    window, e.g. in updategeom:
    wh-=200;
    Kind regards,
    Anselm
    Rickard Gustafsson
    Mon, 04 Aug 2008 04:28:39 -0700
    { "gkrellm",  NULL,       "gkrellm",  (1 << 9) - 1,            True },
    or you could just replace (1 << 9) - 1 with 511.

  • [solved]DWM rules for opening terminal based apps

    These are the rules that I have in my dwm config.h
    The ncurses apps that open in the terminal do not follow the rules. How can accomplish this?
    static const Rule rules[] = {
    /* class instance title tags mask isfloating monitor */
    { "Gimp", NULL, NULL, 0, True, -1 },
    { "Firefox", NULL, NULL, 1 << 3, False, -1 },
    { "Pcmanfm", NULL, NULL, 1 << 1, False, -1 },
    { "ranger", NULL, NULL, 1 << 6, False, -1 },
    { "mutt", NULL, NULL, 1 << 7, False, -1 },
    { "ncmpc", NULL, NULL, 1 << 8, False, -1 },
    Last edited by derrickcope (2015-05-02 05:26:14)

    thanks for the suggestion. xprop just sees them as "terminator". When I start them with -T "title" then xprop sees them with "title".
    When I used the -T switch in .xinitrc and then changed my rules to
    static const Rule rules[] = {
    /* class instance title tags mask isfloating monitor */
    { "Gimp", NULL, NULL, 0, True, -1 },
    { "Firefox", NULL, NULL, 1 << 3, False, -1 },
    { "Pcmanfm", NULL, NULL, 1 << 1, False, -1 },
    { "ranger", NULL, "ranger", 1 << 6, False, -1 },
    { "mutt", NULL, "mutt", 1 << 7, False, 2 },
    { "ncmpc", NULL, "ncmpc", 1 << 8, False, 2 },
    They are still opening on the first monitor and not on the tag I set. I am not sure I am doing it correctly. Should I write terminator as the class?

Maybe you are looking for