LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-23-2018, 03:29 PM   #1
lamic
Member
 
Registered: Jan 2013
Posts: 37

Rep: Reputation: Disabled
Question Lua and Devispie2 window scripting


Lua script only works when the stdout is being displayed. How can i make it work in background?

Code:
if (get_application_name()=="terminator") then
    terminator_window_xid = get_window_xid()
—    debug_print( "terminator_window_xid" )

— set a variable for the number of terminator instances called
  if not terminator_instance then
      terminator_instance = 0
debug_print( "terminator_instance = ", terminator_instance )

  else
      terminator_instance = terminator_instance + 1
debug_print( "terminator_instance = ", terminator_instance )
  end

  if terminator_instance == 0 then
      set_window_workspace( 3 )
      set_window_geometry( 0, 0, 775, 450 )

  elseif terminator_instance == 1 then
      set_window_workspace( 3 )
      set_window_geometry( 961, 0, 960, 540 )

  elseif terminator_instance == 2 then
      set_window_workspace( 3 )
      set_window_geometry( 0, 400, 960, 240 )

  elseif terminator_instance == 3 then
      set_window_workspace( 3 )
      set_window_geometry( 100, 0, 960, 540 )

  else
      set_window_workspace( 3 )

  end
end
Source: https://www.justingedge.com/blog/
 
Old 02-23-2018, 04:26 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,276
Blog Entries: 24

Rep: Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224
I know nothing about Devilspie2 except what I got from a quick look at documentation I just found online.

From that, I think that your script must be invoked by Devilspie2 when found in some config'd directory, and Devispie2 has been started with the WM, and is running in background or as a daemon(?).

Could you be more specific about how you are starting Devispie2, and how are you "backgrounding" it?

Also, what distro and what WM are you using it with?
 
Old 02-24-2018, 12:19 PM   #3
lamic
Member
 
Registered: Jan 2013
Posts: 37

Original Poster
Rep: Reputation: Disabled
I’m using linux mint with Mate desktop manager. The devilspie2 gets auto started with "Startup Applications"
Code:
devilspie2 --folder /home/USER/.scripts/devilspie2/
I store all my other scirpts in .scripts/devilspie2/ dir and they all work, but for the above script to work, I must start the script in another terminal
Code:
 devilspie2 --debug /home/USER/.config/devilspie2/terminator.lua
 
  


Reply

Tags
lua, scripting



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Conky with lua. flyinggeorge Linux - Software 6 06-19-2013 03:00 PM
lua how to get process id? fantasy1215 Programming 1 05-11-2012 04:12 AM
Conky + lua flyinggeorge Linux - Software 6 03-05-2012 08:47 PM
Scripting question: the width of the terminal window Bebo Programming 13 11-06-2003 04:41 PM
Scripting KDE to change window decorations meeshka Linux - Software 2 08-05-2003 06:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration