What's in your .muttrc? - mutt

I've just begun using mutt (what started out as slowly stripping myself of GUI applications, ended up with me just being holed inside a terminal window), and while I've managed to fetch my mail from my IMAP server, there are some customizations I'd like to do, mainly:
Fetch today's mail.
Leave everything on server
Don't save anything ever on local disk
Don't ask if I want to create a $USER/Mail folder. Since I also have my regular mail client, mutt is just an easy way to check mail from the terminal.
Instead of just asking a question here, I thought I'd try to find out more about some cool tricks, color schemes, and config settings you guys might have, that I can use in mine.

Here's what I can think of re your customizations:
Not sure how you'd be able to achieve that, if you switch to a folder in IMAP mutt will fetch all the headers of that folder. It will only fetch a mail once you open it tough.
Since you are using IMAP, mutt should leave everything on the server by default anyway. It will only delete something if you specifically request deletion. Or maybe I'm misunderstanding what you're trying to achieve?
That should be possible by disabling the local cache. There's a header and a message cache. See header-cache and message-cachedir for more info. But note that disabling the caches will hurt the performance, because every time you switch a directory mutt will have to re-fetch the headers for all your messages.
In your muttrc, make sure to set your folder variable correctly. If I remember correctly $USER/Mail is the default value. If you set it correctly mutt won't ask you to create it every time you start it.
And here are some excerpts from my mutt config:
set postpone=ask-no
set beep_new=yes
set confirmappend=no
set sort=threads
set mail_check=60
set timeout=10
set net_inc=5
set move=no
set sort_alias=alias
set reverse_alias=yes
set alias_file=~/.mail_aliases
set editor='vim + -c "set textwidth=72" -c "set wrap"'
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
auto_view text/html application/pdf application/msword
alternative_order text/plain text text/enriched text/html
mime_lookup application/octet-stream
source $alias_file
set mbox_type=maildir
set ssl_starttls=yes
set folder=imaps://host:port
set spoolfile="+inbox"
set record="+sent/`date +%Y-%m`"
set postponed="+drafts"
ignore *
unignore Date To Cc Bcc From Subject X-Mailer Organization User-Agent X-PGP-Key List-Id
hdr_order Date From To Cc Bcc Subject X-Mailer User-Agent Organization List-Id X-PGP-Key
And my color scheme:
# Default color definitions
color normal white default
color hdrdefault green default
color quoted green default
color quoted1 yellow default
color quoted2 red default
color signature cyan default
color indicator brightyellow red
color error brightred default
color status brightwhite blue
color tree brightmagenta default
color tilde brightblue default
color attachment brightyellow magenta
color markers brightred default
color message white default
color search brightwhite magenta
color bold brightyellow green
# Color definitions when on a mono screen
mono bold bold
mono underline underline
mono indicator reverse
mono error bold
# Colors for items in the reader
color header brightyellow default "^(From|Subject):"
color header brightcyan default ^To:
color header brightcyan default ^Cc:
mono header bold "^(From|Subject):"
Hope that helps!

I realize this is super old now but check out offlineimap for background syncing of a local Maildir setup to an IMAP account somewhere.
http://offlineimap.org/
Also, the solarized color schemes are quite nice:
http://ethanschoonover.com/solarized

Related

Open a c++ application installed on computer with a custom url in browser [duplicate]

How do i set up a custom protocol handler in chrome? Something like:
myprotocol://testfile
I would need this to send a request to http://example.com?query=testfile, then send the httpresponse to my extension.
The following method registers an application to a URI Scheme. So, you can use mycustproto: in your HTML code to trigger a local application. It works on a Google Chrome Version 51.0.2704.79 m (64-bit).
I mainly used this method for printing document silently without the print dialog popping up. The result is pretty good and is a seamless solution to integrate the external application with the browser.
HTML code (simple):
Click Me
HTML code (alternative):
<input id="DealerName" />
<button id="PrintBtn"></button>
$('#PrintBtn').on('click', function(event){
event.preventDefault();
window.location.href = 'mycustproto:dealer ' + $('#DealerName').val();
});
URI Scheme will look like this:
You can create the URI Scheme manually in registry, or run the "mycustproto.reg" file (see below).
HKEY_CURRENT_USER\Software\Classes
mycustproto
(Default) = "URL:MyCustProto Protocol"
URL Protocol = ""
DefaultIcon
(Default) = "myprogram.exe,1"
shell
open
command
(Default) = "C:\Program Files\MyProgram\myprogram.exe" "%1"
mycustproto.reg example:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\mycustproto]
"URL Protocol"="\"\""
#="\"URL:MyCustProto Protocol\""
[HKEY_CURRENT_USER\Software\Classes\mycustproto\DefaultIcon]
#="\"mycustproto.exe,1\""
[HKEY_CURRENT_USER\Software\Classes\mycustproto\shell]
[HKEY_CURRENT_USER\Software\Classes\mycustproto\shell\open]
[HKEY_CURRENT_USER\Software\Classes\mycustproto\shell\open\command]
#="\"C:\\Program Files\\MyProgram\\myprogram.exe\" \"%1\""
C# console application - myprogram.exe:
using System;
using System.Collections.Generic;
using System.Text;
namespace myprogram
{
class Program
{
static string ProcessInput(string s)
{
// TODO Verify and validate the input
// string as appropriate for your application.
return s;
}
static void Main(string[] args)
{
Console.WriteLine("Raw command-line: \n\t" + Environment.CommandLine);
Console.WriteLine("\n\nArguments:\n");
foreach (string s in args)
{
Console.WriteLine("\t" + ProcessInput(s));
}
Console.WriteLine("\nPress any key to continue...");
Console.ReadKey();
}
}
}
Try to run the program first to make sure the program has been placed in the correct path:
cmd> "C:\Program Files\MyProgram\myprogram.exe" "mycustproto:Hello World"
Click the link on your HTML page:
You will see a warning window popup for the first time.
To reset the external protocol handler setting in Chrome:
If you have ever accepted the custom protocol in Chrome and would like to reset the setting, do this (currently, there is no UI in Chrome to change the setting):
Edit "Local State" this file under this path:
C:\Users\Username\AppData\Local\Google\Chrome\User Data\
or Simply go to:
%USERPROFILE%\AppData\Local\Google\Chrome\User Data\
Then, search for this string: protocol_handler
You will see the custom protocol from there.
Note: Please close your Google Chrome before editing the file. Otherwise, the change you have made will be overwritten by Chrome.
Reference:
https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
Chrome 13 now supports the navigator.registerProtocolHandler API. For example,
navigator.registerProtocolHandler(
'web+custom', 'http://example.com/rph?q=%s', 'My App');
Note that your protocol name has to start with web+, with a few exceptions for common ones (like mailto, etc). For more details, see: http://updates.html5rocks.com/2011/06/Registering-a-custom-protocol-handler
This question is old now, but there's been a recent update to Chrome (at least where packaged apps are concerned)...
http://developer.chrome.com/apps/manifest/url_handlers
and
https://github.com/GoogleChrome/chrome-extensions-samples/blob/e716678b67fd30a5876a552b9665e9f847d6d84b/apps/samples/url-handler/README.md
It allows you to register a handler for a URL (as long as you own it). Sadly no myprotocol:// but at least you can do http://myprotocol.mysite.com and can create a webpage there that points people to the app in the app store.
This is how I did it. Your app would need to install a few reg keys on installation, then in any browser you can just link to foo:\anythingHere.txt and it will open your app and pass it that value.
This is not my code, just something I found on the web when searching the same question. Just change all "foo" in the text below to the protocol name you want and change the path to your exe as well.
(put this in to a text file as save as foo.reg on your desktop, then double click it to install the keys)
-----Below this line goes into the .reg file (NOT including this line)------
REGEDIT4
[HKEY_CLASSES_ROOT\foo]
#="URL:foo Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\foo\shell]
[HKEY_CLASSES_ROOT\foo\shell\open]
[HKEY_CLASSES_ROOT\foo\shell\open\command]
#="\"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\" \"%1\""
Not sure whether this is the right place for my answer, but as I found very few helpful threads and this was one of them, I am posting my solution here.
Problem: I wanted Linux Mint 19.2 Cinnamon to open Evolution when clicking on mailto links in Chromium. Gmail was registered as default handler in chrome://settings/handlers and I could not choose any other handler.
Solution:
Use the xdg-settings in the console
xdg-settings set default-url-scheme-handler mailto org.gnome.Evolution.desktop
Solution was found here https://alt.os.linux.ubuntu.narkive.com/U3Gy7inF/kubuntu-mailto-links-in-chrome-doesn-t-open-evolution and adapted for my case.
I've found the solution by Jun Hsieh and MuffinMan generally works when it comes to clicking links on pages in Chrome or pasting into the URL bar, but it doesn't seem to work in a specific case of passing the string on the command line.
For example, both of the following commands open a blank Chrome window which then does nothing.
"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "foo://C:/test.txt"
"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "foo://C:/test.txt"
For comparison, feeding Chrome an http or https URL with either of these commands causes the web page to be opened.
This became apparent because one of our customers reported that clicking links for our product from a PDF being displayed within Adobe Reader fails to invoke our product when Chrome is the default browser. (It works fine with MSIE and Firefox as default, but not when either Chrome or Edge are default.)
I'm guessing that instead of just telling Windows to invoke the URL and letting Windows figure things out, the Adobe product is finding the default browser, which is Chrome in this case, and then passing the URL on the command line.
I'd be interested if anyone knows of Chrome security or other settings which might be relevant here so that Chrome will fully handle a protocol handler, even if it's provided via the command line. I've been looking but so far haven't found anything.
I've been testing this against Chrome 88.0.4324.182.
open
C:\Users\<Username>\AppData\Local\Google\Chrome\User Data\Default
open Preferences then search for excluded_schemes you will find it in 'protocol_handler' delete this excluded scheme(s) to reset chrome to open url with default application

Does the WinRT Clipboard History only support text and images?

I'm making a C++/WinRT app that makes use of the Window 10 clipboard history but for some reason I can only grab text and images.
My code is a bit like this..
auto history = Clipboard::GetHistoryItemsAsync().get();
if (history.Status() == ClipboardHistoryItemsResultStatus::Success)
{
auto historyItemList = history.Items();
for (const auto& historyitem : historyItemList)
{
//Works
if (dataPackageView.Contains(StandardDataFormats::Text()))
{
GetClipboardText(dataPackageView);
}
//Works
if (dataPackageView.Contains(StandardDataFormats::Bitmap()))
{
GetClipboardBitmap(dataPackageView);
}
//Never triggers
if (dataPackageView.Contains(StandardDataFormats::Html()))
{
GetClipboardHtml(dataPackageView);
}
//Never triggers
if (dataPackageView.Contains(StandardDataFormats::StorageItems()))
{
GetClipboardStorageItems(dataPackageView);
}
//etc..
I'd like to make use of the other dataformats. EG: For StorageItems, I expected if I CTRL+C an item from my desktop or if I did it programatically with
dataPackage.SetStorageItems({ std::begin(files), std::end(files) });
Clipboard::SetContent(dataPackage);
Clipboard::Flush();
The file would end up in the clipboard history so I could handle it like in the first snippet. But the file never appears in the returned Clipboard::GetHistoryItemsAsync() container. I also don't see the file in the history viewer when you press WIN+V.
So what i'm wondering is;
Does Windows 10 clipboard history "only" support raw text and images? can I not make use of the other dataformat properties? (ApplicationLink, Html, Rtf, StorageItems, Uri, Weblink etc)
I gave StorageItems as an example but it happens with the other formats too. If I CTRL+C a weblink (such as: https://stackoverflow.com/questions/ask), I expected dataPackageView.Contains(StandardDataFormats::WebLink()) Or Uri to trigger, but they don't
If the clipboard history can support other formats, how do you actually make use of it?
Edit:
Forgot to add. When I programatically added a StorageItem to the clipboard I also tried it like below. Don't know why I can't add strings to an IVector though.
auto options = ClipboardContentOptions();
auto formats = Windows::Foundation::Collections::IVector<hstring>();
formats.Append(StandardDataFormats::StorageItems()); //Unhandled Exception
options.IsAllowedInHistory(true);
options.IsRoamable(true);
options.HistoryFormats() = formats;
options.RoamingFormats() = formats;
Clipboard::Clipboard::Clear();
Clipboard::SetContentWithOptions(dataPackage, options);
Clipboard::Flush();
As observed by my esteemed colleague Faywang - MSFT, Windows' clipboard history and cloud clipboard sync implementation supports only a limited number of clipboard data formats, and this is reflected in the UWP clipboard API in the Windows Runtime Clipboard class.
It's important to remember that what clipboard formats are supported by clipboard history is not a contractual detail of clipboard history. Please keep that in mind when you read on:
As of Windows 10 version 2004 (aka build 19041, aka the May 2020 update), clipboard history supports the following clipboard data formats defined in StandardDataFormats:
Plain text: StandardDataFormats.Text
Various URI formats: StandardDataFormats.Uri, StandardDataFormats.WebLink, and StandardDataFormats.ApplicationLink
HTML clipboard format: StandardDataFormats.Html
Bitmaps: StandardDataFormats.Bitmap
For compatibility with classic desktop applications (aka Win32 apps), clipboard history also supports a few clipboard data formats whose names are not in StandardDataFormats, but which the Windows system can auto-convert to and from the above-listed StandardDataFormats formats when needed by an app trying to paste a particular format.
Clipboard history does not support any other custom or well-known clipboard formats.
Given the above, the only thing I see in your results that seems strange is that your app doesn't appear to be reading the HTML format. I don't know of any Windows implementation bugs in this area - try fiddling with your code some more, and if you still have trouble, I'd definitely encourage you to post another question, or contact us at Microsoft another way (such as through Feedback Hub).
I do observe that the Microsoft documentation around clipboard history from a conceptual technical perspective is lacking. I'd also encourage you to file GitHub issues against the places where clipboard history is documented, such as https://github.com/MicrosoftDocs/winrt-api - we're always listening.

Preview url is not showing correctly when all metadata are ok

Hello from today we begin to have a problem with the metadata, nothing added to level code, and nothing change in this side, normally we had preview of the page based in the metadata , all params are ok, og:image path is ok and all other meta params have been verified but looks how that there are some problem that i not arrive to see :
https://www.onehousestand.com/fr/salles/Brabant-Flamand/Affligem/dans-le-loft-la-maison-de-laura
If i look into all params are ok, but by example into facebook developer console 'https://developers.facebook.com/tools/debug/' i have this error :
Unknown Image Error
We have detected an unknown error in the "og: image" property (URL https://www.onehousestand.com/images/5/s_58.jpg).
But img is ok and path is ok
In the page, the https path to image was changed, if we look the source code of the page, no https in the path to og:image really but facebook detect that yes (i dont know if possible cache)
All ideas and suggestions are wellcome

Pywinauto 0.6.0 access browser URL in edit control for Firefox

I am currently trying to access URL of the active window for Firebox browser using Pywinauto 0.6.0, as part of a python app that can track website usage. I am a newbie python programmer, so if I have made some obvious mistakes then this is why.
I have read all the material I can find on Google and the Pywinauto docs, but there are no clear indications of how to do this, atleast not without using "Typekeys" after connecting to a window.
In fact, I have been able to access to the URL the "hack" way by connecting to the browser window with pywinauto, then using "TypeKeys()" to grab the URL and copy it to clipboard. But this approach will not work for me, as it interrupts the user and my app must run in the background whilst the user is accessing their system as usual. Using the typekeys method introduces some odd mouse and window behaviour when changing or refreshing windows and then trying to grab the URL - so the approach has proven unworkable for me.
Currently the code I have is as follows (I have used the window text title='' of a specific window I am using for testing, in practice it is whichever the active tab on the browser is):
from pywinauto import *
app = application.Application()
app.connect(title=u'Facebook - Log In or Sign Up - Mozilla Firefox', found_index=0)
window = app.top_window_()
window.PrintControlIdentifiers()
titlebar = window.child_window(title=u'Facebook - Log In or Sign Up - Mozilla Firefox')
toolbar = titlebar.child_window(title=u'Navigation Toolbar')
combobox = toolbar.child_window(title=u'Search or enter address')
edit = combobox.child_window(title=u'Search or enter address')
I use PrintControlIdentifiers() in order to see which elements I can interact with, but this returns only
MozillaWindowClass - 'Facebook - Log In or Sign Up - Mozilla Firefox' (L-32000, T-32000, R-31840, B-31944)
[u'Facebook - Log In or Sign Up - Mozilla Firefox', u'MozillaWindowClass', u'Facebook - Log In or Sign Up - Mozilla FirefoxMozillaWindowClass']
I can access the Firefox Window fine with the current active tab, but next when trying to access the ChildWindow and subsequent ChildWindow there is no error, until I try and do something with the childwindow e.g., Click() function on what I think in the URL bar UI element. However, I am not sure even if the code is even accessing the child window element correctly in the first place. Or if this the right way to try and filter through the child elements to get to the URL edit control element.
As can be seen in the below image of the tree view of the UI elements (using UISPY.exe), the following tree to access the firefox browser edit control element that contains the URL is:
Tree view of Firefox UI elements via UISPY
"window" -> "title bar" -> "tool bar" "Navigation Toolbar" -> "combo box" -> "Search or enter address" -> "edit" "Search or enter address
where the "edit" control contains the attribute Value, Value:"url", which I need to extract to a variable.
Any help with this would greatly appreciated.
This is probably too late to post but incase any future developers has similiar question. Here is working solution.
Just pass backend='uia' as argument like application.Application(backend='uia'). Now, accessing and performing actions on child_window is possible.
Here is complete code snippet for any url.
url='https://google.com'
app = application.Application(backend='uia').connect(title_re=".*Mozilla Firefox")
main_firefox_winspec = app.window(title_re=".*Mozilla Firefox")
address_bar = main_firefox_winspec.child_window(title_re=".*or enter address", control_type="Edit")
address_bar.set_edit_text(url)
time.sleep(3)
main_firefox_winspec.child_window(title="Go to the address in the Location Bar").wrapper_object().click_input()

R Markdown with Shiny Server change host parameter

I am running RStudio on a server and I created a RMarkdown (.Rmd) file. It works fine if I create it as a static HTML but it does not work if I want it to be interactive (by adding runtime:shiny).
The issue is that when I add runtime:shiny and press the Run Document button the application will try to open at 127.0.0.1:xxxx (here xxxx is a random port). In order to make it work I would have to be able to change the host parameter to '0.0.0.0'. This is an option in the runApp function from the shiny package but I don't know how to add this option in RMarkdown.
Can anyone help me with this?
Thank you.
The ::run command from rmarkdown invokes shiny::runApp internally. You can set the option shiny.host before running the document:
options(shiny.host="0.0.0.0")
rmarkdown::run("myfile.Rmd")
You an also pass arbitrary paramters to runApp, so this should work too:
rmarkdown::run("myfile.Rmd", shiny_args=list(host="0.0.0.0"))
Neither of these will work with the Run Document button; that button starts a new R session in which to render the document. To change the shiny.host option in that session, you'll need to add the option to your .Rprofile.
Set the default values you want to initialize in (~/.Rprofile) under user directory
Sys.setenv(TZ = "UTC") # for Timezone
options(shiny.port = 9999)