Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package tbsm for openSUSE:Factory checked in 
at 2022-12-31 11:23:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/tbsm (Old)
 and      /work/SRC/openSUSE:Factory/.tbsm.new.1563 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "tbsm"

Sat Dec 31 11:23:02 2022 rev:2 rq:1045838 version:0.7

Changes:
--------
--- /work/SRC/openSUSE:Factory/tbsm/tbsm.changes        2022-04-08 
00:29:22.565203446 +0200
+++ /work/SRC/openSUSE:Factory/.tbsm.new.1563/tbsm.changes      2022-12-31 
11:23:03.984508975 +0100
@@ -1,0 +2,16 @@
+Fri Dec 30 15:55:29 UTC 2022 - Jan-Luca Kiok <[email protected]>
+
+- Change build dependency to devel package instead of versioned lib
+
+-------------------------------------------------------------------
+Sun Nov 13 17:37:23 UTC 2022 - Jan-Luca Kiok <[email protected]>
+
+- Update to version 0.7
+  * Use colon as path separator in sessionPfads string
+  * Make check if running in tty more fuzzy
+  * Drop not needed option when using ln command
+  * runSession: detect DBUS_SESSION_ADDRESS
+- Manual: Add a hint how to add a shell session to the menu
+- Add build-dep libpcre1
+
+-------------------------------------------------------------------

Old:
----
  v0.6.tar.gz

New:
----
  v0.7.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ tbsm.spec ++++++
--- /var/tmp/diff_new_pack.YuKEFI/_old  2022-12-31 11:23:05.468517862 +0100
+++ /var/tmp/diff_new_pack.YuKEFI/_new  2022-12-31 11:23:05.472517886 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           tbsm
-Version:        0.6
+Version:        0.7
 Release:        0
 Summary:        A pure bash session or application launcher
 License:        GPL-2.0-only
@@ -25,6 +25,7 @@
 Group:          System/X11/Utilities
 URL:            https://loh-tar.github.io/tbsm
 Source:         
https://github.com/loh-tar/tbsm/archive/refs/tags/v%{version}.tar.gz
+BuildRequires:  pcre-devel
 
 %description
 tbsm is an application or session launcher, written in pure bash with no 
ncurses or dialog dependencies. It is inspired by cdm, tdm, in some way by 
krunner and related.

++++++ v0.6.tar.gz -> v0.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tbsm-0.6/.kateconfig new/tbsm-0.7/.kateconfig
--- old/tbsm-0.6/.kateconfig    2022-02-27 14:00:34.000000000 +0100
+++ new/tbsm-0.7/.kateconfig    2022-11-13 10:47:22.000000000 +0100
@@ -4,3 +4,5 @@
 kate-wildcard(*.sgml): replace-tabs on; indent-width 2; remove-trailing-spaces 
modified;
 kate-wildcard(*.md;*.txt): replace-tabs on; indent-width 2; 
remove-trailing-spaces modified;
 kate-mimetype(text/plain): replace-tabs on; indent-width 2; 
remove-trailing-spaces modified;
+
+kate: remove-trailing-spaces modified; default-dictionary en_US; replace-tabs 
on;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tbsm-0.6/README.md new/tbsm-0.7/README.md
--- old/tbsm-0.6/README.md      2022-02-27 14:00:34.000000000 +0100
+++ new/tbsm-0.7/README.md      2022-11-13 10:47:22.000000000 +0100
@@ -4,7 +4,7 @@
 ncurses or dialog dependencies. It is inspired by cdm, tdm, in some way by
 krunner and related.
 
-**Last version is 0.6, Feb 2022**
+**Last version is 0.7, Nov 2022**
 
 Details about **tbsm** can be found in the doc directory and on
 the [tbsm home page](https://loh-tar.github.io/tbsm/) with some
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tbsm-0.6/doc/01_Manual.txt 
new/tbsm-0.7/doc/01_Manual.txt
--- old/tbsm-0.6/doc/01_Manual.txt      2022-02-27 14:00:34.000000000 +0100
+++ new/tbsm-0.7/doc/01_Manual.txt      2022-11-13 10:47:22.000000000 +0100
@@ -1,4 +1,4 @@
-                                                             tbsm v0.6, Feb 
2022
+                                                             tbsm v0.7, Nov 
2022
 Index
 =======
 1- Introduction
@@ -46,7 +46,7 @@
 2- Things Of Interest
 =======================
 He only works with .desktop files to start something, there is no other
-possibility.
+possibility. See 4-6- for a custom example.
 
 The following statements assume a usual configuration. However there will
 XDG_CONFIG_HOME and XDG_CONFIG_DIRS respected.
@@ -116,7 +116,10 @@
 
   $ cat ~/.config/tbsm/start-x
   #!/bin/bash
-  # $@ contains: $1="${bin[@]}"  $2="--"  $3="${XserverArg[@]}"
+  # $@ contains: "${bin} -- ${XserverArg}" but all splitted, so $2 may "--"
+  # but not for sure. $3 is typically ":1" (display) $4 typically "-nolisten"
+  # and so on. Depending on your config settings.
+  #
   # do something before
   startx $@
   # do something after
@@ -129,6 +132,7 @@
 Here are some hints collected in order as they was reported. Should that list
 grow in the future I should better enable the Wiki feature on GitHub.
 
+
 4-1- tbsm together with tmux
 ------------------------------
 When using tmux, tbsm will run with the above mentioned setup in each terminal
@@ -186,10 +190,24 @@
   mkdir -p $(dirname $ownLogfile)
   # We also set an option to improve readability on high resolution displays in
   # a slightly strange way. Typical we would set XserverArg in the conf file
-  # Just remember: $@ is like "${bin[@]} -- ${XserverArg[@]}"
+  # Just remember: $@ is like "${bin} -- ${XserverArg}"
   startx $@ -dpi 120 2> ${ownLogfile}
 
 
+4-6- Add a shell session to the menu
+--------------------------------------
+In this example you will be dropped to a bash shell, other shells will have
+similar options. When your are done type 'exit' and you came back to tbsm.
+
+  $ cat ~/.config/tbsm/whitelist/bash-session.desktop
+  [Desktop Entry]
+  Name=Bash Session
+  Exec=bash -i
+  Terminal=true
+
+Asked by bee-keeper, https://github.com/loh-tar/tbsm/issues/18
+
+
 5- Contact
 ============
 The home of tbsm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tbsm-0.6/doc/60_DefaultConfig.txt 
new/tbsm-0.7/doc/60_DefaultConfig.txt
--- old/tbsm-0.6/doc/60_DefaultConfig.txt       2022-02-27 14:00:34.000000000 
+0100
+++ new/tbsm-0.7/doc/60_DefaultConfig.txt       2022-11-13 10:47:22.000000000 
+0100
@@ -35,7 +35,7 @@
                       # @Xdisplay@ will replaced by number of tty
 #   verboseLevel="3"  # 0=quiet, 1=silent, 2=info, 3=verbose
 #   theme=""          # Ok, it is theme related
-#   sessionPfads="/usr/share/xsessions /usr/share/wayland-sessions"
+#   sessionPfads="/usr/share/xsessions:/usr/share/wayland-sessions"
                       # Yeah, looks like a typo, but use it as written :-)
 
 # Available text (foreground) colors and attributes, protected not to change.
@@ -63,6 +63,7 @@
 #   tbsmColor="${txtBold}"
 #   promptCol="${tbsmColor}"
 #   menuTitle="${tbsmColor}T${txtNormal}erminal ${tbsmColor}B${txtNormal}ased 
${tbsmColor}S${txtNormal}ession ${tbsmColor}M${txtNormal}anager 
(${tbsmColor}${myName}${txtNormal} v${myVersion})"
+#   colSeparator="${txtClean}"
 #   menuSeparator="--------------------------------------------"
 #   menuPrompt="${myName}:"
 #   menuHint="${tbsmColor}Hint:${txtNormal}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tbsm-0.6/doc/80_ReleaseNotes.txt 
new/tbsm-0.7/doc/80_ReleaseNotes.txt
--- old/tbsm-0.6/doc/80_ReleaseNotes.txt        2022-02-27 14:00:34.000000000 
+0100
+++ new/tbsm-0.7/doc/80_ReleaseNotes.txt        2022-11-13 10:47:22.000000000 
+0100
@@ -1,19 +1,15 @@
-Release notes to tbsm version v0.6, Feb 2022
+Release notes to tbsm version v0.7, Nov 2022
 ==============================================
-031c2a3 - Makefile: Add new target 'update'
-e7cc113 - Manual: Add Tips&Tricks section
-          Thanks to all who gave a hint
-afdb675 - Allow configuration of session search paths by conf file
-          Thanks to Douglas
-54b0c57 - Support XDG Base Directory Specification
-          Thanks to Vladimir
-0f04aa3 - Exit on error in config file. Prior was such an error ignored
-9f82e2d - Allow custom Xorg startup file
-53d339e - Improved user information in verbose mode - 1a4d9f1
-a6e7bcb - Add new doc file ReleaseNotes (Hey, you're reading it!)
-a6e7bcb - Rename ChangeLog to ReleaseLog
+c69bc18 - runSession: detect DBUS_SESSION_ADDRESS
+          Thanks to Victor for this DBUS/Wayland fix
+4e8ad87 - Drop not needed option when using ln command
+d6e8982 - Make check if running in tty more fuzzy ...
+          With these two we try to be more BSD compatible
+56ec23b - Use colon as path separator in sessionPfads string
+          CAUTION! if you have used that in your config!
+9c3a661 - Manual: Add a hint how to add a shell session to the menu
 
================================================================================
-Previous tbsm version was v0.5, Dez 2018
+Previous tbsm version was v0.6, Feb 2022
 
--------------------------------------------------------------------------------
 To view older release notes : tbsm doc log
 The full changelog is online: https://github.com/loh-tar/tbsm/commits/master
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tbsm-0.6/doc/81_ReleaseLog.txt 
new/tbsm-0.7/doc/81_ReleaseLog.txt
--- old/tbsm-0.6/doc/81_ReleaseLog.txt  2022-02-27 14:00:34.000000000 +0100
+++ new/tbsm-0.7/doc/81_ReleaseLog.txt  2022-11-13 10:47:22.000000000 +0100
@@ -5,6 +5,18 @@
 
--------------------------------------------------------------------------------
 
 
+2022-11-13  v0.7
+=======================================
+c69bc18 - runSession: detect DBUS_SESSION_ADDRESS
+          Thanks to Victor for this DBUS/Wayland fix
+4e8ad87 - Drop not needed option when using ln command
+d6e8982 - Make check if running in tty more fuzzy ...
+          With these two we try to be more BSD compatible
+56ec23b - Use colon as path separator in sessionPfads string
+          CAUTION! if you have used that in your config!
+9c3a661 - Manual: Add a hint how to add a shell session to the menu
+
+
 2022-02-27  v0.6
 =======================================
 031c2a3 - Makefile: Add new target 'update'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tbsm-0.6/src/.shellcheckrc 
new/tbsm-0.7/src/.shellcheckrc
--- old/tbsm-0.6/src/.shellcheckrc      1970-01-01 01:00:00.000000000 +0100
+++ new/tbsm-0.7/src/.shellcheckrc      2022-11-13 10:47:22.000000000 +0100
@@ -0,0 +1,3 @@
+# Verify variable is used
+#   We have so much unused vars, like configured colors. So this check is pesky
+disable=SC2034
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tbsm-0.6/src/tbsm new/tbsm-0.7/src/tbsm
--- old/tbsm-0.6/src/tbsm       2022-02-27 14:00:34.000000000 +0100
+++ new/tbsm-0.7/src/tbsm       2022-11-13 10:47:22.000000000 +0100
@@ -37,7 +37,7 @@
 
 declare -r myName="tbsm"
 declare -r myLongName="Terminal Based Session Manager"
-declare -r myVersion="0.6" # Feb 2022
+declare -r myVersion="0.7" # Nov 2022
 declare -r myDescription="A pure bash session and application launcher"
 
 # Let's support XDG Base Directory Specification
@@ -54,7 +54,7 @@
 declare -r configDir="${XDG_CONFIG_HOME:-${HOME}/.config}/${myName}"
 
 declare -r installPfad=""
-declare    sessionPfads="/usr/share/xsessions /usr/share/wayland-sessions"
+declare    sessionPfads="/usr/share/xsessions:/usr/share/wayland-sessions"
 declare    runInTTY="yes"         # When unset we have no tty, glas is half 
full
 declare    XserverArg="@Xdisplay@ -nolisten tcp"  # @Xdisplay@ will replaced 
by number of tty
 declare    protectedVerbose
@@ -113,14 +113,14 @@
   #   0 You have data
   #   1 No more data
 
-  local last=(${#cmdStack[@]}-1)
+  local last=${#cmdStack[@]}-1
 
   command=""
 
   [[ "${last}" -lt 0 ]] && return 1
 
   command="${cmdStack[${last}]}";
-  cmdStack=(${cmdStack[@]:0:last})
+  cmdStack=("${cmdStack[@]:0:last}")
 # # #   echo "pop  cmd: $command"
 }
 
@@ -132,7 +132,7 @@
   # We could use popCommand here and test if there is "quit" but then we have 
to
   # to re-push it. That's why we code all again
 
-  local last=(${#cmdStack[@]}-1)
+  local last=${#cmdStack[@]}-1
 
   argument=""
 
@@ -140,7 +140,7 @@
   [[ "${cmdStack[${last}]}" == "quit" ]] && return 1
 
   argument="${cmdStack[${last}]}";
-  cmdStack=(${cmdStack[@]:0:last})
+  cmdStack=("${cmdStack[@]:0:last}")
 # # #   echo "popedArg: $argument"
 }
 
@@ -167,7 +167,7 @@
 }
 
 # http://stackoverflow.com/a/229606
-hasOption() { [[ "${argList[@]}" == *"--$1"* ]]; }
+hasOption() { [[ "${argList[*]}" == *"--$1"* ]]; }
 
 # It's better not to use echo
 # http://unix.stackexchange.com/a/65819
@@ -200,8 +200,10 @@
 checkConfigDir() {
   [[ -d "${configDir}" ]] && return
 
-  mkdir -p "${configDir}"/{blacklist,themes,whitelist} 2>/dev/null
-  [[ $? != 0 ]] && exitError "Can't create my config dir: ${configDir}"
+  if ! mkdir -p "${configDir}"/{blacklist,themes,whitelist} 2>/dev/null ; then
+    exitError "Can't create my config dir: ${configDir}"
+  fi
+
   info "Created config directory: ${configDir}"
 }
 
@@ -214,7 +216,7 @@
 
   # Hint: We can't print information about success/fail in this loop and 
respect
   # at the same time some verbose level. That why we collect data and print 
later
-  for path in ${searchPath[@]}; do
+  for path in "${searchPath[@]}" ; do
     local fullPath="${path}/${cfgFile}"
     if [[ ! -r "${fullPath}" ]]; then
       failPath=("${failPath[@]}" "${fullPath}")
@@ -225,7 +227,7 @@
 
     # http://stackoverflow.com/a/20815951
     local -i lineNo=0
-    while IFS='= ' read lhs rhs
+    while IFS='= ' read -r lhs rhs
     do
       (( ++lineNo ))
       if [[ ! $lhs =~ ^\ *# && -n $lhs ]]; then
@@ -234,30 +236,30 @@
 
         # Without eval does it not works as intended. Because we want use
         # already known variables in config files too.
-        declare -g $lhs="$(eval "echo $rhs")" || exitError "Bad config in 
file: ${fullPath} line: ${lineNo}"
+        declare -g "$lhs"="$(eval "echo $rhs")" || exitError "Bad config in 
file: ${fullPath} line: ${lineNo}"
       fi
     done < "${fullPath}"
 
   done
 
-  if (( !$ok )); then
+  if (( ! ok )); then
     error "No config file '${cfgFile##*/}' found"
     error "+-Searched in: ${failPath[0]%/*}/"
-    for path in ${failPath[@]:1}; do
+    for path in "${failPath[@]:1}" ; do
       error "+------------: ${path%/*}/"
     done
     return 1
   fi
 
   # Restore verbose level given on command line, if some
-  [[ -n "${protectedVerbose}" ]] && verboseLevel=("${protectedVerbose}")
+  [[ -n "${protectedVerbose}" ]] && verboseLevel="${protectedVerbose}"
 
   if [[ ${verboseLevel} -gt "2" ]] ; then
     info "Searched for config file(s) '${cfgFile##*/}' in ..."
-    for path in ${failPath[@]}; do
+    for path in "${failPath[@]}" ; do
       info "- Nothing in: ${path%/*}/"
     done
-    for path in ${usedPath[@]}; do
+    for path in "${usedPath[@]}" ; do
       info "+ Utilized  : ${path}"
     done
   fi
@@ -292,10 +294,9 @@
   fillBlacklist
   clearLists "keepBlack"
 
-  for pfad in ${sessionPfads[@]}; do
+  for pfad in "${sessionPfads[@]}" ; do
     info "Look at session path: ${pfad}"
-    readDesktopFiles "$pfad" "$warnOnly"
-    [[ $? == 0 ]] && (( ++goodPfads ))
+    readDesktopFiles "$pfad" "$warnOnly" && (( ++goodPfads ))
   done
   if [[ $goodPfads -eq  "0" ]]; then
     warn "${FUNCNAME[0]}: No session paths found"
@@ -322,15 +323,16 @@
 
   for ((count=0; count < ${#desktopFiles[@]}; count++)); do
     # Filter blacklisted entries
-    realLink=("$(readlink -m ${desktopFiles[${count}]})")
+    realLink="$(readlink -m "${desktopFiles[${count}]}")"
     # http://stackoverflow.com/a/15394738
-    [[ "${blacklist[@]}" =~ "${realLink}" ]] && continue
+    # shellcheck disable=SC2076 # Guess we need the quotes to avoid false 
positive
+    [[ " ${blacklist[*]} " =~ " ${realLink} " ]] && continue
 
     # TryExec key is there to determine if executable is present,
     # but as we are going to test the Exec key anyway, we ignore it.
     # http://stackoverflow.com/a/22550813
-    execKey=$(sed -nr '/^\[Desktop Entry\]/,/^\[/{s/^Exec=//p}' 
${desktopFiles[${count}]})
-    nameKey=$(sed -nr '/^\[Desktop Entry\]/,/^\[/{s/^Name=//p}' 
${desktopFiles[${count}]})
+    execKey=$(sed -nr '/^\[Desktop Entry\]/,/^\[/{s/^Exec=//p}' 
"${desktopFiles[${count}]}")
+    nameKey=$(sed -nr '/^\[Desktop Entry\]/,/^\[/{s/^Name=//p}' 
"${desktopFiles[${count}]}")
     # Sadly have only the plasma.desktop file an entry with "Type=XSession", 
all
     # other (sorry, the few I have seen) says "Type=Application", so work 
around this
     flag="X"
@@ -339,26 +341,26 @@
     elif [[ $realLink == *"wayland-sessions"* ]]; then
       flag="W"    # Treat all in /usr/share/wayland-sessions as such
     else
-      val=$(sed -nr '/^\[Desktop Entry\]/,/^\[/{s/^Type=//p}' 
${desktopFiles[${count}]})
+      val=$(sed -nr '/^\[Desktop Entry\]/,/^\[/{s/^Type=//p}' 
"${desktopFiles[${count}]}")
       if [[ "${val}" == "XSession" ]]; then
         flag="S"  # Takes action when there is a real local file, not a link
       else
-        val=$(sed -nr '/^\[Desktop Entry\]/,/^\[/{s/^Terminal=//p}' 
${desktopFiles[${count}]})
+        val=$(sed -nr '/^\[Desktop Entry\]/,/^\[/{s/^Terminal=//p}' 
"${desktopFiles[${count}]}")
         [[ "${val}" == "true" ]] && flag="C"
       fi
     fi
     if [[ -n ${execKey} && -n ${nameKey} ]]; then
       # The .desktop files allow there Exec keys to use $PATH lookup.
-      binItem="$(which "${execKey%%[ ]*}" 2>/dev/null)"
+      if ! binItem="$(which "${execKey%%[ ]*}" 2>/dev/null)"
       # If which fails to return valid path, skip to next .desktop file.
-      if [[ $? != 0 ]]
         then
         warn "Skip '$nameKey' Binary found not: ${execKey%%[ ]*}"
         continue
       fi
-      binList+=("${binItem} ${execKey#*${execKey%%[ ]*}}")
+      binList+=("${binItem} ${execKey#*"${execKey%%[ ]*}"}")
       flagList+=("${flag}")
-      if [[ "$flag" == "W" ]] && [[ " ${nameList[@]} " =~ " ${nameKey} " ]]; 
then
+      # shellcheck disable=SC2076 # Guess we need the quotes to avoid false 
positive
+      if [[ "$flag" == "W" ]] && [[ " ${nameList[*]} " =~ " ${nameKey} " ]]; 
then
           nameList+=("${nameKey} (Wayland)")
       else
           nameList+=("${nameKey}")
@@ -377,7 +379,7 @@
     # Given -maxdepth 1 to fix trouble at storing default/lastSession
     # links above blacklist/whitelist directorys
     # Why use -regex and not -name ?
-    desktopFiles=($(find "${filePfad}" -maxdepth 1 -regex .\*.desktop | sort))
+    mapfile -t desktopFiles < <(find "${filePfad}" -maxdepth 1 -regex 
.\*.desktop | sort)
     parseDesktopFiles
   else
     if [[ ${warnOnly} ]]; then
@@ -402,7 +404,7 @@
   clearLists
 
   if [[ -d "${filePfad}" ]]; then
-    desktopFiles=($(grep -Ril --include="*.desktop" "$pattern" "$filePfad" | 
sort))
+    mapfile -t desktopFiles < <(grep -Ril --include="*.desktop" "$pattern" 
"$filePfad" | sort)
     info "Found matches: ${#desktopFiles[@]}"
     parseDesktopFiles
   else
@@ -420,12 +422,9 @@
 }
 
 printMenuHeader() {
-  # When called without argument set title to menuTitle
-  local title=${@:-${menuTitle}}
-
   if [[ ! "${noMenuHeader}" ]]; then
     printMenuSeparator
-    print "${title}"
+    print "${menuTitle}"
     printMenuSeparator
   fi
 }
@@ -456,12 +455,12 @@
   # Run $bin according to its flag.
   case ${flagList[${listIndex}]} in
     C)  # Console programs
-      info "Run command: ${bin[@]}"
-      ${bin[@]}
+      info "Run command: ${bin}"
+      eval "${bin}"
       ;;
     S)  # X Sessions
       if [[ $runInTTY ]]; then
-        runXSession "${bin[@]}"
+        runXSession "${bin}"
       else
         info "Not running in tty. Will not start X session." "0"
         return 1
@@ -469,10 +468,12 @@
       ;;
     W) # Wayland Sessions
       if [[ $runInTTY ]]; then
-        [[ "${bin[@]}" =~ (^| )(/.*/)?dbus-run-session( |$) ]] ||
-        waylandSessionArgs+=$(which dbus-run-session 2> /dev/null)
-        info "Run command: XDG_SESSION_TYPE=wayland 
${waylandSessionArgs:+${waylandSessionArgs[@]} }${bin[@]}"
-        XDG_SESSION_TYPE=wayland 
${waylandSessionArgs:+${waylandSessionArgs[@]} }${bin[@]}
+        if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
+            waylandSessionArgs+=$(which dbus-run-session 2> /dev/null)
+        fi
+        info "Run command: XDG_SESSION_TYPE=wayland 
${waylandSessionArgs:+${waylandSessionArgs[*]} }${bin}"
+        # shellcheck disable=SC2086 # Don't work when we quote $bin
+        XDG_SESSION_TYPE=wayland 
${waylandSessionArgs:+${waylandSessionArgs[@]} }${bin}
       else
         info "Not running in tty. Will not start Wayland session." "0"
         return 1
@@ -480,10 +481,10 @@
       ;;
     X)  # Applications
       if [[ $runInTTY ]]; then
-        runXSession "${bin[@]}"
+        runXSession "${bin}"
       else
-        info "Not running in tty, run: ${bin[@]}"
-        ${bin[@]}
+        info "Not running in tty, run: ${bin}"
+        eval "${bin}"
       fi
       ;;
     -)  # Old cdm/tdm stuff, not used
@@ -496,7 +497,7 @@
 
   # Exit or not. Show full menu if no command left
   if popCommand
-    then pushCommand ${command}
+    then pushCommand "${command}"
     else pushCommand "menu"
   fi
 }
@@ -504,11 +505,11 @@
 runXSession() {
   # Has the user configured some custom start X file?
   local -a searchPath=("${configDir}" "${sessionStartDirs[@]}")
-  for path in ${searchPath[@]}; do
+  for path in "${searchPath[@]}"; do
     local startFile="${path}/start-x"
     if [[ -x "${startFile}" ]]; then
       info "Start X by ${startFile}"
-      "${startFile}" "${bin[@]}" "--" "${XserverArg[@]}"
+      eval "${startFile} ${bin} -- ${XserverArg}"
       return
     fi
     if [[ -f "${startFile}" ]]; then
@@ -519,8 +520,9 @@
   done
 
   # No special start file found, use the build in
-  info "Run command: startx ${bin[@]} -- ${XserverArg[@]}"
-  startx ${bin[@]} -- ${XserverArg[@]}
+  info "Run command: startx ${bin} -- ${XserverArg}"
+  # shellcheck disable=SC2068,SC2086 # We need the splitting here, or(?)
+  startx ${bin} -- ${XserverArg}
 }
 
 showQuickMenu() {
@@ -533,8 +535,8 @@
 
   local promptText
   promptText="${promptCol}${quickPrompt}${txtNormal} [*]"
-  [[ -n "${defaultSession}" ]] && promptText=("${promptText}  
[!]${nameList[0]}")
-  [[ -n "${lastSession}" && "${lastSession}" != "${defaultSession}" ]] && 
promptText=("${promptText} [ ]${nameList[1]}")
+  [[ -n "${defaultSession}" ]] && promptText="${promptText}  [!]${nameList[0]}"
+  [[ -n "${lastSession}" && "${lastSession}" != "${defaultSession}" ]] && 
promptText="${promptText} [ ]${nameList[1]}"
 
   promptText="${promptText} "
 
@@ -544,12 +546,13 @@
   elif [[ -z "${userInput}" ]]; then runSession "1"
   else
     # Don't quote here or it will not work as intended
+    # shellcheck disable=SC2086
     pushCommand ${userInput#!}
   fi
 }
 
 showMenu() {
-  printMenuHeader $1
+  printMenuHeader
   printMenuList
   printMenuFooter
 }
@@ -577,7 +580,7 @@
     ok=1
   done
 
-  if (( !$ok )) ; then
+  if (( ! ok )) ; then
     # FUNCNAME is a build in bash array. We cut leading 3 char "cmd"
     error "${FUNCNAME[1]:3} need a valid session number"
     return 1
@@ -603,8 +606,8 @@
       2) err=1; continue; ;; # Error but we ignore it
     esac
 
-    for file in ${configDir}/${list}/* ; do
-      link=("$(readlink -m ${file})")
+    for file in "${configDir}/${list}/"* ; do
+      link="$(readlink -m "${file}")"
       if [[ "${link}" == "${linkList[${listIndex}]}" ]] ; then
         unlink "$file"
         info "Session removed from ${list}: ${nameList[${listIndex}]}" "1"
@@ -614,7 +617,7 @@
 
   done
 
-  if (( !$ok || $err )) ; then
+  if (( ! ok ||  err )) ; then
     # FUNCNAME is a build in bash array. We cut leading 3 char "cmd"
     error "${FUNCNAME[1]:3} needs a valid session number"
     return 1
@@ -641,7 +644,7 @@
     return
   fi
 
-  ln -sf -T "${linkList[${listIndex}]}" 
"${configDir}/000-default-session.desktop"
+  ln -sf "${linkList[${listIndex}]}" "${configDir}/000-default-session.desktop"
   info "New default session: ${nameList[${listIndex}]}" "1"
   sleep 1
 }
@@ -652,7 +655,7 @@
   local docPath="/usr/share/doc/tbsm"
 
   popArgument
-  docMatch=($(find "${docPath}" -not -type d -iname \*${argument}\* | sort))
+  mapfile -t docMatch < <(find "${docPath}" -not -type d -iname 
\*"${argument}"\* | sort)
 
   if [[ ${#docMatch[@]} -gt 1 ]]; then
     print "Available documentation:"
@@ -660,10 +663,10 @@
       doc="${doc#*/??_}"
       print "  ${doc%.*}"
     done
-  elif [[ -z "$docMatch" ]]; then
+  elif (( ${#docMatch[@]} == 0 )) ; then
       print "No manual match '${argument}'"
   else
-   less "$docMatch"
+   less "${docMatch[0]}"
   fi
 }
 
@@ -762,7 +765,7 @@
   if [[ $runInTTY ]]; then
     # Logout is not easy from inside a script. Can you do it better?
     myPid=$$
-    kill -SIGHUP $(ps -ef | awk '($2=="'$myPid'"){print $3}')
+    kill -SIGHUP "$(ps -ef | awk '($2=="'$myPid'"){print $3}')"
   else
     exitNormal
   fi
@@ -790,7 +793,7 @@
   if [[ "${linkList[${listIndex}]}" != "-" ]]; then
     # Don't save default as last session
     if [[ "${defaultSession}" !=  "${linkList[${listIndex}]}" ]]; then
-      ln -sf -T "${linkList[${listIndex}]}" 
"${configDir}/001-last-session.desktop"
+      ln -sf "${linkList[${listIndex}]}" 
"${configDir}/001-last-session.desktop"
     fi
 
     if [[ -z "${defaultSession}" ]]; then
@@ -837,8 +840,8 @@
     # the user may write down his command the input would discard.
     # That's why we wait for the first key stroke
     # FIXME: With -e is a new line printed after key stroke
-    read -s -n 1 -t 12 -p "${promptText} " userInput;
-    if [[ $? > 128 ]]; then
+    read -rs -n 1 -t 12 -p "${promptText} " userInput;
+    if [[ $? -gt 128 ]]; then
       print $'\r'"${menuHint} 1-${#nameList[@]} b d l m qm q r s w X ?"
     elif [[ -z "${userInput}" ]]; then
       pushCommand "quick-menu"
@@ -848,7 +851,7 @@
       userInput=""
       # Flush keyboard if e.q. cursor key was pressed
       # http://superuser.com/a/364421
-      read -t 0.01 -n 100
+      read -rt 0.01 -n 100
       printf $'\r'
       continue
     fi
@@ -857,7 +860,7 @@
     # http://stackoverflow.com/a/25000195
     read -erp "${promptText} " -i "$userInput" -a userInput ;
 
-    if [[ -z "${userInput}" ]]; then
+    if (( ${#userInput[@]} == 0 )) ; then
       pushCommand "quick-menu"
     elif [[ "${userInput[0]}" =~ ^[1-9]*[0-9]+$ ]]; then
       pushCommand "run" "${userInput[0]}"
@@ -898,6 +901,9 @@
   readConfigFile "themes/${theme}"
 fi
 
+# Convert our path string into an array for nicer handling later
+IFS=':' read -ra sessionPfads <<< "$sessionPfads"
+
 # FIXME: Do you know a way to "re-eval" strings with variables in it so we can
 #        simple 'declare' all these on top of file but have effect if a config
 #        file change e.g. a color?
@@ -906,6 +912,7 @@
 [[ -z "$tbsmColor" ]]     && tbsmColor="${txtBold}"
 [[ -z "$promptCol" ]]     && promptCol="${tbsmColor}"
 [[ -z "$menuTitle" ]]     && menuTitle="${tbsmColor}T${txtNormal}erminal 
${tbsmColor}B${txtNormal}ased ${tbsmColor}S${txtNormal}ession 
${tbsmColor}M${txtNormal}anager (${tbsmColor}${myName}${txtNormal} 
v${myVersion})"
+[[ -z "$colSeparator" ]]  && colSeparator="${txtClean}"
 [[ -z "$menuSeparator" ]] && 
menuSeparator="--------------------------------------------"
 [[ -z "$menuPrompt" ]]    && menuPrompt="${myName}:"
 [[ -z "$menuHint" ]]      && menuHint="${tbsmColor}Hint:${txtNormal}"
@@ -916,11 +923,11 @@
 
 # Check if running in tty and set X displaynumber
 runInTTY=$(tty)
-if [[ ! "$runInTTY" =~ /dev/tty[0-9] ]]; then
+if [[ ! "$runInTTY" =~ /dev/tty[a-z]*([0-9]) ]]; then
   unset runInTTY
 else
   # Replace @Xdisplay@ with e.g. :1
-  XserverArg=${XserverArg/@Xdisplay@/:${runInTTY#/dev/tty}}
+  XserverArg=${XserverArg/@Xdisplay@/:${BASH_REMATCH[1]}}
 fi
 
 # Special handling to support GNU style help
@@ -938,6 +945,7 @@
   IamToStupid="$*"
   IamToStupid="${IamToStupid%%--*}"
   # Don't quote here or it will not work as desired
+  # shellcheck disable=SC2068
   pushCommand ${IamToStupid[@]}
 fi
 
@@ -971,8 +979,8 @@
                     pushCommand "run" "$command"                ; ;;
 
     # Try to catch lazy written b w commands
-    [bw][1-9])      pushCommand ${command:0:1} ${command:1}     ; ;;
-   -[bw][1-9])      pushCommand ${command:0:2} ${command:2}     ; ;;
+    [bw][1-9])      pushCommand "${command:0:1}" "${command:1}" ; ;;
+   -[bw][1-9])      pushCommand "${command:0:2}" "${command:2}" ; ;;
 
     *)              error "Unknown command: ${command}"         ; ;;
   esac

Reply via email to