Code Monkey home page Code Monkey logo

shellex's People

Contributors

breunigs avatar joker234 avatar merovius avatar pseyfert avatar stapelberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

shellex's Issues

Auto-open terminal for terminal based application when needed

Sometimes, we open a launcher with alt+F2 but we need to open terminal-based app.
So, is it possible to make shellex in this situations to autodetect this need and open a terminal with the asked command in it?

As example, supose I try to run vim on shellex, not gvim but vim, so currently nothing happend.
Ideally, shellex should open a urxvt (or other terminal) with vim on it.

multicommand launch

currently launching several applications at once fails to quit shellex:

  • start shellex
  • type "programA&programB&otherstuff"
  • hit return
  • all three programs open, shellex doesn't close but shows the error "zsh: you have running jobs". shellex grabs inputs

usecase:

  • i frequently start multiple programs at a time ("oh yeah i ended up where they have internet, lets check mails and log on to instant messenger, and browse the web + more")
  • aliassing this is undesired since now and then individual programs get dropped ("i don't want to talk to people, no instant messenger", "i'm on vacation, no mails") and having multiple aliasses for all the combinations is bad.

shellex size determination fails with lxde/openbox on workspaces without windows

Triggered by the investigation of #57 I checked how shellex launches on empty workspaces in lxde/openbox and got as output (with some extra printouts from me):

position should be at the top
Getting shellex-position from focused window
Get outputs
urxvt: An X Error occurred, trying to continue after report.
urxvt: + Serial number of failed request:  136
urxvt: + X Error of failed request: BadValue (integer parameter out of range for operation)
urxvt: + Major opcode of failed request:  12
urxvt: + (which is X_ConfigureWindow)
urxvt: + Value in failed request:  0x0
line is LVDS-1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 277mm x 156mm
 w=1366 h=768 x=0 y=0
line is VGA-1 connected (normal left inverted right x axis y axis)
 w= h= x= y=
line is HDMI-2 connected (normal left inverted right x axis y axis)
 w= h= x= y=
Got outputs
Got input focus
not DefaultRootWindow
Focus 12583203 (1x1)
writing max rows file done
loading config
add_lines(string = "%")
resizing to -10
size_change(1366, 174)
add_lines(string = "                                                                                                                                                                         \r \r\r")
resizing to -10
add_lines(string = "robusta% ")
resizing to -10
add_lines(string = "u")
resizing to -10
add_lines(string = "unset LD_PRELOAD")
resizing to -10
add_lines(string = "\r\r\n")
resizing to -10
add_lines(string = "%")
resizing to -10
add_lines(string = "                                                                                                                                                                         \r \r\r")

The observations are:

  1. There is an X error happening in get_outputs. This surprises me, as the function only parses the output of xrandr -q (which runs fine when started on its own with a shortcut).
  2. Shellex tries to resize to a negative size. I need more debug output to narrow down where this comes from. In any case, the checks if $nrows is greater than 0 don't work (possibly because $ENV{SHELLEX_MAX_ROWS} is negative).

X-Errors when configuring

On some systems, there is an X-Error when initiallly configuring the window. The problem is this magic constant, it appears, you have to add some pixels, for some reasons, to the fontheight. 2 works on my system, but not on others, so it seems to be dependent on the font or something. It's a minor nuisance, but we should figure out, why we need that and how to get it at runtime.

Use a “prefixe” before each command executed

In i3 specifically, some apps do not opened in the workspace from whom they were called. It’s a weird behaviour.

So, the solution as described here is still to use exec i3 before the command.

So, it would be useful if shellex allow to define of kind of prefix to execute before each command.

Then the expected behavior would be this one:

  1. The user open shellex ;
  2. The user type his command randomcommand;
  3. shellex execute i3 exec randomcommand.

Buffering/showing some output, for errors etc

It would be nice if shellex could show some error-output, so that you don't wonder what is happening, if your command does not start.

We have to think about some magic way to determine, wether output is helpfull or the launcher should be hidden immediately.

dmenu-like completion

shellex should be able to have dmenu-like completion, i.e. typing chess should show a list of all commands containing chess. The user then should be able to shoose one of them with the cursor-keys and hitting return to start it, or space to input command-line parameters or something like that.

TabCompletion works only once

I installed the latest version of shellex (11.05.2014) and I have trouble with the tab-completion shellex offers.
When I try to tabcomplete anything, shellex offers me a list of anything, and then the commandline opens up under these offers, just like the default bash behaviour.
When I then try to tabcomplete anything else, shellex starts to flicker and stops only after pressing a button, or has to be killed manually, and does not tabcomplete.

Since this is one of the major features of shellex, it would be nice if this issue could be resolved.

Refactor debug-output

We have some debug output. We should define a debug-level environment variable and log conditionally

urxvt opens as window instead of as bar when no window has focus (in wayland)

