deepin-wine icon indicating copy to clipboard operation
deepin-wine copied to clipboard

【KDE桌面环境托盘图标问题集中讨论区】Kubuntu 20.04 托盘图标不闪烁

Open YKY-0110 opened this issue 4 years ago • 18 comments

来消息后,TIM和微信的图标都不闪烁,但TIM图标会改变

YKY-0110 avatar Aug 12 '20 09:08 YKY-0110

双屏?

zq1997 avatar Aug 12 '20 11:08 zq1997

双屏?

不是,使用外接显示屏的时候关闭了笔记本的屏幕。 只使用笔记本的屏幕也不会闪烁

YKY-0110 avatar Aug 12 '20 12:08 YKY-0110

一般来说,要确保系统又类似于Windows一样的右下角任务栏,且屏幕无偏移,其余桌面布局都可能让它失效

zq1997 avatar Aug 12 '20 13:08 zq1997

嗯,你说的这些都满足。 mmexport1597240363642

YKY-0110 avatar Aug 12 '20 13:08 YKY-0110

这个桌面没有见过,不太清楚,Ubuntu内置桌面的话需要top-icon-plus插件

zq1997 avatar Aug 13 '20 12:08 zq1997

我的KDE也有这个问题,消息来了没有变化

nintha avatar Oct 03 '20 01:10 nintha

我也遇到这个问题了,听到提示音才知道有信息,没开声音就没办法了。

CyrusYip avatar Oct 25 '20 14:10 CyrusYip

我现在也遇到这个问题,不过我是自己用原装的wine折腾的,我之前用 gnome + deepin-wine-for-ubuntu 安装 topicon plus 插件,开机用一段时间后托盘图标就各种问题,比如不显示或者显示空白之类,然后现在换成kde桌面了又遇到不闪烁问题,担心错过领导发的消息,所以我手机也开消息提醒放在桌子上,一振动就在电脑上点开企业微信看一下。。。

blackmatch avatar Nov 24 '20 15:11 blackmatch

我现在也遇到这个问题,不过我是自己用原装的wine折腾的,我之前用 gnome + deepin-wine-for-ubuntu 安装 topicon plus 插件,开机用一段时间后托盘图标就各种问题,比如不显示或者显示空白之类,然后现在换成kde桌面了又遇到不闪烁问题,担心错过领导发的消息,所以我手机也开消息提醒放在桌子上,一振动就在电脑上点开企业微信看一下。。。

用智能手环的振动效果更明显。

CyrusYip avatar Nov 25 '20 02:11 CyrusYip

我现在也遇到这个问题,不过我是自己用原装的wine折腾的,我之前用 gnome + deepin-wine-for-ubuntu 安装 topicon plus 插件,开机用一段时间后托盘图标就各种问题,比如不显示或者显示空白之类,然后现在换成kde桌面了又遇到不闪烁问题,担心错过领导发的消息,所以我手机也开消息提醒放在桌子上,一振动就在电脑上点开企业微信看一下。。。

用智能手环的振动效果更明显。

买不起手环,不然我也不会在小米笔记本上折腾Linux了,Linux下开发真心爽到爆,但是一些社交软件就很折腾人。。。

blackmatch avatar Nov 25 '20 03:11 blackmatch

我现在也遇到这个问题,不过我是自己用原装的wine折腾的,我之前用 gnome + deepin-wine-for-ubuntu 安装 topicon plus 插件,开机用一段时间后托盘图标就各种问题,比如不显示或者显示空白之类,然后现在换成kde桌面了又遇到不闪烁问题,担心错过领导发的消息,所以我手机也开消息提醒放在桌子上,一振动就在电脑上点开企业微信看一下。。。

用智能手环的振动效果更明显。

买不起手环,不然我也不会在小米笔记本上折腾Linux了,Linux下开发真心爽到爆,但是一些社交软件就很折腾人。。。

我用的是微信,我会一直打开一个窗口,这样来消息后,任务栏上的微信窗口会变颜色

YKY-0110 avatar Nov 25 '20 03:11 YKY-0110

还可以用 scrcpy 把手机投屏到电脑来用微信

CyrusYip avatar Nov 27 '20 07:11 CyrusYip

可以试试这个,用dbus-monitor监听托盘新图标的信号,然后用 notify-send 发提醒通知

notplus avatar Apr 24 '21 07:04 notplus

可以试试这个,用dbus-monitor监听托盘新图标的信号,然后用 notify-send 发提醒通知

这个误报率太高了,而且不知道消息来自哪个应用。

loaden avatar Jun 09 '21 07:06 loaden

请问这个问题目前有解决方法了吗?

livinghub avatar Sep 11 '21 06:09 livinghub

