You are not logged in.
I use a thinkpad t460s.
I'd like to modifiy my .xinitrc with something like
cat /proc/acpi....
if (status=docked) then do somethingbut it appears that docking with modern thinkpads is treated more like an event.
Is it still possible to read somewhere the docked/undocked status?
Offline
I doubt you'd find anything in /proc/. I'm pretty sure there'd be some changes in /sys/, but personally I'd take the stupid simple approach. In the case of my x200s and their docking stations:
if [ -e /dev/sr0 ]; then
# ...
fiThis works for the x200s as sr0 is the optical drive present on the dock but not on the laptop itself. The device node is created when/while docked.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
thinkwiki should have most of the relevant information.
http://www.thinkwiki.org/wiki/Docking_Solutions
https://phihag.de/2012/thinkpad-docking.html
You could write a status file when you receive the events.
Last edited by progandy (2018-02-04 03:56:11)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
I had looked into the thinkwiki, but I prefer the stupid simple approach.
Could you guys point to some places where I may look (like /sys /dev ..) in the case of my t460s with ultra dock?
Offline
the one (probably too stupid) I could think of is
xrandr | grep -o 'DP-2-2 connected' | grep -o connectedwith 'if' command.
Offline
Are there no devices on the docking station such that my x200 solution wouldn't work? If you want to use xrandr, don't use 2 greps, and don't use a separate conditional:
if $(xrandr | grep -q 'DP-2-2 connected'); then
# ...
fiAs for telling you what's difference under /sys with and without the dock, I doubt anyone here can unless you find someone with exactly the same model. But you're sitting at the right model now, explore. Or just diff and `ls /dev/` from docked and not to use the device node solution I already posted.
Last edited by Trilby (2018-02-04 12:12:08)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks, I will do some experiments, but already a solution with if and xrandr should do the dirty job ![]()
Offline
Ok, so right now this is my .xinitrc file: does it look fine to you guys?
#!/bin/sh
rm ~/.config/chromium-flags.conf
touch ~/.config/chromium-flags.conf
echo '--password-store=gnome' >> ~/.config/chromium-flags.conf
if $(xrandr | grep -q 'DP-2-2 connected'); then
xrandr --output eDP-1 --off
nmcli radio wifi off
else
xrandr --dpi 216
echo '--force-device-scale-factor=2' >> ~/.config/chromium-flags.conf
nmcli radio wifi on
fi
eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
export SSH_AUTH_SOCK
~/Projects/suckless/dropbox.py start &> dropbox.log
~/Projects/suckless/dwm_status.sh &
udiskie &
feh --bg-center ~/Pictures/m1.jpg
xautolock -time 20 -locker slock &
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec dwmOffline
rm, touch, and echo are all redundant, the last echo is sufficient if you use a single `>` rather than `>>` (or a `>|` if you have 'noclobber' set).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline