mirror of
https://github.com/hyprwm/hyprland-wiki.git
synced 2024-11-22 20:55:59 +01:00
parent
5b77e9c833
commit
e249a73bf2
1 changed files with 8 additions and 8 deletions
|
@ -106,29 +106,29 @@ ENABLED_PORTAL_DIR="/usr/share/xdg-desktop-portal/portals"
|
||||||
# needs to be created manually
|
# needs to be created manually
|
||||||
DISABLED_PORTAL_DIR="/usr/share/xdg-desktop-portal/disabled-portals"
|
DISABLED_PORTAL_DIR="/usr/share/xdg-desktop-portal/disabled-portals"
|
||||||
|
|
||||||
function is_enabled {
|
is_portal_enabled() {
|
||||||
[ -f "$ENABLED_PORTAL_DIR/$1.portal" ]
|
[ -f "$ENABLED_PORTAL_DIR/$1.portal" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_disabled {
|
is_portal_disabled() {
|
||||||
[ -f "$DISABLED_PORTAL_DIR/$1.portal" ]
|
[ -f "$DISABLED_PORTAL_DIR/$1.portal" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
function enable {
|
enable_portal() {
|
||||||
mv "$DISABLED_PORTAL_DIR/$1.portal" "$ENABLED_PORTAL_DIR/$1.portal"
|
mv "$DISABLED_PORTAL_DIR/$1.portal" "$ENABLED_PORTAL_DIR/$1.portal"
|
||||||
}
|
}
|
||||||
|
|
||||||
function disable {
|
disable_portal() {
|
||||||
mv "$ENABLED_PORTAL_DIR/$1.portal" "$DISABLED_PORTAL_DIR/$1.portal"
|
mv "$ENABLED_PORTAL_DIR/$1.portal" "$DISABLED_PORTAL_DIR/$1.portal"
|
||||||
}
|
}
|
||||||
|
|
||||||
PORTAL=$1
|
PORTAL=$1
|
||||||
ENABLE=${2:-$(is_enabled $PORTAL && echo "disable" || echo "enable")}
|
ENABLE=${2:-$(is_portal_enabled "$PORTAL" && echo "disable" || echo "enable")}
|
||||||
|
|
||||||
if [ $ENABLE = "enable" ]; then
|
if [ "$ENABLE" = "enable" ]; then
|
||||||
is_disabled $PORTAL && enable $PORTAL
|
is_portal_disabled "$PORTAL" && enable_portal "$PORTAL"
|
||||||
else
|
else
|
||||||
is_enabled $PORTAL && disable $PORTAL
|
is_portal_enabled "$PORTAL" && disable_portal "$PORTAL"
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue