Fix persistence loading issue
This commit is contained in:
@@ -1,7 +1,3 @@
|
|||||||
persistence_dir = File.join(ENV["XDG_STATE_HOME"] || File.expand_path("~/.local/state"), "kutu")
|
|
||||||
Dir.mkdir(persistence_dir) unless Dir.exist?(persistence_dir)
|
|
||||||
persistence_path = File.join(persistence_dir, "num.json")
|
|
||||||
|
|
||||||
presets = {
|
presets = {
|
||||||
normal: [0, X.clk],
|
normal: [0, X.clk],
|
||||||
mod: [X.mod, X.mod | X.clk]
|
mod: [X.mod, X.mod | X.clk]
|
||||||
|
|||||||
+4
-1
@@ -1,3 +1,7 @@
|
|||||||
|
persistence_dir = File.join(ENV["XDG_STATE_HOME"] || File.expand_path("~/.local/state"), "kutu")
|
||||||
|
Dir.mkdir(persistence_dir) unless Dir.exist?(persistence_dir)
|
||||||
|
persistence_path = File.join(persistence_dir, "num.json")
|
||||||
|
|
||||||
def keybind(key, mod, &block)
|
def keybind(key, mod, &block)
|
||||||
if mod.is_a? Array
|
if mod.is_a? Array
|
||||||
mod.each { |m| keybind(key, m, &block) }
|
mod.each { |m| keybind(key, m, &block) }
|
||||||
@@ -29,7 +33,6 @@ def load_monitors!
|
|||||||
xrandr_output = `xrandr --query`
|
xrandr_output = `xrandr --query`
|
||||||
connected = xrandr_output.each_line.select { |line| line.include?(" connected") }
|
connected = xrandr_output.each_line.select { |line| line.include?(" connected") }
|
||||||
connected.sort_by! { |line| line.include?(" primary") ? 0 : 1 }
|
connected.sort_by! { |line| line.include?(" primary") ? 0 : 1 }
|
||||||
persistence_path = File.join(__dir__, ".num.json")
|
|
||||||
persistence = File.exist?(persistence_path) ?
|
persistence = File.exist?(persistence_path) ?
|
||||||
JSON.parse(File.read(persistence_path), symbolize_names: true) :
|
JSON.parse(File.read(persistence_path), symbolize_names: true) :
|
||||||
{}
|
{}
|
||||||
|
|||||||
Reference in New Issue
Block a user