Compare commits
3 commits
4161bdb411
...
9cd2d75890
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cd2d75890 | ||
|
|
665eb290cb | ||
|
|
400a3f59de |
5 changed files with 75 additions and 11 deletions
|
|
@ -1,7 +1,10 @@
|
|||
[package]
|
||||
name = "sway-de-utils"
|
||||
version = "0.1.0"
|
||||
authors = ["Penelope Gwen <support@pogmom.me>"]
|
||||
edition = "2024"
|
||||
license-file = "LICENSE.md"
|
||||
description = "A collection of utility commands which help manage a multiple-workspace setup in Sway"
|
||||
|
||||
[[bin]]
|
||||
name = "sdu"
|
||||
|
|
|
|||
60
LICENSE.md
Normal file
60
LICENSE.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# 🏳️🌈 Opinionated Queer License v1.3
|
||||
|
||||
© Copyright {Licensor}
|
||||
|
||||
## Permissions
|
||||
|
||||
The creators of this Work (“The Licensor”) grant permission
|
||||
to any person, group or legal entity that doesn't violate the prohibitions below (“The User”),
|
||||
to do everything with this Work that would otherwise infringe their copyright or any patent claims,
|
||||
subject to the following conditions:
|
||||
|
||||
## Obligations
|
||||
|
||||
The User must give appropriate credit to the Licensor,
|
||||
provide a copy of this license or a (clickable, if the medium allows) link to
|
||||
[oql.avris.it/license/v1.3](https://oql.avris.it/license/v1.3),
|
||||
and indicate whether and what kind of changes were made.
|
||||
The User may do so in any reasonable manner,
|
||||
but not in any way that suggests the Licensor endorses the User or their use.
|
||||
|
||||
## Prohibitions
|
||||
|
||||
No one may use this Work for prejudiced or bigoted purposes, including but not limited to:
|
||||
racism, xenophobia, queerphobia, queer exclusionism, homophobia, transphobia, enbyphobia, misogyny.
|
||||
|
||||
No one may use this Work to inflict or facilitate violence or abuse of human rights,
|
||||
as defined in either of the following documents:
|
||||
[Universal Declaration of Human Rights](https://www.un.org/en/about-us/universal-declaration-of-human-rights),
|
||||
[European Convention on Human Rights](https://prd-echr.coe.int/web/echr/european-convention-on-human-rights)
|
||||
along with the rulings of the [European Court of Human Rights](https://www.echr.coe.int/).
|
||||
|
||||
No entity that commits such abuses or materially supports entities that do
|
||||
may use the Work for any reason.
|
||||
|
||||
No law enforcement, carceral institutions, immigration enforcement entities, military entities or military contractors
|
||||
may use the Work for any reason. This also applies to any individuals employed by those entities.
|
||||
|
||||
No business entity where the ratio of pay (salaried, freelance, stocks, or other benefits)
|
||||
between the highest and lowest individual in the entity is greater than 50 : 1
|
||||
may use the Work for any reason.
|
||||
|
||||
No private business run for profit with more than a thousand employees
|
||||
may use the Work for any reason.
|
||||
|
||||
Unless the User has made substantial changes to the Work,
|
||||
or uses it only as a part of a new work (eg. as a library, as a part of an anthology, etc.),
|
||||
they are prohibited from selling the Work.
|
||||
That prohibition includes processing the Work with machine learning models.
|
||||
|
||||
## Sanctions
|
||||
|
||||
If the Licensor notifies the User that they have not complied with the rules of the license,
|
||||
they can keep their license by complying within 30 days after the notice.
|
||||
If they do not do so, their license ends immediately.
|
||||
|
||||
## Warranty
|
||||
|
||||
This Work is provided “as is”, without warranty of any kind, express or implied.
|
||||
The Licensor will not be liable to anyone for any damages related to the Work or this license,
|
||||
under any kind of legal claim as far as the law allows.
|
||||
|
|
@ -16,9 +16,9 @@ SDU is a tool heavily targeting my own personal use-cases. It is a collection of
|
|||
append `--release` for a release build
|
||||
|
||||
### Debian
|
||||
```
|
||||
todo
|
||||
```
|
||||
|
||||
`cargo-deb`
|
||||
|
||||
## Usage
|
||||
|
||||
`sdu --help` for now
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub fn profile(profile_command: &ProfileCommand, profiles_config: Vec<Profile>,
|
|||
let active_profile_index = active_profile_index();
|
||||
match switch_by_index(profiles_config, active_profile_index, preserve_keyboard_order) {
|
||||
Ok(_) => {
|
||||
let _: () = debug!("successfully initialized sway-desktop-utils");
|
||||
let _: () = debug!("successfully initialized sway-de-utils");
|
||||
Ok(())
|
||||
},
|
||||
Err(e) => Err(e),
|
||||
|
|
@ -85,7 +85,7 @@ pub fn profile(profile_command: &ProfileCommand, profiles_config: Vec<Profile>,
|
|||
let profile_detail = get_command.clone().unwrap_or(ProfileGetCommand::Json);
|
||||
println!("{}",get::profile_info(profiles_config.clone(),profile_detail.clone()));
|
||||
let _: () = if monitor.unwrap_or_default() {
|
||||
let _ = get::watch(profiles_config, profile_detail,get_xdg_dirs().runtime_dir.expect("XDG Runtime dir could not be found").join("sway-desktop-utils/active-profile.json").to_str().expect("could not create str from path").to_string());
|
||||
let _ = get::watch(profiles_config, profile_detail,get_xdg_dirs().runtime_dir.expect("XDG Runtime dir could not be found").join("sway-de-utils/active-profile.json").to_str().expect("could not create str from path").to_string());
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -113,7 +113,7 @@ pub fn initialize(mut sway_connection: Connection, profile: Profile,uindex: usiz
|
|||
};
|
||||
|
||||
let base_directories = BaseDirectories::new();
|
||||
let active_profile_cache = base_directories.get_runtime_directory().expect("why tf do xdg dirs not exist").join("sway-desktop-utils/active-profile.json");
|
||||
let active_profile_cache = base_directories.get_runtime_directory().expect("why tf do xdg dirs not exist").join("sway-de-utils/active-profile.json");
|
||||
let active_profile = json!(uindex);
|
||||
|
||||
DirBuilder::new().recursive(true).create(active_profile_cache.parent().expect("Unable to determine cache dir")).expect("Failed to create cache directory");
|
||||
|
|
@ -165,7 +165,8 @@ pub fn switch_by_name(profiles_config: Vec<Profile>,name: String,preserve_keyboa
|
|||
|
||||
pub fn active_profile_index() -> usize {
|
||||
let base_directories = BaseDirectories::new();
|
||||
let active_profile_cache_json = base_directories.get_runtime_directory().expect("xdg dirs do not exist?").join("sway-desktop-utils/active-profile.json");
|
||||
let active_profile_cache_json = base_directories.get_runtime_directory().expect("xdg dirs do not exist?").join("sway-de-utils/active-profile.json");
|
||||
|
||||
if active_profile_cache_json.exists() {
|
||||
fs::File::open(active_profile_cache_json).ok()
|
||||
.and_then(|f|serde_json::from_reader::<fs::File,usize>(f).ok())
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ pub struct SDUError {
|
|||
}
|
||||
|
||||
pub fn setup_runtime_dir(xdg_directories: BaseDirectories) {
|
||||
match xdg_directories.create_runtime_directory("sway-desktop-utils") {
|
||||
match xdg_directories.create_runtime_directory("sway-de-utils") {
|
||||
Ok(_) => debug!("created runtime directories"),
|
||||
Err(_) => debug!("failed to create runtime directories"),
|
||||
}
|
||||
|
|
@ -72,10 +72,10 @@ pub fn get_xdg_dirs() -> BaseDirectories {
|
|||
fn main() -> Result<(),()> {
|
||||
env_logger::init();
|
||||
let cli = Cli::parse();
|
||||
let config = if confy::get_configuration_file_path("sway-desktop-utils", "config").expect("Unable to determine config file location").exists() {
|
||||
confy::load("sway-desktop-utils", "config").unwrap_or_default()
|
||||
let config = if confy::get_configuration_file_path("sway-de-utils", "config").expect("Unable to determine config file location").exists() {
|
||||
confy::load("sway-de-utils", "config").unwrap_or_default()
|
||||
} else {
|
||||
let _ = confy::store("sway-desktop-utils", "config", Config::default());
|
||||
let _ = confy::store("sway-de-utils", "config", Config::default());
|
||||
Config::default()
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue