summary refs log blame commit diff stats
path: root/examples/plugin_new_macro.py
blob: 6757e4916af89b63ca46c1d6e00e3016b68e2b51 (plain) (tree)
1
2
                                            
 
















                                                                            
# Compatible with ranger 1.6.0 through 1.7.*
#
# This plugin adds the new macro %date which is substituted with the current
# date in commands that allow macros.  You can test it with the command
# ":shell echo %date; read"

# Save the original macro function
import ranger.core.actions
old_get_macros = ranger.core.actions.Actions._get_macros

# Define a new macro function
import time
def get_macros_with_date(self):
       macros = old_get_macros(self)
       macros['date'] = time.strftime('%m/%d/%Y')
       return macros

# Overwrite the old one
ranger.core.actions.Actions._get_macros = get_macros_with_date
.5&id=586f66331d1105be03c42e6faeae1672b974a98a'>586f663 ^
366d81e ^

1076f2b
439e15d ^
3399650 ^
1076f2b
439e15d ^
3399650 ^
439e15d ^
1076f2b
3399650 ^
d6e0e6e ^
39677ec ^

3399650 ^
39677ec ^
439e15d ^


366d81e ^
586f663 ^


2a0fc84 ^
366d81e ^
439e15d ^
0053620 ^
3399650 ^



d6e0e6e ^
b9da4b0 ^
a05beb6 ^
2a0fc84 ^
3399650 ^

b9da4b0 ^
439e15d ^
366d81e ^

16c67f3 ^
366d81e ^
b9da4b0 ^



1076f2b
0053620 ^
3399650 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93




                                                              
                   


                 

                      

                            

                             
 
           
                                       

                                          
            

                                                          
               
                                 
                  
                       
                           

                                                             


                     
                     
                      

  


                          

                                

  
                    
                           
                                               
                              
                                
                                      
                                             
 
                  
                                       

                   
                               
 


                       
           


                            
                           
 
              
                                                    



                                   
                                   
                              
                                   
                                  

             
                                                   
 

                          
                                
 



                               
          
                                                           

                                                       
/*
 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
 * See LICENSE file for license details.
 */

#include "config.h"
#include "draw.h"
#include "util.h"

#include <X11/Xutil.h>

#define WM_PROTOCOL_DELWIN 1

typedef struct Client Client;
typedef struct Key Key;

/* atoms */
enum { WMProtocols, WMDelete, WMLast };
enum { NetSupported, NetWMName, NetLast };

/* cursor */
enum { CurNormal, CurResize, CurMove, CurInput, CurLast };

struct Client {
	char name[256], tag[256];
	int proto;
	int x, y, w, h;
	int tx, ty, tw, th;
	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
	long flags; 
	Window win;
	Window trans;
	Window title;
	Client *next;
	Client *snext;
};

struct Key {
	unsigned long mod;
	KeySym keysym;
	void (*func)(void *aux);
	void *aux;
};

extern Display *dpy;
extern Window root, barwin;
extern Atom wm_atom[WMLast], net_atom[NetLast];
extern Cursor cursor[CurLast];
extern XRectangle rect, barrect;
extern Bool running, sel_screen, grid;
extern void (*handler[LASTEvent]) (XEvent *);

extern int screen;
extern char statustext[1024], tag[256];

extern Brush brush;
extern Client *clients, *stack;

/* bar.c */
extern void draw_bar();

/* cmd.c */
extern void run(void *aux);
extern void quit(void *aux);
extern void kill(void *aux);
extern void sel(void *aux);

/* client.c */
extern void manage(Window w, XWindowAttributes *wa);
extern void unmanage(Client *c);
extern Client *getclient(Window w);
extern void focus(Client *c);
extern void update_name(Client *c);
extern void draw_client(Client *c);
extern void resize(Client *c);
extern void update_size(Client *c);
extern Client *gettitle(Window w);

/* event.c */
extern unsigned int discard_events(long even_mask);

/* key.c */
extern void update_keys();
extern void keypress(XEvent *e);

/* mouse.c */
extern void mresize(Client *c);
extern void mmove(Client *c);

/* wm.c */
extern int error_handler(Display *dpy, XErrorEvent *error);
extern void send_message(Window w, Atom a, long value);
extern int win_proto(Window w);