Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-welcome
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-welcome
Commits
f666b4a9
Commit
f666b4a9
authored
Feb 06, 2025
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --autostarted flag
parent
93f6a97f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
application.rs
src/application.rs
+42
-1
No files found.
src/application.rs
View file @
f666b4a9
use
std
::
env
;
use
std
::
path
::
Path
;
use
adw
::{
prelude
::
*
,
subclass
::
prelude
::
*
};
use
adw
::{
prelude
::
*
,
subclass
::
prelude
::
*
};
use
gtk
::{
gio
,
glib
};
use
gtk
::{
gio
,
glib
};
...
@@ -67,7 +70,45 @@ impl Application {
...
@@ -67,7 +70,45 @@ impl Application {
log
::
info!
(
"Ximper Welcome ({})"
,
config
::
APP_ID
);
log
::
info!
(
"Ximper Welcome ({})"
,
config
::
APP_ID
);
log
::
info!
(
"Version: {} ({})"
,
config
::
VERSION
,
config
::
PROFILE
);
log
::
info!
(
"Version: {} ({})"
,
config
::
VERSION
,
config
::
PROFILE
);
log
::
info!
(
"Datadir: {}"
,
config
::
PKGDATADIR
);
log
::
info!
(
"Datadir: {}"
,
config
::
PKGDATADIR
);
Self
::
default
()
.run
()
let
app
=
Self
::
default
();
app
.add_main_option
(
"autostarted"
,
glib
::
Char
::
from
(
b
'a'
),
glib
::
OptionFlags
::
NONE
,
glib
::
OptionArg
::
None
,
"Indicates that the application was autostarted"
,
None
,
);
let
args
:
Vec
<
String
>
=
env
::
args
()
.collect
();
let
autostarted
=
args
.iter
()
.any
(|
arg
|
arg
==
"--autostarted"
);
if
autostarted
{
let
home_dir
=
match
env
::
var
(
"HOME"
)
{
Ok
(
home
)
=>
home
,
Err
(
e
)
=>
{
log
::
error!
(
"Не удалось получить домашний каталог: {}"
,
e
);
return
glib
::
ExitCode
::
FAILURE
;
}
};
let
config_path
=
Path
::
new
(
&
home_dir
)
.join
(
".config/ximper-welcome-dont-start"
);
if
config_path
.exists
()
{
log
::
info!
(
"Файл автозапуска существует, выход."
);
return
glib
::
ExitCode
::
SUCCESS
;
}
match
std
::
fs
::
File
::
create
(
&
config_path
)
{
Ok
(
_
)
=>
log
::
info!
(
"Файл автозапуска создан."
),
Err
(
e
)
=>
{
log
::
error!
(
"Ошибка создания файла: {}"
,
e
);
return
glib
::
ExitCode
::
FAILURE
;
}
}
}
app
.run
()
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment