Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-07-09 00:56:12

Mellowbob
Member
Registered: 2011-10-16
Posts: 286

Force window to start tiled

I've got a little shell script that opens 2 windows, a pdf viewer and a copy of emacs. I want the viewer to open tiled (snapped) to the left side of the screen and the editor to the right. I certainly can do this manually, but there must be a way to automate it? Oh, and I don't want the 2 programs to always behave this way, just when I call it from the script.

Thanks.

Offline

#2 2020-07-09 01:36:12

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,486

Re: Force window to start tiled

Assuming that you have Snap Left and Snap Right set to Ctrl+Left and Ctrl+Right respectively in Settings Manager > Window Manager > Keyboard, and you have xdotool installed, you can use a script like this:

#!/bin/bash

emacs &
sleep 1
xdotool key Ctrl+Right
atril &
sleep 1
xdotool key Ctrl+Left

Note, I'm using atril as the pdf viewer. Change the applications and sleep values to suit.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2020-07-09 02:31:38

Mellowbob
Member
Registered: 2011-10-16
Posts: 286

Re: Force window to start tiled

I'll have to review xdotool ... but right now it's not working for me. Making sure I did not copy incorrectly, I have:

#!/bin/bash

emacs &
sleep 1
xdotool key Ctrl+Right
atril &
sleep 1
xdotool key Ctrl+Left

But I just get a regular emacs and atril. Running the script in the background makes no difference.

My xdotool is: xdotool version 3.20160805.1

Doing a very quick scan of the manual, it seems I need a window id? But I'm really not sure.

Offline

#4 2020-07-09 11:22:22

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,486

Re: Force window to start tiled

Does Ctrl+Left tile the window to the left for you for any application? Maybe the keyboard shortcut is different. Check in Settings Manager > Window Manager > Keyboard to see what your "Tile window to the left" keyboard shortcut is.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2020-07-09 16:14:49

Mellowbob
Member
Registered: 2011-10-16
Posts: 286

Re: Force window to start tiled

Not ctrl-left/right on this system. There is no reference to tiling in keyboard at all. However, the function does work via Super-Left/Right, etc. I'll try the script later and let you know.

Offline

#6 2020-07-09 23:56:37

Mellowbob
Member
Registered: 2011-10-16
Posts: 286

Re: Force window to start tiled

Works perfectly with Super-Left, etc. Thanks for the help.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.008 seconds, 7 queries executed - Memory usage: 535.01 KiB (Peak: 535.85 KiB) ]