Feature #939


Add key stroke to launch terminal

Added by Hammel over 1 year ago. Updated 10 months ago.

Target version:
Start date:
25 Feb 2023
Due date:
% Done:


Estimated time:
02 - High


In Media Player there is no terminal icon. But there doesn't need to be if a key combe, say Ctrl-T, will launch the terminal. This is useful when debugging.

Actions #1

Updated by Hammel 10 months ago

  • Priority changed from Urgent to Immediate
Actions #2

Updated by Hammel 10 months ago

Here is an example from stackoverflow.

    case GDK_m:
      if (event->state & GDK_SHIFT_MASK)
        printf("key pressed: %s\n", "shift + m");
      else if (event->state & GDK_CONTROL_MASK)
        printf("key pressed: %s\n", "ctrl + m");
        printf("key pressed: %s\n", "m");

So I just need to test for Ctrl-t (lowercase) for a terminal in launcher. That will cause an iteration of dbGetEntry() to find an appName == "Terminal Emulator", temporarily setting currentIndex to that appIndex and calling notify().

However, this doesn't work on systems that don't show the terminal icon because they won't have an appEntry for the terminal (it's xml config was removed). So launcher will need to keep the xml handy, even in these cases, and use it to setup a call to a subset of notify() instead of mucking with currentIndex.

Currently the only system that doesn't show the Terminal icon is kiosk, which copies the xml to a .noshow directory. Launcher can load .noshow entries in a separate link list and search them only in special cases. That way any system that doesn't want a terminal can just move it to .noshow in the launcher build, like kiosk does.

Actions #3

Updated by Hammel 10 months ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

To implement:

  • Make GList *appNoShow global in db.c
  • dbLoad() needs to be dbLoad(path,noshow), where path is the path to search for XML files and noshow=1 means populate the noshow list (appNoShow) instead of the normal list (appList).
    • update dbload() to dbLoad(path,0) in main()
    • add dbload(path/.noshow,1) to main()
  • dbGetEntry(idx) should be dbGetEntry(idx,noshow)
  • dbGetLength() should be dbGetLength(noshow)
  • notify() should be notify(idx,noshow)
    • Update existing calls to notify to be notify(currentIdx,0)
    • move call get dbGetEntry() in notify() to start of function to avoid network setup when no matching entry exists.
  • Add key handler for Ctrl-T that iterates over dbGetLength(1) on dbGetEntry(idx,1) to find the terminal entry, and then calls notify for that entry.
    • the .noshow list will never change so we only need to get this index once and hang onto it.

This assumes all we want from the .noshow entries are to read them into a link list. This will allow us to search for the entries however we choose by iterating over them one at a time. This is inefficient but since the .noshow list is likely to be very small and only searched once it isn't tragically bad.

Actions #4

Updated by Hammel 10 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 10 to 100

I had to add dbFindEntry() to search by appName, but other than that the implementation steps in the previous comment were all that was needed.

Implemented and tested on RPi 4 hardware with HDMI and wired keyboard.

Code committed and pushed.

Closing issue.


Also available in: Atom PDF