Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long Delay before Action #42

Closed
rubensf opened this issue Jul 2, 2018 · 11 comments
Closed

Long Delay before Action #42

rubensf opened this issue Jul 2, 2018 · 11 comments

Comments

@rubensf
Copy link

rubensf commented Jul 2, 2018

Hi guys, - sorry if I'm making noise - I can get skhd to work but weirdly it gives me a 1-2s delay before actually executing my action. I've tried a minimalistic ~/.skhdrc:

alt - f : echo -e "\a"

# change focus
alt - h : chunkc tiling::window --focus west
alt - j : chunkc tiling::window --focus south
alt - k : chunkc tiling::window --focus north
alt - l : chunkc tiling::window --focus east

I know the problem isn't on chunkc since the beep also takes about a second to come out - any ideas??

Using skhd 0.2.2 on Hish Sierra.

@koekeishiya
Copy link
Owner

You're most likely using a slow shell (fish?). Try to run skhd as follows: SHELL=/bin/bash skhd

@rubensf
Copy link
Author

rubensf commented Jul 2, 2018

Yes I was using fish, and yes that made a huge difference -- thanks! (Maybe worth adding to a FAQ?)

Mind if I also ask how to set it to always start up with bash?

@dominiklohmann
Copy link

Mind if I also ask how to set it to always start up with bash?

Assuming you've installed with brew:

brew edit skhd

Scroll down to the Plist file relevant for you (either with or without logging) and change like this

 <key>EnvironmentVariables</key>
 <dict>
   <key>PATH</key>
   <string>#{HOMEBREW_PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
+  <key>SHELL</key>
+  <string>/bin/bash</string>
 </dict>

@rubensf
Copy link
Author

rubensf commented Jul 2, 2018

Somehow editing with brew edit skhd didn't change the plist opened by brew start - but changing it directly on /usr/local/Cellar/skhd/0.2.2/... did!

Anyway, thanks!

@rubensf rubensf closed this as completed Jul 2, 2018
@dominiklohmann
Copy link

Eh, I forgot mentioning that you need to reinstall with the altered brew formula.

@rubensf
Copy link
Author

rubensf commented Jul 5, 2018

Just an addendum, I figured I had a couple (brew --prefix package) on my config.fish, so fish itself was taking about 2s to startup... So it wasn't so much a fish problem as much as me making awful code problem 🤦‍♂️

chunkhang added a commit to chunkhang/dotfiles that referenced this issue Jun 12, 2019
I noticed a considerable delay in skhd, similar to what was reported by
someone else. The sourcing in zshenv is making the shell slow, so we
need to offload it to zprofile. This file is only sourced for login
shells.

koekeishiya/skhd#42
https://unix.stackexchange.com/a/487889
chunkhang added a commit to chunkhang/dotfiles that referenced this issue Jun 12, 2019
I noticed a considerable delay in skhd, similar to what was reported by
someone else. The sourcing in zshenv is making the shell slow, so we
need to offload it to zprofile. This file is only sourced for login
shells.

koekeishiya/skhd#42
https://unix.stackexchange.com/a/487889
@george43g
Copy link

Incredible - thank you - using fast yabai for the first time in years is a lifechanger - I chose dash as my shell for even better performance.

@pencilcheck
Copy link

The latest skhd changed how it store the launchagent, so you have to run skhd --install-service to get the path then go edit using your own editor of choice

@johannesCmayer
Copy link

johannesCmayer commented Dec 21, 2023

Here is a summary of the current fix all in one message:

Setup SKHD

Set command executing shell

This setup is required when you use chsh to set the default shell to a shell that is prone to slow startup time (e.g. fish).

Use skhd --install-service to determine .plist file. Add the SHELL environment variable at at the right position setting it to the shell you want to use:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	...
    <key>EnvironmentVariables</key>
	...
        <key>SHELL</key>
        <string>/bin/sh</string>
    </dict>
    ...
</dict>
</plist>

Reboot the system. Now your shortcuts should be executed quickly. You can check that it worked with something like:

cmd + ctrl + ralt + shift - b : terminal-notifier -message $SHELL -group system-wide-whisper -timeout 1

@pencilcheck
Copy link

If this can be updated in the README or wiki that would be awesome, I don't know if it is there already but I only got the fix in this thread

@xsova
Copy link

xsova commented Oct 29, 2024

@koekeishiya I am running into this issue (and I'm using darwin-nix to manage/configure it).. I was able to update the nixos.org.skhd.plist file via:

launchd.user.agents = {
    yabai.serviceConfig.EnvironmentVariables.SHELL = "/bin/dash";
    skhd.serviceConfig.EnvironmentVariables.SHELL = "/bin/dash"; # Dash bc bash compatible but faster
};

my configuration includes:

services.skhd.skhdConfig = ''
    cmd - return : alacritty
'';

and when I would run that (i.e., press cmd + return), alacritty launches with /bin/dash as the interactive shell- I'm not entirely sure how that interaction works- but is there a way to make the launch-ing shell = /bin/dash and keep $SHELL as fish in the skhd program's env after launch?

pylbrecht added a commit to pylbrecht/dotfiles that referenced this issue Dec 14, 2024
I manually set `SHELL=/bin/sh` in the `.plist` file, which speeds up
switching workspaces.

koekeishiya/skhd#42 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants