From b8c1f0f4ebc5deb25fdc9849624261b896c3323e Mon Sep 17 00:00:00 2001 From: krolxon Date: Mon, 4 Aug 2025 09:43:03 +0530 Subject: [PATCH] hyprland: use kanshi for auto-management of monitors --- .config/hypr/hypridle.conf | 11 +++++ .config/hypr/hyprland.conf | 75 ++++++++++++----------------------- .config/kanshi/config | 22 ++++++++++ .config/shell/profile | 2 +- .config/wal/templates/dunstrc | 60 ---------------------------- .local/bin/setwall | 5 --- .local/bin/sysact | 26 ------------ .local/bin/wrdm | 9 ----- 8 files changed, 59 insertions(+), 151 deletions(-) create mode 100644 .config/hypr/hypridle.conf create mode 100644 .config/kanshi/config delete mode 100644 .config/wal/templates/dunstrc delete mode 100755 .local/bin/setwall delete mode 100755 .local/bin/sysact delete mode 100755 .local/bin/wrdm diff --git a/.config/hypr/hypridle.conf b/.config/hypr/hypridle.conf new file mode 100644 index 0000000..a2f5f1e --- /dev/null +++ b/.config/hypr/hypridle.conf @@ -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. +} diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index cd2cd82..ef7f7c3 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -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 diff --git a/.config/kanshi/config b/.config/kanshi/config new file mode 100644 index 0000000..e6aabe2 --- /dev/null +++ b/.config/kanshi/config @@ -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 + } +} diff --git a/.config/shell/profile b/.config/shell/profile index e5787ba..c290ffa 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -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 diff --git a/.config/wal/templates/dunstrc b/.config/wal/templates/dunstrc deleted file mode 100644 index 309a4e2..0000000 --- a/.config/wal/templates/dunstrc +++ /dev/null @@ -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 = "%s\n%b" - - # Allow some HTML tags like and 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 diff --git a/.local/bin/setwall b/.local/bin/setwall deleted file mode 100755 index 35b5f06..0000000 --- a/.local/bin/setwall +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -xwallpaper --zoom ~/.local/share/bg.jpg -wal -c -wal -i ~/.local/share/bg.jpg -xdotool key super+F5 diff --git a/.local/bin/sysact b/.local/bin/sysact deleted file mode 100755 index abd0221..0000000 --- a/.local/bin/sysact +++ /dev/null @@ -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 diff --git a/.local/bin/wrdm b/.local/bin/wrdm deleted file mode 100755 index 5b10f05..0000000 --- a/.local/bin/wrdm +++ /dev/null @@ -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 -