Showing posts with label productivity. Show all posts
Showing posts with label productivity. Show all posts

Monday, September 27, 2021

Why for me Firefox still rules on desktop in 2021 (and why NOT)

In this article I would like to show you why I think Firefox is still the best browser among the well known desktop browsers today. For those who want to be productive while browsing the web, I do believe there is no better alternative for many years already.

Why this article?

Well, maybe you've heard about diminishing number of users of Firefox recently. The fact is that the decrease in Firefox users has got various reasons, but that's not the topic I would like to go into here. 

Like me, you may also read some articles how the new Firefox with its new, "totally revamped" UI is great, or, from the other camp, a total mess. There is also this popular "privacy & tracking" topic nowadays. But as I will show you below, I honestly think none of these is really an important decisive factor in a long term.

What bothers me is how so many people seem to be blind to see what is really important when choosing the browser "for their life". So this and also the lack of articles that would show the real strong sides of Firefox, where its competitors are a good way behind, led me to writing this post.

What really matters to me?

Most of the time we use a web browser for navigating the web, right? That is to view web pages and to search for them, being it via a search engine like Google, or by finding them in our browsing history, among pages we have bookmarked or among pages (tabs) that we have got currently opened.

And while this may sound new and surprising to some readers, there are IMHO huge gaps in how efficient Firefox versus the other browsers let you be in this area of quickly getting to pages opened either now, just recently or in a more distant past.

A side note: While there are various add-ons that strive to bring you some "core" functionality that is missing in a browser, based on my research mainly with Chrome, due to various technical limitations like restricted browsers' API, those add-ons mostly fail to deliver the desired functionality. Moreover, when you need to use a corporate PC, you might not be allowed to install any add-ons to your preinstalled browser. It's exactly when one realizes, as it happened to me, what a nightmare it is when you are forced to use a different browser, when it lacks all the functionality which you already consider an obvious, basic one.

OK, so let's finally have a look at what I consider the game-changing pros of Firefox.

Intelligent address bar and searching

This is such a superior and time saving feature for so many years, I'm surprised that the other browsers are seemingly only taking the first baby steps in this area. It feels like it is just not promoted enough by Firefox authors or its users.

Let's have a look at what all the address bar in Firefox offers. As in all browsers, you can search using your default search engine, but also at the same time:

  • search in the history of visited pages
    • unlike Chrome or Edge, Firefox does a fully fledged search here. I. e. you can enter unlimited number of words (or their parts), and Firefox still gives you relevant results from history. The very same applies to the 2 following features as well.
  • search in bookmarked pages
    • you can also add tags to your bookmarks or even assign a keyword and later refer to them in the address bar
  • search in the currently opened tabs
    • as in the aforementioned searches, both URL and title of a page can be searched for
  • learn and suggest pages the user visits the most among the top matches

And of course, as most of the stuff in Firefox, the address bar behavior is pretty much customizable.

Switch to the most recently viewed pages easily

Firefox doesn't limit you when it comes to switching to another tab. You can either use the Ctrl+Tab shortcut similarly to Alt+Tab, i. e. to switch to the most recently viewed pages, which many people, including me, naturally prefer. Or you can setup Firefox to switch to the next tab in the tab bar.

And what about the other browsers? They only offer you the latter way of switching, which is quite limiting, moreover when one can always use Ctrl+PageUp and Ctrl+PageDown in order to navigate in this way!

Advanced Find on page possibilities

I guess that this is not critical for most users, but when you press Ctrl+F in Chrome or Edge, you can just search a plain string on the page, with no further options. While in Firefox you get many more options: "Match Case", "Match Diacritics", "Whole Words" and "Highlight All". 

A side note: There was this 17 years old feature request To also highlight matches on the scrollbar that was just implemented this year, a big thank you to the contributors! For me, this was possibly the only bigger missing feature when compared to Chrome. It could have been somewhat mitigated by add-ons, but they could have never reached the quality of a native function.

What matters, but is secondary to me?

