2 Commits

Author SHA1 Message Date
Christoph Reiter
2493c69100 Add a border around the "2" 2021-03-24 10:34:41 +01:00
Christoph Reiter
c2aaca5cd8 Rebuild the icons based on SVG sources
The SVG was created by tracing with Inkscape
2021-03-24 09:10:58 +01:00
16 changed files with 72 additions and 97 deletions

2
.gitattributes vendored
View File

@@ -1,2 +1,2 @@
# Declare files that always have LF line endings on checkout
PKGBUILD text eol=lf
* text eol=lf

29
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: build
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: setup-msys2
uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
install: msys2-devel base-devel
- name: Build
shell: msys2 {0}
run: |
makepkg -Csfri --noconfirm --nocheck
- name: Upload
uses: actions/upload-artifact@v2
with:
name: package
path: '*.pkg.tar.*'

View File

@@ -1,6 +1,6 @@
PREFIX=
all: msys2.exe msys2.ini mingw32.exe mingw32.ini mingw64.exe mingw64.ini ucrt64.exe ucrt64.ini clang64.exe clang64.ini clangarm64.exe clangarm64.ini
all: msys2.exe msys2.ini mingw32.exe mingw32.ini mingw64.exe mingw64.ini ucrt64.exe ucrt64.ini clang64.exe clang64.ini
.PHONY: all
@@ -43,11 +43,3 @@ clang64.res: launcher.rc clang64.ico
$(PREFIX)windres -O COFF -o $@ $< -DMSYSTEM=CLANG64 -DICONFILE=clang64.ico
clang64.exe: launcher.c clang64.res
$(PREFIX)gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o $@ $^
clangarm64.ini: launcher.ini
cp -f $^ $@
echo MSYSTEM=CLANGARM64>> $@
clangarm64.res: launcher.rc clangarm64.ico
$(PREFIX)windres -O COFF -o $@ $< -DMSYSTEM=CLANGARM64 -DICONFILE=clangarm64.ico
clangarm64.exe: launcher.c clangarm64.res
$(PREFIX)gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o $@ $^

View File

@@ -1,28 +1,27 @@
_realname="msys2-launcher"
pkgname=("${_realname}-git")
pkgver=1.5
pkgver=1.0
pkgrel=1
pkgdesc="Helper for launching MSYS2 shells"
arch=('x86_64' 'i686')
license=('MIT')
backup=({msys2,mingw32,mingw64,ucrt64,clang64}.ini)
backup=({mingw32,mingw64,msys2}.ini)
provides=("${_realname}")
conflicts=("${_realname}")
depends=("mintty>=2.2.1")
makedepends=('mingw-w64-cross-gcc')
source=(launcher.{c,ini,rc} {macros,version}.h Makefile {msys2,mingw32,mingw64,ucrt64,clang64,clangarm64}.ico)
sha256sums=('8e3912d38ba631a525caec2be982b462181125c8767b0b5d7271d13df8ad85be'
'232eaa3de03c5c2cde8106a229b4df768d26f2343ea5df88e22e0e8c088f017e'
'0b118e093f514fdabfabf69dd6148d56a3a282b77add1d53ef31f50635c21d7a'
'ca88f2e77322c0d2a7930b84a981723897eb720131026356f4e14d2be8a35291'
'30b6807a39d8bf0857767daa0dfe0227fd3583c1ee099a496c35a7f9e75dbdac'
'd1e1298433ee116b0a61bfe738aa736422742acd6208f7999fb2ca3dad818578'
'793b9450a1a59a6c294e51fd0c2a47090d68c68ff2f33a25a11b45f6408c3917'
'f8f1b5943d385e8a7e3b5a4a2c7d64004108c94c17b2f936016e2ae50bdb65af'
'91b4a790aad38a102565f0cfcba6c0e6d274f6cda0b37b128d9cc43c5ad6b24d'
'733e97cbb823773e1a08a91a41035a7692bc0ff270d3c894224911b4b091db44'
'56d4080c15dff89a6263f3d5f9aa68849b2062179cabd6d78edfe0e3af6bf64a'
'3b7af99516768485383b34d606749e6f98a250372a8191bc8d3a962d66bdfe35')
source=(launcher.{c,ini,rc} {macros,version}.h Makefile {mingw32,mingw64,msys2,ucrt64,clang64}.ico)
sha512sums=('eac22e62609e06a49931f70b12abaf0f1a412a98bcf349a2b6a0738b511d05ed7ce7731d2e30f9510926c3175d3521d0164e25cd70e9b18ba33aeb887deef11e'
'5ed8a2e9997d9d2c1e17940292d68542f897e2716b274741d8a3ba7c8f46235c175b7e0a1252a879ba3c79b571504d25de2a8d6b004aedd117d263195bc2b185'
'cf257f1f5b7fc69a32c63fe5bf5299db078621850b1e12358654d71da7777a94a0668d657c1834be308db099cad9d48a42fa7877ad58dfdbd576248150913a12'
'6019ca0d67375c1261dda0d54d45fc411b02244c51b71d5c57d2613e9edfb4e8f9000754e5c7d632ed0101005c01cd0a98c3961d5b5f51c94d83eceba4296d35'
'2e2669db2e8ef54ff6859f4e9a2657f867aef89094f29386da6df6a39931b55927bd16f92a5058fb4aecc5705a2bf3a867172740bc53bca560b98820790ad3c9'
'a8f7568ae878481641422a8e9c1d19e84b3d33815f179af179fa9c83ebac9fb5834a939b97b38b5b5c53f9f86753daf06d1e1551019764d3f8305571e6fe32d5'
'a591e978af84a5deec5dfd28e421ba165d8d3d23b5e58a828346edadbdaecf8f6c847862b318af3e04f3fdf8531b3e7344e7f38e757ca208ec175822be132f51'
'88940f62af67685894bfe897fe6a1b8bce439708e18d0c0c1d065c44e8a5e3ce414e65c66c5f572f1ffd6f713d1ab8810a5f7e737ecaa0f5b9ff567a86589c33'
'29a9d80f338eaa6e39e6ed0b8941d579e9483de8db4499ccb4723c1cce4bce03dee07e9fda54a21d39d5de13c979395cfaf43bea91f50fc930dfc30a13dbcae6'
'f1729c410b8027587c8865afa04113a667214761fd82748e896b7b53dfe93186537898edc87d12add9e4be208bfe45333fcb1824655c5c46b1e71ec048d83739'
'2a7925862864ad350f334e84ebe0da2160532b08faa1bd9923bb6848ccc6541054d027ffa6ccfd6861170afd06e126c33fcb0d89d4a08d694ef5ead53ff0dc96')
pkgver() {
local _major=$(cat version.h | grep -F 'VER_MAJOR' | head -1 | sed -e 's/.* //')
@@ -35,5 +34,5 @@ build() {
}
package() {
cp {msys2,mingw32,mingw64,ucrt64,clang64,clangarm64}.{exe,ini} "${pkgdir}"
cp {mingw32,mingw64,ucrt64,clang64,msys2}.{exe,ini} "${pkgdir}"
}

View File

@@ -1,25 +1,23 @@
MSYS2 launcher
==============
A helper for launching MSYS2 shells. Features blink-less launching and correct taskbar/start pinning.
A helper for launching MSYS2 shells. Features blink-less launching and correct taskbar/start pinning.
Installation
------------
Just `make` and put the .exe and .ini files inside your MSYS2 root. Needs mintty v2.1.6 or newer.
Just `make` and put the .exe and .ini files inside your MSYS2 root. Needs mintty v2.1.6 or newer.
Configuration
-------------
All three default launchers are the same (except for embedded icons and descriptions) and are configured by corresponding .ini files. The .ini file has to be in the same directory as the .exe file and have the same filename (except for the `.exe` -> `.ini` change).
All three default launchers are the same (except for embedded icons and descriptions) and are configured by corresponding .ini files. The .ini file has to be in the same directory as the .exe file and have the same filename (except for the `.exe` -> `.ini` change).
The .ini file contains environment variables, each on a separate line, in the usual `VAR=val` format. Lines starting with `#` are ignored. The values are expanded using the current environment (use Windows `%var%` syntax), evaluated from top to bottom. By default, only `MSYSTEM` is set and the rest is inherited from the outside environment, but some common options are prepared and commented out in the files:
By default, only `MSYSTEM` is set, but options for inheriting `PATH` and tweaking `MSYS` are prepared, as well as `CHERE_INVOKING` for the shell to stay in the current working directory (instead of changing to the home directory).
- `MSYS=...`: configures runtime behavior
- `CHERE_INVOKING=1`: prevent the login scripts from changing the working directory to the user's home directory
- `MSYS2_PATH_TYPE=strict|minimal|inherit`: configures how the login scripts set up `PATH`
The .ini file contains environment variables, each on a separate line, in the usual `VAR=val` format. Lines starting with `#` are ignored. The values are expanded using the current environment (use Windows `%var%` syntax).
Pinning
-------
As with many other applications, the correct way to pin a shortcut to the taskbar is by right-clicking the button of a running MSYS2 shell (started by this launcher) on the taskbar and choosing "Pin this program to taskbar". Pinning the `.exe` file itself won't create the shortcut correctly. There are tools to diagnose and fix such a situation (7+ Taskbar Tweaker and Win7AppId) in case re-pinning is not preferred.
As with many other applications, the correct way to pin a shortcut to the taskbar is by right-clicking the button of a running MSYS2 shell (started by this launcher) on the taskbar and choosing "Pin this program to taskbar". Pinning the `.exe` file itself won't create the shortcut correctly. There are tools to diagnose and fix such a situation (7+ Taskbar Tweaker and Win7AppId) in case re-pinning is not preferred.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,4 +1,4 @@
all: ../msys2.ico ../mingw32.ico ../mingw64.ico ../ucrt64.ico ../clang64.ico ../clangarm64.ico
all: ../msys2.ico ../mingw32.ico ../mingw64.ico ../clang64.ico ../ucrt64.ico
sources=icon-large.svg icon-medium.svg icon-small.svg
@@ -11,11 +11,8 @@ sources=icon-large.svg icon-medium.svg icon-small.svg
../mingw64.ico: $(sources)
./build.sh '#276597' $@
../ucrt64.ico: $(sources)
./build.sh '#8b7b16' $@
../clang64.ico: $(sources)
./build.sh '#be643e' $@
../clangarm64.ico: $(sources)
./build.sh '#238423' $@
../ucrt64.ico: $(sources)
./build.sh '#8b7b16' $@

View File

@@ -12,7 +12,6 @@ rsvg-convert temp-small.svg -w 16 -h 16 --output temp-16.png
rsvg-convert temp-small.svg -w 32 -h 32 --output temp-32.png
rsvg-convert temp-medium.svg -w 48 -h 48 --output temp-48.png
rsvg-convert temp-large.svg -w 64 -h 64 --output temp-64.png
rsvg-convert temp-large.svg -w 96 -h 96 --output temp-96.png
rsvg-convert temp-large.svg -w 256 -h 256 --output temp-256.png
convert temp-16.png temp-32.png temp-48.png temp-64.png temp-96.png temp-256.png +dither -colors 255 "$2"
rsvg-convert temp-large.svg -w 128 -h 128 --output temp-128.png
convert temp-16.png temp-32.png temp-48.png temp-64.png temp-128.png +dither -colors 255 "$2"
rm temp-*.png temp-*.svg

View File

@@ -1,4 +1,3 @@
#define __USE_MINGW_ANSI_STDIO 1
#define _UNICODE
#define _WIN32_WINNT 0x0601
#define WIN32_LEAN_AND_MEAN
@@ -18,7 +17,7 @@ int _CRT_glob = 0;
static void ShowError(const wchar_t* desc, const wchar_t* err, const long code) {
wchar_t msg[1024];
swprintf(msg, 1024, L"%ls. Reason: %ls (0x%lx)", desc, err, code);
swprintf(msg, 1024, L"%s. Reason: %s (0x%lx)", desc, err, code);
MessageBox(NULL, msg, L"Launcher error", MB_ICONEXCLAMATION | MB_OK);
}
@@ -39,22 +38,6 @@ static void ShowErrno(const wchar_t* desc) {
ShowError(desc, err, errno);
}
// adapted from http://www.partow.net/programming/hashfunctions/index.html
// MIT licensed
static unsigned int APHash(const wchar_t* str, size_t length) {
unsigned int hash = 0xAAAAAAAA;
size_t i = 0;
for (i = 0; i < length; ++str, ++i) {
hash ^= ((i & 1) == 0)
? ((hash << 7) ^ (*str) * (hash >> 3))
: (~((hash << 11) + ((*str) ^ (hash >> 5))))
;
}
return hash;
}
static PROCESS_INFORMATION StartChild(wchar_t* cmdline) {
STARTUPINFOW si;
PROCESS_INFORMATION pi;
@@ -167,19 +150,22 @@ int wmain(int argc, wchar_t* argv[]) {
wchar_t* tmp;
wchar_t* args;
wchar_t* msystem;
wchar_t* msysdirhash;
wchar_t msysdir[PATH_MAX];
wchar_t exepath[PATH_MAX];
wchar_t confpath[PATH_MAX];
code = GetModuleFileName(NULL, exepath, sizeof(exepath) / sizeof(*exepath));
code = GetModuleFileName(NULL, exepath, sizeof(exepath) / sizeof(exepath[0]));
if (code == 0) {
ShowLastError(L"Could not determine executable path");
return __LINE__;
}
tmp = exepath;
while ((tmp = wcschr(tmp, L'/')) != NULL) {
while (true) {
tmp = wcschr(tmp, L'/');
if (tmp == NULL) {
break;
}
*tmp = L'\\';
}
@@ -191,24 +177,9 @@ int wmain(int argc, wchar_t* argv[]) {
}
*tmp = L'\0';
msysdirhash = (wchar_t*)alloca(10 * sizeof(wchar_t)); // dot + unsigned int as %x + null
if (msysdirhash == NULL) {
ShowError(L"Could not allocate memory", L"", 0);
return __LINE__;
}
if (wcsicmp(msysdir, L"C:\\msys64") == 0) {
code = swprintf(msysdirhash, 10, L""); // no change in AppID for default installations
} else {
code = swprintf(msysdirhash, 10, L".%8x", APHash(msysdir, wcslen(msysdir)));
}
if (code < 0) {
ShowErrno(L"Could not write to buffer");
return __LINE__;
}
wcscpy(confpath, exepath);
tmp = confpath + wcslen(confpath) - 4;
if (wcsicmp(L".exe", tmp) != 0) {
if (0 != wcsicmp(L".exe", tmp)) {
ShowError(L"Could not find configuration file", confpath, 0);
return __LINE__;
}
@@ -235,23 +206,13 @@ int wmain(int argc, wchar_t* argv[]) {
ShowLastError(L"Could not set environment variable");
}
// can break, but hopefully won't for most use cases
args = GetCommandLine();
tmp = argv[0];
while (*tmp != L'\0') {
if (*args == *tmp) {
args++;
tmp++;
} else if (*args == L'"') {
args++;
} else {
ShowError(L"Could not parse command name", argv[0], 0);
return __LINE__;
}
}
while (*args == L'"') {
if (args[0] == L'"') {
args++;
}
while (*args == L' ') {
args += wcslen(argv[0]);
if (args[0] == L'"') {
args++;
}
@@ -264,7 +225,7 @@ int wmain(int argc, wchar_t* argv[]) {
ShowError(L"Could not allocate memory", L"", 0);
return __LINE__;
}
code = swprintf(buf, buflen, L"%ls\\usr\\bin\\mintty.exe -i '%ls' -o 'AppLaunchCmd=%ls' -o 'AppID=MSYS2.Shell.%ls.%d%ls' -o 'AppName=MSYS2 %ls Shell' -t 'MSYS2 %ls Shell' --store-taskbar-properties -- %ls %ls", msysdir, exepath, exepath, msystem, APPID_REVISION, msysdirhash, msystem, msystem, argc == 1 ? L"-" : L"/usr/bin/sh -lc '\"$@\"' sh", args);
code = swprintf(buf, buflen, L"%s\\usr\\bin\\mintty.exe -i '%s' -o 'AppLaunchCmd=%s' -o 'AppID=MSYS2.Shell.%s.%d' -o 'AppName=MSYS2 %s Shell' -t 'MSYS2 %s Shell' --store-taskbar-properties -- %s %s", msysdir, exepath, exepath, msystem, APPID_REVISION, msystem, msystem, argc == 1 ? L"-" : L"/usr/bin/sh -lc '\"$@\"' sh", args);
buflen *= 2;
}
if (code < 0) {

View File

@@ -8,7 +8,7 @@ BEGIN
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "ProductName", "Befator Inc. MSYS2"
VALUE "ProductName", "MSYS2"
VALUE "FileDescription", "MSYS2 " STRINGIFY_A(MSYSTEM) " shell launcher"
VALUE "FileVersion", STRINGIFY_A(VER_MAJOR) "." STRINGIFY_A(VER_MINOR)
END

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 32 KiB

BIN
msys2.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -2,6 +2,6 @@
#define M2L_VERSION_H
#define VER_MAJOR 1
#define VER_MINOR 5
#define VER_MINOR 0
#endif