ubuntu提升使用体验篇

Gnome自用插件

KDE配置相关

安装GSConnect插件后与其他设备配对

  • 远程锁定/解锁屏幕

    设置方式:Mobile Settings -> Connected Device -> Commands 增加以下两项

    1
    2
    /usr/bin/gnome-screensaver-command -l //锁定屏幕
    /usr/bin/gnome-screensaver-command -d //解锁屏幕

系统快捷键

设置方式:Settings -> Keyboard -> View and Customize Shortcuts -> Custom Shortcuts

  • 快速打开scrcpy

    1. 添加自动检测快捷键

      Name: Scrcpy#~

      Command: /usr/bin/scrcpy-auto-detect

      Shortcut: Ctrl + ~

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      #!/bin/bash

      # 获取所有设备及其状态(排除标题行和空行)
      devices_info=$(adb devices | sed 1d | grep -v '^$')

      # 如果没有设备,提示并退出
      if [ -z "$devices_info" ]; then
      notify-send -i "dialog-error" "设备未连接" "没有找到任何 Android 设备!"
      exit 1
      fi

      # 获取设备总数
      device_count=$(echo "$devices_info" | wc -l)

      if [ "$device_count" -eq 1 ]; then
      # 只有一个设备,直接连接
      device_id=$(echo "$devices_info" | awk '{print $1}')
      scrcpy -s "$device_id"
      else
      # 多个设备,显示选择界面
      device_list=()
      while IFS= read -r line; do
      id=$(echo "$line" | awk '{print $1}')
      status=$(echo "$line" | awk '{print $2}')
      device_list+=("$id" "$status")
      done <<< "$devices_info"

      selected_device=$(zenity --list \
      --title="选择 Android 设备" \
      --text="检测到多个设备,请选择要连接的设备:" \
      --column="设备 ID" --column="状态" \
      "${device_list[@]}")

      # 提取选择的设备 ID(选中的整行内容是"设备ID|状态")
      if [ -n "$selected_device" ]; then
      selected_id=$(echo "$selected_device" | awk -F'|' '{print $1}')
      scrcpy -s "$selected_id"
      fi
      fi

      将以上脚本内容保存到/usr/bin/scrcpy-auto-detect 记得将文件设置为可执行权限

  • 将最近使用的terminal显示在前台(避免打开过多的窗口导致桌面混乱)

    1. 执行sudo apt install xdotool安装软件包

    2. 将以下脚本保存到~/bin/call-recent-terminal下并追加执行可执行权限

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      #!/bin/bash
      if ! which xdotool > /dev/null 2>&1; then
      echo "You need to install xdotool package first."
      echo "sudo apt-get install xdotool"
      exit 1
      fi
      if [[ $(pgrep -x x-terminal-emul) ]]; then
      xdotool windowactivate `xdotool search --pid $(pgrep -x x-terminal-emul) | tail -1`
      else
      x-terminal-emulator
      fi
    3. 添加自定义快捷键

      Name: Launch recent terminal

      Command: ~/bin/call-recent-terminal

      Shortcut:Ctrl + Alt + R

  • 交互式截屏(类似于微信)

    1. 安装软件包sudo apt install flameshot

    2. 添加自定义快捷键

      Name: Take a screenshot interactively plus

      Command: /usr/bin/flameshot gui

      Shortcut:Shift + Ctrl + Alt + T

  • 扫描屏幕二维码

    1. 安装软件包sudo apt install flameshot

    2. 添加自定义快捷键

      Name: Scan QR Code

      Command: bash -c 'qrcode_content=$(flameshot gui -r | zbarimg -1q --raw - 2>/dev/null); if [ -n "$qrcode_content" ]; then echo "$qrcode_content" | xclip -selection clipboard && notify-send -i "dialog-information" "二维码识别成功" "已复制到剪贴板:\n$qrcode_content"; else notify-send -i "dialog-error" "二维码识别失败" "未检测到二维码!"; fi'

      Shortcut: Ctrl + Alt + Q

      1
      2
      3
      4
      5
      6
      7
      8
      #!/bin/bash
      qrcode_content=$(flameshot gui -r | zbarimg -1q --raw - 2>/dev/null)
      if [ -n "$qrcode_content" ]; then
      echo "$qrcode_content" | xclip -selection clipboard
      notify-send -i "dialog-information" "二维码识别成功" "已复制到剪贴板:\n$qrcode_content"
      else
      notify-send -i "dialog-error" "二维码识别失败" "未检测到二维码!"
      fi

      或者保存以上内容到/usr/bin/qrscan然后替换快捷键命令路径

Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2015-2025 Kaisar
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信