[Boot/Shutdown] systemd中运行xmodmap 命令报错
Tofloor
poster avatar
wangxinpeng
deepin
2021-05-18 04:47
Author

/usr/bin/xmodmap:  unable to open display ':0'

 

这是我的 service 脚本(放在/etc/sstemd/system/下执行):

[Unit]                                                                                                                                                                                                               

Description=Remap some key (By Xinpeng)                                                                                                                                                                              

Documentation=man:xmodmap                                                                                                                                                                                            

After=graphical.target                                                                                                                                                                                               

Wants=graphical.target                                                                                                                                                                                               

                                                                                                                                                                                                                     

[Service]                                                                                                                                                                                                            

Type=oneshot                                                                                                                                                                                                         

ExecStart=/usr/bin/bash -c 'export DISPLAY=":0"; sleep 10; /usr/bin/xmodmap /home/xmi/.config/system/remap.key; dumpkeys > /home/xmi/.Xmodmap'                                                                                                                                                                                                                                                                                            

[Install]                                                                                                                                                                                                            

WantedBy=graphical.target 

Reply Favorite View the author
All Replies
deepin-mq
deepin
2021-05-18 17:40
#1

收到,我们试下

Reply View the author
wangxinpeng
deepin
2021-05-18 21:26
#2
deepin-mq

收到,我们试下

感谢大佬

Reply View the author
wangxinpeng
deepin
2021-05-18 22:17
#3
deepin-mq

收到,我们试下

在线等待

Reply View the author
deepin-mq
deepin
2021-05-19 04:40
#4

看了下,图形程序不应该使用systmed去执行,属于错误使用

Reply View the author
wangxinpeng
deepin
2021-05-20 19:47
#5
deepin-mq

看了下,图形程序不应该使用systmed去执行,属于错误使用

那请教一下,我想开机执行一次键盘的重新映射,应该放在哪里合适.

Reply View the author
幻想自由
deepin
2023-09-01 06:10
#6
wangxinpeng

那请教一下,我想开机执行一次键盘的重新映射,应该放在哪里合适.

有解决方法了吗

Reply View the author