Compare commits
3 Commits
9f93d04ff9
...
0543c241da
Author | SHA1 | Date |
---|---|---|
lub | 0543c241da | 10 months ago |
lub | 7f9ab5dd7a | 10 months ago |
lub | 9b863196db | 10 months ago |
@ -0,0 +1,11 @@
|
|||||||
|
#
|
||||||
|
# ~/.bash_profile
|
||||||
|
#
|
||||||
|
|
||||||
|
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
||||||
|
|
||||||
|
if [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
|
||||||
|
eval $(ssh-agent)
|
||||||
|
|
||||||
|
exec /usr/bin/sway
|
||||||
|
fi
|
@ -0,0 +1,94 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
|
||||||
|
<# TODO
|
||||||
|
.SYNOPSIS
|
||||||
|
Takes a screenshot and puts the URL into the clipboard
|
||||||
|
.DESCRIPTION
|
||||||
|
Uses grim and slurp to create a screenshot and uploads it into a matrix content repository.
|
||||||
|
A GETable URL is placed into the clipboard via wl-copy and optionally sent to the specified room.
|
||||||
|
.NOTES
|
||||||
|
Example config at $HOME/.config/matrix-screenshot.ps1:
|
||||||
|
|
||||||
|
```
|
||||||
|
$roomId = '!XpxHNLnPsnNEbScyeh:imninja.net'
|
||||||
|
$accessToken = 'NotaReALaCceSSTOk3n'
|
||||||
|
$homeserverUrl = 'https://imninja.net'
|
||||||
|
```
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
# Takes a fullscreen screenshot instead of selecting an area.
|
||||||
|
[switch]
|
||||||
|
$Fullscreen
|
||||||
|
)
|
||||||
|
|
||||||
|
# import config
|
||||||
|
$config = Import-Clixml (Join-Path $env:HOME '.config/nextcloud-screenshot.xml')
|
||||||
|
|
||||||
|
|
||||||
|
$tmp = New-TemporaryFile
|
||||||
|
$tmpPath = $tmp.FullName
|
||||||
|
$webpPath = $tmpPath -replace 'tmp$','webp'
|
||||||
|
|
||||||
|
if ($Fullscreen) {
|
||||||
|
grim $tmpPath
|
||||||
|
} else {
|
||||||
|
grim -g $(slurp) $tmpPath
|
||||||
|
}
|
||||||
|
if ((Get-Item $tmpPath).Length -eq 0) {
|
||||||
|
Remove-Item $tmpPath
|
||||||
|
throw ('Temp file "{0}" is empty' -f $tmpPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
magick $tmpPath $webpPath
|
||||||
|
if ((Get-Item $webpPath).Length -eq 0) {
|
||||||
|
Remove-Item $webpPath
|
||||||
|
throw ('WebP file "{0}" is empty' -f $webpPath)
|
||||||
|
} else {
|
||||||
|
Remove-Item $tmpPath
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$webpName = (Split-Path -Leaf $webpPath)
|
||||||
|
$nextcloudPath = $config.Path + '/' + $webpName
|
||||||
|
|
||||||
|
$uploadSplat = @{
|
||||||
|
Authentication = 'Basic'
|
||||||
|
#Credential = New-Object System.Management.Automation.PSCredential (($config.Password | ConvertFrom-SecureString -AsPlainText), (New-Object System.Security.SecureString))
|
||||||
|
Credential = $config.Credential
|
||||||
|
Method = 'Put'
|
||||||
|
Uri = '{0}/remote.php/dav/files/{1}/{2}' -f $config.BaseUrl,$config.Credential.UserName,$nextcloudPath
|
||||||
|
InFile = $webpPath
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Invoke-RestMethod @uploadSplat
|
||||||
|
} catch {
|
||||||
|
throw $_
|
||||||
|
Remove-Item $webpPath
|
||||||
|
}
|
||||||
|
|
||||||
|
$shareSplat = @{
|
||||||
|
Authentication = 'Basic'
|
||||||
|
Credential = $config.Credential
|
||||||
|
Header = @{
|
||||||
|
'OCS-APIRequest' = 'true' # https://docs.nextcloud.com/server/27/admin_manual/configuration_user/user_provisioning_api.html
|
||||||
|
}
|
||||||
|
Method = 'Post'
|
||||||
|
Uri = $config.BaseUrl + '/ocs/v2.php/apps/files_sharing/api/v1/shares'
|
||||||
|
Body = @{
|
||||||
|
path = $nextcloudPath
|
||||||
|
shareType = 3 # public link
|
||||||
|
permissions = 1 # read
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$share = Invoke-RestMethod @shareSplat
|
||||||
|
} catch {
|
||||||
|
throw $_
|
||||||
|
Remove-Item $webpPath
|
||||||
|
}
|
||||||
|
$share.ocs.data.url | wl-copy --trim-newline
|
||||||
|
notify-send 'Screenshot URL in clipboard' --expire-time=1000
|
||||||
|
|
||||||
|
Remove-Item $webpPath
|
||||||
|
|
@ -1,9 +1,5 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
cd "$HOME/.config"
|
export WINEPREFIX=/home/lub/.wineprefix/zygor
|
||||||
|
|
||||||
rm -r Zygor
|
wine /home/lub/.wineprefix/zygor/drive_c/users/lub/AppData/Local/Zygor/Zygor.exe
|
||||||
mkdir Zygor
|
|
||||||
cp -a Settings Zygor/
|
|
||||||
|
|
||||||
exec "$HOME/.zygor.AppImage"
|
|
||||||
|
Loading…
Reference in New Issue