Study: ComputerScience(CS)/CS: Linux

[Linux] Fusuma ํ„ฐ์น˜ํŒจ๋“œ ๋ฐ ํŠธ๋ž™ํŒจ๋“œ ํ™œ์šฉํ•˜๊ธฐ(feat. Mac ํ„ฐ์น˜ํŒจ๋“œ)

DrawingProcess 2023. 8. 8. 21:19
๋ฐ˜์‘ํ˜•
๐Ÿ’ก ๋ณธ ๋ฌธ์„œ๋Š” 'Fusuma ํ„ฐ์น˜ํŒจ๋“œ ๋ฐ ํŠธ๋ž™ํŒจ๋“œ ํ™œ์šฉํ•˜๊ธฐ(feat. Mac ํ„ฐ์น˜ํŒจ๋“œ)'์— ๋Œ€ํ•ด ์ •๋ฆฌํ•ด๋†“์€ ๊ธ€์ž…๋‹ˆ๋‹ค.
Ubuntu์—์„œ ํ„ฐ์น˜ํŒจ๋“œ๋ฅผ Mac์ฒ˜๋Ÿผ ํ™œ์šฉํ•˜๊ธฐ ์œ„ํ•œ ํˆด์ธ Fusuma์˜ ๊ธฐ๋ณธ ์„ค์ •์— ๋Œ€ํ•ด ์ •๋ฆฌํ•˜์˜€์œผ๋‹ˆ ์ฐธ๊ณ ํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

1. Fusuma ํ™˜๊ฒฝ ์„ค์ •

1) ํ„ฐ์น˜ํŒจ๋“œ ์žฅ์น˜๋ฅผ ์ฝ๊ธฐ ์œ„ํ•œ ๊ถŒํ•œ ์„ค์ •

์ค‘์š”: Fusuma ๋ฅผ ํ†ตํ•ด touchpad ์ž…๋ ฅ์„ ๋ฐ›์œผ๋ ค๋ฉด ๋ฐ˜๋“œ์‹œ INPUT ๊ทธ๋ฃน์˜ ๋ฉค๋ฒ„์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.

$ sudo gpasswd -a $USER input

์ด์ œ ํ•ด๋‹น ์‚ฌํ•ญ์„ ์ ์šฉ ์‹œํ‚ค๊ธฐ ์œ„ํ•ด์„œ๋Š” logout์„ ํ•˜๊ฑฐ๋‚˜ ์žฌ๋ถ€ํŒ…์„ ํ•œ๋ฒˆ ํ•ด์ฃผ์„ธ์š”.

$ newgrp input

2) Fusuma ์„ค์น˜ ๋ฐ ์‹คํ–‰

Fusuma๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

$ sudo apt install libinput-tools ruby xdotool -y
$ sudo gem install fusuma

Fusuma๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

$ fusuma
WARN -- : config file: /home/sjchoi/.config/fusuma/config.yml is NOT FOUND
...

config file์ด ๋ฐœ๊ฒฌ๋˜์ง€ ์•Š์•˜๋‹ค๊ณ  ๋‚˜์˜ต๋‹ˆ๋‹ค. ์„ค์ • ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด ์ฃผ์–ด์•ผ ๊ฒ ๋„ค์š”.

$ mkdir -p ~/.config/fusuma     
$ vi ~/.config/fusuma/config.yml

2. ํ„ฐ์น˜ํŒจ๋“œ ์„ค์ •ํ•˜๊ธฐ (feat. Mac ํ„ฐ์น˜ํŒจ๋“œ ์„ค์ •)

1) Ubuntu ์ œ์Šค์ฒ˜ ๋งคํ•‘ ์˜ˆ์‹œ

swipe:
  3: 
    left: 
      command: 'xdotool key alt+Right'
    right: 
      command: 'xdotool key alt+Left'
    up: 
      command: 'xdotool key super'
    down: 
      command: 'xdotool key super'
  4:
    left: 
      command: 'xdotool key ctrl+alt+Down'
    right: 
      command: 'xdotool key ctrl+alt+Up'
    up: 
      command: 'xdotool key ctrl+alt+Down'
    down: 
      command: 'xdotool key ctrl+alt+Up'
pinch:
  in:
    command: 'xdotool keydown ctrl click 4 keyup ctrl'
  out:
    command: 'xdotool keydown ctrl click 5 keyup ctrl'
hold:
  4:
    command: 'xdotool key super' # Activity

