Tencent QQ

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

QQ is an instant messaging software developed by Tencent, an imitation of ICQ, and the most popular IM software in China. This page lists various solutions for Arch Linux using QQ.

Official version

The official version is already available. To use the official version, install linuxqqAUR.

Note:
  • The official version provides an ordinary QQ, TIM does not have an official version. If you want to use TIM, please use the wine solution.
  • The official version is incomplete and the interface is rudimentary. If you need to use the missing function or a better-looking interface, please use the wine solution.

Virtual machine

You can run a complete Windows system in a virtual machine and run QQ in this. Compared with other schemes, this scheme has the smallest chance of error. The disadvantage is that it takes up more resources.

Tip:

Wine

Wine is a "compatibility layer" that runs Microsoft Windows programs under UNIX-like systems, and it can be used to simulate QQ environment to run QQ/TIM.

Warning: The style of Wine QQ/TIM under the tiled window manager may be out of control on a large scale and additional configuration is required.

Deepin QQ/TIM

Deepin QQ/TIM is a relatively mature solution in wine. Almost out of the box, with fewer bugs.

You can install the normal QQ: com.qq.im.deepinAUR or TIM: com.qq.office.deepinAUR (or com.qq.tim.sparkAUR from Spark Store), also from ArchLinux CN source install the normal QQ: deepin.com.qq.im or TIM: deepin.com.qq.office

Or you can install the Light version: deepin.com.qq.im.lightAUR

For the KDE/Plasma desktop, see Deepin-wine#Deepin-wine applications fails to start.

Crossover

You can use CrossOver to run QQ, TM2013 and TIM. For more details, please refer to CrossOver's compatibility list.

AppImage

AppImage is a format for packaging applications into a single file. You can download the packaged Wine QQ/TIM in [1].Only need to give executable permissions to use. Since the AppImage format comes with the dependencies required by the program, this method is least affected by the versions of other components in the system.

Note: Since AppImage does not use the system's Wine, adjustments to Wine may be invalid, such as #HiDPI support.

Teacher Qingfeng's Wine QQ program

You can also use the Wine QQ program provided by Teacher Qingfeng.

Note: After the installation is successful, you need to uncheck the automatic update of QQ to avoid unavailability of automatic update.

Manual Wine scheme

QQ light chat version

Note: This program uses QQ Light Chat version 6.7, and later versions require additional adjustments in the current wine version to install.

Install winetricks and wine. Created qqlight.verb as follows:

w_metadata qqlight apps \
 title="QQ Light" \
 publisher="Tencent" \
 year="2015" \
 media="download" \
 file1="QQ6.7Light.exe" \
 installed_exe1="$W_PROGRAMS_X86_WIN/Tencent/QQ/Bin/QQ.exe" \
 homepage="https://www.qq.com" \
 unattended="no"

load_qqlight()
{
    w_download https://dldir1.qq.com/qqfile/qq/QQ6.7Light/13466/QQ6.7Light.exe e1e1ff2bf6461c08047d0a01927a43c5a0746bdf

    if w_workaround_wine_bug 29636 "Installing native riched20 to work around crash bug"
    then
        w_call riched20
    fi

    if w_workaround_wine_bug 34566 "Installing native ctf to work around crash"
    then
        w_call msctf
    fi

    # Make sure chinese fonts are available
    w_call fakechinese

    # uses mfc42u.dll
    w_call mfc42

    cd "$W_CACHE/$W_PACKAGE"
    w_try "$WINE" "$file1"

    # fix crash after login
    mkdir -p ~/.local/share/wineprefixes/qqlight/drive_c/users/$LOGNAME/Application\ Data/Tencent/QQ/Misc/com.tencent.wireless/SDK
    chmod 000 ~/.local/share/wineprefixes/qqlight/drive_c/users/$LOGNAME/Application\ Data/Tencent/QQ/Misc/com.tencent.wireless/SDK

    w_declare_exe "$W_PROGRAMS_X86_WIN\\Tencent\\QQ\\Bin" QQ.exe
}

Run winetricks to install:

$ winetricks qqlight.verb

After installation, start it through wineconsole:

$ wineconsole .wine/drive_c/run-qqlight.bat

TIM

Install wine, wine-gecko and wine-mono.

Execute winetricks riched20, or use winecfg to set function library substitution.

You may need to configure Chinese font display, see #Font configuration.

Install TIM.

Generate icon

The installed TIM may not have generated an icon in the program list. To add icons by yourself, create a new tim.desktop file and write the following:

tim.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1
Name=TIM
Comment=Tencent TIM
Exec=wine '~/.wine/drive_c/Program Files/Tencent/TIM/Bin/TIM.exe'
Icon=~/.wine/drive_c/Program Files/Tencent/TIM/TIMUninst.ico
Terminal=false
Type=Application
Categories=Network;

Move tim.desktop to ~/.local/share/applications or /usr/share/applications.

Tips and tricks

HiDPI support

On the HiDPI display, the QQ/TIM interface may be too small. Support for HiDPI has been added to the newer version of QQ/TIM. Just manually adjust Wine's DPI.

Execute winecfg, switch to the display tab in the opened window and adjust the DPI.

Note: If you are not using the default wine container (for example, use deepin QQ/TIM) you need to specify the WINEPREFIX variable when you execute winecfg. For example, env WINEPREFIX=$HOME/.deepinwine/Deepin-QQ deepin-wine winecfg or env WINEPREFIX=$HOME/.deepinwine/Deepin-TIM deepin-wine winecfg.

Configuration under the tiled window manager

Awesome

Wine QQ/TM may be out of control under the tiled window manager, and some configuration is required.

The following configuration has these effects:

  • Set all TM windows to float.
  • Clear unnecessary window borders to prevent the focus from moving to the menu when the menu pops up.
  • Automatically close the pop-up news window.

Add the following to the Awesome configuration:

function myfocus_filter(c)
  if awful.client.focus.filter(c) then
    -- This works with tooltips and some popup-menus
    if c.class == 'Wine' and c.above == true then
      return nil
    elseif c.class == 'Wine'
      and c.type == 'dialog'
      and c.skip_taskbar == true
      and c.size_hints.max_width and c.size_hints.max_width < 160
      then
      -- for popup item menus of Photoshop CS5
      return nil
    else
      return c
    end
  end
end

awful.rules.rules = {
  -- All clients will match this rule.
  {
    rule = { },
    properties = {
      -- we use our own function
      focus = myfocus_filter,
      -- The following is the default part
      border_width = beautiful.border_width,
      border_color = beautiful.border_normal,
      keys = clientkeys,
      buttons = clientbuttons,
    }
  }, {
    rule_any = { 
      instance = {'TM.exe', 'QQ.exe'},
    },
    properties = {
      -- This, together with myfocus_filter, make the popup menus flicker taskbars less
      -- Non-focusable menus may cause TM2013preview1 to not highlight menu
      -- items on hover and crash.
      focusable = true,
      floating = true,
      -- remove the border
      border_width = 0,
    }
  }, {
    -- Other rules
  }
}

alt_switch_keys = awful.util.table.join(
    -- it's easier for a vimer to manage this than figuring out a nice way to loop and concat
    awful.key({'Mod1'}, 1, function(c) awful.util.spawn('xdotool key --window ' .. c.window .. ' ctrl+1') end),
    awful.key({'Mod1'}, 2, function(c) awful.util.spawn('xdotool key --window ' .. c.window .. ' ctrl+2') end),
    awful.key({'Mod1'}, 3, function(c) awful.util.spawn('xdotool key --window ' .. c.window .. ' ctrl+3') end),
    awful.key({'Mod1'}, 4, function(c) awful.util.spawn('xdotool key --window ' .. c.window .. ' ctrl+4') end),
    awful.key({'Mod1'}, 5, function(c) awful.util.spawn('xdotool key --window ' .. c.window .. ' ctrl+5') end),
    awful.key({'Mod1'}, 6, function(c) awful.util.spawn('xdotool key --window ' .. c.window .. ' ctrl+6') end),
    awful.key({'Mod1'}, 7, function(c) awful.util.spawn('xdotool key --window ' .. c.window .. ' ctrl+7') end),
    awful.key({'Mod1'}, 8, function(c) awful.util.spawn('xdotool key --window ' .. c.window .. ' ctrl+8') end),
    awful.key({'Mod1'}, 9, function(c) awful.util.spawn('xdotool key --window ' .. c.window .. ' ctrl+9') end)
)
function bind_alt_switch_tab_keys(client)
    client:keys(awful.util.table.join(client:keys(), alt_switch_keys))
end -- }}}

client.connect_signal("manage", function (c, startup)
  -- other configuration

  if c.instance == 'TM.exe' then
    -- add Alt+n support
    bind_alt_switch_tab_keys(c)
    -- close all kinds of news notification small windows
    if c.name and c.name:match('^腾讯') and c.above then
      c:kill()
    end
  end

  -- other configuration
end)

You can also look at the complete Awesome configuration.

i3

In the native configuration, when qq2012 is started, it will be maximized automatically, and the border is not beautiful. The following two rules can be set in the i3 config setting to improve:

for_window [instance="QQ.exe"] floating enable
for_window [instance="QQ.exe"] border none

Troubleshooting

Font configuration

If you have problems displaying Chinese, you can try to execute winetricks fakechinese first.

See also fonts and Applications without fontconfig support

File is occupied

Just kill the process of QQ or TIM. After exiting QQ/TIM, some related processes are still running in the background. You can also use the following script to start QQ/TIM, it will first find the existing process, kill the process and start a new QQ/TIM.

start-tim.sh
#!/bin/sh
# script to start TIM
# kill TIM before start TIM
for pid in `pgrep TIM.exe`; do
	if [ -n ${pid} ]; then
		kill ${pid}
	fi
done
# start TIM
wine '~/.wine/drive_c/Program Files/Tencent/TIM/Bin/TIM.exe'

The above example is applicable to TIM, and can be applied to QQ after a little modification.

Unable to input emoticons under xfce4 (xfwm4)

Open the Settings Manager-Window manager tuning-focus, uncheck the ICCCM focus prompt to activate focus anti-theft and follow the standard.

The reason is that incompatibility occurs when the emoji window gains focus.

Cannot enter Chinese under non-Chinese locale

Modify the Exec of the .desktop file, which is usually located in /usr/share/applications/ or ~/.local/share/applications/.

Add env LC_ALL=zh_CN.UTF-8 to the Exec line. For example, the original Exec was:

Exec=".wine/drive_c/Program Files/QQ/Bin/QQ.exe"

Should be changed to:

Exec=env LC_ALL=zh_CN.UTF-8 wine ".wine/drive_c/Program Files/QQ/Bin/QQ.exe"

See also