post your custom dmenu

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: post your custom dmenu

Unread post by machinebacon » Thu Apr 30, 2015 5:37 am

^ In this case, "stop" can actually be dropped :D
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: post your custom dmenu

Unread post by rhowaldt » Thu Apr 30, 2015 9:42 am

^ ja, but i wanted to have at least an option to stop the music completely. this is just to soothe my mind; when i pause, i still feel it "hanging", whereas when i stop, it is stopped and done. /ENOGHU!
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: post your custom dmenu

Unread post by machinebacon » Thu Apr 30, 2015 10:20 am

^ Your mind is paranoid. ;) I need facts! :D
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: post your custom dmenu

Unread post by rhowaldt » Thu Apr 30, 2015 10:31 am

no such thing as facts! nothing is true. ;_;
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
elixir
Weight Watcher
Posts: 357
Joined: Fri Feb 21, 2014 8:25 am

Re: post your custom dmenu

Unread post by elixir » Sat May 09, 2015 8:53 am

This is all so neat. I honestly had no idea that dmenu hacking/customizing was a thing.
Out of the corner of your eye you spot him... Shia LaBeouf.

https://www.youtube.com/watch?v=o0u4M6vppCI

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: post your custom dmenu

Unread post by rhowaldt » Sat May 09, 2015 3:34 pm

since i wanted to use xft fonts in dmenu i switched to dmenu2 instead, which works really well :)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: post your custom dmenu

Unread post by rhowaldt » Sat May 09, 2015 4:18 pm

adjusted version to deal with MOC server not running:

Code: Select all

#!/bin/bash
 
#       Custom dmenu-moc.sh
#
#       Copyright 2009, Gatti Paolo (lordkrandel at gmail dot com)
#       Distributed as public domain.
#		Modified to use with MOC by rhowaldt 290415

bgcol=$(xrdb -query | sed -n "/*background:/s/*background://p" $xcolors | tr -d [:blank:])
fgcol=$(xrdb -query | sed -n "/*foreground:/s/*foreground://p" $xcolors | tr -d [:blank:])
sbgcol=$(xrdb -query | sed -n "/*color4:/s/*color4://p" $xcolors | tr -d [:blank:])
#font='-misc-fixed-*-r-*-*-12-*-*-*-*-*-*-*'

title="MOC "
moc_running=$(pidof "mocp" > /dev/null && echo 1 || echo 0)
if [ $moc_running -eq 1 ]; then
menu=( \
#               labels            commands
#           Main =========================================
                next               "mocp --next"
                playpause          "mocp --toggle-pause"
                stop               "mocp --stop"
                quit               "mocp --exit"
    )

for (( count = 0 ; count < ${#menu[*]}; count++ )); do
 
#   build two arrays, one for labels, the other for commands
    temp=${menu[$count]}
    if (( $count < ${#menu[*]}-2 )); then
        temp+="\n"
    fi
    if (( "$count" % 2 == "0" )); then
        menu_labels+=$temp
    else
        menu_commands+=$temp
    fi
 
done
 
select=`echo -e $menu_labels | dmenu -p $title -nb $bgcol -nf $fgcol -sb $sbgcol -sf $fgcol`
 
if [ "$select" != "" ]; then
 
#   fetch and clean the index of the selected label
    index=`echo -e "${menu_labels[*]}" | grep -xnm1 $select | sed 's/:.*//'`
 
#   get the command which has the same index
    part=`echo -e ${menu_commands[*]} | head -$index`
    exe=`echo -e "$part" | tail -1`
 
#   execute
    $exe &
fi
else
echo "--server not running--" | dmenu -p $title -nb $bgcol -nf $fgcol -sb $sbgcol -sf $fgcol
fi
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
stark
MILF
Posts: 521
Joined: Sat Sep 27, 2014 6:38 pm
Location: Arpanet
Contact:

Re: post your custom dmenu

Unread post by stark » Fri May 15, 2015 12:05 pm

Updated dmenu2 script with colr and icons from siji.
menu.png
menu.png (4.96 KiB) Viewed 5131 times

Code: Select all

#!/usr/bin/env bash
 
# Preferred terminal
terminal='urxvtc'
 
# Preferred editor
editor='vim'
 
# Drawing the line ( hexcode will vary if not using lime )
auto_line ()
{
	# You may change the limit ( i.e the number 11 ) to suit your needs
	for i in {1..11}
	do
		printf "\u00c4"
	done
}
 
# Fonts
font1='-artwiz-lime-medium-r-normal--10-110-75-75-m-50-iso8859-1'
font2='-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1'
 
# Dmenu Preferences
 
# Width
W=64
# Horizontal Position
X=612
# Vertical Position
Y=304
 
 
menu_list="  Run\n  File\n  Edit\n  View\n  Term\n  Web\n  Rngr\n  Wifi\n  Music\n`auto_line`\n  Info\n  Find\n  Sett\n\n    "
 
# Get colr: http://ow.ly/MYBjg or manually enter the color codes
Dmenu="/usr/bin/dmenu -i -fn '$font1','$font2' -x $X -y $Y -w $W -l 20 -nb '#`colr bg`' -sb '#`colr cynf`' -nf '#`colr fg`' -sf '#`colr bg`'"
 
 
# Putting it all together
cmd=$(echo -e "$menu_list" | eval $Dmenu)
 
case $cmd in
 
	*Run)
		$HOME/bin/dmenu.scripts/run-recent ;;
 
	*File)
		thunar > /dev/null 2>&1 ;;
 
	*Edit)
		$terminal -e $editor
 
	*View)
		sxiv -qbfr $HOME/images/ ;;
 
	*Term)
		$terminal -g 120x40 -e bash -c "tmux -q has-session && exec tmux attach-session -dt main || exec tmux new-session -nmain -smain" ;;
 
	*Web)
		firefox --private > /dev/null 2>&1 ;;
 
	*Music)
		$HOME/bin/mpd-launch ;;
 
	*Rngr)
		$terminal -e ranger ;;
 
	*Wifi)
		gksudo $HOME/bin/dmenu.scripts/.connman_dmenu > /dev/null 2>&1 ;;
 
	*Info | ";"i | i";")
		$HOME/bin/dmenu.scripts/stat ;;
 
	*Find)
		$HOME/bin/dmenu.scripts/finder ;;
 
	*Sett | ";"s | s";")
		$HOME/bin/dmenu.scripts/settings ;;
 
	quit | * | ";"q | q |q";")
		$HOME/bin/dmenu.scripts/exit-menu ;;
 
	h | ";"h | h";")
		$terminal -g 68x6 -e htop ;;
 
	";"a | a";")
		$HOME/bin/dmenu.scripts/.dscript ;;
 
	";"t | t";")
		$HOME/bin/dmenu.scripts/todo ;;
 
	";"e | e";")
		$terminal -e $editor $HOME/bin/dmenu.scripts/.menu ;;
 
	"/")
		$terminal -e $editor $HOME/bin/dmenu.scripts/ ;;
 
	k | ";"k | k";")
		$HOME/bin/dmenu.scripts/pkill-menu ;;
esac
 
exit 0
If you can do it go ahead and do it, if you can't do it then don't even criticize it. - gingerdesu

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: post your custom dmenu

Unread post by rhowaldt » Fri May 15, 2015 1:17 pm

that looks cool :)

(this is essentially just like the Openbox menu in dmenu, no?)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
stark
MILF
Posts: 521
Joined: Sat Sep 27, 2014 6:38 pm
Location: Arpanet
Contact:

Re: post your custom dmenu

Unread post by stark » Fri May 15, 2015 1:44 pm

Thanks :)

I didn't mess with openbox that much so I don't know and remember much about the xml stuff. But essentially yeah just a predefined menu. You can make the positioning dynamic so it launches under the cursor by using xdotool. I can add the xdotool version if you want :)
If you can do it go ahead and do it, if you can't do it then don't even criticize it. - gingerdesu

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: post your custom dmenu

Unread post by rhowaldt » Fri May 15, 2015 4:40 pm

thanks stark, i wont be using it myself as it doesnt fit my workflow, so worries about the xdotool :)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

Post Reply