Compare commits
51 Commits
27e56ad364
...
b0e15a2eef
Author | SHA1 | Date |
---|---|---|
|
b0e15a2eef | |
|
bf158fb137 | |
|
86eadfdc15 | |
|
aa2103a3a4 | |
|
a859d5694e | |
|
189d26a85d | |
|
e52ed11829 | |
|
62c0a3112f | |
|
122c2ef51c | |
|
2e2e3d59c9 | |
|
e0e1f5d2ad | |
|
790fd4347c | |
|
e68aab2ac5 | |
|
3a0f283c82 | |
|
9987313da7 | |
|
7ea84089d5 | |
|
ecf21faae3 | |
|
8a554bd5fb | |
|
ac5aa12faf | |
|
d602125bdd | |
|
7b0d8d8a76 | |
|
67f9fa671e | |
|
0e8fea7999 | |
|
cc6fe9a337 | |
|
700320e665 | |
|
345d1c0611 | |
|
e3abbe810c | |
|
f8b3a4979e | |
|
3228a5d271 | |
|
8183bcfa2b | |
|
02fc2ef1b6 | |
|
fe1730ac4f | |
|
dbd6bbd561 | |
|
5041acdf5c | |
|
9fe0657309 | |
|
7d6a6ae13c | |
|
d58be60b82 | |
|
bdc85b9ac2 | |
|
b65e5158a3 | |
|
6f3c493c7d | |
|
5aec63d242 | |
|
d9118de373 | |
|
0447f68106 | |
|
367358c3f4 | |
|
2899c83c28 | |
|
bd3fbd2566 | |
|
02597dde99 | |
|
b276a54f9f | |
|
8914ba08e1 | |
|
bc5fd58ebc | |
|
fea6955b8f |
|
@ -1,52 +1,18 @@
|
|||
env = WLR_DRM_DEVICES,/dev/dri/card0:/dev/dri/card1
|
||||
env = WLR_NO_HARDWARE_CURSORS,1
|
||||
env = TERMINAL,alacritty
|
||||
|
||||
$scripts = /home/user/.config/scripts
|
||||
$mainMod = SUPER
|
||||
|
||||
monitor=DP-2,preferred,0x550,1
|
||||
monitor=DP-3,preferred,1920x0,1
|
||||
monitor=HDMI-A-1,preferred,5760x550,1
|
||||
|
||||
exec-once=hyprpaper
|
||||
exec-once=wl-paste --type text --watch cliphist store
|
||||
exec-once=wl-paste --type image --watch cliphist store
|
||||
exec-once=/usr/lib/mate-polkit/polkit-mate-authentication-agent-1
|
||||
exec-once=/usr/lib/kdeconnectd
|
||||
exec-once=sleep 2 && hyprctl dispatch workspace 21
|
||||
|
||||
workspace=DP-2,11
|
||||
workspace=DP-3,21
|
||||
workspace=HDMI-A-1,1
|
||||
|
||||
workspace=21,monitor:HDMI-A-1, default:true
|
||||
workspace=22,monitor:HDMI-A-1
|
||||
workspace=23,monitor:HDMI-A-1
|
||||
workspace=24,monitor:HDMI-A-1
|
||||
workspace=25,monitor:HDMI-A-1
|
||||
workspace=26,monitor:HDMI-A-1
|
||||
workspace=27,monitor:HDMI-A-1
|
||||
workspace=28,monitor:HDMI-A-1
|
||||
workspace=29,monitor:HDMI-A-1
|
||||
|
||||
workspace=1,monitor:DP-2, default:true
|
||||
workspace=2,monitor:DP-2
|
||||
workspace=3,monitor:DP-2
|
||||
workspace=4,monitor:DP-2
|
||||
workspace=5,monitor:DP-2
|
||||
workspace=6,monitor:DP-2
|
||||
workspace=7,monitor:DP-2
|
||||
workspace=8,monitor:DP-2
|
||||
workspace=9,monitor:DP-2
|
||||
|
||||
workspace=11,monitor:DP-3, default:true
|
||||
workspace=12,monitor:DP-3
|
||||
workspace=13,monitor:DP-3
|
||||
workspace=14,monitor:DP-3
|
||||
workspace=15,monitor:DP-3
|
||||
workspace=16,monitor:DP-3
|
||||
workspace=17,monitor:DP-3
|
||||
workspace=18,monitor:DP-3
|
||||
workspace=19,monitor:DP-3
|
||||
exec-once=waybar
|
||||
|
||||
# windowrulev2 = tile, class:.*
|
||||
windowrulev2 = float, title:^(rofi)(.*)$
|
||||
|
@ -57,8 +23,6 @@ windowrulev2 = minsize 1 1, title:^()$,class:^(steam)$
|
|||
windowrulev2 = stayfocused, title:^()$,class:^(steam)$
|
||||
windowrule = noanim,waybar
|
||||
|
||||
exec-once=waybar
|
||||
|
||||
binds {
|
||||
scroll_event_delay=1
|
||||
}
|
||||
|
@ -122,9 +86,7 @@ gestures {
|
|||
workspace_swipe_invert = false
|
||||
}
|
||||
|
||||
$mainMod = SUPER
|
||||
|
||||
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
|
||||
bindr = $mainMod, SUPER_L, exec, pkill rofi || rofi -show drun
|
||||
bindr = $mainMod, SUPER_R, exec, pkill rofi || rofi -show drun
|
||||
bind = $mainMod, return, exec, $scripts/launch_alacritty.sh $(hyprctl activewindow -j | jq .pid)
|
||||
|
@ -140,6 +102,7 @@ bind = $mainMod, SPACE, togglesplit, # dwindle
|
|||
bind = CONTROL_L ALT_L, L, exec, swaylock
|
||||
bind = $mainMod, C, exec, cliphist list | awk '{print $0, "\0icon\x1fcom.github.davidmhewitt.clipped"}' | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy
|
||||
bind = $mainMod, Y, exec, /home/user/.config/rofi/rofi-ykman.sh
|
||||
bind = $mainMod, N, exec, /home/user/.config/rofi/rofi-ssh.sh
|
||||
|
||||
bind = $mainMod, Escape, exec, rofi -show power-menu -modi power-menu:$scripts/rofi-power-menu
|
||||
|
||||
|
@ -176,32 +139,32 @@ binde = $mainMod ALT, H, resizeactive, -20 0
|
|||
binde = $mainMod ALT, K, resizeactive, 0 -20
|
||||
binde = $mainMod ALT, J, resizeactive, 0 20
|
||||
|
||||
bind = $mainMod, 1, exec, hyprsome workspace 1
|
||||
bind = $mainMod, 2, exec, hyprsome workspace 2
|
||||
bind = $mainMod, 3, exec, hyprsome workspace 3
|
||||
bind = $mainMod, 4, exec, hyprsome workspace 4
|
||||
bind = $mainMod, 5, exec, hyprsome workspace 5
|
||||
bind = $mainMod, 6, exec, hyprsome workspace 6
|
||||
bind = $mainMod, 7, exec, hyprsome workspace 7
|
||||
bind = $mainMod, 8, exec, hyprsome workspace 8
|
||||
bind = $mainMod, 9, exec, hyprsome workspace 9
|
||||
bind = $mainMod, 1, split-workspace, 1
|
||||
bind = $mainMod, 2, split-workspace, 2
|
||||
bind = $mainMod, 3, split-workspace, 3
|
||||
bind = $mainMod, 4, split-workspace, 4
|
||||
bind = $mainMod, 5, split-workspace, 5
|
||||
bind = $mainMod, 6, split-workspace, 6
|
||||
bind = $mainMod, 7, split-workspace, 7
|
||||
bind = $mainMod, 8, split-workspace, 8
|
||||
bind = $mainMod, 9, split-workspace, 9
|
||||
|
||||
bind = $mainMod SHIFT, 1, exec, hyprsome movefocus 1
|
||||
bind = $mainMod SHIFT, 2, exec, hyprsome movefocus 2
|
||||
bind = $mainMod SHIFT, 3, exec, hyprsome movefocus 3
|
||||
bind = $mainMod SHIFT, 4, exec, hyprsome movefocus 4
|
||||
bind = $mainMod SHIFT, 5, exec, hyprsome movefocus 5
|
||||
bind = $mainMod SHIFT, 6, exec, hyprsome movefocus 6
|
||||
bind = $mainMod SHIFT, 7, exec, hyprsome movefocus 7
|
||||
bind = $mainMod SHIFT, 8, exec, hyprsome movefocus 8
|
||||
bind = $mainMod SHIFT, 9, exec, hyprsome movefocus 9
|
||||
bind = $mainMod SHIFT, 1, split-movetoworkspace, 1
|
||||
bind = $mainMod SHIFT, 2, split-movetoworkspace, 2
|
||||
bind = $mainMod SHIFT, 3, split-movetoworkspace, 3
|
||||
bind = $mainMod SHIFT, 4, split-movetoworkspace, 4
|
||||
bind = $mainMod SHIFT, 5, split-movetoworkspace, 5
|
||||
bind = $mainMod SHIFT, 6, split-movetoworkspace, 6
|
||||
bind = $mainMod SHIFT, 7, split-movetoworkspace, 7
|
||||
bind = $mainMod SHIFT, 8, split-movetoworkspace, 8
|
||||
bind = $mainMod SHIFT, 9, split-movetoworkspace, 9
|
||||
|
||||
bind = $mainMod SHIFT, T, exec, hyprsome move-empty
|
||||
bind = $mainMod, T, exec, hyprsome focus-empty
|
||||
bind = $mainMod SHIFT, T, split-movetoworkspace, empty
|
||||
bind = $mainMod, T, split-workspace, empty
|
||||
|
||||
# Scroll through existing workspaces with mainMod + scroll
|
||||
bind = $mainMod, TAB, workspace, m+1
|
||||
bind = $mainMod SHIFT, TAB, workspace, m-1
|
||||
bind = $mainMod, TAB, split-workspace, m+1
|
||||
bind = $mainMod SHIFT, TAB, split-workspace, m-1
|
||||
|
||||
# Move/resize windows with mainMod + LMB/RMB and dragging
|
||||
bindm = $mainMod, mouse:272, movewindow
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
/target
|
||||
/result
|
File diff suppressed because it is too large
Load Diff
|
@ -1,17 +0,0 @@
|
|||
[package]
|
||||
name = "hyprsome"
|
||||
description = "A small CLI apps that allows to make Hyprland's workspaces work like Awesome in multi-monitor setup"
|
||||
license = "GPL-3.0"
|
||||
version = "0.1.11"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.0.15", features = ["derive"] }
|
||||
ipc-rpc = "1.2.2"
|
||||
schemars = "0.8.11"
|
||||
serde = "1.0.145"
|
||||
serde_json = "1.0.86"
|
||||
tokio = "1.21.2"
|
||||
hyprland = "0.3.1"
|
|
@ -1,16 +0,0 @@
|
|||
The GPLv3 License (GPLv3)
|
||||
|
||||
Copyright (c) 2022 Author
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
@ -1,76 +0,0 @@
|
|||
# Hyprsome
|
||||
Hyprsome is a binary that interacts with Hyprland's Unix socket to make workspaces behave similarly to AwesomeWM in a multi-monitor setup.
|
||||
|
||||
If you're focused on a monitor and press SUPER+[1-9], you'll only switch to the workspaces that are bound to that monitor.
|
||||
|
||||
It is inspired by Swaysome, which does a similar thing for Sway.
|
||||
|
||||
# Installation
|
||||
`
|
||||
cargo install hyprsome
|
||||
`
|
||||
|
||||
# Usage
|
||||
Once the binary is installed, you can modify your ~/.config/hypr/hyprland.conf to accomodate it.
|
||||
Here is an example of a dual monitor setup:
|
||||
|
||||
```
|
||||
monitor=DP-1,1920x1080@60,0x0,1.33
|
||||
monitor=DP-1,transform,1
|
||||
workspace=DP-1,1
|
||||
monitor=HDMI-A-1,3440x1440@100,813x0,1
|
||||
workspace=HDMI-A-1,11
|
||||
```
|
||||
|
||||
Most noteworthy thing here is the 'workspace' keyword that I use to bind a default workspace for each monitor.
|
||||
|
||||
|
||||
Then you can bind workspaces to your different monitors.
|
||||
|
||||
It is very important that you bind your workspaces in order.
|
||||
|
||||
Check the results of `hyprctl monitors`. Bind workspaces from 1 to 9 on your monitor that has 0 as an id.
|
||||
|
||||
Then just bind workspaces by prefixing numbers by the id of the monitor they're bound to.
|
||||
|
||||
Here, HDMI-A-1's id is 1, so I bind workspaces from 11 to 19 to it.
|
||||
|
||||
```
|
||||
workspace=1,monitor:DP-1
|
||||
workspace=2,monitor:DP-1
|
||||
workspace=3,monitor:DP-1
|
||||
workspace=4,monitor:DP-1
|
||||
workspace=5,monitor:DP-1
|
||||
|
||||
workspace=11,monitor:HDMI-A-1
|
||||
workspace=12,monitor:HDMI-A-1
|
||||
workspace=13,monitor:HDMI-A-1
|
||||
workspace=14,monitor:HDMI-A-1
|
||||
workspace=15,monitor:HDMI-A-1
|
||||
```
|
||||
|
||||
Then it's just a matter of making sure your regular workspace keybinds call hyprsome.
|
||||
|
||||
```
|
||||
bind=SUPER,1,exec,hyprsome workspace 1
|
||||
bind=SUPER,2,exec,hyprsome workspace 2
|
||||
bind=SUPER,3,exec,hyprsome workspace 3
|
||||
bind=SUPER,4,exec,hyprsome workspace 4
|
||||
bind=SUPER,5,exec,hyprsome workspace 5
|
||||
|
||||
bind=SUPERSHIFT,1,exec,hyprsome move 1
|
||||
bind=SUPERSHIFT,2,exec,hyprsome move 2
|
||||
bind=SUPERSHIFT,3,exec,hyprsome move 3
|
||||
bind=SUPERSHIFT,4,exec,hyprsome move 4
|
||||
bind=SUPERSHIFT,5,exec,hyprsome move 5
|
||||
|
||||
```
|
||||
|
||||
# Limitations
|
||||
This is alpha software and my first program in Rust, bugs are bound to happen but nothing that will break your system.
|
||||
|
||||
Some features are most likely missing.
|
||||
|
||||
You can only have 9 workspaces per monitor as of now.
|
||||
|
||||
I haven't worked on supporting monitor hot-plug at all. It may work but it's unlikely.
|
|
@ -1,159 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1684981077,
|
||||
"narHash": "sha256-68X9cFm0RTZm8u0rXPbeBzOVUH5OoUGAfeHHVoxGd9o=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "35110cccf28823320f4fd697fcafcb5038683982",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1685518550,
|
||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1685498995,
|
||||
"narHash": "sha256-rdyjnkq87tJp+T2Bm1OD/9NXKSsh/vLlPeqCc/mm7qs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9cfaa8a1a00830d17487cb60a19bb86f96f09b27",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"crane",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"crane",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1683080331,
|
||||
"narHash": "sha256-nGDvJ1DAxZIwdn6ww8IFwzoHb2rqBP4wv/65Wt5vflk=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "d59c3fa0cba8336e115b376c2d9e91053aa59e56",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
crane.url = "github:ipetkov/crane";
|
||||
crane.inputs.nixpkgs.follows = "nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, crane, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
craneLib = crane.lib.${system};
|
||||
in
|
||||
{
|
||||
packages.default = craneLib.buildPackage {
|
||||
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
||||
# Add extra inputs here or any other derivation settings
|
||||
# doCheck = true;
|
||||
# buildInputs = [];
|
||||
# nativeBuildInputs = [];
|
||||
};
|
||||
});
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
use hyprland::{
|
||||
data::{Client, Clients},
|
||||
dispatch::{Direction, Dispatch, DispatchType},
|
||||
shared::{HyprData, HyprDataActiveOptional},
|
||||
};
|
||||
|
||||
pub fn get_active() -> Option<Client> {
|
||||
Client::get_active().unwrap()
|
||||
}
|
||||
|
||||
pub fn get() -> Clients {
|
||||
Clients::get().unwrap()
|
||||
}
|
||||
|
||||
pub fn focus_by_direction(direction: Direction) {
|
||||
let _ = Dispatch::call(DispatchType::MoveFocus(direction));
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
pub mod client;
|
||||
pub mod monitor;
|
||||
pub mod option;
|
||||
pub mod workspace;
|
||||
|
||||
use std::env;
|
||||
use std::io::prelude::*;
|
||||
use std::os::unix::net::UnixStream;
|
||||
|
||||
extern crate serde_json;
|
||||
|
||||
fn send_message(action: &str, args: Vec<&str>) -> String {
|
||||
let env_var_name = "HYPRLAND_INSTANCE_SIGNATURE";
|
||||
|
||||
let hyprland_instance_sig = match env::var(env_var_name) {
|
||||
Ok(v) => v,
|
||||
Err(e) => panic!("${} is not set ({})", env_var_name, e),
|
||||
};
|
||||
|
||||
let socket_path = format!("/tmp/hypr/{}/.socket.sock", hyprland_instance_sig);
|
||||
let mut stream = match UnixStream::connect(socket_path) {
|
||||
Err(_) => panic!("server is not running"),
|
||||
Ok(stream) => stream,
|
||||
};
|
||||
|
||||
let mut message = format!("j/{}", action);
|
||||
args.into_iter()
|
||||
.for_each(|a| message.push_str(&format!(" {}", a)));
|
||||
|
||||
// TODO: stop being stinky and manage errors
|
||||
let _ = stream.write_all(message.as_bytes());
|
||||
let mut response = String::new();
|
||||
|
||||
// TODO: stop being stinky and manage errors
|
||||
let _ = stream.read_to_string(&mut response);
|
||||
response
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
use hyprland::data::{Monitor, Monitors};
|
||||
use hyprland::dispatch::*;
|
||||
use hyprland::shared::HyprData;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ActiveWorkspace {
|
||||
pub id: u64,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
pub fn get_by_id(id: i16) -> Monitor {
|
||||
let mut monitors = get();
|
||||
monitors.find(|m| m.id == id).unwrap()
|
||||
}
|
||||
|
||||
pub fn get() -> Monitors {
|
||||
Monitors::get().unwrap()
|
||||
}
|
||||
|
||||
pub fn focus_left() {
|
||||
let _ = Dispatch::call(DispatchType::FocusMonitor(MonitorIdentifier::Direction(
|
||||
Direction::Left,
|
||||
)));
|
||||
}
|
||||
|
||||
pub fn focus_right() {
|
||||
let _ = Dispatch::call(DispatchType::FocusMonitor(MonitorIdentifier::Direction(
|
||||
Direction::Right,
|
||||
)));
|
||||
}
|
||||
|
||||
pub fn focus_up() {
|
||||
let _ = Dispatch::call(DispatchType::FocusMonitor(MonitorIdentifier::Direction(
|
||||
Direction::Up,
|
||||
)));
|
||||
}
|
||||
|
||||
pub fn focus_down() {
|
||||
let _ = Dispatch::call(DispatchType::FocusMonitor(MonitorIdentifier::Direction(
|
||||
Direction::Down,
|
||||
)));
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
const GETOPTIONS: &str = "getoptions";
|
||||
const GENERAL_GAPS_OUT: &str = "general:gaps_out";
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct HyprlandOption {
|
||||
pub option: String,
|
||||
pub int: i32,
|
||||
pub float: f64,
|
||||
pub str: String,
|
||||
}
|
||||
|
||||
pub fn get_gaps() -> i16 {
|
||||
let response = super::send_message(GETOPTIONS, vec![GENERAL_GAPS_OUT]);
|
||||
let gap_option: HyprlandOption = serde_json::from_str(&response).unwrap();
|
||||
|
||||
gap_option.int as i16
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// TODO: change this file to hyprland-rs
|
||||
const WORKSPACE: &str = "workspace";
|
||||
const DISPATCH: &str = "dispatch";
|
||||
const MOVETOWORKSPACESILENT: &str = "movetoworkspacesilent";
|
||||
const MOVETOWORKSPACE: &str = "movetoworkspace";
|
||||
|
||||
pub fn focus(workspace_number: &u64) {
|
||||
let _ = super::send_message(DISPATCH, vec![WORKSPACE, &workspace_number.to_string()]);
|
||||
}
|
||||
|
||||
pub fn move_to(workspace_number: &u64) {
|
||||
super::send_message(
|
||||
DISPATCH,
|
||||
vec![MOVETOWORKSPACESILENT, &workspace_number.to_string()],
|
||||
);
|
||||
}
|
||||
|
||||
pub fn move_focus(workspace_number: &u64) {
|
||||
super::send_message(
|
||||
DISPATCH,
|
||||
vec![MOVETOWORKSPACE, &workspace_number.to_string()],
|
||||
);
|
||||
}
|
|
@ -1,350 +0,0 @@
|
|||
use clap::{Parser, Subcommand, ValueEnum};
|
||||
|
||||
mod hyprland_ipc;
|
||||
use hyprland::{
|
||||
data::{Client, Monitor, Transforms, Workspaces},
|
||||
dispatch::Direction, shared::HyprData,
|
||||
};
|
||||
use hyprland_ipc::{client, monitor, option, workspace};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "hyprsome")]
|
||||
#[command(author = "sopa0")]
|
||||
#[command(version = "0.1.11")]
|
||||
#[command(about = "Makes hyprland workspaces behave like awesome")]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Commands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Commands {
|
||||
Focus { direction: Directions },
|
||||
Workspace { workspace_number: u64 },
|
||||
Move { workspace_number: u64 },
|
||||
Movefocus { workspace_number: u64 },
|
||||
MoveEmpty,
|
||||
FocusEmpty,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)]
|
||||
enum Directions {
|
||||
L,
|
||||
R,
|
||||
U,
|
||||
D,
|
||||
}
|
||||
|
||||
pub trait MonitorDimensions {
|
||||
fn real_width(&self) -> f32;
|
||||
fn real_height(&self) -> f32;
|
||||
}
|
||||
|
||||
impl MonitorDimensions for Monitor {
|
||||
fn real_width(&self) -> f32 {
|
||||
match self.transform {
|
||||
Transforms::Normal
|
||||
| Transforms::Normal180
|
||||
| Transforms::Flipped
|
||||
| Transforms::Flipped180 => self.width as f32 / self.scale,
|
||||
Transforms::Normal90 | Transforms::Normal270 | Transforms::Flipped90 => {
|
||||
self.height as f32 / self.scale
|
||||
}
|
||||
_ => self.width as f32,
|
||||
}
|
||||
}
|
||||
|
||||
fn real_height(&self) -> f32 {
|
||||
match self.transform {
|
||||
Transforms::Normal
|
||||
| Transforms::Flipped
|
||||
| Transforms::Normal180
|
||||
| Transforms::Flipped180 => self.height as f32 / self.scale,
|
||||
Transforms::Normal90 | Transforms::Normal270 | Transforms::Flipped90 => {
|
||||
self.width as f32 / self.scale
|
||||
}
|
||||
_ => self.height as f32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_current_monitor() -> Monitor {
|
||||
monitor::get().find(|m| m.focused).unwrap()
|
||||
}
|
||||
|
||||
//TODO: refactor this nonsense
|
||||
pub fn select_workspace(workspace_number: &u64) {
|
||||
let mon = get_current_monitor();
|
||||
match mon.id {
|
||||
0 => workspace::focus(workspace_number),
|
||||
_ => {
|
||||
workspace::focus(
|
||||
&format!("{}{}", mon.id, workspace_number)
|
||||
.parse::<u64>()
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_empty_workspace() -> u64 {
|
||||
let mon = get_current_monitor();
|
||||
let mut found = Vec::new();
|
||||
for workspaces in Workspaces::get().iter() {
|
||||
for workspace in workspaces.iter() {
|
||||
if workspace.monitor == mon.name {
|
||||
let mut id = workspace.name.clone();
|
||||
if id.len() > 1 {
|
||||
id = id.chars().nth(1).unwrap().to_string();
|
||||
}
|
||||
found.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
for i in 1..9 {
|
||||
if !found.contains(&i.to_string()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 1; // Send to the first workspace if no others are available
|
||||
}
|
||||
|
||||
//TODO: refactor this nonsense
|
||||
pub fn send_to_workspace(workspace_number: &u64) {
|
||||
let mon = get_current_monitor();
|
||||
match mon.id {
|
||||
0 => workspace::move_to(workspace_number),
|
||||
_ => {
|
||||
workspace::move_to(
|
||||
&format!("{}{}", mon.id, workspace_number)
|
||||
.parse::<u64>()
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: refactor this nonsense
|
||||
pub fn movefocus(workspace_number: &u64) {
|
||||
let mon = get_current_monitor();
|
||||
match mon.id {
|
||||
0 => workspace::move_focus(workspace_number),
|
||||
_ => {
|
||||
workspace::move_focus(
|
||||
&format!("{}{}", mon.id, workspace_number)
|
||||
.parse::<u64>()
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_leftmost_client_for_monitor(mon_id: i16) -> Client {
|
||||
let clients = client::get();
|
||||
|
||||
clients
|
||||
.into_iter()
|
||||
.filter(|c| c.monitor == mon_id)
|
||||
.min_by_key(|c| c.at.0)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn focus_left(aw: Client) {
|
||||
let mon = monitor::get_by_id(aw.monitor);
|
||||
let is_leftmost_client = is_leftmost_client(&aw, &mon);
|
||||
|
||||
if is_leftmost_monitor(&mon) && is_leftmost_client {
|
||||
return;
|
||||
}
|
||||
|
||||
if is_leftmost_client {
|
||||
monitor::focus_left();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
client::focus_by_direction(Direction::Left);
|
||||
}
|
||||
|
||||
pub fn focus_right(aw: Client) {
|
||||
let mon = monitor::get_by_id(aw.monitor);
|
||||
|
||||
if is_rightmost_monitor(&mon) && is_rightmost_client(&aw, &mon) {
|
||||
return;
|
||||
}
|
||||
|
||||
if is_rightmost_client(&aw, &mon) {
|
||||
monitor::focus_right();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
client::focus_by_direction(Direction::Right);
|
||||
}
|
||||
|
||||
pub fn focus_up(aw: Client) {
|
||||
let mon = monitor::get_by_id(aw.monitor);
|
||||
let is_top_client = is_top_client(&aw, &mon);
|
||||
|
||||
if is_top_monitor(&mon) && is_top_client {
|
||||
return;
|
||||
}
|
||||
|
||||
if is_top_client {
|
||||
monitor::focus_up();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
client::focus_by_direction(Direction::Up);
|
||||
}
|
||||
|
||||
pub fn focus_down(aw: Client) {
|
||||
let mon = monitor::get_by_id(aw.monitor);
|
||||
let is_bottom_client = is_bottom_client(&aw, &mon);
|
||||
|
||||
if is_bottom_monitor(&mon) && is_bottom_client {
|
||||
return;
|
||||
}
|
||||
|
||||
if is_bottom_client {
|
||||
monitor::focus_down();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
client::focus_by_direction(Direction::Down);
|
||||
}
|
||||
|
||||
pub fn is_leftmost_client(aw: &Client, mon: &Monitor) -> bool {
|
||||
let gaps = option::get_gaps();
|
||||
|
||||
if (aw.at.0 - gaps) as i32 == mon.x {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
pub fn is_rightmost_client(aw: &Client, mon: &Monitor) -> bool {
|
||||
let gaps = option::get_gaps();
|
||||
|
||||
if mon.real_width() + mon.x as f32 - gaps as f32 == aw.size.0 as f32 + aw.at.0 as f32 {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
pub fn is_top_client(aw: &Client, mon: &Monitor) -> bool {
|
||||
let gaps = option::get_gaps();
|
||||
|
||||
if mon.y + (gaps as i32) + (mon.reserved.1 as i32) == (aw.at.1 as i32) {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
pub fn is_bottom_client(aw: &Client, mon: &Monitor) -> bool {
|
||||
let gaps = option::get_gaps();
|
||||
|
||||
if mon.real_height() + mon.y as f32 - gaps as f32 - mon.reserved.1 as f32
|
||||
== aw.size.1 as f32 + gaps as f32
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
pub fn is_rightmost_monitor(mon: &Monitor) -> bool {
|
||||
let monitors = monitor::get();
|
||||
let max = monitors.into_iter().max_by_key(|m| m.x).unwrap();
|
||||
if max.x == mon.x {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub fn is_leftmost_monitor(mon: &Monitor) -> bool {
|
||||
let monitors = monitor::get();
|
||||
let min = monitors.into_iter().min_by_key(|m| m.x).unwrap();
|
||||
if min.x == mon.x {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub fn is_top_monitor(mon: &Monitor) -> bool {
|
||||
let monitors = monitor::get();
|
||||
let min = monitors.into_iter().min_by_key(|m| m.y).unwrap();
|
||||
if min.y == mon.y {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub fn is_bottom_monitor(mon: &Monitor) -> bool {
|
||||
let monitors = monitor::get();
|
||||
let max = monitors.into_iter().max_by_key(|m| m.y).unwrap();
|
||||
if max.y == mon.y {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let cli = Cli::parse();
|
||||
match &cli.command {
|
||||
Commands::Focus { direction } => match direction {
|
||||
Directions::L => {
|
||||
let aw = client::get_active();
|
||||
|
||||
match aw {
|
||||
Some(aw) => focus_left(aw),
|
||||
None => monitor::focus_left(),
|
||||
};
|
||||
}
|
||||
Directions::R => {
|
||||
let aw = client::get_active();
|
||||
|
||||
match aw {
|
||||
Some(aw) => focus_right(aw),
|
||||
None => monitor::focus_right(),
|
||||
};
|
||||
}
|
||||
Directions::U => {
|
||||
let aw = client::get_active();
|
||||
|
||||
match aw {
|
||||
Some(aw) => focus_up(aw),
|
||||
None => monitor::focus_up(),
|
||||
};
|
||||
}
|
||||
Directions::D => {
|
||||
let aw = client::get_active();
|
||||
|
||||
match aw {
|
||||
Some(aw) => focus_down(aw),
|
||||
None => monitor::focus_down(),
|
||||
};
|
||||
}
|
||||
},
|
||||
Commands::Workspace { workspace_number } => {
|
||||
select_workspace(workspace_number);
|
||||
}
|
||||
Commands::Move { workspace_number } => {
|
||||
send_to_workspace(workspace_number);
|
||||
}
|
||||
Commands::Movefocus { workspace_number } => {
|
||||
movefocus(workspace_number);
|
||||
}
|
||||
Commands::MoveEmpty => {
|
||||
movefocus(&get_empty_workspace());
|
||||
},
|
||||
Commands::FocusEmpty => {
|
||||
select_workspace(&get_empty_workspace());
|
||||
},
|
||||
}
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
# vim:ft=dircolors
|
||||
# (This is not a dircolors file but it helps to highlight colors and comments)
|
||||
|
||||
# default values from dircolors
|
||||
# (entries with a leading # are not implemented in lf)
|
||||
# #no 00 # NORMAL
|
||||
# fi 00 # FILE
|
||||
# #rs 0 # RESET
|
||||
# di 01;34 # DIR
|
||||
# ln 01;36 # LINK
|
||||
# #mh 00 # MULTIHARDLINK
|
||||
# pi 40;33 # FIFO
|
||||
# so 01;35 # SOCK
|
||||
# #do 01;35 # DOOR
|
||||
# bd 40;33;01 # BLK
|
||||
# cd 40;33;01 # CHR
|
||||
# or 40;31;01 # ORPHAN
|
||||
# #mi 00 # MISSING
|
||||
# su 37;41 # SETUID
|
||||
# sg 30;43 # SETGID
|
||||
# #ca 30;41 # CAPABILITY
|
||||
# tw 30;42 # STICKY_OTHER_WRITABLE
|
||||
# ow 34;42 # OTHER_WRITABLE
|
||||
# st 37;44 # STICKY
|
||||
# ex 01;32 # EXEC
|
||||
|
||||
# default values from lf (with matching order)
|
||||
# ln 01;36 # LINK
|
||||
# or 31;01 # ORPHAN
|
||||
# tw 01;34 # STICKY_OTHER_WRITABLE
|
||||
# ow 01;34 # OTHER_WRITABLE
|
||||
# st 01;34 # STICKY
|
||||
# di 01;34 # DIR
|
||||
# pi 33 # FIFO
|
||||
# so 01;35 # SOCK
|
||||
# bd 33;01 # BLK
|
||||
# cd 33;01 # CHR
|
||||
# su 01;32 # SETUID
|
||||
# sg 01;32 # SETGID
|
||||
# ex 01;32 # EXEC
|
||||
# fi 00 # FILE
|
||||
|
||||
# file types (with matching order)
|
||||
ln 01;36 # LINK
|
||||
or 31;01 # ORPHAN
|
||||
tw 34 # STICKY_OTHER_WRITABLE
|
||||
ow 34 # OTHER_WRITABLE
|
||||
st 01;34 # STICKY
|
||||
di 01;34 # DIR
|
||||
pi 33 # FIFO
|
||||
so 01;35 # SOCK
|
||||
bd 33;01 # BLK
|
||||
cd 33;01 # CHR
|
||||
su 01;32 # SETUID
|
||||
sg 01;32 # SETGID
|
||||
ex 01;32 # EXEC
|
||||
fi 00 # FILE
|
||||
|
||||
# archives or compressed (dircolors defaults)
|
||||
*.tar 01;31
|
||||
*.tgz 01;31
|
||||
*.arc 01;31
|
||||
*.arj 01;31
|
||||
*.taz 01;31
|
||||
*.lha 01;31
|
||||
*.lz4 01;31
|
||||
*.lzh 01;31
|
||||
*.lzma 01;31
|
||||
*.tlz 01;31
|
||||
*.txz 01;31
|
||||
*.tzo 01;31
|
||||
*.t7z 01;31
|
||||
*.zip 01;31
|
||||
*.z 01;31
|
||||
*.dz 01;31
|
||||
*.gz 01;31
|
||||
*.lrz 01;31
|
||||
*.lz 01;31
|
||||
*.lzo 01;31
|
||||
*.xz 01;31
|
||||
*.zst 01;31
|
||||
*.tzst 01;31
|
||||
*.bz2 01;31
|
||||
*.bz 01;31
|
||||
*.tbz 01;31
|
||||
*.tbz2 01;31
|
||||
*.tz 01;31
|
||||
*.deb 01;31
|
||||
*.rpm 01;31
|
||||
*.jar 01;31
|
||||
*.war 01;31
|
||||
*.ear 01;31
|
||||
*.sar 01;31
|
||||
*.rar 01;31
|
||||
*.alz 01;31
|
||||
*.ace 01;31
|
||||
*.zoo 01;31
|
||||
*.cpio 01;31
|
||||
*.7z 01;31
|
||||
*.rz 01;31
|
||||
*.cab 01;31
|
||||
*.wim 01;31
|
||||
*.swm 01;31
|
||||
*.dwm 01;31
|
||||
*.esd 01;31
|
||||
|
||||
# image formats (dircolors defaults)
|
||||
*.jpg 01;35
|
||||
*.jpeg 01;35
|
||||
*.mjpg 01;35
|
||||
*.mjpeg 01;35
|
||||
*.gif 01;35
|
||||
*.bmp 01;35
|
||||
*.pbm 01;35
|
||||
*.pgm 01;35
|
||||
*.ppm 01;35
|
||||
*.tga 01;35
|
||||
*.xbm 01;35
|
||||
*.xpm 01;35
|
||||
*.tif 01;35
|
||||
*.tiff 01;35
|
||||
*.png 01;35
|
||||
*.svg 01;35
|
||||
*.svgz 01;35
|
||||
*.mng 01;35
|
||||
*.pcx 01;35
|
||||
*.mov 01;35
|
||||
*.mpg 01;35
|
||||
*.mpeg 01;35
|
||||
*.m2v 01;35
|
||||
*.mkv 01;35
|
||||
*.webm 01;35
|
||||
*.ogm 01;35
|
||||
*.mp4 01;35
|
||||
*.m4v 01;35
|
||||
*.mp4v 01;35
|
||||
*.vob 01;35
|
||||
*.qt 01;35
|
||||
*.nuv 01;35
|
||||
*.wmv 01;35
|
||||
*.asf 01;35
|
||||
*.rm 01;35
|
||||
*.rmvb 01;35
|
||||
*.flc 01;35
|
||||
*.avi 01;35
|
||||
*.fli 01;35
|
||||
*.flv 01;35
|
||||
*.gl 01;35
|
||||
*.dl 01;35
|
||||
*.xcf 01;35
|
||||
*.xwd 01;35
|
||||
*.yuv 01;35
|
||||
*.cgm 01;35
|
||||
*.emf 01;35
|
||||
*.ogv 01;35
|
||||
*.ogx 01;35
|
||||
|
||||
# audio formats (dircolors defaults)
|
||||
*.aac 00;36
|
||||
*.au 00;36
|
||||
*.flac 00;36
|
||||
*.m4a 00;36
|
||||
*.mid 00;36
|
||||
*.midi 00;36
|
||||
*.mka 00;36
|
||||
*.mp3 00;36
|
||||
*.mpc 00;36
|
||||
*.ogg 00;36
|
||||
*.ra 00;36
|
||||
*.wav 00;36
|
||||
*.oga 00;36
|
||||
*.opus 00;36
|
||||
*.spx 00;36
|
||||
*.xspf 00;36
|
|
@ -0,0 +1,77 @@
|
|||
di
|
||||
fi 📃
|
||||
tw 🤝
|
||||
ow 📂
|
||||
ln ⛓
|
||||
or ❌
|
||||
ex 🎯
|
||||
*.txt ✍
|
||||
*.mom ✍
|
||||
*.me ✍
|
||||
*.ms ✍
|
||||
*.avif 🖼
|
||||
*.png 🖼
|
||||
*.webp 🖼
|
||||
*.ico 🖼
|
||||
*.jpg 📸
|
||||
*.jpe 📸
|
||||
*.jpeg 📸
|
||||
*.gif 🖼
|
||||
*.svg 🗺
|
||||
*.tif 🖼
|
||||
*.tiff 🖼
|
||||
*.xcf 🖌
|
||||
*.html 🌎
|
||||
*.xml 📰
|
||||
*.gpg 🔒
|
||||
*.css 🎨
|
||||
*.pdf 📚
|
||||
*.djvu 📚
|
||||
*.epub 📚
|
||||
*.csv 📓
|
||||
*.xlsx 📓
|
||||
*.tex 📜
|
||||
*.md 📘
|
||||
*.r 📊
|
||||
*.R 📊
|
||||
*.rmd 📊
|
||||
*.Rmd 📊
|
||||
*.m 📊
|
||||
*.mp3 🎵
|
||||
*.opus 🎵
|
||||
*.ogg 🎵
|
||||
*.m4a 🎵
|
||||
*.flac 🎼
|
||||
*.wav 🎼
|
||||
*.mkv 🎥
|
||||
*.mp4 🎥
|
||||
*.webm 🎥
|
||||
*.mpeg 🎥
|
||||
*.avi 🎥
|
||||
*.mov 🎥
|
||||
*.mpg 🎥
|
||||
*.wmv 🎥
|
||||
*.m4b 🎥
|
||||
*.flv 🎥
|
||||
*.zip 📦
|
||||
*.rar 📦
|
||||
*.7z 📦
|
||||
*.tar 📦
|
||||
*.z64 🎮
|
||||
*.v64 🎮
|
||||
*.n64 🎮
|
||||
*.gba 🎮
|
||||
*.nes 🎮
|
||||
*.gdi 🎮
|
||||
*.1 ℹ
|
||||
*.nfo ℹ
|
||||
*.info ℹ
|
||||
*.log 📙
|
||||
*.iso 📀
|
||||
*.img 📀
|
||||
*.bib 🎓
|
||||
*.ged 👪
|
||||
*.part 💔
|
||||
*.torrent 🔽
|
||||
*.jar ♨
|
||||
*.java ♨
|
|
@ -0,0 +1,22 @@
|
|||
set icons true
|
||||
set autoquit true
|
||||
set mouse true
|
||||
set number true
|
||||
set relativenumber true
|
||||
set cursorpreviewfmt ""
|
||||
|
||||
cmd q quit
|
||||
|
||||
map <backspace2> quit
|
||||
map <c-e> half-up
|
||||
map . set hidden!
|
||||
map o $nvim -c "lua require(\"oil\").open(\"$PWD\")"
|
||||
map - $nvim -c "lua require(\"oil\").open(\"$PWD\")"
|
||||
map <enter> open
|
||||
|
||||
cmd jump ${{
|
||||
res=$(zsh -c "source $HOME/.zshrc && find_global d")
|
||||
lf -remote "send $id cd \"$res\""
|
||||
}}
|
||||
|
||||
map <c-t> :jump <enter>
|
|
@ -14,6 +14,7 @@ return {
|
|||
TelescopePromptBorder = { bg = "#191926", fg = "#191926" },
|
||||
TelescopeTitle = { fg = colors.blue },
|
||||
WinSeparator = { fg = "#023269" },
|
||||
FlashCursor = { bg = colors.red },
|
||||
}
|
||||
end,
|
||||
color_overrides = {
|
||||
|
|
|
@ -19,7 +19,7 @@ return {
|
|||
["<leader>v"] = "actions.select_vsplit",
|
||||
["<leader>s"] = "actions.select_split",
|
||||
["<leader>p"] = "actions.preview",
|
||||
["<backspace>"] = "actions.close",
|
||||
["<backspace>"] = function() vim.cmd("q!") end,
|
||||
["<leader>r"] = "actions.refresh",
|
||||
["-"] = function() require("oil").open(); save_dir() end,
|
||||
["_"] = "actions.open_cwd",
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
servers=(Mallorea Kell Riva Vault Aloria Arendia)
|
||||
selected=$(for server in "${servers[@]}"; do printf "%s\0icon\x1fterminal\n" "$server"; done | rofi -dmenu -i)
|
||||
if [ -z "$selected" ]; then
|
||||
exit 1
|
||||
fi
|
||||
alacritty -e zsh -c "source ~/.zshrc && run_waypipe $selected"
|
|
@ -19,6 +19,11 @@ setopt autocd
|
|||
# to add other keys to this hash, see: man 5 terminfo
|
||||
typeset -g -A key
|
||||
|
||||
# We need this here since it's used below
|
||||
if command -v fdfind &> /dev/null; then
|
||||
alias fd="fdfind"
|
||||
fi
|
||||
|
||||
# Use vi-mode
|
||||
source ${XDG_CONFIG_HOME}/zsh/zsh-vi-mode/zsh-vi-mode.plugin.zsh
|
||||
ZVM_VI_INSERT_ESCAPE_BINDKEY=jj
|
||||
|
@ -33,6 +38,78 @@ if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
|||
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
|
||||
fi
|
||||
|
||||
function cd_to() {
|
||||
setopt localoptions pipefail no_aliases 2> /dev/null
|
||||
local dir=$1
|
||||
if [[ -z "$dir" ]]; then
|
||||
zle redisplay
|
||||
return 0
|
||||
fi
|
||||
zle push-line # Clear buffer. Auto-restored on next prompt.
|
||||
cd $dir
|
||||
zle accept-line
|
||||
local ret=$?
|
||||
unset dir # ensure this doesn't end up appearing in prompt expansion
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
function find_local() {
|
||||
fd . -t $1 | fzy -l 20
|
||||
}
|
||||
|
||||
function find_global() {
|
||||
file_type=$1
|
||||
FZY_CACHE=~/.cache/fzy_paths_$file_type
|
||||
if [ -f $FZY_CACHE ]; then
|
||||
if [ $(stat -c %Y $FZY_CACHE) -lt $(date +%s -d '-1 day') ]; then
|
||||
rm $FZY_CACHE
|
||||
fi
|
||||
fi
|
||||
if [ ! -f $FZY_CACHE ]; then
|
||||
PATHS="$(/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME ls-files)"
|
||||
if [ "$file_type" = "d" ]; then
|
||||
PATHS="$(echo -e $PATHS | xargs -n 1 dirname | uniq | grep -v '^\.$' | parallel echo ~/{})"
|
||||
else
|
||||
PATHS="$(echo -e $PATHS | parallel echo ~/{})"
|
||||
fi
|
||||
search_dirs=(~/Workspace/ ~/Containers/ /home/server/Storage/Thomas/)
|
||||
for i in "$search_dirs[@]"; do
|
||||
if [ -d $i ]; then
|
||||
PATHS="$PATHS\n$i"
|
||||
PATHS+="\n$(fd . $i -t $file_type -d 8)"
|
||||
fi
|
||||
done
|
||||
echo -e "$PATHS" > $FZY_CACHE
|
||||
fi
|
||||
file="$(cat $FZY_CACHE | fzy -l 20)"
|
||||
echo $file | cat - $FZY_CACHE | awk '!x[$0]++' > /tmp/fzy_paths_$file_type && mv /tmp/fzy_paths_$file_type $FZY_CACHE
|
||||
echo $file
|
||||
}
|
||||
|
||||
function open_path() {
|
||||
file_type=$1
|
||||
search_fn=$2
|
||||
selection="$($search_fn $file_type)"
|
||||
if [ "$selection" = "" ]; then
|
||||
zle reset-prompt
|
||||
return
|
||||
fi
|
||||
if [ "$LBUFFER" = "" ]; then
|
||||
if [ "$file_type" = "d" ]; then
|
||||
cd_to "$selection"
|
||||
else
|
||||
selection=$(realpath "$selection")
|
||||
cd_to "$(dirname $selection)"
|
||||
nvim "$selection"
|
||||
fi
|
||||
else
|
||||
emulate -L zsh
|
||||
zle -I
|
||||
LBUFFER="${LBUFFER}\"$selection\""
|
||||
zle reset-prompt
|
||||
fi
|
||||
}
|
||||
|
||||
function zvm_after_init() {
|
||||
key[Home]="${terminfo[khome]}"
|
||||
key[End]="${terminfo[kend]}"
|
||||
|
@ -85,97 +162,33 @@ function zvm_after_init() {
|
|||
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
fi
|
||||
|
||||
function cd_to() {
|
||||
setopt localoptions pipefail no_aliases 2> /dev/null
|
||||
local dir=$1
|
||||
if [[ -z "$dir" ]]; then
|
||||
zle redisplay
|
||||
return 0
|
||||
fi
|
||||
zle push-line # Clear buffer. Auto-restored on next prompt.
|
||||
cd $dir
|
||||
zle accept-line
|
||||
local ret=$?
|
||||
unset dir # ensure this doesn't end up appearing in prompt expansion
|
||||
zle reset-prompt
|
||||
function open_global_path_d() { open_path d find_global }
|
||||
function open_global_path_f() { open_path f find_global }
|
||||
function open_local() { open_path f find_local }
|
||||
|
||||
zle -N push_local_files
|
||||
zle -N find_local_directories
|
||||
|
||||
function register_key() {
|
||||
zle -N $2
|
||||
bindkey "^$1" $2
|
||||
bindkey -M emacs "^$1" $2
|
||||
bindkey -M vicmd "^$1" $2
|
||||
bindkey -M viins "^$1" $2
|
||||
}
|
||||
|
||||
# Use FZY instead of FZF for ctrl-t
|
||||
function find_global_files() {
|
||||
zle -I
|
||||
FZY_CACHE=~/.cache/fzy_paths
|
||||
if [ -f $FZY_CACHE ]; then
|
||||
# Check if cache is older than 1 day
|
||||
if [ $(($(date +%s) - $(date -r $FZY_CACHE +%s))) -gt 86400 ]; then
|
||||
rm $FZY_CACHE
|
||||
fi
|
||||
fi
|
||||
if [ ! -f $FZY_CACHE ]; then
|
||||
PATHS=""
|
||||
search_dirs=(~/.config/waybar/ \
|
||||
~/.config/xmodmap/ \
|
||||
~/.config/zsh/ \
|
||||
~/.config/tmux/ \
|
||||
~/.config/vim/ \
|
||||
~/.config/qtile/ \
|
||||
~/.config/rofi/ \
|
||||
~/.config/scripts/ \
|
||||
~/.config/nvim/ \
|
||||
~/.config/picom/ \
|
||||
~/.config/polybar/ \
|
||||
~/.config/awesome/ \
|
||||
~/.config/dunst/ \
|
||||
~/.config/firefox/ \
|
||||
~/.config/git/ \
|
||||
~/.config/gitui/ \
|
||||
~/.config/helix/ \
|
||||
~/.config/hypr/ \
|
||||
~/.config/i3/ \
|
||||
~/.config/kitty/ \
|
||||
~/.config/mpv/ \
|
||||
~/.config/alacritty/ \
|
||||
~/Workspace/ \
|
||||
~/Containers/ \
|
||||
~/Storage/Shared/ \
|
||||
~/Storage/Thomas/ \
|
||||
)
|
||||
|
||||
for i in $search_dirs ; do
|
||||
if [ -d $i ]; then
|
||||
PATHS="$PATHS\n$i"
|
||||
PATHS="$PATHS\n$(fd . $i -t d -d 5)"
|
||||
fi
|
||||
done
|
||||
echo -e $PATHS > $FZY_CACHE
|
||||
fi
|
||||
cd_to "$(cat $FZY_CACHE | fzy -l 20)"
|
||||
}
|
||||
|
||||
function find_local_files() {
|
||||
zle -I
|
||||
cd_to "$(fd . -t d | fzy -l 20)"
|
||||
}
|
||||
|
||||
zle -N find_global_files
|
||||
zle -N find_local_files
|
||||
|
||||
bindkey "^T" find_global_files
|
||||
bindkey -M emacs "^T" find_global_files
|
||||
bindkey -M vicmd "^T" find_global_files
|
||||
bindkey -M viins "^T" find_global_files
|
||||
|
||||
bindkey "^Y" find_local_files
|
||||
bindkey -M emacs "^Y" find_local_files
|
||||
bindkey -M vicmd "^Y" find_local_files
|
||||
bindkey -M viins "^Y" find_local_files
|
||||
|
||||
register_key "T" open_global_path_d
|
||||
register_key "E" open_global_path_f
|
||||
register_key "W" open_local
|
||||
|
||||
if [ "$SSH_SESSION_ID" != "" ]; then
|
||||
mkdir -p /tmp/ssh_sessions
|
||||
echo $$ > /tmp/ssh_sessions/"$SSH_SESSION_ID"
|
||||
fi
|
||||
if [ "$REMOTE_PATH" != "" ]; then
|
||||
if [ -d "$REMOTE_PATH" ]; then
|
||||
cd "$REMOTE_PATH"
|
||||
fi
|
||||
elif [ "$PREVIOUS_SESSION_ID" != "" ]; then
|
||||
cd "$(readlink -e /proc/$(cat /tmp/ssh_sessions/$PREVIOUS_SESSION_ID)/cwd)"
|
||||
fi
|
||||
|
@ -243,6 +256,23 @@ function xterm_title_preexec () {
|
|||
print -Pn -- '\e]2;' && print -n -- "${(q)1}\a"
|
||||
}
|
||||
|
||||
|
||||
if [[ "$TERM" == (Eterm*|alacritty*|aterm*|gnome*|konsole*|kterm*|putty*|rxvt*|screen*|tmux*|xterm*) ]]; then
|
||||
add-zsh-hook -Uz precmd xterm_title_precmd
|
||||
add-zsh-hook -Uz preexec xterm_title_preexec
|
||||
fi
|
||||
|
||||
|
||||
###########################################
|
||||
# Aliases
|
||||
###########################################
|
||||
|
||||
if [[ "$(hostname)" == "mallorea" ]]; then
|
||||
alias lf="/usr/bin/lf -last-dir-path /tmp/lf_dir && cd \"\$(cat /tmp/lf_dir 2> /dev/null || pwd)\""
|
||||
else
|
||||
alias lf="cd \"\$(/usr/bin/lf -print-selection -print-last-dir)\""
|
||||
fi
|
||||
|
||||
function o () {
|
||||
xdg-open "$1" &!
|
||||
}
|
||||
|
@ -253,32 +283,29 @@ function run_waypipe() {
|
|||
SSH_SESSION_ID=$SSH_SESSION_ID waypipe ssh -t $1 env REMOTE_PATH=\"$REMOTE_PATH\" SSH_SESSION_ID=$SSH_SESSION_ID "zsh --login"
|
||||
}
|
||||
|
||||
function git() {
|
||||
if [ "$HOME" = "$(pwd)" ]; then
|
||||
/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME" "$@"
|
||||
else
|
||||
/usr/bin/git "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
alias mallorea="run_waypipe mallorea"
|
||||
alias vault="run_waypipe vault"
|
||||
alias riva="run_waypipe riva"
|
||||
alias kell="run_waypipe kell"
|
||||
alias aloria="run_waypipe aloria"
|
||||
|
||||
if [[ "$TERM" == (Eterm*|alacritty*|aterm*|gnome*|konsole*|kterm*|putty*|rxvt*|screen*|tmux*|xterm*) ]]; then
|
||||
add-zsh-hook -Uz precmd xterm_title_precmd
|
||||
add-zsh-hook -Uz preexec xterm_title_preexec
|
||||
fi
|
||||
|
||||
# Aliases
|
||||
if command -v fdfind &> /dev/null; then
|
||||
alias fd="fdfind"
|
||||
fi
|
||||
alias ls="ls --color=auto"
|
||||
alias gdb='gdb -q'
|
||||
alias ll='ls -lhat'
|
||||
alias clip="xsel --clipboard"
|
||||
alias compress="tar --use-compress-program=lbzip2 -cvf"
|
||||
alias vim="nvim"
|
||||
alias dot='/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"'
|
||||
alias dot='/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME" "$@"'
|
||||
alias wget=wget --hsts-file="$XDG_DATA_HOME/wget-hsts"
|
||||
alias xbindkeys="xbindkeys -f $XDG_CONFIG_HOME/xbindkeys/config"
|
||||
alias python=python3
|
||||
alias r=". ranger"
|
||||
alias v="vim . && cd \"\$(cat /tmp/oil_dir 2> /dev/null || pwd)\""
|
||||
alias v="nvim -c ':lua require(\"oil\").open()' && cd \"\$(cat /tmp/oil_dir 2> /dev/null || pwd)\""
|
||||
alias cpr="rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1"
|
||||
alias mvr="rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files"
|
||||
alias rg="rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
text/html; w3m -dump -o -document_charset=%{charset} %s; nametemplate=%s.html; copiousoutput
|
|
@ -0,0 +1,83 @@
|
|||
# .notmuch-config - Configuration file for the notmuch mail system
|
||||
#
|
||||
# For more information about notmuch, see https://notmuchmail.org
|
||||
# Database configuration
|
||||
#
|
||||
# The only value supported here is 'path' which should be the top-level
|
||||
# directory where your mail currently exists and to where mail will be
|
||||
# delivered in the future. Files should be individual email messages.
|
||||
# Notmuch will store its database within a sub-directory of the path
|
||||
# configured here named ".notmuch".
|
||||
#
|
||||
[database]
|
||||
path=/home/user/.config/aerc/mail
|
||||
|
||||
# User configuration
|
||||
#
|
||||
# Here is where you can let notmuch know how you would like to be
|
||||
# addressed. Valid settings are
|
||||
#
|
||||
# name Your full name.
|
||||
# primary_email Your primary email address.
|
||||
# other_email A list (separated by ';') of other email addresses
|
||||
# at which you receive email.
|
||||
#
|
||||
# Notmuch will use the various email addresses configured here when
|
||||
# formatting replies. It will avoid including your own addresses in the
|
||||
# recipient list of replies, and will set the From address based on the
|
||||
# address to which the original email was addressed.
|
||||
#
|
||||
[user]
|
||||
name=Thomas Avé
|
||||
primary_email=email@thomasave.be
|
||||
other_email=Thomas.Ave@uantwerpen.be;Thomas.Ave@imec.be;
|
||||
|
||||
# Configuration for "notmuch new"
|
||||
#
|
||||
# The following options are supported here:
|
||||
#
|
||||
# tags A list (separated by ';') of the tags that will be
|
||||
# added to all messages incorporated by "notmuch new".
|
||||
#
|
||||
# ignore A list (separated by ';') of file and directory names
|
||||
# that will not be searched for messages by "notmuch new".
|
||||
#
|
||||
# NOTE: *Every* file/directory that goes by one of those
|
||||
# names will be ignored, independent of its depth/location
|
||||
# in the mail store.
|
||||
#
|
||||
[new]
|
||||
# Search configuration
|
||||
#
|
||||
# The following option is supported here:
|
||||
#
|
||||
# exclude_tags
|
||||
# A ;-separated list of tags that will be excluded from
|
||||
# search results by default. Using an excluded tag in a
|
||||
# query will override that exclusion.
|
||||
#
|
||||
[search]
|
||||
# Maildir compatibility configuration
|
||||
#
|
||||
# The following option is supported here:
|
||||
#
|
||||
# synchronize_flags Valid values are true and false.
|
||||
#
|
||||
# If true, then the following maildir flags (in message filenames)
|
||||
# will be synchronized with the corresponding notmuch tags:
|
||||
#
|
||||
# Flag Tag
|
||||
# ---- -------
|
||||
# D draft
|
||||
# F flagged
|
||||
# P passed
|
||||
# R replied
|
||||
# S unread (added when 'S' flag is not present)
|
||||
#
|
||||
# The "notmuch new" command will notice flag changes in filenames
|
||||
# and update tags, while the "notmuch tag" and "notmuch restore"
|
||||
# commands will notice tag changes and update flags in filenames
|
||||
exclude_tags=deleted;spam;
|
||||
|
||||
[maildir]
|
||||
synchronize_flags=true
|
Loading…
Reference in New Issue