【求助】开机打开程序的bash命令
Tofloor
poster avatar
不避风云
deepin
2016-04-19 16:56
Author
本帖最后由 bubifengyun 于 2016-4-19 09:05 编辑

每天都要写代码,天天都需要关机开机。
每次开机都要先打开vim,打开firefox,打开vscode,打开一个chm文件。
然后把他们分别放在四个桌面,一个写代码,一个测试代码,一个记录问题做笔记,一个查阅资料。
哪位大神可否给提供一个shell代码,实现一个脚本程序,做到代替开机的这些工作,然后把他们分别放在不同的桌面下。
先谢谢啦。
其中打开这四个程序的脚本,分别如下。

  1. $ vim
  2. ## change to another terminal
  3. $ firefox
  4. ## change to another terminal
  5. $ vscode
  6. ## change to another terminal
  7. $ chmsee xx.chm
Copy the Code


我可以实现在同一个脚本下打开,但是都在同一桌面下。

```bash
  1. firefox &
  2. vscode &
  3. chmsee xx.chm &
  4. vim -p xx.php xxx.php
Copy the Code


```

先谢谢啦。
Reply Favorite View the author
All Replies
avatar
MattD
deepin
2016-04-19 18:31
#1
用wmctrl实现,试试改成以下形式:
  1. #!/bin/bash
  2. firefox &
  3. vscode &
  4. chmsee xx.chm &
  5. vim -p xx.php xxx.php &
  6. sleep 10

  7. wmctrl -r firefox -t 0
  8. wmctrl -r vscode -t 1
  9. wmctrl -r chmsee -t 2
  10. wmctrl -r vim -t 3
Copy the Code


Reply View the author
Comments
bubifengyun
2016-04-30 20:06
不错,不过安装wmCtrl 后,系统出现好多问题。而且那个CHMsee一点都不配合。折腾了一下,还是把wm Ctrl给删了,凑合着慢慢一个个打开吧。
avatar
yutent
deepin
2016-04-22 04:33
#2
It has been deleted!