aboutsummaryrefslogtreecommitdiff
path: root/util/fbautostart/include
diff options
context:
space:
mode:
authorPaul Tagliamonte <paultag@ubuntu.com>2011-04-15 18:48:05 (GMT)
committerPaul Tagliamonte <tag@loki.(none)>2011-09-24 15:48:47 (GMT)
commitcc5c30c9cbdce2693d284c57ae4671017bf0660c (patch)
treece85451dd72abc0dfc8475c20c86e496805110f2 /util/fbautostart/include
parent0e1ee49603a565427fa833a4136c586a0e816c47 (diff)
downloadfluxbox_paul-cc5c30c9cbdce2693d284c57ae4671017bf0660c.zip
fluxbox_paul-cc5c30c9cbdce2693d284c57ae4671017bf0660c.tar.bz2
Integrating fbautostart into the Fluxbox tree.
This change merges fbautostart into fluxbox. fbautostart has been re-licensed under MIT to allow for this. I've added the util/fbautostart directory, and tweeked the build chain to include fbautostart. I've also added in a few docs. Those are the only changes outside the util/fbautostart folder. It's been noted in the ChangeLog, but fbautostart changes (since it might be a bit more "high-volume") should be maintained in util/fbautostart/ChangeLog. The XDG spec can be found at: - http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
Diffstat (limited to 'util/fbautostart/include')
-rw-r--r--util/fbautostart/include/dot_desktop.hh55
-rw-r--r--util/fbautostart/include/fbautostart.hh147
2 files changed, 202 insertions, 0 deletions
diff --git a/util/fbautostart/include/dot_desktop.hh b/util/fbautostart/include/dot_desktop.hh
new file mode 100644
index 0000000..c234061
--- /dev/null
+++ b/util/fbautostart/include/dot_desktop.hh
@@ -0,0 +1,55 @@
1/*
2 * dot_desktop.hh
3 *
4 * This file is part of the Fluxbox Autostart ( fbautostart )
5 * Utility.
6 *
7 * Copyright (C) 2011 by Paul Tagliamonte <paultag@ubuntu.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
26 *
27 */
28
29#ifndef _DOT_DESKTOP_H
30#define _DOT_DESKTOP_H ohai
31
32#include <vector>
33
34namespace fbautostart {
35 class dot_desktop_attr {
36 public:
37 std::string attr;
38 std::string value;
39 };
40
41 class dot_desktop {
42 protected:
43 std::vector<dot_desktop_attr *> * attr;
44 std::string file;
45 std::string id;
46 public:
47 dot_desktop( std::string s, std::string id );
48 void load();
49 std::string getAttr( std::string sx );
50 bool validate();
51 std::string getFile();
52 std::string getID();
53 };
54}
55#endif
diff --git a/util/fbautostart/include/fbautostart.hh b/util/fbautostart/include/fbautostart.hh
new file mode 100644
index 0000000..6ce1144
--- /dev/null
+++ b/util/fbautostart/include/fbautostart.hh
@@ -0,0 +1,147 @@
1/*
2 * fbautostart.hh
3 *
4 * This file is part of the Fluxbox Autostart ( fbautostart )
5 * Utility.
6 *
7 * Copyright (C) 2011 by Paul Tagliamonte <paultag@ubuntu.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
26 *
27 */
28
29#ifndef _FBAUTOSTART_H
30#define _FBAUTOSTART_H ohai
31
32#define PACKAGE "fbautostart"
33#define PACKAGE_VERSION "2.71828"
34
35#ifndef _DEBUG_MODE
36#define _DEBUG_MODE 0
37#endif
38
39extern const char * _ON_BEHALF_OF;
40extern bool noexec;
41
42#include "dot_desktop.hh"
43
44#define _DEFAULT_XDG_HOME "~/.config"
45#define _DEFAULT_XDG_DIRS "/etc/xdg"
46#define _XDG_AUTOSTART_DIR "/autostart/"
47
48// XXX: Please document these functions better.
49// the @param names need to be fixed up as well.
50// stuff like `foo' or `loc' sucks ass.
51// -PRT
52
53namespace fbautostart {
54
55 /**
56 * Print a help message to the user
57 */
58 void help();
59
60 /**
61 * Lecture the user on correct invocation.
62 */
63 void lecture();
64
65 /**
66 * Print version of fbautostart to stdout.
67 */
68 void version();
69
70 /**
71 * Log an error to stderr.
72 * @param s std::string with the error message
73 */
74 void logError( std::string s );
75
76 /**
77 * Log an error to stderr, to print a single integer.
78 * @param i int to print to stderr
79 */
80 void logError( int i );
81
82 /**
83 * Print the string to the screen if debug mode is enabled.
84 * @param s std::string with the message to print to the screen
85 */
86 void debug( const std::string & s );
87
88 /**
89 * Print a std::vector to the screen if debug mode is enabled.
90 * @param foo std::vector<std::string> to dump
91 */
92 void debug( const std::vector<std::string> & foo );
93
94 /**
95 * Print a size_t to the screen if debug mode is enabled.
96 * @param foo size_t to be printed to the screen
97 */
98 void debug( size_t foo );
99
100 /**
101 * processArgs should only be called by main, and pass the main arguments to processArgs.
102 * @param argc number of arguments in args
103 * @param argv char array of arguments
104 */
105 void processArgs( int argc, char ** args );
106
107 /**
108 * Run a command on the system
109 * @param appl command to run
110 * @return return status of the application
111 */
112 int runCommand( std::string appl );
113
114 /**
115 * Break a line up based on a ":"
116 * @param locs the std::vector to push tokens back into
117 * @param lines to process
118 */
119 void breakupLine( std::vector<std::string> * locs, std::string lines );
120
121 /**
122 * Fix paths with a tilde in them.
123 * @param locs a std::vector of paths to fix up
124 * @param home the home path of the user, absolute
125 */
126 void fixHomePathing( std::vector<std::string> * locs, std::string home );
127
128 /**
129 * Get configuration directories according to the XDG spec.
130 * @param loc std::vector to load up results in
131 * @return returns false if we are unable to complete processing (such as null $HOME)
132 */
133 bool getConfDirs( std::vector<std::string> & loc );
134
135 /**
136 * Get all the .desktop files to process.
137 * @param dirs the directories to search
138 * @param out_files the vector we are loading up
139 * @return if we were able to complete processing with success
140 */
141 bool getDesktopFiles(
142 const std::vector<std::string> & dirs,
143 std::vector<dot_desktop> & out_files
144 );
145}
146
147#endif