to rotate gtk application running on text mode of porteus into portrait view?

Technical issues/questions of an intermediate or advanced nature.
mudit.s
White ninja
White ninja
Posts: 15
Joined: 24 Jan 2020, 11:39
Distribution: Porteus 3.2.2 Xfce

to rotate gtk application running on text mode of porteus into portrait view?

Post#1 by mudit.s » 04 Feb 2020, 18:53

I am using porteus on text only with terminal in potrait mode to run the GTK application. I have removed GUI/Desktop mode.
I used 'startx' and 'xinit' without using x server.

The application is able to run, but it is running in landscape view only while I am using porteus in text mode with portrait view.

I tried the following commands,

Code: Select all

  $ xinit ./(gtk application)
I also tried to embed 'xinit' with 'xrandr -o left ' as below,

Code: Select all

 $ xinit && xrandr -o left ./(gtk application)
but above is also not making the application run in the portrait mode.

However when I tried the 'xinit' command alone, then a temporary **xserver** white window of **xinit** opens up in the landscape view, where I was able to run and rotate the application in portrait view using *'xrandr -o left'* command followed by application running as below mentioned,

In the text mode console

Code: Select all

 $ xinit
In the 'xinit' white console

Code: Select all

$ xrandr -o left
$ ./(gtk_application)
But I want to make application run and rotate in portrait view using a single line command on text mode console only, with or without writing any script.

I tried to make a script with the above commands and run it, still I didn't get the application running on the porteus mode.

I used xvfb also to run the gtk application using

Code: Select all

xvfb-run ./(gtk application)
command but nothing seems to be promising

Any suggestions would be surely appreciated.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

to rotate gtk application running on text mode of porteus into portrait view?

Post#2 by Rava » 07 Mar 2020, 21:03

Since I have not the setup for testing it, I cannot give you a working solution you want.
For using xrandr I created these scripts alone on one machine:

Code: Select all

root@porteus:/usr/local/bin# l monitorrotate.*
-rwxr-xr-x 1 root 37 2019-01-07 12:44 monitorrotate.HDMI-0.left
-rwxr-xr-x 1 root 39 2019-01-07 12:44 monitorrotate.HDMI-0.normal
-rwxr-xr-x 1 root 38 2019-07-01 05:31 monitorrotate.HDMI-0.right
-rwxr-xr-x 1 root 39 2020-02-10 06:51 monitorrotate.HDMI-1.normal
-rwxr-xr-x 1 root 38 2020-02-10 06:53 monitorrotate.HDMI-1.right
-rwxr-xr-x 1 root 41 2019-06-19 05:03 monitorrotate.LVDS-0.inverted
-rwxr-xr-x 1 root 37 2019-06-02 07:20 monitorrotate.LVDS-0.left
-rwxr-xr-x 1 root 39 2019-06-02 07:20 monitorrotate.LVDS-0.normal
-rwxr-xr-x 1 root 38 2019-06-02 07:21 monitorrotate.LVDS-0.right
Why so many one might ask? Because the internal monitor of the laptop is usually switched off, but when I use it, it is LVDS-0.
The HDMI is usually HDMII-0, but at times the system thinks it is HDMI-1 (even though I only have one HDMI port on that machine), so I created a new set of scripts to handle the unlikely event when again HDMI is discovered and handled as HDMI-1.

I have no clue if this is even helpful to you, but in my case I also need to specify the device or the monitor won't rotate. (Maybe that is only the case when there are more than one physical monitor possibilities present in the current machine.)

Therefore I give you some examples taken from my above scripts:

Code: Select all

xrandr --output HDMI-0 --rotate normal
xrandr --output LVDS-0 --rotate left
Anyhow, why can't you use xrandr to rotate and run the program you want?

I don't see the issue for having a script for that. You could e.g. create a script that first does the rotate you want, and then starts the program given as first parameter. So you would only need one script to rule them all rotate the monitor and start any program you need.
Be aware that you need to put $1 into " when it might contain whitespace and also you need to use $* when you have to include parameters for the program.
Cheers!
Yours Rava

Post Reply