Coder Social home page Coder Social logo

Comments (8)

vstath avatar vstath commented on May 26, 2024

I just realized that if focus is on the terminal window then < Ctrl >m does not seem to work. If I switch focus on another window then it works fine !?!?!?

from tym.

endaaman avatar endaaman commented on May 26, 2024

Can you show me your machine environment (OS, desktop env, window manager etc...) and the minimal config Lua code to reproduce the situation?

The following code seems to work correctly for me on my env.

local tym = require 'tym'

tym.set('shell', 'sh')

tym.set_timeout(function()
  tym.send_key('<Ctrl>m')
  return true
end, 1000)

My machine info:

  • Arch Linux
  • MATE
  • Marco

from tym.

vstath avatar vstath commented on May 26, 2024

I am using i3wm in Linux Mint 19.1 Tessa

When focus is on another window the code above works fine and presses enter every second. When focus is on the terminal window then it does not work :-)

It's very weird but probably is an i3wm issue? I will look into it from that angle.

from tym.

endaaman avatar endaaman commented on May 26, 2024
local tym = require 'tym'

tym.set('shell', 'sh')

tym.set_timeout(function()
  -- tym.send_key('<Ctrl>m')
  print('hoge')
  return true
end, 1000)

Does above code work correctly (logs will be printed) when the window has focus? Please launch tym from command line like $ tym -u /path/to/config.lua and confirm it.

If it works, it follows that the problem comes from set_timeout() not from send_key(). I have never used i3 so I want you to check it.

from tym.

vstath avatar vstath commented on May 26, 2024

Ok, let me explain the setup.

i3 windows manager has hotkeys (the most prominent one to start a terminal). So typically the mod key is Alt or Super.

My combination is Super+t to start a terminal.

Now, if I run tym within the default i3 terminal, it works fine (so tym terminal executed within i3 default terminal let's say). The "hoge" is printed etc. Note that it is printed on the i3 default terminal, not in the new window of tym.

But when I press Super+t (ie tym starts on its own window as a standalone application) then "hoge" is not printed, even if focus goes to another window. I assume your desired outcome would be that "hoge" shows within tym window, right?

Naturally, I would like to use tym as my default terminal (and script it and automate it in my favorite Lua). Perhaps that's not the intended way of using it? Should tym run from another terminal???

I will try to make a video and demonstrate.

from tym.

vstath avatar vstath commented on May 26, 2024

Let me verify first with i3 people because xdotools does not send keys to another window so it may be related.

from tym.

endaaman avatar endaaman commented on May 26, 2024

Just for testing I asked to launch from command line. You can use tym same as any other terminals.

When you have a problem using my first code, we can't aware whether set_timeout() or send_key() causes the problem. So if you launch tym from another terminal and see logs whether active or inactive, it follows that send_key() causes it and set_timeout() is not broken. But when you launch tym by pressing shortcut key or clicking a desktop entry file such as tym.desktop you can't see logs, so you need to launch tym from command line.

If the problem comes from send_key(), It is definitely related to the behavior of xdotools. It is good to verify with them.

from tym.

endaaman avatar endaaman commented on May 26, 2024

At least either tym.send_key('<Ctrl>m') or tym.send_key('KP_Enter') works.

from tym.

Related Issues (20)

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.