Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
  
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
stjepan
n00b
n00b


Joined: 02 Mar 2006
Posts: 47

PostPosted: Mon Mar 06, 2006 9:05 pm    Post subject:    Reply with quote

  

Last edited by stjepan on Tue Sep 20, 2022 9:59 pm; edited 23 times in total
Back to top
View user's profile Send private message
stjepan
n00b
n00b


Joined: 02 Mar 2006
Posts: 47

PostPosted: Tue Mar 07, 2006 9:36 am    Post subject: Reply with quote

  

Last edited by stjepan on Tue Sep 20, 2022 9:59 pm; edited 2 times in total
Back to top
View user's profile Send private message
CoffeeBuzz
Apprentice
Apprentice


Joined: 15 Jun 2005
Posts: 269
Location: Canada Eh.

PostPosted: Tue Mar 07, 2006 3:29 pm    Post subject: Reply with quote

I made some small edits to it to place all files in /tmp instead of working directory. I know it cleans everything up but meh, in the event somethings goes wrong the cruft remains in /tmp


Revision 48 contains an ebuild, trans-inactive that installs trans-inactive-config.py

Then just run

Code:
trans-inactive-config.py


enter your preferred values and trans-inactive gets installed.
_________________
HP Pavilion zd7260us
Xgl Overlay: http://svn.xgl-coffee.org/xgl-coffee/trunk
Xgl Forums: http://forums.xgl-coffee.org
Back to top
View user's profile Send private message
stjepan
n00b
n00b


Joined: 02 Mar 2006
Posts: 47

PostPosted: Tue Mar 07, 2006 8:17 pm    Post subject: Reply with quote

  

Last edited by stjepan on Tue Sep 20, 2022 9:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
CoffeeBuzz
Apprentice
Apprentice


Joined: 15 Jun 2005
Posts: 269
Location: Canada Eh.

PostPosted: Wed Mar 08, 2006 5:36 am    Post subject: Reply with quote

Commited, several times... slightly intoxicated tonight me thinks.

Revision 50-something should be working. Renamed to trans-inactive-config. Added ewarn's to run the python script before launching the daemon.
_________________
HP Pavilion zd7260us
Xgl Overlay: http://svn.xgl-coffee.org/xgl-coffee/trunk
Xgl Forums: http://forums.xgl-coffee.org
Back to top
View user's profile Send private message
stjepan
n00b
n00b


Joined: 02 Mar 2006
Posts: 47

PostPosted: Wed Mar 08, 2006 7:33 am    Post subject: Reply with quote

  

Last edited by stjepan on Tue Sep 20, 2022 9:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
CoffeeBuzz
Apprentice
Apprentice


Joined: 15 Jun 2005
Posts: 269
Location: Canada Eh.

PostPosted: Wed Mar 08, 2006 4:48 pm    Post subject: Reply with quote

stjepan wrote:
CoffeeBuzz wrote:
Commited, several times... slightly intoxicated tonight me thinks.

Revision 50-something should be working. Renamed to trans-inactive-config. Added ewarn's to run the python script before launching the daemon.

Much better, but I noticed something in the ebuild:
Code:
pkg_postinst(){
        ewarn ""
        ewarn "You must run trans-inactive-config.py to configure and" ### this line is not ok
        ewarn "install the trans-inactive binary."
        ewarn ""
        ewarn "Then run \"trans-inactive &\" as user to enable the effects."
        ewarn ""
}
There is not "trans-inactive-config.py". It is dead! There is just "trans-inactive.config". Also see that I changed the howto a bit. There is no *.py. Also please change /usr/bin/trans-inactive-config.py to /usr/bin/trans-inactive-config. It doesn't the ".py" because it contains the "#!/usr/bin/env python" line.
Everything else with it is great.


done and done.
_________________
HP Pavilion zd7260us
Xgl Overlay: http://svn.xgl-coffee.org/xgl-coffee/trunk
Xgl Forums: http://forums.xgl-coffee.org
Back to top
View user's profile Send private message
stjepan
n00b
n00b


Joined: 02 Mar 2006
Posts: 47

PostPosted: Wed Mar 08, 2006 5:57 pm    Post subject: Reply with quote

  

Last edited by stjepan on Tue Sep 20, 2022 9:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
CoffeeBuzz
Apprentice
Apprentice


Joined: 15 Jun 2005
Posts: 269
Location: Canada Eh.

PostPosted: Wed Mar 08, 2006 7:40 pm    Post subject: Reply with quote

Interesting... I dont get that at all, what revision? I'm at 54 here.

OH OH OH ... remove the tarball from /usr/portage/distfiles and redownload it (above isnt using the right tarball).
_________________
HP Pavilion zd7260us
Xgl Overlay: http://svn.xgl-coffee.org/xgl-coffee/trunk
Xgl Forums: http://forums.xgl-coffee.org
Back to top
View user's profile Send private message
stjepan
n00b
n00b


