SandSããããã®ã¹ã¯ãªãããsystemdã§èªååããå®æçã«åèµ·åã§ããããã«ãã¾ãã
SandS(Space and Shift)ã¨ããæè¡ããããã¹ãã¼ã¹ãã¼ã®é·æ¼ããã·ãããã¼ã¨ãã¦æ±ããã®ã§ãç¹ã«ã·ãããã¼ãå¤ç¨ããSKKã¨ã®ç¸æ§ãè¯ããSKKã¦ã¼ã¶ã¯ããã¦ãSandSãæå¹åãã¦ããã
ãã¦ããã®SandSãæå¹åããæ¹æ³ã«ã¯ããããããããèªåã¯xcape
ã¨xmodmap
ãä½µç¨ããã¹ã¯ãªãããèµ·åãããã¨ã§ãããè¡ã£ã¦ããããã®æé ã«é¢ãã¦ã¯å¥éSandS memoãç¨æãã¦ããã®ã§åç
§ãã¦ã»ããã
ãããããã®æé ãå®è¡ãã¦ãxcapeã®å¹æãåãã¦ãã¾ããã¨ãããå°ã£ã¦ãããå®æçã«åèµ·åããªãã¨ãããªãã®ãä¸æºã ã£ããããããã»ã¹ãèªåçã«åèµ·åããããã«ãããã
Systemdã«ã¯ããã»ã¹ãå®æçã«åèµ·åããæ©è½ããããããããã使ããã¨ã«ããã
ãã®è¨äºã§ã¯ãxcape
ãèµ·åããã¹ã¯ãªããã«è¥å¹²ã®ä¿®æ£ãå ããSystemdã®ã¦ã¼ã¶ãµã¼ãã¹ã¨ãã¦èµ·åããå®æçã«åèµ·åããããããªè¨å®ãè¡ãã
ä¸æºå
åè¿°ã®ã¹ã¯ãªããã§ã¯xcape
ãããã¯ã°ã©ã¦ã³ãã§èµ·åããããã«ãªã£ã¦ãããããããããã©ã¢ã°ã©ã¦ã³ãã§èµ·åããããã«ã³ãã³ãã©ã¤ã³ãä¿®æ£ããã
xcape
ããã©ã¢ã°ã©ã¦ã³ãã§èµ·åããã«ã¯ã-f
ãªãã·ã§ã³ã使ãã
#!/bin/sh # SandS configuration if pgrep -x xcape ; then killall xcape # to prevent xcape daemon duplication fi xmodmap -e 'keycode 255=space' xmodmap -e 'keycode 65=Shift_L' env xcape -f -e '#65=space' # added -f option
ã¹ã¯ãªããã¯æã§èµ·åããããã¨ãããã®ã§ãå¥ésystemdåãã«å¥åã§ä¿åãããä»åã¯~/bin/sands-f.sh
ã¨ãããå®è¡æ¨©éãå¿ããã«è¨å®ãã¦ããã
% chmod u+x ~/bin/sands-f.sh
Systemd ã¦ããããã¡ã¤ã«ã®è¨è¿°
Systemdã¯ã¦ã¼ã¶ã¢ã¼ãã§ã®ãµã¼ãã¹å®è¡ãæä¾ãã¦ãã*1ãä»åã®ç¨éã«ä¸åº¦è¯ãã®ã§ãã¦ã¼ã¶ãµã¼ãã¹ã¨ãã¦ã¦ããããã¡ã¤ã«ãè¨è¿°ããã
~/.config/systemd/user/sands.service
ã¨ãã¦ä»¥ä¸ãè¨è¿°ããã
[Unit] Description=Sands service [Service] # restart periodically Restart=always # alwaysã¯å°æåãªã®ã§æ³¨æããã㨠RuntimeMaxSec=60 ExecStart=%h/bin/sands-f.sh [Install] WantedBy=default.target
ã¡ãªã¿ã«ã%h
ã¯ãã¼ã ãã£ã¬ã¯ããªã«å±éãããã
è¨å®ã®åæ ã¨èµ·å
% systemctl --user daemon-reload
ãµã¼ãã¹ãæå¹åãã¦ããèµ·åãããæå¹åããªããã°60ç§ã§çµäºããã¾ã¾åèµ·åãã¦ãããªãããã
% systemd --user enable sands.service % systemd --user start sands.service
ããã¨èªåçã«60ç§ãã¨ã«ãµã¼ãã¹ãçµäºãã¦ãµããã³èµ·åãã¦ãããããã«ãªãã
ããã£ãã¨ãã
RuntimeMaxSec
ã¯systemdã®ãã¼ã¸ã§ã³ãæ°ãããªãã¨ä½¿ããªãã®ã§æ³¨æãããã¨ã
Restart=always
ã®always
ãå°æåãããªãã¨ãããªãäºã«æ°ä»ãããå
¨ç¶åèµ·åãã¦ãããªããã¨ã«å°ã£ã¦ãã°ããæéãç¡é§ã«ãªã£ã¦ãã¾ã£ããç¡å¹ãªè¨å®ã¯è¦åãåºãã¨å¬ããã¨æãã
ä»ç¥ã£ãããã©systemd-analyze --user verify ã¦ãããå
ãå®è¡ããã¨ããããæ¤è¨¼ãã¦ããããããªã®ã§ããã使ãã°ããã£ãã
# 大æåã®Alwaysã ã¨è¦åãåºã % systemd-analyze --user verify sands.service /home/windymelt/.config/systemd/user/sands.service:6: Failed to parse service restart specifier, ignoring: Always
ãªã«ãã¨ä¾¿å©ãããªã³ãã³ããªã®ã§æ´»ç¨ãããã
ã¡ãªã¿ã«ä»ã©ãããè¨å®ã«ãªã£ã¦ãããã¯systemd --user show ã¦ãããå
ãããããã£ã¨åºã¦ããã
systemd --user show sands.service Type=simple Restart=always NotifyAccess=none RestartUSec=100ms ... ...