linuxdeepin / developer-center

Deepin developer center, provide developer wiki and community forum.
452 stars 73 forks source link

Deepin root file manager doesn't honor system scaling on 4k monitor #894

Closed keybreak closed 5 years ago

keybreak commented 5 years ago

Describe the bug

On 4k screen with scaling higher than 1, root dde-file-manager doesn't honor scaling settings.

To Reproduce

  1. You must have 4k screen with scaling set in Deepin settings, let's say to x2
  2. Open Deepin root file manager with any of this ways:
    • sudo dde-file-manager
    • In deepin file manager press right mouse button - Open in new window as admin
    • From programs list launch root-Filemanager

Expected behavior

Every program should honor system scaling :)

Screenshots

Image of Yaktocat

Enviroments:

OS: Manjaro 18.0.2 Illyria Kernel: x86_64 Linux 4.19.20-1-MANJARO Shell: bash 5.0.0 DE: Deepin 15.9 WM: Deepin WM WM Theme: deepin GTK Theme: deepin [GTK2/3] Icon Theme: deepin bits: 64 compiler: gcc v: 8.2.1 tk: Qt 5.12.0 dm: LightDM

Distro & Version

Manjaro Deepin 18.0.2

Related package version

deepin-file-manager 1:4.7.5-1

Additional context

Tested only on this machine and only in Manjaro Deepin, since i don't have any other 4k, inxi -Fxxz:

System:    Host: x133-pc Kernel: 4.19.20-1-MANJARO x86_64 bits: 64 compiler: gcc v: 8.2.1 Desktop: Deepin 15.9 tk: Qt 5.12.0 
           wm: DeepinWM dm: LightDM Distro: Manjaro Linux 
Machine:   Type: Laptop System: Dell product: Precision 7730 v: N/A serial: <filter> Chassis: type: 10 serial: <filter> 
           Mobo: Dell model: 0VC5H3 v: A00 serial: <filter> UEFI: Dell v: 1.6.0 date: 12/25/2018 
Battery:   ID-1: BAT0 charge: 94.1 Wh condition: 94.1/97.0 Wh (97%) volts: 13.0/11.4 model: BYD DELL GW0K986 serial: <filter> 
           status: Full 
CPU:       Topology: 6-Core model: Intel Core i9-8950HK bits: 64 type: MT MCP arch: Kaby Lake rev: A L2 cache: 12.0 MiB 
           flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 69720 
           Speed: 941 MHz min/max: 800/4800 MHz Core speeds (MHz): 1: 1394 2: 1178 3: 1685 4: 932 5: 1846 6: 1592 7: 1606 
           8: 4449 9: 1065 10: 1483 11: 1038 12: 1672 
Graphics:  Device-1: NVIDIA GP104GLM [Quadro P5200 Mobile] vendor: Dell driver: nvidia v: 415.27 bus ID: 01:00.0 
           chip ID: 10de:1bb5 
           Display: x11 server: X.Org 1.20.3 driver: nvidia resolution: 3840x2160~60Hz 
           OpenGL: renderer: Quadro P5200/PCIe/SSE2 v: 4.6.0 NVIDIA 415.27 direct render: Yes 
Audio:     Device-1: Intel Cannon Lake PCH cAVS vendor: Dell driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
           chip ID: 8086:a348 
           Device-2: NVIDIA GP104 High Definition Audio vendor: Dell driver: snd_hda_intel v: kernel bus ID: 01:00.1 
           chip ID: 10de:10f0 
           Sound Server: ALSA v: k4.19.20-1-MANJARO 
Network:   Device-1: Intel Ethernet I219-LM vendor: Dell driver: e1000e v: 3.2.6-k port: efa0 bus ID: 00:1f.6 
           chip ID: 8086:15bb 
           IF: eno1 state: down mac: <filter> 
           Device-2: Intel Wireless-AC 9260 driver: iwlwifi v: kernel port: 3000 bus ID: 6f:00.0 chip ID: 8086:2526 
           IF: wlp111s0 state: up mac: <filter> 
Drives:    Local Storage: total: 267.35 GiB used: 39.24 GiB (14.7%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: PM981 NVMe 256GB size: 238.47 GiB speed: 31.6 Gb/s lanes: 4 
           serial: <filter> 
           ID-2: /dev/sda type: USB vendor: Kingston model: DataTraveler 3.0 size: 28.88 GiB serial: <filter> 
Partition: ID-1: / size: 54.30 GiB used: 10.05 GiB (18.5%) fs: ext4 dev: /dev/nvme0n1p3 
Sensors:   System Temperatures: cpu: 59.0 C mobo: N/A gpu: nvidia temp: 61 C 
           Fan Speeds (RPM): cpu: 1688 fan-2: 1681 
Info:      Processes: 261 Uptime: 3m Memory: 62.75 GiB used: 1.17 GiB (1.9%) Init: systemd v: 239 Compilers: gcc: 8.2.1 
           Shell: bash v: 5.0.0 running in: deepin-terminal inxi: 3.0.30 
BLumia commented 5 years ago

FYI root dde-file-manager use the preference of the root user.

keybreak commented 5 years ago

Hmm...Ok i didn't know that, problem is that i had only 1 user with root passsword on this test-system, and it happened only after last update, so i guess it still can be considered as bug, right? Probably connected to https://github.com/linuxdeepin/developer-center/issues/893 then

BLumia commented 5 years ago

so i guess it still can be considered as bug, right?

Yep, btw did this also happened on Deepin (distro)? Seems works fine on my machine with deepin distro.

keybreak commented 5 years ago

Nope can't confirm, i haven't tested Linux Deepin on real 4k machine yet. btw is there any way to trick VirtualBox to behave as 4k with scaling, for testing purposes?

keybreak commented 5 years ago

Just to clarify my sloppy english above, i mean i've tested only in Manjaro Deepin and can't confirm Linux Deepin)

But bug is still here.

keybreak commented 5 years ago

@BLumia Can you please fix this? :smiley_cat: On 4k screen root file manager is unusable :(

BLumia commented 5 years ago

Sorry I'm really busy these days, the priority of this issue is not quite high..

But, just curious, what's your use case for using root file manager? IMO user should avoid using root file manager for their daily work since it can take damage to the file if user modified some file in the wrong way and it may cause other issue.

keybreak commented 5 years ago

Ok, i know that you have a lot of hardcore things to do lately and thank you)

Main use cases for me are:

  1. When you need to modify more than 1 system file in a row, it's really easier for me to double click and use text-edtor of choise, than paste / type directly to terminal or use sudo nano
  2. When you are searching for something you know you need to sudo, but don't really know what it is unless you find / see it, which again is easier to do visually in root file manager)

So i mean, it's obviously for power-users and probably people used to do it other ways, but for me it's a really handy way of quickly doing system-level things)

BLumia commented 5 years ago

Just did some quick research, seems pkexec cannot pass the current environment variable to the program it runs, the program will still read the root user's related environment variable to do the scaling behavior. We can add extra argument to dde-file-manager to manually set the scale factor to override the one which environment variable given, but it seems is not a clean way to do.

And although adding extra argument to the file manager can workaround this issue, other program which runs by pkexec may still got this issue. #607

Any other idea about this?

BLumia commented 5 years ago

@electricface 修改屏幕缩放比会修改 ~/.pam_environment 文件吗?

electricface commented 5 years ago

不会

BLumia commented 5 years ago

Should be fixed now, please wait for next release :)

xiaoc-arch commented 5 years ago

sudo deepin-editor也有同样的问题,deepin环境下

keybreak commented 5 years ago

@xiaoc-arch How the hell you managed to get sudo deepin-editor working at all now? It wasn't fixed yet https://github.com/linuxdeepin/developer-center/issues/889

xiaoc-arch commented 5 years ago

比如sudo deepin-editor /etc/modprobe.d/xxxx;安装nvidia418.43

keybreak commented 5 years ago

wow...

So you don't have this bug on Arch Deepin, that you can't in any way open deepin-editor as root Interesting :astonished:

keybreak commented 5 years ago

@BLumia Please note, that both of this bugs (OP and https://github.com/linuxdeepin/developer-center/issues/889) can be connected since they was started in same day, after exactly same update and wasn't there before.

Hopefully this info also can help you with solving root deepin-editor bug, if not already)

xiaoc-arch commented 5 years ago

仍然建议你使用deepin,arch系列的dde移植不太好,包依赖处理的不太好,我之前也是arch+dde

felixonmars commented 5 years ago

@xiaoc-arch 有什么包依赖问题麻烦反馈一下……

xiaoc-arch commented 5 years ago

要说运行流畅完全没问题,只是arch有些包没有,也不能怪你,哈哈。deepin处理得更细:dde-file-manager居然依赖deepin-movie,deepin-movie居然又依赖mpv,完全没必要啊,Deepin下deepin-movie都是依赖libmpv1的。我看了arch里面根本没有libmpv包,这样虽然运行流畅,但避免不了软件杂糅,安装网易音乐(依赖vlc)后,arch都有四五个播放器了

BLumia commented 5 years ago

sudo deepin-editor也有同样的问题

其实是 pkexec 运行的时候不会把环境变量带过去,Qt使用了几个环境变量决定缩放行为,但又由于 pkexec 的安全缘故(详情自行 man pkexec)带不过去,所以就只能不缩放显示了。

文件管理器之前的处理方式是读 .pam_environment,而后端(startdde)不再管理 .pam_environment 文件之后,文件管理器即便再读取也没什么实质意义了(因为里面内容是不对的)。

这次的修复是采用了读取 .dde_env 的方式,于是就有个前提是 .dde_env 得是对的。这个东西是 startdde 管理的,于是如果在非 DDE 下跑深度的文管,其实还是可能有问题的,所以我个人觉得这个方案其实也不算好,但至少管用。

其实我觉得 pkexec 在运行别的程序时能够附带必要的不会造成安全问题的环境变量会是比较好的解决方案,而不应该是应用做一些奇怪的 hack...

How the hell you managed to get sudo deepin-editor working at all now? It wasn't fixed yet

Sorry I still didn't have enough time to look into that issue :joy:

要说运行流畅完全没问题,只是arch有些包没有,也不能怪你,哈哈

反馈具体的内容才能帮助改善这些问题,只是说“有问题”不是太有帮助其实..

keybreak commented 5 years ago

@felixonmars Well... @xiaoc-arch got the point, obviously in general less dependencies = better = more stable (at least for OS-level programs it definitely makes sense), but i guess that's Arch way....

Though dde-file-manager i believe requires deepin-movie & mpv for preview using space

Still Arch is very modular)

Best examples of really independent / portable Linux software are Telegram and Renoise)

keybreak commented 5 years ago

@BLumia Also by chance, maybe it's connected to this one https://github.com/linuxdeepin/developer-center/issues/896?

It came out same day as this bug, after same update and also is 4k related, so just in case thought you might want to check)

keybreak commented 5 years ago

@BLumia Solved in Arch and Manjaro, thanks! :+1:

keybreak commented 5 years ago

@BLumia @zhaofangfangdeepin Please reopen this issue and fix again, started to happen with new Manjaro Deepin update. But this time root file manager text is normal size, only it's icons and window size is small.

Just in case i've tried to change scaling logout-login - still same.

deepin-file-manager 1:4.8.4.1-1

OS: Manjaro 18.0.4 Illyria
Kernel: x86_64 Linux 4.19.42-1-MANJARO
Shell: bash 5.0.7
DE: Deepin 15.10.1
WM: Deepin WM
BLumia commented 5 years ago

But this time root file manager text is normal size, only it's icons and window size is small.

What's the output of env | grep QT and cat ~/.dde-env?

Will consider reopen this one or create a new one depends on the result.

keybreak commented 5 years ago

@BLumia

Here you go: env | grep QT

QT_DBL_CLICK_DIST=30

cat ~/.dde-env

# DDE user env file, bash script
export DEEPIN_WINE_SCALE="2.00";
export LANG="ru_RU.UTF-8";
BLumia commented 5 years ago

Well, seems a control center or dde-daemon issue, it should write the scaling info to ~/.dde-env. It's also weird since your env | grep QT only shows one result. for that case the normal apps will also don't have DPI scaling, too.

BLumia commented 5 years ago

@yefeifei

需要确认:调整 DPI 并注销重新登录后,~/.dde-env 中是否有被正确设置当前的 DPI ,环境变量中的相关环境变量是否有被正确设置,以及文件管理器的管理员模式缩放是否正确。

edit: 不用测了,确认这个行为改了。

BLumia commented 5 years ago

https://github.com/linuxdeepin/dde-file-manager/pull/173

No longer using ~/.dde_env now.

keybreak commented 5 years ago

Means this issue will be fixed on next update?

keybreak commented 5 years ago

Seems to be finally solved on 12.06.2019 Manjaro Deepin stable update.

@BLumia Thx, so ~/.dde_env can be safely removed, it's not used by dde anywhere else?

BLumia commented 5 years ago

Seems to be finally solved on 12.06.2019 Manjaro Deepin stable update.

@BLumia Thx, so ~/.dde_env can be safely removed, it's not used by dde anywhere else?

Yes you can remove that file now, but I can only confirm all project which I maintained are no longer using ~/.dde_env now. Not sure if other project is still using it. Feel free to fire a bug if you found any other project is still using that file :)