1. 程式人生 > >Ubuntu 16.04下快速在當前目錄打開終端的快捷鍵設置

Ubuntu 16.04下快速在當前目錄打開終端的快捷鍵設置

pen 打開終端 span 分享圖片 使用 apt nal 圖片 快捷鍵設置

說明:不一定每次都準確打開,80%的機會是行的。

原理:使用xdotool模擬鍵盤按鍵,打開的文件夾管理界面,然後通過Ctrl+L獲取地址欄地址,然後傳遞到終端上。

安裝:

1、安裝xdotool

sudo apt-get install xdotool 

2、設置腳本

sudo vim /usr/bin/openterminal.sh

寫入以下內容並保存

#!/bin/bash

xclip_tmp=$(xclip -o)
xdotool key Ctrl+l
currnet_dir_path=$(xclip -o)
xdotool key Escape
gnome
-terminal --working-directory=$currnet_dir_path echo $xclip_tmp | xclip -i

設置可執行權限

sudo chmod  +x /usr/bin/openterminal.sh

在鍵盤上設置快捷鍵,如下:

技術分享圖片

3、使用

打開所在文件夾,按【Ctrl】+【L】

參考:

http://forum.ubuntu.org.cn/viewtopic.php?t=476365(腳本轉自此篇文章)

Ubuntu 16.04下快速在當前目錄打開終端的快捷鍵設置