mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 01:18:26 +02:00
chore(home/linux/gui/hyprland): remove scripts & unused packages, use hyprlock & hypridle
This commit is contained in:
@@ -72,7 +72,7 @@ You don't have to go through the pain I've experienced again! Check out my
|
|||||||
| **Text Editor** | [Neovim][Neovim] |
|
| **Text Editor** | [Neovim][Neovim] |
|
||||||
| **Fonts** | [Nerd fonts][Nerd fonts] |
|
| **Fonts** | [Nerd fonts][Nerd fonts] |
|
||||||
| **Image Viewer** | [imv][imv] |
|
| **Image Viewer** | [imv][imv] |
|
||||||
| **Screenshot Software** | [flameshot][flameshot] + [grim][grim] |
|
| **Screenshot Software** | [flameshot][flameshot] |
|
||||||
| **Screen Recording** | [OBS][OBS] |
|
| **Screen Recording** | [OBS][OBS] |
|
||||||
| **Filesystem & Encryption** | tmpfs on `/`, [Btrfs][Btrfs] subvolumes on a [LUKS][LUKS] encrypted partition for persistent, unlock via passphrase |
|
| **Filesystem & Encryption** | tmpfs on `/`, [Btrfs][Btrfs] subvolumes on a [LUKS][LUKS] encrypted partition for persistent, unlock via passphrase |
|
||||||
| **Secure Boot** | [lanzaboote][lanzaboote] |
|
| **Secure Boot** | [lanzaboote][lanzaboote] |
|
||||||
@@ -193,7 +193,6 @@ Other dotfiles that inspired me:
|
|||||||
[Neovim]: https://github.com/neovim/neovim
|
[Neovim]: https://github.com/neovim/neovim
|
||||||
[AstroNvim]: https://github.com/AstroNvim/AstroNvim
|
[AstroNvim]: https://github.com/AstroNvim/AstroNvim
|
||||||
[flameshot]: https://github.com/flameshot-org/flameshot
|
[flameshot]: https://github.com/flameshot-org/flameshot
|
||||||
[grim]: https://github.com/emersion/grim
|
|
||||||
[flameshot]: https://github.com/flameshot-org/flameshot
|
[flameshot]: https://github.com/flameshot-org/flameshot
|
||||||
[imv]: https://sr.ht/~exec64/imv/
|
[imv]: https://sr.ht/~exec64/imv/
|
||||||
[OBS]: https://obsproject.com
|
[OBS]: https://obsproject.com
|
||||||
|
|||||||
@@ -1,2 +1,9 @@
|
|||||||
#-- Startup ----------------------------------------------------
|
#-- Startup ----------------------------------------------------
|
||||||
exec-once=~/.config/hypr/scripts/startup
|
exec-once = waybar --bar main-bar --log-level error
|
||||||
|
|
||||||
|
#-- Idle Daemon --
|
||||||
|
exec-once = hypridle
|
||||||
|
|
||||||
|
## Fix anyrun
|
||||||
|
## https://github.com/anyrun-org/anyrun/issues/153
|
||||||
|
exec-once = ln -s "$XDG_RUNTIME_DIR/hypr" /tmp/hypr
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
#-- Keybindings ----------------------------------------------------
|
#-- Keybindings ----------------------------------------------------
|
||||||
$term = foot
|
$term = foot
|
||||||
$app_launcher = ~/.config/hypr/scripts/menu
|
$app_launcher = anyrun
|
||||||
$volume = ~/.config/hypr/scripts/volume
|
|
||||||
$lockscreen = ~/.config/hypr/scripts/lockscreen
|
|
||||||
$wlogout = ~/.config/hypr/scripts/wlogout
|
|
||||||
$colorpicker = ~/.config/hypr/scripts/colorpicker
|
|
||||||
$files = thunar
|
$files = thunar
|
||||||
$browser = firefox
|
$browser = firefox
|
||||||
|
|
||||||
@@ -23,9 +19,8 @@ bind=SUPER,S,pseudo,
|
|||||||
|
|
||||||
# -- Misc --
|
# -- Misc --
|
||||||
bind=SUPER,N,exec,nm-connection-editor # need install network-manager-applet
|
bind=SUPER,N,exec,nm-connection-editor # need install network-manager-applet
|
||||||
bind=SUPER,P,exec,$colorpicker
|
bind=CTRLALT,L,exec,hyprlock
|
||||||
bind=CTRLALT,L,exec,$lockscreen
|
bind=SUPERSHIFT,X,exec,wlogout
|
||||||
bind=SUPERSHIFT,X,exec,$wlogout
|
|
||||||
|
|
||||||
# -- Some nice mouse binds --
|
# -- Some nice mouse binds --
|
||||||
bindm=SUPER,mouse:272,movewindow
|
bindm=SUPER,mouse:272,movewindow
|
||||||
@@ -34,14 +29,10 @@ bindm=SUPER,mouse:273,resizewindow
|
|||||||
# -- Function keys --
|
# -- Function keys --
|
||||||
# bind=,XF86MonBrightnessUp,exec,$backlight --inc
|
# bind=,XF86MonBrightnessUp,exec,$backlight --inc
|
||||||
# bind=,XF86MonBrightnessDown,exec,$backlight --dec
|
# bind=,XF86MonBrightnessDown,exec,$backlight --dec
|
||||||
bind=,XF86AudioRaiseVolume,exec,$volume --inc
|
# bind=,XF86AudioRaiseVolume,exec,$volume --inc
|
||||||
bind=,XF86AudioLowerVolume,exec,$volume --dec
|
# bind=,XF86AudioLowerVolume,exec,$volume --dec
|
||||||
bind=,XF86AudioMute,exec,$volume --toggle
|
# bind=,XF86AudioMute,exec,$volume --toggle
|
||||||
bind=,XF86AudioMicMute,exec,$volume --toggle-mic
|
# bind=,XF86AudioMicMute,exec,$volume --toggle-mic
|
||||||
bind=,XF86AudioNext,exec,mpc next
|
|
||||||
bind=,XF86AudioPrev,exec,mpc prev
|
|
||||||
bind=,XF86AudioPlay,exec,mpc toggle
|
|
||||||
bind=,XF86AudioStop,exec,mpc stop
|
|
||||||
|
|
||||||
# -- Screenshots --
|
# -- Screenshots --
|
||||||
bind=,Print,exec,hyprshot -m output -o ~/Pictures/Screenshots -- imv
|
bind=,Print,exec,hyprshot -m output -o ~/Pictures/Screenshots -- imv
|
||||||
|
|||||||
19
home/linux/gui/hyprland/conf/hypridle.conf
Normal file
19
home/linux/gui/hyprland/conf/hypridle.conf
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
general {
|
||||||
|
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple instances
|
||||||
|
before_sleep_cmd = loginctl lock-session # lock before suspend
|
||||||
|
after_sleep_cmd = hyprctl dispatch dpms on # resume dpms after suspend
|
||||||
|
ignore_dbus_inhibit = false # whether to ignore dbus-sent idle-inhibit requests
|
||||||
|
}
|
||||||
|
|
||||||
|
listener {
|
||||||
|
timeout = 290 # 4 minutes and 50 seconds
|
||||||
|
on-timeout = pidof hyprlock || hyprlock # lock screen
|
||||||
|
on-resume = hyprctl dispatch dpms on # monitor wake up
|
||||||
|
}
|
||||||
|
|
||||||
|
listener {
|
||||||
|
timeout = 300 # 5 minutes
|
||||||
|
on-timeout = hyprctl dispatch dpms off # screen off
|
||||||
|
on-resume = hyprctl dispatch dpms on # monitor wake up
|
||||||
|
}
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
## Simple Script To Pick Color Quickly.
|
|
||||||
|
|
||||||
color=$(grim -g "$(slurp -b 1B1F2800 -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | cut -d' ' -f4)
|
|
||||||
image=/tmp/${color}.png
|
|
||||||
|
|
||||||
main() {
|
|
||||||
if [[ "$color" ]]; then
|
|
||||||
# copy color code to clipboard
|
|
||||||
echo $color | tr -d "\n" | wl-copy
|
|
||||||
# generate preview
|
|
||||||
convert -size 48x48 xc:"$color" ${image}
|
|
||||||
# notify about it
|
|
||||||
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i ${image} "$color, copied to clipboard."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run the script
|
|
||||||
main
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Times the screen off and puts it to background
|
|
||||||
swayidle \
|
|
||||||
timeout 300 'swaymsg "output * power off"' \
|
|
||||||
resume 'swaymsg "output * power on"' &
|
|
||||||
# Locks the screen immediately
|
|
||||||
swaylock
|
|
||||||
# Kills last background task so idle timer doesn't keep running
|
|
||||||
kill %%
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if [[ ! $(pidof anyrun) ]]; then
|
|
||||||
anyrun
|
|
||||||
else
|
|
||||||
pkill anyrun
|
|
||||||
fi
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
## launch mako with alt config
|
|
||||||
|
|
||||||
CONFIG="$HOME/.config/hypr/mako/config"
|
|
||||||
|
|
||||||
if [[ ! $(pidof mako) ]]; then
|
|
||||||
mako --config ${CONFIG}
|
|
||||||
fi
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
## Fix anyrun
|
|
||||||
## https://github.com/anyrun-org/anyrun/issues/153
|
|
||||||
ln -s $XDG_RUNTIME_DIR/hypr /tmp/hypr
|
|
||||||
|
|
||||||
## Autostart Programs
|
|
||||||
|
|
||||||
# Kill already running process
|
|
||||||
_ps=(waybar mako)
|
|
||||||
for _prs in "${_ps[@]}"; do
|
|
||||||
if [[ $(pidof ${_prs}) ]]; then
|
|
||||||
killall -9 ${_prs}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Set wallpaper via a wallpaper.service
|
|
||||||
# it will by start by home-manager automatically, do not need to restart it here.
|
|
||||||
# systemctl --user restart wallpaper.service
|
|
||||||
|
|
||||||
# Launch notification daemon (mako)
|
|
||||||
~/.config/hypr/scripts/notifications &
|
|
||||||
|
|
||||||
# Launch statusbar (waybar)
|
|
||||||
~/.config/hypr/scripts/statusbar &
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
## launch waybar with alt config
|
|
||||||
|
|
||||||
CONFIG="$HOME/.config/hypr/waybar/config.jsonc"
|
|
||||||
STYLE="$HOME/.config/hypr/waybar/style.css"
|
|
||||||
|
|
||||||
if [[ ! $(pidof waybar) ]]; then
|
|
||||||
waybar --bar main-bar --log-level error --config ${CONFIG} --style ${STYLE}
|
|
||||||
fi
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
## Script To Manage Speaker Volume(in Wayland).
|
|
||||||
|
|
||||||
iDIR="$HOME/.config/hypr/mako/icons"
|
|
||||||
|
|
||||||
# Get Volume
|
|
||||||
get_volume() {
|
|
||||||
volume=$(amixer get Master | tail -n1 | awk -F ' ' '{print $5}' | tr -d '[]')
|
|
||||||
echo "$volume"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get icons
|
|
||||||
get_icon() {
|
|
||||||
vol="$(get_volume)"
|
|
||||||
current="${vol%%%}"
|
|
||||||
if [[ "$current" -eq "0" ]]; then
|
|
||||||
icon="$iDIR/volume-mute.png"
|
|
||||||
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
|
|
||||||
icon="$iDIR/volume-low.png"
|
|
||||||
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
|
|
||||||
icon="$iDIR/volume-mid.png"
|
|
||||||
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
|
|
||||||
icon="$iDIR/volume-high.png"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Notify
|
|
||||||
notify_user() {
|
|
||||||
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Volume : $(get_volume)"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Increase Volume
|
|
||||||
inc_volume() {
|
|
||||||
amixer -Mq set Master,0 5%+ unmute && get_icon && notify_user
|
|
||||||
}
|
|
||||||
|
|
||||||
# Decrease Volume
|
|
||||||
dec_volume() {
|
|
||||||
amixer -Mq set Master,0 5%- unmute && get_icon && notify_user
|
|
||||||
}
|
|
||||||
|
|
||||||
# Toggle Mute
|
|
||||||
toggle_mute() {
|
|
||||||
amixer get Master | grep '\[on\]' &>/dev/null
|
|
||||||
if [[ "$?" == 0 ]]; then
|
|
||||||
amixer set Master toggle && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/volume-mute.png" "Mute"
|
|
||||||
else
|
|
||||||
amixer set Master toggle && get_icon && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Unmute"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Toggle Mic
|
|
||||||
toggle_mic() {
|
|
||||||
amixer get Capture | grep '\[on\]' &>/dev/null
|
|
||||||
if [[ "$?" == 0 ]]; then
|
|
||||||
amixer -D pulse sset Capture toggle && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF"
|
|
||||||
else
|
|
||||||
amixer -D pulse sset Capture toggle && get_icon && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone.png" "Microphone Switched ON"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Execute accordingly
|
|
||||||
if [[ "$1" == "--get" ]]; then
|
|
||||||
get_volume
|
|
||||||
elif [[ "$1" == "--inc" ]]; then
|
|
||||||
inc_volume
|
|
||||||
elif [[ "$1" == "--dec" ]]; then
|
|
||||||
dec_volume
|
|
||||||
elif [[ "$1" == "--toggle" ]]; then
|
|
||||||
toggle_mute
|
|
||||||
elif [[ "$1" == "--toggle-mic" ]]; then
|
|
||||||
toggle_mic
|
|
||||||
else
|
|
||||||
get_volume
|
|
||||||
fi
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
## wlogout with alt layout and style file
|
|
||||||
|
|
||||||
LAYOUT="$HOME/.config/hypr/wlogout/layout"
|
|
||||||
STYLE="$HOME/.config/hypr/wlogout/style.css"
|
|
||||||
|
|
||||||
if [[ ! $(pidof wlogout) ]]; then
|
|
||||||
wlogout --layout ${LAYOUT} --css ${STYLE} \
|
|
||||||
--column-spacing 20 \
|
|
||||||
--row-spacing 20 \
|
|
||||||
--margin-top 200 \
|
|
||||||
--margin-bottom 200 \
|
|
||||||
--margin-left 150 \
|
|
||||||
--margin-right 150
|
|
||||||
else
|
|
||||||
pkill wlogout
|
|
||||||
fi
|
|
||||||
@@ -50,14 +50,14 @@
|
|||||||
},
|
},
|
||||||
"custom/launcher": {
|
"custom/launcher": {
|
||||||
"format": "\uf313 ",
|
"format": "\uf313 ",
|
||||||
"on-click": "$HOME/.config/hypr/scripts/menu",
|
"on-click": "anyrun",
|
||||||
"on-click-middle": "exec default_wall",
|
"on-click-middle": "exec default_wall",
|
||||||
"on-click-right": "exec wallpaper_random",
|
"on-click-right": "exec wallpaper_random",
|
||||||
"tooltip": false,
|
"tooltip": false,
|
||||||
},
|
},
|
||||||
"custom/powermenu": {
|
"custom/powermenu": {
|
||||||
"format": "\uf011",
|
"format": "\uf011",
|
||||||
"on-click": "$HOME/.config/hypr/scripts/wlogout",
|
"on-click": "wlogout",
|
||||||
"tooltip": false,
|
"tooltip": false,
|
||||||
},
|
},
|
||||||
"idle_inhibitor": {
|
"idle_inhibitor": {
|
||||||
|
|||||||
@@ -7,18 +7,32 @@
|
|||||||
}: let
|
}: let
|
||||||
package = pkgs.hyprland;
|
package = pkgs.hyprland;
|
||||||
in {
|
in {
|
||||||
# hyprland configs, based on https://github.com/notwidow/hyprland
|
|
||||||
xdg.configFile = let
|
xdg.configFile = let
|
||||||
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
|
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
|
||||||
hyprPath = "${config.home.homeDirectory}/nix-config/home/linux/gui/hyprland/conf";
|
hyprPath = "${config.home.homeDirectory}/nix-config/home/linux/gui/hyprland/conf";
|
||||||
in {
|
in {
|
||||||
|
"mako".source = mkSymlink "${hyprPath}/mako";
|
||||||
|
"waybar".source = mkSymlink "${hyprPath}/waybar";
|
||||||
|
"wlogout".source = mkSymlink "${hyprPath}/wlogout";
|
||||||
|
"hypr/hypridle.conf".source = mkSymlink "${hyprPath}/hypridle.conf";
|
||||||
"hypr/configs".source = mkSymlink "${hyprPath}/configs";
|
"hypr/configs".source = mkSymlink "${hyprPath}/configs";
|
||||||
"hypr/mako".source = mkSymlink "${hyprPath}/mako";
|
|
||||||
"hypr/scripts".source = mkSymlink "${hyprPath}/scripts";
|
|
||||||
"hypr/waybar".source = mkSymlink "${hyprPath}/waybar";
|
|
||||||
"hypr/wlogout".source = mkSymlink "${hyprPath}/wlogout";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# status bar
|
||||||
|
programs.waybar.enable = true;
|
||||||
|
|
||||||
|
# screen locker
|
||||||
|
programs.hyprlock.enable = true;
|
||||||
|
|
||||||
|
# Logout Menu
|
||||||
|
programs.wlogout.enable = true;
|
||||||
|
|
||||||
|
# Hyprland idle daemon
|
||||||
|
services.hypridle.enable = true;
|
||||||
|
|
||||||
|
# notification daemon, the same as dunst
|
||||||
|
services.mako.enable = true;
|
||||||
|
|
||||||
# NOTE:
|
# NOTE:
|
||||||
# We have to enable hyprland/i3's systemd user service in home-manager,
|
# We have to enable hyprland/i3's systemd user service in home-manager,
|
||||||
# so that gammastep/wallpaper-switcher's user service can be start correctly!
|
# so that gammastep/wallpaper-switcher's user service can be start correctly!
|
||||||
|
|||||||
@@ -1,26 +1,17 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
pkgs-unstable,
|
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
waybar # the status bar
|
|
||||||
swaybg # the wallpaper
|
swaybg # the wallpaper
|
||||||
swayidle # the idle timeout
|
|
||||||
swaylock # locking the screen
|
|
||||||
wlogout # logout menu
|
|
||||||
wl-clipboard # copying and pasting
|
wl-clipboard # copying and pasting
|
||||||
hyprpicker # color picker
|
hyprpicker # color picker
|
||||||
|
|
||||||
pkgs-unstable.hyprshot # screen shot
|
hyprshot # screen shot
|
||||||
grim # taking screenshots
|
|
||||||
slurp # selecting a region to screenshot
|
|
||||||
wf-recorder # screen recording
|
wf-recorder # screen recording
|
||||||
|
|
||||||
mako # the notification daemon, the same as dunst
|
|
||||||
|
|
||||||
yad # a fork of zenity, for creating dialogs
|
|
||||||
|
|
||||||
# audio
|
# audio
|
||||||
alsa-utils # provides amixer/alsamixer/...
|
alsa-utils # provides amixer/alsamixer/...
|
||||||
networkmanagerapplet # provide GUI app: nm-connection-editor
|
networkmanagerapplet # provide GUI app: nm-connection-editor
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
# fix https://github.com/ryan4yin/nix-config/issues/10
|
# fix https://github.com/ryan4yin/nix-config/issues/10
|
||||||
security.pam.services.swaylock = {};
|
security.pam.services.hyprlock = {};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user