debian 12 里的 dolphin 空格键和之前功能不一样了,进入一个目录后,按空格键会进入Selection Mode
而不是选中当前(第一个)项目,感觉很烦人,于是我就修改源码恢复到之前的功能了。
这里记录一下步骤,供需要的人参考。
- 安装
devscripts
:
sudo apt install devscripts
- 构建依赖软件包:
mk-build-deps dolphin
- 安装构建依赖软件包:
sudo apt install ./dolphin-build-deps_22.12.3-1_amd64.deb
- 下载
dolphin
源码:
apt source dolphin
- 进入源码目录:
cd dolphin-22.12.3/
- 修改源码文件
src/kitemviews/kitemlistcontroller.cpp
:
@@ -435,11 +435,15 @@
m_selectionManager->setSelected(index, 1, KItemListSelectionManager::Toggle);
m_selectionManager->beginAnchoredSelection(index);
break;
- } else if (m_keyboardManager->addKeyBeginsNewSearch()) { // File names shouldn't start with a space,
- // so we can use this press as a keyboard shortcut instead.
- Q_EMIT selectionModeChangeRequested(!m_selectionMode);
- break;
+ } else {
+ // Select the current item if it is not selected yet.
+ const int current = m_selectionManager->currentItem();
+ if (!m_selectionManager->isSelected(current)) {
+ m_selectionManager->setSelected(current);
+ break;
+ }
}
+
}
Q_FALLTHROUGH(); // fall through to the default case and add the Space to the current search string.
default:
- 增加版本号:
dch -n
- 构建软件包:
debuild -b -us -uc
- 安装新软件包:
sudo dpkg -i ./libdolphinvcs5_22.12.3-1.1_amd64.deb ../dolphin_22.12.3-1.1_amd64.deb
- 删除无用软件包(
devscripts
和构建依赖):
sudo apt autoremove --purge devscripts dolphin-build-deps
最后再清理一下残留文件,整个过程就结束了。