LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Arch (https://www.linuxquestions.org/questions/arch-29/)
-   -   Can you customize dmenu? (https://www.linuxquestions.org/questions/arch-29/can-you-customize-dmenu-4175549200/)

itscience 07-28-2015 05:43 PM

Can you customize dmenu?
 
Hey. I have a question :-) Can you customize dmenu? I'd like to know if there is a file or fork of dmenu that I can change it's appearance. Really I would like to change it's width to match the i3bar.

I put this under Arch because the packages might be Arch pacific:
Thanks for reading. Hope there is a way.

Head_on_a_Stick 07-29-2015 08:00 AM

Quote:

Originally Posted by itscience (Post 5397525)
Really I would like to change it's width to match the i3bar.

To modify the height of the dmenu bar, you will have to download the source code and modify that.
Code:

git clone http://git.suckless.org/dmenu
cd dmenu

You will need to alter the paths in dmenu/config.mk to this:
Code:

# paths
PREFIX = /usr
MANPREFIX = ${PREFIX}/share/man

X11INC = /usr/include/X11
X11LIB = /usr/lib/X11

Then copy the default configuration file to a user-alterable version:
Code:

cp config.def.h config.h
Then modify config.h to your taste (the latest MASTER branch now has Xft support so you can use a fancy font if you wish).

For the bar height, modify dmenu.c
Code:

vim dmenu.c
Go to line 617 (this is specific to the current MASTER branch):
Code:

        bh = drw->fonts[0]->h + 2;
This line sets the height of the bar ("bh") to the height of the font plus two pixels ("h + 2") -- simply change "2" to whichever value you want and compile and install the package:
Code:

make
# make install

Alternatively, you could modify the version found in the repositories by using the Arch Build System and install with pacman (ie, the "correct" way) -- the line is very similar but is at a different line number.

It is also possible to use the PKGBUILD found in the ABS to install the git version with pacman.

itscience 07-29-2015 08:22 AM

Perfect. This will give me the opportunity to learn about the Arch Build System.
Thanks for your reply. It is very helpful :-)

Head_on_a_Stick 07-29-2015 08:24 AM

You're welcome :)

itscience 07-29-2015 11:43 AM

Hi, sorry about this but I have one last query.
I have tried the Arch way but something isn't quite working.
I have used abs to build from source:
#abs community/dmenu $mkdir $HOME/abs $cp -r /var/abs/community/dmenu ~/abs $cd ~/abs/dmenu $makepkg -s

Once it is finished I am left with folders and a dmenu-***.pkg.tar.xz file and I make the changes I wanna make in ~/abs/dmenu/src/dmenu
I $cp config.def.h config.h and edit the config.h, config.mk and dmenu.c
dmenu.c doesn't have the line you described but I found bh = dc->font.height + 2; on line 552 which I figured must be it.
next thing is I use #pacman -U dmenu-***.pkg.tar.xz and the program is installed but no changes are made.

I can only assume that the folder are irrelevant and the changes I should be making are in fact in the pkg.tar.xz file.
I'd love to know what I am missing or doing wrong. Please let me know. Thanks again :-)

Head_on_a_Stick 07-29-2015 03:00 PM

Quote:

Originally Posted by itscience (Post 5397875)
$makepkg -s

From makepkg(8):
Quote:

-e, --noextract
Do not extract source files or run the prepare() function (if present); use whatever
source already exists in the $srcdir/ directory. This is handy if you want to go into
$srcdir/ and manually patch or tweak code, then make a package out of the result. Keep
in mind that creating a patch may be a better solution to allow others to use your
PKGBUILD.
Use:
Code:

makepkg -efi
EDIT: You also have to either update the checksums or use:
Code:

makepkg -efi --skipinteg

itscience 07-30-2015 01:37 PM

Eurika! Thank you :-)

To clarify I used:
$mkdir ~/abs
$abs repository/package
$cp -r /var/abs/repository/package ~/abs
$makepkg -s (in ~/abs/package_folder)
(Made the changes I wanted/needed)
$makepkg -efi --skipinteg (again, in ~/abs/package_folder)

So far I've had no problems. I am sure I can fiddle to my hearts content should I desire it but the dmenu looks a lot smarter and matches with the i3bar perfectly :-)

Cheers, again!

Head_on_a_Stick 07-30-2015 02:49 PM

You're welcome, glad you got it working.

dmenu FTW!
:)


All times are GMT -5. The time now is 04:17 AM.