atom报错找不到uncrustify

今天看书的时候无意间打开了之前写的一个C程序,按保存的时候突然报错找不到uncrustify。再三确认uncrustify不仅安装了还是安装的最新版本的情况下,甚至指定了绝对路径,atom还是不认。网上搜的全都是“你肯定没有安装,装一个就好”。

思考再三,感觉和之前的dhcpcd 8.1事件有点类似。首先降级了atom到1.40.1,发现问题没有解决。然后把uncrustify从0.70.0降级到0.69.0,问题就解决了。所以结论就是最新版的uncrustify是有问题的。

用PlayOnLinux装Office 2010的改进方法

之前用PlayOnLinux(简称POL)来安装Office 2010的时候,OneNote总是作怪,隔几分钟就崩溃,实在是没法用。当时迫不得已,用wine直接装,用了一段时间,但是某次系统大更新,把wine升级了之后,OneNote就没办法调出中文输入法,又废掉了。结果只能回来研究POL怎么安装才能搞定。直接按照流程来做的话,因为国内网络的问题,十有八九会在下载包的过程中断开连接而fail掉。但是即使是丢了一些包,竟然还能打得开,所以就有了手动修复依赖包的想法。浏览到POL论坛的Office2010的安装script(附在文章结尾了),依赖包有dotnet20 gecko corefonts gdiplus riched20 riched30 msxml6 mspatcha

所以如果fail了,点开POL的“配置”,选中Office2010,然后“安装内容”里面先把dotnet20和它的sp1、sp2安装上,然后corefonts对应的是Microsoft Core Fonts,剩下的包名字都能找到,就不多说了。

安装完还要在“Wine”标签页里面配置Wine,在“函数库”里面确保gdiplus mspatcha riched20 riched30 msxml6全都有而且设置成了“原装优先于内建”(native,builtin)。最后还需要在“杂项”标签页里选择“在此虚拟盘中运行可执行文件”,把Office 2010的SP1补丁安装上。之后Office就能顺利运行啦。如果掉不出输入法,记得把环境变量LANG设置成zh_CN.UTF-8,而且环境变量已经设置好fcitx作为输入法模块。

#!/bin/bash
  
# CHANGELOG
# [Quentin PÂRIS] (2012-05-05 14-45)
#   Wine version set to 1.5.3, Outlook 2010 compatiblity
# [Quentin PÂRIS] (2012-05-05 15-05)
#   Check winbind (samba) presence on Linux, required to install
#   Adding gettext support
# [Quentin PÂRIS] (2012-05-12 18-36)
#   Requires 4.0.18
# [SuperPlumus] (2013-06-09 14-44)
#   gettext
# [Quentin PÂRIS] (2014-07-21 17-09)
#   Updating with the latest WineHQ version
# [rbelo] (2018-07-22 15-50)
#   Updating with the latest stable WineHQ version (3.0.2), ver 1.7.52 does not seem to work.
# [Mrjacobarussell] (2018-09-25 20-50)
# Updating missing dotnet20 , gdiplus, gecko, corefonts, msxml6
# [diogoborges14] (2018-12-01)
#   mspatcha
 
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
  
PREFIX="Office2010"
WINEVERSION="3.0.2"
TITLE="Microsoft Office 2010"
  
POL_GetSetupImages "http://files.playonlinux.com/resources/setups/Office/top.jpg" "http://files.playonlinux.com/resources/setups/Office/left.png" "$TITLE"
  
POL_SetupWindow_Init
POL_SetupWindow_SetID 801
  
POL_SetupWindow_presentation "$TITLE" "Microsoft" "http://www.microsoft.com" "Quentin PÂRIS" "$PREFIX"
  
POL_RequiredVersion 4.0.18 || POL_Debug_Fatal "$TITLE won't work with $APPLICATION_TITLE $VERSION\nPlease update"
  
if [ "$POL_OS" = "Linux" ]; then
        wbinfo -V || POL_Debug_Fatal "Please install winbind (or samba, on Arch Linux) before installing $TITLE"
fi
POL_Debug_Init
POL_System_SetArch "x86"
  
  
POL_SetupWindow_InstallMethod "LOCAL,DVD"
  
if [ "$INSTALL_METHOD" = "DVD" ]; then
        POL_SetupWindow_cdrom
        POL_SetupWindow_check_cdrom "x86/setup.exe" "setup.exe"
        SetupIs="$CDROM_SETUP"
        cd "$CDROM"
else
        POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run')" "$TITLE"
        SetupIs="$APP_ANSWER"
fi
  
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WINEVERSION"
  
