Adds bitwarden

This commit is contained in:
Michel Fedde 2025-05-18 18:29:55 +02:00
parent e798bb5e1f
commit a301315f2a
8 changed files with 84 additions and 15 deletions

View file

@ -392,7 +392,7 @@ class Orchestrator {
this.#actFiles()
if (this.#support.isValid) {
this.#support.update(this.#fileMap.values().toArray());
this.#support.update([...this.#fileMap.values()]);
}
await new Promise(resolve => setTimeout(resolve, 1000));
@ -439,7 +439,7 @@ class Orchestrator {
}
await directory.close();
this.#fileMap.values()
[...this.#fileMap.values()]
.filter(fileContainer => !availableFiles.includes(fileContainer.filepath))
.forEach(value => {
this.#fileMap.set(value.filepath, {
@ -473,7 +473,7 @@ class Orchestrator {
/**
* @type {Device}
*/
const selectedDevice = this.#devices.values().find((device) => device.name === deviceName) ?? { name: deviceName }
const selectedDevice = [...this.#devices.values()].find((device) => device.name === deviceName) ?? { name: deviceName }
return {
filepath: path,
@ -499,7 +499,7 @@ class Orchestrator {
deviceMap.get(value.device.name).push(value);
}
const duplicates = deviceMap.values().filter(devices => devices.some(device => device.state !== 'invalid') && devices.length > 1);
const duplicates = [...deviceMap.values()].filter(devices => devices.some(device => device.state !== 'invalid') && devices.length > 1);
for (let duplicate of duplicates) {
const container = duplicate[0];
this.#notifications.sendNotification(
@ -530,7 +530,7 @@ ${duplicate.map((file) => `- ${file.filepath}`).join('\n')}\`
);
}
const previousDuplicates = deviceMap.values().filter(devices => devices[0].state === 'invalid' && devices.length < 2);
const previousDuplicates = [...deviceMap.values()].filter(devices => devices[0].state === 'invalid' && devices.length < 2);
previousDuplicates.forEach((previousDuplicate) => {
const duplicate = previousDuplicate[0];
this.#fileMap.set(duplicate.filepath, {
@ -539,7 +539,7 @@ ${duplicate.map((file) => `- ${file.filepath}`).join('\n')}\`
})
this.#logger.log(
`==> Marking device ${duplicate.device} as valid, due to having only one file`,
`==> Marking device ${duplicate.device.name} as valid, due to having only one file`,
'ORCHESTRATOR',
'INFO'
);
@ -618,7 +618,7 @@ s
const message = this.#notifications.sendReplaceableNotification({
summary: "Please wait...",
message: Orchestrator.NOTIFICATION_STARTING.replace('{device}', file.device),
message: Orchestrator.NOTIFICATION_STARTING.replace('{device}', file.device.name),
urgency: "critical",
});
this.#logger.log(
@ -709,15 +709,15 @@ s
switch (reason) {
default:
case "GENERIC":
notificationMessage = Orchestrator.NOTIFICATION_GENERIC_PROCESS_STOP.replace('{device}', file.device)
notificationMessage = Orchestrator.NOTIFICATION_GENERIC_PROCESS_STOP.replace('{device}', file.device.name)
logMessage = `Removing process for device '${file.device.name}' from file '${file.filepath}', due to unknown reason`
break;
case "REMOVED_FILE":
notificationMessage = Orchestrator.NOTIFICATION_MISSING_FILE_PROCESS_STOP.replace('{device}', file.device)
notificationMessage = Orchestrator.NOTIFICATION_MISSING_FILE_PROCESS_STOP.replace('{device}', file.device.name)
logMessage = `Removing process for device '${file.device.name}' from file '${file.filepath}', due to a removed file`
break;
case "INVALID_FILE":
notificationMessage = Orchestrator.NOTIFICATION_INVALID_FILE_PROCESS_STOP.replace('{device}', file.device)
notificationMessage = Orchestrator.NOTIFICATION_INVALID_FILE_PROCESS_STOP.replace('{device}', file.device.name)
logMessage = `Removing process for device '${file.device.name}' from file '${file.filepath}', due to a invalid file`
break;

View file

@ -97,7 +97,7 @@ bind = $mainMod, N, exec, $scriptsDir/LockScreen.sh # screen lock
bind = , Print, exec, $scriptsDir/ScreenShot.sh --area # screenshot (area)
bind = , F12, exec, $scriptsDir/ScreenShot.sh --active # screenshot (active window only)
bind = $mainMod SHIFT, N, exec, swaync-client -t -sw # swayNC notification panel
bind = $mainMod SHIFT, N, exec, $scriptsDir/Toolkit.sh # swayNC notification panel
bind = $mainMod SHIFT, L, movecurrentworkspacetomonitor, r
@ -118,6 +118,7 @@ bind = $mainMod Shift, Return, exec, hyprdrop ghostty --identifier term_hyprdrop
bind = $mainMod, T, exec, $files
bind = $mainMod, R, focusurgentorlast
bind = $mainMod, P, exec, $scriptsDir/Bitwarden.sh
# Master Layout Keybinds
bind = $mainMod, A, layoutmsg,swapwithmaster master

View file

@ -43,4 +43,4 @@ exec-once = hyprswitch init --show-title --size-factor 5.5 --workspaces-per-row
exec-once = hyprsunset &
exec-once = hyprshade auto
exec-once = sleep 1 && darkman run &
exec-once = bitwarden-daemon &

View file

@ -0,0 +1,42 @@
#!/bin/env sh
declare -A actions
actions['Sync']="sync"
actions["Logout"]="logout"
actions["Lock"]="lock"
printSelection() {
echo "$1"
for key in "${!fruits[@]}"
do
echo "Action: $key"
done
}
formattedIDs=$(echo "format:[NAME] ([USERNAME])" | nc -U /tmp/bitwarden-daemon.sock)
selectionList=$(echo "$formattedIDs" | jq 'keys | map("\(.)\n") | add' -r)
actionSelectionList=$(printf "Actions: %s\n" ${!actions[@]})
selection=$(printf "%s\n" "$selectionList" "$actionSelectionList" | anyrun --plugins libstdin.so)
echo "$selection"
if [[ $selection == '' ]]; then
exit 0
fi
if [[ $selection == Actions:* ]]; then
actionKey="${selection:9}"
action="${actions[$actionKey]}"
echo "Performing: $action"
echo "$action:" | nc -U /tmp/bitwarden-daemon.sock
else
id=$(echo "$formattedIDs" | jq ".[\"${selection}\"]" -r)
echo "lookupPassword:$id" | nc -U /tmp/bitwarden-daemon.sock | wl-copy
notify-send "Password copied" "Copied password for '$selection' to clipboard."
fi
exit 0;

15
.config/hypr/scripts/Toolkit.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/env sh
SCRIPTS_DIR="$HOME/.config/hypr/scripts"
declare -A scripts
scripts["Shutdown"]="systemctl poweroff"
scripts["Reboot"]="systemctl reboot"
scripts["Logout"]="logout terminate-user $USER"
scripts["Lock"]="$SCRIPTS_DIR/LockScreen.sh"
scripts["Notification Center (SwayNC)"]="swaync-client -t -sw"
selected=$(printf "%s\n" "${!scripts[@]}" | anyrun --plugins libstdin.so)
command="${scripts[$selected]}"
$command

View file

@ -20,12 +20,11 @@ entry {
padding: $input-padding;
border: none;
box-shadow: none;
color: $foreground
color: $foreground;
}
list#main {
background-color: rgba(0, 0, 0, 0);
//padding: 0.5rem;
}
list#plugin {

View file

@ -6,4 +6,5 @@ addApplications neovim \
btop \
zoxide fzf \
wifi-qr neovim \
brightnessctl
brightnessctl \
nodejs-lts-iron

View file

@ -0,0 +1,11 @@
#!/bin/env sh
addApplications bitwarden-cli zenity
addGitInstall "bitwarden-daemon" "ssh://git@git.php.fail:2222/neintonine/bitwarden-daemon.git" setupBitwardenDaemon
setupBitwardenDaemon() {
npm install
npm run build
sudo npm install -g .
}