summaryrefslogtreecommitdiffstats
path: root/pkgs/simple
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-02 02:18:54 +0000
committertv <tv@krebsco.de>2026-12-02 02:18:54 +0000
commitb540a7713c63e551670f1f0f0bc3d3f6d36c9654 (patch)
tree7cf121d2d2a677f7fd75feea97f49cb017ce5709 /pkgs/simple
parent6d895321d2614c4c8fbb88c4b7f61de2495e7831 (diff)
flameshot-once: flameshot 13.3.0, configured by a module
flameshot-once starts flameshot's daemon and its GUI, with flameshot.ini from config.nix's settings, and with imgur, uploads to its createUrl and an xdg-open that opens or deletes them. flameshot gets the history and applauncher patches, too. The buttons option, which was commented out, is left out, and with it the tools that listed the button types for it.
Diffstat (limited to 'pkgs/simple')
-rw-r--r--pkgs/simple/flameshot-once/config.nix515
-rw-r--r--pkgs/simple/flameshot-once/default.nix138
-rw-r--r--pkgs/simple/flameshot-once/flameshot/default.nix10
-rw-r--r--pkgs/simple/flameshot-once/flameshot/flameshot-13.applauncher.patch27
-rw-r--r--pkgs/simple/flameshot-once/flameshot/flameshot-13.history.patch28
-rw-r--r--pkgs/simple/flameshot-once/flameshot/flameshot-13.imgur.patch56
6 files changed, 513 insertions, 261 deletions
diff --git a/pkgs/simple/flameshot-once/config.nix b/pkgs/simple/flameshot-once/config.nix
index 269f13a6..52a8a9f6 100644
--- a/pkgs/simple/flameshot-once/config.nix
+++ b/pkgs/simple/flameshot-once/config.nix
@@ -1,235 +1,324 @@
-{ config, pkgs }:
-with pkgs.stockholm.lib;
-with generators;
-let
+{ config, lib, mylib, pkgs, ... }:
- # Refs https://github.com/lupoDharkael/flameshot/blob/master/src/widgets/capture/capturebutton.h
- ButtonType = {
- PENCIL = 0;
- DRAWER = 1;
- ARROW = 2;
- SELECTION = 3;
- RECTANGLE = 4;
- CIRCLE = 5;
- MARKER = 6;
- SELECTIONINDICATOR = 7;
- MOVESELECTION = 8;
- UNDO = 9;
- COPY = 10;
- SAVE = 11;
- EXIT = 12;
- IMAGEUPLOADER = 13;
- OPEN_APP = 14;
- BLUR = 15;
- REDO = 16;
- PIN = 17;
- TEXT = 18;
- CIRCLECOUNT = 19;
- };
-
- cfg = eval.config;
-
- eval = evalModules {
- modules = singleton {
- _file = toString ./profile.nix;
- imports = singleton config;
- options = {
- buttons = mkOption {
- apply = map (name: ButtonType.${name});
- default = [
- "PENCIL"
- "DRAWER"
- "ARROW"
- "SELECTION"
- "RECTANGLE"
- "CIRCLE"
- "MARKER"
- "SELECTIONINDICATOR"
- "MOVESELECTION"
- "UNDO"
- "SAVE"
- "EXIT"
- "BLUR"
- "CIRCLECOUNT"
- ]
- ++ optional cfg.imgur.enable "IMAGEUPLOADER"
- ;
- type = types.listOf (types.enum (attrNames ButtonType));
+{
+ options = {
+ imgur = lib.mkOption {
+ default = {};
+ type = lib.types.submodule {
+ options = {
+ enable = lib.mkEnableOption "imgur";
+ createUrl = lib.mkOption {
+ example = "http://p.r/image";
+ type = lib.types.str;
+ };
+ deleteUrl = lib.mkOption {
+ example = "http://p.r/image/delete/%1";
+ type = lib.types.str;
+ };
+ xdg-open = lib.mkOption {
+ default = {};
+ type = lib.types.submodule {
+ options = {
+ enable = lib.mkEnableOption "imgur.xdg-open" // {
+ default = true;
+ };
+ browser = lib.mkOption {
+ default = "${pkgs.coreutils}/bin/false";
+ type = lib.types.str;
+ };
+ createPrefix = lib.mkOption {
+ default = config.imgur.createUrl;
+ type = lib.types.str;
+ };
+ deletePrefix = lib.mkOption {
+ default = lib.removeSuffix "/%1" config.imgur.deleteUrl;
+ type = lib.types.str;
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ package = lib.mkOption {
+ type = lib.types.package;
+ default = import ./flameshot pkgs pkgs;
+ };
+ settings = {
+ # Options without a description are not documented in flameshot's README.
+ # Compare with:
+ # nix-shell -p flameshot-once.dev --run get-recognizedGeneralOptions
+ General = lib.mapAttrs (_: lib.recursiveUpdate { default = null; }) {
+ allowMultipleGuiInstances = lib.mkOption {
+ description = ''
+ Allow multiple instances of `flameshot gui` to run at the same time
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ antialiasingPinZoom = lib.mkOption {
+ description = ''
+ Anti-aliasing image when zoom the pinned image
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ autoCloseIdleDaemon = lib.mkOption {
+ description = ''
+ Automatically close daemon when it's not needed
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ checkForUpdates = lib.mkOption {
+ type = lib.types.nullOr lib.types.bool;
+ };
+ contrastOpacity = lib.mkOption {
+ description = ''
+ Opacity of area outside selection
+ '';
+ type = lib.types.nullOr (mylib.types.boundedInt 0 255);
};
- copyAndCloseAfterUpload = mkOption {
- default = false;
- type = types.bool;
+ contrastUiColor = lib.mkOption {
+ description = ''
+ Contrast UI color
+ '';
+ type = lib.types.nullOr mylib.types.flameshot.color;
+ };
+ copyAndCloseAfterUpload = lib.mkOption {
+ type = lib.types.nullOr lib.types.bool;
+ };
+ copyOnDoubleClick = lib.mkOption {
+ type = lib.types.nullOr lib.types.bool;
+ };
+ copyPathAfterSave = lib.mkOption {
+ description = ''
+ Copy path to image after save
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ copyURLAfterUpload = lib.mkOption {
+ description = ''
+ On successful upload, close the dialog and copy URL to clipboard
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ disabledTrayIcon = lib.mkOption {
+ description = ''
+ Whether the tray icon is disabled
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ drawColor = lib.mkOption {
+ description = ''
+ Last used color
+ '';
+ type = lib.types.nullOr mylib.types.flameshot.color;
};
- disabledTrayIcon = mkOption {
- default = true;
- type = types.bool;
+ drawFontSize = lib.mkOption {
+ type = lib.types.nullOr mylib.types.positive;
};
- drawColor = mkOption {
- default = "#ff0000";
+ drawThickness = lib.mkOption {
+ description = ''
+ Last used tool thickness
+ '';
+ type = lib.types.nullOr mylib.types.positive;
+ };
+ filenamePattern = lib.mkOption {
+ description = ''
+ Filename pattern using C++ strftime formatting
+ '';
type =
- types.addCheck types.str (test "#[0-9A-Fa-f]{6}");
+ lib.types.nullOr
+ # This is types.filename extended by [%:][%:+]*
+ (lib.types.addCheck
+ lib.types.str
+ (mylib.test "[%:0-9A-Za-z._][%:+0-9A-Za-z._-]*"));
+ };
+ fontFamily = lib.mkOption {
+ type = lib.types.nullOr lib.types.str;
+ };
+ historyConfirmationToDelete = lib.mkOption {
+ type = lib.types.nullOr lib.types.bool;
+ };
+ ignoreUpdateToVersion = lib.mkOption {
+ description = ''
+ Ignore updates to versions less than this value
+ '';
+ type = lib.types.nullOr lib.types.str;
+ };
+ keepOpenAppLauncher = lib.mkOption {
+ description = ''
+ Keep the App Launcher open after selecting an app
+ '';
+ type = lib.types.nullOr lib.types.bool;
};
- drawThickness = mkOption {
- default = 8;
- type = types.positive;
+ predefinedColorPaletteLarge = lib.mkOption {
+ description = ''
+ Use larger color palette as the default one
+ '';
+ type = lib.types.nullOr lib.types.bool;
};
- filenamePattern = mkOption {
- default = "%FT%T%z_flameshot";
+ saveAfterCopy = lib.mkOption {
+ description = ''
+ Save image after copy
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ saveAsFileExtension = lib.mkOption {
+ description = ''
+ Default file extension for screenshots
+ '';
type =
- # This is types.filename extended by [%:][%:+]*
- types.addCheck types.str (test "[%:0-9A-Za-z._][%:+0-9A-Za-z._-]*");
+ lib.types.nullOr
+ (lib.types.addCheck
+ mylib.types.filename
+ (lib.hasPrefix "."));
};
- imgur = mkOption {
- default = {};
- type = types.submodule {
- options = {
- enable = mkEnableOption "imgur";
- createUrl = mkOption {
- example = "http://p.r/image";
- type = types.str;
- };
- deleteUrl = mkOption {
- example = "http://p.r/image/delete/%1";
- type = types.str;
- };
- xdg-open = mkOption {
- default = {};
- type = types.submodule {
- options = {
- enable = mkEnableOption "imgur.xdg-open" // {
- default = true;
- };
- browser = mkOption {
- default = "${pkgs.coreutils}/bin/false";
- type = types.str;
- };
- createPrefix = mkOption {
- default = cfg.imgur.createUrl;
- type = types.str;
- };
- deletePrefix = mkOption {
- default = removeSuffix "/%1" cfg.imgur.deleteUrl;
- type = types.str;
- };
- };
- };
- };
- };
- };
+ safeLastRegion = lib.mkOption {
+ type = lib.types.nullOr lib.types.bool;
};
- savePath = mkOption {
- default = "/tmp";
- type = types.absolute-pathname;
+ savePath = lib.mkOption {
+ description = ''
+ Image Save Path
+ '';
+ type = lib.types.nullOr mylib.types.absolute-pathname;
+ };
+ savePathFixed = lib.mkOption {
+ description = ''
+ Whether the savePath is a fixed path
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ showDesktopNotification = lib.mkOption {
+ description = ''
+ Show desktop notifications
+ '';
+ type = lib.types.nullOr lib.types.bool;
};
- showDesktopNotification = mkOption {
- default = false;
- type = types.bool;
+ showHelp = lib.mkOption {
+ description = ''
+ Show the help screen on startup
+ '';
+ type = lib.types.nullOr lib.types.bool;
};
- showHelp = mkOption {
- default = false;
- type = types.bool;
+ showMagnifier = lib.mkOption {
+ type = lib.types.nullOr lib.types.bool;
};
- showSidePanelButton = mkOption {
- default = false;
- type = types.bool;
+ showSelectionGeometry = lib.mkOption {
+ type = lib.types.nullOr (mylib.types.boundedInt 0 5);
};
- showStartupLaunchMessage = mkOption {
- default = false;
- type = types.bool;
+ showSelectionGeometryHideTime = lib.mkOption {
+ type = lib.types.nullOr mylib.types.uint;
};
- timeout = mkOption {
- default = 200;
+ showSidePanelButton = lib.mkOption {
description = ''
- Maximum time in milliseconds allowed for the flameshot daemon to
- react.
+ Show the side panel button
'';
- type = types.positive;
+ type = lib.types.nullOr lib.types.bool;
};
- };
- };
- };
-
- hexchars = stringToCharacters "0123456789abcdef";
-
- # Encode integer to C-escaped string of bytes, little endian / LSB 0
- le = rec {
- x1 = i: let
- i0 = mod i 16;
- i1 = i / 16;
- in
- "\\x${elemAt hexchars i1}${elemAt hexchars i0}";
-
- x2 = i: let
- i0 = mod i 256;
- i1 = i / 256;
- in
- "${x1 i0}${x1 i1}";
-
- x4 = i: let
- i0 = mod i 65536;
- i1 = i / 65536;
- in
- "${x2 i0}${x2 i1}";
- };
-
- toQList = t: xs:
- assert t == "int";
- "QList<${t}>${le.x4 0}${le.x4 (length xs)}${concatMapStrings le.x4 xs}";
-
- XDG_CONFIG_HOME = pkgs.write "flameshot-config" {
- "/flameshot/flameshot.ini".text =
- toINI {} {
- General = {
- buttons = ''@Variant(\0\0\0\x7f\0\0\0\v${toQList "int" cfg.buttons})'';
- disabledTrayIcon = cfg.disabledTrayIcon;
- checkForUpdates = false;
- copyAndCloseAfterUpload = cfg.copyAndCloseAfterUpload;
- drawColor = cfg.drawColor;
- drawThickness = cfg.drawThickness;
- filenamePattern = cfg.filenamePattern;
- savePath = cfg.savePath;
- showDesktopNotification = cfg.showDesktopNotification;
- showHelp = cfg.showHelp;
- showSidePanelButton = cfg.showSidePanelButton;
- showStartupLaunchMessage = cfg.showStartupLaunchMessage;
- startupLaunch = false;
+ showStartupLaunchMessage = lib.mkOption {
+ type = lib.types.nullOr lib.types.bool;
+ };
+ squareMagnifier = lib.mkOption {
+ type = lib.types.nullOr lib.types.bool;
+ };
+ startupLaunch = lib.mkOption {
+ description = ''
+ Launch at startup
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ uiColor = lib.mkOption {
+ description = ''
+ Main UI color
+ '';
+ type = lib.types.nullOr mylib.types.flameshot.color;
+ };
+ undoLimit = lib.mkOption {
+ type = lib.types.nullOr (mylib.types.boundedInt 0 999);
};
- Shortcuts = {
- TYPE_COPY = "Return";
+ uploadClientSecret = lib.mkOption {
+ type = lib.types.nullOr lib.types.str;
+ };
+ uploadHistoryMax = lib.mkOption {
+ type = lib.types.nullOr mylib.types.uint;
+ };
+ uploadWithoutConfirmation = lib.mkOption {
+ description = ''
+ Upload to imgur without confirmation
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ useJpgForClipboard = lib.mkOption {
+ description = ''
+ Use JPG format instead of PNG
+ '';
+ type = lib.types.nullOr lib.types.bool;
+ };
+ userColors = lib.mkOption {
+ apply = value:
+ if value != null then
+ lib.concatStringsSep ", " value
+ else
+ null;
+ description = ''
+ List of colors for color picker
+ The colors are arranged counter-clockwise with the first being set
+ to the right of the cursor. "picker" adds a custom color picker.
+ '';
+ type =
+ lib.types.nullOr
+ (lib.types.listOf
+ (lib.types.either
+ mylib.types.flameshot.color
+ (lib.types.enum ["picker"])));
};
};
+ Shortcuts = lib.genAttrs [
+ # Generated with:
+ # nix-shell -p flameshot-once.dev --run get-Shortcuts
+ "TYPE_ACCEPT"
+ "TYPE_ARROW"
+ "TYPE_CIRCLE"
+ "TYPE_CIRCLECOUNT"
+ "TYPE_COMMIT_CURRENT_TOOL"
+ "TYPE_COPY"
+ "TYPE_DELETE_CURRENT_TOOL"
+ "TYPE_DRAWER"
+ "TYPE_EXIT"
+ "TYPE_IMAGEUPLOADER"
+ "TYPE_INVERT"
+ "TYPE_MARKER"
+ "TYPE_MOVESELECTION"
+ "TYPE_MOVE_DOWN"
+ "TYPE_MOVE_LEFT"
+ "TYPE_MOVE_RIGHT"
+ "TYPE_MOVE_UP"
+ "TYPE_OPEN_APP"
+ "TYPE_PENCIL"
+ "TYPE_PIN"
+ "TYPE_PIXELATE"
+ "TYPE_RECTANGLE"
+ "TYPE_REDO"
+ "TYPE_RESIZE_DOWN"
+ "TYPE_RESIZE_LEFT"
+ "TYPE_RESIZE_RIGHT"
+ "TYPE_RESIZE_UP"
+ "TYPE_SAVE"
+ "TYPE_SELECTION"
+ "TYPE_SELECTIONINDICATOR"
+ "TYPE_SELECT_ALL"
+ "TYPE_SIZEDECREASE"
+ "TYPE_SIZEINCREASE"
+ "TYPE_SYM_RESIZE_DOWN"
+ "TYPE_SYM_RESIZE_LEFT"
+ "TYPE_SYM_RESIZE_RIGHT"
+ "TYPE_SYM_RESIZE_UP"
+ "TYPE_TEXT"
+ "TYPE_TOGGLE_PANEL"
+ "TYPE_UNDO"
+ ] (name: lib.mkOption {
+ default = null;
+ type = lib.types.nullOr lib.types.str;
+ });
+ };
};
-
-in
-
- pkgs.writeDash "flameshot.profile" ''
- export FLAMESHOT_CAPTURE_PATH=${cfg.savePath}
- export FLAMESHOT_ONCE_TIMEOUT=${toString cfg.timeout}
- export XDG_CONFIG_HOME=${XDG_CONFIG_HOME}
- ${optionalString cfg.imgur.enable /* sh */ ''
- export IMGUR_CREATE_URL=${shell.escape cfg.imgur.createUrl}
- export IMGUR_DELETE_URL=${shell.escape cfg.imgur.deleteUrl}
- ${optionalString cfg.imgur.xdg-open.enable /* sh */ ''
- PATH=$PATH:${makeBinPath [
- (pkgs.writeDashBin "xdg-open" ''
- set -efu
- uri=$1
- prefix=$(${pkgs.coreutils}/bin/dirname "$uri")
- case $prefix in
- (${shell.escape cfg.imgur.xdg-open.createPrefix})
- echo "opening image in browser: $uri" >&2
- exec ${config.imgur.xdg-open.browser} "$uri"
- ;;
- (${shell.escape cfg.imgur.xdg-open.deletePrefix})
- echo "deleting image: $uri" >&2
- exec ${pkgs.curl}/bin/curl -fsS -X DELETE "$uri"
- ;;
- (*)
- echo "don't know how to open URI: $uri" >&2
- exit 1
- esac
- '')
- ]}
- ''}
- ''}
- ''
+}
diff --git a/pkgs/simple/flameshot-once/default.nix b/pkgs/simple/flameshot-once/default.nix
index 0524c2cf..20a69c74 100644
--- a/pkgs/simple/flameshot-once/default.nix
+++ b/pkgs/simple/flameshot-once/default.nix
@@ -1,28 +1,126 @@
-{ pkgs, stockholm, ... }@args:
-with stockholm.lib;
+{ name ? "flameshot-once", lib, mylib, pkgs, ... }@args:
let
+
# config cannot be declared in the input attribute set because that would
# cause callPackage to inject the wrong config. Instead, get it from ...
# via args.
config = args.config or {};
+
+ cfg = (lib.evalModules {
+ specialArgs = {
+ inherit mylib;
+ };
+ modules = lib.singleton {
+ _file = toString ./default.nix;
+ _module.args.pkgs = pkgs;
+ imports = [
+ config
+ ./config.nix
+ ];
+ };
+ }).config;
in
- pkgs.symlinkJoin {
- name = "flameshot-once-wrapper";
- paths = [
- (pkgs.writeDashBin "flameshot-once" ''
- export PATH=${makeBinPath [
- pkgs.flameshot
- pkgs.qt5.qtbase
- pkgs.xclip
- pkgs.xwaitforwindow
- ]}
- ${optionalString (config != null) /* sh */ ''
- . ${import ./profile.nix { inherit config pkgs; }}
- ''}
- exec ${pkgs.haskellPackages.flameshot-once}/bin/flameshot-once "$@"
- '')
- pkgs.haskellPackages.flameshot-once
- ];
- }
+pkgs.symlinkJoin {
+ inherit name;
+ paths = [
+ (pkgs.write "flameshot-once" {
+ "/bin/flameshot-once" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ export PATH=${lib.makeBinPath [
+ pkgs.qt5.qtbase
+ ]}:''${PATH+:$PATH}
+ ${lib.optionalString (config != null) /* sh */ ''
+ export XDG_CONFIG_HOME=${placeholder "out"}/etc
+ ${lib.optionalString cfg.imgur.enable /* sh */ ''
+ export IMGUR_CREATE_URL=${mylib.shell.escape cfg.imgur.createUrl}
+ export IMGUR_DELETE_URL=${mylib.shell.escape cfg.imgur.deleteUrl}
+ ${lib.optionalString cfg.imgur.xdg-open.enable /* sh */ ''
+ export PATH=${placeholder "out"}/lib/imgur/bin''${PATH+:$PATH}
+ ''}
+ ''}
+ ''}
+ ${cfg.package}/bin/flameshot &
+ exec ${cfg.package}/bin/flameshot gui
+ '';
+ };
+ "/etc/flameshot/flameshot.ini".text =
+ lib.generators.toINI {} (mylib.stripAttr cfg.settings);
+ ${if cfg.imgur.enable then "/lib/imgur/bin/xdg-open" else null} = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ set -efu
+ uri=$1
+ prefix=$(${pkgs.coreutils}/bin/dirname "$uri")
+ case $prefix in
+ (${mylib.shell.escape cfg.imgur.xdg-open.createPrefix})
+ echo "opening image in browser: $uri" >&2
+ exec ${config.imgur.xdg-open.browser} "$uri"
+ ;;
+ (${mylib.shell.escape cfg.imgur.xdg-open.deletePrefix})
+ echo "deleting image: $uri" >&2
+ exec ${pkgs.curl}/bin/curl -fsS -X DELETE "$uri"
+ ;;
+ (*)
+ echo "don't know how to open URI: $uri" >&2
+ exit 1
+ esac
+ '';
+ };
+ })
+ ];
+}
+// {
+ dev = pkgs.write "flameshot-once-tools" {
+ "/bin/get-recognizedGeneralOptions" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ src=${cfg.package.src}/src/utils/confighandler.cpp
+ ${pkgs.coreutils}/bin/cat "$src" |
+ ${pkgs.gnused}/bin/sed -n '/\<recognizedGeneralOptions = {/,/^};/p' |
+ ${pkgs.gcc}/bin/cpp |
+ ${pkgs.gnugrep}/bin/grep -F OPTION |
+ ${pkgs.coreutils}/bin/sort
+ '';
+ };
+ "/bin/get-Shortcuts" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ indent=$(${placeholder "out"}/bin/indent-of Shortcuts)
+ src=${cfg.package.src}/src/utils/confighandler.cpp
+ ${pkgs.coreutils}/bin/cat "$src" |
+ ${pkgs.gnused}/bin/sed -n '/recognizedShortcuts = {/,/^};/p ' |
+ ${pkgs.gcc}/bin/cpp |
+ ${pkgs.gnused}/bin/sed -nr 's/^\s*SHORTCUT\("(TYPE_[^"]+).*/"\1"/p' |
+ ${pkgs.coreutils}/bin/sort |
+ ${placeholder "out"}/bin/prefix " $indent"
+ '';
+ };
+ "/bin/indent-of" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ # usage: indent-of NAME NIX_FILE
+ exec ${pkgs.gawk}/bin/awk -v name="$1" '
+ $1 == name && $2 == "=" {
+ sub("[^ ].*", "")
+ print
+ }
+ ' ${./config.nix}
+ '';
+ };
+ "/bin/prefix" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ ${pkgs.gawk}/bin/awk -v prefix="$1" '{ print prefix $0 }'
+ '';
+ };
+ };
+}
diff --git a/pkgs/simple/flameshot-once/flameshot/default.nix b/pkgs/simple/flameshot-once/flameshot/default.nix
index 10154cc4..7b9ccbf0 100644
--- a/pkgs/simple/flameshot-once/flameshot/default.nix
+++ b/pkgs/simple/flameshot-once/flameshot/default.nix
@@ -2,14 +2,16 @@ self: super:
super.flameshot.overrideAttrs (old: rec {
name = "flameshot-${version}";
- version = "0.10.2";
+ version = builtins.head (builtins.match "tags/v(.*)" src.rev);
src = self.fetchFromGitHub {
owner = "flameshot-org";
repo = "flameshot";
- rev = "v${version}";
- sha256 = "sha256-rZUiaS32C77tFJmEkw/9MGbVTVscb6LOCyWaWO5FyR4=";
+ rev = "tags/v13.3.0";
+ hash = "sha256-RyoLniRmJRinLUwgmaA4RprYAVHnoPxCP9LyhHfUPe0=";
};
patches = old.patches or [] ++ [
- ./flameshot_imgur_0.10.2.patch
+ ./flameshot-13.imgur.patch
+ ./flameshot-13.history.patch
+ ./flameshot-13.applauncher.patch
];
})
diff --git a/pkgs/simple/flameshot-once/flameshot/flameshot-13.applauncher.patch b/pkgs/simple/flameshot-once/flameshot/flameshot-13.applauncher.patch
new file mode 100644
index 00000000..c43096dd
--- /dev/null
+++ b/pkgs/simple/flameshot-once/flameshot/flameshot-13.applauncher.patch
@@ -0,0 +1,27 @@
+diff --git a/src/tools/launcher/applauncherwidget.cpp b/src/tools/launcher/applauncherwidget.cpp
+index 4ec68f29..3a0fa9ad 100644
+--- a/src/tools/launcher/applauncherwidget.cpp
++++ b/src/tools/launcher/applauncherwidget.cpp
+@@ -22,6 +22,7 @@
+ #include <QStandardPaths>
+ #include <QTabWidget>
+ #include <QTemporaryFile>
++#include <stdlib.h>
+
+ namespace {
+ #if defined(Q_OS_WIN)
+@@ -72,6 +73,14 @@ AppLauncherWidget::AppLauncherWidget(const QPixmap& p, QWidget* parent)
+ m_parser.processDirectory(QDir(appsDir));
+ }
+
++ const char *USER = secure_getenv("USER");
++ QString dirUser = "/etc/profiles/per-user/" + QString::fromUtf8(USER) + "/share/applications/";
++ QDir appsDirUser(dirUser);
++ m_parser.processDirectory(appsDirUser);
++
++ QString dir = QStringLiteral("/run/current-system/sw/share/applications/");
++ QDir appsDir(dir);
++ m_parser.processDirectory(appsDir);
+ #endif
+
+ initAppMap();
diff --git a/pkgs/simple/flameshot-once/flameshot/flameshot-13.history.patch b/pkgs/simple/flameshot-once/flameshot/flameshot-13.history.patch
new file mode 100644
index 00000000..3626f5c7
--- /dev/null
+++ b/pkgs/simple/flameshot-once/flameshot/flameshot-13.history.patch
@@ -0,0 +1,28 @@
+diff --git a/src/utils/history.cpp b/src/utils/history.cpp
+index 877e6195..7e46f168 100644
+--- a/src/utils/history.cpp
++++ b/src/utils/history.cpp
+@@ -76,9 +76,9 @@ const HistoryFileName& History::unpackFileName(const QString& fileNamePacked)
+ int nPathIndex = fileNamePacked.lastIndexOf("/");
+ QStringList unpackedFileName;
+ if (nPathIndex == -1) {
+- unpackedFileName = fileNamePacked.split("-");
++ unpackedFileName = fileNamePacked.split("|");
+ } else {
+- unpackedFileName = fileNamePacked.mid(nPathIndex + 1).split("-");
++ unpackedFileName = fileNamePacked.mid(nPathIndex + 1).split("|");
+ }
+
+ switch (unpackedFileName.length()) {
+@@ -109,9 +109,9 @@ const QString& History::packFileName(const QString& storageType,
+ if (storageType.length() > 0) {
+ if (deleteToken.length() > 0) {
+ m_packedFileName =
+- storageType + "-" + deleteToken + "-" + m_packedFileName;
++ storageType + "|" + deleteToken + "|" + m_packedFileName;
+ } else {
+- m_packedFileName = storageType + "-" + m_packedFileName;
++ m_packedFileName = storageType + "|" + m_packedFileName;
+ }
+ }
+ return m_packedFileName;
diff --git a/pkgs/simple/flameshot-once/flameshot/flameshot-13.imgur.patch b/pkgs/simple/flameshot-once/flameshot/flameshot-13.imgur.patch
index c4c0bf38..bc9537c1 100644
--- a/pkgs/simple/flameshot-once/flameshot/flameshot-13.imgur.patch
+++ b/pkgs/simple/flameshot-once/flameshot/flameshot-13.imgur.patch
@@ -1,35 +1,43 @@
---- a/src/tools/imgur/imguruploader.cpp
-+++ b/src/tools/imgur/imguruploader.cpp
-@@ -31,6 +31,7 @@
- #include <QTimer>
+diff --git a/src/tools/imgupload/storages/imgur/imguruploader.cpp b/src/tools/imgupload/storages/imgur/imguruploader.cpp
+index 1021dc6b..909c5633 100644
+--- a/src/tools/imgupload/storages/imgur/imguruploader.cpp
++++ b/src/tools/imgupload/storages/imgur/imguruploader.cpp
+@@ -17,6 +17,7 @@
+ #include <QNetworkRequest>
+ #include <QShortcut>
#include <QUrlQuery>
- #include <QVBoxLayout>
+#include <stdlib.h>
ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent)
- : QWidget(parent)
-@@ -79,8 +80,11 @@ void ImgurUploader::handleReply(QNetworkReply* reply)
- m_imageURL.setUrl(data[QStringLiteral("link")].toString());
-
- auto deleteToken = data[QStringLiteral("deletehash")].toString();
-+ char *deleteImageURLPattern = secure_getenv("IMGUR_DELETE_URL");
-+ if (deleteImageURLPattern == NULL)
-+ deleteImageURLPattern = "https://imgur.com/delete/%1";
- m_deleteImageURL.setUrl(
-- QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken));
-+ QString::fromUtf8(deleteImageURLPattern).arg(deleteToken));
-
- // save history
- QString imageName = m_imageURL.toString();
-@@ -133,7 +137,10 @@ void ImgurUploader::upload()
+ : ImgUploaderBase(capture, parent)
+@@ -84,7 +85,13 @@ void ImgurUploader::upload()
QString description = FileNameHandler().parsedPattern();
urlQuery.addQueryItem(QStringLiteral("description"), description);
- QUrl url(QStringLiteral("https://api.imgur.com/3/image"));
-+ char *createImageURLPattern = secure_getenv("IMGUR_CREATE_URL");
-+ if (createImageURLPattern == NULL)
-+ createImageURLPattern = "https://api.imgur.com/3/image";
-+ QUrl url(QString::fromUtf8(createImageURLPattern));
++ const char *IMGUR_CREATE_URL = secure_getenv("IMGUR_CREATE_URL");
++ QString createUrlPattern =
++ IMGUR_CREATE_URL != NULL
++ ? QString::fromUtf8(IMGUR_CREATE_URL)
++ : QStringLiteral("https://api.imgur.com/3/image")
++ ;
++ QUrl url(createUrlPattern);
url.setQuery(urlQuery);
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHeader,
+@@ -101,8 +108,14 @@ void ImgurUploader::deleteImage(const QString& fileName,
+ const QString& deleteToken)
+ {
+ Q_UNUSED(fileName)
++ const char *IMGUR_DELETE_URL = secure_getenv("IMGUR_DELETE_URL");
++ QString deleteImageURLPattern =
++ IMGUR_DELETE_URL != NULL
++ ? QString::fromUtf8(IMGUR_DELETE_URL)
++ : QStringLiteral("https://imgur.com/delete/%1")
++ ;
+ bool successful = QDesktopServices::openUrl(
+- QUrl(QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken)));
++ QUrl(deleteImageURLPattern.arg(deleteToken)));
+ if (!successful) {
+ notification()->showMessage(tr("Unable to open the URL."));
+ }