The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

Idea for Restoring Windows on Login

asked 2013-08-26 16:26:43 +0000

drak3 gravatar image

I have an idea for restoring a specific window setup on login.

for a given window setup, there is a sequence of key combinations which should yield this setup. My idea is to store this sequence in a script to be run on login. Catch is, I have no idea how to store this sequence of key combinations.

I'm wondering if anyone knows how this might be done?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2013-08-26 20:49:46 +0000

drak3 gravatar image

updated 2013-08-27 02:00:45 +0000

Ok, so far I've managed to kinda figure this out.

I use xdotool to issue commands to X through a shell script. It would have to be run on login. (I have to do it manually, but I think thats bc Ubuntu is stupid) The example below switches to tabbed layout, uses dmenu to search for gnome-terminal, opens it, then runs archey.

xdotool key Alt_L+w
xdotool key Alt_L+d
xdotool type gnome-terminal
xdotool key Return
sleep .5  #small delay to allow terminal to open
xdotool type archey
xdotool key Return

Use xev to determine what the key codes are. For some unknown reason xdotool key Alt_L+Return does not open a new terminal...

Obviously change things as needed, for you, but this seems to work.

I hope this will be useful to somebody.

edit flag offensive delete link more

Comments

You can also use the i3 ipc interface to do this more easily: http://i3wm.org/docs/ipc.html

Michael gravatar imageMichael ( 2013-08-27 06:49:26 +0000 )edit
Michael gravatar imageMichael ( 2013-08-27 06:49:54 +0000 )edit

tbh, passing the key sequences to the WM seems simpler, and I haven't the slightest clue how i'd go about using this to pass something like alt+enter to i3. maybe its just way too late, but the example of issuing "exit" seems overly simple.

drak3 gravatar imagedrak3 ( 2013-08-27 07:11:22 +0000 )edit

You don’t pass Alt+Enter, you pass whatever you would bind to Alt+Enter to it. E.g., if Alt+Enter is bound to “exec urxvt”, just send “exec urxvt”. This works with every key binding.

Michael gravatar imageMichael ( 2013-09-26 16:48:06 +0000 )edit

Thanks! this makes launching utilities much less awkward, but how would it be used to reposition windows?

drak3 gravatar imagedrak3 ( 2013-09-26 17:46:28 +0000 )edit

Question Tools

Stats

Asked: 2013-08-26 16:26:43 +0000

Seen: 305 times

Last updated: Aug 27 '13