The University of Massachusetts Amherst
Categories
Linux

Quick Guide to Patching Linux Icon Packs

One of the nice advantages of using Linux is the wealth of customization options available. A key area of  that customization are app icons. For those unfamiliar, it is similar to how icons change across Android versions, even though the apps themselves are often the same.

Now I could go over how to install icons packs, however there are countless sites who already explain the process very well, such as Tips on Ubuntu. As for obtaining icon packs, a great site is OpenDesktop.org, which among other things hosts a wide variety of free to use icon packs.

So, now onto something less commonly covered, patching icon sets (no coding or art skills required). First a little background, if you use one of the more popular icon packs, you’ll likely have no issues. However many of the smaller icon packs either only support certain distros or lack icons for lesser known programs.

Take for example my all time favorite icon pack, Oranchelo, it is geared mainly towards Ubuntu. Lately I’ve been using Fedora 28 and while some icons work liked they’re supposed to, others, which work in Ubuntu, do not. So why is that?

Each program has an icon name, and while many programs keep a consistent icon name across distros, this is not always the case, such as with some of the default Gnome apps in Fedora vs Ubuntu. To fix this we need to either change the app’s icon name or create symbolic links to the current icon name, the latter generally being the better option.

First we need to find the current icon name, for all common (and probably for the uncommon ones as well) Linux desktop environments the way to do this is:

cd /usr/share/applications/

Here you will see (using the ls command) a bunch of .desktop files, these are config files that set how a program will be shown on the desktop, such as what will it be called under English or under Polish, as well as what the icon should be.

I’ve already patched Oranchelo for most of my applications but I’ve yet to do it for the IceCat browser (located towards the bottom on the screenshot), so I’ll use it as an example. Since we already have our terminal located in the right folder, lets just search for the right .desktop file:

ls | grep -i icecat

From that command we now know that full name of the file is “icecat.desktop”. Now that we see the file, we just need to find what it’s icon name is:

cat icecat.desktop | grep -i icon

Now that we know what the icon is called (“icecat”, icon names aren’t always this simple), we needed to open up our installed icon pack, if you’re not sure where that is, look back on the install instructions you used for your pack and just find where you placed said pack.

I generally prefer to look at the icons in a graphical file manager, so that I can make sure I pick the right one.

So now that we’re in the file, we want to go into apps, then scalable. Here we have all our icons, once we found one that we like, we need to create a symbolic link.

Since Oranchelo doesn’t currently have an Icecat logo, I will use the firefox nightly icon.

Now we need to open a terminal at this location and do the following command (depending on where you installed your icons, you may or may not need to use sudo)

ln -s icon.svg desiredApp.svg

Or in my case:

ln -s firefox-nightly-icon.svg icecat.svg

Now all we need to do is toggle the icons, simply switch to the system default icon set and then switch back and the correct icons will show.

As you can see, the desired icon is now set for Icecat

However this is not the only way to patch icon sets, some icon sets are designed to only replace a small amount of icons, such as folders. These often use inheritance to fill the void, however you may not always like the set from which they inherit the remainder, or you may simply prefer if it inherited from a different set.

One of my favorite Gnome themes, Canta, comes with its own icon pack that replaces folders but inherits the rest from Numix icon pack, but since I haven’t installed Numix, it defaults to the system default. However, I have the Flat Remix pack installed, I’ll make it instead inherit from that.

As before, we need to go into the icon pack folder. Once we’re in the canta icon pack, we need to open up the index.theme file with a text editor (as before, depending on where it is installed, you may or may not need sudo).

A few lines from the bottom you will see a “Inherits=”. For Canta it is:

"Inherits=Numix-Circle,Adwaita,gnome,hicolor"

So if we want it to inherit from flat remix (provided flat remix is installed correctly), all we need to do is add it in, changing the line to:

"Inherits=Flat-Remix,Numix-Circle,Adwaita,gnome,hicolor"

Once you save the file, all the missing icons should be automatically inherited from Flat Remix.

Best of luck with all your Linux customization.

Categories
Operating System

Handling Media Files in MatLab

You might be wondering: does anyone love anything as much as I love MatLab?  I get it, another MatLab article… Well, this one is pretty cool.  Handling media files in MatLab is, not only extremely useful, but is also rewarding.  To the programming enthusiast, it can be hard to learn about data structures and search algorithms and have only the facilities to apply this knowledge to text documents and large arrays of numbers.  Learning about how to handle media files allows to you see how computation effects pictures, and hear how it effects music.  Paired with some of the knowledge for my last two articles, one can begin to see how a variety of media-processing tools can be created using MatLab.

 

Audio

Audio is, perhaps, the simplest place to start.  MathWorks provides two built-in functions for handling audio: audioread() & audiowrite().  As the names may suggest, audioread can read-in an audio file from your machine and turn it into a matrix; audiowrite can take a matrix and write it to your computer as a new audio file.  Both functions can tolerate most conventional audio file formats (WAV, FLAC, M4A, etc…); however, there is an asymmetry between the two function in that, while audioread can read-in MP3 files, audiowrite cannot write MP3 files.   Still, there are a number of good, free MP3 encoders out there that can turn your WAV or FLAC file into an MP3 after you’ve created it.

So let’s get into some details… audioread has only one input argument (actually, it can be used with more than one, but for our purposed, you only have to use one), the filename.  Please note, filename here means the directory too (:C\TheDirectory\TheFile.wav).  If you want to select the file off your computer, you could use uigetfile for this.

The audioread function has two output arguments: the matrix of samples from the audio file & the sample rate.  I would encourage the reader to save both since the sample rate will prove to be important in basically every useful process you could perform on the audio.  Sample values in the audio matrix are represented by doubles and are normalized (the maximum value is 1).

Once you have the audio file read-in to MatLab, you can do a whole host of things to it.  MatLab has in-built filtering and other digital signal processing tools that you can use to modify the audio.  You can also make plots of the audio magnitude as well as it’s frequency contents using the fft() function.  The plot shown below is of the frequency content of All Star by Smashmouth.Once you’re finished processing the audio, you can write it back to a file on your computer.  This is done using the audiowrite() function.  The input arguments to audiowrite are the filename, audio matrix in Matlab, and sample rate.  Once again, the filename should also include the directory you want to save in.  This time, the filename should also include the file extension (.wav, .ogg, .flac, .m4a, .mp4).  With only this information, MatLab will produce a usable audio file that can then be played through any of your standard media players.

The audiowrite function also allows for some more parameters to be specified when creating your audiofile.  Name-argument pairs can be sent as arguments to the function (after the filename, matrix, and sample-rate) and can be used to set a number of different parameters.  For example, ‘BitsPerSample’ allows you to specify the bit-depth of the output file (the default is 16 bits, the standard for audio CDs).  ‘BitRate’ allows you to specify the amount of compression if you’re creating an .m4a or .mp4 file.  You can also use these arguments to put in song titles and artist names for use with software like iTunes.

 

Images

Yes, MatLab can also do pictures.  There are two functions associated with handling images: imread() and imwrite().  I think you can surmise from the names of these two function which one reads-in images and which one writes them out.  With images, samples exist in space rather than in time so there is no sample-rate to worry about.  Images still do have a bit-depth and, in my own experience, it tends to differ a lot more from image-to-image than it does for audio files.

When you import an image into MatLab, the image is represented by a three-dimensional matrix.  For each color channel (red, green, and blue), there is a two-dimensional matrix with the same vertical and horizontal resolution as your photo.  When you display the image, the three channels are summed together to produce a full-color image.

By the way, if you want to display an image in MatLab, use the image() function.

MathWorks provides a good deal of image-processing features built-into MatLab so if you are interested in doing some crazy stuff to your pictures, you’re covered!

Categories
Hardware

The Future Of Wireless Charging

The idea of powering devices wirelessly has been around for centuries, ever since Nikola Tesla built the Tesla tower that could light up lamps about 2 km away based on electromagnetic induction. Wireless Charging devices can be traced back to electric toothbrushes that used a relatively primitive form of inductive charging, decades before Nokia announced Integrated Inductive charging in its break-though Lumia 920 model in 2012. This marked the birth of the Qi standard which at that time was still contending for the much coveted universal/international standard spot. Although now it seems like wireless charging is right around the corner; and with Apple and Google launching Qi compatible phones, the message is clear and simple. ‘Wireless is the future and future is here.’ Or is it ?

 Qi (Mandarin for ‘material energy’ or ‘inner strength’) is a near-field energy transfer technology that works on the principle of electromagnetic induction. Simply put, the base station (charging matt, pad or dock) has a transmitting coil, which (when connected to an active power source) induces a current into the receiver coil in the phone, which in turn charges the battery. In its early stages, Qi used ‘guided positioning’ which required the device to be placed in a certain alignment on the base station. With some rapid developments over the time, this has been effectively replaced by the ‘free positioning’, which is standard in almost all the recent Qi charging devices. There’s a catch here- the devices must have a transmittable back surface. Glass is currently the most viable option and most Qi compatible smartphones have glass backs. This certainly has its implications though, the obvious one being significantly reduced durability.

Come to think of it, the fact that in order to charge, the device has to be within at the most an inch of the base station sounds counterproductive.  Besides, if the base needs to be connected to a power source, that’s still one cable. So…….. what’s the point ? Well currently the mobility part is more of a grey-area since this technology is still in its transitional phase. Majority of the Qi compatible smartphones still come with a traditional adapter by default and the wireless dock needs to be purchased separately. There are several other issues with near-field charging that need to be addressed, such as-

  •  Longer charging times
  •  Reduced efficiency ~60-70%
  •  high manufacturing costs
  •  higher energy consumption which could lead to increased production costs of electricity
  •  residual electromagnetic waves- a potential health risk
  •  Devices heat up faster compared to traditional adapters >  energy/heat waste
  •  Higher probability of software updates causing bugs

Over the past decade, people have come up with interesting solutions for this, including a charging phone case and even a battery-less phone powered by ambient radio waves and wifi signals. But the most promising option is the pi charging startup which hopes to fix the range issue, by allowing devices to pair with a charging pad within the range of a foot in any direction. The concept is still in its experimental stages and it’s going to be a while before the mid-long range wireless charging technology becomes pervasive standard for smartphones and other IoT devices. Assuming, further progress is made down that road, wireless charging hotspots could be a possibility in the not-very-distant future.

Qi standard despite all its shortcomings has had considerable success in the market and it looks like it’s here to stay for the next few years. A green light by both Apple and Google has given it the necessary boost towards being profitable and wireless pads are gradually finding their way into Cafes, Libraries, Restaurants, Airports etc. Furniture retailers such as Ikea have even started manufacturing wireless charging desks and tables with inductive pads/surfaces built in.  However, switching completely to, and relying solely on inductive wireless charging wouldn’t be the most practical option as of now unless upgrades are made to it, keeping all the major concerns surrounding it in sights. Going fully wireless would mean remodelling the very foundations of conventional means of transmitting electricity. In short, the current Qi standard is not the endgame and it can be seen as more of a stepping stone towards mid-long range charging hotspots.