LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 10-20-2020, 12:35 PM   #1
pottag
LQ Newbie
 
Registered: Oct 2020
Posts: 2

Rep: Reputation: Disabled
How to make key-binds to execute shell scripts in DWM


I want to make DWM execute a shell script when I press a series of keys. Like this would do in I3 "bindsym $mod+p exec ~/Tests/shell/mpc-play.sh" Thank you!
 
Old 10-20-2020, 12:54 PM   #2
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
Guessing you would have to modify the config.h (?) and recompile. Been a while since I have used DWM. You can add your own bindings I think - probably just figure out the key codes and add them in the appropriate spot. I have modified key bindings but not added my own.
 
1 members found this post helpful.
Old 10-20-2020, 02:28 PM   #3
individual
Member
 
Registered: Jul 2018
Posts: 315
Blog Entries: 1

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by pottag View Post
I want to make DWM execute a shell script when I press a series of keys. Like this would do in I3 "bindsym $mod+p exec ~/Tests/shell/mpc-play.sh" Thank you!
As sevendogsbsd said, you need to add a keybinding in config.h and recompile dwm.
In config.h, define an array of character pointers (strings) to hold the script name, and any arguments it may take, and it must end with NULL.
Code:
static const char *mpcplay[] = { "/absolute/path/to/mpc-play.sh", "ARGUMENTS", NULL };
In the "keys" structure, also in config.h, you can add something like the following.
Code:
{ MODKEY, p, spawn, {.v = mpcplay} },

Last edited by individual; 10-20-2020 at 02:28 PM. Reason: Clarification
 
2 members found this post helpful.
Old 10-31-2021, 12:22 AM   #4
Si-Ki
LQ Newbie
 
Registered: Oct 2021
Posts: 1

Rep: Reputation: Disabled
Thumbs up

thanks for the solution, I'm a total newb to all this and wanted to ask you if there is some documentation page that you could guide me to that has all such basic stuff, and also, I wanted to know how to set variables and use them, for eg.

I use brave as my browser.
I downloaded Luke Smith's build of DWM and it has "$BROWSER" all over the config.h file, and there is a key bind to for executing $BROWSER but i believe the value of $BROWSER is not set to brave, how do i fix that?

thanks

Last edited by Si-Ki; 10-31-2021 at 12:25 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mouse binds for interactive desktop AlteRFirE SUSE / openSUSE 4 01-12-2007 11:54 PM
binds in fstab for chrooted ftp users (format help please) crazytigger Linux - Newbie 1 05-03-2006 07:14 PM
binds in fstab for chrooted ftp users (format help please) crazytigger Linux - Networking 1 05-03-2006 07:13 PM
Red Hat Enterprise 3 AS Binds Config Different louisb Linux - Enterprise 2 02-14-2005 01:27 PM
binds moonspell *BSD 2 12-11-2003 06:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration