Commit e38e4742 authored by Erik Reider's avatar Erik Reider

Added --replace arg to replace the currently running swaync instance

parent 0e5c6e8a
......@@ -14,6 +14,7 @@ _swaync() {
--version
--style
--config
--replace
--skip-system-css
--custom-system-css
)
......
......@@ -3,5 +3,6 @@ complete -c swaync -s h -l help --description "Show help options"
complete -c swaync -s v -l version --description "Prints version"
complete -c swaync -s s -l style --description "Use a custom Stylesheet file" -r
complete -c swaync -s c -l config --description "Use a custom config file" -r
complete -c swaync -l replace --description "Replace the currently running instance of SwayNotificationCenter"
complete -c swaync -l skip-system-css --description "Skip trying to parse the packaged Stylesheet file. Useful for CSS debugging"
complete -c swaync -l custom-system-css --description "Pick a custom CSS file to use as the \"system\" CSS. Useful for CSS debugging" -r
......@@ -5,5 +5,6 @@ _arguments -s \
'(-v --version)'{-v,--version}'[Prints version]' \
'(-s --style)'{-s,--style}'[Use a custom Stylesheet file]:files:_files' \
'(-c --config)'{-c,--config}'[Use a custom config file]:files:_files' \
'( --replace)'--replace'[Replace the currently running instance of SwayNotificationCenter]' \
'( --skip-system-css)'--skip-system-css'[Skip trying to parse the packaged Stylesheet file. Useful for CSS debugging]' \
'( --custom-system-css)'--custom-system-css'[Pick a custom CSS file to use as the "system" CSS. Useful for CSS debugging]:files:_files' \
......@@ -19,6 +19,9 @@ swaync - A simple notification daemon with a GTK gui for notifications and the c
*-s, --style* <CSS file>
Use a custom Stylesheet file
*--replace*
Replace the currently running instance of SwayNotificationCenter
*--skip-system-css*
Skip trying to parse the packaged Stylesheet file. Useful for CSS debugging
......
......@@ -42,10 +42,12 @@ namespace SwayNotificationCenter {
public signal void config_reload (ConfigModel ?old_config, ConfigModel new_config);
public Swaync () {
public Swaync (bool replace) {
Object (
application_id : "org.erikreider.swaync",
flags: ApplicationFlags.DEFAULT_FLAGS
| ApplicationFlags.ALLOW_REPLACEMENT
| (replace ? ApplicationFlags.REPLACE : 0)
);
try {
......@@ -230,6 +232,7 @@ namespace SwayNotificationCenter {
}
public static int main (string[] args) {
bool replace = false;
if (args.length > 0) {
for (uint i = 1; i < args.length; i++) {
string arg = args[i];
......@@ -248,6 +251,9 @@ namespace SwayNotificationCenter {
case "--config":
config_path = args[++i];
break;
case "--replace":
replace = true;
break;
case "-v":
case "--version":
stdout.printf ("%s\n", Constants.VERSION);
......@@ -283,7 +289,7 @@ namespace SwayNotificationCenter {
Functions.init ();
self_settings = new Settings ("org.erikreider.swaync");
app = new Swaync ();
app = new Swaync (replace);
return app.run ();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment