Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Add the assume_root_window_is_desktop setting (-r) #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ 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

Expand Down
21 changes: 18 additions & 3 deletions xwinwrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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))
Expand Down