Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to test if docked #12

Open
ettom opened this issue Jun 30, 2018 · 6 comments
Open

Add an option to test if docked #12

ettom opened this issue Jun 30, 2018 · 6 comments

Comments

@ettom
Copy link

ettom commented Jun 30, 2018

It would be nice if there was an option to run a command that would test if the laptop is docked. If yes, then switch video modes and run hook scripts. Currently when turning on the laptop when it is docked you have to either physically undock and dock or run dockd --set docked. This feature would eliminate the need to do that.

@ettom
Copy link
Author

ettom commented Jun 30, 2018

I wrote a simple bash script that does that.

#!/bin/bash
   
  string=$(lsusb)
  if [[ $string = *"Dock"* ]]; then
  dockd --set docked
  fi

@etnx
Copy link

etnx commented Sep 6, 2018

Where did you put this script ?

@ettom
Copy link
Author

ettom commented Sep 6, 2018

It depends on your DE. The idea is to run this on startup. I'm running i3 so I added the following line to my i3 config.
exec --no-startup-id ~/.scripts/checkdock.sh

@etnx
Copy link

etnx commented Sep 6, 2018

I'm using LXDE. I have put in my lxsession autostart file
@bash /path/to/script/checkdock.sh
But I see no result.

@ettom
Copy link
Author

ettom commented Sep 7, 2018

Did you make the script executable? Did you try running it manually? You can also try running lsusb while laptop is docked and see if the dock shows up , if it does and the line contains the string "Dock", then the script should work.

@etnx
Copy link

etnx commented Sep 23, 2018

In fact, lsusb does not contain the string "Dock". But lsusb contains a string with my external screen name (let's call it "BlurpBrand"). So, I wrote this :

#!/bin/bash

string=$(lsusb)
if [[ $string = "BlurpBrand" ]]; then
dockd --set docked
fi

It's a bit dirty but it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants