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

Winget Installation Does Not Support Machine Scope for Xournal++ #5983

Open
Lonniebiz opened this issue Oct 25, 2024 · 3 comments
Open

Winget Installation Does Not Support Machine Scope for Xournal++ #5983

Lonniebiz opened this issue Oct 25, 2024 · 3 comments
Labels
bug os::windows Operating System Microsoft Windows packaging Related to distribution and packaging of Xournal++

Comments

@Lonniebiz
Copy link

Lonniebiz commented Oct 25, 2024

Operating System

Windows 10

Installation Method

winget

Xournal++ Version

1.2.4

libgtk Version

3.24.43

Bug Description

I encountered an issue when trying to deploy Xournal++ across multiple workstations using winget. The problem is that Xournal++ cannot be installed using the --scope machine option in winget, which causes difficulties when deploying it in an enterprise environment where the software needs to be accessible to all users on a workstation. Attempting the command:

winget install Xournal++.Xournal++ --scope machine --source winget

results in an installation failure with an error code (e.g., 3221225477). As a result, the installation only works for the currently logged-in user, and not system-wide.

Expected Behaviour

When running the command:

winget install Xournal++.Xournal++ --scope machine --source winget

I expect Xournal++ to be installed system-wide, making it available for all users on the workstation. The software should be located in the C:\Program Files directory, and shortcuts should be automatically created in the Start Menu for all users, just as other applications installed via winget behave when using the --scope machine option.

Steps to Reproduce

  1. Open an elevated PowerShell session (as Administrator) on a Windows workstation.

  2. Run the following command:
    winget install Xournal++.Xournal++ --scope machine --source winget

  3. Observe that the installation fails with an error code (e.g., 3221225477) and does not install Xournal++ for all users on the machine.

Additional Context

To resolve this issue, I had to take several manual and inconvenient steps:

  1. I manually installed Xournal++ using the default user scope, as the machine scope option failed.
  2. I created a PowerShell script to manually create a shortcut for Xournal++ in C:\ProgramData\Microsoft\Windows\Start Menu\Programs so that all users would have access to it through the Start Menu:
# Define the shortcut location and target application path
$ShortcutPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Xournal++.lnk"
$TargetPath = "C:\Program Files\Xournal++\bin\xournalpp.exe"
$IconPath = "C:\Program Files\Xournal++\bin\xournalpp.exe"  # Optional: Use the executable's icon

# Create the shortcut using the WScript.Shell COM object
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutPath)
$Shortcut.TargetPath = $TargetPath
$Shortcut.WorkingDirectory = "C:\Program Files\Xournal++\bin"
$Shortcut.IconLocation = $IconPath
$Shortcut.Description = "Xournal++"
$Shortcut.Save()
  1. I used another PowerShell script to modify the Windows registry and add an "Open with Xournal++" option for PDF files, ensuring that all users could access this feature.
# Define the application path for Xournal++
$XournalPath = "C:\Program Files\Xournal++\bin\xournalpp.exe"

# Define the registry path for adding the "Open with Xournal++" option for PDF files
$RegistryPath = "HKLM:\SOFTWARE\Classes\Xournalpp.PDF\shell\Open with Xournal++\command"

# Create the registry keys if they do not exist
if (-not (Test-Path $RegistryPath))
{
    New-Item -Path $RegistryPath -Force | Out-Null
}

# Set the default value for the command to open PDF files with Xournal++
$Command = "`"$XournalPath`" `"%1`""
Set-ItemProperty -Path $RegistryPath -Name "(Default)" -Value $Command

# Register the new handler under the .pdf file association
$FileAssociationPath = "HKLM:\SOFTWARE\Classes\.pdf\OpenWithProgids"
if (-not (Test-Path $FileAssociationPath))
{
    New-Item -Path $FileAssociationPath -Force | Out-Null
}

# Add the new file association for PDFs with Xournal++
New-ItemProperty -Path $FileAssociationPath -Name "Xournalpp.PDF" -PropertyType String -Value "" -Force | Out-Null
  1. These manual steps were repeated for each workstation, which was time-consuming and prone to error.

A native solution supporting machine-wide installation via winget would save significant time and effort in enterprise environments and improve the deployment and management experience for IT administrators.

@Lonniebiz Lonniebiz added the bug label Oct 25, 2024
@rolandlo rolandlo added the os::windows Operating System Microsoft Windows label Oct 25, 2024
@rolandlo
Copy link
Member

rolandlo commented Oct 25, 2024

Thanks for reporting. Winget passes the scope option to the installer, which we create using NSIS, so all that needs to be improved is the file xournalpp.nsi. We haven't worked on it for around 3 years, but it would definitely be worth it.

Some more issues to fix:

Also related:

@rolandlo rolandlo added the packaging Related to distribution and packaging of Xournal++ label Oct 25, 2024
@Lonniebiz
Copy link
Author

I also reported this at winget:
microsoft/winget-pkgs#185672

Yeah, I'd say its worth it. Xournal is an awesome tool, and I bet a lot of Windows administrators would be happy to install it for all their users if you'd take some of the burden off them. Supporting --scope machine in the winget installer would be huge help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug os::windows Operating System Microsoft Windows packaging Related to distribution and packaging of Xournal++
Projects
None yet
Development

No branches or pull requests

3 participants
@Lonniebiz @rolandlo and others