[Share Experiences] 使用xdotool简单实现钉钉窗口快捷键激活
Tofloor
poster avatar
yinshuwei
deepin
2023-08-13 02:27
Author

Linux版钉钉非常简陋,没有快捷键激活/隐藏窗口,这里介绍一个简单的方法,测试可行(按道理其他的程序也可以这样实现)。

一、确保已经安装xdotool

sudo apt install xdotool

二、新建python脚本,记住路径,例如 /opt/py/dingding.py,内容如下

import os


def get_dingding_windows():
    windows = os.popen("xdotool search '^钉钉$'")  # 通过xdotool搜索钉钉窗口
    windows = windows.read()
    windows = [x.strip() for x in windows.split('\n')]
    windows = [x for x in windows if x and 'Defaulting' not in x]
    return windows


def get_active_window():
    window = os.popen('xdotool getactivewindow')  # 通过xdotool获取当前激活窗口
    window = window.read()
    window = window.strip()
    return window


if __name__ == '__main__':
    dingding_windows = get_dingding_windows()
    active_window = get_active_window()
    if active_window in dingding_windows:  # 如果当前窗口是钉钉,最小化
        os.system('xdotool windowminimize %s' % active_window)
    else:  # 如果当前窗口不是钉钉,激活钉钉
        for dingding_window in dingding_windows:
            os.system('xdotool windowactivate %s' % dingding_window)

三、新建快捷键

image.png

image.png
设置好名称,命令(python3 /opt/py/dingding.py),快捷键(自己喜欢的)。

结束

Reply Favorite View the author
All Replies
阿尼樱奈奈
Moderator
2023-08-13 02:52
#1

like

Reply View the author
pyjy
deepin
2023-08-13 05:08
#2

钉钉LINUX版跟WIN版差别太大了,linux版都电脑端登陆了,查看消息还要用手机扫码,那还不如用手机端看看消息得了,多此一举。win版的则登陆以后就可以查看,同样是操作系统,差别怎么这么大呢?

Reply View the author
晚秋(lateautumn)
Moderator
2023-08-13 06:57
#3
pyjy

钉钉LINUX版跟WIN版差别太大了,linux版都电脑端登陆了,查看消息还要用手机扫码,那还不如用手机端看看消息得了,多此一举。win版的则登陆以后就可以查看,同样是操作系统,差别怎么这么大呢?

慢慢来,一切都会好的applaud

Reply View the author
silentdoer
deepin
2023-08-14 06:36
#4

wayland可以支持这个软件吗?

Reply View the author