Joined: 02 Mar 2006
Posts: 47

PostPosted: Wed Mar 08, 2006 9:09 pm    Post subject: Reply with quote

  

Last edited by stjepan on Tue Sep 20, 2022 9:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
pijalu
Guru
Guru


Joined: 04 Oct 2004
Posts: 365

PostPosted: Thu Mar 09, 2006 12:06 am    Post subject: Reply with quote

Nice work... but using a python script to actually patch a c file to configure opacity is a little 8O
So, here comes a patch to the original trans inactive to add command line parameters
Code:

--- trans-inactive.c.ori   2006-03-09 00:11:18.000000000 +0100
+++ trans-inactive.c   2006-03-09 00:59:40.000000000 +0100
@@ -25,14 +25,20 @@
 #include <stdio.h>
 #include <limits.h>
 
+#include <getopt.h>
+
 #include <X11/X.h>
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 
+
+float _inactive_opacity=0.8,_active_opacity=0.9;
+
 /* Set this to the desired opacity of inactive windows.  The example below
  * sets inactive windows 80% opaque (or, equivalently, 20% transparent).
  */
-#define INACTIVE_OPACITY (0.80 * 0xffffffff)
+#define INACTIVE_OPACITY (_inactive_opacity * 0xffffffff)
+#define ACTIVE_OPACITY (_active_opacity * 0xffffffff)
 
 static Atom
 get_window_type(Display *dpy,
@@ -124,6 +130,16 @@
     return 0;
 }
 
+void
+usage(char* name) {
+  printf("USAGE:\n");
+  printf("%s [options]\n",name);
+  printf("Options:\n");
+  printf("\t-h, --help :\tThis screen...\n");
+  printf("\t-a level, --active level:\t Set active trans. level\n");
+  printf("\t-i level, --inactive level:\t Set inactive trans. level\n");
+}
+
 int
 main(int argc,
      char **argv)
@@ -136,6 +152,59 @@
          _NET_WM_WINDOW_TYPE_DESKTOP, _NET_WM_WINDOW_TYPE_DOCK, window_type;
     XEvent xev;
     
+    /* parse arg */
+    while (0 == 0)
+    {
+      int option_index = 0;
+      int next_option;
+      static struct option long_options[] = {
+   {"help", 0, NULL, 'h'},
+   {"active", 1, NULL, 'a'},
+   {"inactive", 1, NULL, 'i'},
+   {NULL, 0, NULL, 0}
+      };
+
+      next_option =
+   getopt_long (argc, argv, "ha:i:", long_options, &option_index);
+
+      if (next_option == -1)
+   {
+     break;
+   }
+
+      switch (next_option)
+   {
+   case 'a':
+     if (optarg) {
+       if (sscanf(optarg,"%f",&_active_opacity)==EOF) {
+         fprintf(stderr,"Wrong format for active opacity\n");
+         return -1;
+       }
+       if (_active_opacity>=1)
+         _active_opacity=0.999999; /* Xgl don't like 1... */
+     }
+     break;
+   case 'i':
+      if (optarg) {
+       if (sscanf(optarg,"%f",&_inactive_opacity)==EOF) {
+         fprintf(stderr,"Wrong format for inactive opacity\n");
+         return -1;
+       }
+       if (_inactive_opacity>=1)
+         _inactive_opacity=0.999999;
+      }
+      break;
+   default:
+     usage (argv[0]);
+     return -1;
+   }
+    }
+
+    printf("Using following trans. level:\n\t %f active\n\t %f inactive\n",
+      _active_opacity,
+      _inactive_opacity);
+
+   
     dpy = XOpenDisplay(NULL);
     if(!dpy) {
         fprintf(stderr, "Failed to open display\n");
@@ -168,7 +237,7 @@
         for(i = 0; i < ntoplevels; i++) {
             if(toplevels[i] == old_active_window) {
                 set_opacity(dpy, toplevels[i], _NET_WM_WINDOW_OPACITY,
-                            0xffffffff);
+                            ACTIVE_OPACITY);
                 continue;
             }
             
@@ -221,7 +290,7 @@
                         
                         if(active_window != None) {
                             set_opacity(dpy, active_window,
-                                        _NET_WM_WINDOW_OPACITY, 0xffffffff);
+                                        _NET_WM_WINDOW_OPACITY, ACTIVE_OPACITY);
                         }
                         
                         old_active_window = active_window;


With this, you can simply lauch it with needed parameters :
Code:

-a level, --active level : set "level" as "active" trans value
-i level,--inactive level: set "level" as "inactive" trans value


eg:
Code:

trans-inactive -a 0.9 -i 0.4


Have phun
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum