SliTaz SliTaz Forum

You are not logged in.

#1 2015-06-23 21:23:13

TraceE
Member
Registered: 2014-02-02
Posts: 112

Best place to put an xrandr script so that it runs at startup?

I would like to experiment with xrandr scripts to turn off my laptop internal screen when my external HDTV screen is connected ....... e.g.:

#!/bin/bash

IN="LVDS1"

EXT="VGA1"

if (xrandr | grep "$EXT disconnected"); then

    xrandr --output $EXT --off --output $IN --auto

else

    xrandr --output $IN --off --output $EXT --auto

fi

Where would be the best place to save it for it to be run automatically at startup?

Is the script above suitable for Slitaz?

Offline

#2 2015-06-23 22:53:14

kubepc
Member
Registered: 2014-05-14
Posts: 86

Re: Best place to put an xrandr script so that it runs at startup?

Hi TraceE,

my screen 1920x1200 wasn't recognized from slitaz-rolling.iso. Setting it up with tazx created for the user tux a file

/home/tux/.config/autostart/lxrandr-autostart.desktop

[Desktop Entry]

Type=Application

Name=LXRandR autostart

Comment=Start xrandr with settings done in LXRandR

Exec=sh -c 'xrandr --output HDMI1 --mode 1920x1200 --same-as LVDS1 --output LVDS1 --off'

OnlyShowIn=LXDE

I think, this place could be suitable for Your script too, for my modified iso I placed it at

/etc/skel/.config/autostart/lxrandr-autostart.desktop

in a rootfs0.gz and it worked fine for me with last weeks slitaz-rolling.iso.

Offline

#3 2015-06-23 23:16:54

lexeii
Administrator
Registered: 2012-03-21
Posts: 1,853

Re: Best place to put an xrandr script so that it runs at startup?

Hi TraceE,

I not used Bash, but seems your script works with the SliTaz default Busybox's Shell too.

There exists other form of checking, usually I wrote:

[c]if xrandr | grep -q "$EXT disconnected"; then[/c]

instead of:

[c]if (xrandr | grep "$EXT disconnected"); then[/c]

And you can use kubepc's desktop file as-is, or change line "Exec=/full/path/to/your/executable/script"

Offline

#4 2015-06-24 02:54:02

TraceE
Member
Registered: 2014-02-02
Posts: 112

Re: Best place to put an xrandr script so that it runs at startup?

Thanks for the replies .... I am using version 4.0 still  .... I will try your suggestions and let you know what happens ... smile

Offline

#5 2015-06-25 04:47:54

TraceE
Member
Registered: 2014-02-02
Posts: 112

Re: Best place to put an xrandr script so that it runs at startup?

It didn't go very well .....I tried kubepc's file with the resolution etc. changed to suit, saved to usb using:

tazusb writefs gzip

and now I'm getting

"Failed to execute login command" .....

I can still log into root ... any advice on how to get tux working again?

Offline

#6 2015-06-25 06:46:37

kubepc
Member
Registered: 2014-05-14
Posts: 86

Re: Best place to put an xrandr script so that it runs at startup?

Hi TraceE,

sorry my first solution belonged to experiences with slitaz-rolling.iso. In SliTaz 4.0 (4 in 1 design) I used a different solution for my intel graphics. I used the boot parameter screen=1920x1080x24, which does not exist in 5.0 rolling, but in tazx of SliTaz 4.0. Booting frugal I used in menu.lst the following lines:

title SliTaz 4.0 GNU/Linux English US 1920x1080x24

root (hd0,0)/boot

kernel /bzImage lang=en_US kmap=us screen=1920x1080x24 rw autologin

initrd /rootfs4.gz /rootfs3.gz /rootfs2.gz /rootfs1.gz

with the original bzImage, rootfs4.gz, rootfs3.gz, rootfs2.gz, rootfs1.gz from slitaz-4.0.iso.

Offline

#7 2015-06-25 14:31:11

TraceE
Member
Registered: 2014-02-02
Posts: 112

Re: Best place to put an xrandr script so that it runs at startup?

I am stuck trying to get logged into tux at the moment .... I have logged into root and reversed the changes that I made to the

/home/tux/.config/autostart/lxrandr-autostart.desktop

file that seemed to cause this .... but it has not fixed it and I am still getting

"Failed to execute login command"

when trying to autolog into tux ...... anyone else had this and managed to fix it?

Offline

#8 2015-06-25 17:13:18

kubepc
Member
Registered: 2014-05-14
Posts: 86

Re: Best place to put an xrandr script so that it runs at startup?

Hi TraceE,

maybe the SliTaz Login Manager configuration file (/etc/slim.conf) has been changed though this trouble. This is my original file for the default user tux, maybe Your default user has changed:

# /etc/slim.conf: Slim login manger configuration file

#

# Path, X server and arguments (if needed)

# Note: -xauth $authfile is automatically appended

default_path        ./:/bin:/usr/bin:/usr/local/bin

default_xserver     /usr/bin/Xorg

#xserver_arguments

# Commands for halt, login, etc.

halt_cmd            /sbin/poweroff

reboot_cmd          /sbin/reboot

console_cmd         /usr/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -l -c "exec /bin/login"

#suspend_cmd         /usr/sbin/suspend

# Full path to the xauth binary

xauth_path          /usr/bin/xauth

# Xauth file for server

authfile            /var/run/slim.auth

# Activate numlock when slim starts. Valid values: on|off

# numlock             on

# Hide the mouse cursor (note: does not work with some WMs).

# Valid values: true|false

hidecursor          true

# This command is executed after a succesful login.

# you can place the %session and %theme variables

# to handle launching of specific commands in .xinitrc

# depending of chosen session and slim theme

login_cmd           exec /bin/sh -l ~/.xinitrc %session

# Commands executed when starting and exiting a session.

# They can be used for registering a X11 session with

# sessreg. You can use the %user variable

#

# sessionstart_cmd    some command

# sessionstop_cmd    some command

# Start in daemon mode. Valid values: yes | no

# Note that this can overridden by the command line

# option "-d"

#daemon                yes

# Available sessions (first one is the default).

# The current chosen session name is replaced in the login_cmd

# above, so your login command can handle different sessions.

# see the xinitrc.sample file shipped with slim sources

sessions            openbox,e17,jwm

# Executed when pressing F11 (requires imagemagick)

#screenshot_cmd      mtpaint -s /root/slim-shot.png

# welcome message. Available variables: %host, %domain

welcome_msg         Welcome to %host

# shutdown / reboot messages

shutdown_msg       The system is going down...

reboot_msg         The system is rebooting...

# default user, leave blank or remove this line

# for avoid pre-loading the username.

default_user        tux

# current theme, use comma separated list to specify a set to

# randomly choose from

current_theme       slitaz

# Lock file

lockfile            /var/lock/slim.lock

# Log file

logfile             /var/log/slim.log

# Let normal users have access to systems commands. If the value is true,

# then the root password is requiered to start a system command.

# Valid values: true|false

# root_password false

I hope, that this helps or that somebody else gives You a good advice or that You find a solution by Yourself. Sorry I don't know how to help You in a better way, especially I have no experience in removing or creating users in SliTaz.

Offline

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

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.018 seconds, 7 queries executed - Memory usage: 1.55 MiB (Peak: 1.77 MiB) ]