LinHES Forums

Picking a new theme from the command line
Page 1 of 1

Author:  tjc [ Mon Mar 06, 2006 7:43 pm ]
Post subject:  Picking a new theme from the command line

Things can get fairly ugly if you accidentally select a theme that doesn't work well with your display (say a wide theme on a normal TV) or your add in theme is missing after an upgrade. The following script will let you change the theme from a text console.


if [ $(id -u) -ne 0 ] ; then
    echo "You must run this script as root!"
    exit 1

echo "Current GUI theme is:"
mysql mythconverg -e "select * from settings where value = 'Theme'"

echo "Current OSD theme is:"
mysql mythconverg -e "select * from settings where value = 'OSDTheme'"


THEMES=$(for i in $(ls $THEMEDIR) ; do
             [ -f $THEMEDIR/$i/theme.xml ] && echo "$i"
echo "Select the number of the GUI theme you would like to use:"
select THEME in $THEMES ; do echo ; break ; done

OSDTHEMES=$(for i in $(ls $THEMEDIR) ; do
                [ -f $THEMEDIR/$i/osd.xml ] && echo "$i"
echo "Select the number of the OSD theme you would like to use:"
select OSDTHEME in $OSDTHEMES ; do echo ; break ; done

echo "Setting Theme = '$THEME', OSDTheme = '$OSDTHEME'."
mysql mythconverg <<EOF
update settings set data = '$THEME' where value = 'Theme';
update settings set data = '$OSDTHEME' where value = 'OSDTheme';

pkill xinit

Edited to make the script work in modern systems which don't use gdm.

Author:  douw [ Fri Oct 13, 2006 3:12 am ]
Post subject: 

What if I inadvertently broke something in the appearance menu and now I cannot see the menus? LiveTv and playback still works.

Author:  mrshark [ Fri Oct 13, 2006 4:39 am ]
Post subject: 

am i the only that see all the phpbb bbcode tags in the forum posts? i see QUOTE, CODE, and so on, instead of their html translated couterparts... it's very annoying...

Author:  tjc [ Fri Oct 13, 2006 6:01 pm ]
Post subject: 


Author:  frisco [ Mon Dec 11, 2006 5:45 pm ]
Post subject: 

I'm getting an error running this with KM .20. It gives an error regarding incorrecto syntax with SQL. The reason I'm even trying to do this is to get my OSD Theme to match my GUI theme. Somehow they've become mismatched and I'm having trouble to switch them all back to Titivillus. Any suggestions?

Author:  tjc [ Mon Dec 11, 2006 6:39 pm ]
Post subject: 

I just tested it on my machine and it worked fine, so I'm guessing the something got botched in your cut & paste. I even snagged the source out of the page to be sure the versions match. You are running this as root, right?

Author:  frisco [ Tue Dec 12, 2006 9:33 am ]
Post subject: 

Ok I figured it out - I'm a script tard!! I was pasting the EOF and /etc/init.d/gdm restart into the script file itself. I'm pretty forgetful so what I did was added the a line to the script that says:

echo "Don't forget to restart gdm with: /etc/init.d/gdm restart"

Once again thanks for your help TJC!!

Author:  tjc [ Tue Dec 12, 2006 6:55 pm ]
Post subject: 

frisco wrote:
I was pasting the EOF and /etc/init.d/gdm restart into the script file itself.

Those both ARE part of the script along with everything else in that "code" block. The EOF closes the "here" document (which starts with <<EOF) containing the SQL commands to update the settings. The GDM restart is there to bring the GUI back up with the new themes. I'm guessing you're hosing yourself with some kind of "invisible whitespace" corruption, which is not uncommon when folks monkey with Unix text files using MS-Windows. Here's what a normal run looks like:
Current GUI theme is:
| value | data   | hostname |
| Theme | Iulius | black2   |

Current OSD theme is:
| value    | data    | hostname |
| OSDTheme | Isthmus | black2   |

Select the number of the GUI theme you would like to use:
1) G.A.N.T.         4) MythCenter       7) Titivillus
2) Iulius           5) MythCenter-wide  8) blue
3) Minimalist-wide  6) Retro            9) syth-blue-wide
#? 2

Select the number of the OSD theme you would like to use:
1) Gray-OSD        3) Iulius-OSD      5) Titivillus-OSD  7) defaultosd
2) Isthmus         4) Retro-OSD       6) blueosd         8) isthmus
#? 2

Setting Theme = 'Iulius', OSDTheme = 'Isthmus'.

Stopping GNOME Display Manager: gdm.
Starting GNOME Display Manager: gdm.

Author:  graysky [ Sun Sep 30, 2007 2:13 pm ]
Post subject: 

As usual, great information, tjc. There is an alternative assuming the user has a windows-based box that's on his/her LAN.

Have a look at this thread. I have successfully used the an xsession (which differs from the built in vnc by thw way) to recover my mythbackend when I switched by painter from Qt to OpenGL. In that case, neither the localmachine nor vnc could save me!

The xsession can also be used to change a theme.

EDIT (02-Aug-2008): I came across the themepainter switch that also might work in a situation when you can't get back into your frontend due to the opengl issue.

$ mythfrontend -O ThemePainter=qt

I haven't tried it, but I assume it would work. Maybe it'll help out someone some day.

Author:  snaproll [ Sun Feb 14, 2010 12:38 pm ]
Post subject: 

Any updated instructions to get this to work for 6 ?

I seem to have stepped in it & can't change it back.... :oops:

Author:  tjc [ Sun Feb 14, 2010 1:58 pm ]
Post subject: 

I don't have a R6 system running at the moment but it should just be a matter of updating the THEMEDIR setting. You can run this command as root to look for the directory:
find / -type d -name themes -print

Author:  snaproll [ Sun Feb 14, 2010 2:12 pm ]
Post subject: 

Thanks TJC !

By the time I had read your reply I had tried attaching the machine to a widescreen TV- No dice- It still ended up at the desktop.

Then I renamed the new (inop) theme directory in /user/share/mythtv/themes/


Then I rebooted, and the system came back up defaulted to G.A.N.T. and I could again get into setup, appearance to change to a working theme.

I tried your line, and it came up with KDE themes, not Mythtv themes.. :(

[greg@mythbox101 ~]$ su
[root@mythbox101 greg]# find / -type d -name themes -print
[root@mythbox101 greg]# cd /opt/kde/share/apps/kstyle/themes
[root@mythbox101 themes]# dir
b3.themerc            light-v2.themerc  qtmotifplus.themerc
default.themerc       light-v3.themerc  qtplatinum.themerc
highcolor.themerc     plastik.themerc   qtsgi.themerc
highcontrast.themerc  qtcde.themerc     qtwindows.themerc
keramik.themerc       qtmotif.themerc   riscos.themerc

Author:  mihanson [ Sun Feb 14, 2010 4:07 pm ]
Post subject:  R6 Theme change from command line

If you need to change the theme from the commandline in R6, you can use the following:

$ mythfrontend -O Theme=<VAILD THEME>

For example:
$ mythfrontend -O Theme=Terra

This is a command does not permanently change your theme, but it will allow you to start up a frontend. This command is also compatable with mythtv-setup:

$ mythtv-setup -O Theme=<VAILD THEME>

mythfrontend --help or mythtv-setup --help for more info.

Author:  snaproll [ Sun Feb 14, 2010 4:31 pm ]
Post subject: 

Useful stuff to have (when the screen goes yellow... :lol: )

Helps to have multiple ways to skin a cat....

I made a pointer thread to this answer in the LinHes Hints and Tips section... :D

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group