You are not logged in.

#1 2016-03-03 17:53:06

slackista
Member
Registered: 2016-03-03
Posts: 1

Dockscript as systemd service to rename xorg.conf on boot

I use Arch for a while on my Thinkpad T520 with Optimus connected to external monitor via Displayport on docking station. Unfortunately Displayport is hardwired to nvidia chip hence I'm using nvidia proprietary driver with xorg.conf (nouveau is to slow cause still lack of Fermi reclocking). My goal is to have Optimus enabled and when boot undocked systemd service trigger bbswitch to turn off nvidia and rename xorg.conf file ex. xorg.conf.intel. When boot docked bbswitch on nvidia and rename to xorg.conf.
According to wiki: https://wiki.archlinux.org/index.php/Le … kPad_T420s there is a inird script:

/etc/rc.d/dockscript

#!/bin/bash
dock_usb_id="17ef:100a Lenovo ThinkPad Mini Dock Plus Series 3"
dock_xorg_file=/etc/X11/xorg.conf.nvidia
xorg_file=/etc/X11/xorg.conf

. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
  start)
    stat_busy "Starting Dock Detection"
    lsusb | grep "$dock_usb_id" > /dev/null
    if [ $? -eq 0 ]; then
      tee /proc/acpi/bbswitch <<<ON
      cp "$dock_xorg_file" "$xorg_file"
    else
      rm "$xorg_file"
    fi
    stat_done
    ;;
  stop)
    stat_busy "Stopping Dock Detection"
    rm "$xorg_file"
    tee /proc/acpi/bbswitch <<<OFF
    stat_done
    ;;
  restart)
    $0 stop
    sleep 3
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

How to create correct systemd service based on that?

Last edited by slackista (2016-03-03 17:59:54)

Offline

#2 2016-03-03 21:31:55

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: Dockscript as systemd service to rename xorg.conf on boot

Offline

Board footer

Powered by FluxBB