You are not logged in.

#1 2009-10-06 13:59:42

Lich
Member
Registered: 2009-09-13
Posts: 437

evilwm launcher patch

Ok so I was a big fan of evilwm during my "minimalist hunt". I still use it as my floating alternative to Ratpoison (yes, tmpwm can do wonders smile )
One thing that I've always hated about evilwm was the lack of any type of application launcher, all you could do was to spawn a terminal, and start your application from there.
I wrote this little patch really fasts, it works, but I intend to extend on it (for now you can only launch apps or scripts, but I intend to make it default to dmenu without the need of a separate script)
To patch against evilwm-1.0.1(fresh source, nothing messed with or else the patch could fail):
1. Copy the patch somewhere within reach (I usually put it right in the source's directory)
2. Do `patch -p1 ./evilwm-1.0.1-lich.patch`
3. `make clean && make && sudo make install`

You can now run evilwm with an extra flag, -launcher. The patch defaults to using the application called "launcher" (which should not exist unless you made one called like that). If you have an app in your $PATH that has this name already, no need to pass the flag (ONLY IF that application is actually an application launcher, otherwise make the flag point to your launch script). My `launcher` script ( I keep it in my ~/bin directory, which is in my $PATH )

#!/bin/sh
exec $(dmenu_path | dmenu -nb "grey20" -nf "goldenrod" -sb "goldenrod" -sf "grey20")

chmod +x ~/bin/launcher` and that's it, start evilwm and you should have dmenu run on CTRL+ALT+m (default evilwm MOD is CTRL+ALT)
evilwm-1.0.1-lich.patch

diff -crB evilwm-1.0.1/events.c evilwm-1.0.1-lich/events.c
*** evilwm-1.0.1/events.c    2009-03-30 13:37:06.000000000 +0300
--- evilwm-1.0.1-lich/events.c    2009-10-06 16:36:53.000000000 +0300
***************
*** 33,38 ****
--- 33,41 ----
  #endif
  
      switch(key) {
+         case KEY_LAUNCHER:
+             spawn(opt_launcher);
+             break;
          case KEY_NEW:
              spawn(opt_term);
              break;
diff -crB evilwm-1.0.1/evilwm.h evilwm-1.0.1-lich/evilwm.h
*** evilwm-1.0.1/evilwm.h    2009-03-30 13:37:05.000000000 +0300
--- evilwm-1.0.1-lich/evilwm.h    2009-10-06 16:36:53.000000000 +0300
***************
*** 51,57 ****
  #else
  #define DEF_TERM        "xterm"
  #endif
! 
  /* readability stuff */
  
  #define KEY_TO_VDESK(key) ((key) - XK_1)
--- 51,57 ----
  #else
  #define DEF_TERM        "xterm"
  #endif
! #define DEF_LAUNCHER    "launcher"
  /* readability stuff */
  
  #define KEY_TO_VDESK(key) ((key) - XK_1)
***************
*** 200,205 ****
--- 200,206 ----
  extern unsigned int     grabmask2;
  extern unsigned int     altmask;
  extern const char       *opt_term[3];
+ extern const char       *opt_launcher[3];
  extern int              opt_bw;
  #ifdef SNAP
  extern int              opt_snap;
diff -crB evilwm-1.0.1/keymap.h evilwm-1.0.1-lich/keymap.h
*** evilwm-1.0.1/keymap.h    2009-03-30 13:37:06.000000000 +0300
--- evilwm-1.0.1-lich/keymap.h    2009-10-06 16:36:53.000000000 +0300
***************
*** 1,6 ****
  #ifndef _KEYMAP_H
  #define _KEYMAP_H
! 
  #define KEY_NEXT    XK_Tab
  #define KEY_NEW        XK_Return
  #define KEY_TOPLEFT    XK_y
--- 1,6 ----
  #ifndef _KEYMAP_H
  #define _KEYMAP_H
! #define KEY_LAUNCHER XK_m
  #define KEY_NEXT    XK_Tab
  #define KEY_NEW        XK_Return
  #define KEY_TOPLEFT    XK_y
diff -crB evilwm-1.0.1/main.c evilwm-1.0.1-lich/main.c
*** evilwm-1.0.1/main.c    2009-03-30 13:37:06.000000000 +0300
--- evilwm-1.0.1-lich/main.c    2009-10-06 16:36:53.000000000 +0300
***************
*** 51,56 ****
--- 51,57 ----
  unsigned int grabmask2 = Mod1Mask;
  unsigned int altmask = ShiftMask;
  const char   *opt_term[3] = { DEF_TERM, DEF_TERM, NULL };
+ const char   *opt_launcher[3] = { DEF_LAUNCHER, DEF_LAUNCHER, NULL };
  int          opt_bw = DEF_BW;
  #ifdef SNAP
  int          opt_snap = 0;
***************
*** 83,88 ****
--- 84,90 ----
  #endif
      { "-bw", OPT_INT, &opt_bw },
      { "-term", OPT_STRING, &opt_term[0] },
+     { "-launcher", OPT_STRING, &opt_launcher[0] },
  #ifdef SNAP
      { "-snap", OPT_INT, &opt_snap },
  #endif
***************
*** 189,195 ****
              LOG_INFO(" [-app name/class] [-g geometry] [-v vdesk] [-s]");
  #endif
  #ifdef SOLIDDRAG
!             LOG_INFO("\n              [-nosoliddrag]");
  #endif
              LOG_INFO(" [-V]\n");
              if (0 == strcmp(argv[i], "-h") || 0 == strcmp(argv[i], "--help"))
--- 191,197 ----
              LOG_INFO(" [-app name/class] [-g geometry] [-v vdesk] [-s]");
  #endif
  #ifdef SOLIDDRAG
!             LOG_INFO("\n              [-nosoliddrag] [-launcher app]");
  #endif
              LOG_INFO(" [-V]\n");
              if (0 == strcmp(argv[i], "-h") || 0 == strcmp(argv[i], "--help"))
***************
*** 199,205 ****
      }
  
      opt_term[1] = opt_term[0];
! 
      wm_exit = 0;
      act.sa_handler = handle_signal;
      sigemptyset(&act.sa_mask);
--- 201,207 ----
      }
  
      opt_term[1] = opt_term[0];
!     opt_launcher[1] = opt_launcher[0];
      wm_exit = 0;
      act.sa_handler = handle_signal;
      sigemptyset(&act.sa_mask);
diff -crB evilwm-1.0.1/screen.c evilwm-1.0.1-lich/screen.c
*** evilwm-1.0.1/screen.c    2009-03-30 13:37:06.000000000 +0300
--- evilwm-1.0.1-lich/screen.c    2009-10-06 16:36:53.000000000 +0300
***************
*** 460,466 ****
      KEY_FIX, KEY_PREVDESK, KEY_NEXTDESK,
      XK_1, XK_2, XK_3, XK_4, XK_5, XK_6, XK_7, XK_8,
  #endif
!     KEY_NEW, KEY_KILL,
      KEY_TOPLEFT, KEY_TOPRIGHT, KEY_BOTTOMLEFT, KEY_BOTTOMRIGHT,
      KEY_LEFT, KEY_RIGHT, KEY_DOWN, KEY_UP,
      KEY_LOWER, KEY_ALTLOWER, KEY_INFO, KEY_MAXVERT, KEY_MAX
--- 460,466 ----
      KEY_FIX, KEY_PREVDESK, KEY_NEXTDESK,
      XK_1, XK_2, XK_3, XK_4, XK_5, XK_6, XK_7, XK_8,
  #endif
!     KEY_LAUNCHER, KEY_NEW, KEY_KILL,
      KEY_TOPLEFT, KEY_TOPRIGHT, KEY_BOTTOMLEFT, KEY_BOTTOMRIGHT,
      KEY_LEFT, KEY_RIGHT, KEY_DOWN, KEY_UP,
      KEY_LOWER, KEY_ALTLOWER, KEY_INFO, KEY_MAXVERT, KEY_MAX

Enjoy, even though anyone with a minimal C knowledge could have done this smile

Last edited by Lich (2009-10-06 14:06:06)


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#2 2009-10-06 15:17:15

SamC
Member
From: Calgary
Registered: 2008-05-13
Posts: 611
Website

Re: evilwm launcher patch

Another way to do this is by setting something like gmrun or dmenu_run as your terminal, or using xbindkeys to run it.

Offline

#3 2009-10-06 21:48:58

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: evilwm launcher patch

SamC wrote:

Another way to do this is by setting something like gmrun or dmenu_run as your terminal, or using xbindkeys to run it.

Yes, that's how I used it too, but why not have an 'official' option? big_smile


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

Board footer

Powered by FluxBB