attempted to add a keybind to toggle touchpad
somehow i cant get the script to run when i use the touchpad, but hey, its in the repo now and the licence has been updated so i can get around to it later also i removed the default fish greeting it was annoying me
This commit is contained in:
parent
98ea496a19
commit
772518df4f
6 changed files with 116 additions and 2 deletions
38
LICENCE
38
LICENCE
|
@ -1,3 +1,40 @@
|
|||
Copyright for portions of this repository are held by Diana, 2024 as part of the files available at https://github.com/dianaw353/dotfiles and are provided under the BSD license. See the below lincences for details.
|
||||
All other copyright for project Foo are held by Gabriella Bere, 2024.
|
||||
|
||||
Licenses are specified as follows:
|
||||
|
||||
file:
|
||||
licence of file
|
||||
|
||||
|
||||
./scripts/hyprland/touchpad_toggle.sh:
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2024, Diana
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Everything else in this repo:
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Gabriella Bere
|
||||
|
@ -7,3 +44,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
nixos-switch = "sudo nixos-rebuild switch --flake ~/nixconf &| nom";
|
||||
home-switch = "home-manager switch --flake ~/nixconf &| nom";
|
||||
server-switch = "nixos-rebuild switch --flake ~/nixconf#biggerpi --target-host blue@biggerpi --use-remote-sudo &| nom";
|
||||
home-manager-news = "home-manager news --flake ~/nixconf";
|
||||
};
|
||||
shellInit = "
|
||||
set --global theme_virtual_env_prompt_enabled no
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
EDITOR = "nvim";
|
||||
NIXOS_OZONE_WL = 1;
|
||||
LD_LIBRARY_PATH = "${pkgs.libGL}/lib:${pkgs.gtk3}/lib:${pkgs.glib.out}/lib:${pkgs.xorg.libXtst}/lib";
|
||||
scripts = "/home/blue/nixconf/scripts";
|
||||
};
|
||||
|
||||
xdg.mimeApps = {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
systemd.variables = [ "--all" ];
|
||||
settings = {
|
||||
misc = {
|
||||
enable_anr_dialog = false;
|
||||
enable_anr_dialog = false; # disable application not repsonding dialog as it tends to just get in the way when trying to fix the unresponsive application
|
||||
};
|
||||
# Monitor config for home desk layout
|
||||
monitor = [
|
||||
|
@ -30,7 +30,7 @@
|
|||
follow_mouse = 1;
|
||||
mouse_refocus = false;
|
||||
touchpad = {
|
||||
disable_while_typing = false;
|
||||
disable_while_typing = true;
|
||||
};
|
||||
};
|
||||
gestures = {
|
||||
|
@ -67,6 +67,9 @@
|
|||
"$mod, D, exec, vesktop"
|
||||
"$mod, space, exec, bash -c 'wofi --show drun, run'"
|
||||
|
||||
# Keybind for toggling touchpad
|
||||
"$mod, j, exec, sh $scripts/hyprland/touchpad_toggle.sh"
|
||||
|
||||
# Screenshot tool
|
||||
", Print, exec, hyprshot -m region"
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
davinci-resolve # video editor
|
||||
libreoffice # office suite
|
||||
zoom-us # proprietary meeting app
|
||||
libnotify # notification server useful in scripting
|
||||
|
||||
# Audio Plugins
|
||||
calf
|
||||
|
|
70
scripts/hyprland/touchpad_toggle.sh
Normal file
70
scripts/hyprland/touchpad_toggle.sh
Normal file
|
@ -0,0 +1,70 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Script to toggle a given device.
|
||||
# Use the following command to choose what device you want to toggle:
|
||||
# hyprctl devices
|
||||
#
|
||||
# Courtesy of r/hyprland Reddit community:
|
||||
# https://reddit.com/r/hyprland/comments/11kr8bl/hotkey_disable_touchpad/
|
||||
# https://reddit.com/r/hyprland/comments/1bqohmd/dynamically_enabledisable_device/
|
||||
#
|
||||
# Ported, generalized, improved and overengineered by Bahar Kurt for
|
||||
# Diana's dotfiles.
|
||||
#
|
||||
|
||||
# HACK: Try to set a nonexistent config under "device:" so that
|
||||
# Hyprland refreshes all properties inside.
|
||||
hyprctl keyword device:a true > /dev/null 2>&1
|
||||
|
||||
# Set device to be toggled
|
||||
export HYPRLAND_DEVICE="$(hyprctl devices | grep touchpad | sed '/2-synaptics-touchpad/d; s/.* //')"
|
||||
export HYPRLAND_VARIABLE="device[${HYPRLAND_DEVICE}]:enabled"
|
||||
|
||||
if [ -z "$XDG_RUNTIME_DIR" ]; then
|
||||
export XDG_RUNTIME_DIR=/run/user/$(id -u)
|
||||
fi
|
||||
|
||||
# Check if device is currently enabled
|
||||
export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status"
|
||||
|
||||
# Try to get the touchpad status from status file.
|
||||
if [ -f "$STATUS_FILE" ]; then
|
||||
export TOUCHPAD_ENABLED="$(cat "$STATUS_FILE")"
|
||||
fi
|
||||
|
||||
# Toggle the touchpad
|
||||
if [ "$TOUCHPAD_ENABLED" != "false" ]; then
|
||||
# The touchpad is known to be, or assumed to be, enabled (not disabled).
|
||||
export PREVIOUS_STATUS="true"
|
||||
export TOUCHPAD_ENABLED="false"
|
||||
# Try to disable the touchpad. If it fails, set the new status to enabled.
|
||||
hyprctl --batch -r -- keyword "$HYPRLAND_VARIABLE" $TOUCHPAD_ENABLED || export TOUCHPAD_ENABLED="true"
|
||||
else
|
||||
# The touchpad is known to be disabled.
|
||||
export PREVIOUS_STATUS="false"
|
||||
export TOUCHPAD_ENABLED="true"
|
||||
# Try to enable the touchpad. If it fails, set the new status to disabled.
|
||||
hyprctl --batch -r -- keyword "$HYPRLAND_VARIABLE" $TOUCHPAD_ENABLED || export TOUCHPAD_ENABLED="false"
|
||||
fi
|
||||
|
||||
# Write the new touchpad status into the status file.
|
||||
echo "$TOUCHPAD_ENABLED" > "$STATUS_FILE"
|
||||
|
||||
# Generate the notification message.
|
||||
export NOTIFMSG="Touchpad "
|
||||
|
||||
if [ "$TOUCHPAD_ENABLED" == "$PREVIOUS_STATUS" ]; then
|
||||
export NOTIFMSG+="could not be "
|
||||
# Touchpad could not be...
|
||||
fi
|
||||
|
||||
if [ "$PREVIOUS_STATUS" == "true" ]; then
|
||||
export NOTIFMSG+="disabled."
|
||||
# Touchpad (could not be) disabled.
|
||||
else
|
||||
export NOTIFMSG+="enabled."
|
||||
# Touchpad (could not be) enabled.
|
||||
fi
|
||||
|
||||
notify-send -u normal "$NOTIFMSG"
|
Loading…
Add table
Add a link
Reference in a new issue