Of course, there are plenty of other criteria you can also take into consideration when choosing your favorite browser. Yet, even though being important, for me the following features and traits of the top browsers are mostly quite similar and therefore not the primary decision factors.

  1. Performance and system resources. It is already many years back when Firefox was apparently slower than Chrome (and when Firefox was even missing native developer tools). If you watch this topic, you know that in some areas like memory consumption it might be even vice versa today. BTW we are still waiting whether Chrome will ever implement lazy loading of tabs on browser's start.
  2. Add-ons. Historically there were much more add-ons for Firefox. I admit I'm not sure how it is now and how strong are the communities of add-ons authors. As a user I can't see any dramatic differences now.
  3. Web pages functionality. Yes, there are some unfortunate exceptions when developers test or even target their page / app just at some browser, typically (and logically) at the wide-spread Chrome (while Edge uses the same engine beneath). That's something I can live with though.
  4. Security, blocking trackers. I consider this as a nice bonus of using Firefox. But having this as the main criteria to choose a browser? I'm not that paranoid and this area is also quite dynamic, so definitely not.
  5. License. Well, sure, Firefox being open source is great and promising, but do users generally really bother?
  6. Synchronization among devices, auto-play blocking, etc. etc. While once again Firefox beats for example Chrome in some aspects (see Mozilla's comparison), I find that browsers are mostly on par here.

What shouldn't matter at all?

Here come the 2 main topics that I've come across recently in articles which either promoted or reproved Firefox...

"Modern design / looks"

Firefox has got this new UI called "Proton" recently. While some promote this nearly as revolutionary, the only practical differences I can see are:

  • The new UI eats some extra vertical pixels "just for fun" of some crazy designer, but I can surely live with that, moreover when it may get changed soon.
  • I hope that they will bring back a page icon in the tab bar while there is a video / audio playing on that page.

All the other changes won't get into my view most of the time. Call me design ignorant if you want, but Firefox is basically still the same browser, with the same controls and UI layout that in principle cannot even be much different from the other browsers!

History

What happened happened, right? It's good to know how the various browsers evolved, so that we can better guess their future, but it is the present functionality that we should mainly talk about.

Summary

In short, I don't choose a browser because it is preinstalled, out of nostalgia or because it has a "modern UI" (whatever that means). I do choose a browser because of its functionality and because it makes me more productive than the other browsers. And I believe everyone should do the same and not to judge a browser if they haven't really actually checked it out and its full potential. Of course, your point of view may vary, but please try to be kind and as much as objective as possible. :)

Saturday, December 19, 2020

CopyQ - Quick diff texts

TL;DR

In short, you can use the power of CopyQ commands in order to quickly compare any two pieces of text - just copy the texts into the clipboard and run the Diff Latest Items command on them. As always, simply follow the installation instructions in order to install the command into your CopyQ instance.

As mentioned in the documentation page, you will also need a compare tool that can be invoked by the CopyQ command in order to do the actual comparison. The last step is, possibly, to modify a part of the command's code. This part looks like the following at the time of writing:

// Choose your favorite diff tool (leave just one execute(...) uncommented):

// === Beyond Compare ===
// reference: https://www.scootersoftware.com/v4help/command_line_reference.html
execute('bcompare', name1, name2)

// === WinMerge ===
// reference: https://manual.winmerge.org/en/Command_line.html
// execute('winmergeu', '/e', '/x', '/u', '/fl', '/dl', 'item1', '/dr', 'item2', name1, name2)

Note: In order to work, the program passed to the execute() command must be on the system PATH, otherwise a full path to the program needs to be specified.

Story of the Diff Latest Items command

I don't know how you, but I pretty much hate doing something that a computer can do for me instead. In regards of this post, it is finding out differences in texts. It might be the case of comparing similarly looking methods in a source code, or for example similar paragraphs found on different web pages.

Of course, one can use many different tools to do the comparison, but they usually require you to firstly have files created that are going to be compared.1 So, I was looking for a quick and universal solution. And once you get familiar with CopyQ, creating a simple CopyQ command just for that is the next logical step, and that is how the Diff Latest Items command got created. Well, I'm not the original author of it though. :)

I was playing with this idea in my head for several weeks and just on the weekend when I started with implementation, I searched for an example of how to create a temporary file from CopyQ (so that it can be fed to an external comparison tool). And instead of an example, I found this ready-to-use script that was created just a few days before! So at least I improved its documentation and also added support for my favorite tool WinMerge, job done. :)

Conclusion

And what about you? Do you have some other tricks of how to compare text chunks? Or have you also found this CopyQ's command useful? Don't hesitate to let all know in the comments. :)


1 If you use Eclipse IDE, for example, and you are lucky enough to come across the AnyEdit Tools plugin, you can e. g. compare a part of an opened file with clipboard contents pretty easily. Yet, this still requires some clicking "here and there" and we also know that startup times of IDEs like Eclipse are not the best. ;)

Sunday, March 22, 2020

CopyQ - The most useful commands

In this post, we will look at some of the most useful CopyQ commands that are either built-in, or that can be additionally imported from a dedicated project on GitHub. If you are unsure what CopyQ or its commands mean, or what are the various types of commands, I recommend you to read the quick introduction to CopyQ first.

Note: There are simply too many commands available to name them all, so what follows is just a selection of commands which I myself currently find generally the most useful. It's quite likely that depending on the stuff you do and applications you use, your selection of favorite commands might be different.

Built-in commands


Built-in commands are the commands which can be easily added to CopyQ via the "Add" button of the Commands window, as shown in the following screenshot:

CopyQ's "Add commands" dialog, listing all the built-in commands.

Command: Paste clipboard as plain text (global)


More often than not one needs to paste a clipboard content without any formatting. And that's exactly what the global command "Paste clipboard as plain text" does. This function is already built-in to some programs, e. g. into the LibreOffice suite, but many other programs don't have anything like that.

CopyQ also offers a similarly named command: "Paste as Plain Text". It does the same thing, but you run it upon a selected item from CopyQ's history instead of using the current clipboard content.

And that's all from built-in commands. Still, there are commands which you might find useful in specific scenarios, so you can surely give them a try as well.

Commands from the GitHub project


There is a dedicated copyq-commands project on GitHub, maintained by the CopyQ's author, that one can use to easily get to plenty of useful commands. Another pro of this project is that you can suggest or contribute new commands there.

Let's have a look of some handy commands from this project now. Note that there is a small gotcha that the commands are often called differently than in the project's documentation.

Command: Import Commands after Copied to Clipboard (automatic)


[documentation]

As described at the project's home page linked above, this command saves you time when adding other commands to CopyQ - so that you don't need to enter all the command attributes manually.

Warning: If the copied text is a link to a command on GitHub, the automatic import doesn't have to always succeed due to a general SSL issue #1177.

Command: Big Data Tab (automatic)


[documentation]

If you copy too big items, searching in the clipboard history might get slow. That's when this command steps in and moves an item into a dedicated tab if the item exceeds a predefined size (counted as a sum from all the item formats - e. g. plain text + html1).

Of course, you can change this limit - right at the beginning of the script. But how to find out how big an item is, without scripting? Simply select an item and select "Show Content..." from the context menu (or press F4) and you will see the size in bytes in the follow-up dialog.

Command: Replace All Occurrences in Selected Text (global)


[documentation]

This is a simple find-replace text function which is not that powerful and I can imagine it could be taken at least one step further. Yet, it nicely demonstrates some of the CopyQ's capabilities for those who want to write their own commands - like:
  • triggering copy and paste system events,
  • showing a user input dialog,
  • or using various JavaScript / ECMAScript constructs, including RegExp functions.

Command: Snippets (global)


[documentation]

This powerful command is my favorite one. In short, this command extends CopyQ so that it can be used as a simple tool for snippets, or templates, if you like.

This command is quite nicely documented, so I will just illustrate its usage on the following example:

Imagine you write a blog post and you want to insert a footnote and a corresponding footnote link into the post. As this doesn't have to be directly supported by your blogging system, you can use the Snippets command for generating relatively complex HTML code chunks:

An example of a dedicated tab with custom snippets.

An example of the snippet selection dialog when the Snippets command is launched.

An example of the final dialog where values for placeholders are to be filled in.


Customizing the command

You may want to add the resulting snippet text as another item to history and not to paste it immediately. In the simplest case, you would have to change the function pasteSnippet() of the command script from this:

function pasteSnippet(mime, content) {
  copy(mime, content)
  copySelection(mime, content)
  paste()
}

... to this:

function pasteSnippet(mime, content) {
  copy(mime, content)
  copySelection(mime, content)
  tab('clipboard') // change this to whatever default tab name you use
  add(unpack(content))
}

Of course, I can't give any warranty on this, but it is supposed to work at the time of writing.

Conclusion


As you can see, you can use CopyQ not only as a simple clipboard manager, but thanks to commands you can extend its functionality in many ways. Don't hesitate to share your own experience with CopyQ commands in the comments!

1 Note that for texts copied e. g. from MS Word the size of clipboard content in the HTML format can be surprisingly high (like several kilobytes) even for short texts. This is due to all the extra styling information added to clipboard by the source application.

Saturday, February 22, 2020

CopyQ for the impatient - Introduction

CopyQ is a really handy clipboard manager. As its name suggests, it enables you to easily return to previous items in your clipboard, but as you will see later, it offers much, much more. Thanks to its scripting capabilities, it is also a handy automation tool. I'm a big fan of CopyQ and I think it deserves more promotion, so I decided to create this, hopefully useful wrap-up.

Why to use it, and not something else?


On AlternativeTo, CopyQ holds the 2nd position with 162 likes at the time of writing. The 1st place is occupied by Ditto with 304 likes, but Ditto has one big disadvantage: it is only for Windows. For me, CopyQ is also much better when it comes to options of running custom commands (scripting). Both apps are free and open source.

When talking about Windows, since a recent Windows 10 build, you might use their built-in clipboard manager as well (just try to press Win+V if you own one). But even without trying out, I'm sure it will be pretty much behind CopyQ & co. when talking about productivity-boosting features for advanced users - just read on!

Features


Firstly, to make a basic idea of the app, here is a screenshot of its main window:

An example of CopyQ's main window, illustrating some basic terms.


Here are the main distinguishing traits of CopyQ:
  • Runs and offers the same interface on Linux, Mac and Windows.1
  • Supports images as well as formatted text.
  • You can search the clipboard history easily (supports regular expressions).
  • It has a simple built-in editor of clipboard items.
  • You can control what gets into the clipboard history. And of course, the history is persisted among computer restarts.
  • If you want, you can control it from command line as well.
  • Nearly endless possibilities of customization, including running custom commands (see Commands).
  • A superb documentation (see Documentation).
And to mention some advanced "enterprise" features:
The only nice-to-have feature which is missing, is probably an automated synchronization of commands across multiple machines (e. g. in a company)...

Basic setup


So now that we know what CopyQ can do, how to make it run on our machine? We start by downloading an installer or a portable archive - simply follow the installation instructions.

Once the CopyQ is installed and running, we set a global keyboard shortcut for showing the CopyQ's main window. Firstly, we need to open the Configuration dialog from the system tray:


Secondly, we set the shortcut in the opened dialog:


Here we inspired from Ditto's default shortcut, which is Ctrl+` - i. e. hold down Ctrl and press the back-quote (tilde = ~) key.2

In the same dialog, we can choose whether we want immediate pasting after selecting a clipboard item from history, or not:



Add a tab for your favorite snippets


Next, we might want to add a tab for keeping our favorite code snippets (as seen on the very first picture above), or whatever we intend to use it for. This is as easy as pressing Ctrl+T in the main window:



Done!


Now we can just enjoy the CopyQ, let it maintain the clipboard in the background and use its main window and/or shortcuts whenever we need to return to a previous clipboard item, for example. The GUI and default shortcuts are pretty intuitive, so luckily there's only little to learn for the basic usage.

Documentation


CopyQ has a pretty good documentation and this post is definitely not meant to be its replacement. Beware though that there are some little gotchas:

  • The project's home page on Github contains some overlapping information (e. g. installation steps). And it is only here where you can see a quick overview of app's features.
  • If you by coincidence get to a project's wiki page like Basic Usage, run away - it got deprecated and replaced by the newer documentation.

Commands


Attention: It gets a little bit more technical in here!

Pressing F6 in the CopyQ's main window takes you to the management of commands:

An example of the Commands window. It shows the source code of one of the many built-in commands (selected & inserted via the "Add" button). Properties of the command are set in the "Advanced" tab.


While working with commands in CopyQ is great and thoroughly documented, I miss a quick overview of some concepts for newbies. So here is my little attempt to fix that (You might still want to read the official glossary page first.):

  • Commands are either built-in, or user defined. Every command is actually a readable script (with some necessary metadata - options). For the impatient: see this paragraph for various forms of the command scripts.3
  • Every command may be run in different contexts depending on what checkboxes get selected in its "Type of Action" options section. That is:
    • automatic (when there's a new clipboard item)
    • in menu (to run it over selected item(s); a shortcut may be assigned)
    • global (to run it at anytime when needed; a global shortcut may be assigned)
    • display (changes how items look like in the main window)
    • script (changes the default set of available functions, so a more precise name would be an "extension script")
  • If you don't see a built-in command, you need to explicitly add it to available commands via the Commands window (F6). Or, you can achieve the same effect by assigning a shortcut to the command in the Configuration dialog (Ctrl+P).
  • The Action Dialog dialog (F5) lets you run an ad-hoc command script instead of an existing named command. You have to explicitly select a "Standard input" for passing the content of selected item(s) to the script.
    Here's an example, showing a rather improbable scenario of converting a URL address to uppercase:

All-in-all, with CopyQ commands you can do lots of interesting stuff and there are many ways of how to create and use them. There is even a library of commands from the author(s) in a dedicated Github project called copyq-commands. Maybe in another post we will take a closer look at this!

Follow-up article: CopyQ - The most useful commands.

1 Ordered alphabetically.

2 Beware though that a keystroke which includes a key that maps to different characters based on the current keyboard layout (like Ctrl+`) doesn't have to work under all circumstances. See issue 1323 for more details.

3 As you may have guessed, the "copyq:" scripts are written in ECMAScript and you can call built-in CopyQ functions from them. So if you are familiar with JavaScript, you'll be like at home here.