From 1a4a1b4b772379e1374619ec9f897603bb1f3c1e Mon Sep 17 00:00:00 2001 From: Berger Eugene Date: Sat, 13 Jan 2024 14:40:36 +0200 Subject: [PATCH] Bug Fix: #116 - Removed selection mode in Wayland session (temp) --- src/config/config.go | 5 +++++ src/tui/view.go | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/config/config.go b/src/config/config.go index a1459c2..34457f8 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -131,3 +131,8 @@ func isClient() bool { } return false } + +func IsLogSelectionOn() bool { + _, found := os.LookupEnv("WAYLAND_DISPLAY") + return !found +} diff --git a/src/tui/view.go b/src/tui/view.go index 7605f72..4276888 100644 --- a/src/tui/view.go +++ b/src/tui/view.go @@ -142,6 +142,9 @@ func (pv *pcView) onAppKey(event *tcell.EventKey) *tcell.EventKey { pv.logsText.ToggleWrap() pv.updateHelpTextView() case pv.shortcuts.ShortCutKeys[ActionLogSelection].key: + if !config.IsLogSelectionOn() { + return event + } pv.stopFollowLog() pv.toggleLogSelection() pv.appView.SetFocus(pv.logsTextArea) @@ -319,7 +322,9 @@ func (pv *pcView) updateHelpTextView() { pv.shortcuts.ShortCutKeys[ActionLogFind].writeButton(pv.helpText) pv.shortcuts.ShortCutKeys[ActionLogFindNext].writeButton(pv.helpText) pv.shortcuts.ShortCutKeys[ActionLogFindPrev].writeButton(pv.helpText) - pv.shortcuts.ShortCutKeys[ActionLogSelection].writeToggleButton(pv.helpText, !pv.logSelect) + if config.IsLogSelectionOn() { + pv.shortcuts.ShortCutKeys[ActionLogSelection].writeToggleButton(pv.helpText, !pv.logSelect) + } pv.shortcuts.ShortCutKeys[ActionLogFindExit].writeButton(pv.helpText) return } @@ -327,7 +332,9 @@ func (pv *pcView) updateHelpTextView() { pv.shortcuts.ShortCutKeys[ActionLogScreen].writeToggleButton(pv.helpText, logScrBool) pv.shortcuts.ShortCutKeys[ActionFollowLog].writeToggleButton(pv.helpText, !pv.logFollow) pv.shortcuts.ShortCutKeys[ActionWrapLog].writeToggleButton(pv.helpText, !pv.logsText.IsWrapOn()) - pv.shortcuts.ShortCutKeys[ActionLogSelection].writeToggleButton(pv.helpText, !pv.logSelect) + if config.IsLogSelectionOn() { + pv.shortcuts.ShortCutKeys[ActionLogSelection].writeToggleButton(pv.helpText, !pv.logSelect) + } pv.shortcuts.ShortCutKeys[ActionLogFind].writeButton(pv.helpText) fmt.Fprintf(pv.helpText, "%s ", "[lightskyblue::b]PROCESS:[-:-:-]") pv.shortcuts.ShortCutKeys[ActionProcessScale].writeButton(pv.helpText)