mirror of https://github.com/davatorium/rofi.git
Add support for selecting marks
This commit is contained in:
parent
bd33e93e16
commit
0529d21ffd
|
@ -48,6 +48,9 @@ Settings config = {
|
||||||
.window_key = "F12",
|
.window_key = "F12",
|
||||||
.run_key = "mod1+F2",
|
.run_key = "mod1+F2",
|
||||||
.ssh_key = "mod1+F3",
|
.ssh_key = "mod1+F3",
|
||||||
|
#ifdef I3
|
||||||
|
.mark_key = "mod1+F5",
|
||||||
|
#endif
|
||||||
.location = CENTER,
|
.location = CENTER,
|
||||||
.wmode = VERTICAL,
|
.wmode = VERTICAL,
|
||||||
.inner_margin = 5
|
.inner_margin = 5
|
||||||
|
|
|
@ -21,9 +21,12 @@ simpleswitcher \- a simple EWMH window switcher
|
||||||
.IR combo ]
|
.IR combo ]
|
||||||
.RB [ \-dkey
|
.RB [ \-dkey
|
||||||
.IR comdo ]
|
.IR comdo ]
|
||||||
|
.RB [ \-mkey
|
||||||
|
.IR comdo ]
|
||||||
.RB [ \-now ]
|
.RB [ \-now ]
|
||||||
.RB [ \-rnow ]
|
.RB [ \-rnow ]
|
||||||
.RB [ \-snow ]
|
.RB [ \-snow ]
|
||||||
|
.RB [ \-mnow ]
|
||||||
.RB [ \-term
|
.RB [ \-term
|
||||||
.IR terminal ]
|
.IR terminal ]
|
||||||
.RB [ \-loc
|
.RB [ \-loc
|
||||||
|
@ -70,7 +73,7 @@ simpleswitcher -rkey mod1+grave (grave=backtick)
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B -skey
|
.B -skey
|
||||||
Change the key combination to display the ssh dialog (default: mod1-F3).
|
Change the key combination to display the ssh dialog (default: Alt-F3).
|
||||||
.P
|
.P
|
||||||
.RS
|
.RS
|
||||||
simpleswitcher -skey F10
|
simpleswitcher -skey F10
|
||||||
|
@ -80,6 +83,14 @@ simpleswitcher -skey control+shift+s
|
||||||
simpleswitcher -skey mod1+grave (grave=backtick)
|
simpleswitcher -skey mod1+grave (grave=backtick)
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
.B -mkey
|
||||||
|
Change the key combination to display the mark dialog (default: Alt-F5)
|
||||||
|
(only if i3 support is enabled).
|
||||||
|
.P
|
||||||
|
.RS
|
||||||
|
simpleswitcher -mkey Alt-F2
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
.B -now
|
.B -now
|
||||||
Run simpleswitcher in all-windows mode once then exit. Does not bind any keys.
|
Run simpleswitcher in all-windows mode once then exit. Does not bind any keys.
|
||||||
.TP
|
.TP
|
||||||
|
@ -89,6 +100,10 @@ Run simpleswitcher in run-dialog mode once then exit. Does not bind any keys.
|
||||||
.B -snow
|
.B -snow
|
||||||
Run simpleswitcher in ssh mode once then exit. Does not bind any keys.
|
Run simpleswitcher in ssh mode once then exit. Does not bind any keys.
|
||||||
.TP
|
.TP
|
||||||
|
.B -mnow
|
||||||
|
Run simpleswitcher in mark mode once then exit. Does not bind any keys (only if i3 support is
|
||||||
|
enabled).
|
||||||
|
.TP
|
||||||
.B -bg
|
.B -bg
|
||||||
Set the background text color (X11 named color or hex #rrggbb) for the menu (default: #222222).
|
Set the background text color (X11 named color or hex #rrggbb) for the menu (default: #222222).
|
||||||
.P
|
.P
|
||||||
|
|
|
@ -10,11 +10,17 @@
|
||||||
#define INTERSECT(x,y,w,h,x1,y1,w1,h1) (OVERLAP((x),(w),(x1),(w1)) && OVERLAP((y),(h),(y1),(h1)))
|
#define INTERSECT(x,y,w,h,x1,y1,w1,h1) (OVERLAP((x),(w),(x1),(w1)) && OVERLAP((y),(h),(y1),(h1)))
|
||||||
|
|
||||||
extern const char *cache_dir;
|
extern const char *cache_dir;
|
||||||
|
#ifdef I3
|
||||||
|
extern char *i3_socket_path;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
WINDOW_SWITCHER,
|
WINDOW_SWITCHER,
|
||||||
RUN_DIALOG,
|
RUN_DIALOG,
|
||||||
SSH_DIALOG,
|
SSH_DIALOG,
|
||||||
|
#ifdef I3
|
||||||
|
MARK_DIALOG,
|
||||||
|
#endif
|
||||||
NUM_DIALOGS,
|
NUM_DIALOGS,
|
||||||
MODE_EXIT,
|
MODE_EXIT,
|
||||||
NEXT_DIALOG
|
NEXT_DIALOG
|
||||||
|
@ -82,6 +88,9 @@ typedef struct _Settings {
|
||||||
WindowLocation location;
|
WindowLocation location;
|
||||||
WindowMode wmode;
|
WindowMode wmode;
|
||||||
unsigned int inner_margin;
|
unsigned int inner_margin;
|
||||||
|
#ifdef I3
|
||||||
|
char * mark_key;
|
||||||
|
#endif
|
||||||
} Settings;
|
} Settings;
|
||||||
|
|
||||||
extern Settings config;
|
extern Settings config;
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
#include "simpleswitcher.h"
|
#include "simpleswitcher.h"
|
||||||
#include "run-dialog.h"
|
#include "run-dialog.h"
|
||||||
#include "ssh-dialog.h"
|
#include "ssh-dialog.h"
|
||||||
|
#include "mark-dialog.h"
|
||||||
|
|
||||||
#define LINE_MARGIN 4
|
#define LINE_MARGIN 4
|
||||||
|
|
||||||
|
@ -649,6 +650,12 @@ unsigned int rundialog_modmask;
|
||||||
KeySym rundialog_keysym;
|
KeySym rundialog_keysym;
|
||||||
unsigned int sshdialog_modmask;
|
unsigned int sshdialog_modmask;
|
||||||
KeySym sshdialog_keysym;
|
KeySym sshdialog_keysym;
|
||||||
|
|
||||||
|
#ifdef I3
|
||||||
|
unsigned int markdialog_modmask;
|
||||||
|
KeySym markdialog_keysym;
|
||||||
|
#endif
|
||||||
|
|
||||||
Window main_window = None;
|
Window main_window = None;
|
||||||
GC gc = NULL;
|
GC gc = NULL;
|
||||||
|
|
||||||
|
@ -1178,7 +1185,11 @@ void run_switcher( int fmode, SwitcherMode mode )
|
||||||
} else if ( mode == SSH_DIALOG ) {
|
} else if ( mode == SSH_DIALOG ) {
|
||||||
retv = ssh_switcher_dialog( &input );
|
retv = ssh_switcher_dialog( &input );
|
||||||
}
|
}
|
||||||
|
#ifdef I3
|
||||||
|
else if ( mode == MARK_DIALOG ) {
|
||||||
|
retv = mark_switcher_dialog ( &input );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if ( retv == NEXT_DIALOG ) {
|
if ( retv == NEXT_DIALOG ) {
|
||||||
mode = ( mode+1 )%NUM_DIALOGS;
|
mode = ( mode+1 )%NUM_DIALOGS;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1214,6 +1225,12 @@ void handle_keypress( XEvent *ev )
|
||||||
key == sshdialog_keysym ) {
|
key == sshdialog_keysym ) {
|
||||||
run_switcher( FORK , SSH_DIALOG );
|
run_switcher( FORK , SSH_DIALOG );
|
||||||
}
|
}
|
||||||
|
#ifdef I3
|
||||||
|
if ( ( markdialog_modmask == AnyModifier || ev->xkey.state & markdialog_modmask ) &&
|
||||||
|
key == markdialog_keysym ) {
|
||||||
|
run_switcher( FORK , MARK_DIALOG );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert a Mod+key arg to mod mask and keysym
|
// convert a Mod+key arg to mod mask and keysym
|
||||||
|
@ -1389,21 +1406,31 @@ int main( int argc, char *argv[] )
|
||||||
run_switcher( NOFORK, RUN_DIALOG );
|
run_switcher( NOFORK, RUN_DIALOG );
|
||||||
} else if ( find_arg( argc, argv, "-snow" ) >= 0 ) {
|
} else if ( find_arg( argc, argv, "-snow" ) >= 0 ) {
|
||||||
run_switcher( NOFORK, SSH_DIALOG );
|
run_switcher( NOFORK, SSH_DIALOG );
|
||||||
|
#ifdef I3
|
||||||
|
} else if ( find_arg( argc, argv, "-mnow" ) >= 0 ) {
|
||||||
|
run_switcher( NOFORK, MARK_DIALOG );
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// Daemon mode, Listen to key presses..
|
// Daemon mode, Listen to key presses..
|
||||||
|
|
||||||
find_arg_str( argc, argv, "-key", &( config.window_key ) );
|
find_arg_str( argc, argv, "-key", &( config.window_key ) );
|
||||||
find_arg_str( argc, argv, "-rkey",&( config.run_key ) );
|
|
||||||
find_arg_str( argc, argv, "-skey",&( config.ssh_key ) );
|
|
||||||
|
|
||||||
parse_key( config.window_key, &windows_modmask, &windows_keysym );
|
parse_key( config.window_key, &windows_modmask, &windows_keysym );
|
||||||
parse_key( config.run_key, &rundialog_modmask, &rundialog_keysym );
|
|
||||||
parse_key( config.ssh_key, &sshdialog_modmask, &sshdialog_keysym );
|
|
||||||
|
|
||||||
// bind key combos
|
|
||||||
grab_key( windows_modmask, windows_keysym );
|
grab_key( windows_modmask, windows_keysym );
|
||||||
|
|
||||||
|
find_arg_str( argc, argv, "-rkey",&( config.run_key ) );
|
||||||
|
parse_key( config.run_key, &rundialog_modmask, &rundialog_keysym );
|
||||||
grab_key( rundialog_modmask, rundialog_keysym );
|
grab_key( rundialog_modmask, rundialog_keysym );
|
||||||
|
|
||||||
|
find_arg_str( argc, argv, "-skey",&( config.ssh_key ) );
|
||||||
|
parse_key( config.ssh_key, &sshdialog_modmask, &sshdialog_keysym );
|
||||||
grab_key( sshdialog_modmask, sshdialog_keysym );
|
grab_key( sshdialog_modmask, sshdialog_keysym );
|
||||||
|
// bind key combos
|
||||||
|
#ifdef I3
|
||||||
|
find_arg_str( argc, argv, "-mkey",&( config.mark_key ) );
|
||||||
|
parse_key( config.mark_key, &markdialog_modmask, &markdialog_keysym );
|
||||||
|
grab_key( markdialog_modmask, markdialog_keysym );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue