Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X scheme handler and overwrite confirmation #8

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9b7e762
Add vscode and clang-format based on linux kernel
magnus-ISU Dec 29, 2021
0b000ad
More formatting
magnus-ISU Dec 29, 2021
e175334
The GPL2 included was modified from the original license text. This s…
magnus-ISU Dec 29, 2021
4f1efa3
Add build information
magnus-ISU Dec 29, 2021
2c2b23b
Change name from a generic 'widget' to a more descriptive 'selectdefa…
magnus-ISU Dec 29, 2021
037f717
Don't waste CPU and IO reading desktop files after we finish with the…
magnus-ISU Dec 29, 2021
81fdc14
Add some things I'm unsure about
magnus-ISU Dec 30, 2021
e873d4a
Comment out more useless crap
magnus-ISU Dec 30, 2021
17dc8bd
Add comments
magnus-ISU Dec 30, 2021
958dc11
This is negative quality code
magnus-ISU Dec 30, 2021
059b881
Go through another function adding comments, find a bug
magnus-ISU Dec 30, 2021
a23ea7e
Make documentation of plan correct
magnus-ISU Dec 30, 2021
2407075
Changing everything...
magnus-ISU Dec 30, 2021
59e6595
Big rewrite compiles, probably doesn't work
magnus-ISU Dec 30, 2021
e761382
Remove more dead code
magnus-ISU Dec 30, 2021
85bcd9c
Fix the bug where existing associations are deleted if we set a diffe…
magnus-ISU Dec 30, 2021
debcb89
Track down why some output messages were being spammed, document why
magnus-ISU Dec 30, 2021
5a99813
Remove all the crufty comments I had lying around in case I broke som…
magnus-ISU Dec 30, 2021
9e4b869
Get ready to add more functionality in header
magnus-ISU Dec 30, 2021
eb01bf1
Add mimegroups to mimegroups set
magnus-ISU Dec 30, 2021
13b96af
Working towards a much better gGUI
magnus-ISU Dec 30, 2021
3c02a14
SORTING!!!
magnus-ISU Dec 30, 2021
8673b4f
Cleanup a bit
magnus-ISU Dec 30, 2021
11bc8e7
Add help
magnus-ISU Dec 30, 2021
f073fe4
Close to mimegroup filtering
magnus-ISU Dec 30, 2021
9d44081
Very sad Qt6 solution
magnus-ISU Dec 30, 2021
6b21d59
Correct sorting based on actions
magnus-ISU Dec 30, 2021
bc9c2b8
Almost done making it responsive but there is a bug
magnus-ISU Dec 30, 2021
fb71c89
UI real nice
magnus-ISU Dec 30, 2021
7fc2d67
Fix a bad bugg where duplicate entries can get put into mimeapps.list
magnus-ISU Dec 30, 2021
24aff1a
Command line options, set version number to 2.0, and added Verbose flag
magnus-ISU Dec 30, 2021
b888f37
format code
magnus-ISU Dec 30, 2021
d4ca093
Merge pull request #1 from magnus-ISU/change-everything
magnus-ISU Dec 30, 2021
5dde7b9
Fix up help a little bit
magnus-ISU Dec 30, 2021
ce7c34c
Merge branch 'master' of github.com:magnus-ISU/selectdefaultapplication
magnus-ISU Dec 30, 2021
617800e
Get started fixing x-scheme-handler issues
magnus-ISU Dec 31, 2021
fc413ff
Allow parsing of x-scheme-handler and remove useless re-validation of…
magnus-ISU Dec 31, 2021
78641dc
Fix Data to Name
magnus-ISU Dec 31, 2021
680bed4
Allow reading of x-scheme-handler full support
magnus-ISU Dec 31, 2021
d5bbf10
Make labels less verbose, drastically increasing the length of a prog…
magnus-ISU Jan 3, 2022
38eedb2
Merge branch 'change-everything' into x-scheme-handler
magnus-ISU Jan 3, 2022
c7bf8b6
Fix a bug where child mimetypes wouldn't display
magnus-ISU Jan 3, 2022
c1b38f0
Merge branch 'change-everything' into x-scheme-handler
magnus-ISU Jan 3, 2022
8380c43
Working towards warnings for overwritse
magnus-ISU Jan 3, 2022
4d903a7
Finished
magnus-ISU Jan 3, 2022
14b037a
Remove debug prints
magnus-ISU Jan 3, 2022
54ef9cb
Merge warn-overwrite into master
magnus-ISU Jan 3, 2022
62114bb
Fix bug where it wouldn't display description of mimetypes
magnus-ISU Jan 3, 2022
fd5ce7a
Merge x-scheme-handler to master
magnus-ISU Jan 3, 2022
4e8501d
Fix a problem I re-introduced from merge with x-scheme-handler
magnus-ISU Jan 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
562 changes: 562 additions & 0 deletions .clang-format

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.qmake.stash
Makefile
moc_*
*.o
selectdefaultapplication
29 changes: 29 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/qt6/QtCore",
"/usr/include/qt6",
"/usr/include/qt6/QtWidgets",
"/usr/include/qt6/QtGui"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++20",
"intelliSenseMode": "linux-clang-x64",
"compilerArgs": [],
"mergeConfigurations": false,
"browse": {
"path": [
"${workspaceFolder}/**",
"/usr/include/qt6/QtCore"
],
"limitSymbolsToIncludedHeaders": true
}
}
],
"version": 4
}
39 changes: 19 additions & 20 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Steet, Fifth Floor, Boston, MA 02111-1307 USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble
Preamble

The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Expand All @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.

When we speak of free software, we are referring to freedom, not
Expand Down Expand Up @@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE

GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains
Expand Down Expand Up @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
Expand Down Expand Up @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
Expand Down Expand Up @@ -225,7 +225,7 @@ impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
Expand Down Expand Up @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

NO WARRANTY
NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
Expand All @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
Expand All @@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02111-1307 USA

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Also add information on how to contact you by electronic and paper mail.

Expand Down Expand Up @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
Select Default Application
==========================
# Select Default Application

A very simple application that lets you define default applications on Linux in a sane way.

![screenshot](/screenshot.png)


How it works
------------
## How it works

Basically it just loads all installed applications by reading their .desktop
files, reads the MimeType fields to see what it supports, and updates
~/.config/mimeapps.list with what the user wants.

## Links

- https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html
- https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
- https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html

Links
-----
## Building

* https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html
* https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
* https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html
Just run

```
qmake
make
```
28 changes: 23 additions & 5 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
#include "widget.h"
#include "selectdefaultapplication.h"
#include <QApplication>
#include <QCommandLineParser>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

return a.exec();
QApplication a(argc, argv);
a.setApplicationVersion("2.0");
a.setApplicationDisplayName("Select Default Application");

QCommandLineParser parser;
parser.setApplicationDescription(
"A very simple application that lets you define default applications on Linux in a sane way.");
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption verbose(QStringList() << "V"
<< "verbose",
"Print verbose information about how the desktop files are parsed");

parser.addOption(verbose);
parser.process(a);

SelectDefaultApplication w(nullptr, parser.isSet(verbose));
w.show();

return a.exec();
}
Loading