if [ "$POL_OS" = "Mac" ]; then
    # Samba support
    POL_Call POL_GetTool_samba3
    source "$POL_USER_ROOT/tools/samba3/init"
fi
  
  
POL_Wine_WaitBefore "$TITLE"
[ "$CDROM" ] && cd "$CDROM"
  
if [ ! "$(file $SetupIs | grep 'x86-64')" = "" ]; then
    POL_Debug_Fatal "$(eval_gettext "The 64bits version is not compatible! Sorry")";
fi
POL_Wine "$SetupIs"
POL_Wine_WaitExit "$TITLE"
POL_Call POL_Install_dotnet20
POL_Call POL_Install_gecko
POL_Call POL_Install_corefonts
POL_Call POL_Install_gdiplus
POL_Call POL_Install_riched20
POL_Call POL_Install_riched30
POL_Call POL_Install_msxml6
POL_Call POL_Install_mspatcha
# See http://forum.winehq.org/viewtopic.php?f=8&t=23126&p=95555#p95555
POL_Wine_OverrideDLL "native,builtin" "riched20"
POL_Wine_OverrideDLL "native,builtin" "riched30"
POL_Wine_OverrideDLL "native,builtin" "gdiplus"
plsy 
 
# Fix a crash when loading a file
 
  
POL_Shortcut "WINWORD.EXE" "Microsoft Word 2010" "" "" "Office;WordProcessor;"
POL_Shortcut "EXCEL.EXE" "Microsoft Excel 2010" "" "" "Office;Spreadsheet;"
POL_Shortcut "POWERPNT.EXE" "Microsoft Powerpoint 2010" "" "" "Office;Presentation;"
POL_Shortcut "ONENOTE.EXE" "Microsoft OneNote 2010" "" "" "Network;InstantMessaging;" # No category for collaborative work?
POL_Shortcut "OUTLOOK.EXE" "Microsoft Outlook 2010" "" "" "Network;Email;" # Calendar;ContactManagement; ? :p
  
POL_Extension_Write doc "Microsoft Word 2010"
POL_Extension_Write docx "Microsoft Word 2010"
POL_Extension_Write xls "Microsoft Excel 2010"
POL_Extension_Write xlsx "Microsoft Excel 2010"
POL_Extension_Write ppt "Microsoft Powerpoint 2010"
POL_Extension_Write pptx "Microsoft Powerpoint 2010"
  
if [ "$POL_OS" = "Mac" ]; then
    POL_Shortcut_InsertBeforeWine "Microsoft Word 2010" "source \"$POL_USER_ROOT/tools/samba3/init\""
    POL_Shortcut_InsertBeforeWine "Microsoft Excel 2010" "source \"$POL_USER_ROOT/tools/samba3/init\""
    POL_Shortcut_InsertBeforeWine "Microsoft Powerpoint 2010" "source \"$POL_USER_ROOT/tools/samba3/init\""
    POL_Shortcut_InsertBeforeWine "Microsoft OneNote 2010" "source \"$POL_USER_ROOT/tools/samba3/init\""
    POL_Shortcut_InsertBeforeWine "Microsoft Outlook 2010" "source \"$POL_USER_ROOT/tools/samba3/init\""
fi
  
POL_SetupWindow_message "$(eval_gettext '$TITLE has been installed successfully\n\nIf an installation Windows prevent your programs from running, you must remove and reinstall $TITLE')" "$TITLE"
POL_SetupWindow_Close
exit

 

deepin-wine-wechat

archlinux+KDE

首先参考的是AUR|deepin qq的评论区,留意其中关于Deepin QQ(Office)的X Error of failed request: BadWindow 评论。

github issue | KDE环境完全无法使用wine-tim可知在KDE环境下无法启动deepin-wine系列的东西是因为缺少了gnome依赖。所以用console启动的时候可以看见报错是X Error of failed request: BadWindow 之类的(依靠这个才找到AUR,才解决了问题)。

所以就是怎么办的问题。置顶评论只是解决了中文无法输入的问题,或者是治标不治本的简单粗暴方法:直接换用gnome。但是下面评论的一条解决了问题:

……
非gnome系的解决方案:安装gnome-settings-daemon,然后运行/usr/lib/gsd-xsettings

manjaro+awesome下测试通过

确实OK了。最后再加一个systemd服务在开机的时候自动启动就好了:


[Unit]
Description=GSD-Xsettings Service
After=rc-local.service

[Service]
Type=simple
User=root
Group=root
#WorkingDirectory=/home/sieve
ExecStart=/usr/lib/gsd-xsettings
Restart=always