์ฐธ๊ณ : Ubuntu ์ œ์Šค์ฒ˜ ๋งคํ•‘ ์˜ˆ์‹œ: https://github.com/iberianpig/fusuma/wiki/Ubuntu

2) Mac๊ณผ ์ œ์Šค์ฒ˜ ํ†ต์ผ์‹œํ‚ค๊ธฐ

swipe:
  3:
    left:
      command: "xdotool key alt+Right" # History forward
    right:
      command: "xdotool key alt+Left" # History back        
    begin:
      command: xdotool mousedown 1
    update:
      command: xdotool mousemove_relative -- $move_x, $move_y
      interval: 0.01
      accel: 2
    end:
      command: xdotool mouseup 1
  4:
    up:
      command: "xdotool key super" # Activity
    down:
      command: "xdotool key super" # Activity
    left:
      command: "xdotool key ctrl+alt+Down" # Switch to next workspace
    right:
      command: "xdotool key ctrl+alt+Up" # Switch to previous workspace


pinch:
  2:
    in:
      command: "xdotool keydown ctrl click 4 keyup ctrl"
    out:
      command: "xdotool keydown ctrl click 5 keyup ctrl"

threshold:
  swipe: 0.5
  pinch: 0.3

interval:
  swipe: 0.5
  pinch: 0.5

์ฐธ๊ณ : Ubuntu OS to mimic Mac a little: https://github.com/iberianpig/fusuma/wiki/Ubuntu-OS-to-mimic-Mac-a-little

Feature

๊ฐ ๊ธฐ๋Šฅ์— ๋Œ€ํ•ด ์„ค๋ช…ํ•˜๋ฉฐ command: ํ”„๋กœํผํ‹ฐ๋ฅผ ํ†ตํ•ด ํ„ฐ์น˜ํŒจ๋“œ๋กœ ํ•˜๋Š” ๊ธฐ๋Šฅ(Key Command)์„ ๋ช…์‹œํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ command: ํ”„๋กœํผํ‹ฐ๊ฐ€ ๋น„์–ด ์žˆ์œผ๋ฉด, swipe๋‚˜ pinch๋Š” ์–ด๋–ค ์ปค๋งจ๋“œ๋„ ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. 

์†๊ฐ€๋ฝ 3๊ฐœ๋กœ ๋“œ๋ž˜๊ทธํ•ด์„œ ์ฐฝ ์›€์ง์ด๊ธฐ (Fusuma ๋ฒ„์ „ 2 ์ด์ƒ)

swipe:
  3:
    begin:
      command: xdotool mousedown 1
    update:
      command: xdotool mousemove_relative -- $move_x, $move_y
      interval: 0.01
      accel: 2
    end:
      command: xdotool mouseup 1

์†๊ฐ€๋ฝ 3๊ฐœ ๋“œ๋ž˜๊ทธ๋กœ ๋’ค๋กœ๊ฐ€๊ธฐ/ ์•ž์œผ๋กœ๊ฐ€๊ธฐ

swipe:
  3:
    left:
      command: "xdotool key alt+Right" # History forward
    right:
      command: "xdotool key alt+Left" # History back

์†๊ฐ€๋ฝ 4๊ฐœ ์œ„,์•„๋ž˜๋กœ superํ‚ค. ๋งฅ์—์„œ์˜ ๋ฏธ์…˜์ปจํŠธ๋กค์„ ๋Œ€์ฒด

  4:  
    up:
      command: "xdotool key super" # Activity
    down:
      command: "xdotool key super" # Activity

์†๊ฐ€๋ฝ 4๊ฐœ ์ขŒ,์šฐ ์ด๋™์œผ๋กœ ์›Œํฌ์ŠคํŽ˜์ด์Šค ๋ณ€ํ™˜

  4:
    left:
      command: "xdotool key ctrl+alt+Down" # Switch to next workspace
    right:
      command: "xdotool key ctrl+alt+Up" # Switch to previous workspace

๋‘์†๊ฐ€๋ฝ pinch ํ™•๋Œ€/์ถ•์†Œ

pinch:
  2:
    in:
      command: "xdotool keydown ctrl click 4 keyup ctrl"
    out:
      command: "xdotool keydown ctrl click 5 keyup ctrl"

Threshold ์™€ Interval

  • threshold:  swipe๋‚˜ pinch์˜ ๋ฏผ๊ฐ๋„๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ 1๋กœ, ๋งŒ์•ฝ swipe์˜ thradhold๊ฐ€ 0.5๋ผ๋ฉด ๋ฐ˜์‘์„ ์‹œ์ž‘ํ•˜๋Š” swipe์˜ ๊ธธ์ด๊ฐ€ ์ ˆ๋ฐ˜์œผ๋กœ ์งง์•„์ง€๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.
  • interval: wsipe์™€ pinch ์‚ฌ์ด์˜ ๋”œ๋ ˆ์ด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ ๊ฐ’์€ ์—ญ์‹œ 1 ์ž…๋‹ˆ๋‹ค. ๋งŒ์•ฝ swipe์˜ interval์ด 0.5๋ผ๋ฉด ๋‹ค์Œ swipe๋ฅผ ์ธ์‹ํ•  ๋•Œ๊นŒ์ง€์˜ ์ธํ„ฐ๋ฒŒ์ด ์ ˆ๋ฐ˜์œผ๋กœ ์งง์•„์ง‘๋‹ˆ๋‹ค.
  • swipe: ๊ฐœ์ธ์ ์œผ๋กœ 1์€ ๋„ˆ๋ฌด ๊ธธ๋‹ค๊ณ  ๋Š๊ปด์ ธ์„œ ํ™•์‹คํžˆ ์ค„์—ฌ์•ผ ํ•  ํ•„์š”๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. 
  • pinch: pinch์˜ ์ธํ„ฐ๋ฒŒ๋„ ์ค„์ด์ง€ ์•Š์œผ๋ฉด ์ •๋ง ๋‹ต๋‹ตํ•ฉ๋‹ˆ๋‹ค.

Fusuma ์„ค์ • ์ ์šฉ(~/.config/fusuma/config.yml)

๊ธฐ๋ณธ์ ์œผ๋กœ ~/.config/fusuma/config.yml ํŒŒ์ผ์„ ์„ค์ •ํ•œ ์ดํ›„ fusuma๋ฅผ ์‹คํ–‰ํ•ด์•ผ ํ•ด๋‹น ์„ค์ •์ด ์ ์šฉ๋˜๋ฉฐ, ์‹คํ–‰๋˜์–ด ์žˆ๋Š” ํ•œ์—์„œ ํŠธ๋ž™ํŒจ๋“œ๋กœ ํ•ด๋‹น ์„ค์ •์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ fusuma ์ปค๋ฉ˜๋“œ๋ฅผ ์ด์šฉํ•˜๋ฉด ์‹คํ–‰์‹œํ‚ฌ ์ˆ˜ ์žˆ์œผ๋ฉฐ -d ์˜ต์…˜์„ ์ฃผ์–ด ๋ฐ๋ชฌ์œผ๋กœ ์‹คํ–‰๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

$ fusuma -d

์ด๋•Œ ํ„ฐ์น˜ํŒจ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋งค๋ฒˆ log-in ํ˜น์€ ์ „์›์„ ํ‚ค๊ณ  fusuma๋ฅผ ์ผœ์ฃผ๋Š” ์ž‘์—…์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ gnome-session-properties๋ฅผ ์ด์šฉํ•ด์„œ ์ž๋™์œผ๋กœ ์‹คํ–‰์‹œ์ผœ๋†“๋Š” ๊ฒƒ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

3. ์ž๋™์‹คํ–‰ (gnome-session-properties)

fusuma ์‹คํ–‰ํŒŒ์ผ ์œ„์น˜ ํ™•์ธ

$ which fusuma
/usr/local/bin/fusuma

gnome-session-properties ์‹คํ–‰

๋‹ค์Œ์˜ ์ปค๋ฉ˜๋“œ๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ์‹คํ–‰ํ•œ ํ›„ Add ๋ฅผ ํด๋ฆญํ•˜์—ฌ fusuma๋ฅผ ์ถ”๊ฐ€ํ•ด์ค๋‹ˆ๋‹ค. ๋งˆ์ง€๋ง‰์— -d๋ฅผ ์ถ”๊ฐ€ํ•ด์ค€๋‹ค๋ฉด ์ž๋™์œผ๋กœ ๋ฐ๋ชฌ์œผ๋กœ ์‹คํ–‰๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ gnome-session-properties

์ฐธ๊ณ 

[Blog] Ubuntu) ํ„ฐ์น˜ํŒจ๋“œ ๋ฐ ํŠธ๋ž™ํŒจ๋“œ ํ™œ์šฉํ•˜๊ธฐ Fusuma: https://shanepark.tistory.com/257

๋ฐ˜์‘ํ˜•