Fix persistence and update deprecated dependencies
This commit is contained in:
@@ -18,10 +18,10 @@
|
||||
gcc
|
||||
pkg-config
|
||||
|
||||
xorg.libxcb
|
||||
xorg.xcbutilwm
|
||||
xorg.xrandr
|
||||
xorg.xprop
|
||||
libxcb
|
||||
xcbutilwm
|
||||
xrandr
|
||||
xprop
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
|
||||
+10
-7
@@ -2,7 +2,10 @@
|
||||
, ruby
|
||||
, makeWrapper
|
||||
, pkg-config
|
||||
, xorg
|
||||
, libxcb
|
||||
, xcbutilwm
|
||||
, xrandr
|
||||
, xprop
|
||||
, rubyPackages
|
||||
, gcc
|
||||
, lib
|
||||
@@ -24,10 +27,10 @@ stdenv.mkDerivation {
|
||||
(ruby.withPackages (ps: [
|
||||
ps.ffi
|
||||
]))
|
||||
xorg.libxcb
|
||||
xorg.xcbutilwm
|
||||
xorg.xrandr
|
||||
xorg.xprop
|
||||
libxcb
|
||||
xcbutilwm
|
||||
xrandr
|
||||
xprop
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
@@ -53,8 +56,8 @@ stdenv.mkDerivation {
|
||||
|
||||
wrapProgram $out/bin/kutu.rb \
|
||||
--prefix PATH : ${lib.makeBinPath [
|
||||
xorg.xrandr
|
||||
xorg.xprop
|
||||
xrandr
|
||||
xprop
|
||||
]}
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
presets = {
|
||||
normal: [0, X.clk],
|
||||
mod: [X.mod, X.mod | X.clk]
|
||||
@@ -95,25 +99,23 @@ end
|
||||
keybind 56, presets[:mod] do |_event|
|
||||
monitor = current_monitor
|
||||
create_workspace monitor
|
||||
persistence_path = File.join(__dir__, ".num.json")
|
||||
persistence = File.exist?(persistence_path) ?
|
||||
JSON.parse(File.read(persistence_path), symbolize_names: true) :
|
||||
{}
|
||||
persistence[$monitors.key(monitor)] ||= {}
|
||||
persistence[$monitors.key(monitor)][:length] = monitor[:workspaces].length
|
||||
#File.write(persistence_path, JSON.pretty_generate(persistence))
|
||||
File.write(persistence_path, JSON.pretty_generate(persistence))
|
||||
end
|
||||
|
||||
keybind 57, presets[:mod] do |_event|
|
||||
monitor = current_monitor
|
||||
delete_workspace monitor[:workspaces].length - 1, monitor
|
||||
persistence_path = File.join(__dir__, ".num.json")
|
||||
persistence = File.exist?(persistence_path) ?
|
||||
JSON.parse(File.read(persistence_path), symbolize_names: true) :
|
||||
{}
|
||||
persistence[$monitors.key(monitor)] ||= {}
|
||||
persistence[$monitors.key(monitor)][:length] = monitor[:workspaces].length
|
||||
#File.write(persistence_path, JSON.pretty_generate(persistence))
|
||||
File.write(persistence_path, JSON.pretty_generate(persistence))
|
||||
end
|
||||
|
||||
keybind 110, presets[:normal] do |_event|
|
||||
@@ -134,7 +136,6 @@ end
|
||||
|
||||
keybind 89, presets[:mod] do |_event|
|
||||
monitor = current_monitor
|
||||
persistence_path = File.join(__dir__, ".num.json")
|
||||
persistence = File.exist?(persistence_path) ?
|
||||
JSON.parse(File.read(persistence_path), symbolize_names: true) :
|
||||
{}
|
||||
@@ -143,14 +144,13 @@ keybind 89, presets[:mod] do |_event|
|
||||
else
|
||||
persistence[$monitors.key(monitor)] ||= {}
|
||||
persistence[$monitors.key(monitor)][:saved] = monitor[:selected_workspace]
|
||||
#File.write(persistence_path, JSON.pretty_generate(persistence))
|
||||
File.write(persistence_path, JSON.pretty_generate(persistence))
|
||||
select_workspace 0, monitor
|
||||
end
|
||||
end
|
||||
|
||||
keybind 81, presets[:mod] do |event|
|
||||
monitor = current_monitor
|
||||
persistence_path = File.join(__dir__, ".num.json")
|
||||
persistence = File.exist?(persistence_path) ?
|
||||
JSON.parse(File.read(persistence_path), symbolize_names: true) :
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user