Programming :: Bash Script For Automatic Viewport Changing And Other WM Stuff (works With Compiz)?
Oct 18, 2010
I had to make for work a collectd based network monitoring system which displays data for each server in a fullscreen conky on different compiz viewports. I have to switch viewports automatically when the machine isn't operated (sorta screensaver) and also if i had to call attention in the case something bad happens, autoswitching should stop and the relevant viewport be showed up.This requires an interface to talk dynamically to the WM, which i've implemented in bash with support of the widely available "wmctrl" program.
I wondered whether there is a way in Compiz (or some other way) of not just assigning particular applications to default workspaces, but also, when an application is opened, to switch to the designated workspace automatically.
(That is, "follow" the active application) So suppose: Firefox is assigned to workspace 2. I am currently in workspace 1, where I launch Firefox. Firefox opens in workspace 2, but I myself am still in workspace 1.What I wonder then is: Is there a way of following Firefox, so to speak? That is, in my example, that I switch automatically to workspace 2
I have managed to get Compiz Desktop Cube working with 4 viewports. Everything is great but I have noticed the that cube will show the running applications in the bottom panel, from the previously active viewport, on all sides of the cube.
Anyone know how to set it so that the bottom panel on each side of the cube displays only the applications that are running in the currently visible viewport? I hope that's clear because I'm not 100% sure of the terminology.er to determine the viewport you are looking for.
I have sixteen workspacess arranged in a 4x4 square. When the Compiz desktop cube is enabled, I can only switch between four of them on a row. All keys that would otherwise allow me to switch up and down between rows are disabled, even the ones I set outside of Compiz.
What is worst is that even the Window switchers are unable to change the current row I am on. If I use the Ring, Shift or Static switchers' "All Workspaces" modes, I can see the windows on all sixteen workspaces - but trying to switch to a window that is above or below the row I am currently on will only rotate around to the correct workspace's column, but not actually bring up the workspace the window is on. To navigate between all workspaces, I have to use the "Expose" feature.
Is there any way I can have a cube for horizontal navigation, but keep ordinary vertical navigation?
Anyone know how to launch a program from CLI (command line) to a specific viewport? I start programs all the time from the CLI and there are times when I'm in "typing demon" mode and don't want to touch the mouse. Being able to launch a program to a certain viewport (Compiz, w. effects) would be really helpful at times.
I'm familiar with wmctrl and i can use the -a and -c options to switch to and close windows fine. I only have 1 desktop (9 viewports, though), and wmctrl's support for viewport seems limited at best. Ideally, I'd like to launch a program to a specific viewport, but just being able to move an existing one to a specific viewport would work, too.
Please note: I'm talking about moving apps to viewports AD HOC or DYNAMICALLY, not in a fixed way like I believe devilspie and such (and Compiz' Place plugin). Depending on my task, I need to quickly launch several apps to different viewports, and this VARIES for me a lot. ubuntu 10.04 lts / gnome / compiz w. full effects
I want to write the date & time and a text string to a file from crontab.The following line works fine in the CL:echo $(/bin/date +"%F %T")" Some text" >> /home/me/foo.txtI installed in crontab and no text appears in the file that it is redirected to.The crontab entry looks like:* * * * * echo $(/bin/date +"%F %T")" Some text" >> /home/me/foo.txtTried a version to just write to stdout....* * * * * echo $(/bin/date +"%F %T")" Some text"No date, time or text appears at the command line
I am writing a bash script that utilizes the output of another script (which I will refer to as script#2.) Script#2 is not owned by me, I cannot modify it. All of the output from script#2 is blue, which makes it difficult for me to read.
I would like to have the output of it changed to grey. Is there a way I can do that in my script? A command I can pipe the output to?
Edit: One other question related to this. I put a trap function in my script that works well. Script#2 essentially runs a tail -f. When I ctrl+c to stop it, it stops script#2 and never calls the trap in my script. Is there any way I can work around that?
I'm writing a Bash script to take IPTC keywords from a text file and write them, via Exiv2, to several (first batch is 100) JPEG files in a single directory. The script has one while loop inside another while loop, both terminated, but I'm pretty sure that's not my problem. I think it's how I'm incrementing the "counter" variable, although it could also be the method of parsing the text lines from the file (using cut with delimiters that have worked fine in simpler scripts).
Here's the code as I've worked it up to this point.
Code:
And yes, "keywords" checks out in Crimson Editor, Emacs GUI and nano as an ASCII file with UNIX line endings. No issues on that score.
Feeding each line consecutively into a terminal (excepting the exiv2 command) works fine: each variable echoes with the part of the text line used as a variable value as it should, even when the b variable is incremented the quick&dirty way (up arrow three commands and hit enter).
Running the above script in eval mode (sh -x) stalls after setting the b variable to one and reading in the first line of text. I'd like to know why. I'd also like some advice on another reliable method of parsing the read-in lines.
(bare with me as I am sort of new with scripting) I am trying to figure out how to run a script that does a basic chkconfig and to get only those services that are running, but changing the color of "on" to red in my output file. Here is what I am working with so far:
*I had to substitute a "-" and <colon_symbol> for ":" in front of the on's, because the forum thought they were smiley faces (i.e. n) how to make the "on" to be red while the rest of everything remains in black text. I have been trying to read up on sed and awk, but it is still pretty much a mystery to me right now. There will be other things in the output file that I wouldn't want a rogue "on" to be in red, so just the instances of "on" in that one chkconfig return.
Writing script to create backup of file by adding datetime to file name. Basically test for file presence if there, cp with datetime then rm original cp works fine from command line but get cannot stat `full path to file': No such file or directory
Code:
Here are the errors: cp: cannot stat `~/html/CVP_dadamail/.dada_files/.logs/errors.txt': No such file or directory rm: cannot remove `...': No such file or directory
The for statement is a placeholder as I have same file to backup out of several directories. using "bash -x scriptname" -OR- inserting echos, I can see I've constructed the strings properly. Believing it might be related to the hidden directories, I tried setting the shopt "glob" options to no avail.
Ultimately I'll add the other directories to the for loop and then run this from a cron job, so if you see potential pitfalls knowing I'm headed in that direction...believe construct would be
I am trying to write a bash script that installs a program fully automated for me. I am stuck at the one part where i need to change a line in one config file. I have tried various syntax for sed and none have worked. Maybe someone can suggest how to go about this. Since the line appears in the middle of the file, I can't use echo or cat. Also the file will be diffrent lengths depending on the install.
The line I need changed is:
I need that changed to:
the last syntax i tried is:
Yes this is for PNP4Nagios on centos 5.6 64bit. If i can get this figured out. I will be willing to post the whole thing for others to use. it will be used to install PNP after a working nagios install is done.
I've been trying to get full video card support for the following card Radeon HD 2400 XT Im running the new 10.04 and I cant seem to get the 3d stuff to work properly with compiz When I go to Administration - Hardware drivers it recommends the ATI/AMD proprietary FGLRX graphics driver. Even after getting that installed I still cant get Normal compiz to work. I dont know if it is the driver or some other configuration.
Since installing Lucid LYNX LTS on my Netbook. (See: [URL] [#136]). Via USB, I can connect my iPhone 3GS. It gives me two simultaneous choices: Open F-Spot and Open Rythmbox. In addition, I can also "Open / Browse Folder". As such, I can view / import photos and videos made on the phone, as well as video PODCASTS. I can also play my music files
What I cannot do: 1) Play / find my purchased audiobooks [decryption not supported] 2) Locate the mp4 videos / movies (NOT encrypted) that I transferred to the phone via iTunes on my MacBook. 3) Send a file via bluetooth to the phone [the Indicator Applet does allow me go go as far as select the file. It gets to the point of "connecting" then "unknown error occurred"
I cannot sync the addressbook, calendar, or notes on the iPhone with my netbook. I have the following libraries installed: ifuse libmobiledevice-utils libmobiledevice0 libplist++1 libplist1 libusbmuxd1 python-imobildevice usbmuxd NOTA BENE: This phone is NOT jail-broken.
Just ran into this issue with Suse 11.2. Everytime I try to change the desktop wallpaper, plasma crashes and returns me to the log in screen. This is the first time this has happened and it happens no matter what wallpaper I choose. Desktop effects are OFF. Strange that adding widgets to the desktop does NOT cause this crash, just changing the desktop wallpaper. The computer is using 855GM Intel Chipset.
I'm using an Acer Aspire One with ubuntu 10.10 Desktop/Netbook and Kubuntu 10.10 installed.I'm using Compiz for the window manager and Emerald for the decorator. I know my problem has something to do with compiz because after uninstalling it, the problem went away, so I'm hoping I'm just missing a setting somewhere.After installing compiz, my icons/system theme (not my window decorations) will change on their own,(Please see attached screenshots) and even when I choose, let's say, 'ambiance' in the appearance menu, the panels for gnome will change, but the icons will not. the only way i can get the ubuntu mono-dark icons to reappear is to logout/restart, etc. However, it will still switch to unity icons on a seemingly random basis. It is a little thing, but it is driving me crazy
right now am posting this from ubuntu safe mode, when i login normally what i get is just a plain space without desktop alt+f2 also not working there, only thing i can do from there is ctrl+alt+del and a window came without borders and i can restart or shutdown pc.
i had installed compiz configuration window and tried to enable cube desktop and it showed some conflict with other plugins and i had pressed disable this plugin and all tick mark in that configuration window gone after that this problem occurred
I've ditched ubuntu for xubuntu 11.04. I love it. The marvellous grid based desktop...the beautiful theme...the ease of customisation...everything. I switched because I didn't like unity.However, I now have a problem. After installing the proprietary ati drivers for my raedon 5xxx card, compz still does not work at all. A lot of other people have been having problems with extreme lag when dragging windows (my unity-likeing school friend included). I don't have this problem because compiz won't work. The weird thing is that in any other 3d tasks the card performs better than on 10.10. For example I can now play oblivion without the characters lacking faces.
My question is simple, is it possible to enable and disable automatic sleep/hibernate/standby using BASH? I need it for a bash script.Been searching for a while now, can't seem to find it.
I've got 9.04 and 9.10 both installed on the same machine. The /home directory is on a separate partition, so both OSes use the same /home.I can't get Compiz to work at all in 9.10, even though it's been perfectly fine in 9.04. Is there a backport of some sort that i should install?The fixes I've found all point to editing the xorg.conf file, but of course, Karmic doesn't have an xorg.conf file.I've tried reinstalling the Compiz files, reinstalled the open-source video drivers, installed/uninstalled fglrx drivers a few times, rebooted dozens of times.
I went to [URL] the other day, and I'm really impressed with the way, when you click on domain, it adds it to the cart WITHOUT A REFRESH. But what I really want to know is - how does it do the slick little effect when you click "Add to basket", when it "appears" on the right hand side?
I was wondering if you could recommend a simple way to achieve functionality where received email messages are automatically processed and used in SQL commands (depending on certain criteria, of course). For example, say I have made a PHP-based blog application and it's located at example.com and I'd like to give members the option of posting to their blogs by sending email to a special @example.com address. The email messages received there will be inserted into a database depending on the sender's address, with the body becoming the post and the subject line becoming the post's title, etc.
Another example could be how those trouble ticket systems let customers submit tickets via email, while the support agents operate via a database-driven Web application. Is this the type of thing one must code from scratch, or is there an open source solution out there which only needs to be configured accordingly?
I'm writing a script that edits a Maya ascii file. Inside the .MA(maya ascii file) there is a line defaultRenderGlobals. My script is supposed to find this line and according to what options they manipulate will update the lines below defaultRenderGlobals. I've got that working... but... the issue i'm having is that defaultRenderGlobals is only made when a the maya scene is made into a batch render. I want my script to manually addefaultRenderGlobals line into the .ma file if its not there and add the certain lines below it.RenderGlobals is already there I want to just manipulate whats below it. Hope this makes sense
I just put a pfSense firewall inbetween my ADSL router and my LAN. It's configured to have a cachng DNS server and a DHCP server. Among other things. For reasons beyond this post the address range served by DHCP changed from 10.0.0.x to 192.168.1.x. The new DHCP server gives 192.168.1.1 as gateway and DNS server name and not the public IP addresses of our internet provider.
After reconnecting our client machines everything worked just fine on the win-xp boxes, but the Debian Squeeze servers and Ubuntu 10.4 clients all started to get network timeouts. If I ping public websites it works but browsing to the same servers fails. Other services like POP3 and IMAP also fails. All machines use WiFi to connect and the access point is the same as before.
What could it be that make the debian boxes fail? My laptop runs squeeze too and also fails. But when connecting to various other access points at hotels and such I do not get this problem.
Another weird thing is that the debian server running virtualbox cannot do things online but the virtual windows boxes running on this machine can. Weird! Where should I start looking? How is networking/dhcp clients on Debian different from Windows XP?
I started using Ubuntu's chat tool the other day, I gave it my Gmail username and password,and lo! it found my list of CONTACTS FROM INSIDE GMAIL!Facebook has done the same thing as well! Was this in Google's terms? Can't something be done about this? This is SCARY.But also, a small part of me wants to know how it was done (only a small part, this protocol sh*t is not particularly challenging, right?
I got this part from my script working that it will delete a folder is from 8 days agoEightDaysAgo=`(date --date="8 days ago" +%d-%m-%Y)`rm -rf $EightDaysAgoTarHowever I need to remove files that are older than 8days for example if the script is'nt run for a day it will remove both the 9th and 8th day one not just the 8th day one. If I'm making any sense lol
I have this JSON encoded data, which I want to efficiently parse (i.e. fast, with minimal system resources). I don't want to use a/the shell any more than necessary.
Here's a snippet of what the raw serial data looks like:
Code: [{"num":1,"name":"1","visible":false,"focused":false,"rect":{"x":0,"y":0,"width":1680,"height":1050},...blah blah.. So that's fine. I currently have at least two ways of parsing it:
This Perl method (which I don't much care for because I'm not much into Perl, and because the output is not much more useful than the raw form, and imho even more cryptic):
# Which means: at x=1680, draw a 20x20px grey block, then back up -10px and draw a "1" on the block.I figure that the two awk's I've used can be combined into one -- but I began having problems with removing the single quotes if I did it within the awk, which is why I stuck a `tr` in the middle.
I know this sucks. So, if someone has some ideas or thoughts on something else to do with this JSON data, that's less convoluted that where I'm currently going, I'll be happy to hear about it.
PS - I know this whole post is possibly hard to understand -- if you need more info (you mean you're interested in this mess?? )