hyprland: use kanshi for auto-management of monitors

This commit is contained in:
krolxon 2025-08-04 09:43:03 +05:30
parent 3718ac5eb3
commit b8c1f0f4eb
8 changed files with 59 additions and 151 deletions

View File

@ -0,0 +1,11 @@
general {
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances.
before_sleep_cmd = loginctl lock-session # lock before suspend.
after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display.
}
listener {
timeout = 330 # 5.5min
on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed
on-resume = hyprctl dispatch dpms on # screen on when activity is detected after timeout has fired.
}

View File

@ -1,35 +1,11 @@
autogenerated = 0
env = HYPRSHOT_DIR,/home/krolyxon/pix/ss/
plugin {
split-monitor-workspaces {
count = 10
keep_focused = 1
enable_notifications = 0
enable_persistent_workspaces = 1
}
}
# This is an example Hyprland config file.
# Refer to the wiki for more information.
# https://wiki.hypr.land/Configuring/
# Please note not all available settings / options are set here.
# For a full list, see the wiki
# You can split this configuration into multiple files
# Create your files separately and then link them to this file like this:
source = ~/.config/hypr/monitors.conf
# source = ~/.config/hypr/monitors.conf
###################
### MY PROGRAMS ###
###################
# See https://wiki.hypr.land/Configuring/Keywords/
# Set programs that you use
$terminal = alacritty
$fileManager = pcmanfm
# $menu = rofi -show drun
@ -40,12 +16,10 @@ $browser = brave
#################
### AUTOSTART ###
#################
# Autostart necessary processes (like notifications daemons, status bars, etc.)
# Or execute your favorite apps at launch like this:
exec-once = hyprpm reload -n
exec-once = kanshi
exec-once = waybar & hyprpaper & swaync & hyprsunset
exec-once = hypridle
exec-once = systemctl --user start hyprpolkitagent
plugin {
@ -58,37 +32,40 @@ plugin {
#############################
### ENVIRONMENT VARIABLES ###
#############################
# See https://wiki.hypr.land/Configuring/Environment-variables/
env = HYPRSHOT_DIR,/home/krolyxon/pix/ss/
env = XCURSOR_SIZE,24
env = HYPRCURSOR_SIZE,24
#######################
### PLUGIN SETTINGS ###
#######################
plugin {
split-monitor-workspaces {
count = 10
keep_focused = 1
enable_notifications = 0
enable_persistent_workspaces = 1
}
}
###################
### PERMISSIONS ###
###################
ecosystem {
enforce_permissions = 1
}
# See https://wiki.hypr.land/Configuring/Permissions/
# Please note permission changes here require a Hyprland restart and are not applied on-the-fly
# for security reasons
# ecosystem {
# enforce_permissions = 1
# }
# permission = /usr/(bin|local/bin)/grim, screencopy, allow
# permission = /usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland, screencopy, allow
# permission = /usr/(bin|local/bin)/hyprpm, plugin, allow
permission = /usr/(bin|local/bin)/grim, screencopy, allow
permission = /usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland, screencopy, allow
permission = /usr/(bin|local/bin)/hyprpm, plugin, allow
#####################
### LOOK AND FEEL ###
#####################
# Refer to https://wiki.hypr.land/Configuring/Variables/
# https://wiki.hypr.land/Configuring/Variables/#general
general {
gaps_in = 10
gaps_out = 10
@ -100,7 +77,6 @@ general {
layout = master
}
# https://wiki.hypr.land/Configuring/Variables/#decoration
decoration {
rounding = 0
@ -115,7 +91,6 @@ decoration {
# shadow_render_power = 3
# col.shadow = rgba(1a1a1aee)
}
# https://wiki.hypr.land/Configuring/Variables/#animations
animations {
enabled = yes
@ -147,7 +122,7 @@ dwindle {
# See https://wiki.hypr.land/Configuring/Master-Layout/ for more
master {
new_status = master
# new_on_top = true
new_on_top = true
}
@ -211,7 +186,7 @@ bind = $mainMod SHIFT, R, togglefloating,
bind = $mainMod, R, exec, $menu
bind = $mainMod SHIFT, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
bind = $mainMod, tab, cyclenext
bind = $mainMod, tab, cyclenext, prev
bind = $mainMod, b, exec, killall waybar || waybar
# Applications

22
.config/kanshi/config Normal file
View File

@ -0,0 +1,22 @@
profile laptop-only {
output eDP-1 {
enable
mode 1920x1080
scale 1
position 0,0
}
}
profile docked {
output eDP-1 {
mode 1920x1080
scale 1
position 0,0
}
output HDMI-A-1 {
mode 1920x1080
scale 1
position 1920,0
}
}

View File

@ -56,4 +56,4 @@ export MPD_PORT="6600"
[ ! -s ~/.config/mpd/pid ] && mpd
# Start graphical server on user's current tty if not already running.
[ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC"
[ "$(tty)" = "/dev/tty1" ] && ! pidof -s hyprland >/dev/null 2>&1 && exec hyprland

View File

@ -1,60 +0,0 @@
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2018 Donovan Glover
# NOTE: This file is automatically generated by pywal. Do not edit it by hand.
[global]
# Make the width 3740 (3840 - 100), have 50 left margin and 95 above
# geometry = "3740x5-50+95"
offset = 3x20
# Show multiple notifications in the same box
separator_height = 0
# Add vertical padding to the inside of the notification
padding = 8
# Add horizontal padding for when the text gets long enough
horizontal_padding = 8
# The frame color and width of the notification
frame_color = "{color6}"
frame_width = 2
# How long a user needs to be idle for sticky notifications
idle_threshold = 120
# Font and typography settings
font = JetBrainsMono Nerd Font 10
alignment = left
word_wrap = yes
# Format for how notifications will be displayed
# Usage: `notify-send 'Title' 'Summary'`
format = "<b>%s</b>\n%b"
# Allow some HTML tags like <i> and <u> in notifications
markup = full
max_icon_size = 120
transparency = 5
# These are the keybindings used to control dunst notifications
[shortcuts]
close = ctrl+space
close_all = ctrl+shift+space
history = ctrl+grave
# Set the background and foreground (text) color for all notifications
[urgency_low]
background = "{background}"
foreground = "{foreground}"
[urgency_normal]
background = "{background}"
foreground = "{foreground}"
[urgency_critical]
background = "{background}"
foreground = "{foreground}"
# vim:ft=cfg

View File

@ -1,5 +0,0 @@
#!/bin/sh
xwallpaper --zoom ~/.local/share/bg.jpg
wal -c
wal -i ~/.local/share/bg.jpg
xdotool key super+F5

View File

@ -1,26 +0,0 @@
#!/bin/sh
export WM="dwm"
case "$(readlink -f /sbin/init)" in
*systemd*) ctl='systemctl' ;;
*) ctl='loginctl' ;;
esac
wmpid(){ # This function is needed if there are multiple instances of the window manager.
tree="$(pstree -ps $$)"
tree="${tree#*$WM(}"
echo "${tree%%)*}"
}
case "$(printf " lock\n󰠚 leave $WM\n renew $WM\n󱣻 hibernate\n reboot\n shutdown\n sleep\n display off" | dmenu -i -l 15 -p 'Action: ')" in
' lock') slock ;;
"󰠚 leave $WM") kill -TERM "$(wmpid)" ;;
" renew $WM") kill -HUP "$(wmpid)" ;;
'󱣻 hibernate') slock $ctl hibernate -i ;;
' sleep') slock $ctl suspend -i ;;
' reboot') $ctl reboot -i ;;
' shutdown') $ctl poweroff -i ;;
' display off') xset dpms force off ;;
*) exit 1 ;;
esac

View File

@ -1,9 +0,0 @@
#!/bin/env bash
# word=$(dmenu -p "Enter Word: " <&-)
word=$(cat ~/.local/bin/words.txt | dmenu -l 25 -p "Choose Word: ")
#$BROWSER https://www.merriam-webster.com/dictionary/$word
if [[ -n $word ]]; then
$BROWSER "https://www.google.com/search?hl=en&q=define+$word"
fi