[Install]
WantedBy=multi-user.target

gentoo

编译

gentoo下官方当然是没有这个包的,所以要靠野包(overlay)来实现。首先是安装layman来管理overlay,然后layman -L && layman -a deepin把deepin的overlay加进去。他们的github是:deepin-overlay
第二步,emerge --ask deepin-wine-wechat,甚至可以加上--newuse --update,然后就会出现一大堆条件未满足,一般会在/etc/portage/package.use文件夹里面产生._cfg开头的文件,把那个文件cat/etc/portage/package.use里面的一个文件里面就好了,我是cat进了wechat文件里面。然后再来一次emerge,这次应该就能开始编译了。

再次编译

编译完成之后,用命令行启动,会发现出现段错误,查找github可以发现有人提过一个issue谈到这个问题。解决问题的办法就是用-O1重新编译一次x11-libs/libxcb和x11-libs/libX11,命令是CFLAGS="-march=native -O1 -pipe" emerge --ask x11-libs/libxcb x11-libs/libX11

安装gnome-settings-daemon

这是和上面的一样的了,稍有不同的是gentoo安装好的要执行的文件的路径是/usr/libexec/gsd-xsettings。往/opt/deepinwine/tools/run_v2.sh的RunApp()里面添加:

if [[ -z "$(ps -e | grep -o gsd-xsettings)" ]]
        then
         /usr/libexec/gsd-xsettings    &
        fi

就可以启动微信了。

中文呢?

/opt/deepinwine/apps/Deepin-WeChat/run.sh里面需要export一些环境变量:

export LC_ALL=zh_CN.UTF8
export XMODIFIERS=@im=fcitx
export QT_IM_MODULE=fcitx
export GTK_IM_MODULE=fcitx

丑是丑了点,但是能用了。

NTP时间同步

记录一下如何配置archlinux上的实践同步。

用到三个网站:systemd-timesyncd (简体中文)Asia — asia.pool.ntp.orgTime.is

首先根据systemd-timesyncd,

systemctl enable systemd-timesyncd.service

然后修改/etc/systemd/timesyncd.conf,找到#NTP=,去掉注释并添加Asia — asia.pool.ntp.org里的NTP服务器:

/etc/systemd/timesyncd.conf

NTP=0.asia.pool.ntp.org 1.asia.pool.ntp.org 2.asia.pool.ntp.org 3.asia.pool.ntp.org

最后用root权限完成启动和同步:

sudo systemctl start systemd-timesyncd
sudo timedatectl set-ntp true

查看同步结果:

timedatectl status

同步之后可以在Time.is上面对表。

archlinux音量管理器

Archlinux内置了asla,所以只需要安装用来调整配置的Sound servers就可以了。根据Arch Wiki的写法,选择了pulseaudio。pacman安装完之后只是有了server,还需要配置界面pavucontrol和系统托盘pasystray。为了利用音量键调整声音,需要安装pulseaudio-ctl,然后在Settings-Keyboard里面设置快捷键。pulseaudio-ctl的用法:

/bin/pulseaudio-ctl {up,down,mute,mute-input,set,atmost,full-status} [n]

 Where up and down adjust volume in ±5 % increments
 Where up and down [n] adjust volume in ±n % increments
 Where mute toggles the mute status on/off
 Where mute-input toggles the input status on/off
 Where set set the volume to [n] %
 Where atmost only takes effect if current volume is higher than [n]
 Where full-status prints volume level, sink and source mute state to stdout

如果是在xfce4下面,打开Settings-Session and Startup-Application Autostart,添加一个/usr/bin/pasystray的启动项就好了。

 

参考:
[SOLVED] PulseAudio and volume buttons
pulseaudio-ctl: vol+/- and mute from the shell or shortcut keys

kvm+QEMU安装虚拟机

一切都要从换用i3wm之后说起。其实背景不复杂,就是在i3wm下面无法启动deepin-wechat这一大杀器……所以只能用传统解决办法:装虚拟机。

现在的Intel CPU基本都支持Intel-VT,所以只需要确认BIOS 里没有禁用虚拟化就可以了。archlinux的官方内核默认加载了kvm模块,所以直接安装QEMU即可。为了偷懒,再安装virt-manager来提供图形界面。为了以普通用户身份来运行virt-manager,需要把用户加入libvirt和kvm组。为了支持NAT,需要安装ebtables和dnsmasq。

启动之前首先用systemctl启动ebtables、dnsmasq、libvirtd(顺序matters),随后启动virt-manager,之后的步骤就和virtualbox的安装步骤差不多了。