可以试试这个,用dbus-monitor监听托盘新图标的信号,然后用 notify-send 发提醒通知

这个误报率太高了,而且不知道消息来自哪个应用。

误报率是挺高的,我用golang写了一个简单小程序,还好.需要拿去试试.效果如下:

微信图片_20211021142709

package main

import (
	"fmt"
	"github.com/shirou/gopsutil/process"
	"log"
	"os"
	"sync"
	"time"

	"github.com/esiqveland/notify"
	"github.com/godbus/dbus/v5"
)

var closeIDS = sync.Map{}

func main() {
	conn, err := dbus.SessionBus()
	if err != nil {
		fmt.Fprintln(os.Stderr, "Failed to connect to session bus:", err)
		os.Exit(1)
	}
	defer conn.Close()

	// Notifier interface with event delivery
	notifier, err := notify.New(
		conn,
		// action event handler
		notify.WithOnAction(func(action *notify.ActionInvokedSignal) {
			log.Printf("ActionInvoked: %v Key: %v", action.ID, action.ActionKey)
		}),
		// closed event handler
		notify.WithOnClosed(func(closer *notify.NotificationClosedSignal) {
			log.Printf("NotificationClosed: %v Reason: %v", closer.ID, closer.Reason)
			closeIDS.Store(closer.ID, true)
		}),
		// override with custom logger
		notify.WithLogger(log.New(os.Stdout, "notify: ", log.Flags())),
	)

	if err = conn.AddMatchSignal(
		dbus.WithMatchInterface("org.kde.StatusNotifierItem"),
		dbus.WithMatchMember("NewIcon"),
	); err != nil {
		panic(err)
	}
	c := make(chan *dbus.Signal, 10)
	conn.Signal(c)

	var prevId uint32 = 0
	for v := range c {
		pid := getSenderPID(conn, v.Sender)
		procName := processName(pid)
		if isXembedsniproxy(procName) && (prevId == 0 || notifyClose(prevId)) {
			// notify
			prevId = notifyWechat(notifier, v)
		}
	}
}

func listAllNames(conn *dbus.Conn) []string {
	var s []string
	err := conn.BusObject().Call("org.freedesktop.DBus.ListNames", 0).Store(&s)

	if err != nil {
		fmt.Fprintln(os.Stderr, "Failed to get list of owned names:", err)
		os.Exit(1)
	}
	fmt.Println("Currently owned names on the session bus:")
	for _, v := range s {
		fmt.Println(v)
	}
	return s
}

func getSenderPID(conn *dbus.Conn, name string) uint32 {
	var s uint32
	err := conn.BusObject().Call("org.freedesktop.DBus.GetConnectionUnixProcessID", 0, name).Store(&s)
	if err != nil {
		fmt.Fprintln(os.Stderr, "Failed to get GetConnectionUnixProcessID:", err)
		os.Exit(1)
	}
	return s
}

func processName(pid uint32) string {
	p, err := process.NewProcess(int32(pid))
	if err != nil {
		return ""
	}
	name, _ := p.Name()
	return name
}

func isXembedsniproxy(name string) bool {
	return "xembedsniproxy" == name
}

func notifyWechat(notifier notify.Notifier, signal *dbus.Signal) uint32 {
	body := "可能是来自微信的消息,请查看!"
	if signal.Body != nil {
		body = body + "   " + fmt.Sprint(signal.Body)
	}
	iconName := "mail-unread"
	n := notify.Notification{
		AppName:       "Wechat Message",
		ReplacesID:    uint32(0),
		AppIcon:       iconName,
		Summary:       "消息通知",
		Body:          body,
		Hints:         map[string]dbus.Variant{},
		ExpireTimeout: time.Second * 10,
	}
	// Ship it!
	createdID, err := notifier.SendNotification(n)
	if err != nil {
		log.Printf("error sending notification: %v", err.Error())
	}
	log.Printf("created notification with id: %v", createdID)
	return createdID
}
func notifyClose(prevId uint32) bool {
	_, exist := closeIDS.LoadAndDelete(prevId)
	return exist
}

zhengzepeng avatar Oct 21 '21 06:10 zhengzepeng

有没有人遇到 https://github.com/zq1997/deepin-wine/issues/251 这个,另外求个 deepin-wine6-stable 6.0.0.18 的安装包

xgdgsc avatar Mar 18 '22 10:03 xgdgsc

我写了一个小工具,可以解决微信、企业微信托盘图标不显示/来消息不闪烁的问题:https://github.com/FengZhongShaoNian/kde-wine-helper

archlinux 下可以使用yay -S kde-wine-helper 一键安装

FengZhongShaoNian avatar Jul 23 '23 16:07 FengZhongShaoNian