25 lines
1.0 KiB
PowerShell
25 lines
1.0 KiB
PowerShell
$ErrorActionPreference = 'SilentlyContinue'
|
|
Add-Type -AssemblyName System.Windows.Forms
|
|
Add-Type -AssemblyName System.Drawing
|
|
|
|
$Dest = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$Daemon = Join-Path $Dest 'bin\rclone-bisyncd.exe'
|
|
$Cfg = Join-Path $Dest 'config.json'
|
|
|
|
$icon = New-Object System.Windows.Forms.NotifyIcon
|
|
$icon.Icon = [System.Drawing.SystemIcons]::Application
|
|
$icon.Text = 'rclone Dropbox bisync'
|
|
$icon.Visible = $true
|
|
|
|
$menu = New-Object System.Windows.Forms.ContextMenuStrip
|
|
$run = $menu.Items.Add('Run bisync now')
|
|
$run.add_Click({ Start-Process $Daemon -ArgumentList '--once' -WindowStyle Hidden })
|
|
$edit = $menu.Items.Add('Edit config.json')
|
|
$edit.add_Click({ Start-Process notepad.exe $Cfg })
|
|
$quit = $menu.Items.Add('Quit tray')
|
|
$quit.add_Click({ $icon.Visible = $false; [System.Windows.Forms.Application]::Exit() })
|
|
$icon.ContextMenuStrip = $menu
|
|
$icon.ShowBalloonTip(4000, 'rclone-bisync', 'Tray running. 15-min task is registered.', [System.Windows.Forms.ToolTipIcon]::Info)
|
|
|
|
[System.Windows.Forms.Application]::Run()
|