]> git.mdlowis.com Git - projs/tide.git/commitdiff
updated xcpd cd to root on daemonization
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 30 May 2017 15:16:21 +0000 (11:16 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 30 May 2017 15:16:21 +0000 (11:16 -0400)
TODO.md
xcpd.c

diff --git a/TODO.md b/TODO.md
index 1b39ab25288e56a38614b14631a42e0cf464a44d..11411e50179ebb8a61754a220b2b86c3903ecb24 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -5,7 +5,6 @@ Up Next:
 * move by words is inconsistent. Example:
     var infoId = 'readerinfo'+reader.id;
 * Add a way to CD using a builtin (buffers will track original dir)
-* cd to root in xcpd
 * Ctrl+; Shortcut to warp cursor to middle of current screen.
 * shortcut to jump to previous edit
 
diff --git a/xcpd.c b/xcpd.c
index e92b81934e520c1b723ea921809ccfc8ea14e733..e5e45accb4beab6b32256f2fee32f555c9d2e331 100644 (file)
--- a/xcpd.c
+++ b/xcpd.c
@@ -23,10 +23,10 @@ void serve_selection(void) {
     if (SelTarget == None)
         SelTarget = XInternAtom(XDisplay, "STRING", 0);
     XSetSelectionOwner(XDisplay, SelType, XWindow, CurrentTime);
-    
+
     for (XEvent e;;) {
         XNextEvent(XDisplay, &e);
-        if (e.type == SelectionRequest) {                
+        if (e.type == SelectionRequest) {
             XEvent s;
             s.xselection.type      = SelectionNotify;
             s.xselection.property  = e.xselectionrequest.property;
@@ -46,10 +46,10 @@ void serve_selection(void) {
             } else if (target == SelTarget || target == xastring) {
                 XChangeProperty(
                     XDisplay, s.xselection.requestor, s.xselection.property,
-                    SelTarget, 8, PropModeReplace, 
+                    SelTarget, 8, PropModeReplace,
                     (unsigned char*)SelText, strlen(SelText));
             }
-            XSendEvent(XDisplay, s.xselection.requestor, True, 0, &s);  
+            XSendEvent(XDisplay, s.xselection.requestor, True, 0, &s);
         } else if (e.type == SelectionClear) {
             break; // Someone else took over. We're done here.
         }
@@ -64,6 +64,7 @@ int main(int argc, char** argv) {
             close(STDIN_FILENO);
             close(STDOUT_FILENO);
             close(STDERR_FILENO);
+            chdir("/");
             serve_selection();
         } else if (pid < 0) {
             die("fork() failed");