I have installed shellex on my Arch Linux system, which uses wayland with sway. Shellex sometimes (I think in like 10% of the cases I press the key binding) starts as a fullscreen urxvt terminal. Screenshot (taken right after the keybinding for shellex, in a fresh and empty workspace): http://oi65.tinypic.com/241qyv6.jpg

Even if the terminal shows up as a bar at the top of the screen (as intended), a bigger terminal window sometimes flashes for a tiny moment. The problem seems to occur mostly (but not exclusively) when I start shellex (by pressing the keybinding) for the first time in a new/fresh workspace.

I'm not sure if this is related to (or maybe even covered by) #21. More details will be provided if demanded.

Edit: I was sloppy in the original post. In X11, shellex seems to work properly. This issue seems to be (contrary to what I wrote in the first version) exclusive to wayland (possibly to sway).

Don't hardcode paths

Once we are decided on how to bundle/distribute shellex, we should stop hardcoding any paths.

Make multiline-commands work

It is not currently possible to have multiple lines in a command (usefull for e.g. loops) due to shellex wrapping every line in it's magic. Maybe we can think of a way to allow this in the future.

Starting on the right output

shellex should get a list of the randr-outputs, decide on which of them to show the launcher (and at the same time not hardcode the width of the screen).

.zshrc support

I'd really love to see support for custom zsh configuration, as I have customized autocompletion configured.
I tried to remove the -f from shellex.in and it works like a charm. Is there a good reason for the -f to be present or can it just be omitted?

History support

We desperately need to support history. Just adding the HISTFILE etc. options to the config does not appear to work for me, that has to be troubleshooted.

`sub get_outputs` does not filter out connected but inactive monitors

upon modifying urxvt/shellex.in to

sub get_outputs {
    my @outputs = ();
    for my $line (qx(xrandr -q)) {
        next unless $line =~ /\sconnected/;
        my ($w, $h, $x, $y) = ($line =~ /(\d+)x(\d+)\+(\d+)\+(\d+)/);
        print "line is $line w=$w h=$h x=$x y=$y\n";
        push @outputs, { w => $w, h => $h, x => $x, y => $y };
    }   
    return @outputs;
}       

I observe output like:

line is LVDS-1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 277mm x 156mm
 w=1366 h=768 x=0 y=0
line is VGA-1 connected (normal left inverted right x axis y axis)
 w= h= x= y=
line is HDMI-2 connected (normal left inverted right x axis y axis)
 w= h= x= y=

I.e. connected monitors that are not enabled end up as outputs with invalid
geometry. Looking through the help message of xrandr this could be replaced
by

sub new_outputs {
  my @outputs = ();
  for my $line (qx(xrandr --listactivemonitors)) {
    next if $line =~ /Monitors: /;
    # output format is ' 0: +*LVDS-1 1366/277x768/156+0+0  LVDS-1'
    my ($w, $h, $x, $y) = ($line =~ /(\d+)\/\d+x(\d+)\/\d+\+(\d+)\+(\d+)/);
    #print "line is $line w=$w h=$h x=$x y=$y\n";
    push @outputs, { w => $w, h => $h, x => $x, y => $y };
  }
  return @outputs;
}

This parses fewer lines with less input that shellex ignores and does the
filtering of connected devices and active devices on the xrandr side.

encapsulate configuration file variables

Reviewing #66 , I noticed $thefiles leaks into the shellex command
line. It does not make it to the child process (cat $thefiles > /tmp/test yields and empty file) but echo $thefi⇥ completes the
variable name and echo ${f}⇥ substitutes it. Declaring them local
(local -a thefiles) is not an ad-hoc solution as they get solved. Atm
unset thefiles at the end of shellexrc seems good to me, but not to
interfere with possible user variables, I would prefer namespacing the
shell variables in addition. Following typical completion functions,
that would involve leading underscores in the variable name, and
probably even shellex in the name.

I thought a bit if not-unsetting them and make them accessible to the
user (for whatever they would want to do with them … debugging?) but
since the behaviour is inconsistent (accessible to tabbing,
inaccessible to processes), I assume it's not worth it.

Shellex uses the default-resources of urxvt

Though we pass the -name parameter to urxvt, it does not stop it from using the existing urxvt-resources. In some setups this messes up the display of shellex (because we pass -bg and -fg)

urxvt is setgid utmp

Urxvt is setgid utmp in a recent versions. This causes ld.so to ignore LD_PRELOAD, which means we can't lie to the shell about how big the terminal really is, which breaks shellex. This might be the cause of #30.

We need to figure out a way to deal with this. urxvt needs to be setgid utmp, so we need to find a way different from LD_PRELOADing into urxvt to make this work. Options might be:

  1. Inject LD_PRELOAD into the shell and overwrite the TIOCGWINSZ ioctl (instead of the TIOCSWINSZ in urxvt) to lie to the shell instead. This might be the most practical option, though it means we need to be careful about cleaning this up in children started by shellex, so that this doesn't lead to unwanted side-effects (e.g. when starting a terminal with shellex)
  2. Inject the preload-library into urxvt at a later stage from the perl-plugin. It is unclear whether this is practical.
  3. Patch urxvt to allow overwriting the size reported via TIOCSWINSZ via the perl plugin API and getting that upstream. This means convincing upstream that this is a useful feature (and a dependency on a suitable version of urxvt).

Dynamic resizing of the launcher-window

When tab-completion has multiple lines of suggestions or the command contains multiple lines, the urxvt-window should dynamically grow and shrink to accomodate the change.

executing empty lines adds 'exit' to the shellex history

The current empty line treatment is to use ZLE to replace empty lines by exit and then execute exit.
This adds 'exit' to the shellex history. It would be nicer if the behaviour would be similar to pushing escape, which does not leave a trace in the history.

Focus loss

When starting shellex and moving the mouse, focus is sometimes lost.

Long version:
Settings: Archlinux with i3wm with focus_follows_mouse set to no (so mouse movement should not cause focus changes).

When I start shellex (press $mod+d which causes i3wm to do exec /usr/bin/shellex), it launches and I can enter text. However, when I move the mouse the slightest, or if there are no other windows in this workspace, focus is immediateley lost. To regain control of shellex, I have to move the mouse over it.

Allow user configuration to set geometry defaults

When using shellex (in this case with bspwm), there is the possibility that shellex does not find the display dimensions. In this case, setting shellex to appear on the bottom edge puts it in an inaccurate position, with no way (That I am able to see) to change this behavior short of compiling from source with manual edits done to the defaults defined here.

This could presumably be resolved by optionally reading these defaults from .Xresources in the same way that edge and pos are.

Shellex bar doesn't open

I did a fresh install of Arch Linux with i3gaps. I installed shellex via the Arch User Repository (AUR), and configured i3 to bind alt+d to shellex.

When I press alt+d, a dark bar is visible at the top of my screen for about 0.1 second. Running shellex from the terminal gives the following output:

ruben@T410 » shellex                                                                                             ~
position should be at the top
Getting shellex-position from focused window
size_change(1440, 15)
urxvt: An X Error occurred, trying to continue after report.
urxvt: + Serial number of failed request:  147
urxvt: + X Error of failed request: BadValue (integer parameter out of range for operation)
urxvt: + Major opcode of failed request:  12
urxvt: + (which is X_ConfigureWindow)
urxvt: + Value in failed request:  0x0
line_update(row = 0)
resizing to 1
size_change(1440, 17)
line_update(row = 1)
resizing to 1
line_update(row = 2)
resizing to 1
line_update(row = 3)
resizing to 1

(the line_update(row=..) and resizing continues until row = 23).

For me, commenting out the first line of the shellex script in /usr/bin/shellex, fixes the issue (that is, I put changed the line
LD_PRELOAD="/usr/lib/shellex/shellex_preload.so"
to
# LD_PRELOAD="/usr/lib/shellex/shellex_preload.so"

So I do have a workaround for this issue (although I haven't tested it thoroughly). I am reporting this issue just for the record. I can't change the status of this issue myself, so it's "open" for now. I figured that LD_PRELOAD might be doing something important, so it's possible that I will run into other issues as a result later.

when shellex is open PRINTSCRN literally tries to print the screen

I have bound that key in i3 to execute a screenshot-shellscript. This is what strace prints when pressing the prntscrn key:

recvfrom(7, 0x25d8c04, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(3, {{EPOLLIN, {u32=7, u64=4294967303}}}, 64, 59743) = 1
recvfrom(7, "\3\0261\1\221\256w\17\215\0\0\0\20\0\0\2\0\0\0\0\310\1$\3\305\1\370\376\0\0\1\0", 4096, 0, NULL, NULL) = 32
recvfrom(7, 0x25d8c04, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(7, 0x25d8c04, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(3, {{EPOLLIN, {u32=7, u64=4294967303}}}, 64, 59743) = 1
recvfrom(7, "\2k1\1\271\262w\17\215\0\0\0\20\0\0\2\0\0\0\0\310\1$\3\305\1\370\376\0\0\1\0", 4096, 0, NULL, NULL) = 32
recvfrom(7, 0x25d8c04, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
pipe2([10, 11], O_CLOEXEC)              = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4aff19ead0) = 20942
close(10)                               = 0
fcntl(11, F_SETFD, 0)                   = 0
fstat(11, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4aff1d1000
write(11, "shellex>  \n", 11)           = 11
close(11)                               = 0
wait4(20942, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 20942
--- SIGCHLD (Child exited) @ 0 (0) ---
rt_sigreturn(0x100)                     = 20942
munmap(0x7f4aff1d1000, 4096)            = 0
recvfrom(7, 0x25d8c04, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(3, {}, 64, 0)                = 0

This is rather unexpected. shellex should only grab keys zsh actually handles and pass the rest through.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.