elsa in mac

mac:Fedora-Asahi Remix, Hyprland의 기능을 확장하라. Pyprland 본문

Mac(OS X)/Asahi Linux

mac:Fedora-Asahi Remix, Hyprland의 기능을 확장하라. Pyprland

elsa in mac 2024. 3. 26. 20:04

 

이번 포스트에서는 Hyprland의 extension CLI인 Pyprland에 대해 알아보도록 하겠습니다. 

Pyprland는 Hyprland WM(Window Manager) 기반에서 추갖거인 기능을 사용할 수 있는 Pyhton 기반의 service 앱 이라고 할 수 있습니다. 

1. 설치
기본 package manager인 dnf를 이용하여 설치 합니다 .

sudo dnf install pyprland

 

2. 지원하는 plugin들
설치를 하게 되면, 기본적으로 pyprland가 제공하는 모든 plugin들이 설칙가 됩니다 plugin들에는 scrachpads, magnify, toggle_special, shortcut_menu, fetch_client_meu, layout_center, expose, lost_windows, toggle_dpms 등이 있습니다. 각 plugin들에 대한 셜멍은 여기서 확인할 수 있습니다.

 

3. 어플리케이션을 drodown & toggling 할 수 있는 scratchpads
가장 기본적이고 많이 사용하는 plugin은 바로, scratchpads 입니다. 이 플러그-인은 사용자가 원하는 app을 화면의 상/하/좌/우 에서 dropdown 방식으로 나타나게하고, 다시 사라지게 할 수 있는 기능을 제공합니다. 

pyprland의 scratchpads 사용 예

 

4. 설정
pyprland는 기본 설정 파일이 있어야 동작을 할 수 있습니다. 기본 설정 파일의 위치와 파일명은 ~/.config/hypr/pyprland.toml  입니다. 아래는 본인이 사용하고 있는 설정파일의 내용 입니다. 

[pyprland]
plugins = ["scratchpads"]

# musikcube CLI 음악 플레이어 
[scratchpads.term_b]
animation = "fromBottom"
command = "kitty --class kitty-dropterm_b musikcube"
class = "kitty-dropterm_b"
lazy = true
size = "40% 40%"
margin = 600

# 빈 터미널 
[scratchpads.term_l]
animation = "fromLeft"
command = "kitty --class kitty-dropterm_l"
class = "kitty-dropterm_l"
# class = "firefox"
lazy = true
size = "40% 70%"
margin = 1150

# Reddit CLI 
[scratchpads.term_r]
animation = "fromRight"
command = "kitty --class kitty-dropterm_r tuir"
class = "kitty-dropterm_r"
lazy = true
size = "40% 70%"
margin = 1150

# bleutooth 설정
[scratchpads.blueman_t]
animation = "fromTop"
command = "blueman-manager"
class = "blueman-manager"
lazy = true
size = "20% 30%"
margin = 700

plugins = 에서는 사용할 plugin을 명시해 주고, 각 세션은 [plugin명.세션명] 으로 정의를 합니다,  아래는 첫번째 세션에 대한 설명입니다. 

# musikcube CLI 음악 플레이어 
[scratchpads.term_b]		# 세션명 
animation = "fromBottom"	# 화면아래에서 화면 중앙으로 나타남
command = "kitty --class kitty-dropterm_b musikcube"	# kitty terminal을 통해 musikcube를 실행
class = "kitty-dropterm_b"	# class 식별자
lazy = true			# lazy = true, pypr 실행 시, 미리 해당 앱을 실행해 놓지 않음
size = "40% 40%"		# 해당 window의 크기, 전체화면 대비 가로 40%, 세로 60%
margin = 600			# offset (픽셀)

# margin 대신에 position을 사용할 수도 있음.
# position = 10%, 20% # 전체 화면 기준

주석과 같이 호출 시, 화면 하단에서 화면 중앙으로 나타나며, 크기는 전체 화면의 40%, 60% 가 됩니다.  kitty의 경우에는 class를 정의하여, 식별할 수 있습니다. 이점 참고 하시고, 나마지 기타 앱들의 class는 일단 해당 앱을 실행시킨 후, terminal 에서 hyprctl clients 명령으로 확인할 수 있습니다. 

foot terminal을 사용한다면, kitty --class  대신에 foot -a로 바꿔주면 됩니다. 

위의 스샷은 bluetooth manager인 blueman-manager GUI 앱에 대한 window 속성을 확인한 예 입니다. 보면, class가 무엇인지를 확인할 수 있습니다. 

 

5. 실행
Hyprland가 실행될 때 pyprland를 자동으로 실행하게 만듭니다. 

exec-once = pypr

다음으로, 각 command를 호출하고 Toggle 시키기 위해 키-바인딩(shoutcut)을 설정합니다. 

bind = , F9,  exec, pypr toggle blueman_t     
bind = , F10, exec, pypr toggle term_l      
bind = , F11, exec, pypr toggle term_r  
bind = , F12, exec, pypr toggle term_b

F10키를 누르면 term_l class를 호출하게 되고, pyprland.toml 의 설정에 따라 term_l class에 해당되는 세션 설정에 따라 scratchpad를 토글하게 됩니다.


대부분의 앱들이 잘 작동하지만, 그렇다고 모든 앱들이 다 정상적으로 실행되는 것은 아닙니다. Firefox의 경우에는 toggle이 되기는 하지만, floating 되지 않고, tiling 되고, Chromium의 경우에는 정상적으로 floating dropdown이 되지만, 추가적으로 앱을 띄울 수 없는 현상이 나타나기도 합니다. 

위의 예에서는 각기 다른 방향에서 나타나도록 했지만, 꼭 그럴 필요는 없습니다. Hyprland를 보다 구조적으로 단단하게 만들 수 있는 좋은 도구로 설치와 실행이 매우 직관적이고 간단하니, Hyprland에 입문하셨다면 검토해 보시고, 유용하게 사용해 보시기 바랍니다. 

공유하기 링크
Comments