12

In the Cinnamon Desktop:

  • What command or code is run in response to Alt+F2?
  • In what file is this association stored?
  • What command or code is run in response to the r command in the command prompt window opened by Alt+F2?
AdminBee
  • 22,803
DrM
  • 345
  • 3
  • 13
  • Related: https://askubuntu.com/questions/143838/how-do-i-restart-cinnamon-from-the-tty/523436#523436 ==> pkill -HUP -f "cinnamon --replace". But I don't know if its exactly the same or if it just has the same effect. – pLumo May 09 '19 at 14:34
  • @RoVo that command locks up the session. I had to reboot and then it took an extra few minutes to login. Also that is the third part of the question. – DrM May 09 '19 at 14:59
  • Okay sorry, then I don't know – pLumo May 09 '19 at 15:23
  • @AdminBee Even though gnome has alt+f2 too, the answer is not the same for Cinnamon and Gnome. I knew about the answer for Gnome when I asked, and I asked about Cinnamon specifically. So your addition of a tag for gnome-shell is not correct. – DrM Jul 30 '21 at 18:16

2 Answers2

7

Since posting this question, and with the help of the discussion following the earlier posted answer, I found the following answer in the Cinnamon source code:

/**
 * cinnamon_global_reexec_self:
 * @global: A #CinnamonGlobal
 *
 * Restart the current process.  Only intended for development purposes.
 */
 void cinnamon_global_reexec_self (CinnamonGlobal *global)
 {
     meta_restart ();
 }

I have implemented access to this function as a bash command (restartcinnamon) by adding the following line to my .bashrc file:

alias restartcinnamon='dbus-send --type=method_call --print-reply \\
      --dest=org.Cinnamon /org/Cinnamon org.Cinnamon.Eval \\
      string:'\''global.reexec_self()'\'''   \\
      /usr/bin/dbus-send
AdminBee
  • 22,803
DrM
  • 345
  • 3
  • 13
  • The code seems to have changed, at least as of 5.4.10: dbus-send --type=method_call --dest=org.Cinnamon /org/Cinnamon org.Cinnamon.Eval string:"global.real_restart()" – Gab Oct 20 '22 at 00:26
  • @Gab Thank you, I will probably update my version of the script for doing this. Also, there is again an applet that works, "Restart Cinnamon", and alt-f2 is again working. But, the command line is still important. There is a bug that locks up everything, precluding the above, that seems to be triggered by some wireless mice. So, still very useful. – DrM Oct 20 '22 at 19:19
6

Cinnamon, like GNOME from which it was forked, will restart the session when you type r into the Alt-F2 window. It's just telling it to re-execute itself, so it's not invoking a new command, but telling the Cinnamon window manager to re-execute.

AdminBee
  • 22,803
jsbillings
  • 24,406
  • Thank you, but that is not what I am asking. I want the exact program that runs from the ALT+F2, and the exact command or call (or signal) that is restarting the session. – DrM May 09 '19 at 20:21
  • 3
    I’m saying that your question can’t be answered that way, because it isnt running a command. If you would like to know what it is doing, check out the javascript source for the restart: https://github.com/linuxmint/cinnamon/blob/32855c198036740f3b9ccf2ee36af6bd3f20557b/js/ui/runDialog.js#L38 – jsbillings May 09 '19 at 20:38
  • Okay, I see what you are saying. The question is still what code is getting executed. Your github link answers that in part, at least we know the name of the routine that is invoked. For gnome. there seems to be a way to invoke it form the command line, dbus-send --type=method_call --print-reply --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'global.reexec_self()' What would the equivalent be for cinnamon? – DrM May 10 '19 at 02:53
  • Judging from this source code, it probably works the same in Cinnamon: https://github.com/linuxmint/cinnamon/blob/68f06003d2946615eccbaeb6f732f46d82fb723b/js/ui/cinnamonDBus.js . Just substitute org.cinnamon and /org/cinnamon for org.gnome.shell and /org/gnome/shell. – jsbillings May 10 '19 at 10:57
  • That's good, but it should be org.Cinnamon (capitalized). I found the dbus service with "d-feet". This answers a question that has been asked repeatedly in different ways over a few years. Anything on the other parts of the question? – DrM May 10 '19 at 13:23
  • It seems that ultimately, ALT+F2 finds its way into the code you linked to. But, it opens a window first, so it seems like there is some other code that the ALT+F2 invokes. And, where/how are the associations for keybindings stored? – DrM May 10 '19 at 13:29
  • @DrM https://github.com/linuxmint/cinnamon-desktop/blob/b823080f53b3b32afb0e0956ba2a23e2644c06e3/schemas/org.cinnamon.desktop.keybindings.wm.gschema.xml.in.in#L142 is where the alt-F2 is defined, as part of the cinnamon-desktop schema. That’s loaded by the javascript library that runs the dialog, and calls the RunDialog method (in runDialog.js), which creates the window. – jsbillings May 10 '19 at 15:12
  • I think we have fleshed out an answer to what I intended to ask. And, I have edited the question to be more clear, "what command or software" is now "what command or code". Do you want to fill in the answer? I posted the command line equivalent for "r" elsewhere, but meanwhile the original question seems worthwhile. I haven't found any documentation besides source code for the internals of the keybindings and commands. – DrM May 10 '19 at 15:59
  • I agree that there seems to be very little documentation. I’m only able to navigate the code because I have a passing familiarity with how gnome works. It appears the schema files are the closest thing to documentation of the configuration options you can make with dconf. – jsbillings May 10 '19 at 16:14