3 Commits
demo ... master

Author SHA1 Message Date
ec32e9b725 Add force desktop window type flag (#4)
* Add force desktop window type flag
This flag places xwinwrap behind desktop icons on ubuntu

* Update README.md
2017-11-28 22:15:01 +05:30
099ea746da Fixes #1 2017-09-03 04:25:00 +05:30
7826c87fae Update README 2017-08-31 04:56:44 +05:30
2 changed files with 53 additions and 3 deletions

View File

@ -4,6 +4,8 @@ My fork of xwinwrap.
Xwinwrap allows you to stick most of the apps to your desktop background. Xwinwrap allows you to stick most of the apps to your desktop background.
My use case - can use gif as a background My use case - can use gif as a background
![demo gif](https://github.com/ujjwal96/xwinwrap/blob/demo/demo.gif)
### Installing ### Installing
``` ```
@ -18,11 +20,12 @@ make clean
### Usage ### Usage
``` ```
Usage: xwinwrap [-g {w}x{h}+{x}+{y}] [-ni] [-argb] [-fs] [-s] [-st] [-sp] [-a] [-b] [-nf] [-o OPACITY] [-sh SHAPE] [-ov]-- COMMAND ARG1... Usage: xwinwrap [-g {w}x{h}+{x}+{y}] [-ni] [-argb] [-fdt] [-fs] [-s] [-st] [-sp] [-a] [-d] [-b] [-nf] [-o OPACITY] [-sh SHAPE] [-ov]-- COMMAND ARG1...
Options: Options:
-g - Specify Geometry (w=width, h=height, x=x-coord, y=y-coord. ex: -g 640x480+100+100) -g - Specify Geometry (w=width, h=height, x=x-coord, y=y-coord. ex: -g 640x480+100+100)
-ni - Ignore Input -ni - Ignore Input
-argb - RGB -argb - RGB
-fdt - force WID window a desktop type window
-fs - Full Screen -fs - Full Screen
-un - Undecorated -un - Undecorated
-s - Sticky -s - Sticky
@ -34,6 +37,7 @@ Options:
-o - Opacity value between 0 to 1 (ex: -o 0.20) -o - Opacity value between 0 to 1 (ex: -o 0.20)
-sh - Shape of window (choose between rectangle, circle or triangle. Default is rectangle) -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) -ov - Set override_redirect flag (For seamless desktop background integration in non-fullscreenmode)
-d - Daemonize
-debug - Enable debug messages -debug - Enable debug messages
``` ```
Example Example

View File

@ -133,12 +133,13 @@ static void sigHandler (int sig)
static void usage (void) static void usage (void)
{ {
fprintf(stderr, "%s \n", NAME); fprintf(stderr, "%s \n", NAME);
fprintf (stderr, "\nUsage: %s [-g {w}x{h}+{x}+{y}] [-ni] [-argb] [-fs] [-s] [-st] [-sp] [-a] " fprintf (stderr, "\nUsage: %s [-g {w}x{h}+{x}+{y}] [-ni] [-argb] [-fdt] [-fs] [-s] [-st] [-sp] [-a] [-d] "
"[-b] [-nf] [-o OPACITY] [-sh SHAPE] [-ov]-- COMMAND ARG1...\n", NAME); "[-b] [-nf] [-o OPACITY] [-sh SHAPE] [-ov]-- COMMAND ARG1...\n", NAME);
fprintf (stderr, "Options:\n \ fprintf (stderr, "Options:\n \
-g - Specify Geometry (w=width, h=height, x=x-coord, y=y-coord. ex: -g 640x480+100+100)\n \ -g - Specify Geometry (w=width, h=height, x=x-coord, y=y-coord. ex: -g 640x480+100+100)\n \
-ni - Ignore Input\n \ -ni - Ignore Input\n \
-argb - RGB\n \ -argb - RGB\n \
-fdt - force WID window a desktop type window\n \
-fs - Full Screen\n \ -fs - Full Screen\n \
-un - Undecorated\n \ -un - Undecorated\n \
-s - Sticky\n \ -s - Sticky\n \
@ -150,6 +151,7 @@ static void usage (void)
-o - Opacity value between 0 to 1 (ex: -o 0.20)\n \ -o - Opacity value between 0 to 1 (ex: -o 0.20)\n \
-sh - Shape of window (choose between rectangle, circle or triangle. Default is rectangle)\n \ -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 \ -ov - Set override_redirect flag (For seamless desktop background integration in non-fullscreenmode)\n \
-d - Daemonize\n \
-debug - Enable debug messages\n"); -debug - Enable debug messages\n");
} }
@ -274,6 +276,7 @@ int main(int argc, char **argv)
bool have_argb_visual = false; bool have_argb_visual = false;
bool noInput = false; bool noInput = false;
bool argb = false; bool argb = false;
bool set_desktop_type = false;
bool fullscreen = false; bool fullscreen = false;
bool noFocus = false; bool noFocus = false;
bool override = false; bool override = false;
@ -283,6 +286,7 @@ int main(int argc, char **argv)
bool above = false; bool above = false;
bool skip_taskbar = false; bool skip_taskbar = false;
bool skip_pager = false; bool skip_pager = false;
bool daemonize = false;
win_shape shape = SHAPE_RECT; win_shape shape = SHAPE_RECT;
Pixmap mask; Pixmap mask;
@ -307,6 +311,10 @@ int main(int argc, char **argv)
{ {
argb = true; argb = true;
} }
else if (strcmp (argv[i], "-fdt") == 0)
{
set_desktop_type = true;
}
else if (strcmp (argv[i], "-fs") == 0) else if (strcmp (argv[i], "-fs") == 0)
{ {
fullscreen = 1; fullscreen = 1;
@ -366,6 +374,10 @@ int main(int argc, char **argv)
{ {
debug = true; debug = true;
} }
else if (strcmp (argv[i], "-d") == 0)
{
daemonize = true;
}
else if (strcmp (argv[i], "--") == 0) else if (strcmp (argv[i], "--") == 0)
{ {
break; break;
@ -377,6 +389,35 @@ int main(int argc, char **argv)
} }
} }
if (daemonize)
{
pid_t process_id = 0;
pid_t sid = 0;
process_id = fork();
if (process_id < 0)
{
fprintf(stderr, "fork failed!\n");
exit(1);
}
if (process_id > 0)
{
fprintf(stderr, "pid of child process %d \n", process_id);
exit(0);
}
umask(0);
sid = setsid();
if (sid < 0)
{
exit(1);
}
chdir("/");
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
}
for (i = i + 1; i < argc; i++) for (i = i + 1; i < argc; i++)
{ {
if (strcmp (argv[i], "WID") == 0) if (strcmp (argv[i], "WID") == 0)
@ -491,7 +532,12 @@ int main(int argc, char **argv)
xa = ATOM(_NET_WM_WINDOW_TYPE); xa = ATOM(_NET_WM_WINDOW_TYPE);
Atom prop; Atom prop;
prop = ATOM(_NET_WM_WINDOW_TYPE_NORMAL); if (set_desktop_type)
{
prop = ATOM(_NET_WM_WINDOW_TYPE_DESKTOP);
} else {
prop = ATOM(_NET_WM_WINDOW_TYPE_NORMAL);
}
XChangeProperty(display, window.window, xa, XA_ATOM, 32, XChangeProperty(display, window.window, xa, XA_ATOM, 32,
PropModeReplace, (unsigned char *) &prop, 1); PropModeReplace, (unsigned char *) &prop, 1);