1 /*vim: set sw=4 ts=4 et: */
3 * This file is part of Live Wallpaper (livewp)
5 * Copyright (C) 2010 Vlad Vasiliev
6 * Copyright (C) 2010 Tanya Makova
9 * This software is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This software is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this software; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 /*******************************************************************************/
25 #include "livewp-conky.h"
26 void create_config(gboolean sleep){
31 file_in = fopen("/etc/conky/conky.conf","r");
32 file_out = fopen("/tmp/conky.conf","w");
33 if (file_in && file_out){
34 while (!feof(file_in)) {
35 memset(buffer, 0, sizeof(buffer));
36 fgets(buffer, sizeof(buffer) - 1, file_in);
37 if (!strcmp(buffer, "own_window yes\n")){
38 fputs("own_window no\n", file_out);
41 if (!strcmp(buffer, "$alignc $nodename - $sysname $kernel on $machine ${color yellow}Uptime:$color $uptime\n")){
42 fputs("$alignr $nodename\n$alignr $sysname $kernel on $machine\n", file_out);
43 fputs("$alignr ${color yellow}Uptime:$color $uptime\n", file_out);
46 if (!strcmp(buffer, "gap_y 60\n")){
47 fputs("gap_y 0\n", file_out);
50 if (!strcmp(buffer, "gap_x 20\n")){
51 fputs("gap_x 5\n", file_out);
54 if (!strcmp(buffer, "update_interval 3.0\n") && sleep){
55 fputs("update_interval 20.0\n", file_out);
58 if (!strcmp(buffer, "${color #24ff00} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}")){
59 fputs(buffer, file_out);
60 fputs("\n${color #20ff00} ${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5}\n", file_out);
61 fputs("${color #16ff00} ${top name 6} ${top pid 6} ${top cpu 6} ${top mem 6}\n", file_out);
65 fputs(buffer, file_out);
73 init_scene_Conky(AWallpaperPlugin *desktop_plugin){
75 init_scene_External(desktop_plugin);
78 conky_visible(AWallpaperPlugin *desktop_plugin){
79 if (desktop_plugin->priv->visible)
83 kill (desktop_plugin->priv->podpid, SIGHUP);