Sunday, April 28, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 405  / 1 Year ago, sat, april 22, 2023, 6:00:29

I would like to do banshee --next, or just control banshee in general, from a virtual console (e.g., the one I get when I press Ctr-Alt-F1).



Is that possible? How can I do it?


More From » command-line

 Answers
7

It turns out my X session with dbus running has the following environment variable set, which is accessible from all terminal emulators in X:



DBUS_SESSION_BUS_ADDRESS


It's contents (`echo $DBUS_SESSION_BUS_ADDRESS) appear to denote the Unix socket used by Dbus.



Getting banshee terminal commands to work in a virtual console has turned out to be a simple matter of sharing that value with the virtual terminal.



To automate it, I wrote the following simple script:



$ cat get_dbus_addr.sh 
#!/bin/bash
#Use this file for sharing the most recent DBus socket address
FILE="/tmp/${USER}_DBUS_SESSION_BUS_ADDRESS"

if [ ! -z "$DBUS_SESSION_BUS_ADDRESS" ]
then
echo $DBUS_SESSION_BUS_ADDRESS > "$FILE"
else
export DBUS_SESSION_BUS_ADDRESS=`cat "$FILE"`
fi


I source the script from the appropriate terminal config files (so that it gets sourced in both GUI and in the virtual console). Sourcing it in the GUI saves the value to the sharing file in /tmp and sourcing it in a Virtual console (where the ENV variable isn't set) loads it.


[#27658] Sunday, April 23, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ampolinhad

Total Points: 88
Total Questions: 100
Total Answers: 116

Location: South Georgia
Member since Tue, Feb 1, 2022
2 Years ago
;