Compare commits
9 Commits
main-mac
...
36376a2e34
Author | SHA1 | Date | |
---|---|---|---|
36376a2e34
|
|||
6269463d7b
|
|||
34dd9f4b01
|
|||
5c4a9851e6
|
|||
3495c81c49
|
|||
5dd77c49a0
|
|||
15be72893c
|
|||
43d220be01
|
|||
8210faf9ce
|
@ -42,7 +42,7 @@ history_most_used(){ LC_ALL=C cat ~/.bash_history | cut -d ';' -f 2- | §awk 1 |
|
||||
ls ~/bin | grep -P "^§" | sed 's/^§/~\/bin\/ §/'
|
||||
}
|
||||
|
||||
alias §ls='ls -pQFh --group-directories-first'
|
||||
alias ls='ls -pQFh --group-directories-first'
|
||||
alias §less='less -R -S'
|
||||
|
||||
alias §cd.='clear;§ls'
|
||||
@ -64,7 +64,8 @@ alias §find.='find . -maxdepth 1'
|
||||
alias pdftk='java -jar $HOME/bin/pdftk-all.jar'
|
||||
bw-session(){
|
||||
bw logout
|
||||
login=`kwallet-query kdewallet -f accounts -r Bitwarden 2> /dev/null`
|
||||
# login=`kwallet-query kdewallet -f accounts -r Bitwarden 2> /dev/null`
|
||||
login=$(§kwallet.mjs --wallet kdewallet readPassword accounts bw-json)
|
||||
export BW_CLIENTSECRET=`echo "$login" | jq -r .secret`
|
||||
export BW_CLIENTID=`echo "$login" | jq -r .id`
|
||||
bw login --apikey --raw
|
||||
|
@ -1,58 +1,59 @@
|
||||
function setPromt {
|
||||
if [ "$color_prompt" != yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
return
|
||||
fi
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
;;
|
||||
*)
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
return
|
||||
;;
|
||||
esac
|
||||
PROMPT_COMMAND=updatePromt
|
||||
PS2="|"
|
||||
if [ "$color_prompt" != yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
return
|
||||
fi
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
;;
|
||||
*)
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
return
|
||||
;;
|
||||
esac
|
||||
PROMPT_COMMAND=updatePromt
|
||||
PS2="|"
|
||||
}
|
||||
function updatePromt {
|
||||
local prev_exit="$?"
|
||||
# color_helper_>>color<< (Note: \[\]= escaping)
|
||||
local chR="\[\e[1;91m\]" #red
|
||||
local chW="\[\033[00m\]" #white
|
||||
local chG="\[\033[01;32m\]" #green
|
||||
local chB="\[\033[0;34m\]" #blue
|
||||
local chP="\[\033[0;35m\]" #purple
|
||||
local chY="\[\033[0;33m\]" #yellow
|
||||
PS1=""
|
||||
if [ $prev_exit == 0 ]; then
|
||||
PS1+="$chG✓ $chW"
|
||||
else
|
||||
PS1+="$chR✗ $chW"
|
||||
fi
|
||||
local jobs="$(jobs | wc -l)"
|
||||
if [ $jobs != 0 ]; then
|
||||
PS1+="${chY}≡$jobs$chW"
|
||||
fi
|
||||
PS1+="${debian_chroot:+($debian_chroot)}"
|
||||
PS1+=" At ${chG}\A${chW}"
|
||||
PS1+=" by ${chP}\u${chW}"
|
||||
if sudo -n true 2>/dev/null; then
|
||||
PS1+="${chR} (sudo)${chW}"
|
||||
fi
|
||||
PS1+=" in "
|
||||
if \git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
local branch="$(\git symbolic-ref -q HEAD)"
|
||||
PS1+="[${branch#refs/heads/}"
|
||||
local status="$(git for-each-ref --format='%(upstream:trackshort)' refs/heads | awk '!seen[$1]++ {printf $1}')"
|
||||
status+="$(git status --porcelain | awk '!seen[$1]++ {printf $1}')"
|
||||
if [ "$statua"s ]; then
|
||||
PS1+="|$chY$status$chW"
|
||||
fi
|
||||
PS1+="] "
|
||||
fi
|
||||
PS1+="${chB}\w${chW}"
|
||||
PS1+="\n:"
|
||||
history -a
|
||||
local prev_exit="$?"
|
||||
# history -n; history -w; history -c; history -r;
|
||||
# color_helper_>>color<< (Note: \[\]= escaping)
|
||||
local chR="\[\e[1;91m\]" #red
|
||||
local chW="\[\033[00m\]" #white
|
||||
local chG="\[\033[01;32m\]" #green
|
||||
local chB="\[\033[0;34m\]" #blue
|
||||
local chP="\[\033[0;35m\]" #purple
|
||||
local chY="\[\033[0;33m\]" #yellow
|
||||
PS1=""
|
||||
if [ $prev_exit == 0 ]; then
|
||||
PS1+="$chG✓ $chW"
|
||||
else
|
||||
PS1+="$chR✗ $chW"
|
||||
fi
|
||||
local jobs="$(jobs | wc -l)"
|
||||
if [ $jobs != 0 ]; then
|
||||
PS1+="${chY}≡$jobs$chW"
|
||||
fi
|
||||
PS1+="${debian_chroot:+($debian_chroot)}"
|
||||
PS1+=" At ${chG}\A${chW}"
|
||||
PS1+=" by ${chP}\u${chW}"
|
||||
if sudo -n true 2>/dev/null; then
|
||||
PS1+="${chR} (sudo)${chW}"
|
||||
fi
|
||||
PS1+=" in "
|
||||
if \git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
local branch="$(\git symbolic-ref -q HEAD)"
|
||||
PS1+="[${branch#refs/heads/}"
|
||||
local status="$(git for-each-ref --format='%(upstream:trackshort)' refs/heads | awk '!seen[$1]++ {printf $1}')"
|
||||
status+="$(git status --porcelain | awk '!seen[$1]++ {printf $1}')"
|
||||
if [ "$statua"s ]; then
|
||||
PS1+="|$chY$status$chW"
|
||||
fi
|
||||
PS1+="] "
|
||||
fi
|
||||
PS1+="${chB}\w${chW}"
|
||||
PS1+="\n:"
|
||||
history -a
|
||||
}
|
||||
setPromt
|
||||
unset color_prompt
|
||||
|
@ -1,16 +0,0 @@
|
||||
[Behavior]
|
||||
hideDockIcon=false
|
||||
hideMainWindowWhenStarted=true
|
||||
|
||||
[MainWindow]
|
||||
pos=@Point(0 0)
|
||||
size=@Size(640 480)
|
||||
|
||||
[RepoTreeView]
|
||||
expandedCategories-e77d1fb=Moje knihovny\tNed\xe1vno aktualizovan\xe9\tSd\xedleno se skupinama
|
||||
|
||||
[Settings]
|
||||
computerName=TUXEDO-InfinityBook-s15gen6
|
||||
|
||||
[UsedServerAddresses]
|
||||
main=https://seafile.jaandrle.cz/
|
@ -32,7 +32,7 @@
|
||||
"model_hash_override": null,
|
||||
"local_indexing": null,
|
||||
"heartbeat_interval_seconds": null,
|
||||
"last_service_level": "Cloud",
|
||||
"last_service_level": "FreeCloudRegistered",
|
||||
"override_beams": null,
|
||||
"override_context_length": null,
|
||||
"onboarding": null,
|
||||
|
4
.config/xremap.yml
Normal file
4
.config/xremap.yml
Normal file
@ -0,0 +1,4 @@
|
||||
keymap:
|
||||
- name: Ctrl+tab alias
|
||||
remap:
|
||||
C-KEY_KPSLASH: C-KEY_TAB
|
@ -3,7 +3,7 @@ AntiAliasFonts=true
|
||||
BoldIntense=true
|
||||
ColorScheme=DarkPastels
|
||||
DimmValue=54
|
||||
Font=Ubuntu Mono,9,-1,5,75,0,0,0,0,0,Bold
|
||||
Font=Ubuntu Mono,9,-1,5,700,0,0,0,0,0,0,0,0,0,0,1,Bold
|
||||
UseFontLineChararacters=false
|
||||
|
||||
[General]
|
||||
@ -12,4 +12,5 @@ Name=Můj
|
||||
Parent=FALLBACK/
|
||||
|
||||
[Scrolling]
|
||||
HistoryMode=2
|
||||
ScrollBarPosition=2
|
||||
|
65
README.md
65
README.md
@ -25,7 +25,7 @@ see for example [How to Store Dotfiles - A Bare Git Repository \| Atlassian Git
|
||||
## On a new machine
|
||||
1. install git
|
||||
1. `cd ~`
|
||||
1. `gd_branch=main`
|
||||
1. `gd_branch=main` (see also variants `main-termux`)
|
||||
1. `git clone --bare --branch $gd_branch --depth 1 --recurse-submodules --shallow-submodules git@jaandrle.cz:jaandrle/dotfiles.git ~/.dotfiles`
|
||||
1. `alias gitdotfiles='/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"'`
|
||||
1. `gitdotfiles config --local status.showUntrackedFiles no`
|
||||
@ -34,23 +34,43 @@ see for example [How to Store Dotfiles - A Bare Git Repository \| Atlassian Git
|
||||
1. `gitdotfiles checkout -f`
|
||||
1. `gitdotfiles submodule update --init --recursive`
|
||||
|
||||
## KDE Neon
|
||||
- [KDE Plasma5 Fixes](https://zren.github.io/kde/)
|
||||
- Using ‘HTML Wallpaper’ (wip)
|
||||
- [Bing Image Of The Day](./Obrázky/Bing Image Of The Day/index_template.html)
|
||||
- [GNOME Keyring in KDE Plasma - JWillikers](https://www.jwillikers.com/gnome-keyring-in-kde-plasma)
|
||||
- `sudo apt install $(check-language-support)`, see [Popup Language support is incomplete](http://unix.stackexchange.com/questions/421066/ddg#421079)
|
||||
- [KDE Neon does not have an hibernation option? : kde](https://www.reddit.com/r/kde/comments/6n5m49/kde_neon_does_not_have_an_hibernation_option/dk7hd8v/)
|
||||
- [kde plasma 5 - How to use miracast as an extended desktop on Linux? - Super User](https://superuser.com/questions/1160078/how-to-use-miracast-as-an-extended-desktop-on-linux)
|
||||
- [Best tiling extensions for kwin? : kde](https://www.reddit.com/r/kde/comments/qgsv2u/best_tiling_extensions_for_kwin/?sort=new)
|
||||
- [KDE Plasma5 Fixes](https://zren.github.io/kde/)
|
||||
- [Setup git on the CLI to use 2FA with GitHub](https://gist.github.com/ateucher/4634038875263d10fb4817e5ad3d332f)
|
||||
- [G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing - Main](https://gmic.eu/)
|
||||
|
||||
|
||||
## PC log (cs)
|
||||
Sekce obsahuje log změn v Tuxedo laptopu s KDE Neon.
|
||||
|
||||
- [Aloxaf/silicon: Create beautiful image of your source code.](https://github.com/Aloxaf/silicon) {DONE <2024-03-07> *utils* agenda}$
|
||||
|
||||
### KDE Neon 6.0 (22.04)
|
||||
{NEXT <2024-03-20> *tilling* *hud* *html-wallpaper* *virtual-desktop* *klipper* agenda}$
|
||||
|
||||
- mostly OK
|
||||
- [ ] desktop exceptionally freeze for less than a second: *investigation → report a bug*
|
||||
- [x] FIXED by update: ~logout/poweroff dialog not showing and not working: *investigation → report a bug* … see below~
|
||||
- [ ] Kup is missing in Settings (only restore files option is available): *investigation → report a bug*
|
||||
- [x] krunner not launching → created `/usr/share/dbus-1/services/org.kde.krunner.service` (see below)
|
||||
- [x] meta+tab (last virtual desktop) → workaround [./bin/kde6-workarounds.mjs](./bin/kde6-workarounds.mjs)
|
||||
- [x] klipper (edit last item) → workaround [./bin/kde6-workarounds.mjs](./bin/kde6-workarounds.mjs)
|
||||
- [ ] !!! Event calendar widget
|
||||
- [x] Active Window Control replaced with Window Title widget and its better
|
||||
- [ ] html wallpaper → workaround just concat images (see [./bin/§wallpaper\_BIOTD](./bin/§wallpaper_BIOTD))
|
||||
- [ ] tilling → try to use native, try to use [zeroxoneafour/polonium: Tiling window manager for KWin 5.27](https://github.com/zeroxoneafour/polonium) (when there will be a new release)
|
||||
- [ ] hud ([Zren/plasma-hud](https://github.com/Zren/plasma-hud) still works on X11), but maybe Ctrl+Alt+i and so on is OK?
|
||||
- [ ] [Fingerprint reader support : r/tuxedocomputers](https://www.reddit.com/r/tuxedocomputers/comments/176fscp/fingerprint_reader_support/), still receiving “no match”
|
||||
- [ ] [Clipboard support in Wayland · Issue #5157 · vim/vim](https://github.com/vim/vim/issues/5157#issuecomment-776008833)
|
||||
- [x] ctrl+tab using [k0kubun/xremap: Key remapper for X11 and Wayland](https://github.com/k0kubun/xremap) and `sudo crontab -e`+`@reboot` and [./.config/xremap.yml](./.config/xremap.yml)
|
||||
- [ ] Wayland go to sleep even the external monitor is connected (HDMI) *→ seems to be this issue [438716 – Lid close leads to suspend even when external monitor is attached](https://bugs.kde.org/show_bug.cgi?id=438716)*
|
||||
- [ ] [`npx npmkill` — Why are node_modules SO BIG 🤦♂️ #javascript #software #technology #code #webdev - YouTube](https://www.youtube.com/shorts/VgPNtow7fNM?app=desktop&si=Kl7CH3vCoyH7tqFU)
|
||||
|
||||
```bash
|
||||
qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout 1
|
||||
Cannot find 'org.kde.KSMServerInterface.logout' in object /KSMServer at org.kde.ksmserver
|
||||
```
|
||||
[KDE Bugtracking System Main Page](https://bugs.kde.org/)
|
||||
```ini
|
||||
[D-BUS Service]
|
||||
Name=org.kde.krunner
|
||||
Exec=/usr/bin/krunner
|
||||
```
|
||||
|
||||
### KDE neon 5.26 (22.04)
|
||||
{DONE <2022-10-25 17:21> *mail* *hud* *klíčenka* agenda}$
|
||||
|
||||
@ -80,9 +100,18 @@ Sekce obsahuje log změn v Tuxedo laptopu s KDE Neon.
|
||||
|
||||
Postupováno podle návodu [Rename the `~/.local/lib/python3.8/site-packages/pkg_resources` folder to `pkg_resources_back`](https://askubuntu.com/a/1398073).
|
||||
|
||||
### kwin-tiling
|
||||
- https://gitlab.com/faho/kwin-tiling/
|
||||
|
||||
### KDE Neon
|
||||
- [KDE Plasma5 Fixes](https://zren.github.io/kde/)
|
||||
- Using ‘HTML Wallpaper’ (wip)
|
||||
- [Bing Image Of The Day](./Obrázky/Bing Image Of The Day/index_template.html)
|
||||
- [GNOME Keyring in KDE Plasma - JWillikers](https://www.jwillikers.com/gnome-keyring-in-kde-plasma)
|
||||
- `sudo apt install $(check-language-support)`, see [Popup Language support is incomplete](http://unix.stackexchange.com/questions/421066/ddg#421079)
|
||||
- [KDE Neon does not have an hibernation option? : kde](https://www.reddit.com/r/kde/comments/6n5m49/kde_neon_does_not_have_an_hibernation_option/dk7hd8v/)
|
||||
- [kde plasma 5 - How to use miracast as an extended desktop on Linux? - Super User](https://superuser.com/questions/1160078/how-to-use-miracast-as-an-extended-desktop-on-linux)
|
||||
- [Best tiling extensions for kwin? : kde](https://www.reddit.com/r/kde/comments/qgsv2u/best_tiling_extensions_for_kwin/?sort=new), https://gitlab.com/faho/kwin-tiling/
|
||||
- [KDE Plasma5 Fixes](https://zren.github.io/kde/)
|
||||
- [Setup git on the CLI to use 2FA with GitHub](https://gist.github.com/ateucher/4634038875263d10fb4817e5ad3d332f)
|
||||
- [G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing - Main](https://gmic.eu/)
|
||||
|
||||
<details>
|
||||
<summary>`{… cmd}$` explanation</summary>
|
||||
|
@ -7,9 +7,9 @@
|
||||
"file_name": "github-desktop",
|
||||
"exec": "yes",
|
||||
"description": "Fork of GitHub Desktop to support various Linux distributions",
|
||||
"last_update": "2023-12-20T15:25:06Z",
|
||||
"last_update": "2024-02-04T22:31:22Z",
|
||||
"downloads": "/home/jaandrle/bin/github-desktop",
|
||||
"version": "release-3.3.6-linux3"
|
||||
"version": "release-3.3.8-linux2"
|
||||
},
|
||||
{
|
||||
"repository": "jaandrle/jaaCSS-cli",
|
||||
@ -29,9 +29,9 @@
|
||||
"group": "nondev",
|
||||
"file_name": "youtube-music",
|
||||
"exec": "yes",
|
||||
"last_update": "2024-01-05T14:44:27Z",
|
||||
"last_update": "2024-02-20T12:07:29Z",
|
||||
"downloads": "/home/jaandrle/bin/youtube-music",
|
||||
"version": "v3.2.2"
|
||||
"version": "v3.3.2"
|
||||
},
|
||||
{
|
||||
"repository": "ArchGPT/insomnium",
|
||||
@ -93,8 +93,8 @@
|
||||
{
|
||||
"repository": "dynobo/normcap",
|
||||
"name": "NormCap",
|
||||
"description": "OCR powered screen-capture tool to capture information instead of images",
|
||||
"group": "nondev",
|
||||
"description": "Switched to flatpak version | OCR powered screen-capture tool to capture information instead of images",
|
||||
"group": "skip",
|
||||
"file_name": "normcap",
|
||||
"exec": "yes",
|
||||
"last_update": "2023-12-12T22:23:37Z",
|
||||
@ -108,9 +108,9 @@
|
||||
"group": "nondev",
|
||||
"file_name": "upscayl",
|
||||
"exec": "yes",
|
||||
"last_update": "2024-01-16T09:54:25Z",
|
||||
"last_update": "2024-02-10T12:17:10Z",
|
||||
"downloads": "/home/jaandrle/bin/upscayl",
|
||||
"version": "v2.9.8"
|
||||
"version": "v2.9.9"
|
||||
},
|
||||
{
|
||||
"repository": "RasmusLindroth/tut",
|
||||
@ -152,9 +152,9 @@
|
||||
"group": "nondev",
|
||||
"file_name": "fedistar",
|
||||
"exec": "yes",
|
||||
"last_update": "2024-01-29T10:29:58Z",
|
||||
"last_update": "2024-02-09T11:38:02Z",
|
||||
"downloads": "/home/jaandrle/bin/fedistar",
|
||||
"version": "v1.8.3"
|
||||
"version": "v1.8.4"
|
||||
},
|
||||
{
|
||||
"repository": "ollama/ollama",
|
||||
@ -163,9 +163,9 @@
|
||||
"group": "ai",
|
||||
"file_name": "ollama",
|
||||
"exec": "yes",
|
||||
"last_update": "2024-01-26T18:19:36Z",
|
||||
"last_update": "2024-02-22T22:55:46Z",
|
||||
"downloads": "/home/jaandrle/bin/ollama",
|
||||
"version": "v0.1.22"
|
||||
"version": "v0.1.27"
|
||||
},
|
||||
{
|
||||
"repository": "neovim/neovim",
|
||||
@ -208,9 +208,9 @@
|
||||
"group": "ai",
|
||||
"file_name": "jan",
|
||||
"exec": "yes",
|
||||
"last_update": "2024-01-29T05:19:22Z",
|
||||
"last_update": "2024-02-26T03:30:36Z",
|
||||
"downloads": "/home/jaandrle/bin/jan",
|
||||
"version": "v0.4.5"
|
||||
"version": "v0.4.7"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
78
bin/kde6-workarounds.mjs
Executable file
78
bin/kde6-workarounds.mjs
Executable file
@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env nodejsscript
|
||||
/* jshint esversion: 11,-W097, -W040, module: true, node: true, expr: true, undef: true *//* global echo, $, pipe, s, fetch, cyclicLoop */
|
||||
|
||||
const pathLastDesktop= ()=> $.xdg.temp`kde6-workarounds-last-desktop.txt`;
|
||||
const css= echo.css`
|
||||
.code { color: gray; }
|
||||
`;
|
||||
|
||||
$.api()
|
||||
.version("2024-02-29")
|
||||
.describe("Workarounds for KDE6.")
|
||||
.command("logout")
|
||||
.action(function(){
|
||||
$.is_silent= true;
|
||||
const res= s.run([
|
||||
"echo ::options::",
|
||||
"|",
|
||||
"rofi -dmenu -p 'Logout' -l 4 -theme-str 'window { width: 25ch; }' -normal-window"
|
||||
].join(" "), {
|
||||
options: [ "-", "poweroff", "reboot" ].join("\n")
|
||||
}).trim();
|
||||
if(res && res!=="-") s.run(res);
|
||||
$.exit(0);
|
||||
})
|
||||
.command("klipper-edit", "Edit last item in klipper.")
|
||||
.action(async function(){
|
||||
$.is_silent= true;
|
||||
const qdbus= "qdbus org.kde.klipper /klipper org.kde.klipper.klipper.";
|
||||
try{
|
||||
const candidate= s.run(`${qdbus}getClipboardContents`).trim();
|
||||
const content= await $.read({ "-p": "Edit", completions: [ candidate ] });
|
||||
s.run(`${qdbus}setClipboardContents "${content}"`);
|
||||
$.exit(0);
|
||||
} catch (_){
|
||||
$.exit(1);
|
||||
}
|
||||
})
|
||||
.command("desktops-alttab", "Workaround for KDE6 alt-tab between virtual desktops.")
|
||||
.action(function(){
|
||||
const path= pathLastDesktop();
|
||||
// Regarding ★ : this is a workaround for diagonal switching (it duplicates desktop index)
|
||||
let desktop= s.cat(path).trim() || "1";
|
||||
if(desktop.length>3){ // ★
|
||||
const [ _1, _2, ..._3 ]= desktop.slice(-4, desktop.length);
|
||||
if(_1===_2)
|
||||
desktop= desktop.slice(0, -4).concat(_1, ..._3);
|
||||
}
|
||||
if(desktop.length>2){ // ★
|
||||
const [ _1, _2 ]= desktop.slice(-2, desktop.length);
|
||||
if(_1===_2)
|
||||
desktop= desktop.slice(0, -1);
|
||||
}
|
||||
if(desktop.length>2){
|
||||
desktop= desktop.slice(-2, desktop.length);
|
||||
s.echo(desktop).to(path);
|
||||
}
|
||||
echo(desktop);
|
||||
s.run`qdbus org.kde.KWin /KWin org.kde.KWin.setCurrentDesktop ${desktop[0]}`;
|
||||
$.exit(0);
|
||||
})
|
||||
.command("desktops-last-dbus")
|
||||
.action(function(){
|
||||
echo([
|
||||
"dbus-monitor",
|
||||
'"interface=org.kde.KWin.VirtualDesktopManager" "member=currentChanged"',
|
||||
"|",
|
||||
'xargs -e -I {} kde6-workarounds.mjs desktops-last-save {}'
|
||||
].join(" "));
|
||||
$.exit(0);
|
||||
})
|
||||
.command("desktops-last-save <dbus>", "Workaround for KDE6 alt-tab between virtual desktops.")
|
||||
.action(function(dbus){
|
||||
if(-1===dbus.indexOf("path=/VirtualDesktopManager; interface=org.kde.KWin.VirtualDesktopManager; member=currentChanged"))
|
||||
return $.exit(1);
|
||||
const desktop= s.run`qdbus org.kde.KWin /KWin org.kde.KWin.currentDesktop`.trim();
|
||||
s.echo(desktop).toEnd(pathLastDesktop());
|
||||
})
|
||||
.parse();
|
@ -2,7 +2,36 @@
|
||||
/* jshint esversion: 11,-W097, -W040, module: true, node: true, expr: true, undef: true *//* global echo, $, pipe, s, fetch, cyclicLoop */
|
||||
|
||||
$.api("")
|
||||
.version("2023-08-11")
|
||||
.version("2024-03-07")
|
||||
.command("silicon [file]", [
|
||||
"Generovat obrázek s kódem pro sdílení na sociálních sítích. (alternativa k Carbon)",
|
||||
"Toto je jen drobný wrapper s mými defaultními parametry.",
|
||||
"Další nápověda viz `silicon --help`.",
|
||||
])
|
||||
.option("--range", "Select lines from file in the form `start:end`")
|
||||
.option("--font-size, --fs", "Font size", 25)
|
||||
.action(function silicon(file, { range, fs, ["font-size"]: _fs, _, ...args }){
|
||||
args= Object.assign({
|
||||
theme: "OneHalfDark",
|
||||
font: `Ubuntu Mono =${fs}`,
|
||||
background: "#f06d78",
|
||||
["shadow-blur-radius"]: 30,
|
||||
["tab-width"]: 2
|
||||
}, args);
|
||||
args= Object.keys(args).flatMap(key=> [ "--"+key, args[key] ]);
|
||||
let from= file;
|
||||
const index_ext= file.lastIndexOf(".");
|
||||
const output= !file ? "silicon.png" : file.slice(0, index_ext+1)+"png";
|
||||
if(range && typeof range=== "string" && range.includes(":")){
|
||||
from= $.xdg.temp`silicon-range${file.slice(index_ext)}`;
|
||||
const content= s.$().cat(file).toString().split(/\r?\n/).slice(...range.split(":").map(n=> parseInt(n)+1));
|
||||
s.echo(content.join("\n")).to(from);
|
||||
}
|
||||
s.run`silicon ${from} --output ${output} --window-title ${file} ${args}`;
|
||||
echo(`Generated ${output}`);
|
||||
if(from!== file) s.rm(from);
|
||||
$.exit(0);
|
||||
})
|
||||
.command("textInImage [file]", "Generovat obrázek s textem pro sdílení na sociálních sítích.")
|
||||
.alias("tii")
|
||||
.option("--pointsize", "Text size", "62")
|
||||
|
@ -68,7 +68,6 @@ $.api("", true)
|
||||
.map(pipe(
|
||||
j=> j.choices[0].text.trim(),
|
||||
convertToArray,
|
||||
j=> (console.log(j), j),
|
||||
format==="regular" ? i=> i : i=> gitmoji(i, format==="git3moji"),
|
||||
a=> a.join("\n")
|
||||
))
|
||||
|
142
bin/§kwallet.mjs
Executable file
142
bin/§kwallet.mjs
Executable file
@ -0,0 +1,142 @@
|
||||
#!/usr/bin/env nodejsscript
|
||||
/* jshint esversion: 11,-W097, -W040, module: true, node: true, expr: true, undef: true *//* global echo, $, pipe, s, fetch, cyclicLoop */
|
||||
const css= echo.css`
|
||||
.error{ color: lightred; }
|
||||
.code, .method{ color: lightblue; }
|
||||
.code::before, .code::after{ content: "\`"; }
|
||||
.li{ padding-left: 2ch; }
|
||||
`;
|
||||
const cmd= "qdbus";
|
||||
if(!s.which(cmd))
|
||||
$.exit(1, echo([
|
||||
`%cError: ${cmd} not found.`,
|
||||
`%cInstall it with: %csudo apt install ${cmd}`,
|
||||
].join("\n"), css.error, css.unset, css.code));
|
||||
|
||||
import { EventEmitter } from "node:events";
|
||||
const events= new EventEmitter();
|
||||
const exit_event= "exit";
|
||||
events.on(exit_event, $.exit);
|
||||
|
||||
$.api("", true)
|
||||
.version("2024-03-05")
|
||||
.describe([
|
||||
`KWallet CLI using ${cmd}.`,
|
||||
"Call with no arguments to list all methods.",
|
||||
])
|
||||
.example("--wallet kdewallet folderList")
|
||||
.example("--wallet kdewallet readPassword folder entry")
|
||||
.option("--wallet, -w", "Wallet name", "kdewallet")
|
||||
.action(function({ _, wallet }){
|
||||
const qdbus= qdbusGenerator({
|
||||
service: "org.kde.kwalletd6",
|
||||
methods: "/modules/kwalletd6",
|
||||
wallet,
|
||||
exit_event
|
||||
});
|
||||
if(!_.length)
|
||||
echoLs(qdbus());
|
||||
else{
|
||||
//TODO: Map (`--literal` in qdbus and decode the result `echoMap`)
|
||||
const result= qdbus(_);
|
||||
echo(result);
|
||||
}
|
||||
events.emit(exit_event);
|
||||
})
|
||||
.parse();
|
||||
|
||||
function qdbusGenerator({ service, methods, wallet, exit_event }){
|
||||
const name= getScriptName();
|
||||
const no_id= [
|
||||
'allWalletsClosed',
|
||||
'applicationDisconnected',
|
||||
'folderListUpdated',
|
||||
'folderUpdated',
|
||||
'walletClosed',
|
||||
'walletCreated',
|
||||
'walletDeleted',
|
||||
'walletListDirty',
|
||||
'walletOpened',
|
||||
'changePassword',
|
||||
'close',
|
||||
'closeAllWallets',
|
||||
'deleteWallet',
|
||||
'disconnectApplication',
|
||||
'folderDoesNotExist',
|
||||
'isEnabled',
|
||||
'isOpen',
|
||||
'keyDoesNotExist',
|
||||
'localWallet',
|
||||
'networkWallet',
|
||||
'open',
|
||||
'openAsync',
|
||||
'openPath',
|
||||
'openPathAsync',
|
||||
'pamOpen',
|
||||
'reconfigure',
|
||||
'users',
|
||||
'wallets'
|
||||
];
|
||||
|
||||
let id;
|
||||
const qdbus= (...args)=> s.$().run`${cmd} ${service} ${methods} ${args}`;
|
||||
events.on(exit_event, ()=>{
|
||||
if(!id) return;
|
||||
qdbus("close", id, false, name);
|
||||
id= null;
|
||||
});
|
||||
return function([ method, ...args ]= []){
|
||||
if(!method) return qdbus();
|
||||
if(no_id.includes(method)) return qdbus(method, ...args);
|
||||
if(!id) open();
|
||||
return qdbus(method, id, ...args, name);
|
||||
};
|
||||
function open(){
|
||||
id= qdbus("open", wallet, 0, name).trim();
|
||||
return id;
|
||||
}
|
||||
}
|
||||
function echoMap(map){
|
||||
map= map.slice(1, -1).split(", ").map(n=> Number.parseInt(n));
|
||||
const ab= new ArrayBuffer(map.length);
|
||||
const view= new Uint8Array(ab);
|
||||
for(let i= 0; i<map.length; i++)
|
||||
view[i]= map[i];
|
||||
|
||||
const words= [];
|
||||
for(let i= 0; i<map.length; i+= 4){
|
||||
words.push(String.fromCharCode.apply(null, view.subarray(i, i+4)));
|
||||
}
|
||||
pipe(
|
||||
echo
|
||||
)(words);
|
||||
}
|
||||
function echoLs(list){
|
||||
const ns= "org.kde.KWallet.";
|
||||
pipe(
|
||||
list=> list.split("\n").filter(l=> l.startsWith("method") && -1!==l.indexOf(ns)),
|
||||
list=> list.map(l=> l.slice(l.indexOf(" ")+1)).map(l=> l.replace(ns, "")),
|
||||
list=> list.reduce((o, l)=> (o[Number(l.indexOf("int handle")!==-1)].push(l), o), [ [], [] ]),
|
||||
([ no_wallet, wallet ])=> [
|
||||
"Methods available without wallet:",
|
||||
...no_wallet.map(formatMethod),
|
||||
"Methods available with wallet (" + echo.format("%c--wallet", css.code) + " option):",
|
||||
...wallet.map(formatMethod)
|
||||
].join("\n"),
|
||||
echo
|
||||
)(list);
|
||||
function formatMethod(line){
|
||||
const ch_type= line.indexOf(" ")+1;
|
||||
const ch_name= line.indexOf("(", ch_type);
|
||||
return echo.format([
|
||||
"",
|
||||
line.slice(0, ch_type),
|
||||
line.slice(ch_type, ch_name),
|
||||
line.slice(ch_name)
|
||||
].join("%c"), css.li, css.method, css.unset);
|
||||
}
|
||||
}
|
||||
function getScriptName(){
|
||||
const { url }= import.meta;
|
||||
return (new URL(url)).href.slice((new URL("./", url).href.length));
|
||||
}
|
@ -153,7 +153,11 @@ async function actionUpdate(){
|
||||
}).then(f=> s.echo(f).to(dirs.one_files+fileName(url)));
|
||||
}));
|
||||
echo("One-file plugin(s) updated.");
|
||||
s.cd(dirs.bundle).$().run`git commit -m "Update"`;
|
||||
try{
|
||||
s.cd(dirs.bundle).$().run`git commit -m "Update"`;
|
||||
} catch(e){
|
||||
echo(e?.message);
|
||||
}
|
||||
updateRepo(dirs.pack, getPack());
|
||||
|
||||
$.exit(0);
|
||||
|
@ -9,36 +9,36 @@ const folder= homedir()+"/Obrázky/Bing Image Of The Day/";
|
||||
|
||||
get_(url_main+"/HPImageArchive.aspx?format=js&idx=0&n=2&mkt=cs-CZ")
|
||||
.then(res=> {
|
||||
let body= "";
|
||||
res.on("data", chunk=> body+= chunk);
|
||||
res.on("end", ()=> pipe(data, update)(body));
|
||||
let body= "";
|
||||
res.on("data", chunk=> body+= chunk);
|
||||
res.on("end", ()=> pipe(data, update)(body));
|
||||
})
|
||||
.catch(e=> console.error(String(e)));
|
||||
|
||||
function update(data){
|
||||
if(data===null) return false;
|
||||
Promise.allSettled(data.map(({ url, copyright }, id)=> getImage_(url, id ? "prev" : "now", copyright)))
|
||||
.then(res=> {
|
||||
let template= readFileSync(folder+"index_template.html").toString();
|
||||
writeFileSync(folder+"index.html", res.reduce((out, { status, value })=> status==="rejected" ? out : out.replace(`::${value.name}::`, value.description), template));
|
||||
})
|
||||
.catch(e=> console.error(String(e)));
|
||||
if(data===null) return false;
|
||||
Promise.allSettled(data.map(({ url, copyright }, id)=> getImage_(url, id ? "prev" : "now", copyright)))
|
||||
.then(res=> {
|
||||
let template= readFileSync(folder+"index_template.html").toString();
|
||||
writeFileSync(folder+"index.html", res.reduce((out, { status, value })=> status==="rejected" ? out : out.replace(`::${value.name}::`, value.description), template));
|
||||
})
|
||||
.catch(e=> console.error(String(e)));
|
||||
}
|
||||
function getImage_(url, name, desc){
|
||||
const description= desc.replace("(©", "<br>(©");
|
||||
return get_(url_main+url)
|
||||
.then(res=> {
|
||||
const fs= createWriteStream(folder+name+'.jpg');
|
||||
res.pipe(fs);
|
||||
return new Promise(res=> fs.on("finish", ()=> {
|
||||
fs.close();
|
||||
res({ name, description });
|
||||
}));
|
||||
});
|
||||
const description= desc.replace("(©", "<br>(©");
|
||||
return get_(url_main+url)
|
||||
.then(res=> {
|
||||
const fs= createWriteStream(folder+name+'.jpg');
|
||||
res.pipe(fs);
|
||||
return new Promise(res=> fs.on("finish", ()=> {
|
||||
fs.close();
|
||||
res({ name, description });
|
||||
}));
|
||||
});
|
||||
}
|
||||
function data(body){
|
||||
try { return JSON.parse(body).images; }
|
||||
catch (_) { return null; }
|
||||
try { return JSON.parse(body).images; }
|
||||
catch (_) { return null; }
|
||||
}
|
||||
function get_(url){ return new Promise(function(res,rej){ get(url, res).on("error", rej); }); }
|
||||
function pipe(...f){ return Array.prototype.reduce.bind(f, (acc, f)=> f(acc)); }
|
||||
|
Reference in New Issue
Block a user