about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README.md9
-rw-r--r--xwinwrap.c21
2 files changed, 22 insertions, 8 deletions
diff --git a/README.md b/README.md
index 33eba7c..6451157 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # Xwinwrap
 
-My fork of xwinwrap.  
+My fork of xwinwrap. (With some added settings)
 Xwinwrap allows you to stick most of the apps to your desktop background.  
 My use case - can use gif as a background
 
@@ -38,16 +38,15 @@ Options:
              -sh     - Shape of window (choose between rectangle, circle or triangle. Default is rectangle)
              -ov     - Set override_redirect flag (For seamless desktop background integration in non-fullscreenmode)
              -d      - Daemonize
+             -r      - Assume the root window is the desktop
              -debug  - Enable debug messages
 ```
 Example
-`xwinwrap -g 400x400 -ni -s -nf -b -un -argb -sh circle -- gifview -w WID mygif.gif -a`
+`xwinwrap -g 400x400 -ni -s -nf -b -r -un -argb -sh circle -- gifview -w WID mygif.gif -a`
 
 ### Changes
 
-* Added ability to make undecorated window
-* Changed how desktop window is found
-* Refactored window hints
+* Added the -r setting
 
 ----
 Original source - https://launchpad.net/xwinwrap
diff --git a/xwinwrap.c b/xwinwrap.c
index 2cfb8aa..dda771d 100644
--- a/xwinwrap.c
+++ b/xwinwrap.c
@@ -152,6 +152,7 @@ static void usage (void)
             -sh     - Shape of window (choose between rectangle, circle or triangle. Default is rectangle)\n \
             -ov     - Set override_redirect flag (For seamless desktop background integration in non-fullscreenmode)\n \
             -d      - Daemonize\n \
+            -r      - Assume the root window is the desktop\n \
             -debug  - Enable debug messages\n");
 }
 
@@ -287,6 +288,7 @@ int main(int argc, char **argv)
     bool skip_taskbar = false;
     bool skip_pager = false;
     bool daemonize = false;
+    bool assume_root_window_is_desktop = false;
 
     win_shape   shape = SHAPE_RECT;
     Pixmap      mask;
@@ -378,6 +380,10 @@ int main(int argc, char **argv)
         {
             daemonize = true;
         }
+        else if(strcmp (argv[i], "-r") == 0)
+        {
+            assume_root_window_is_desktop = true;
+        }
         else if (strcmp (argv[i], "--") == 0)
         {
             break;
@@ -450,9 +456,18 @@ int main(int argc, char **argv)
     int depth = 0, flags = CWOverrideRedirect | CWBackingStore;
     Visual *visual = NULL;
 
-    if (!find_desktop_window(&window.root, &window.desktop)) {
-        fprintf (stderr, NAME": Error: couldn't find desktop window\n");
-        return 1;
+    if(assume_root_window_is_desktop)
+    {
+        Window true_root = RootWindow(display, screen);
+        window.root = true_root;
+        window.desktop = true_root;
+    }
+    else
+    {
+        if (!find_desktop_window(&window.root, &window.desktop)) {
+            fprintf (stderr, NAME": Error: couldn't find desktop window\n");
+            return 1;
+        }
     }
 
     if (argb && get_argb_visual(&visual, &depth))